- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 5
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
47 Posted Topics
Often we're faced with the need to represent primitive data types as readable/writable bytes that can be sent through a data stream. In Java, there are classes such as DataOutputStream/DataInputStream that can do the work for us, but often a programmer wants to manage the conversions himself (or herself, to … | |
Re: Only way I know how to emulate a switch on strings, and this has already been mentioned without example code, is like the following: [CODE=java]void StringSwitch (String str) { if (str == null) { /* If the String is null... */ } else if (str.equals ("Some Possibility")) { /* ... … | |
Re: *squints at code* ..... Haha, silly me. I missed this at first glance. 1) instead of [INLINECODE]*.addActionPerformed(this);[/INLINECODE] use [INLINECODE]*.addActionListener(this);[/INLINECODE] 2) [INLINECODE]e.getSource()[/INLINECODE] returns an [B]Object[/B], and switch statements work with [B]int[/B] values. ;) Might wanna reconsider, with casting and/or an if-else statement. | |
Re: Oh my. For one, I think this is how you meant to represent your code: [CODE=java] class Rev { char a[]; char i=3; void str() { for(i='A';i<'D';i++) { a[i]='i'; } } void show() { for(int i='A';i<'D';i++) { System.out.print(a[i]); } } void reversStr() { for(i='A';i<'D';i++) { System.out.print(a[i]); } } } class … | |
Hi. I've had this problem with all my ubuntu installations (two, to date), and I can't find my way around it.. Even when I switch to runevel 3, by booting with special options or typing telinit 3.. Even THEN, X server starts up, and that's the ONE thing I need … | |
Re: I was thinking the same: wonderfully, unnecessarily large, but, that's how I used to code when I first started out. Make friends with arrays. Your exact program - the logic and all - could be condensed into at least 1/4 that size by working with arrays and more generalized methods, … | |
Re: Does (ballX, ballY) represent the center of the ball, or the top-left edge of the bounding square? For one, this if statement looks somewhat "iffy": [INLINECODE]if (ballY < 0 || ballY > (getHeight()-25) && ballX > paddleX && ballX < (paddleX +50))[/INLINECODE] Consider grouping the conditions with parenthesis more.. I … | |
SO, I'm playing around with an idea. I'm trying to convert primitives to and from a char array for file logging. I've got all the details worked out, but I don't understand something.. Take the following case, for example: [CODE]public static byte[] ToByta (short data) { return new byte[]{ (byte)(data … | |
Heyo My laptop has a webcam and a mic built-in on top. The laptop is XPS M1210 The distro is Kubuntu 2.6.20-16-generic The problem I've had, ever since I bought the laptop and installed beloved Ubuntu, is that while the webcam is not supported, it overheats rapidly while the laptop … | |
Hey! There has been a question on my mind for a while regarding the JRE and the class loader (or, loading classes into RAM if it's different). Java classes define variable members, methods, and subclasses. I know that when you create a new instance of a class, memory is allocated … | |
Re: Have you researched this? Perhaps, and especially for questions such as yours, you should check Google or some other appropriate search engine for results. You seem to know the words "Java" and "Uppercase" well enough. Take a look at this - be amazed: [url]http://www.google.ca/search?hl=en&q=java+uppercase&btnG=Search&meta=[/url] And can you believe that it … | |
Re: [QUOTE]But even then, reverser engineering can still be performed by determined people.[/QUOTE] Yea, like someone in serious need of "homework help". Jars are just another archive-type file.. The purpose is to hold a number of files under a common name, "myfile.jar", to keep organized and to make it easier for … | |
Re: One reason for the "no" is that Java uses Java-specific resources.. Take the hundreds of importable classes, for example. Take swing, awt, net, etc, etc, and realize that all of these packages were written in Java and are available only to Java. Of course, almost anything you can do in … | |
Re: You have to analyze the input one character at a time... [INDENT]Say we have a string: myString Set up a [I]for loop[/I] with a lower limit of 0 and an upper limit of [INLINECODE]myString.length()-1[/INLINECODE] inclusive Read each character one at a time with [INLINECODE]myString.charAt(int index)[/INLINECODE] Analyze the single character. What … | |
Re: Hmmm. I can't be super helpful before I fall asleep tonight, but.. First thing is working with [URL="http://java.sun.com/docs/books/tutorial/java/generics/index.html"]Generics[/URL] Regular expressions? I'm not very good with those.. But you can find [URL="http://java.sun.com/docs/books/tutorial/essential/regex/index.html"]tutorials[/URL] about how to pick them apart / assemble them. Third thing, the for loop, is called a [URL="http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html"]for-each loop[/URL], … | |
Hey. My question is, can laptops have startup problems if they're cold? If the answer is No, or They Shouldn't, then I will call the depot and interrogate them as to Why my computer fails to start in the mornings. My problem is, sometimes when I turn on my computer, … | |
Re: Unplug the keyboard. Or write the impossible virus. Not sure what you want to know... Locking, aka, disabling input? Input to the entire system? I dunno if Java can do that. Maybe if there's a panel that retains focus and absorbs all key events.. But probably not. | |
Re: [CODE]import java.io.*; import java.util.*; import Employee; [/CODE] The problem is with [INLINECODE]import Employee;[/INLINECODE] --- you can't import classes from the same package without at least giving the package name/whatever. Just remove [INLINECODE]import Employee;[/INLINECODE] and you should be fine. As long as the classes are in the same directory/package, they're automatically … | |
Re: Is there any way we can filter threads like this from being posted? Or, can they be removed? I'm not sure, but I think DaniWeb could go without such dribble as do-my-homework demands. | |
My question today is regarding multidimensional arrays, and synchronization.. I'm working on a client/server project and I'm not sure about the theory of an idea I came up with: I have an array: [INLINECODE]Object[][] myArray = new Object[256][];[/INLINECODE] It is an array of arrays. The length of myArray is 256 … | |
Hi! I'm looking to learn something today, and I have just the question. In writing a recent program, I found no Java method suited to compare two byte arrays. Maybe the method exists, or maybe not. In any case, this is a learning expedition, and I came up with a … | |
Hi. I'm not sure where this belongs, but it'll be fine here. I came up with an idea for a website/service.. It's a really good idea. I've searched, and searched.. I've found nothing like my idea in existence. I think it has a lot of potential at becoming a popular … | |
So I've run into this situation a million times in my "learning career" and I've always found a long way around the issue so as not to risk throwing unnecessary exceptions.. Let's look at a simple example... [CODE=java]boolean IsEnabled (JPanel MyPanel) { return MyPanel.isEnabled(); }[/CODE] Throws java.lang.NullPointerException if null is … | |
[B]Hey![/B] This is a "style" question. Is there some defined custom for the order in which parameters are given to a function, or does it depend entirely on the programmer's stylistic preference? What if the developed software should be released to other programs to incorporate in their own programs? Obviously … | |
I installed Ubuntu Linux this morning and got java jdk 1.5.0_09 installed, along with Eclipse, and then I imported a project I've been working on into the Eclipse workbench. All configuration is fine, as far as I can say. My problem: The program I am working on uses the Enum. … | |
I found this odd... Sometimes, and only sometimes, when I turn of on my laptop and log in, my sound system fails to function. No tune is played at startup, xine can't initialize sound drivers, etc. Then if I restart my system everything usually works fine. Why is this? Does … | |
Re: I think I may know what you're talking about, as I faced the apparent issue myself just last week. It was quite something. If I've misunderstood and all the following information is unrelated, then I guess I'm just practicing my explanatory skills. Basically, you have Nodes, and each Node can … ![]() | |
Hey! So, I have a laptop installed with both Windows and Linux. Linux comes first, logically, so its partitions fill up the first 90 Gigs of my HD. Windows comes at the Very end, filling the remaining 30 Gigs. Interestingly enough, Linux reads and writes from its partitions silently, but … | |
Re: I hardly understand what you're doing or why, but here's the recursive solution.. Recursion is unnecessary and stack-dangerous, by the way. ([COLOR="DarkRed"]StackOverflowError[/COLOR]s are ugly). Using a StringTokenizer is also unnecessary. I've included two examples, one is Your way, and the other is My way. Your Way (Recursive and using a … | |
Re: I think the proper way to escape Quotes is "Here is some [COLOR="Red"][B]\[/B]"[/COLOR]Text inside Quotes[COLOR="Red"][B]\[/B]"[/COLOR]" :rolleyes: And no. It's not platform-independent.. That would be the File Separator, which is "\" in Windows and "/" in Unix (as an example).. In Java, [B]\[/B] always escapes the following character. | |
Hi! Here's my scenario: I have an application that utilized the DatagramSocket class. I also have a favorite Port number that I would like it to connect to Every time I load the application. One problem with my application is that it's highly threaded, and under basic circumstances, it doesn't … | |
So I've been having a problem with Gaim, the chat client, on both of my systems. Actually, I've reinstalled linux on them both atleast once, and each additional time I install Gaim, I get the same problem. It random crashes shortly after MSN login... Mostly when my mouse moves over … | |
Heyyyy Hopefully this isn't the time-old question, and we can get some new input here.. I've lsted some of the most common email providers (which have their own chat services) and I would like to know what the Intelligent people choose as their service-of-choice. I'm looking to upgrade from Hotmail/MSN … | |
Hi there y'all. I recently purchased a beautiful little laptop, and of course, Linux was the first thing that had to be installed. However, I'm having trouble getting everything to work properly. Among the trouble is that of installing support for my wireless WiFi card (internal "Dell Wireless 1500 Draft … | |
Hiii I'm going to document a [I]very[/I] frustrating issue I've been experiencing here, and I encourage you all to read it and give any advice you can. I would really appreciate that, a lot. You'll understand after reading... I recently bought a new laptop, for $3000 -- the XPS M1210. … | |
Hiii I'm going to document a [I]very[/I] frustrating issue I've been experiencing here, and I encourage you all to read it and give any advice you can. I would really appreciate that, a lot. You'll understand after reading... I recently bought a new laptop, for $3000 -- the XPS M1210. … | |
I hope this isn't too lame a question, but I have to ask... Is it necessary to rebuild ALL of the modules each time I want to rebuild the kernel? It takes an awfully long time, and very few modules are needed to be updated, yet they're all rebuilt. Is … | |
So. I'm having an issue. I'm building an application that loads class files as extensions during runtime. I'm doing this, becuase I want my application to be able to grow in the future without having to recode and recompile the main source.. So, I plan to make seperate class files … | |
Sooo.. I'm having media problems. This has been an ongoing problem, and no matter what I try, I can't seem to fix it. I can't get AmaroK or Kaffeine to play [U]anything[/U]. They're using the Xine engine, because it has oh-so-many great reviews and I thought it'd be a good … | |
Sooo... I just started designing the GUI for an application that I'm writing.. And, well, I can't get either the awt.TextArea OR the swing.JTextArea to work properly. Here are snapshots of both, along with the problems I am experiencing. If anyone can resolve these problems, please let me know.. I … | |
This is irritating me so bad, I have spent three hours aimlessly trying to get JScrollPane to work on my JList and I can't figure it out.. here is the code, please make the scroll bars work! :sad: [CODE]public class ChatServer extends JPanel { private JList lstUsers; private JScrollPane scroller; … | |
Hey y'all! I'm fairly new to internet programming, and I'm surrently developping my first socket app in Java.. Now I have a question... I wrote a simple chat client to learn the commands, it uses a datagram socket (that's what I want to stick with for now) and sends/recieves messages.. … | |
Hey!! Ahh, all day I've been trying to learn something new, so reading over tutorials I compiled my first socket app!! The only problem is, it isn't working the way I would like it to, and I was hoping you gyus could help me figure out the problems.. I appologize … | |
Re: Hmmm, looks like dee_dee is quite new at this.. are you learning it in school?? Lets fix a few things here... mostly it's correct.. [CODE] #include <iostream> [COLOR=Red]using namespace std; // (replaces the prior 3 lines)[/COLOR] [COLOR=Blue]// #include <iomanip> // what is this junk? lol[/COLOR] [COLOR=Red]bool [/COLOR]anyNegative(int a[], int arraysize); … | |
Re: [QUOTE=Narue]There are plenty of better examples (much better) out there already. [url=http://www.eternallyconfuzzled.com/tuts/bst1.html#traverse]For example[/url]. :) [/QUOTE] Cool tutorial! :cheesy: I read it all (believe it or not) and now I'm interested in this type of classification and currently writing my first binary search tree app.. And, thus, I'll probably be looking … | |
You heard me, I want to know your guys' techniques for converting data types without using additional headers (such as studio.h). Are there any tricks or intrinsic methods? Can I write my own method? I simply don't like adding unnecessary headers becasue I don't use 95% of the crap that … | |
Hey! I'm learning C++ and pointers are pretty new to me, I can work with them a little but [I]still[/I] don't see the point to them.. ok, well, I do.. For example, passing variables byReference! But that's the only good I see comming from pointers (yup, I'm a n00b).. [B] … |
The End.