> I don't understand what you mean by type 4
http://java.sun.com/products/jdbc/driverdesc.html
http://www.javaworld.com/jw-07-2000/jw-0707-jdbc.html
> I don't understand what you mean by type 4
http://java.sun.com/products/jdbc/driverdesc.html
http://www.javaworld.com/jw-07-2000/jw-0707-jdbc.html
> Should I use Connection Pooling?
Depends; all real life projects use pooling but if you have just started out, cutting down the complexity by not bothering about pooling wouldn't be that bad. There are some SQL mapping frameworks out there [iBatis] which handle all the pooling behind the scenes.
> any way to hold the result for that user utill he logout
Server side sessions; though putting in a lot of data might just slow down things. Caching at the DAO layer is yet another option. Again, frameworks like iBatis and Hibernate shine in this area with configurable caching options.
> Do I need to use MultiThread?
No, at least not when developing a web app since the servlet takes care of spawning a new thread for each request made.
> How should I divide it to get the MVC Model confirmed .
By using a framework which helps you enforce a clear separation of concerns. Spring MVC, Wicket, Struts 2, Tapestry are good contenders.
> JSTL main purpose is to only make your logic more readable
No, it's main purpose is separation of concerns and to make sure that you don't end up mixing your business and view logic. The ability to create reusable custom tags is a big win over having duplicate code in your code base which achieves the same functionality.
That being said, for any real project, I see no need for any technical architect to prefer JSTL over the plethora of Web MVC frameworks out there, each with their own tried and tested view technology. Spring MVC, Wicket, Struts 2, Tapestry; take your pick. :)
Edit: You might find this discussion interesting. Oh and BTW, for the sake of good old god, never ever use JSF!
> At least it proves that Dani does still listen to what members of the
> community say...
Yeah, that's really a nice thing; especially when almost all the regulars are out on the streets baring their pitchforks and torches, foaming at the mouth. ;)
> Why use abstract classes at all? Why not just declare a class and
> then make sure you never instantiate any variables of that type?
...because compile time checks are far superior/efficient when compared to your code blowing up at run time. Languages which don't have the concept of Abstract classes baked in reply on hacks to achieve the same [e.g. Actionscript 3].
> Well, 650,000 users cannot be involved in every single discussion.
I guess nor they would want to as many of them are here for a quick solution.
> Even 20 regulars who post in the feedback forum only represent the
> most vocal members
Correction, the most "faithful" and "caring" members; members who care when things change.
> Well then be more vocal about which features you use and how you use them.
Pretty twisted way of asking for a feedback, eh? :-)
> When you first visit DaniWeb, how do you begin your visit?
UserCP; the subscribed forum list along with the no-email thread subscription works wonders for me. I've never seen the main page, ever.
> The DaniWeb homepage is going to be entirely retooled to actually
> be useful, so hopefully it will make a good first destination when you
> visit the site.
How about keeping on making changes to the main page *without* touching the existing layout? :)
After all there seems to be a lot of space on the right as Mel said; this change seems as if you are forcing all the existing members to visit the home page before they start their daily routine surfing.
But then again, this thread has the same feel as the "quick reply v/s advanced reply" or "IT professional's lounge v/s Geeks Lounge" thread, so bleh. :-)
> "Top Dog" is a common expression here in USA that means the boss or the leader
I'm very much aware of that expression but was expecting "brass" instead of "dog", hence that smiley. :-)
> I do not think daniweb mods are bad, in fact, quite the opposite
Good to hear that, thank you.
> tendency to over-react when a criticism is levelled at some facet of the site
I'd like to clarify this a bit; it's not just criticism against the site, but nonconstructive criticism/trolling in general which gets thrashed. Let's take an example of the very first post of this thread.
WTF? how do you get that?[...]
not that i care about this voting scheme; its obviously meaningless[...]
I just wonder how some Comp Sci folks figured out that 2/3 = 0.75
Now how about:
I currently have two up and one down votes but my total score quality comes out to be 75%? Is this a mistake or part of some weighted calculation? Can someone shed a bit more light on how this entire voting thing works? No bothered, merely curious. :-)
See the difference?
Mind you, not that a bit of sarcasm and drama is bad or anything, it's just that sarcasm begets sarcasm, trolling begets trolling. You get what you ask for, plain and simple. :-)
/me takes off the super-mod hat
> Here be tygers - and they don't like negativity
If someone treats the responses to all the threads in the Feedback forums as some kind of global conspiracy, then that person is seriously messed up in the head. :S
> You'll find the top dogs either saying it's not impt, so "shut up"
> and stop worrying
You forgot the obviously implied, "a newly introduced feature still under development". Oh and BTW, `dogs' is way too derogatory, I'm sure you had a better word in your dictionary, you just didn't use it. Subtle sneaky stabbers FTW. :)
/me puts on the super-mod hat ;)
> overzealous, much?
Far better than a stalker with too much time on his hands IMO.
> So what I need to know to be Java expert in Web and Desktop
> Applications?
Apart from the points already mentioned, I'd like to stress on reading good books/code. I've seen people churn out reams and reams of code without being aware that they are writing sub-standard code. Awareness is of prime importance. Practicing by repeating the same mistakes over & over again doesn't help IMO.
NumberFormat is an abstract class; use its static factory method to get your choice of number formatter.
public class MainTest {
public static void main(String args[]) throws Exception {
// Get a number formatter for the default locale
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMinimumFractionDigits(2);
System.out.println(nf.format(1.1));
// Get a number formatter for a different locale e.g. french
nf = NumberFormat.getNumberInstance(Locale.FRENCH);
nf.setMinimumFractionDigits(2);
System.out.println(nf.format(1.1));
}
}
The commas and the brackets are a part of the ArrayList class's toString() implementation. If you need your own row representation, either write your own method which does so or better yet, create a custom class called BoggleRow which uses composition or inheritance to mimic the ArrayList class. Something like:
public class TestRun3 {
// your code here
public void displayRow(List row) {
// code which loops over the list & displays the row
}
}
//OR
public class BoggleRow {
private List row;
public BoggleRow() {
row = new ArrayList();
}
@Override
public String toString() {
// your code here
}
}
// OR
public class BoggleRow extends ArrayList {
public BoggleRow() {
super();
}
@Override
public String toString() {
// your code here
}
}
The above code gives you a rough sketch of how your class would look like. My personal preference would be the second implementation.
Anything placed in the JSP between the <%! %> tags [jsp declaration tag] is placed outside the service() method but inside the auto-generated servlet class. You can of course create a method containing the given piece of code, which can be invoked from within the code placed inside the <% %> [scriptlet tags]
The bottom line is that anything placed in the JSP declaration section forms part of the auto-generated servlet [and is *not* executed] whereas anything placed between the JSP scriptlet tags is executed for every request received by that JSP. In your case, you might want to declare a method in the declaration section and invoke the same from a scriptlet.
.
<%!
private static void invokeSomething() {
// your stuff here
}
%>
<%
invokeSomething();
%>
Oh, and in case you didn't know, placing logic in JSP's and using scriptlets is bad and has been deprecated since times unknown.
No, you are not going stupid. :)
I guess I've stumbled upon something. Let's search for the post highlighted in your screen caps [click the first search result]. Now if I click on toggle plain text, I don't see any <strong> tags.
Now let's search for another code snippet & click on the first search result. Here, clicking the toggle plain text link again brings up those HTML tags.
Also another weird thing is that the problem is more prominent with C++ code snippets than with Java code snippets [try searching for "daniweb scanf c" & "daniweb println java"]. Gah, I think trying to make sense of this is like a lost cause, just click on the 'Clear' link which appears at the top of every thread when you arrive at Daniweb from a google search and be done with things.
This issue was brought up & discussed to some lengths a couple of months back.
> As you can see I have no tags whatsoever in "plaintext"
This problem crops up only when you arrive at Daniweb via a search made on google; all the highlighted terms [in yellow] in the source code show these weird tags when viewed in plain text.
> Thought this was a feedback forum. If moderators/admins don't like
> honest feedback, why not have a "Daniweb Community Feedback" for
> ****-lickers only.
Keep things on topic; there is absolutely no need to throw around verbal filth and make irrelevant generalizations about mods and admins.
> i miss getting beat up by her.
You can of course pop in the Daniweb irc to get beaten down in real time... ;-)
*sigh* Some people never learn....
Closed.
> How could a firewall cause the problem? both computers are using the
> same firewall.
Probably a configuration issue. You might want to try turning off the firewall for a couple of minutes and then see if you can observe the same behavior.
Most probably your browser is not set to accept cookies from Daniweb which is the mechanism used for session tracking. This might be because of the Firefox add-on you use or a firewall running on your computer.
Sadly, this simple a thing becomes pretty clunky to implement when it comes to Java. A sample implementation might be something like:
class YourClass {
private static final List<String> LOWER_CASE_CHARS;
private static final List<String> UPPER_CASE_CHARS;
static {
LOWER_CASE_CHARS = listFromArray("abcdefgh".toCharArray());
UPPER_CASE_CHARS = listFromArray("ABCDEFGH".toCharArray());
}
private static List<String> listFromArray(char[] charArray) {
List<String> list = new ArrayList<String>(charArray.length);
for(char ch : charArray) {
list.add(String.valueOf(ch));
}
return list;
}
public String[] fillResultArray() {
boolean checkBoxOneChecked = true, checkBoxTwoChecked = true;
List<String> stringList = new ArrayList<String>();
if(checkBoxOneChecked) {
stringList.addAll(LOWER_CASE_CHARS);
}
if(checkBoxTwoChecked) {
stringList.addAll(UPPER_CASE_CHARS);
}
return stringList.toArray(new String[] {});
}
}
Does that work out for you?
After reading the FAQ, the two features which I found interesting were:
- No type hierarchy; this is a life safer given that the ridiculous amount of time OO programmers spend juggling with type hierarchies.
- Goroutines instead of threads; spawning a new thread only when it's absolutely required is cool IMO.
That being said, the syntax looks a bit ugly and convoluted.
> Is there something similar to this that I can use for a Java Web App?
Yes, you can either use the <jsp:include> standard action or tag files to include reusable view templates in your web pages.
Edit: Just keep in mind that the above mentioned techniques include the content at runtime. If you are pretty sure that your re-usable views would never host dynamic content, go with the include directive which includes the content at translation time as opposed to run-time.
> The following program doesn't work in my Linux system's Mozilla firefox.
> Any help to fix this problem is appreciated
This isn't a browser problem. Make sure that your page which hosts EL snippets has an extension of .jsp
and not .html
. The container serves HTML pages as static content instead of running them through the entire JSP life-cycle [translate-> compile -> load -> instantiate].
> Thank you - my understanding of generic types is still somewhat limited.
When in doubt, always look at the standard library code which comes prepackaged with the JDK. For e.g. in this case, looking at the source of the ArrayList.java file would have solved your problem. :-)
Read Why Runtime.exec() won't work?
If you are using Java 1.5 or more, look into ProcessBuilder class which has replaced the old "exec" way of spawning processes.
> Does [0-9] need to be in quotes?
No, it needs to be placed inside forward slashes to be considered as a regular expression. Of course, if you place them inside quotes, you need to explicitly use the RegExp() constructor.
@vishalanuj
That regex won't work. Try something like:
// This restricts the pin code to only digits with at least one
// digit required.
/^[0-9]+$/.test(txtField.value)
> is it impossible to do it without that active x?
AFAIK, yes, it's not possible.
>Oh I see, you replaced the existing tags with spam.
Maybe you missed some of the important points of my previous post. My point being, if a member with zero posts can edit the tags for a given thread, nothing prevents him from automating the same. Think of it as being along the same lines like the programmatic rep-attack which happened about a year back initiated by Rashakil.
> All these colorful appearance of daniweb makes me get the impression
> that this site is friendly and supports freedom of speech until one ...
> turkish flagged my post as bad
This site doesn't support freedom of speech and hence is friendly. Like I have previously mentioned elsewhere, if you want to vent your personal frustrations and let the world know what you think of XXX, creating your blog would be a nice idea. Posting disturbing things like cursing a religion or nation which seems to be your idea of "freedom of speech" is not allowed here, and for a good reason IMO.
Anyways, good bye and thank you for your technical contributions to Daniweb. Maybe one day when you'll gain enough wisdom to understand what you did wrong by posting such things on a public forum, Daniweb would welcome you again.
-sos
Your second file is missing the class imports. I don't see the declaration of your `Convert' enum class. Your naming conventions are still off.
These are pretty simple error messages to hunt down and fix; I'd recommend reading the sticky at the top of the forum.
A few observations:
- Always perform resource cleanup in the `finally' block to be rest assured that the cleanup indeed is performed even if the code ends up throwing an exception.
- The way you have written your code resembles the procedural ad-hoc way of writing code. Break up your logic in methods and create logical classes which represent your problem domain.
Taking a look at the sticky created at the top of the forum might just help you get started in the right direction.
>Thanks a lot guys for the help!
Good luck with the remaining exercises.
> I will flag this as solved when I get my account fixed.
Done and done. :-)
Read the contract of the substring
method; substring(4, 6)
== 2 characters.
Also get in the habit of using uppercase characters for enums i.e. `BIN' instead of `bin'.
I did see it when I first logged in, but trying after around half an hour made it go away.
Some constructive comments:
1. exit (0) means successful return from a function. In case of unsuccessful memory allocation use, exit (1) instead of exit (0)
2. Always send the errors to the error stream rather than the output stream. In most of the cases the error stream is the ouput stream ie your monitor, but in specific cases it can be a log file.
3. A lightweight way to add a newline rather than writing printf ("\n") ;
is putchar ('\n') ;
4. According to the principles of Software Engineering, the less the parameters passed to the functions, the better the function is. If your passed parameters exceed 4, try to re analyze your design.
The number of parameters passed is directly proportional to the complexity of the function.
>I like the reputation system better
I personally feel that the reputation system is a complete fail and the point system introduced by StackOverflow is awesome. You get a vote-up if the answer is acceptable; a vote-down is not. The reputation generated for each vote-up/vote-down is the *same* irrespective of the number of reputation points the voter has!
Let's assume that you post a really good answer to some C# question and it's a hit with the C# developers on this site who completely agree with the reply but just happen to have recently joined Daniweb and hence don't have any reputation points to give. OTOH, someone else posts a so-so reply on the same thread with a bit of *cough* humor *ahem* in it and it gets a A-OK from one of the established members of this site. Viola, the person with a so-so reply now has 50 rep points while you have none.
Reputation should IMO depend on how many people agree with your answer rather than *who* agrees with your answer. The reputation system should focus more on avoiding blunders than trying really hard to reward acceptable answers. Lastly, as someone once said, rep system is more of a popularity contest. :-)
> because the point system would put more of a burder on
> moderators to assess each question and score it
Even normal members can vote-up answers, no? AFAIK, there is no burden on moderators whatsoever.
>that some couple getting married
Agree; marriage is surely a crazy thing! :-)
Thank you all; I really appreciate the trust Daniweb members have placed in me. Looking forward to a better Daniweb with your help and support. :-)
Oh and btw, the green color doesn't look that good; would have preferred something dark like black with red outline. ;-)
So, you were expecting a MySQL Driver class in ojdbc14.jar? How about looking for that class in mysql-connector-java.jar file? ;-)
This thread has gone *way* off-topic. If all you guys want to do is chat about how expensive the standard of living in country XXX create a new thread; this one's dead until some higher-up feels that there is a reason this thread should continue to exist.
> but i seriously doubt that any of microsoft's myriad of problems
> have to do with void main()
Yeah, it's gotta be the way they think which makes them use void main(). :-)
But this thread is off; KTHXBI.
OK, by now we all know who Tom Gunn is, why he has such high rep and how relevant reputation is. The `off-topicness' oozing out from this thread makes it a worthy candidate for closure.
> I fixed that for you.
You shouldn't, really. You just proved his point. :-)
> can i have it?
Yes.
The 2009 Summer Anime Preview is here!
Sadly, not many of these look promising to me except:
- Umi Monogatari ~Anata ga Itekureta Koto~
- Tokyo Magnitude 8.0
- Spice and Wolf II
- Princess Lover!
From the ones mentioned, I've seen the first episode of Princess Lover and it indeed seems entertaining. I would have loved to watch Zan Sayonara Zetsubou Sensei given the hype surrounding it but given that I have yet to see the first two seasons, it's on hold as of now.
Oh BTW, Anime FTW! :-)
> but it seems to work with a "real" file system on a "client side".
I'm not really sure what you mean by a `real' file system; the File class provides an `abstract filesystem independent view' of the path names i.e. your File object does *not* map to a real file on your file system. It's more of an abstraction provided to deal with `file' resources represented using path names.
BTW, I'm personally in favor of having a separate application specific class to represent a File or Directory structure. At first it might end up being just a thin wrapper for the File class but as and when features are added, it would serve as a good abstraction for containing all `File' or `Directory' specific state and behavior of your application.