7,116 Posted Topics
Re: > only God knows and they are not talking to me at the moment. Presuming that you are using "they" as a gender-neutral pronoun, then shouldn't that be "they is not talking to me"? It sounds so wrong, but it's logical. If, on the other hand you are referring specifically … | |
Re: You're going to need an extra loop to keep trying new random numbers until you get one that is divisible by 3 and not present in the numbers you have already got... in pseudocode... int nextGoodRandom() { do get a random nunber until number %3==0 AND number is not in … | |
Re: Almost 200 lies of code with exactly one comment: "bad loop" We have import statements inside a class We have zero logging, tracing, debugging info We have at least 3 methods with zero code in them We have a BufferedImage that's created at great cost them immediately garbage collected We … | |
Re: Where are the women? Or is it a male-hiring-only organisation? | |
![]() | Re: In the server code I can't see where you uodate `count`. I was expecting a `count++` somewhere. the client code listing seems to be corrupted - main method is missing code and server code replaces it! please repost the client. |
Re: Sure there are people here who will help. You need to explain exactly what help you need! | |
Re: In general you would use another class to represent the set of all Clients, eg "ClientBase". It would have public methods like `addClient`, `printClients`, `printClientsSorted` etc. Internally it may hold those Clients in an array, or ot may be that some kind of List or Map works better, but by … | |
Re: Line 14 Suppose `i` is counting up in fives, i%10 is 0 every other pass ( 5, 10, 15, 20 etc) , so you get a new line every 2 passes. You need a separate counter for the 10 items per line. | |
Re: I guess you have never heard of something called an "iPad", let alone the "iPad Pro". The screens on these beasts are better than on most PCs. Some of us have moved on from computers that need a trolly with wheels to be moved. It's alomost 2020... what are the … | |
Re: You will be working in your chosen career well through the middle of the 2100's Computer skills will be absolutely essential for you to use the necessary tools and technologies. Your teachers are trying to help you acquire those skills. Maybe you won't be using visual studio, but the understanding … | |
Re: If you can't tell the difference then this application is too advanced for your current level of knowledge | |
Re: What's happening is: if `available[i]` is 1, the first case is executed, in which `available[i]` is changed to 0 if `available[i]` is 0, the second case is executed, in which `available[i]` is changed to 1 so on each pass of the loop you will execute one of those cases and … | |
Re: Current versions of Java do support multiple inheritance from interfaces. So your question is in error. | |
Re: Good advice, but 9 years too late. | |
Re: A `char` is a one-byte integer value, used ti hold the ASCII value of a single character. A string literal (enclosed in double quotes) is equivalent to an array of chars. So on line 5 you are trying to assign an array (more precisely a pointer to an array) to … | |
Re: > In your case you may wish to start with an array, fill it with the starting data or states then code to follow those rules and iterate (loop) over the rule the number of times you wish. You can't do this with one array. You need a second array … | |
Re: My neighbour's son is a freelance 3D graphics artist. He had two years work on his PC when someone in the flat below fell asleep with cigarette in his hand, and burned down the building. That was last month. He had no backups. He justifies it by saying how rare … | |
Re: You are missing a semi-colon on line 238. (Yes, I know its a guess, but since you didn't say what the problem was, or show us the code, all I had was a guess) | |
Re: You have (quite rightly) overridden `paintComponent`. super's `paintComponent` is responsible for clearing/setting the background, so you have missed that functionality and and are starting with whatever is left over in one of Swing's graphics buffers. your `paintComponent` method needs to start with a `super.paintComponent(g);` on its first call to ensure … | |
Re: Wrong wrong wrong. Terrible advice. Layout managers are essential for creating apps that run on screens with different resolutions or different fonts. You need to learn to use them, not turn them off. See https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html | |
Re: You are using Java 7 - no public support since 2015. You should be very worried about your security. Current Java is 13. So the first thing is to update all your installations before trying again. Also that "classForDriver" thing was replaced years and years ago by DriverManager. see https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html … | |
Re: I saw this topic briefy late last night (C.E.S.T.) and it seemed odd. Now in the morning it still seems odd. It's not at all clear what is the problem here. Whenever you add or delete products you need to update the combo box's contents (add or remove an item, … | |
Re: Something like this should give you enough info... Stream<Integer> si = Stream.of(1, 2, 3, 4, 5); List<Optional<Integer>> result = si.filter(i -> i < 4). map(i -> Optional.of(i)). collect(Collectors.toList()); System.out.println(result); | |
Re: That could be much easier amd faster of you sorted the List (or create a sorted copy) first. Then just store every record that's equal to the previous record. If not... have you tried changing line 5 to `for(int j = i+1; ...` ... which should fix it for one … | |
Re: > You don't specify an array size in the parameter list. I thought that was pefectly valid in C ... am I wrong? | |
Re: Room1 has three exits but only one connecting room, so any attempt to go in the second or third exit will crash for lack of a corresponding connecting room. | |
Re: Here's the help you need: You won't learn anything from someone else writing the code. Do your best then if you get stuck come back here and explain what you have done and what's stopping you going further. | |
Re: First look at what is inside each loop and decide whether it belongs inside or outside the loop. Eg: how many times do you want to print out the standard deviation? How many times do you need to calcuiate the total? Second: what is `noLoop() `? | |
Re: You can't define a method inside another method. ps: next time post the complete error message with line numbers etc | |
Re: You must explain exactly what help you need. | |
At the risk of making a total fool of myself... I got very excited when I discovered that Java's "only opaque rectangular windows" limitation has been removed. Full release is intended for Java 7, but working methods can be accessed thru com.sun.awt.AWTUtilities in recent releases of Java 6 (I'm using … | |
Re: If you only have 243 combinations to process then you could program it in anything and it would still take a millisecond For performance to be an issue you need to be processing billions of combinations (assuming there's no I/O or database access needed). In any case, any modern compiled … | |
Re: Do you mean MVC as in Model-View-Controller? If so, it's just an architectural principle. A quick Google will point you to dozens of explanations - all less than a page long. There's not much to learn about that. Depending on language and architecture there are many MVC frameworks and libraries, … | |
Re: probably 2(n+1) that looks like a function call - the multiplication needs to be explicit as in 2*(n+1) | |
Re: == and != for objects test for RH and LH expressions both referring to exactly the same object (or not). The `equals` method tests that the two objects are equivalent in some sense that depends on what kind of object they are. Eg for two Strings it tests that they … | |
Re: How about something to manage Users... logon, password verification, privileges/authorisations, preferences etc You could have it as a API then optionally layer a GUI on top. | |
Re: +1 for the "second thought" > I wouldn't use Settings variables. They are stored in clear text (Depending on your language) it's only a few lines of code to encrypt all the info and Base64 encode it for storage in a "plain text" medium. IMHO that's a lot simpler than … | |
Re: That seems backewards to me. For a first learning exercise in REST maybe it would be better to start with the essential univeral REST components - a Client and a Server. They should implement the relevant commands (GET etc). You could start with just one resource that the server has … | |
Re: It's just how the designers of those two functions decided they should work. | |
I'm asking this question in the context of a satellite internet service with expensive download limits... If you just accept all the recommended updates for Windows 10 (creator's update, security etc) for a single Home Edition machine how many Gigabytes will that represent in a typical 12 month period? Eg: … | |
Re: If you start to press the next key before you have fully released the previous one then the release will override the press. Maybe that's part of the problem??? | |
Re: Looks like a design problem around when you read the input from the ObjectInputStreams - you only try to read them after sending something. So the client can send something but the server won't respond until something is typed a the server. The way this is normally done is to … | |
Re: The last link you posted explains how to get and understand the magnitudes, so what exactly is your question? | |
Re: > I could create a GUI using Swing and add by using Robot class to imitate mouseactions and keyactions and by using screen capture and Compression and TCP/socket programming I could send the images. There was a long thread on this subject a couple of years ago here. We did … | |
Re: ^ like he said. Waiting for a connection has to be done in its own thread if you want the app to respond to anything else while waiting. Same goes for the whileChatting loop | |
Re: That's really close, but in copying (length+1) bytes (lines 26-31): you copy the same byte repeatedly. in replicating one byte (lines34-38) you don't skip the byte you are copying. Testing code on real data is easy - it either works or it doesn't. But debugging it is a nightmare because … | |
Re: For Each HDDDET In HDD.Get HDD_DETLAIS = etc TextBox1.Text = HDD_DETLAIS Next You loop through all the disks setting the text box to dosplay their details BUT each one immediately overwrites the previous one so all you ever see is the last. To see all the disks you need to … |
The End.