7,116 Posted Topics

Member Avatar for alemojarro

This is a Swing context, so never use sleep etc. It looks like this code is the "model", so best to use a Java.util.Timer (runs in its own thread)

Member Avatar for JamesCherrill
0
96
Member Avatar for Newbiejavagirl

Do you have the spreadsheet as a file, or do you have all the data in arrays or some other data structure. If it's the latter then you can use ordinary SQL commands via JDBC to update the database.

Member Avatar for JamesCherrill
0
100
Member Avatar for Zubenna

I sense a non-argument here! If the goal is to write the simplest Java code then use a set. If this is a beginners exercise in arrays and algorithms then Slavi's algorithm with stultuske's addendum. My guess is that it's the beginner's version.

Member Avatar for JamesCherrill
0
326
Member Avatar for BustACode
Member Avatar for fonzali
1
1K
Member Avatar for hakeemtunde

Without seeing what you have done, and because you hae not asked any specific questions, how can anyone help?

Member Avatar for hakeemtunde
0
175
Member Avatar for ali11
Member Avatar for garkle

That's the compiler being a bit smart. It's checking that you always return a value as specified in the method signature. Suppose your data is such that none of the cases is true... In that case it will drop through the switch and hit the end of the method without …

Member Avatar for JamesCherrill
0
397
Member Avatar for chivini
Member Avatar for SwtNemesis

(year % 100 != 0) && (year % 400 == 0 ) something wrong there... if (year % 100 != 0) then (year % 400 cannot be == 0 ) ps: I guess you know that the current (Gregorian) calendar is only valid from 1752?

Member Avatar for David W
0
2K
Member Avatar for Satyajit Rath

