3,892 Posted Topics

Member Avatar for nickliutw

Your `compareTo` method isn't proper. In compareTo, you don't create "new" objects but compare the object on which the method was invoked with the object which was passed in. Your current code doesn't work because "k" should ideally be the "this" object. Also, your assignment to "k1" is lost/meaningless since …

Member Avatar for nickliutw
0
5K
Member Avatar for creative_m

> a reason why you yourself would/could use private constructors, is implementing the Singleton pattern As a safety measure, if your class shouldn't be instantiated, make sure you throw an exception from the private constructor otherwise it is pretty much [URL="http://stackoverflow.com/questions/6636734/does-instanceof-void-always-return-false/6636767#6636767"]open to reflection abuse[/URL].

Member Avatar for creative_m
0
472
Member Avatar for SasseMan

You can use [URL="http://www.catosplace.net/blogs/personal/2009/09/12/junit-4-test-suites/"]JUnit Test Suites[/URL] to get a fine grained control on which tests get executed. Create a test suite, run it and it will automatically run only the included test classes.

Member Avatar for SasseMan
0
221
Member Avatar for Airshow

> but it would be nice to know that the money got through Hover over your avatar in any post you make and you should see a "sponsor" badge. Also, try accessing "Area 51" in community center after "clearing your cookies". If these two are as expected, then your payment …

Member Avatar for Airshow
0
196
Member Avatar for Ancient Dragon

[quote]I'm looking for something new to play (got bored of WoW for now)[/quote] Try Everquest 2 for a different experience though I must warn that the pace of that game isn't for everyone.

Member Avatar for dij_0983
0
105
Member Avatar for ananyaholla

[quote] think that you should have posted this in the JSP forum[/quote] Please report such posts instead of replying to them. This will ensure that the post doesn't lose its meaning after the thread move is done.

Member Avatar for peter_budo
0
596
Member Avatar for Majestics

Because mathematically, 10.1 is the same as 10.10 which is the same as 10.100 and so on. You might want to elaborate a bit on the context here to get useful answers.

Member Avatar for mKorbel
0
312
Member Avatar for Melow

You need to break up the regex you have posted and explain your reasoning behind putting the constructs which are there in your regex. Also, instead of posting "sample data" for the pattern you can looking for, it would be much for helpful for your own sake to frame the …

Member Avatar for Melow
0
193
Member Avatar for nesnes

> i got this code form the internet where it can delete a file.but when i tried to use it n my own java program it does not work anymore.it always returns 'Could not delete file'. First thing, never have empty catch blocks in your code, ever, no matter what. …

Member Avatar for ~s.o.s~
0
806
Member Avatar for anand01

A label in Java can be used for regular code blocks and IF statements along with their regular usage with looping constructs. So you can have: [code] something: if (i == 1) { method(); int j = method2(); if (j == i) { break something; } }[/code] Similarly with blocks: …

Member Avatar for anand01
0
236
Member Avatar for AndreRet

We have been recently hit with a spam wave which resulted in the admins banning a few IP ranges to stop the onslaught. It's a possiblity that your IP address was caught in the cross-fire and hence shows the given message. Once the admins are online, they should be able …

Member Avatar for AndreRet
0
192
Member Avatar for David Lee

> [inlinecode]window.location = imageArray[ i - 1 ].href;[/inlinecode] [INLINECODE] window.location[/INLINECODE] is an [INLINECODE]Object[/INLINECODE], its [INLINECODE]href[/INLINECODE] property a [INLINECODE]String[/INLINECODE]. Though the above one works, the correct way of writing it would be: [inlinecode]window.location.href = imageArray[ i - 1 ].href;[/inlinecode]

Member Avatar for Kyle G
0
264
Member Avatar for riahc3

[quote]What I ment was that in each project (both the lib and the main program) do I have to have that com.stuct package and that Global class with var?[/quote] No, having it in one place would be fine. Let's suppose that you have the `Global' class in the library project …

