50 Solved Topics

Remove Filter
Member Avatar for BestJewSinceJC

Oracle Certified Professional Java Programmer was formerly known as the Sun Certified Java Programmer certification. Does anyone know if the switch to Oracle has changed anything significantly, such as the questions that will be on the test? Or is it the same cert with a new name? The reason I …

Member Avatar for prashantpatel
1
140
Member Avatar for BestJewSinceJC

Hi everyone, I'm in a situation where I would like to have a ServerSocket that listens on a specific port. However, if this port is already taken, I would like to listen on a different port. How can I advertise what port my Java program is listening on, so that …

Member Avatar for masijade
0
142
Member Avatar for BestJewSinceJC

[CODE] Integer i = 5; Integer j = 5; if (i == j) System.out.println("true"); [/CODE] ^ Prints true [CODE] Integer i = new Integer(5); Integer j = new Integer(5); if (i == j) System.out.println("true"); [/CODE] ^ Does not print true. I understand that in the second case, the == is …

Member Avatar for BestJewSinceJC
0
109
Member Avatar for BestJewSinceJC

On the old layout, the Mark as Solved button was easy to find and new members, and even some with nearly 200 posts, still rarely used it. Now it is, IMO, much too small. I knew the button would be somewhere and it still took me awhile to find. New …

Member Avatar for happygeek
3
224
Member Avatar for BestJewSinceJC

I was going to post this in the linux/unix board, but there is no 'start new thread' button. Why is that? Anyway, I'm going through a ton of steps to apply a patch file. Everything in the patch file seems to apply seamlessly, with one exception. My patch file is …

Member Avatar for BestJewSinceJC
0
65
Member Avatar for BestJewSinceJC

How can I create a semaphore using the above functions that will allow [I]any[/I] process access to the semaphore? I've been playing around with global variables for hours thinking I was doing it wrong, but now I believe I was misled. I think the problem is that the other processes …

0
79
Member Avatar for BestJewSinceJC

My sister has a windows vista machine and I have a windows 7. I want to connect remotely to her machine because she has a viruses, and I helped her track it to 'ave.exe' which is some trojan that edits registry values, starts itself when you start another process, won't …

Member Avatar for BestJewSinceJC
0
176
Member Avatar for BestJewSinceJC

I'm trying to write my own system calls. I have a .c file where I'm putting the system calls. My system calls use a struct, so I have declared a global variable that is an array of my struct. Lets just call it [CODE] //Stuff is the name of the …

Member Avatar for BestJewSinceJC
0
96
Member Avatar for BestJewSinceJC

What I've learned so far: An OS may trigger a software interrupt by executing a system call. According to what I read online, this is implemented via special instructions such as INT that the CPU can execute. I also understand how interrupts get handled by the interrupt service routine. My …

Member Avatar for BestJewSinceJC
0
170
Member Avatar for BestJewSinceJC

My book says that interrupt chaining is a "compromise between the overhead of a huge interrupt table and the inefficiency of dispatching to a single interrupt handler." I understand how the interrupt vector table works & why dispatching to a single interrupt handler is worse than choosing from an array. …

Member Avatar for BestJewSinceJC
0
194
Member Avatar for BestJewSinceJC

I'm wondering where to find what values system() accepts. For example, I want to list the server's OS type. I already did man system, did not find it very useful. And google is returning a lot but nothing relevant.

Member Avatar for BestJewSinceJC
0
78
Member Avatar for BestJewSinceJC

If I was using @$ as my flag pattern (to signal the end of the data) what would I do if @$ was seen in the data? I would just stuff another @$ right after it in the sender and in the receiver, if I saw two consecutive @$ I …

Member Avatar for BestJewSinceJC
0
613
Member Avatar for BestJewSinceJC

After compiling the code found [URL="http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#simpleclient"]here[/URL], I immediately got a number of errors. (Unfortunately, Beej is the starting point my instructor suggested to implement our FTP client's "minimal" commands, but that's another story). Anyway, I got rid of a few of them, then ran into this: [CODE]client.c:32 - error: storage …

