Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

Malith Yapa

Ranch Hand
+ Follow
since Jan 17, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Malith Yapa

i'm new to j2me programming. to start with the 3d api i created a simple scene from blender and exported to m3g. it works fine. but when i added an ipo curve(starts from frame 1 ends on frame 100,2 key frames) animation to the cube i created the following error appears in the blender console(with a beep) when i export

DeprecationWarning :: integer argument expected, got float

but an m3g file is created. with that file when i try to animate the cube like this

int time = 0;

while(flag) {

//set Graphics3d

scene.animate(time) // or cube.animate(time)

// release graphics



nothing happens.. only the first frame is rendered. Can someone please tell me how to do it the right way. and whats wrong with the export.
12 years ago
Hey guys,

Well i'm using netbeans to create a GUI application.. I'm using swing with free design layout.. Everythings fine except i can't make the GUI look like it does inside the netbeans.. Do how can i set the native look & feel.. Can this be done inside netbeans.. If and if not how? Thanks in advance..
Ooops.. I'm really sorry bro.. Yeah it's group layout and not absolute layout.. However you can use the "absolute layout" Which works almost as good but obviously not as good as free design.. "Absolute layout" works fine with jvm 1.5.. I've tested it on 1.4.. Actually in my software Jleeker i wrote a different version for jvm 1.4 and later users since the group layout is not supported.. And i did that completely using absolute layout.. It might take some time to get used to.. But works fine.. And of course works better than writing the code outta hand..
12 years ago
It is quite hard to say with the information you've provided.. Please post how you exactly tried to get the connection..

However if this error occured in a webapp.. It may be because the server is clustered.. That way only the instance that created the database can use it.. Requests sent through the other instance would not be processed.. Well i thought so because that's one way that it could work only sometimes.. Please make your posts in more detail..

The exception is not familiar to me.. I haven't used oracle anyways.
Free design uses the "Absolute Layout" defined in java 6 (and maybe 5) If you're using an older java version like 1.4 netbeans will put the "absolute layout.jar" in your lib folder.. There's absolutely no harm in using the free design upto my knowledge.. But if you're using java 6 you'll have to keep in mind that the free design layout gui won't work when it's been run on earlier jvms.. Like 1.4.. I had to write two separate versions of my gui because of this..
[ July 30, 2007: Message edited by: Malith Yapa ]
12 years ago
I've written the context like this..

And i'm using this code to retrive the datasource

But i get the following exception :-(

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

Cant understand it.. Pleeease help..
[ July 28, 2007: Message edited by: Bear Bibeault ]
12 years ago
The manager works.. But when the app is using a library of some sort like "h2.jar" Stopping the application from the manager wont completely undeploy it.. When trying to delete the lib folder it gets the error file in use by another process.. So i have to stop tomcat, delete the lib folder, and restart tomcat and deploy my app again.. Got any alternative for that?
12 years ago
Thanks raj.. But i actually figured that the problem was that the server i 'm using was clustered for two instances.. So when one JVM creates the database the other JVM doesn't have access to it.. That way only one of two requests would be processed.. Thanks for your tip anyway..
I didnt know about dojo only downloading parts of it's massive content.. With that approach dojo is definitely effective.. However i suppose that everyone agrees that a js library is not the best approach for a beginner.. So how about starting out with forum replies..

If you check the forum replies in the html section.. more than 50% of the replies to ajax problems advice you to use a js library so that the library will take care of the problem.. I suppose it's better to just tell them how to solve there problem and how using a js library in the future would be effective..
Hey guys,

I'm writing a small web app for a software i created.. The whole page is 100% dynamic and ajax is used to deal with server-side requests.. When i was first learning ajax many tutorials lead me to using a js library like dojo.. But when i got dojo the javascript library itself was about 10 times bigger than my site..

And size means time on not-so-fast connections like the one i use.. SO then i wrote the js myself and got away with like 2 kb.. So is using a library really effective unless we're developing a major web app..

And shouldn't the beginners be lead to developing there own code instead of using libraries??
Oh i got it.. encodeUriComponent() is a javascript function.. Thank bear..I'll do that..
Thanks bear.. But i'm not using a library.. Its a small application so i wrote the javascript myself.. I'll see to uriEncoding.. I hope theres some reference o the internet.. Cause i don't know what uri is..
Hey guys,

I use ajax to save guest book messages via a servlet.. The javascript of the page gets the inputField.value and passes it to the ajax

but whenever i type a ' character to the field this doesn't work..

Do i have to use cgi escape character instead?

but when i output the text like slert(inputField.value) it works fine..

Please help.. Thanks in advance
When i try to access my HSQLDB database through my web app sometimes i get the following error :-

The database is already in use by another process: org.hsqldb.persist.NIOLockFile@b857bc59[file =/home/malith/www/data/db.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: checkHeartbeat(): lock file [/home/malith/www/data/db.lck] is presumably locked by another process.

What could be causing it? upto my knowledge HSQLDB allows multiple connections . So what other process could be using it?? Is it something wrong with the server i use.. It's a Apache 2.0.59 + Tomcat 5.5.23 .. Pleeeeease help... Oh and this error doesn't occur when i'm running the web app at my home tomcat..

One more thing, Is it necessary to call the
everytime i connect to the database.. Or is just enough that i call it from within the constructor once...

Guys i really really need some help.. Thanks in advance..
Hey guys,

I'm quite new to java servlets.. I wrote a web app where it uses a hsqldb database and the jdbc driver to access it.. I wrote a specific class which is not a servet to handle the database..

Is this how i must do it? Is it safe to synchronize all database access methods.. Will it slow down the web app?

And this class returns the result set object to be handled by the exact servlet.. Is it safe to do so? That way i won't be able to close the connection.. Please give me some advice.. Thank you..
12 years ago