Member Avatar for riahc3
0
529
Member Avatar for Majestics

Look into the "connect()" method of the `Socket` class. Basically, you create a blank socket and ask it to connect to a given destination with a specific timeout. This connect() call blocks until a connection was made or timeout was encountered.[code] // untested final Socket sock = new Socket(); final …

Member Avatar for ~s.o.s~
0
826
Member Avatar for roverphoenix

Using [inlinecode] goto LABEL; [/inlinecode] is not a recommended programming practice. THe same applies to [inlinecode] system ("PAUSE") [/inlinecode] calls. Calling OS dependent functions is not good programming practice.

Member Avatar for roverphoenix
0
422
Member Avatar for Mike Askew

Dani is furiously working towards rolling out brand new Daniweb website written from scratch. You might want hold off your suggestions and bring them out when she is again in "accepting new feature requests" mode. :-)

Member Avatar for Mike Askew
0
182
Member Avatar for PrimePackster

AFAICT, the web client works across all browsers (assuming you have no "blocking" plugins installed). Give [URL="http://embed.mibbit.com/?userListWidth=50&server=irc.daniweb.com%3A6667&chatOutputNickWidth=80&channel=%23Daniweb"]this link[/URL] a try and let us know how it goes.

Member Avatar for PrimePackster
0
327
Member Avatar for _neo_

I don't think this solves anything if your purpose here is to "cancel" the underlying computation. Create a task which continuously (while true) prints "Hello world" to the console (STDOUT) every second and set the timeout for that task to be 5 seconds. You'll notice that even after the task …

Member Avatar for _neo_
0
296
Member Avatar for dennysimon

Have you checked the JAR file to ensure the manifest really is there? Make sure you are invoking a JAR command which "packages" the manifest file in the JAR. Ensure there is a newline after the last manifest attribute. [URL="http://stackoverflow.com/a/2591548/193906"]Read this[/URL]. Follow up if it still doesn't work.

Member Avatar for dennysimon
0
183
Member Avatar for MooGeek

Yes, it's a scam/spam message. I have banned the member in consideration (even I was one of those members who received the PM) for trying to scam/spam via PM so it should be all good now.

Member Avatar for WaltP
0
203
Member Avatar for Alicito

We need more details. What is the command invoked to "build" the JAR file? Which version of Java do you have on the Linux box? This error normally comes up when you try to compile code containing generics using pre 1.5 source level.

Member Avatar for Alicito
0
258
Member Avatar for Vetha

@dheaven: Having looked at your previous posts, I'm assuming that you are either affiliated with the blog in consideration or own it. Posting self links is not recommended here and is seen as promotion. If you want to redirect users to your blog/help them, link your blog in the signature …

Member Avatar for ~s.o.s~
0
1K
Member Avatar for coding101

[quote]How do strings work? In C we must declare the size of a char array to represent a "string". But in java we do not allocate memory for the size of a string. So how does the string work? Is there a pre deterimed size assigned to strings from the …

Member Avatar for dheaven
0
238
Member Avatar for autorunman22

I don't think there is a clean way of doing this in RMI given RMI doesn't offer an appropriate level of "socket" abstraction for this sort of stuff. Your best bet would be to pass a "[URL="http://www.cs.swan.ac.uk/~csneal/InternetComputing/ThreadCallBack.html"]callback handler[/URL]" when "registering" or "joining" the chat. When the server wants to kick …

Member Avatar for autorunman22
0
1K
Member Avatar for anand01

I'm not sure what's the confusion here:[code] // add same elements twice; should be added only once set.add(i1); set.add(i1); // add new element; size is now 2 set.add(i2); // remove added element, size is now 1 set.remove(i2); // remove a non-existent element, shouldn't affect set // size is still 1 …

Member Avatar for anand01
0
116
Member Avatar for dennysimon

