stephen84s 550 Nearly a Posting Virtuoso Featured Poster
stephen84s 550 Nearly a Posting Virtuoso Featured Poster
722
but for a school project I really wouldn't worry about it.
I disagree with that one, School projects are supposed to teach you how you should do things the "RIGHT" way, the way things are supposed to be done.
Even if this is a school project I suggest you at least try to follow to some degree the Model View Controller Architecture discussed in this sticky thread.
dreams
Actually when you consider serializing static variables, it doesn't make any sense, because the static variables are part of the "STATE OF THE CLASS" not the "STATE OF THE OBJECT".
However as far as your question goes, any variable not declared as "transient" (even static variables) would be serialized and their state stored.
-1061
Have any of you guys noticed the Anomaly ??
In the first few posts if you observe
"CountDown Value" + "Post Count" = 1001
But now 2099+ (-1061) = 1038
How did this skew happen ??
No, My generation went through it, why spare the next :P
Are cats more loyal that dogs ?
we
Well not so embarrassing, I remember another naive employee from my firm (you will not want to believe this one) actually SHREDDED the most recent copy of her project and she had conveniently forgotten to commit her code every night in our version control system.
So now back to the point, if you use a decompiler I do not know if your quality of code will remain the same, since there are chances that the java compiler might be performing optimisations on your code. My first option would be to try to recover the deleted data.
This would be possible if you are on Windows, there are quite few free and paid software available, Here are some free ones :-
http://www.aumha.org/a/recover.php
http://www3.telus.net/mikebike/RESTORATION.html
http://www.undelete-plus.com/files/
If you are lucky you will get your project back without decompiling.
714
+2 For above post
+2 For me
718
Oh, I found the problem. Change
JButton button = new JButton ("Click ME!!");
to
button = new JButton("Click ME!!");
Rather that just giving corrected code directly and making people dependent on you, I suggest you point the errors and then let them at least try to figure out the solution.
You are facing that problem simply because if we look inside your constructor, the "button", that you have added to your JFrame is this this one :-
JButton button = new JButton ("Click ME!!");
And you are adding the ActionListener on that button
Because of that the JButton object "button" declared at the class level is hidden in your constructor (to access it you would have had to use the "this" pointer).
And also in your actionPerformed() method when you are checking for the source of event, you are comparing it with the "button" object declared at the class level, (since it cannot see the "button" object declared in your constructor).
So whenever you are clicking your "button", the check e.getSource() == button
fails, and whatever code inside the "if" block is never executed.
Please also remember to wrap your code inside [code=java] and [/code], It maintains indentations and provides syntax highlighting.
edit: I'm looking into this a little more, but I tried it with '==' and it does work, because of how getSource works. I'll run your code and get back to you.
Yes the "==" operator would work correctly here since e.getSource() would return you the reference of the original obect from where the event originated.
info.studio52.dao.ContentsDAO.getContentsById(ContentsDAO.java:73)
info.studio52.controller.HomeAction.home(HomeAction.java:42)
Is info.studio52 your package, Also paste your code (especially the code at the lines mentioned above).
Also you obviously(as the exception shows) are having some problem tracking your Array indexes,
We need your code to go on to diagnose the issue here apart from just the stack trace.
Also preferably when you post your code highlight the lines mentioned above. Cause chances are the lines nos in your code after pasting here may not be the same.
Please also remember to paste you code inside [code=java] and [/code] tags.
EDIT:
The stacktrace, however is better put in [code]
[/code].
pig.
714
Sheff21, you need to learn first about HTTP. And how data is sent to a web page via GET or POST.
You send a request to a Web page via the GET or POST method, if you have done some basic web programming or written some forms in HTML you would have encountered them, or you could read about them in the page I have linked to HTTP.
Also once you have cleared your HTTP concepts, Here is an example on how to perform POST in Core Java.
Performing a GET is as simple as appending the the URL with a "?" and then appending the data with the format <param1>=<value1>&<param2>=<value2>& ... &<paramN>=<valueN>
and invoking it.
Sorry for the delayed reply, but I would like to point out that the "code" attribute of the "<applet>" tag can only take a relative URL and not an absolute one.
To be able to use the applet mentioned in the URL, you will need to use the "codebase" attribute of the "<applet>" tag, shown below:-
<applet width=450 height=300 codebase="http://.../" code="applet_maxr.class">
You can learn more about them here.
Take it easy guys, most probably the thread starter's project deadline has already passed, so no use bumping this thread any more.
Also if she is smart enough ( and worthy enough to be helped) I am pretty sure she will get the point with the first post itself , so no use drilling it in with more posts.
stinky
Paste the code of the HTML file which is using your Applet, So we can see whats going on.
like
A Very Merry Christmas to All daniwebbers ;-), from me too.
It
Since you have already achieved control over your lights through your LAN, I am guessing you have some sort of listener (a kind of server) set up which actually listens to these requests on the PC where you have connected the lights on the serial port.
To achieve the same from a PC connected to the Internet but not in your LAN, you will need to set up Port forwarding on your Gateway machine.
In port forwarding "a port" on your local machine "is forwarded" to your gateway, such that any requests coming on that specific port on your gateway would be "forwarded" to a port of specific machine on your LAN.
For example :-
Assume "192.168.0.12" is the machine on which your program to switch off the lights is running and listening on port 8080 . Your gateway is "192.168.0.1" on LAN and "121.22.22.22" is its static IP.
Using port forwarding you can tell the gateway machine to forward whatever content it receives on port 8080 (on its Static IP) to forward it to port 8080 of the 192.168.0.12 machine.
Here is a small example of port forwarding, where the gateway is an ADSL Router and the machine to which content needs to be forwarded has Windows XP loaded on it.
Also once you have the socket connection established fro the remote machine, you can write the feedback back on the same …
Am famished here !!!
^ is going to be great programmer someday ...(if not already)
< Off to eat my lunch
v Hates exercise
710
Resistance is futile Team B :P
706
702
Hi! i am trying to develop an application using java in which i want that i should be able to send messages from my application to mobiles and i m using a modem.please reply! i want the code in java for it.
If you would have just cared to search through the forums first instead of directly posting you would have noticed that your question has already been answered here.
How can i convert float or double to binary?
Same way I convert.
I would not mind giving you the answer, but let us see what have you tried. We only give answers to those who have at least made an effort to find them,
So first show us your code then we will help you.
As sillyboy mentioned, this is not a JSP issue, the "&heart;" symbol is not supported by the Latin1 character set (ISO-8859-1) which most probably by default is the character encoding for your page.
So set change your page encoding to Unicode if you want it to be displayed.
Here is a guide on how to use special characters in HTML
Yes and I want the moon.
In case you want more help full answers out of me then read :-
Member Rules
How to ask questions the smart way ?
Who we help ?
And then repost.
698
donkey
Well that you showed was the Runtime error which your JRE was giving you an it clearly states that your code has not yet compiled correctly, You need to show your import statements, chances are you are using the "Statement", from com.mysql.jdbc package, when it fact as I had mentioned in my previous post you should use them from the java.sql package.
Also you have not imported the DriverManager class. Obviously you are not going through the tutorial properly.
EDIT:
You should also check what your compiler is throwing up at you because clearly your code has not compiled, and you definitely cannot run your program without compiling it first.
And I put the jar in the correct folder, i didn't rename it or anything just copied it
Also renaming the JAR would not make any difference.
698
newly wrote data until i compile again
Please get your basic concepts on Java clear, compiling only takes your source code .java file(s) and generates the corresponding .class files for every class. It has nothing to do with anything that might go right or wrong at runtime
First you could check whether your MySQL installation really works, try telnet <IP-Address-of-machine-which-has-MySQL-server> 3306
on your console, if this gives you a "Connection Refused" error then it means your MySQL server has not been installed correctly (or is running on a different port, 3306 is just the default).
Now to use the Type 4 JDBC driver (from MySQL) for MySQL all you need to do is :-
Class.forName("com.mysql.jdbc.Driver");
, Apart from that everything else is the same as mentioned in this tutorial here.Note that this tutorial uses Apache Derby hence they load the driver using the following statement:- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
. Note if you get a ClassNotFoundException it means that Java cannot find the mysql-driver i.e your mysql-connector jar file is not in the classpath.
However in case you get any other SQLException, try to print out the SQL state (using getSQLState()) and compare it with the last column of this table to figure out where your SQL Statement is failing.
Also note that we do not normally need to use any package from the mysql-connector apart …
The Type 4 JDBC Driver for the MySQL database which you are talking about needs to be on the client, where your java application is running.
Its exactly like using third party java libraries in your program. The "jar" file needs to be in your classpath while you are compiling and running your program.
So as long as you have the proper JNI code in place along with dynamic libraries for your target platforms, almost anything is possible in Java
Yep, Hard to disagree with that one, I guess should have mentioned
the Standard Java Library.
But being a Java programmer I did love the statement :-
almost anything is possible in Java
Thanks for the information on raw sockets ~s.o.s~, All I had known was Java (the core networking APIs of Java) works with TCP/IP or UDP Sockets and that Ping works with ICMP, never knew why they couldn't mix.
Also when I read some material on Raw Sockets, I noticed that the packets arriving on them bypass the normal processing on the TCP/IP Protocol stack (by the kernel), So **I guess** we can actually drop down not only to the Network layer, but also access the Data Link Layer headers here.
Thanks again, discovered another new thing today and Sorry for hijacking your thread awo.
Chill Out Guys, the original poster has not posted since 4 days already
Ping cannot be accessed directly you can use Runtime to execute console ping command and read it in, but this is awkward solution
I actually meant implementing the "ping" utility completely in Java (note: not just invoking a ready to use implementation) is not possible, cause Java runs mostly on the Application or Transport layer.
Nope .. Prefer Gtalk instead
Is the world round ?
694
According to me the MAC-Address comes into play at the Data Link Layer, whereas Java can go down only till the Transport Layer. One of the reasons why I had read "ping" cannot be written in Java.
Yes
Are you an AMD fan boy ?
694
What no OpenOffice (Although yeah I know its a piece of trash in fron of MS Office)
My choice Office 2007.
Soccer or Cricket ??
No
Are you a Nomad ?