Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Dieter Quickfend

Bartender
+ Follow
since Aug 06, 2010
Dieter likes ...
Java Netbeans IDE Redhat
Cows and Likes
Cows
Total received
4
In last 30 days
0
Total given
1
Likes
Total received
58
Received in last 30 days
0
Total given
68
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dieter Quickfend

This depends on the compiler and is at this point an unreliable comparison. If the compiler gets both references from the String pool it will return true, if it doesn't, it will return false. To compare their true value, you must use equals method. Using equals operator will return true for some compilers (in reality, probably all compilers), but it's not an obligation according to the specification and should thus never be relied upon.
you could make a prepared statement with named parameters using a wrapper class (google search will help with this) with something like

"select * from table where (:param1 is null or table.paramName=:param1) and (:param2 is null or table.param2Name=:param2) and ..."

Do it for all possible fields and you're in. If you don't want to use the wrapper class, you could just apply your params twice each.

For this kind of thing, JPA would be better suited though. Up to you if you want to head to JPA or keep using JDBC.
As long as your traffic is low, you should go for the simplest solution, meaning a simple application with the edit role for internal users and only a view role for external users. Using two servers would be over-engineering in this case.
3 years ago
If you are new at Python programming (I think that means you want to do it) why not write it yourself? Google basic Python and any extra API's necessary and I'm sure you'll figure it out fast.
3 years ago
About artists: I am a big fan of culture and art and I think a lack of spending on culture and art from a public perspective indicates that the public is not being paid enough. You're not going to buy a painting or go to concerts if you can't afford it.

That having been said, in my country artists get a certain budget from the government and generally complain that it's not enough. I do not think the government should pay for artists to just 'exist'. Sure, it isn't fair that children from wealthy homes have the opportunity to be an artist while children from poor homes don't, but this is indicative of a problem far greater than art, namely the income gap.

If you make sure the working population has enough money to spend on culture and art, artists will be able to generate sufficient income themselves without becoming dependent on government support. (And no, this is not done through tax cuts). The inequality of young people relying on parents' income is a major issue which must be addressed. But government subsidizing artists simply gives way to systematic abuse.

I do believe that the pursuit of a higher education should be fully subsidized by governments. The more people that pursue a higher education, the higher your level of employment and the higher your average income. If everyone can afford to go to school, everyone can get a job in which they are not so easy to replace. Meaning poverty rates will be far lower. Premiums for rare profiles will also decrease due to there being more choice on the market, which will cause a reduction of the income gap.
3 years ago
Another option is to list the files using a filter.
3 years ago

Greg Charles wrote:I've seen that, but I wonder if the poster is really an idiot, or was making a canny joke. I mean, a lot of people must use a laptop on the subway, right? Why snap this particular one? It's still funny, but I don't know if I'm laughing at Mr. Hale, or with him.


Small google search indicated that the poster was making a joke. Got a lot of hate in the process, though...
3 years ago
I moved this to Java in General because it really has nothing to do with JDBC.

Check out the Joda Time library. It has a method like:



which you can use to get the amount of days between two dates. It also has a lot of other possibilities.

If you use Java 8, there is a new Date Time API in Java 8 which is likely to be able to help.
3 years ago

J. Kevin Robbins wrote:

Ngml Bishop wrote:


Be very, very cautious about using this. It doesn't just cause the application to exit, it shuts down the entire JVM. It sometimes makes sense for command line tools, but it would be very unusual to use it in a web or desktop application.



Indeed. If you haven't learned about throwing exceptions, it would perhaps be beneficial to use "return;" instead.
3 years ago
Your original ideas are very good. Why don't you read up on them and try them out?
3 years ago
What does the error log say?

EDIT: your dispatcher servlet does not handle page calls by parameter, right?
3 years ago
JSP
On a higher level: do not accept requests to implement complex behavior that users think they want. Trust me, it's really not what they want.

If nobody has the authority or the guts to say "This is not a good idea. Let's have a meeting about why it isn't and what you're trying to achieve; I'm sure there's a better solution." then any application will end up as a total mess, no matter how good your development team is.
3 years ago
You make good points. I avoid if...else stacks just as much as I avoid switches. I am also fully aware of the evaluation differences between "i++" and "++i". What I'm saying is that if you find yourself in a position where that difference determines whether your application is functional... you've already lost the technical debt match. There is nothing easier to miss than that. You will read it twenty times, and even knowing the difference, you won't notice it.

Very interesting discussion though. It seems that no one agrees with me on the increment operator, which I find surprising.
3 years ago
There are two things which this could pertain to:
- The HTTP Request
- The HttpServletRequest object

HTTP Request

HTTP is a request/response protocol. This means that the browser sends a request to the server. This means a TCP/IP connections is opened for the duration of the request. When an HTTP response is sent, the server or the browser closes the TCP/IP connection. That is the end of the HTTP request/response chain. You can now see the response (containing data and a header). HTTP is stateless, so nothing else is kept.

HttpServletRequest

This object is created and populated with request data by the container (server) when the request is made. Its lifecycle depends completely on the container implementation. It may choose to pool HttpServletRequest objects, or it may choose to discard them when the response is sent. As for its attributes, they will be discarded along with the HttpServletRequest object unless the attribute is an object with references in other objects. IF another object still has a reference to the object which is also a request attribute, it will continue to exist.


Note

Do not mistake request dispatch actions (like servlet->JSP) with a response commit. The response is not committed and the request lifecycle is not over. The request is still completely valid in a JSP because a JSP is just another servlet that happens to put a bunch of html into the response without having to write a a lot of ugly, useless code. The response is only committed after the JSP is processed.