Member Avatar for BestJewSinceJC
0
188
Member Avatar for BestJewSinceJC

It took me very little effort to put a JComboBox in a JTable so that when the cells in a certain column are clicked, it lets the user choose from a drop down list of items. However, my program requires that the underlying combo box can change, since the list …

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for BestJewSinceJC

Hey guys, I bought a new computer with 4 gigs of ram, 64 bit windows vista OS, dual core 2.4 ghz processor. . and I'm having some problems with it. Firefox frequently seems to mess up. Sometimes it won't stop loading a page when I click 'X', it will become …

Member Avatar for goldeagle2005
0
285
Member Avatar for BestJewSinceJC

The important code: [CODE] Browser browser = new Browser(shell, SWT.NONE); URL url = this.getClass().getResource("/example.html"); browser.setUrl(url.toString()); shell.open(); [/CODE] P.S. I've carefully considered what Masijade and others told me in the other thread; the example.html file is located in multiple locations, including in the same directory as the .class file. . I …

Member Avatar for kvprajapati
0
418
Member Avatar for BestJewSinceJC

edit: I see a lot of other threads on Daniweb on this. But after 2+ hours of reading about Sound in Java, I'm even more frustrated, so I have some questions. 1. Is the Java Sound API sufficient for the following operations: Playing mp3 audio files, pausing, and fast forward/rewinding …

Member Avatar for BestJewSinceJC
0
496
Member Avatar for BestJewSinceJC

[CODE=Java]URL myurl = this.getClass().getResource("/SummaryReport.rptdesign"); File file = new File(myurl.getFile()); System.out.println("Name=" + file.getAbsolutePath()); [/CODE] The above code seems to get the resource. But I guess I am going about creating a file connected to that resource wrong? Because I cannot subsequently open a FileReader connected to that file. . I am …

Member Avatar for ~s.o.s~
0
134
Member Avatar for BestJewSinceJC

After a little research I discovered some Calendar methods that were pretty nice. [CODE=Java]Date date = new Date(); int daysSinceSeen = - ( rand.nextInt() % 365 ); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, daysSinceSeen);[/CODE] How could this code be returning a date in 2010? Do I have a bug that …

Member Avatar for BestJewSinceJC
0
107
Member Avatar for BestJewSinceJC

What would be the best way to implement dynamic search? So, for example, given the words: the, then, behemoth, abchemto Typing in 'he' would return all of the above words since they all have he in them. Is the best way to do this using a Trie?

Member Avatar for BestJewSinceJC
0
375
Member Avatar for BestJewSinceJC

Ezzaral & James -- I remember (and found) a thread from a while back where you guys gave me an example of an Observer pattern. Basically a model had a List of interested Listeners. When the model changed, it went through a for loop, notifying each listener (the views) that …

Member Avatar for BestJewSinceJC
0
74
Member Avatar for BestJewSinceJC

In one View, I have text boxes and buttons. In the other View, I have a Pie Graph that I created using JFreeChart. When the button is clicked, I want the Pie Graph to be refreshed, displaying the new percentages (based on what the user entered in the text boxes). …

0
58
Member Avatar for BestJewSinceJC

Is using (in the paint method) g.clearRect() the correct way to clear the screen? It's working but I don't know if there is a better way. . google says it is supposed to clear automatically when update is called but that doesn't seem to happen.

Member Avatar for BestJewSinceJC
0
138
Member Avatar for BestJewSinceJC

I have a list of teams, it can be any length. Now, for each team, I want to create a 2D box that says the team's name in the box. And I want to match these teams up against each other. So basically I want to be able to drag …

Member Avatar for BestJewSinceJC
0
161
Member Avatar for BestJewSinceJC

How can I check if an event is user generated? When the user clicks on a combo box and changes the displayed/selected content, I want the code in the itemStateChanged method to be executed. But I only want this code to be executed if the method call was due to …

Member Avatar for BestJewSinceJC
0
96
Member Avatar for BestJewSinceJC