[quote]my part of code give me message to recompile with -Xlint:unchecked How to fix this code so the message gone[/quote] JComboBox was made a generic type in Java 7 so creating a new JComboBox without supplying the type parameters would result in the usual "unsafe" warning. The solution here would …

Member Avatar for dennysimon
0
2K
Member Avatar for Mr.BunyRabit

I had a look at [URL="http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/a1996291-735f-4a8c-8544-b98610f966bd"]this thread[/URL] and it seems that you don't need entire Access suite installed just for using MS Access. You might want to try the links mentioned in the thread. BTW, any reason you are stuck with Access? Is there any reason you can't use a …

Member Avatar for Mr.BunyRabit
0
804
Member Avatar for happygeek

> And what do most websites use these days? OpenID providers which pretty much brings down the possibility of mass registrations since the spammers would now be up against OpenID providers for spamming rather than Daniweb itself.

Member Avatar for Dani
2
1K
Member Avatar for Karlwakim

[quote]Ok thanks and happy new year. when i said "when i'll master them" i meant when i'll master the core language. I wanna develop programs that can connect to the internet, ping, scan network, etc. So which language is most used for these kind of stuff ?? thanks again[/quote] The …

Member Avatar for Karlwakim
0
379
Member Avatar for deanus

[quote]I've just learned that Java's 'protected' access specifier has a different effect than that in C++. So is there a way to make a member of a base class visible to its inheritors but not globally?[/quote] Assuming by globally you mean "other classes in the same package", then no, there …

Member Avatar for deanus
0
107
Member Avatar for winecoding