[Here's](http://docs.oracle.com/javase/tutorial/networking/sockets/index.html) a good tutorial on using input and putput streams over Sockets, but instead of using print streams, you can use ObjectOutputStream and ObjectInputStream to transfer your image object.

Member Avatar for JamesCherrill
0
148
Member Avatar for QuizzNaYeeziey

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java …

Member Avatar for JamesCherrill
-2
267
Member Avatar for Pobunjenik

"but to no avail", while very poetic, tells us nothing. What was wrong with it? Did you set a mono-spaced font eg Courier?

Member Avatar for sishenyelang
0
1K
Member Avatar for Gribouillis

How short is "short"? If the string/file is less than 2^16 characters long then there will be at least one UniCode character that's not in the string, and which will therefore meet your requirement. ;)

Member Avatar for Gribouillis
0
334
Member Avatar for michael.james.90475
Member Avatar for michael.james.90475
0
255
Member Avatar for Gl753

`Integer.parseInt(...` takes the string that the user entered and converts it to an int. You can put that into an array of doubles, but you will have lost everything after the decimal point. If you want to parse a string for a double value it's a very similar method... `Double.parseDouble(...`

Member Avatar for samson.dadson.3_1
0
229
Member Avatar for Markyboy

Even after you fix that... When your method reaches the return statement it will immediatley return to the caller, and any remaining statements will not be executed. That's what your error message means - lines 43-49 can never be reached because line 41 will exit the method.

Member Avatar for samson.dadson.3_1
0
224
Member Avatar for Ant695

You are using + to concatenate stuff for printing, OK, but you have left some out. You need a + between every expression.. "there are " + weeks + " in " + (etc)

Member Avatar for michael.james.90475
0
236
Member Avatar for amogh.max

You can do this by using JDBC to read the data and a JTable to display it. It's a fairly common thing to do, so you'll find many examples and tutorials on the web - just Google `JDBC` and `JTable` together

Member Avatar for JamesCherrill
0
419
Member Avatar for serubiri

So what is it about making your jar that you need help with... How to make a jar in NetBeans? How to embed images in a jar? How to embed a database in a jar? Sonething else?

Member Avatar for serubiri
0
370
Member Avatar for johnny70

I don't know, but you could try printing the contents of firstLine to see what's happening. Maybe it's something that's not displayed, like "<html>" ???

Member Avatar for JamesCherrill
0
770
Member Avatar for Kadian

? Splitting the declaration onto 3 lines will have zero effect. This is not a "null" problem, it's an undefined symbol. The problem is that the Preference class is not known when compiling that code. Where is the Preferences enum defined?

Member Avatar for JamesCherrill
0
164
Member Avatar for sesaso

You must try to answer this question. Show us your answer and we will help you to get it right.

Member Avatar for JamesCherrill
0
315
Member Avatar for Roger_2
Member Avatar for Kujinn

SQL isn't going to loom large in a Game. Java hasn't been used much in the past for games, but modern Java and JavaFX is no worse than c#/.NET, and lot more portable. However, the big question is "where does IOS fit (if anywhere) in your target gaming market?". IOS …

Member Avatar for admiri92
0
198
Member Avatar for SkateX

Lines 43-51 you set the same data for all 3 cats, using the data from the third/last pass of you input loop, so when you print them of course you see the same data You need to set cat1 *during* the first pass of your loop, cat2 in the second …

Member Avatar for JamesCherrill
0
305
Member Avatar for jjones0150

The thing that immediately jumps out is that on line 44 you comment *end of for loop*, but theres no closing bracket to implement that, so the for loop is not going to end where you think, and subsequesnt loops and blocks will also be suspect. If you are using …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Amenda.St

YOU can use Java Sockets to connect to a web site, send an HTLM request, and read the response. The hard part is usually parsing the web page to extract the right data. The first half of [this tutorial](http://www.binarytides.com/java-socket-programming-tutorial/) shows you how to get the web page's HTML. The parsing …

Member Avatar for peter_budo
0
255
Member Avatar for ema-miles

Nobody will send you the code. Sending you the code will only help you to cheat. Either do the work or drop the class. If you want to take this seriously, post what you have done so far and someone will hel you from there

Member Avatar for stultuske
-3
133
Member Avatar for skill11

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there.

Member Avatar for JamesCherrill
0
120
Member Avatar for murali2489

The check is obviously done in your isInteger method, so you need to change that. Edit: djjeavons makes a good point. My advice above is bad. Don't change isInteger - maybe create a new isAlphanumeric method to parallel isInteger but with the tests you need.

Member Avatar for djjeavons
0
176
Member Avatar for Farhanalee

I suggest you post this in the Java forum, but first check the DaniWeb Member Rules and "provide evidence of having done some work yourself if posting questions from school or work assignments"

Member Avatar for stultuske
0
140
Member Avatar for OMER AHMED

Sending mouse and keyboard events depends on the language you use, but the real problem is how to send and update the real-time screen image across a limited bandwith. It all comes down to how you compress the screen images. We had a long thread on this in the Java …

Member Avatar for JamesCherrill
0
927
Member Avatar for divinity02

You input two mileage figures (`exmile`, `retmile`), but your if tests use `mileage`, which you never set. Typically you would have a do....while loop that keeps processing user input until the user enters a "stop" value (eg a car ID number of <= 0), or you ask if there's more …

Member Avatar for divinity02
0
180
Member Avatar for lena1990

Obviously you can use bitwize operations to separate out the two bytes of each short and store them into consecutive elements of a byte array (and vice-versa), but does anyone know a smarter solution?

Member Avatar for JamesCherrill
0
357
Member Avatar for divinity02

There's no one absolute definition of "Object Oriented", so different people will give diferent answers to those questions. Here are my first attempts: All Java OO programs are Java programs All Java programs are OO to some degree because that's how the API is designed. Some people write Java programs …

Member Avatar for divinity02
0
324
Member Avatar for AmrMohammed

That's his opinion - my opinion is opposite. The "resource deprived hardware" phones he talks about have more memory and compute power than the mainframes I learned on. Every new verison of a phone is faster and more powerful than the previous. Hardware isn't the problem. More functional, more intelligent, …

Member Avatar for JamesCherrill
0
162
Member Avatar for Sphinx'LostNose

[This web page ](https://crackstation.net/hashing-security.htm)has an excellent discussion of how to do it (and how not to do it)

Member Avatar for mike_2000_17
0
281
Member Avatar for ali11

It's creating a grid to display one month's calendar, one week per row x 7 columns. It loops through all the days, divides by 7 to get the week (row), and modulos by 7 to get the day (col). The "som" variable contains the day (Mon, Tues etc) corresponding to …

Member Avatar for JamesCherrill
0
134
Member Avatar for iamthwee

Since you mention Mac OSX... Your sizes and positions seem to be in pixels(?). How do you deal with the difference between "retina" displays and older ones with pixels more than twice the size?

Member Avatar for iamthwee
0
502
Member Avatar for LostnC

After 5 years either he will have got the answer or have given up. Please don't re-awaken old dead threads without a good reason.

Member Avatar for deceptikon
0
3K
Member Avatar for SkateX

You obviously need to re-initialise your booleans each time the user enters a new password (ie around lines 19 to 31)

Member Avatar for SkateX
0
561
Member Avatar for Qaim
Member Avatar for saurabh.mehta.33234

You seem to be ignoring the end-of-line char(s). What did you intend wih the two calls to readLine?

Member Avatar for JamesCherrill
0
1K
Member Avatar for Sara_9

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for stultuske
0
263
Member Avatar for amogh.max

Use String's `split` method http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)

Member Avatar for JamesCherrill
0
185
Member Avatar for AmrMohammed

Java EE is a superset of Java SE that has tools for Enterprise-scale application development and deployment. Java SE includes all you need to perform transactions on popular SQL databases. See the Java SE tutorials for JDBC: http://docs.oracle.com/javase/tutorial/jdbc/index.html

Member Avatar for JamesCherrill
0
195
Member Avatar for Trevor_5

Line 16 you create a new array of ints. You don't provide any initialisation, so all the elements are 0. Lines 17-25 are only executed if the array elements are not 0 - so they are never executed.

Member Avatar for Trevor_5
0
253
Member Avatar for divinity02
Member Avatar for Builder_1

Soiunds like a homework question to me! Read the [DaniWeb Rules](https://www.daniweb.com/community/rules) What do **you** think the answer is?

Member Avatar for iamthwee
0
164
Member Avatar for Builder_1

Just think of the number in in its binary representation. What question will tell you the value of the first bit? Knowing that, what question will tell you the value of the next bit? How many questions will you need to know the values of all the bits?

Member Avatar for SalmiSoft
0
133

The End.