[CODE=Java]java.util.Vector<EmergencyContacts.ContactInfo> contacts = Application.getPatient().readEmergencyContacts().readContactInfos(); for (int i = 0; i < contacts.size(); i++){ EmergencyContacts.ContactInfo info = contacts.get(i); } public Vector<ContactInfo> readContactInfos(){ return contacts; } private Vector<ContactInfo> contacts = new Vector<ContactInfo>(); [/CODE] As you can see, it returns a Vector of ContactInfo. Why would I be getting an error saying, "Exception …

Member Avatar for quuba
0
132
Member Avatar for BestJewSinceJC

Question directed at JamesCherill specifically, (and anyone else who can answer it) I've never had [I]too[/I] much trouble with communicating between the model and the view, in an application that only has a model and a view. However, looking at the observer pattern (at the bottom) of this [URL="http://leepoint.net/notes-java/GUI/structure/ui-model-communication.html"]link[/URL], I …

Member Avatar for Ezzaral
0
1K
Member Avatar for BestJewSinceJC

I'm using the same file menu with the same menu items in multiple places. As such, they should have the same actionListeners etc since the same windows should open when they are clicked. How do I get netbeans to automatically do this (make them all use the same events and …

Member Avatar for Ezzaral
0
103
Member Avatar for BestJewSinceJC

I have a JTabbedPane inside a JFrame. I've been having a lot of problems with resizing and things like that. . how do I get the JTabbledPane to resize with the JFrame? So when the user drags the window open to a larger size, the JTabbedPane should be dragged to …

Member Avatar for BestJewSinceJC
0
200
Member Avatar for BestJewSinceJC

I was doing a bit of reading, and according to what I read, GUIs can be set up and realized in any thread, but doing more GUI work in a normal thread (non-EDT) after a call to setVisible can be dangerous. The explanation given is as follows: [QUOTE]The example constructs …

Member Avatar for BestJewSinceJC
0
103
Member Avatar for BestJewSinceJC

In netbeans I added a scroll pane + bar inside one of my JPanels. When I drag enough items into the JPanel, the size of the JPanel increases in netbeans. How do I get it so that it stays at a fixed size, so I can use the scroll bar?

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for BestJewSinceJC

I'm not sure what forum this fits into, if any, but the program itself is going to be written in Java (not that it matters much). My question is, what is the easiest software to use that I can create a drawing of a GUI with? The GUI I want …

Member Avatar for BestJewSinceJC
0
87
Member Avatar for BestJewSinceJC

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Java Sun's site is down right now so I can't check but I'm guessing this is an old method since according to Eclipse, the method doesn't exist anymore. So my question is, are there any other ways to do the same thing?

Member Avatar for BestJewSinceJC
0
112
Member Avatar for BestJewSinceJC

I have to write a program that mimics a digital clock w/ seconds, minutes, and hours. I'm sure I can get the displays working on my own and everything. My concern: what is the most efficient way to check the time? Should I just do Thread.sleep for 1 second then …

Member Avatar for Ezzaral
0
124
Member Avatar for BestJewSinceJC

I managed to delete the only up to date saved copy of an important Java project I had (I know, I know). I have the compiled .class files and I know it's possible to decompile them. Can anyone direct me to any references or anything to help me do this …

Member Avatar for BestJewSinceJC
0
132
Member Avatar for BestJewSinceJC

I'm trying to read in the whole file at once. If this code ever fails, my whole project will fail. I'm using the following: byte[] theFile = new byte[input2.available()]; then, input2.read(theFile); The API says something about blocking. What exactly is blocking, when will it happen, and how will it affect …

Member Avatar for BestJewSinceJC
0
91
Member Avatar for BestJewSinceJC

I had a problem w/ efficiency - The problem was that using String concatenation was inefficient for large text files, when reading the whole file into the String. I've since thought about it, and I guess this is because Strings are immutable - so every time concatenation is done, a …

Member Avatar for masijade
0
141
Member Avatar for BestJewSinceJC

