Archive for JAVA Community

Most efficient way of reading XML

is C# actually used at Oulu University, or is this some hobby/work stuff?-)

hobby, but thanks for the stalking, i'm flattered *blush*

that's the internets, no privacy here

in your opinion what would be the most efficient way of reading XML api hosting data?
use dom4j straight or is there a higher abstraction?
dom4j isn't bad I currently use it for yahoo geocoding services
but is there anything better?

does anybody know where i can find/download a copy of the java web host 1.6 javadocs?

sun.com

i couldnt find a link except to the online ones

it should come with the JVM
netbeans pack perhaps?

java.sun.com - Downloads
look

the only sdks i see in there are java ee
Java EE 5 SDK

have you tried jaxb+

ah
i found it
thanks

~tell victori about xml

victori, xml is best parsed with XOM (http://www.xom.nu/ ), JAXB (http://java.sun.com/xml/jaxb/ ), or XmlMap (http://www.zwitserloot.com/java-boilerplate/mox
). If you like pain, you may wish to check out SAX or DOM (http://java.sun.com/xml/tutorial_intro.html ).

well, xmlBean is also a good choice i think
very "high level"

sup guys

… apparently not much

weekends are always quiet..

work

irl

for some.

hi!

heh, so quiet
would it be feasible to write a video editor in java, using jmf?

I think so
I'm not up to speed with JMF. But from a performance point of view, you should be able to do a lot of video editing with a java web hosting App
Real time might be pushing it though

I was thinking about writing one.. not sure if I'll ever have enough time though
any alternative to jmf?
oh, and without jni

http://sourceforge.net/search/?type_of_search=soft&words=java+video+editor
I don't know if there are alternatives to JMF

an advanced search gives me only one project, which seems to do something else

Yeah. I think pumping in the url without looking too deep was a bad idea
the first few items looked promising (but not in java)

guys i amtrying to a java class from Maven project in eclipse
it is unable to find commons-lang jar
java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/ToStringBuilder

Have you included it in the classpath?

u mean build class path?

Yeah, that too

yes

~tell Abhi123 about aolbonics

Abhi123, aolbonics is talking like a retard using speech as if you were on AIM or using single letters for you, are, you are, you're, see, etc. Talking like this is frowned upon in ##java and may result in you being silenced. We want to prevent you from making a fool of yourself like this idiot:
http://forums.oracle.com/forums/thread.jspa?threadID=499980&start=0&tstart=0

both build and Run
I need to set M2_REPO under windows system variables?

no

in eclipse build variables??

I take it the NoClassDefFoundError is happening at runtime: what sort of project is it?
Ask one question at a time if you want answers

do you run with "java -jar …"?

the project has only single module
i build the jar java hosting and package it… run the server fromjar

do you run with "java -jar …"?

then i connect to server hosting from Eclipse by running a test

What sort of server?

it is a javaspaces server

suppose i have a class with some methods, now i'd like that every time these methods are called, another method is called (for example, a drawing one). I'd like to obtain this ideally in a perfect transparent way (without adding instructions to the class i already have)…
…i thought about extending the class, and overriding the methods, but this broke extendibilty. I even thought adding a parent abstract class with methods with the same signature and different names that call abstract methods (ovverridden in the inherited class) and the drawing method, but this
constricts the use of naming convention i'd like to avoid…

ideas? tnx

ernimri, it is a maven project

Sorry,but I don't know how to deploy additional libraries with that project. You might have to refer to some docs

change your current class to an interface, implement it in one standard way (like you have now) and also implementa proxy one…

when i run from Run console… i can see M2_REP/***/***/commons-lang2.1.jar in classpath

I do not use maven

anybody use Maven?
i executed mvn eclipse:eclipse also

try #maven on irc.codehaus.org
that's the official channel

how do i implement the proxy one?

You don't need to set M2_REPO, it is an environmnet variable you can use to override the location of your local repository. the default on windows should be documents and settings/user/.m2/repository

public class FooProxy implements Foo { FooProxy (Foo foo) {this.foo = foo;} public foo() {log("foo called"); foo.foo(); }}

the lack of said class indicates that your project fails to declare a dependency on commons-lang

ok, hope i'll understand it in short time, i'm still a little drunk from yesterday evening…

it is just an implementation of the interface that does some extra operation and then calls the real handler.
in my example the extra call was a call to log…

ok, you maybe forgot the member "private Foo foo"?

I would not say forgot, I made a short example, not compilable java code…
but, yes, you need that variable if you want to compile it..

ahah…i'm not judging you :-D
tranks a lot, i've understood

hi there

hello

i have a problem with keylistener and focus
i have that class:

pastebin may be a good idea…

http://rafb.net/p/5V0InV91.html
yes
you see, i open a JComboBox, to decide wether the game should go fullscreen or windowed
no matter what i try, when the game is launched, i loose control of keyboard ..

1) you do swing/awt/java2d outside of the edt, anything can happen

i tryed with KeyEventDispatcher and all…
what mean edt ?

2) that code has lots of commented stuff in it and no comments
~tell keisangi about edt

keisangi, Event Dispatch Thread, the thread that drives the swing gui. See http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html for a tutorial on Swing and threads, and note "http://java.sun.com/developer/JDCTechTips/2005/tt0727.html#1">http://java.sun.com/developer/JDCTechTips/2005/tt0727.html#1

yes.. sorry about the code state, it's messy ..

3) your indentation is horrible

thanks for the heads up on edt

there is never any reason to be sloppy when writing code. Use an editor that helps you indent properly

so, i get keyboard support while the swing JComboBox is displayed, but then once the real app is started i totaly loose focus it seems

~tell keisangi about test case

keisangi, Provide complete, compilable Java SOURCE CODE that shows the problem and nothing else. Be as brief as possible. (See http://javafaq.mine.nu/lookup?364 for details and a HOWTO.)

a test case would be better and as long as you do swing/awt/jaav2d outside of the edt I will now help you with random problems since it is expected!

you mean you can help ?
…me..

I have done lots of swing and java2d, but since you are not following the swing/java2d rules anything can happen
including focus problems

yes.. i understand how bad this might be looking ..
i'm learning .. and i have no excuses for the indentation and the lack of comments ..
usualy when i get everything sorted out, i release all the sources on my website.. some kind of tutorials ..(mainly for me , but anyone can use them ..) but in the mean time the code is alway messy
only when i get everything sorted out, i clean the code and comment a bit here and there

doing things in that order just means that you can find no one to help you when you have a problem

want the url, to look at last version sources? they're context highlighted at least
?

sure…

hum, you got a point there
http://yggdrasil.keisangi.free.fr/html/index.php

well, I have probably been coding for more years than you are old… :-)

space weasel

there's a java webstart too ..
http://yggdrasil.keisangi.free.fr/html/javaview.php?id=4 (direct link)

I run linux/64 bit, no java plugin so no webstart for me…

i run 32bit ubuntu ..
sad to hear no jws on 64bit .. i didn't know

that's so wrong, why would Sun not make jws for 64bit?

yes, i think there is too

they do not provide any javaplugin for 64 bit systems… it is said that they will make jdk/7 have one though…
it has been one of their most requested features for the last 4 years…