Variable arity (var-args) are a Java 5+ feature but is implemented under the hood as an array. If you have a Java 1.4 compiler trying to compile the code calling a var args method, there is a possibility of getting this error. Are you sure the setup on CentOS (both …

Member Avatar for ~s.o.s~
0
213
Member Avatar for SasseMan

This problem can be easily solved if you are ready to pass around "type" tokens i.e. Class instances to methods. Let's say you want to create a generic "doSomething" method as mentioned in your first post. The generic version would look something along the lines of:[code]public <T> T doSomething(Object obj, …

Member Avatar for SasseMan
0
187
Member Avatar for Sherif1410

AFAICT, if an explicit charset is not provided, Scanner class uses the default Charset when parsing the input stream. Two things you can try out: [LIST=1] [*]Add a SOP to the start of your program to print the default charset being used by adding the line: `[ICODE]System.out.println(Charset.defaultCharset().name())[/ICODE]` at the start …

Member Avatar for ~s.o.s~
0
8K
Member Avatar for axim0

Is that the same connection variable you are using for all of them? If yes, then you are effectively throwing away the connection retrieved. The way you should test is: retrieve the connection for a given database and fire some query specific to that database which will ensure that you …

Member Avatar for ~s.o.s~
0
705
Member Avatar for serdas

You can download the self-extracting .bin file for 1.4.2_19 from [url]http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html#j2sdk-1.4.2_30-sol-JPR[/url] After the download is done, just fire:[code] chmod +x j2sdk-1_4_2_19-linux-i586.bin ./j2sdk-1_4_2_19-linux-i586.bin[/code] This will fire-off the installer and bring up a licence agreement screen which you will have to agree to. Once installation is done, you'll have a new folder …

Member Avatar for serdas
0
371
Member Avatar for apines

A few articles you might be interested in: [LIST] [*][URL="http://eternallyconfuzzled.com/arts/jsw_art_bigo.aspx"]A blog article by Narue[/URL] [*][URL="http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o/487278#487278"]Simple explanation on Big-O at Stackoverflow[/URL] [/LIST] A few comments: [LIST] [*]Your use of pseudo code is kind of confusing; I think using a language like Java, Python etc. might be more clear [*]Try using LaTeX …

Member Avatar for Rashakil Fol
13
1K
Member Avatar for gsingh2011

A non-Java based obvious solution would be to grab mplayer and use its speeding up and scale tempo options; more here: [url]http://tux4life.wordpress.com/2009/01/07/change-mplayer-playback-speed/[/url] . If you want to do the same thing in Java, I'm not sure. Java based front ends (bindings) for mplayer etc. look terrible, are pretty much unusable …

Member Avatar for ~s.o.s~
0
116
Member Avatar for mohamed moamen

> i have a java class extend Httpservlet when i'm where i can but the servlet APIs to compile it If you have a servlet container like Tomcat/Jetty, you should be able to find these dependent JAR files (i.e. jar files part of servlet specification) somewhere in the Tomcat/Jetty directory …

Member Avatar for mohamed moamen
0
142
Member Avatar for gourav1

[quote]okay! let i have called o1.t.start(); and second statement is o2.t.start();(t is object of Thread class here and o1 and o2 are my objects of class implementing Runnable).now in this example i have seen is that both statement are executing give control to each other randomly.if in run(), i give …

Member Avatar for ~s.o.s~
0
329
Member Avatar for drsmith

Since it is you who controls the insertion into the database table, coding a listener which would notify or fire the refresh script as soon as insertion request for a particular table comes shouldn't be that difficult. Some other ways would be polling the table in consideration at regular intervals …

Member Avatar for twoclicks
0
529
Member Avatar for sofia85

[quote]I have a large file (11 GB), that I want to extract information from.[/quote] At the risk of posting some off-topic, is using Python an absolute requirement? If not, and assuming you are on *nix, you can easily extract the probability using a one-liner:[code] cat tab.txt | sed '1d' | …

Member Avatar for sofia85
0
148
Member Avatar for newbie14

Use a PreparedStatement which automatically takes care of escaping special characters and at the same time protecting you from [URL="https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet"]SQL Injection attacks[/URL].[code] PreparedStatement pstmt = connection.prepareStatement("select dataid from tbldata where datastring=?"); pstmt.setString(1, level2[0]); ResultSet rs = pstmt.executeQuery(); // use rs[/code] Use the same trick for inserting data so that you …

Member Avatar for thines01
0
188
Member Avatar for divsok
Member Avatar for arindam31

On the REPL, when you type a name which exists (can be a variable, class name, function etc.), the output shown is the str() representation of that name. For e.g. [code]>>> s = "Hello\nWorld" >>> s 'Hello\nWorld' >>> s.__str__() 'Hello\nWorld' >>> str(s) 'Hello\nWorld'[/code] If you want to view the output …

Member Avatar for arindam31
0
34K
Member Avatar for vegaseat
Member Avatar for jmichae3

[quote]if I make a code block and insert a *numeric* entity in the format ampersand-#-number-semicolon it comes out converted to html[/quote] Dani, I can confirm this is happening and even noparse tags can't resist the urge to parse the numeric entities. [quote]I don't think *anybody* has even a clue what …

Member Avatar for Dani
0
274
Member Avatar for efronefron

When creating the ServerSocket, make sure you are binding to the same host and port which the client is trying to connect to. Look into the different types of constructors offered by ServerSocket class and use the one which also allows you to specify the IP to bind to.

Member Avatar for ~s.o.s~
0
1K
Member Avatar for BoBok2002

You can't change it yourself. Please provide us an username which you would like to get it changed to (assuming it's not already taken).

Member Avatar for happygeek
0
60
Member Avatar for Dani

> I REALLY hope to see everyone there!!!!!!!! <3 I won't be able to make it but hope you have a great birthday bash with our fellow Daniweb members; party hard! :)

Member Avatar for nalini@121
4
418
Member Avatar for khaled_jawaher

[quote]no i m sure bcs i uses many other jar files in java with different applications and every thing goes well.but in this code i can't find what is the problem??[/quote] You need to have 'streambuffer.jar' file in your runtime classpath. Check whether you have that JAR included at both …

Member Avatar for ~s.o.s~
0
566

The End.