ah.
Found I can't catch shortcut keys (like Alt-T, Alt-X, etc.) using this system so I abandoned it.
Instead I now validate the field when it's value is read out instead of when it's input and give an error then.
ah.
Found I can't catch shortcut keys (like Alt-T, Alt-X, etc.) using this system so I abandoned it.
Instead I now validate the field when it's value is read out instead of when it's input and give an error then.
1) search the web. There are some tools that package a jar in an executable wrapper, but why would you want to? Far easier to use JNLP (Java Webstart).
2) Don't. Learn about classpaths instead.
3) see 2)
It would be easier to just search the net for one of the tons of similar applications that already exist and adopt that for your organisation.
Cheers, I'll give it a look.
Gink, the idea is to allow only certain input. If it were readonly I'd have used a label or something else instead :)
The DOM API is really simple.
When you have an XML element you can call methods on that that will give you a list of all elements with a given name (or using other criteria) that are children of that element.
There are also methods to retrieve attributes and node values on a given element.
The trick is building the xml file to have ant do tricks like run unit tests, deploy your application to a J2EE server, and things like that :)
And of course integrating Ant inside another application is a bit more involved than just calling the command from the prompt.
Same here.
Up to 10 hours a day at the office and another 4-6 hours at home during weekdays.
Weekends, anything from nothing to nearly 24 hours a day depending on what I'm doing.
OTOH during vacation time I often choose locations where there are no computers (and often no phones, televisions, radios and newspapers) at all.
It's a common error, the names are somewhat familiar leading people to believe they're one and the same thing sometimes.
Take this to the web forums, especially JavaSCRIPT or HTML forums.
Java is NOT JavaScript.
yes, there's an area of Java I'm almost a complete novice in (so far, I'm going full steam ahead :cheesy: ).
I've the following code to filter out non-numeric input from a JTextField (which is meant to contain a timeout interval in minutes, that's why).
private void dumpNonNumericInput(KeyEvent e) {
char input = e.getKeyChar();
String oldText = ((JTextField)e.getSource()).getText();
if (input != KeyEvent.VK_BACK_SPACE && input != KeyEvent.VK_DELETE &&
(input < '0' || input > '9')) {
JOptionPane.showMessageDialog(this, "Numeric input required",
"Input error",
JOptionPane.ERROR_MESSAGE);
e.consume();
((JTextField)e.getSource()).setText(oldText);
}
}
This method works like a charm, that's not the problem.
The problem is that is I remove the error message popup (just the showMessageDialog command) the method no longer removes the faulty input either.
I THINK it's something to do with Swing thread timing, but I'm not sure.
Neither do I know how to cure this, which is more important at the moment as I'd rather not have that popup appear every time someone makes a typo.
I could probably subclass JTextField but that may be more trouble than it's worth.
Ant is a tool similar to make (which is for C/C++ mainly).
It's written completely in Java so can easily integrate with Java applications.
There's books written about it, I'm barely scratching the surface by using it from the commandline to compile and package my projects.
Maybe next year when I may have time to do more I'm going to really dive into it :)
use getDeclaredMethods() instead.
The API docs would have told you as much :) (yes, I know I keep hammering away at people using them, they're that good) :mrgreen:
confusing? It's what I'd do. It's platform independent which is important as I work on several operating systems at the same time (Windows, 2 versions of Linux, and AIX, and I hope to add a Mac sometime next year).
And calling Ant should be rather easy. probably easier in fact than capturing the commandline output.
Used to have an account there, but it stopped working about a month ago and all email goes unanswered.
Sad, it's a nice site (though as swamped with "do my homework for me" posts as this one).
It's alive (even if my Delphi installation isn't at the moment, I'm too busy with other things).
But Delphi isn't all that hard and there are loads of resources available, maybe people don't feel the need to ask many questions.
Which could be a sign that Delphi is used mainly by people who are mature enough to do their own research (rather than a disturbinly large percentage of people asking questions in Java and C++ forums), possibly because there are no free versions.
" dont know y its giving me this error. All the parameters r correct. Can any 1 help me. Im developing a container tracking system for a company. I have worked with Java and Oracle. This is my first time with Java and MS Access."
You saved yourself 7 characters by writing that nonsense "y, r, 1". Was that really worth it?
If you consider yourself a professional (which you seem to do), don't use such shorthand language.
And oh, for a production application NEVER use the JDBC-ODBC bridge driver from the JDK. It's for demonstration and testing only, too unstable and poorly performant for realworld use.
To run a class you don't need to launch the java executable.
Create a classloader and use that to fork off the class in-process :)
You can also do that to compile classes. Simply hook into Ant which is a Java application and can compile Java classes for you (by hooking into the JDK).
Examining the Ant source should be interesting (I've not yet done so) to see how they do it in a platform independent way.
1) not quite. Static methods don't share any object instance. Rather they don't have access to the object instances at all.
2) http://java.sun.com/docs/index.html see the coding conventions for what's the norm, and the language specs for what's required. Also check out the tutorial (it's not quite up to date but rather nice anyway). And of course the API docs which are vital to have and understand how to use.
I don't know what to use to get the pixels (like I said, I've never done anything like this in Java, last time was C++ under DOS).
Best way would be to get access to the raw image data and manipulate that, would certainly be a lot faster.
You can apply filters to do pretty much anything. Where I put -1 for each, you could have any combination of values including mathematical functions, possibly different for each pixel.
No, it doesn't.
Yahoo! has a contract with Google to provide part of their search results (probably certain categories), but that contract is set to expire.
They have their own engine as well, which has been under active development in the past (maybe they subcontracted to Google in order to have the time to improve upon it).
I'm not going to read a thousand lines of unformated code.
Use code tags and post only the relevant bits.
Most likely you never attached the code that shows the message to the component where you want it shown.
Hi Jwenting
thanks for the reply. I tried your code but couldn't get it to compile as i wasn't sure if you meant just replace my two methods with this new code or not?
but it says several errors, one of which is arraylist cannot be resolved to type.
Any ideas?
Thanks
Yes, that replaces all the code you use to create the array.
I didn't bother to post the import statements you need, leaving that up to your imagination.
Code only works with the latest compiler also. While you can get it working with older compilers, it takes some work and isn't as easy to use.
Of course you will need to do something with the array once you've created it also :)
That can be done a lot easier.
List<Integer> l = new ArrayList<Integer>();
for (int i=0;i<amount;i++) {
int q = (int) Math.floor(Math.random() * 100);
if (!l.contains(q)) {
l.add(q);
}
}
Integer[] dummy = l.toArray(new Integer[] {});
You'll end up with an array of Integer instead of int but with autounboxing that doesn't matter.
Most books won't mention tricks like this, and older books won't even mention the language features used here because they didn't exist until a few months ago.
You can get the mouse coordinates of the mouse.
That will give you the location on screen.
From that you could get the Component the mouse is over.
From that you can retrieve a Graphics object which can draw that component.
From that you can retrieve an offset Graphics object which can draw that component somewhere else (if I read the API docs correctly).
What I don't know is whether any of that will do you much good :)
I know Google runs (at least in part) on Python and Linux servers, but the software itself is most definitely NOT public.
Yahoo! almost certainly is similar.
Of course pretty much three quarter of the web runs on Apache or Apache related products :)
The math part is language independent.
There are books about image manipulation out there, many highly theoretical.
Lowpass and highpass filters work essentially the same as in electronics, so filter theory books for that should work as well.
Start out writing a simple filter, and work your way up :)
Essentially a basic filter takes a pixel and based on its value and a mathematical formula performs some operation on pixels surrounding it.
For example, a very simple filter indeed would just decrease that value by a set amount:
---------------
| -1 | -1 | -1 |
| -1 | 0 | -1 |
| -1 | -1 | -1 |
---------------
If you consider a pixel to be a single value (greyscale) for now, putting this matrix over a pixel would decrease (darken) all pixels surrounding it slightly.
That's the easiest example. Once you get something like this working, more complex filters are possible to do things like edge detection and working on larger areas.
But the math involved quickly gets rather complex. Now I don't mind complex math (it used to be a hobby of mine as well as part of my study) but I'm no expert at this and my knowledge is rather rusty.
hi jwenting,
Thanks for the reply. I am SCJP(2002). I hope that does not matter. I want to take it up as slowly as possible so that I can look into the quality very well. If you have any resources which are useful, please let me know. Thanks once again
regards
Srinivas
The actual version of your SCJP is irrelevant.
You may want to check if yours is still valid though. You got it around the time that Sun changed their policy on that, earlier exams expired after 3 years. If yours has expired you can contact Sun and have it changed into a new non-expiring certificate for the exam you took.
Some more hints and tips:
The version of the compiler/JVM you're writing for must be no more than 18 months old (or the latest production release, if that one is over 18 months old) at the time of submission (so NOT at the time you buy the exam!).
At the moment this means you are allowed to use either 1.4 or 5.0, nothing else.
Your documentation should include a list of JVMs and operating systems used to test and develop the application (gives you some leeway I guess if it doesn't quite work perfectly on another platform in ways you may not have known).
Myself I'm using 5.0 and most (but not all, I don't agree with the philosophy behind some of them) new features it provides.
Some books you're going to want to have (and possibly have read at least in part before setting out):
- Effective Java (Bloch, Sun Java Series)
- Java Threads 3rd edition (Oaks and Wong, O'Reilly)
- Java Network Programming 3rd edition (Harold, O'Reilly)
- Head First Design Patterns (Freeman and Freeman, O'Reilly)
- Java 1.5 Tiger Developer's Notebook (McLaughlin and Flanagan, O'Reilly)
- The Sun Certified Java Developer Exam (APress, you may want to wait for the second edition which is expected soon)
- a good Swing book (I think the APress book is the best at the moment, I'm about to order it)
optional, these books deal with topics …
Get your SCJP first...
If you do have that, sign up for the CX-310-252A exam which is the assignment, and you get (after a few days usually) a download link.
The file you find there contains complete instructions.
Essentially all assignments require you to write a complete client/server system including the database engine.
Technologies being tested:
-network programming. Either sockets or RMI allowed, nothing else.
-multithreading
-Swing. The document will state certain components that you MUST use and functionality your application MUST have.
-design patterns/skills
-documentation skills
You're not allowed to use ANY thirdparty libraries, only those classes that exist inside the core APIs shipping with the JDK itself (so also no libraries from J2EE or any other Sun extension APIs are allowed).
There is no time limit for the exam, and I'd advise you not to rush it.
I've been working on it for about a month now (mainly in the evenings and lunchbreaks) and I've the first draft of the database server almost complete (which I think will see some major rewrites in time because I'm not quite happy with the design yet even though it works well).
The requirements document is in many areas deliberately vague. You are expected to make your own decisions in those areas and document those.
No answers to most questions pertaining the document will be given, or else the answer will usually be to come to your own …
If you can't grasp the language even with the documentation, you shouldn't be in OO development.
Most likely you can't grok OO concepts and that's why you've trouble, you wouldn't fare better using any other OO language (and your C++ code most likely is just C code with some C++ thingies scattered across it).
Define "web services".
If you mean SOAP you're behind the times, SOAP was hyped a few years ago but never took off.
It's used, but nowhere near as much as you'd think from the hype.
the whole "web services" thingy is pretty similar. Many people do it as part of their regular jobs (me included), but I know none who specialise in it simply because it's a wet hen/dead herring/insert your own.
getDocumentBase() is one thing, but I was really thinking of something else (maybe in combination with that).
Let your applet contact your server (which of course is the only one it's allowed to talk with by the sandbox) and get the really sensitive stuff using and RMI or socket connection to a process running there either as a standalone application or as a servlet.
That way the sensitive code is never deployed with the servlet so the thief (if any) will have to write that all himself.
If you then make sure only authorised IP addresses can connect to your server you also have a nice subscription based service in place almost for free.
no. Applets are clientside code, the classfiles will always have to be downloaded to the client.
In fact, your user won't even have to do that, he can just pull the classfile from your browsercache.
You can do things to prevent the classfile from being used from any other location though.
Think about applet restrictions and it becomes obvious :)
Still doesn't stop someone from decompiling your applet and changing it, but what are the chances of that (iow, how many people will want to go to the trouble? What makes your code so brilliant that people will actually want to decompile and crack it?).
If you don't want that, you'll have to use servlets/JSP and send over the generated html.
That's not Java, it's Javascript.
Put it in the Javascript forum if there is one, otherwise the html forum, and format it properly so people can actually read it.
it is possible, and it can't hurt to ask.
If they don't, hosting space for servlets and JSPs isn't that expensive if you don't need large amounts of bandwidth.
no, of course not.
Any software running on a machine needs to be installed by someone who has a right to do so.
If that weren't the case the security implications would be enormous.
Of course if you have an account on that machine you might install it using an ssh connection, but if the machine is properly configured it should be inaccessible to the outside world as the firewall would block requests to it.
Hi everyone,
The starting prompt needs to be the location of java.exe
Richard West
No it doesn't. As long as java.exe is on the path you're fine.
And that's not his problem anyway. His problem is a path problem where he can't find a jar he tries to launch.
So all he needs to do is call java with the correct location for the jar, which he doesn't seem capable of doing for some reason.
A beginner's course in using a command prompt might be in order :mrgreen:
It will rather be available more easily to people on social security and people in 3rd world nations.
The political left will argue (and successfully) that reserving such a treatment to those who can pay for it amounts to discrimination and social stigmatising of low income people. Thus everyone will be forced to pay massive amounts of taxes to make it available for those who are already leeches on society, causing those who could otherwise pay for it to now no longer be able to afford it...
Java is indeed a lot easier to get into than is C++.
The larger core APIs are a main reason for that. No longer do you have to write tons of lowlevel stuff yourself (or find some often poorly documented 3rd party library which will likely work on only one compiler and OS which is always one you're not using) like you would with C++.
The documentation is also a LOT better.
Sadly this promise of a more easy start attracts a lot of people with no interest in learning at all, they just want a quick injection of knowledge to stuff their resumes.
These people disappear from the statistics as they fail to deliver but do increase the percentage of users dropping out.
With C++ these people never even try, and therefore the dropout percentage will be lower.
You can't. It needs to be installed there for your use by the server administrator.
there may be a protocol called CVS (though I've never heard of it) but that's not the issue here.
We're talking about CVS the VCS (version control system), a similar (but free) product to visual sourcesafe or PVCS.
Richard, Ant and CVS aren't programming APIS. They're tools to make your job easier.
Just like you can use notepad to write your code but it's a lot faster and more convenient to use vim or jEdit.
Which goes to show that Gates is a lot more pragmatic than many people give him credit for :mrgreen: :cheesy: :lol:
that too, but so has Cobol :cheesy:
Maybe if they were free to speak their minds they'd get around to training those minds? :mrgreen:
we'd also have to get used to a working life of centuries, maybe millenia.
Instead of retiring at 65 there's be no retirement, ever, unless you've saved up enough to never have to work again LITERALLY.
The only ways out would be death by some means or a disability so severe that it can't be treated (and if you can treat old age itself, there'd be very little that couldn't be treated...).
Where do you draw the line?
Today you ban people from claiming negroes (I don't hold with PC alternatives) are lazy, tomorrow you ban people from saying they don't like strawberries.
And the day after you ban all fruit except strawberries.
Maybe next week you ban fastfood restaurants, and next month you ban music.
Next year you ban women from wearing "revealing clothing" and outlaw all religions except one, and suddenly you have the Taliban.
Once you start on the slippery slope of telling people what to say and think and what not, there is no way of stopping it.
If people say they hate me for having grey blue eyes, that's their problem not mine...
Of course the KKK took their ideas and turned them into practice, and that was taking it too far.
But as long as its just ideas and words, noone gets hurt in a way he can't defend himself against if he has freedom of speech and expression.
If you claim Africans are lazy, any African can try to change your opinion by showing you that he's not.
If no African takes up the challenge, who's to say you weren't right all along?
As things stand now you would not be allowed to call that African lazy (that would be discrimination) but that African can say whatever he likes about you without fear of repercussions (because for some weird reason it's not discrimination if …
Sure. Since 1.4 Java has included a nice logging package which can log to just about anything.
You can log to the console (effectively what you're doing now but it includes origin and timestamps), to file, or even to a network connection (which could point to a program storing the information in a database for example).
Or use one of the many 3rd party logging packages available.
Freedom of expression is not just a good thing, it's essential to being a free person in a free society.
If you aren't allowed to say what you think of things (even if others don't disagree with you), you're nothing, you've no personality left.
In the absense of freedom of expression you get situations like the USSR under Stalin, Cambodia under Pol Pot, Zimbadwe under Mugabe.
Anyone who says (or is even suspected of saying) something that doesn't agree with the party line is a traitor and killed or put in slave labour ("reeducation") camps.
You'd of course also loose all freedom of choice. After all, choice IS expression of personal opinion and preference.
Of course some peoples' ideas, freely expressed, can be shocking or disturbing to others.
But as long as no physical harm comes from them they should be allowed to stand (not the distinction, if you want to express your freedom of expression by blowing up a train that's still murder. If you paint a picture of a blown up Tel Aviv restaurant with PLO flags waving victoriously in the background you're making something that will make me loath you in the extreme but I will not say it should be banned).
Depending on the exception that might be good enough. But if the user can do something about the exception (say it's a network error or he typed something wrong causing a validation error) you should notify him instead of just logging it somewhere.
SOMETIMES eating an exception is justified, but in such cases you should always carefully document the exact reason you're eating it.
For example, in one of my projects an exception can occur in an XML read operation when an optional parameter to an XML element isn't there.
I know the read operation for that parameter may yield an exception if the parameter is absent but as the parameter is optional I don't care and I document that.
If other exceptions are thrown I take action accordingly (for example an invalid value for the parameter).
you'd have to be in that very directory then. And add '.' to your classpath and path.