Unnar Björnsson

Ranch Hand
+ Follow
since Apr 30, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
14
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Unnar Björnsson

Farakh khan wrote:

Unnar Björnsson wrote:Yes, google, facebook and many other websites that display live data all use Ajax to do so.


Can you please refer to any helpful link?

I am thankful to all for giving me your precious time



This one
11 years ago
Yes, google, facebook and many other websites that display live data all use Ajax to do so.
11 years ago
Singleton ensures that only one object has access to the database at a time, therefore reduces load and eliminates consistency issues between processes.
11 years ago

Farakh khan wrote:

Unnar Björnsson wrote:
Then the client can ask the server to process the next 100-1000 emails if there are any left to process.



Then if there are 50K emails in database then client will fed up to request again after 100 emails and say in case 1000k?



Well if there are 1 million email addresses in the database and each batch is 100 emails then you'd have to iterate 10 thousand times sure but, depending on the server you could probably process more emails at a time.

I also hope you have considered the general guidlines regarding bulk emailing as to not get your domain blacklisted or your messages flagged as spam.
11 years ago
The servlet runs code on server side, so you must be careful not to overload it with some large task. If you need to perform a large task that can be cut down into smaller ones you should do so.
I don't know where your list of emails comes from but lets say they are in a database on the server, you should write a function that gets only the first 100-1000 emails, processes them and returns a confirmation to the client.
Then the client can ask the server to process the next 100-1000 emails if there are any left to process.

1. n = 1
2. Client asks the server to process the n-th batch of emails
3. Server returns with confirmation of completion
4. n = n +1
5. repeat 2,3 and 4 until server return with 'all done' or something like that

The key here is that the server finishes it's task in each iteration before it times out.
11 years ago
That functionality must be implemented client side i.e with javascript. If you expect a task to take longer than 60-120 secs it should be sent in batches otherwise you might be timed out.
You can use Ajax to send 100 emails -> update a status message in the browser window -> send next batch of 100 emails.
11 years ago
It seems that you check the input string for length, which is good but all you do is print out whether the strign is of the correct length or not. If the string is shorter than 13 you'll get StringIndexOutOfBoundsException
11 years ago
Remember the (==) comparison is object comparison, it checks if the objects on both sides of the == signs are the same.
The .equals() method compares the string value of the string objects, which is what you want to compare.
11 years ago
I am making a little tile-based game where each tile is a JPanel and I need to know which tile was clicked with the mouse. What I did is have each tile implement the MouseListener Interface, that way I can simply use event.getComponent() to get the correct instance. However since each map in this game can have like 50x50 tiles (2500 tiles) I wonder if this is memory demanding and perhaps I should just use one listener and map the click coordinates to the correct tile on the map.
What do you think?
11 years ago
The reason you are not getting any output is that transacList is empty. What is missing is adding a new Transaction object to that list when deposit, withdrawal or transfer is made on the account.
12 years ago
    1
   101
  10001
 1000001
100000001


Do you mean like this?

Just use whitespace
12 years ago
If you are having output problems the simplest way to debug it is to output some extra debug text at appropriate places in your code to narrow the possible cause. I'd check if that for loop at line:95 is being executed as it should. In other words, work you way backwards until you find the source of the problem.
12 years ago
It's never good idea to post that much code unless you are sure it's all relevant to the problem you are having. It is also preferred that you write your code in english because when someone starts to read someone elses code he looks at variable and method names to understand it faster, in your case you have written your code in french if I'm not mistaken which makes it more difficult to read for someone that doesn't know french (me for instance).
12 years ago
I've done this, when testing the body of an if statement
12 years ago
You seem to agree that the foodBasket should be fruitBasket, ok but if I want to make an inventory of food available at the store? The easiest way would be to use one Arraylist<Food>() which has the same problem as foodBasket, so would you split the inventory into multiple arraylists for each category then?
12 years ago