3,892 Posted Topics
Re: [quote]I have two string which have time in them like one= 11:54:30.360 two= 11:54:30,427 Wht is the best way to get the difference between them[/quote] IMO, the best way would be to convert both of those to proper Date objects using the SimpleDateFormat class and then apply normal Date diff … | |
Re: The try-catch-finally (try-catch) is a well known vicious cycle when dealing with closeable resources. There are two ways around this: * Using the nested-try method (NOT RECOMMENDED, since multiple resources can make the code ugly and this doesn't handle closing of 'out' in case closing of 'in' fails) [code] public … | |
Re: 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. | |
Re: The FilenameFilter is used to filter out files in visual components (e.g. when you navigate to a folder, only *.java files would be seen) and in cases where you need to return file names which satisfy a given criteria. Basically for filtering needs based on "file names", FilenameFilter is used. … | |
Hi folks, The new anime season is just around the corner (hats off to Japan!) and it seems to be a pretty busy season with around "42" new shows! The preview can be found at [URL="http://randomc.net/2011/03/18/spring-2011-preview/"]'random curiosity'[/URL]. As always, I'll be picking up anything related to romance and harem. The … | |
![]() | Re: You are missing a `return` statement in your catch block: [code]try { Thread.sleep(100); } catch(InterruptedException e) { // print win return; }[/code] Basically, when the 'loser' thread is interrupted by the main class, you catch the exception, log the message but continue with the loop and hence the program keeps … ![]() |
Re: [quote]I never wanted to offend anyone, and I was never the first to initiate any negative comments here. I was trying to clarify my previous post but another poster insisted on arguing[/quote] IMO, it doesn't seem that way. Tip: if you don't find a particular reply suiting your taste, all … | |
Re: James, a side by side comparison using a non-trivial example would be helpful in evaluating this. My reasoning being if the LOC/effort being saved isn't significant, there is no need to ditch the compile time checks IMO. Plus, given that no source code is supplied, you might want to delve … | |
Re: [quote]I am arguing that whether we can trust wikipedia and how much stories can be trusted. [/quote] ... and this certainly isn't the right thread for the discussion. A bit of off-topic chat is never frowned upon but this thread has gone *way* too off-topic. | |
Re: You need to improve your 'google-fu' :-) [url]http://www.mkyong.com/applet/jmf-unable-to-handle-format-mpeglayer3/[/url] I haven't used JMF but as per [URL="http://stackoverflow.com/questions/1214954/error-using-jmf"]this thread[/URL] JMF is horrible. You have been warned, or something like that... | |
Re: Create a new instance of the Properties class, call setProperty and then store. See this: [url]http://www.mkyong.com/java/java-properties-file-examples/[/url] | |
Re: Yes, you definitely can do it. If I've captured your requirements correctly, you basically want to "invoke" the functionality implemented by native extensions in your Java code. In that case, look into [URL="http://java.sun.com/docs/books/jni/html/jniTOC.html"]JNI [/URL](the actual specification) and a easier way to go about it using [URL="http://jna.java.net/"]JNA [/URL](JNI is too much … | |
Re: What is the use-case for this Coin class (i.e. client code)? I think that this class could be much better modeled as an enum (limited and finite states) in which case you automatically get a good equals and hashCode implementation. Also, when you say 'weight', is it the physical weight … | |
Re: Java (along with its standard libraries) doesn't directly support this. The only way is to drop down to the platform specific stuff and interface that with your Java application using JNI/JNA. There was an entire discussion pertaining to this topic with example code I guess but the link ([url]http://forums.sun.com/thread.jspa?threadID=632369[/url]) now … | |
Re: You can return a Pair object which contains a pair of Cell instances. A sample Pair class implementation [URL="http://stackoverflow.com/questions/156275/what-is-the-equivalent-of-the-c-pairl-r-in-java/677248#677248"]can be found here[/URL]. Also, cloning in Java is pretty much broken ([URL="http://www.artima.com/intv/bloch13.html"]read the experts view here[/URL]) and you would be better off creating a copy constructor which does the same stuff. … | |
Re: [quote]You get it, The IRC you post is only for support forums and technical difficulties [/quote] You've got it wrong; IRC is not a place to ask support questions, it's a chillout zone/place. Click on the link jonsca has posted in this thread and just hang out there. You don't … | |
I know this is kind of late but in case you folks didn't know, Japan is still trying to recover from the aftereffects of the calamity which struck it few days back. In these horrid times, every bit of sentiment and help counts. No help given with good intentions is … | |
Re: I'm not sure why you think it won't be a good idea to request the sys admins for setting things straight. It's not as if you are asking for a permission to unblock youtube or gmail. Plus, the filter is obviously broken; it allows you to browse some parts of … | |
Re: There already exists a database forum hidden inside the Web development forum; [URL="http://www.daniweb.com/web-development/databases/16"]here ya go[/URL]. EDIT: Also I'm surprised you missed [URL="http://www.daniweb.com/community-center/daniweb-community-feedback/threads/353624"]this thread [/URL]in the same forum. :-) | |
Re: It's already there, hidden inside web development (click [URL="http://www.daniweb.com/web-development/databases/16"]Databases[/URL]). | |
Re: [code=cpp] T arraynums[n] ; arraynums[n] = n ; // dont you think its out of bounds error. [/code] Please make sure your code works before you post it in the code snippets section. In future code snippets which dont compile will be deleted. | |
Re: This is because each thread spawned is effectively a garbage collection root i.e. the central point at which the GC starts working. As far as an official source is concerned, the same is mentioned (but in a bit cryptic way) [URL="http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html#997428"]here[/URL] (read the unreachable section). | |
Re: [quote]Why the reluctance to create more forums, does having more forums affect something that we aren't aware of?[/quote] At least from a moderation viewpoint, it amounts to more house keeping which needs to be taken care of. Plus, it's not like it was always this way in the past. Forums … | |
Re: Your problem is that you are using 'long' type where 'double' is desirable. For e.g. what should be power of 10.1^2 ? What does your invocation of 'power(10.1, 2)' print? Your power method is broken but it doesn't throw a compile time error because of your use of `*=` construct. … | |
Re: I don't see any form element with the name "mmsTitleAdded" which kind of explains why you are not getting any values (unless you have not posted the code which shows this element). If you are trying to get the multiple values of the "SELECT" in your first code snippet, try … | |
Re: [quote]It wasn't meant to sound like an attack and i apologise.After you sent me that message i've re read the rules and i couldn't find myself breaking any.I'm not saying i don't deserve my down-reps but i definitely don't deserve all of them.I apologise for my bad english and i … | |
Re: Are you using a redirect on the server side when serving the excel file? How exactly is the download feature implemented? Also, what's the code you are using to download the excel file? | |
Re: Yeah gets hold of all the image elements on the page in an array and starts manipulating the properties like its x and y coordinates. But still its the idea that counts, good one. | |
Re: Looking good, nice job! BTW, just noticed that this isn't applicable when I click on a particular forum (e.g. Java from the drop-down). Not sure if this is how it was meant to be. Same with permalinks for thread posts (the PERMALINK link). Also, I think it would be wise … | |
Re: Have you tried inspecting the page source in both the cases? Do you see a difference in the image paths? Are you using relative or absolute path location for loading your images? | |
Re: A serialized image written to a file is not the same as an image written to a file. Java serialization uses a specific binary format for writing out Java objects. Also, your post isn't clear. What exactly does "serialize[x]" contains i.e. what kind of object? What is locaties? | |
Re: If you need to pass them for every call to prepared statement, then they are not constant and should be part of prepare statement. If they really are constants, you can embed those values in the query itself. Or you can combine both the approaches: [code]var pStmt = "select * … | |
Re: You can't since the signature of the run() method is fixed. The way you are doing it suggests you have some custom task which needs to be executed. In that case I would recommend creating a custom Runnable or Thread class which takes those two "strings" as constructor arguments and … | |
Re: Try to parse the user input as a number; if it fails, the given string is not a valid number, otherwise it is. Look into the parseXXX method of the wrapper classes (Integer, Long, Float etc.). | |
Re: > all the suggestions will be greatly appreciated!! Assuming the normal quadrant and angle measuring convention: [code]x = cx + r * cos(theta) y = cy + r * sin(theta)[/code] where: x, y = coordinates of the point on the circumference of the circle cx, cy = coordinates of the … | |
Re: Was it working fine previously or is this a new install? If this is a new install which version? Also, AFAIK, Glassfish had problems starting up if the install path contained space characters (as it is in your case). If a reinstall doesn't fix it, I'd recommend hitting the Glassfish … | |
Re: First, don't mess with your Tomcat lib directory; all application related jars should ideally go in the WEB-INF/lib directory of your web application, unless you have a good reason to not do so. | |
Re: As it has already been mentioned many times before, posting questions without showing attempt would be ignored by most members here. Also, a simple search for "find leaf node" would bring up the description of a leaf node with its implementation. BTW, please don't PM me. I have limited time … | |
Re: > Does anyone know of a way to make it so the customer can click a link to start the game > instantly without haveing to [download-save-open] the file... No, it can't be done. Isn't the reason apparent here? You go to a site, click on a link which actually … | |
Re: [quote=Bench;296736]Bearing in mind that if this is a console application, there's a finite number of characters for any given line which you can output without the code spilling over to the next line, and completely ruining your formatting anyway. Therefore, it may be simplest to put in an upper limit … | |
Re: Regarding the error message, I think what is happening here is that when you are logged in successfully, you are assigned a session token (which looks like the output of a hash algorithm like MD5 or SHA etc.) which has a fixed validity. Given that you were trying to use … | |
Re: [QUOTE=cscgal;1487820]I've made a change to the way that quote tags are implemented. As you remember: [noparse][quote][/noparse] by itself will always show the full quote [noparse][quote=.....][/noparse] will show/hide the quote, to eliminate redundancy and having to scroll past huge quotes Now, when you are using the quote tags that show/hide the … | |
Re: When reading from a file, always check for "hasNextLine()" before calling "nextLine()" method. Also, your method calls "object.setIsPrime()" and the line reading part "nextLine()" should come in a loop which will continue as long as there is a line that can be read. Also, your implementation of prime number checker … | |
Re: Your Stack implementation is not generic i.e. doesn't accept type parameters. Or is it that you are planning on using the Stack implementation provided by the standard library? | |
Re: Why are you using DataOutputStream for writing out textual content? Use PrintWriter by passing in the FileOutputStream created, invoke its println() method and you should be good to go. Always make sure that you use XxxWriter for writing out textual content rather than streams. | |
Re: You have not initialized your operand stack and you don't do anything with the value returned by the "evaluate" method. That being said, don't use StringTokenizer but use the "split" method of the String class. Also, Stack class extends Vector class which has all its method synchronized and has fallen … | |
Re: Of all the posts in this thread, I am in complete agreement with Progr4mmer's post. To someone beginning programming (not just Java), I'd neither recommend a full-blown IDE or a stupid text editor like Notepad. I mean come on, if you want to test your vision, there are better things … | |
Re: The simplest solution would be to write out a new file with the updated data and delete the original one. A sample implementation to get you started would be: [url]http://www.javadb.com/remove-a-line-from-a-text-file[/url] (untested) A really messed up solution would be to try to get something working with RandomAccessFile but then again it … | |
Re: [quote]Let say I click on a link on this page, for example, your user name, but instead of opening another html page such as your profile, it runs an application. [/quote] Run an application where? On the server or on the client PC (i.e. a user accessing your application). In … |
The End.