i couldn't swear but i tought there was jws even on 64bit version of linux

the code for space weasel 2 is almost as horrible as your earlier paste….

ernimril, if you don't have the browser plugin, just copy the link and from a term, type javaws http://www.link..
ernimril, argh

"here's a nice and convenient deployment system; wanna run it on the most powerful and advanced servers? too bad, go away!"

there is no javaws in my install… sun do not provide one
stay in channel please

ok

~tell keisangi about pm

keisangi, pm is something that you should do to 'bots, like Drone and me, but not to other users without asking first. See: http://javachannel.net/wiki/pmwiki.php/FAQ/Pm

you did ask, but in the wrong place…

allright

but I fade in and out, so stay in channel and others may join in

k
so what could i do about my focus problem ? i think it all get confused because i open few jframes .. like parent and children, the focus gets lost ?

start by fixing your edt problems
read the edt-tutorial, change your main as they suggest

ok
i'll do that .. thanks for the links

hm.. that weasel wants java 6

yes
and it need hardware accelrated X
i don't run windows at all, i didn't tryed on windows at all, result may be diffrent from what i get on my linux box
maybe i should avoid swing alltogether ?
i read it's no thread safe, and may lead to thread interference or memory consistency errors

swing is fine

it is ?
so far it gave me only headaches

if you have "thread interference or memory consistency errors", there can be only one reason, and that is…
~wrong

No, you're doing it wrong! See http://www.oddpic.com/data/520/you_re-doing-it-wrong.jpg

well, it can do that sometimes…
still, this is one of the systems I develop: http://www.digpro.com/Articles/Produkter/dp_com.html
full swing, full java2d….

i look
looks great .. apart running on windows ..
sorry i couldn't resist

it runs equall well on linux/unix

that's the good news

ok wtf uad.java:34: org.jnode.vm.compiler.ir.quad.PhiAssignQuad is not abstract and doe
s not override abstract method generateCode(org.jnode.vm.compiler.ir.CodeGenerat
orT) in org.jnode.vm.compiler.ir.quad.PhiAssignQuad

about half of our java coders run linux, the other half windows. All of our customers run windows though…

that's a big project ..
impressive

well it is not small anymore…
we have about 11k source files, I think about 5.5-6k of them are .java, most of the rest are .sql

you mean kilobytes ?

we passed commit 50k in svn and bug 10k some time ago… :-)

or file count ?

about 11 000 files (11k)

ic.. file count
ouch ..
i get you get bigger headache than i then
i bet

not really…

11 000 files.. that's a lot ..

most of the things we do are quite simple nowdays…

O_o

but there have certainly been some interesting questions from time to time…

i wish i could same simple things
*could do
ok, i go read that edt tutorial now

tag)

better not loose time if i wish to reach that level one day lol

if you can, then join a larger project, you may pick up a few things…
one of the things that works very well for us is the pre-commit hook we have in svn. It is a program that checks that all classes have 1) a comment 2) an author 3) correct indentation
and a few more things as well…

hi everyone. I'm having a little trouble. I have foo.java and it does import bar.* so I can use java files in bar folder. Problem is java says: "package bar does not exist". DIR arch is: src\foo.java and src\bar\*.java. What is wrong?

are you compiling with -sourcepath src ?

I don't think I should. I use an IDE
and by default src is where java files should be

~tell nkour about newbie ide

nkour, newbies shouldn't use IDEs. http://weblogs.java.net/blog/editors/archives/2007/02/you_better_get.html and "http://weblogs.java.net/blog/gsporar/archive/2007/02/tools_that_do_t.html">http://weblogs.java.net/blog/gsporar/archive/2007/02/tools_that_do_t.html

I'm not that newbie (in general) I use wireless toolkit ide. so I think I should :$

if you do not know how to compile simple java projects you are a java newbie

how can i avoid Iterator erasing during reading?

que?
but still try (#)#whatever_ide_you_use

when i use .next() on Iterator, i erase that element

that is not how a normal iterator works…

ok

why do you erase it?

i don't do it

then what's the problem?

http://rafb.net/p/sEKLtd31.html
data is my iterator, but for i=1, it is empty

there's no iterator there

ok let me ask you something similar: I moves all files from src\bar\ to src\. So I now hava foo.java and it wants to use other java files in the *same* folder. All I should do is use them. I don't need to import them right? Still it fails saying "no such symbols"

make sure that the package declaration matches the path, for each class

"it"? if you have a test case in pastebin with output from _javac_ I may be able to help you. I do not use any ide and I do not care what they say
~tell nkour about package

nkour, package is http://java.sun.com/tutorial/java/interpack/packages.html and some example http://javafaq.mine.nu/lookup?254

How can I add dtds to the xml parsers' search path, do I have to always pass in an EntityResolver?
Well I guess it's not a big deal to just use a static DocumentBuilder with a preset one

guys, i'm posting a request for feature enchantment to java bug tracker of something i think it's a great idea. Would you like to give it a look before i sent it ( http://rifers.org/paste/show/5021 ) ? It's about a keyword for accessing objects
members without the use of the dot. Thanks

personally i think thats pretty ankward.

hi everyone…
has anyone here tryed using a Connection pool for JDBC connections with the SUN AS? (glassfish)

"ankward" is not in my vocabulary… can you use another word :-) ?
oh, you disappointed! :-D
can you explain me why?

its pretty complicated :P

your explanation or my idea?

no, your idea
sure it saves a couple letters, but if such things are class wide its hard to keep track which of them is now active where.. even in big methods it would be hard to track down.

ehi, it's not original :-)
however, it would be only a problem of static parsing

but what do i know anyway

well, have you tryed to observe the scope of inner classes? you can safely access members of the outer class
so, in my opinion, is not about hard definition of the scope…

i'm trying to build an option screen, if you press esc key, the game is paused and the option screen is shown, and if you press esc key again, the option screen disappear and the game restart … but i have a problem with keylistener.. i get too many hits when i press esc key .. how can i
limit to amount of hits on keypress ? my method is like that:

case KeyEvent.VK_ESCAPE : exit = true;break;
i get tons of "true"
i would like to limit to one only ..

anybody knows why ${pageContext.request.remoteAddr} doesnt give me anything in my facelet ?

I would guess that you have added several key listeners

ernimril, i dont think so ?
http://rafb.net/p/PlRC9B25.html
see the method option() ? i would like to display option screen from here .. one keypress (exit) show option screen

kicker is the method that adds the keylistener? it is public so it can be called from a lot of places…

another keypress (exit) leaves option screen

provide a test case and maybe I can take another look

so you call that thing "nest"? in my experience, it's usually called "with"

yes, it's public, so i can call it, but i still don't understand how that's should help me limiting the keypress?

it's how struts devs called that…

anyway, I don't find it very important, I can always define a reference to the "nested" object (if I don't have it already), with a short name, and then access members on it
and nesting makes the code harder to read

i think exactly the opposite

well, sometimes it's not clear which class/object has those members
then one day you add a new member in a class (or rename one), and the semantics of the nested code suddenly change

well, can't see why if the exact concept worked for other languages, why shouldn't works for java

java tends to have lots of classes and objects; inner classes are already stretching it
and there is the classname.this.member thing… not very nice
oh, I wonder if your idea can actually be implemented using inner classes