I'm having trouble with storing bits as a byte. I've read probably 30 different sources about this already. I'm doing Huffman Compression. Lets say I read in the character "c" and I am supposed to output "1010". How would I go about doing that? I know how to write bytes …

Member Avatar for BestJewSinceJC
0
135
Member Avatar for BestJewSinceJC

I have two programs, one is a GUI and the other is a normal (non GUI) program. How do I make a method in the non-GUI program wait until a JButton on the GUI gets clicked before continuing? (No while loops) This is frustrating since I'm fairly certain somebody here …

Member Avatar for BestJewSinceJC
0
93
Member Avatar for BestJewSinceJC

Hey, one of you guys suggested that I go on Wikipedia's page for hash tables. It was actually pretty informative. I'm pressed for time so I am doing separate chaining for my hash table because it seems like it will be one of the easiest to implement (and according to …

Member Avatar for BestJewSinceJC
0
157
Member Avatar for BestJewSinceJC

parseInt does not seem to be throwing an exception when I pass a letter of the alphabet to it. I assume this is because ASCII letters are treated as integers. So my question is, is there a method that will do this: boolean isLetter(); And if not, how do I …

Member Avatar for ~s.o.s~
0
111
Member Avatar for BestJewSinceJC

Is there any way that I can take a String and somehow use it as if its the name of one of my declared Objects? For example, if I have an Animal named germanShephard, is there some way I could say String gerSh = "germanShephard"; and then treat gerSh as …

Member Avatar for ~s.o.s~
0
199
Member Avatar for BestJewSinceJC

I read about data forwarding and according to my notes, a nop (no-op) is required before a beq operation and after a lw operation. What about sw?

0
61
Member Avatar for BestJewSinceJC

This is supposed to draw a line through the JButtons when square9 is clicked. It doesn't work but there are no errors and I don't see what the problem is. Ezzaral gave me the code to draw the line earlier. Obviously, the winning squares aren't always diagonal, so I will …

Member Avatar for BestJewSinceJC
0
81
Member Avatar for BestJewSinceJC

I have a TicTacToe board and I need to draw a line through the X's or O's when someone wins. I know how to use the paint method, repaint, etc (as far as how they're called & the basics). I'm just not sure how to go about actually drawing the …

Member Avatar for BestJewSinceJC
0
92
Member Avatar for BestJewSinceJC

I saw someone, I think it was s.o.s, recommend the use of BigDecimal to someone else. So out of curiosity, and having heard of BigDecimal before, I looked at the Javadoc to see how large the values it could hold were and how it held them. From the doc: "Immutable, …

Member Avatar for jbennet
0
165
Member Avatar for BestJewSinceJC

Its basically telling me it doesn't know wth the pow() function is. But at the top of the file, I have #include<math.h> so shouldn't that work? And right after I have the #include, I declared the function definition of bintodec, so that isn't the problem either. [CODE]int bintodec(char* array){ int …

Member Avatar for BestJewSinceJC
0
114
Member Avatar for BestJewSinceJC

I'm confused how GridBagLayout can be used as if it was GridLayout(0,2). For example, I would like to lay out components like this: Label TextFieldForLabel Label TextFieldForLabel Label TextFieldForLabel Label TextFieldForLabel I thought by making a GridBagConstraints() Object, then setting the gridx and gridy variables, this could be accomplished (Java …

Member Avatar for Ezzaral
0
110
Member Avatar for BestJewSinceJC

All I can think is that there's something fundamentally wrong with how I programmed my GUIs. I have a program that initially displays a GUI which has 6 buttons. Each of these buttons, when clicked, displays a GUI. One of these GUIs in particular is a JTable of "Teams". Each …

Member Avatar for BestJewSinceJC
0
774
Member Avatar for BestJewSinceJC

Ok so lets say I have any GUI that needs its contents changed while it is running, so that it will re-display the new contents. An example would be a JTable that just lists things from an ArrayList. So if I had an ArrayList<GroceryList> my JTable might have Cheese Crackers …

Member Avatar for sanaulla123
0
7K

The End.