3,892 Posted Topics

Member Avatar for newcoder310
Re: Time

[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 …

Member Avatar for ~s.o.s~
0
106
Member Avatar for sanjay11
Member Avatar for Bladtman242

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 …

Member Avatar for Bladtman242
0
228
Member Avatar for Xlphos

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.

Member Avatar for The Dude
2
1K
Member Avatar for bhattpratik

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. …

Member Avatar for bhattpratik
0
2K
Member Avatar for ~s.o.s~

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 …

Member Avatar for ~s.o.s~
0
235
Member Avatar for Javam

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 …

Member Avatar for Javam
0
385
Member Avatar for shinsengumi

[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 …

Member Avatar for Adak
0
584
Member Avatar for JamesCherrill

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 …

Member Avatar for JamesCherrill
0
206
Member Avatar for happygeek

[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.

Member Avatar for TrustyTony
0
477
Member Avatar for cyberbemon

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...

Member Avatar for cyberbemon
0
950
Member Avatar for bharath54321

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]

Member Avatar for JamesCherrill
0
138
Member Avatar for JPramod

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 …

Member Avatar for JPramod
0
184
Member Avatar for Alpdog14

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 …

Member Avatar for JamesCherrill
0
183
Member Avatar for alastair1008

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 …

Member Avatar for ~s.o.s~
0
110
Member Avatar for mkab

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. …

Member Avatar for mkab
0
234
Member Avatar for royng

[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 …

Member Avatar for royng
0
435
Member Avatar for ~s.o.s~

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 …

Member Avatar for royng
1
365
Member Avatar for Shanti C

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 …

Member Avatar for ~s.o.s~
-1
404
Member Avatar for dstoltz

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. :-)

Member Avatar for ~s.o.s~
0
230
Member Avatar for romi_001

It's already there, hidden inside web development (click [URL="http://www.daniweb.com/web-development/databases/16"]Databases[/URL]).

Member Avatar for Dani
0
230
Member Avatar for manutd

[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.

Member Avatar for lxXTaCoXxl
0
181
Member Avatar for liran

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).

Member Avatar for liran
0
169
Member Avatar for Seattle Slim

[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 …

Member Avatar for jon.kiparsky
2
392
Member Avatar for Oppression

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. …

Member Avatar for Oppression
0
93
Member Avatar for raul8

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 …

Member Avatar for ~s.o.s~
0
167
Member Avatar for caut_baia

[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 …

Member Avatar for caut_baia
0
370
Member Avatar for manish250

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?

Member Avatar for ~s.o.s~
0
229
Member Avatar for 'Stein

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.

Member Avatar for susheelsundar
0
593
Member Avatar for Dani

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 …

Member Avatar for ~s.o.s~
0
214
Member Avatar for Dean_Grobler

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?

Member Avatar for javaAddict
0
1K
Member Avatar for MeandJava

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?

Member Avatar for MeandJava
0
1K
Member Avatar for liran

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 * …

Member Avatar for liran
0
310
Member Avatar for jrosh

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 …

Member Avatar for ~s.o.s~
0
135
Member Avatar for lsvife

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.).

Member Avatar for mKorbel
0
122
Member Avatar for gedas

> 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 …

Member Avatar for JamesCherrill
0
133
Member Avatar for haresh2906

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 …

Member Avatar for ~s.o.s~
0
253
Member Avatar for haresh2906

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.

Member Avatar for haresh2906
0
86
Member Avatar for jemz

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 …

Member Avatar for jemz
0
239
Member Avatar for pure_evil020

> 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 …

Member Avatar for Taywin
0
3K
Member Avatar for livingsword

[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 …

Member Avatar for vipinkumar512
0
745
Member Avatar for AndreRet

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 …

Member Avatar for AndreRet
0
110
Member Avatar for Dani

[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 …

Member Avatar for WaltP
0
201
Member Avatar for kodera

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 …

Member Avatar for ~s.o.s~
0
150
Member Avatar for lashbandi

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?

Member Avatar for ~s.o.s~
0
228
Member Avatar for manish250

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.

Member Avatar for ~s.o.s~
0
233
Member Avatar for java_stud

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 …

Member Avatar for ~s.o.s~
0
221
Member Avatar for jimJohnson

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 …

Member Avatar for Progr4mmer
0
140
Member Avatar for CMAUK

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 …

Member Avatar for jon.kiparsky
0
3K
Member Avatar for varia

[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 …

Member Avatar for varia
0
188

The End.