in an hugly way, maybe yes….
better to avoid
however, thanks all for reviewing it :-D i'm still convinced it's a good idea, i filled it

heh.. brings back my ideas for a new language

however, if you see the past….lof of features should had never been implemented :-) Templates? pfui! All our objects inherit from Object! :-D

How do GUI's that don't have save buttons on their preference menus store the changed results? When you make a chnage, are they stored instantly to disk, or does the application save to disk on exit?

there are always different ways to do things.. and they all have pros and cons, and different people will want different things

But "no save preferences" are the new wave, and I'm just wondering if there is a "best practices".

save current settings when they close to app?

they may not have "save prefs", but "ok" and "apply" instead :p

i know some applications that are used by many different people make profiles and save settings automatically
when the app is closed

the problem with that is settings are lost if the app crashes (or the computer suddenly shuts down)

no they arent

That's exactly what I'm not talking about. I mean preference type windows that don't have a save or apply. You change a field and as soon as focus leaves, the results are either saved to disk then, or changed in memory and saved on exit.

they arent saved if they had been changed
but the profile remains on disk

exactly

well geez, how likely is it that the computer will crash?
that rarely happens

Depends on who wrote it and what OS :P

multiply by the number of users, and you can't say "rarely" anymore :p

..
well its not the end of the world if their preferences arent saved one time - most users dont change their settings every time they run the app
at least the apps i work on..

what if it's an app that can run for days?

can you give an example?
im talking about just things you would find in view-options-some options dialog

