pascal betz

Ranch Hand
+ Follow
since Jun 19, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by pascal betz

For me it was an additional line break in the JNDI Name field of the DataSource. Took me a while...
9 years ago

Code not written usually has very few bugs.

Code i write does not have bugs :-)

I was thinking along the "store expression and the next event in cleartext" too. I think this is the way to go or at least to thing to start with.

Thanks for your hints.

The application has one part which is some sort of Calendar app -> user can enter events (i.e. Birthday of my Grandmother at 28. March 1933) and register reminders (send me an email two weeks before the event starts and a Textmessage 6 hours before the event starts). Also the user should be able to get a view of events in the future.
So thats why i want to store the events and the reminder actions in the DB.

Since my Grandmothers celebrates here Birthday once a year i need the reminders every year (recurrent events). And thats where im not clear how to do this.

I could add only the first ocurrence of the event (date of birth) and the reccurent mode (No recurrence, yearly, monthly, ...) or i could store 120 entries (1933 - 2053). But how do i know how far in the future i should add the events ? what if the event is daily ? do i add 365 entries per year ?

Thanks for the hint. I'll look into quartz.
But to send notifications i would need to load all the events and parse the CRON string and see if i would need to fire a reminder action ? I need to think this trough :-)

Thanks for your help!

Hi All

I need to build an application which has some sort of
a calendar and reminder functionalities (i.e. remind me seven and three days before an event takes place).
events can be recurring (i.e. birtday -> yearly, pay the rent -> monthly and so on).

Im looking for a smart way to store these event dates (and notification "actions") in the DB.
My problem lies in the "recurring" feature. How do i store an event taking place once a week ? I can not make
52 entries in the DB per year. Or can i ? But also i can not only store the first event and then make some calculations in the DB. O can i ?

any ideas ? and pointers ? any recomended pattern ?

thanks and have a nice day.

why do you need the column names for that ?

if you want to stiore audit information, then take a look at hibernat intercepter and the hibernate event mechanism introduced in H3.

what do you define unwanted pixels ?
do you need to crop ? remove all red pixels ? paint an specified area green ?
do you need to resize ?

11 years ago
it seems like you should have a look at the different classes in the java API
there you see all the interfaces and implementations as well as the helper classes (e.g. Collections).

11 years ago
add a Session listener ?
11 years ago
sounds like homework...

what do you think ? why do you need to know ?

11 years ago
the validaiton rules are stored in DB ? and they tell you what rule to apply to what field ?

so ni your db you have something like

01| age | > | 18
02| color | == | "red"

and then you need to apply these rules to different objects ?

ok, that is pretty ugly pseudo code. There are lots of things to think about....
Null Values, Number vs. Strings. Where to store error messages ?

11 years ago
What have you tried so far ?

Have a look at String.substring, String.split, java.util.regexp....

Please reply ASAP.

11 years ago
uhmmm.... the hints you've got are pretty good. So why don't you check

- user input from the command line
- write to a text file
- create a timer in java
- read a text file and display on the screen

Where are you stuck ? What have you tried so far ? Whats's the Exception you are seeing ? What is it the compiler keeps complaining ?

11 years ago
Java does not (yet) support writing gif images due to license problems.
There are free libraries available for this thoug: one of them is net.jmge.gif.Gif89Encoder

Check it out and see if it helps you.

I would suggest you have a look at the so called tile based games. Even if your game background is not repetitive like in a stadnard tile based game you can use the aproach to improve performance of your game:

The background image is split into several tiles (probably square shaped images of say 64*64 pixels (usualy a power of 2).
If your view is 200 * 200 pixels then you need to show 4 * 4 images at once. Well i guess you get the picture (no pun intended :-)). Check out for an idea how this could work.
You will probably find code that does this if you do not want to do it yourself...

11 years ago

Ok, thanks for the reply but that didn't clear things up for me...
Let me ask another way. Which methods in which collections will automagically call hashCode() and equals() for me, behind the scene?

Just create a class, override the equals()/hashCode() methods (e.g. adding system out statements) and call the add/contains/remove methods of the various collection types and implementations to see which class calls the hashCode/equals method.
Also compare remove(int index) and remove(Object o). I would expect them to produce different results in termns of calling equals/hashCode.

how about HashSet vs. TreeSet ? From the name i am pretty sure HashSet will call at least the hashCode() method but what about the TreeSet ? And so on...

11 years ago

If we limit ourselves to jdk1.5+ are we safe?

As long as it is not in the spec then i would not buil on it. There are people around here who know the JLS and JVM Specs pretty good (obviously i am not one of those :-) ).

But right now, if you think that you need syncrhonization (probably pretty rare situations where you need it - different threads calling the equals() on the same instance ... but still required to make it work in 100% and not just 99.9%) then you'll need to sync the whole method/block.

Or you could avoid the lazy init ? Just create this Object upfront or in some init block ? Or use super.equals() (as long super class is java.lang.Object this should not make any difference ?). Early in the mornin' here... so i did not think this trough.

Stupid collections anyway. Why do they need equals/hashCode. Can't they just do the job without bothering programmers ? They should know if Objects are equal. Just like that. Can't be that hard :-)

11 years ago