7,116 Posted Topics

Member Avatar for JamesCherrill

This is a little discussion/example of design for modularity and re-use, inspired by javaAddict and Orlando Augusto posts in their thread “Dynamic Multidimensional Array Printing” https://www.daniweb.com/programming/software-development/code/305580/dynamic-multidimensional-array-printing That thread has 3 solutions to printing the contents of a multi-dimensional array of arbitrary dimensions - although in fact all the solutions will …

Member Avatar for JamesCherrill
1
462
Member Avatar for javaAddict

Neater to use the modern Java for-each loop: [CODE]for (Object o : obj) { ...[/CODE] rather than the old C-style looping: [CODE]int length = Array.getLength(obj); int i=0; // NB this is redundant! for (i=0;i<length;i++) { Object o = Array.get(obj, i); ...[/CODE]

Member Avatar for JamesCherrill
0
929
Member Avatar for djabri

Do what you are supposed to do and write it yourself. Coming here and making rude demands is not the way to go. https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

Member Avatar for JamesCherrill
0
91
Member Avatar for Zorrro
Member Avatar for Fola_1

If you don't know if the code is c, c++, or Java then it's hard to take this seriously.

Member Avatar for JamesCherrill
0
213
Member Avatar for Rajesh8367
Member Avatar for David_83

It's interesting that the stack for your error doesn't include any of your code - it's just Swing re-drawing the JTable. So the exception is NOT being thrown from any code that you wrote. The implication is that you, at some earlier time, populated a cell that should be numeric …

Member Avatar for JamesCherrill
0
1K
Member Avatar for newbie14

Hi newbie. I remember this! If the queue keeps growing then the real problem is that you are processing database updates more slowly than new transactions are arriving. Messing about with threads and queues around the input won't change that. I don't fully understand the changes you propose, but I …

Member Avatar for JamesCherrill
0
246
Member Avatar for Amiel_2
Member Avatar for JamesCherrill
0
368
Member Avatar for skimmpy

Before going too far down the reinventing-the-wheel path, have a look at Netbeans, eg "Insert code..."

Member Avatar for JamesCherrill
0
134
Member Avatar for David W

I’m all in favour of this idea. I’ve seen far too many posts here from beginners struggling or failing with Scanner, so an alternative is much needed. David has has posted a whole load of code, but I'm going to ignore that for a moment and try to continue the …

Member Avatar for JamesCherrill
0
1K
Member Avatar for JamesCherrill

This class is intended as a small and simple alternative to java.util.Scanner for people in the early stages of learning Java. Unlike Scanner it has built-in error handling and retry, it throws no checked exceptions, is as tolerant as possible of variations in the format of user input, and avoids …

Member Avatar for sam_30
3
6K
Member Avatar for Adrian_11

Read this before posting: https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

Member Avatar for stultuske
-2
213
Member Avatar for Lois_4

Read this before posting: https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question

Member Avatar for JamesCherrill
0
465
Member Avatar for giancan

Maybe sort the list based on the first value. Then it's trivial to find consecutive entries that are within tolerance for the first value. For each set of such entries sort it by the second value and find the subsets that are within tolerance for the second value. Replace those …

Member Avatar for JamesCherrill
0
822
Member Avatar for Adnan_9

If you want help you must explain what you are trying to do, and exactly what help you need.

Member Avatar for JamesCherrill
0
118
Member Avatar for JamesCherrill

Assertnull and I have cooked up a little Java utility that we think will be useful for early-stage beginners, and I'm planning to post it for anyone to use. Is there some preferred short copyright/ownership/licence statement that I should include at the start of the code? I know that Daniweb …

Member Avatar for JamesCherrill
0
309
Member Avatar for Nol_1

The error message should include a line number... that's important Anyway, line 82 of the second class refers to mortgage, which is a variable in the first class. You don't need that to call a method in the same class. You can just say calcC()

Member Avatar for Nol_1
0
403
Member Avatar for PulsarScript

This code includes a copy of a "Console" class that has popped up a couple of times recently. Maybe the work of David W. ? It's obviously intended as a replacement for the dreaded Scanner class, so I'm all in favour of that! Before it gets too widely copied & …

Member Avatar for PulsarScript
0
599
Member Avatar for IcyFire

Maybe its because your layout manager isn't updating to include the new JLabel until you force it by re-sizing the window. Try calling revalidate() (and maybe also repaint()) after adding the JLabel

Member Avatar for rproffitt
0
7K
Member Avatar for AssertNull

I'm not good at regex, so I often start by removing all the white space (one simple method call) so what remains is easier to parse.

Member Avatar for AssertNull
0
378
Member Avatar for sarah_15

If you "finished it" by using the hundreds of lines of code from David W then you are deceiving yourself. All you wil have done is to get through this exercise without learning the skills it was supposed to teach, which means you will be in an even worse state …

Member Avatar for JamesCherrill
0
1K
Member Avatar for newbee_jv

`results` has just two entries (see lines 11,12). You can add stuff to the maps that they contain, but there are still only two entries in `results`itself Try printing the contents of all your maps to see what's going on - at first sight I think your code is doing …

Member Avatar for JamesCherrill
0
175
Member Avatar for AssertNull

Have a look at the JavaScript support in Java - it allows you to run javascript (and other scripting languages) dynamically from your Java program while sharing varaiables and objects between the two. So you can pass javascript in a String along with any Java values or objects, execute it, …

Member Avatar for AssertNull
0
1K
Member Avatar for AssertNull

> to protect you from yourself so you can't screw anything up. Just don't touch it. You don't need to touch it or know about it or care about it. It's for me, not for you. Well, yes, that's about as inflamatory answer as anyone can give their boss or …

Member Avatar for AssertNull
0
241
Member Avatar for Louie_3

> id like to know the java program of this one We do not do people's homework for them. Try to write it yourself. If you get stuck post what you have done so far and explain what help you need.

Member Avatar for FC Jamison
0
150
Member Avatar for שנהב

Maybe a small point, but naming is ever so important in OO implementations... Would that class not be better called "Connection"?

Member Avatar for JamesCherrill
0
5K
Member Avatar for Sandeep_21

A course will teach you a specific technology. The knowledge you gain will be out of date soon afetr you finish the course. Whatever is "booming" today will be "boring" in a year or two. Your career will continue for decades. So rprofit is right. Get as wide a range …

Member Avatar for AssertNull
0
261
Member Avatar for Ashraf_6

Trying to use dubious tools when you don't understand the underlying code is a really bad idea. At best you'll get some result that you won't understand, at worst you'll just get more and more confused. GridLayout is really simple to use. You don't need any tools. Just read the …

Member Avatar for JamesCherrill
0
156
Member Avatar for Violet_82

I'm with stultuske on this one. Looking at your posts here you are trying to do way too many things at the same time. Stop messing about with frameworks and code repositories and concentrate on mastering the basics of Java coding.

Member Avatar for JamesCherrill
0
1K
Member Avatar for Jayvis
Member Avatar for oresnik

Arrays are not easy to use when you want to have a growing list of values like that. You need to start with a large array, and have a separate counter that tells you how many values you have actually used so far (initially zero). The counter then tells you …

Member Avatar for Shaun_4
0
2K
Member Avatar for PulsarScript

If the program won't compile then its utterly pointless trying to execute it. If it doesn't compile tell us what the error is and on which line. Don't expect us to guess.

Member Avatar for JamesCherrill
0
391
Member Avatar for PulsarScript

"I assume i do something wrong" tells us nothing. If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should be.

Member Avatar for JamesCherrill
0
296
Member Avatar for divinity02

You have a load of get methods that change the values of your variables, eg public double gethoursWork() { hoursWork = hoursWork * rateOfpay ; return hoursWork; } now suppose hoursWork starts out at 10, and rateOfpay is 8 call getHoursWork and it will return 80 call it again and …

Member Avatar for JamesCherrill
0
224
Member Avatar for PulsarScript

Client line 19 you use `write`, which just writes the low byte of its int parameter, but in the client you `readInt`, which neeeds 4 bytes, so the `readInt` is still waiting for the last 3 bytes.

Member Avatar for PulsarScript
0
1K
Member Avatar for Edison_2

Hey yes, welcome. Get started by helping to answer other people' questions, or asking sensible questions of your own. The more you put in, the more you get out.

Member Avatar for Dani
0
230
Member Avatar for Drew-Shawn
Member Avatar for cproger

You will need the window with the back button to have a reference to the other window that needs to be closed. Then you can call that window's dispose method... JFrame otherWindow = // a reference to the other window backButton.addActionListener(e -> { otherWindow.dispose(); this.dispose(); });

Member Avatar for cproger
0
237
Member Avatar for spluskhan

Maybe that is overkill, maybe not, but in any case, starting with OP's tables, they need at least some kind of foreign key to relate Bills to Consumers. Without that the problem has no solution.

Member Avatar for diafol
0
912
Member Avatar for Mark_54

> basic tenants of software object based design, and a little about how developers communicate and work together A key idea here is that objects have a public interface and everything else is encapsualted (hidden) inside. So developers need to discuss and agree those public interfaces. In general they don't …

Member Avatar for JamesCherrill
0
324
Member Avatar for Suzie999

If you are measuring network packets then the OS code involved in receiving those packets will be orders of magnitude more than anything you are adding. Just make sure your code is maintainable, that's all you need to worry about,

Member Avatar for JamesCherrill
0
311
Member Avatar for Violet_82

Well done! In general, yes, install the latest SDK and wait for everything to re-build, then change the settings for each project where you want to use JDK 8 features. At least yur JKD7 code will still compile & run using Java 7 rules & syntax, but without the unfixed …

Member Avatar for JamesCherrill
0
300
Member Avatar for Isky

It's a real problem with Scanner's design - so many people fall into this trap. You have some input with an int followed by some text, eg 101 John Doe ... and you try to read it with int num = scanner.nextInt(); String name = scanner.nextLine(); ... and name is …

Member Avatar for stultuske
0
21K
Member Avatar for Mark_54

If you know Java then JavaScript is just like a children's version of Java and you can pick it up in no time at all. Do that anyway, becuase Java at the server is so often used with JavaScript at the client. Java is absolutely massive in the web server …

Member Avatar for Reverend Jim
0
441
Member Avatar for Shuaibu_1

Seriously? You're doing a dissertation for a Master's degree and you don't know how to use Google search? Go away and do some work yourself. If/when you get stuck you can come back here with your specific problem and people will try to help you, but nobody is going to …

Member Avatar for rproffitt
-2
210
Member Avatar for Kajal_3

You just copy/pasted your assignment without even a moment taken to explain what help you need. 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 …

Member Avatar for JamesCherrill
-1
342
Member Avatar for Yuna_1
Member Avatar for pritaeas

> only 8% of our overall traffic is on mobile. Chicken or egg? Surely nobody would develeop a new networking environment in 2016 without supporting Androis and IOS devices!

Member Avatar for diafol
2
644
Member Avatar for Nathan_7

I was Principal Consultant with Easel/VMark after they acquired the Enfin Smalltalk implementation (now part of Object Studio) in the 1990's. The claims made for Smalltalk are largely true. It was my first intro to formal Object Oriented programming and I never looked back. It was truely ground-breaking, and highly …

Member Avatar for rubberman
0
257

The End.