a trading application (such as the one I'm working on), some clients kept it running for more than a week

not a huge deal
ah
i see
well yes, simply dont write when the app exits then
write whenever convenient

I have the solution. Master timer that checks for things. At first it just checks for 1 minute past the last prefenence field alteration, and saves prefs.

as time passes, there are more options they will change, and a higher probability to crash

Or just save every time focus leaves a preference field.
You must work for a big brokerage if you are writing a trading app that will have access to real time data.
Okay, I'm off to the farmer's market. Thanks for the enlightening convo. .o0(maybe I'll just make the preferences unalterable :P )

we currently have a "save prefs" option

lol the farmer's market
is he 80?

what is that?

a place where the elderly go to buy vegetables

whats_in_a_name, have you never been to a farmers market
its a great place to buy food

i dont eat vegetables or fruits

o_0

how come you're not dead yet?

i get a slice of tomatoe on my burger
and lettuce

so you do eat… some

and potatoes are in french fries - right?
so i guess i eat potatoes

but sounds like cancer is waiting for you with open arms :p

why don't you eat vegetables or fruits?

hes jewish

nonsense

lol, he can't eat them with pork, so he won't eat them with anything!

hm.. "farmer's market".. I think I just called those things "market"

depends where you're from i guess

hey
dudes
i got a prob installing ant
apache irc said i could aks here
when i type "ant -version" in the cmd i get a error that it inst a valid file

that it isn't a valid file? sure that that's the error?

yea
not a valid
batch file

you mean, the command is simply not found and windows prints that out?

yea

then ant is not in PATH, fix that
or call it using the whole path

i double checked dude

you restarted cmd.exe?

no
now i did
and i get a other error
XD
Files\Java\jre1.5.0_02\lib\ext\QTJava.zip""=="""" niet verwacht op dit moment.

and you think that i understand that error?

niet verwacht op dit moment = not expected on this moment
lol

come now, Flamish is almost like German, and that again is almost like English!

he

flamish?
this is dutch
lol
eh…..
weird i do i solve this prob

same thing?

looks like you have an extra " in there

yea only the accent lol
well
seems i was forgotten to remove that version of Java
removed it
and i get the same error
mhmmh
how can i solve this error?
nobody?
=O

you have a messed up PATH. fix it

=O
well my path varriable is ";%JAVA_HOME%bin;%ANT_HOME%bin"
is that a wrong path?

missing a / or \
depending on OS

using win

should be %JAVA_HOME%\bin then I would think
same for ant

has anybody installed jini 2.0?

not working

first off, starting PATH with ; is pointless, second, you don't need to escape your environment vars

well
i am following a tut
ofr jME
only prob is this

do "JAVA_HOME\bin;ANT_HOME\bin"
and you may want to add . in there as well

. where?
wher emust i put the "."

and you might want to say what you are trying to run
what command

ant -version
not working
=/

oh, wait. make sure your path doesn't contain any "'s

i did

okaay, then what is your current path?

JAVA_HOME\bin;ANT_HOME\bin

and you've restarted your commandline?

yes

and JAVA_HOME is…?

ant isnt not a valid batch file, extrenal task
the java sdk

should be %JAVA_HOME% and %ANT_HOME% , this is windows not *nix ;p

?

tell that to my winxp install. JAVA_HOME and ANT_HOME work just fine

so full what will ti be?

odd, always used % here and has worked fine for me too
and his seemed to find the bat when he had the % but not now

so…
"?
%JAVA_HOME\bin;%ANT_HOME\bin?

no

=O

if you use % it is on both ends
see what I said 3 mins ago

i c
i and the
\bin?

%JAVA_HOME%\bin etc

ok
nope
doesnt work.

error?

that
QTJava isnt excpected at the moment

pastebin the contents of ant.bat

i'm willing to bet you have a misplaced " somewhere that's cutting your path short

could be
or in his JAVA_HOME maybe

well
the prob is
the directory that the error comes from
doesnt exist:P

~tell xdemondogx about enter

xdemondogx, enter is not punctuation. Please don't press return until you've finished typing your question, it's annoying to see multiple lines for one question, and hard to follow.

=O, sorry
http://pastebin.com/939598

ick
~pastebin

http://pastebin.stonekeep.com

pastebin.com is junk. try that one

owh ic
http://pastebin.stonekeep.com/538

now pastebin the full contents of your PATH,ANT_HOME,JAVA_HOME and CLASSPATH if you have it

ok
http://pastebin.stonekeep.com/539

hmm can't see what is trying to use that file then

ic

tell xdemondogx about aolbonics

xdemondogx, aolbonics is talking like a retard using speech as if you were on AIM or using single letters for you, are, you are, you're, see, etc. Talking like this is frowned upon in ##java and may result in you being silenced. We want to prevent you from making a fool of yourself like this
idiot: http://forums.oracle.com/forums/thread.jspa?threadID=499980&start=0&tstart=0

sorry again
erhm…what should i do now?

hi, does anyone know an open source java api for editing flac tags?

is spring slower than traditional java applications?

define "traditional java application"
also, you're comparing a web framework against (i assume) a desktop gui. they're really not comparable

using jsp's and beans

ah, in that case, i dunno

(i assume he meant)
if youre talking desktop apps, yeah, quite different from web apps

why i see the string "Java Applet Window" under a JOptionPane.showInputDialog?

what? where?

i am not comparing GUI apps
also spring can be used for normal java apps
who told spring is a web framework alone?

So I guess there was no actual question.

have yall ever got this error java.sql.SQLException: Column Index out of range , when using connector-j ? , jdbc+mysql ?

i have NEVER heard of spring being used for anything other than web apps

http://img408.imageshack.us/img408/4884/imgph9.jpg

guys… how to remote debug a jvm ?

Fanook, only on Planet Wierd.

i am not using any j2ee app server
mine is a javaspaces server
running on some port

[Weird]

still sounds like a web app

??
Fanook, this is not a web app

web apps are for farmers markets

~tell Fanook about javaspaces

Fanook, javaspaces is distributed shared memory, where java objects are entries. See http://www.dancres.org/cottage/javaspaces.html

are you running that code via appletviewer?

no

OH CRAP

paste the code that creates that box

I made a Windows XP harming virus in Java and I had no idea that I had done it. O_o;
uI made a Windows XP harming virus in Java and I had no idea that I had done it. O_o;/u

that's not a virus. that's a vaccine

I was experimenting with file fitness.

dangertools, http://rafb.net/p/DFbGA622.html

guys any idea of eclipse remote debugging

I thought about something that deletes IO.SYS
and I realized, HOLY CRAP THAT'S A VIRUS

mhm, interesting, try to run the code outside eclipse, or try to reproduce it in a testcase

no, could possibly be considered a trojan though…

Well, one thing's for sure.
I'd never make a virus and release it to the public if it actually did anything bad.
virus/trojan/adware/etc.

mercy killing, perhaps?

try emacs or vim

who would write a virus in java
or a trojan for that matter

dangertools, no… i don't see that outside Eclipse

probably someone that would write a virus

the virus from "independent day" was probably written in java

Type B.
GOD IT WAS HORRIBLE.

who woukd write a virus that depended on there being a jre present in order to function?
i mean yeah many people have it
but not all
then again it could be a cross platform virus…
thatd be cool

clearly the future is for crossplatform opensource viruses

i concur

mobile too

but JVM don't control code before executing?

it does safety checks yes

haha
~aditsu++

aditsu has a karma level of 12, varek

whats_in_a_name!

how to start the jvm in debug mode?

~vm options

Fanook, vm options is http://java.sun.com/docs/hotspot/VMOptions.html

Fanook!

easiest way: use a debugger

is thier no way at all to get a classes private variables with reflection ?

java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8080 server=y, suspend=n
is it fine??

~tias

Try it and see. You learn much more by experimentation than by asking without having even tried.

~tell qbert about javadoc Class.getDeclaredFields(*)

qbert, please see java.lang.Class.getDeclaredFields(): http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getDeclaredFields()

heh, I have a game called "Q*bert" on my phone

i got it right… the address was the probe

it's written in java, and it sucks
look up "setAccessible"
(if you want to access them)

whats that do, change access modifier at runtime?

only for reflection

The original Q*Bert owns your soul

http://spiritmech.blogspot.com/2007_03_01_archive.html#8390566551434667161
(The Myth of Expensive Object Allocation)

if you expect us to read green on yellow italic text, then youre nuts

hehe
its little text there
but yes, the format is really strange

i think its fugly.

[krustofski]: you can disable the stylesheet

aditsu, i can do lots of things, but why should i?!

up to you

krust!!

so anyone know if someone has written a C++ compiler for the jvm

lets make it ourselves.. chan project!

chan prroject?

me and krust get administrative roles
you get to be the monkeys

whats_in_a_name, go eat a burger

i jjust finished a pizza

good stuff

no vegetables or fruit on the thing

lol

chrome://browser/content/
put that into firefox

chrome?
do i have him squelched?
i didnt see him speak

wtf are you talking about

oh thats part of the string

How do I make ant rebuild my project when the used jar files changes ?

Has pr3d4t0r been around lately?

no

KimHansen, you stop using ant and use a proper build system

pr3d is in barcelona doing the tss thing

like ?

him and his tss

Damn, I ordered his book, but I guess that explains why I haven't received it yet…

KimHansen, scons is pretty good

you actually bouhgt his book? man he will love you
he pimps that thing whenever he can

for java? ant is better, or maven

Lol.

dangertools, ant is a joke
its nowhere near flexible enough

That kind of stuff is fun to read anyways ;-)

orange80, poor guy, wasted that money

it might be a decent book, he is a pretty good writer

i've heard maven is the shit though
dangertools, you have to be careful not to use a "build tool for a language"

well, scons is …, and why would one like a python based(+python dependency) buildsystem for java?

Agreed. Partly I'm curious what pr3d4t0r's book would be like.

because you inevitably need more stuff than just the language being built
dangertools, i dunno, why would someone want a java dependency for C++? (ant-contrib)

Damn it's a bitch typing his name when there's no autocomplete because he's not here.

orange80, parts of it are on amazon
just call him eugene

well, ant-contrib is more for mixed-projects imho

dangertools, oh, i guess java programmers only work in java..
its probably true

I like Ant.

I like Beatle

as a c++ programmer though, I use atleast python and java in addition to c++

Which one, lol.
I think you meant *Beetle*.

all of them in one project?

anyway, Im just trolling
ant is great
I love java
dangertools, yes

errr right

As opposed to John/Paul/George/Ringo…

3 ringo
ringo had one huge ass nose

Did you get your bottle opener yet?

am i the only one that noticed that?
no

then scons makes sense, xmms2 e.g. also used it (switched to waf now)

im drinking pop right now
i had a budlight with my pizza
actually.. miller light

damn alcoholic

not my fav

dangertools, waf is ok, but his idea of "object-oriented" is very strange

Yeah, bud light sucks.

ya, its all about keystone light!
:p

its tolerable when its ice cold

[krustofski]: Ick.

and going along with pizza
drinking it with no food can be rough

orange80, that and milw.'s best

lol, never had milw.'s best

I saw on Mythbusters that you can chill a room temp beer to 38ºF in about 5 min in a cooler full of ice, water, and salt.

and im in wisconsin

Hello. I want to user OpenOffice as an editor for an wiki. So i want to start OO when the user clicks on edit and on save, upload the content to the wiki. My question is, should i use java-applet to start and control OpenOffice on the client ?

cool.

Well, you gotta support the home team then with your Miller Lite.
I will admit that Miller Lite is way better than Bud Light.

whats_in_a_name, drink the beast

I've never tried the Java API to OO before. OO basic works okay though..

yeah.. *checks can*, brewed in milwaukee

Just like VB for OO

milw best is made by miller

Can I disable use of conext in Mylyn Tasks?

how is it? better than light?

I don't know how efficient it would be to have basic/java call open office for each user though… sounds like a very heavy app

my quesiton is more, am i able to start OO with an applet ( the user has to accept that ofc ) ?

whats_in_a_name, i probably wont ever drink it again

that bad huh? haha

yeah bot it should be client side ( everthing. OpenOffice and the plugin

whats_in_a_name, its cheap, nasty, and widely used in college

oh, I'm not sure.. but i think you can.. http://api.openoffice.org/
ohhh, ya you can do that

So which is better, mule piss or donkey piss?

the heinekin wasnt that bad at all, it was like 8 bucks for 6 bottles

(Sorry.)

thats just a little more than bud light

ok thank you a lot

np

Has anyone ever gotten the error "The parameter name [some field] in the query's selection criteria does not match any parameter name defined in the query." from toplink?
Hello?

'allo

I take it no one has ever gotten that error?

be a bit more patient maybe?

Yep,
..
Ok, well if anyone has gotten that, be sure to say the word "RProgrammer" so my irc client will beep me.

that's called highlighting, a normal thing on irc

using static imports, can we import objects ? i.e. is it legal to say "import static java.lang.System.out;" ? and then out.println… ?

rohan, what happened when you tried it?

it works. but well, my real doubt is, for the statically imported object, we can call only static methods ?

rohan, is println a static method?

you're confusing the usage of static in this context

how ?
i am confused about static imports .. where can i read more about it ?

~static import

Fanook, static import is http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html

thanks

I hate backing up over a lan

better than over a wlan

yeh

hmmmm…

later.

Better than backing up over an icechest full of beer.

hmmm, almost looks like my new firewall/web/mail server is working… :-)

when i say import java.* ; it doesn't import things other packages like java.io and java.util etc, right ?

hello. i have a easy quick question….
how do you check the operating system java's running on?
i didn't see anything in Runtime, figuring the JVM would have it.

~tell rohan about star imports

rohan, star imports is http://en.wikibooks.org/wiki/Java_Programming/StarImports

try system properties…

rohan, you never try these things before asking, do you?

i do, but i am very confused atm

google java system properties
~google java system properties

http://www.google.com/search?q=java+system+properties

hmm.. come to think of it, i must really start eclipse now
sorry for asking before trying :-/
ok, _after_ reading the sun docs on static imports, i'll ask the question again - if i say import static java.lang.System.out; it imports a PrintStream object … for that object, can i call only the static methods ?

rohan, were you able to call println successfully?

yes

rohan, is println a static method?
rohan, yes or no.

no
why didn't i think of it before :-/

Then you just answered your own question.

yes, flippo

rohan, I asked you the first time too.

what's the punishment ?
sorry, flippo

Rock/Paper/Scissors/Gun/Dynamite/Nuke… http://www.umop.com/images/rps25_outcomes.jpg

Roshambo. flippo goes first

out is static, the println method is not, yeah?

correct, as i just learnt
ok, flippo , call ?

sort of odd that they would give you access directly to the object. I always thought that was a nono
I guess for ease of use.

as the sun docs say in bold .. use it very rarely .. and i understand, because it's hell confusing :P

I thought the default access modifier was protected for java

nope, package-protected

Consty, nope, it's a package scope

no, it's default
i mean, there's a default scope which is limited to package

ah, so any object within the package can use the variable as if it were public
?

yes

gotcha
learn new things every day

protected provides more visibility than package

flippo++

I thought with protected only inheriting classes can use it?

Consty, also package

no, package and subclasses

ohh I see

correct, but also inherting class out of package

Gotcha
can you specifically state package protected or whatever using a keyword?

Consty, alas no

I see.

Consty, I add the comment /*package*/

yes, don't use an access modifier. that IS specifically stating package access

we can't state package access can we ?
i mean, what's the use ? if everyone can't use the package, why package it in the first place :P

Did anyone understand that question?

you declare package access by not using any other access modifier
it's for methods and members that you don't want public, don't want protected, but want to use easily within the package you're writing

mine ?

rohan, Fanook seems to have understood

i think it's best used on classes that are internal to the package

ah, i see

i.e., not declared as public

Fanook, that's probably underused. Should be done more.

i know

say, do i need to get the older sdk's to compile for them, or is newer version enough ?

-target=1.X

i know, but is that enough ?

yes

right

well, wait
not for everything
you can't compile everything for java1.4 e.g.

lets assume the code is compatible across

then things should be fine

okies
just saves me from installing abundant amount of these sdk's :P

i only have 1.6 here but compile a project for 1.5 i.e.

guys i am getting invalid stream while deserializing byte[]
actually it is invalid stream header

can we see the complete code ?

sure

paste it on rafb.net/paste

http://rafb.net/p/VoKirP53.html
it is happening while deserializing

you realize you're reading the object stream twice. are you expecting the same object twice?

I created a class which extends JComponent, it paints itself by overriding the paintComponent() method. What do I need to do to get the scrollbars in JScrollPane work like they should? I tried implementing Scrollable but I couldn't figure out how.

yes
farrok, it is right

~jscrollpane

ernimril, I have no idea what jscrollpane is.

xwolf-: read the JScrollPane tutorial

does serialize() write the object twice?

i will paste that code too

xwolf-: you find the link in the api, the first paragraph has a link "how to use scroll panes" (as almost all swing components)

why not just delegate the Scrollable methods to super.methodName?

http://rafb.net/p/Q04Px444.html
fanook, http://rafb.net/p/Q04Px444.html

Fanook i'd say JComponent doesn't implement Scrollable.

it hasnt been shown oss is more secure than closed source?

fanook, i am expecting the object only once

then stop reading it twice
look at lines 73 and 74

fanook, i was disconnected

then stop reading it twice
look at lines 73 and 74

ok
you mean the stream will become empty??
the second time??

the object was already read, there's no object left for the second attempt

yes
thanks

hey friends, i have two objects from diferent classes and i would like to send them has a return from a method of some class. What is the better to do it ?

that was almost sensible iturk…

huh? you're asking how to return two objects from a single method?

make a List
or a Pair
or something

use a pojo

a what?

or a wrapper class

the hell is a pojo

~pojo

Fanook, pojo is Plain Old Java Objects, as opposed to things like EJBs.

With a JTextPane, can you open an HTML document and view its source?

plain ol' java object

sounds like something you bounce around on

Or do you view the HTML document as it would appear in a browser?
(With the JTextPane)

web dev.. ewwwww


Anyway.
Can I get an answer to my question without being judged of my interests?

Dr_Link, that's what happens when you volunteer extra information %]


Well, seriously
Can we get on with the question/answer segment?

Dr_Link, your code already has the url. What's stopping you from looking at the source?

Well, you must have mistook my question…
I meant.

~tell Dr_Link about html swing

Dr_Link, http://java.sun.com/docs/books/tutorial/uiswing/components/html.html

You might have to write a few lines of code yourself.

……
Let me rephrase my question…!

good idea.

OK, say there is an HTML document on your local hard drive.
Now, in a JFrame, there is a JTextPane.

Dr_Link, JTextPane is not a full-featured browser, by the way.

If you are looking at the HTML document in the JTextPane, would you see the page as you would in a browser, or in a text editor?

read the link javabot gave you, it tells you how to do html in swing componenets

All I need is an answer to that question and I can get on with it, I just want to make something that I made myself instead of making it overly easy.

we're telling you to _READ_ the link

can you make something you DIDNT make yourself?

Yes. A modefied open source program.
You technically didn't make the finished product. =Þ

http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html

Now if you'll excuse me…

there you go.

Thanks, r0bby.
I'll check back if it wasn't EXACTLY what I was looking for

sigh….

that IS what you're looking for.

…I was just on that page and it just told me about Undo and Redo when I wanted to know about the JTextPane itself.

you want a JEditorPane

Dr_Link, JEditorPane is probably what you want.

I don't want to know about actions. Just the TextPane.

not a JTextPane

hi guys

two TOTALLY different components.

the JEditorPane… I thought that viewed it as a browser would. I want it to view it as an _EDITOR_ would. Such as Notepad or Dreamweaver.
JEditorPane… sounds a bit misleading…

then use a jtextarea

http://www.google.com/search?source=ig&hl=en&q=Wysiwyg+swing+java+&btnG=Google+Search

WYSIWYG swing java?

what you see is what you get

Is there a way to obtain the path of the directory containing the class with is running at the moment ?

that is EXACTLY what you're looking for.

swing is gui library
and java is language

Dr_Link, does JTextPane claim to interpret special text formats?

I know.
OK, let me say one more thing.

Time's up.

your ignorance and laziness are not helping this situation at all

go read those links, then come back when you have read them. They _SHOULD_ answer your questions.
and I can't type wysiwyg for my life lol

what you see is what you get — I knew that, just wondering why he pointed me to that. But never mind that.

because that's EXACTLY what you're describing

…. Does your mouth move when you read?

you want to be able to edit an HTML Document and display the changes as you're typing it.
hence wysiwyg

… r0bby.
XD

If you are looking at the HTML document in the JTextPane, would you see the page as you would in a browser, or in a text editor?\

…XD

That's a wysiwyg editor sir.

OK, I see why I wasn't getting the answer I was looking for

i have a problem with classloading

You misunderstood me.

No, you're communicating poorly

i am connecting to server which hold some objects in a vector

I wanted a code editor, not a wysiwyg editor. One that shows the code, and it's colored, for example, a tag is colored purple, its attributes are green, comments are grey, etc.
I mean, you know.
Color-coded source editor.
Not a visual editor.

then use a jeditorpane
read about using html in swing

~tell Dr_Link about html swing

Dr_Link, http://java.sun.com/docs/books/tutorial/uiswing/components/html.html

guys can someone help me plz

go read that, google that exact phrase if that page doesn't explain it clear enough, come back when you read it
~tell DoctorPepper about aolbonics

DoctorPepper, aolbonics is talking like a retard using speech as if you were on AIM or using single letters for you, are, you are, you're, see, etc. Talking like this is frowned upon in ##java and may result in you being silenced. We want to prevent you from making a fool of yourself like this
idiot: http://forums.oracle.com/forums/thread.jspa?threadID=499980&start=0&tstart=0

it is *please*. Thank you.

we only help those who give us information

usually, it's ask, not ask to ask

afaik that's not possible
the class could be everywhere

actually i have asked previously

wrong person

hu?

er i didn't see DoctorPepper's question; apologies

guys, I think having one person use ~aolbonics is enough…

nah, two hammers it in really nicely

~tell whaley about stfu

whaley, http://eugeneciurana.com/galereya/view_photo.php?set_albumName=Humor&id=warning
whaley, a xhref="http://eugeneciurana.com/galereya/view_photo.php?set_albumName=Humor&id=warning"http://eugeneciurana.com/galereya/view_photo.php?set_albumName=Humor&id=warning/a

there 3 others chiming in after you… that's a bit much eh?
*there are

i am storing objects in a vector and loadiing the class definitions into hashmap…. now based on some matching criteria i need to remove the objects from vector through a client application… for that i need to aquire classloder that has done the loading of obejcts….

no
map.get(key).someMethodOfTheClass()

the loading and removing of obejcts are happening in server

i didn't actually hammer him for the aolbonics did i ? so it's just 2 people after r0bby

yeah, you're right :/
was attempting to be sympathetic

hehe

http://www.google.com/search?hl=en&safe=off&q=syntax+highlighting+swing+java+&btnG=Search

oooh, thanks!

feeling generous.

i'm off, g'nite

hi

I need to find out how to tell what type an object or primitive is?

IvoryZion, for a object obj.getClass.getName

primitive not sure
dont think its possible
instanceof might work on primitives

I don't think instanceof operates on primitives. At least not when I tried it.

it does not

should be rather simple to create your own class to determine a primitives type

how?
i mean a VERY ugly way would be trying to construct different wrappers

create a class that takes each diff type in the ctor… and determine that way. that's one way

and catch any exceptions generated
ugh
so ugly

sure, but it's an easy way to do it

whaley, overloaded constructors
errr whats_in_a_name

AJADKSHFDKLAJSHFKLASDJHFASLFHK

ALOL
AHAHAHAHA

sorry whaley

oh my god.

rofl

effing tab complete

that happens at LEAST once a day

int.class.getName()
?

wow
didnt know you could do that

lol

thats cool
totally learned something new

lol

tab completion??

no

*phew*

that you could say int.class

whats_in_a_name, though with the overloaded approach you dont need to have any exceptions

ah, i gotcha
yeah thats a slightly better way
instanceof should just work for primitives
honestly

java primitives should just be objects ;D

i wonder if autoboxing would work for ints?

but i guess it wouldnt be efficient

int i; if (i instanceof Integer)?
stand back! im going to try science!

tias

nope!
wont compile
says incompatible types (BS)
im actually surprised that wont work
autoboxing was supposed to let me treat ints like objects

autoboxing/unboxing has it's flaws

since C# stole so much from Java maybe Java is entitled to steal some from C#?

yeah but java probably stole a lot from other languages

true…

i dont think theres a lot totally original in java

I'm just learning Java and there are a few things missing that I would really like…

like what

operator overloading..

ehh… next.
i dont like that

that's overrated

im glad they left that out
its an ugly thing

yeah but switch won't take a string…

plus they added the only one that really matters, string catting

isn't that a little strange?

it violates the "things that look similar should behave similarily" principle
of language design

we're hoping for string switches in java 7

I'm sure they have to overload operators at some to implement that…
another nice thing in C# is properties…

implement what, string switch? naw. they just need to use .equals

well, you can switch on enums nowdays…

I think Java should implement those

arent properites just member variables used with getters/setters?
iirc..

pfft. why? any decent IDE will generate the getter/setter for you. and speaking from experience, C#'s properties aren't any different

yeah, i dont see properties being anything really important

yes…. the concept is the same… it just allows class clients a nice syntax…. Square.getSide() or Square.Side
somewhat minor, I agree

meh, syntactic sugar
the Square.Side, assuming that Side is private

just public your var'iables if you like properties

ugh
wash your mouth out with soap kemik

I don't think it's quite that simple

not that much of a difference if all you do is "get/set" the variable anyway.. *oops*

especially if you need to do validation

it makes a big difference
predator explained it nicely way back
sigh

well, yes. if you're just doing simple assignment/retrieval, there's no reason to make it public other than encapsulation (which some will say it a BIG reason)
s/to make/not to make

i was going to say the only big thing i wish java had was the ability to pass functions around as data, but i just recently met the Method class
very very cool
so now you can properly write a derivative() function

you mean like closures? :P

i dont have a lot of experience with them
i meant just like function pointers in c++

they're functions (well, okay, blocks of code) you pass around

obviously sans the pointer
well yeah, they are more than that i think
theyre bound to an environment

well, Method is kind of limited and slow. It is usually the wrong thing to pass around, use a specific interface instead…

you can simulate closures in java using inner classes iirc

btw, substring (in java 1.5, 1.6) doesnt alloc a new char[]

huh?

maybe it wasnt you who discussed it.. a couple of days ago.. hmm…

it may not alloc a new char[], but it probably makes a new string…
string is immutable

yes, referring the original char[] ..
making it unpossible to GC mentioned char[]
(granted, it's usually not a problem… *usually*… :X )

kemik fail english? that's unpossible!

Fanook!!! hehe nice catch

oh, i'm a font of useless pop culture references

so you have two string objects, noth using the same char[]?
im having a little trouble following you..
both*
if thats the case thats gotta be a bug

nope, efficiency

since as you say you cant even collect the outdated string

just as an example. you have a string coming in to your jvm, 1KB in size, all you want is 2bytes.. you do a substring.. it refers the 1KB char[].. what happens if you receive thousands of strings that way..

since they share the same resource

hmmm, string has too many constructors: String(int,int,char[]) and String(char[],int,int)…
one shares the char[], the other copies it..

indeed.. and (int, int, char) is 'default modified'

I know…

exactly, the shared char[]is used by substring.. nasty biz.

and you confirmed this in the source?

i guess it makes sense in 99% of the cases.
yes, twice actually.. 1 time at work when the 'bug' was identifed..
and later after a discussion here when ppl claimed it wasnt so i 1.5, 1.6

what if you have a class with 2 overloaded methods…

what about it?

you have a client of that class that calls one of the methods at runtime
mutableString.remove( args[0].charAt(0) );
mutableString has 2 remove methods

then it calls whichever one matches the args you pass in

however while debugging… NetBeans is dropping me into the wrong ont

then look at the argument you're giving..

this is pretty standard stuff. are you SURE it is? perhaps you're assuming you're doing the wrong thing

public Character remove( int index )
public int remove( Character ch )
args[0].charAt(0) returns a character

oooh, fun. i bet passing in a char bumps you into the Character method due to autoboxing

however like I said NetBeans drops me into the first remove method.

and you're passing in…what/

a char

the first method I pasted above is the call… args[] is a string array

ok, then it's upcasting to an int instead of autounboxing to a Character
pass the correct thing in

Fanook can you give some detail

you pass in a char and the method that takes in an int is being called?

yes

i guess it makes sense somehow.. int and char are sorta 'related'… but one would assume the boxing to Char would work………….. maaybe

ehhhhh

char is an unsigned integer type. the compiler evidently prefers upcasting instead of taking the method call hit, also, i DOUBT it really matters

i am skeptical

boxing is tried after all primitive conversions

ahhh

shouldnt he need to explicitly cast to (int) for that method to be called? i swear ive had to cast

so it's casing my char to an int and calling the method that takes an int?

try cast and see

a char is a short unsigned int

do all primitives inherit from Object?

a char can be trivially converted to int without loss of information, it is a safe cast so the compiler can apply it

christ, i wish i knew that when some douche complained when i said that char and int are roughly the same thing

primitives are not objects

he started ranting on how they arent isomorphic types or something
lol

~tell whats_in_a_name about primitives

whats_in_a_name, Primitives are the 8 non-Object types in Java: byte, short, int, long, float, double, boolean, and char. See http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html for more
information.

he whopped out type theory on my ass

thanks

where does it say on there that char is an unsigned short?
look here..
The integral types (byte, short, int, and long) can be expressed using decimal, octal, or hexadecimal number systems
doesent say char is an integral type
(that was a quote from that page btw)

read that page, see the char entry

The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

yes, that is what you get if you have 16 bits to play with and do it unsigned

regardless, it's an int type. unsigned, 2 bytes

hi

much like wchar in c (i think that's unsigned(

well sure, but it doesent explicitly say its an unsigned int

is there a method somewhere the is a cube root and not only square root

wchar is not a standard C type

yes. .pow
*shrug*
it would be if c didn't assume ascii

hey, I care, I write C code that can compile on a lot of systems…

Fanook, thats for squaring isnot it?
and cubing and so on…

AHA!
i knew it!!

you can write roots as powers

hm okay

"the method foo(char) is not applicable for the argument type 'int'"

how would that work exactly?

square root is x ^ (-1/2)

ah oaky
so basicly x^(-1/3) is the cube root?
makes sense…

~tias

Try it and see. You learn much more by experimentation than by asking without having even tried.

how does that apply to me?

http://rafb.net/p/bimrVk17.html
I'm not totally clear on this?

erm isn't that 1/square root? square root is just x ^ (1/2)

ops, yes…

i would certainly expect it to either require you to explicitly cast to int, or use the second definition

damn, I need to sleep…

im seeing that behavior here…
maybe its my IDE (Eclipse)?

boxing is tried after _safe_ casts

not sure

you can't safely cast from int to char implicitly

you can do a safe cast from char to int

oh there we go..
:/

not sure how boxing is involved here… int and char are both primitives right?

Character isnt

yes, but Character is not

boxing isnt probably in action here, at least since casting would be tried first, at least according to whats being said

umm… wait a sec. Are char and Character different?

yes

very

quite

ahh… ok
I missed that

and now we see the problem

haha

yes… thanks for the help

so i assume you changed Character to be just char?

no, he HAD char, he needed to get the Character

(Character)args[0].charAt(0)

hi, ive installed java & nautilus crashes.. Why?
/build/buildd/libcairo-1.4.2/src/cairo-surface.c:1076: _cairo_surface_composite: Assertion `! dst-is_snapshot' failed. it says..

ick, that doesn't look safe, IvoryZion

you're right… this code is somewhat ugly
however my primary interest is getting this done fast…
I wouldn't release this code

~tell IvoryZion about javadoc Character.valueof(char)

IvoryZion, please see java.lang.Character.valueOf(char): http://java.sun.com/javase/6/docs/api/java/lang/Character.html#valueOf(char)

nice…
your full of helpful advice

ask in your linux distrubtions channel

thanks.. nobody says nothing nowhere.. good nights..

wait come back!
i was starting to really like him

no i mean, did you change your metho to take in a char?
instead of a character

*ahem* Characther

lmao

erh
Character

you fail kemik

:X

lets not rush to conclusions …

yeah, he doesn't need any help to do that

lol
i knew you or he would say that
assholes.

*grin*

no, i really thought we should make the distinction clear to him..
i mean, he's from the C# world with their weird naming conventions ;D

oh come now, its been some time since i used java for anything non trivial, but i used it for 2.5 years…
i meant to type Character
finger slipped or something

can happen to anyone O_o

well kemik thats how you came into this world…

tssk

mmm…
dead in here..

idd

no r0bby, no krust, no predator, no cheeser

Comments

Preferred method when it comes to storing data in database

When it comes to storing data, what is the preferred method?

XML, JDBC (with or without ODBC) and an external SQL database, or one of these "in-the-application" databases (the ones I've seen are SQL)?
what kind of data? for a simple application you can use hsql or xml Any kind of data, I guess….I'm not thinking specifics here. Just in generalities.
ThomasO: flat files are still bomb Flat files…refresh my memory…files that contain text?

Not necessarily text, no Ah, ok. A quick wikipedia search turned up all the answers about them.
Rather primitive things, but effective for some information.
< \n> how do i clear a char[] array?

\n: you either iterate over it.. or scrap it and create a new one for (int i = 0; i < char.length; i ++) { char[i] = null; }
not really, no
Why wouldn't that work?
a char is not a reference
so that wouldn't compile
and it would be slow

< \n> i cant just say mychararray = null; ?
\n: that would not clear it as such.. just lose it :)
< \n> i want to reuse it for a loop
< \n> just a temp var Err, not char. But char would be the name of your array. Then it might work.
well a char[] array implies it's a char[] :) MXV: Wouldn't that work?

If, in my code, you replaced char[] with name[] where name was the name of the array in question?
Thomas0: null is not a valid value for a char
for(int i = 0, j = c.length; i < j; i++) c[i] = 0; would be the correct way to iterate over and empty a char[] array
….ok…explain the j thing… That seems like a waste of code.

it just avoids fetching c.length for each iteration
(which is not optimized away by the compiler and thus slow)
c = new char[c.length]; has the same result with gc overhead.. faster if the array is large and you do that fairly infrequently Doesn't the HotSpot compiler optimize it?

I was under the impression that HotSpot optimizes any frequently used code.
null rather than 0 and a variable named char were the only things preventing your code from compiling The char variable was just stupidity. And char is something I use infrequently.
So the first thing that came to mind was null, but if I got an error in a compiler, I would have changed that to 0 first thing.

Anyway…has anyone here used SmallSQL?
anyway, that can't be optimized away by hotspot.. as c might change to something else while the loop is running I never thought of that, but it makes sense.
hotspot optimization is rather sloppy.. so it won't bother to check the scope and resolve stuff too deep.

The first time I ran hotspot, I was like "hopy crap" after it turned a certain procedure into taking 5 minutes for large files to <2 minutes.
(and by large files, I mean reading in and analyzing multiple files in the GB ranges)
it inlines stuff and does some local copying, but nothing too fancy.

I've never bothered to analyze how it worked…it's not open source, is it?
just swapping out the interpreter for native code gives quite a boost in itself
the source is available with the scsl license Never messed with native code…you do mean JNI, right?
no.. hotspot generates native opcodes that execute directly on the cpu

Like good old jit As opposed to bytecode?
right If it's so much faster, why doesn't Java use it anymore?
methods are executed as interpreted bytecode until they get hotspotted
hotspot is quite like jit for frequently used methods

So java essentially does use it Wouldn't it be faster if all of the bytecode was transformed to native code prior to running? And then the native "executable" file would only function on one machine.
no But then you could take your source code and compile it or put your byte code on any machine.
then you would lose the dynamic optimization that hotspot does in addition to the compilation

Hotspot can optimize things a static compiler/optimizer can't do I was thinking like HotSpot but for the entire program…optimizing everything from the bytecode for a particular machine to make a unique executable.
which is why hotspotted java is faster than statically compiled C/C++.. or jitted java
unique executable is no good as it can execute in a number of different ways.. which calls for differnet things to be optimized

You would be inlining things that may never be never used I see…although this has been interesting, it's 100F+ here and a little too hot to be running my PC for long periods of time (stupid broken AC). So I'm off for a while.

Thanks MVC for a nice little convo to get me thinking about things.
as for storing data.. don't underestimate data records in a flat file with a separate index :) Err…MXV.
Yeah, that is helpful…
Thanks again.

Comments

Problem with Axis using Java web hosting service

i have a java webservice running, i am trying to send a customer object from a client to the webservice, but when the webservice receives the Customer object, all the data within the object (name, surname, address etc.) is null

Also i have tried debugging it to see if the Customer object is really filled from the client side, and it is the weird thing is, when receiving Customer array filled with Customer objects from the web service, it goes without any problem
what might be the problem when sending a Customer object to the webservice, that the webservice only receives null values ?

You are doing something wrong and/or the webservice/rpc implementation is broken
how can it be broken, could you please explain ?
consider swapping axis for xfire.. it's easier to manage when you got little or no clues what you are doing
i am using axis

axis is very broken on many accounts
xfire is less broken and easier to use
so you mean, this might be an issue with axis

isn't it weird than that i am able to receive an array of objects but not able to send just 1 object, or are these two things totally different from one another ?

More of an issue with you using axis.. it's non-tribial to set up and debug
i c
trivial, even
just saying xfire is easier to get going
thanks for the info

Comments

Java file how to convert & compile it into a class file

hi, can i ask a question, i have a *.java file im working on, and i need to convert/compile it into a *.class file

ive done it before, with javac source endfile
but i've forgotten how
i know its a oneliner simple command, anyone knows?
build it?

yes
even, even
ive forgotten the exact command parameters
and im getting a lang/thread error message
but my JRE SDK (1.5) doesnt have a subdir called lang/thread, maybe i need to install the 1.1.2 JRE ?

or 1.1.8 ?
javac ?
that's it?
to build it yes

if you have a library proble, then i dont have much for you
Unable to initialize threads: cannot find class java/lang/Thread
sounds like im missing the complete JRE installation then?
hmm

i dont know how you would be missing that part
but it would be part of 1.5
I did a full install of 1.5
hmmmmm

let me check hold on
jre-1_5_0_07-windows-i586-p.exe
18mb's
not sure why its not there.. according to sun, its been there since jdk 1.0
doing a reinstall brb 30 sec
1.5 is J2SE, does that matter?

J2SE should include the full JRE as part of J2SE
ill be honest,i havent done threads in java :-P
are you doing import java.lang.thread or implements thread?
or you could just try java.lang.*

yes, it imports 4 components
5
import java.awt.event.*; import java.util.*; etc etc
but the libs are there as JAR files
so it should be ok

did a full new install , and javac.exe doesnt come with it
thanks for the help though

Comments

Way to link java class file to a running java program

is there a way to "link" a class file to a running java program so it can start using it?

<_tn> http://java.sun.com/docs/books/tutorial/reflect/index.html

thanks a lot!
You need to write a full OSGI implementation or people will laugh at you. Or maybe they will anyway.
i dont quite know what you mean

What you describe is a plugin system. Lots of people have come up with plugin systems and most of them suck.
OSGI is a specification for a plugin system.

Only Eclipse implements it, to my knowledge, and apparently, it doesn't suck (that doesn't stop Eclipse from sucking in general though).

Comments

Use javax.naming in order to authenticate users to MS Active Directory

I'm developping a small scale application in which i use javax.naming in order to authenticate users to MS Active Directory, currently -after authentication.

I'm adding the username to the session variable and using it as a means to check whether the session is still alive in every page, if it doesnt exist i'm forwarding the unlogged user to the login page. Would this be a proper way of doing it?

xterm: that's an acceptable way.. container security unfortunately never quite made it
MXV: Would you mind elaborating on that? What do you mean by Container securit never quite made it.
Would anyone happen to know of a well designed Recordset api in which i can incorporate in my solution?

My current backend is MySQL, i'm using MySQL implemented JDBC driver in order to connect to the database.
xterm: hm? container security (google for jaas and j_security_check) is ickypoo
MXV: Thank you sir. I believe i understand what you meant.

Comments

Encrypt data sent via post from my php script

I would like to encrypt for data to send via post to my php script.

Is javascript the way to go here?

Can I encrypt via javascript and send via POST all by hitting the "send" button?

Read the rest of this entry »

Comments

« Previous entries ·