so ant geeks i want to have something in my code that says Build # xxyy that matches the SVN repo number as well
a full int follows…
Yeah, but I bet it’s never going to happen in Java.
when you refactor you will not get any compile time erorrors and the user still has to check that the default values are what he wants…
it should!
8^)=
Sure.
But it won’t.
What is www.netbeans.org? Is that an official Sun site?
yes
thanks
#netbeans
it’s the OSS comunity site
There are cool toys there.
it’s actually a porn site
there are indeed
i usually make an init function and then have all the constructors effectively interface it… with “default” values usually being null
Yes, that does qualify as codemonkey pr0n
view source on the pages and you will find the hidden links to some really strange austrlian porn
is there any good reading on how best to do those types of things in java… it was quite unweildy when I was just testing out each of the operators
if you have something like: foo(int i) { foo (i, 2); } foo (int i, int j) {…}; and you then realize that you do not want _i_ anymore, how do you remove it?
what?
I think meeper has finally gone off the deep end…
g[r]eek: what?
The new Razor2 phone will have a third party dev stack that will support JaveME. Finally a phone I can write my own toys for.
agreed.. but i look at the other versions of foo as the interface to the one and only foo function.. so if the method contract changes, it makes sense that all the itnerface chance, right?
If i create a GUI programme on windows, will it work on linux/mac?
Usually.
s/chance/change
if you write it in java, sure
if you dont use OS dependent stuff.
Stay away from AWT, and make sure you use “File.seperator()”.
like System.getRuntime.exec(…)
hm? awt is not problem wrt to OS
in that case you will always get in trouble. If your code size is small you can handle it, if your code size is medium/large you will miss a few cases and then you can only hope that you _really_ have 100% code coverage for your tests and that you do not pass too easy values…
No, but it is good advice anyways
(I have seen such bugs that were a few years old)…
ernimril, ok i got it
I see. Now i real newbie to java and wanted to know when i open http://java.sun.com/docs/books/tutorial/uiswing/components/passwordfield.html and press launch i get Java starting and the program runs,
just like that, is that java web start? It’s pretty cool.
hehe, true, mostly
i real/i’m a real
hmm, fair enough. But yet again, I usually do that when the extra parameters either define some rarely used options and/or they’re _really_ default… so it’s foo(Integer i) { foo(i, null);}
ernimril, http://rafb.net/p/1THKl378.html this solution works now
yes, that’s webstart. mind that the user has to click through a couple of warnings if the app is not sugned by a trusted party.
but thanks for the point
But it seems really neat.
So is there a good Java CMS that is FOSS?
also note my other point, the one who uses the default version actually have to read up and understand what the default values are…
I’m looking for a CMS to contribute to.
use a StringBuilder instead of concating to a String inside a loop
google…
yeah damn StringBuilder is quick
g[r]eek: Google isn’t so great at making value judgements.
g[r]eek: Yes, there are like 100. I’m asking here to narrow it down, since to judge a CMS, you need to install and use.
But I bet none of them use JSF.
DRMacIver / perlmonkey2: sure, but the most popular are generally of an above average value
hopefully
not necessarily true for the codebase
i recall wikipedia having a good list of java based cms’s
g[r]eek: I don’t believe this bizarre assertion people make about popular things being good.
Bah, I think that’s bad advice. Look at all the people who used StringBuffer instead of concatenation
true… But in the case when the fuller method just adds some parameters, the full version is usually private. Besides, I generally assume that the most widely used method is without any additional parameters.
Eh?
yeah it’s relative
so forgoing on params is expected behavior so the user doesn’t necessary need to look them up.
ernimril, i have replaced it. thx
are constructors always synchronized?
Zaph0d^: No.
I just think using StringBuilder for efficiency is misguided
premature optimization
That seems like a bit of a perverse solution. I’m not sure if I wanna go there, yet.
bThat seems like a bit of a perverse solution. I’m not sure if I wanna go there, yet./b
Hm?
ThreadGroupLocal
Zaph0d^, DRMacIver: err, no one can have a reference to the object before the constructor has finished, right? so it doesn’t have to be synchrnoized?…
Oh, right.
why do you say StringBuilder isn’t efficient?
Yes, I wasn’t suggesting it too seriously.
I used to like default parameters… Then I understood how much trouble they cause for non-first-class coders…
well, unless maybe you start a thread in the constructor.
Unfortunately you can.
Just saying that once upon a time the advice was ‘use StringBuffer to avoid extra allocations’. Now all those people have crappy code
how?
still, if you use them wisely they can be ok… but I usually stay away from them nowdays…
g[r]eek: sourceforge (after a brain flash) would be the place to look.
‘this’ is available inside the constructor, so you can pass it to other methods before the constructor has completed.
of course
Most of the stuff can be done ThreadLocal
Eh. No they don’t. They have code which is very slightly suboptimal which can be trivially fixed.
alrighty, I’ll keep that in mind, thanks :d
That’s what’s so fucking frustrating!
true. and those *could* pass it to anotehr thread to touch. this seems a bit unlikely, though
adempiere seems like a cool program to get involved in
Dunno quite how StringBuilder will be improved on, but may as well just write for correctness (concatenation using + ) and let the jvm figure it out
uDunno quite how StringBuilder will be improved on, but may as well just write for correctness (concatenation using + ) and let the JVM hosting figure it out/u
not a cms, but yeah
well, when sun fixes hotspot to do escape analasys correctly then StringBuilder and StringBuffer will be the same again…
Yeah, it’s not something that has ever given me pause for concern. I tend to consider passing ‘this’ around from within a constructor a bad idea anyway.
g[r]eek: business solution? interesting.
usually, yes.
Except the JVM in no way, shape or form ‘figures it out’.
My point, though, is that the savings is miniscule, no point in doing it at all unless you are in a bottleneck situation
bMy point, though, is that the savings is miniscule, no point in doing it at all unless you are in a bottleneck situation/b
“The save is miniscule”? The fuck are you smoking?
saving
concatenation vs. stringbuffer/builder?
if that code runs once a minute, it doesn’t matter. if it just *might* be called a lot, it does matter
bif that code runs once a minute, it doesn’t matter. if it just *might* be called a lot, it does matter/b
There are cases where the saving is miniscule. In such cases it’s occasionally more convenient to use concatentation, and I do.
alright, premature optimizers. Enjoy your verbosity
javabot write dumb code
http://java.sun.com/developer/technicalArticles/Interviews/goetz_qa.html
Just junk up the heap with a billion garbage strings.
There’s a difference between dumb code and stupid code.
you could avoid verbosity by wrapping the concatenation inside concatenate(String…)
pfft
concatenation has known performance issues, staying away from it is hardly “premature optimization”
I definitely agree with him
that’s like saying avoiding nested loops is “premature optimization”
the performance issues are only relevant in some cases
the verbosity in this case is about the same as the current code…
in a situation where you can use that, you can just as well use +
I see your points
indeed
what’s the new alternative to StringTokenizer?
split
it depends on what you want…
yeah, I’m not exactly sure what I want
there is nothing wrong with StirngTokenizer, String.split may be easier in some cases, but has problems in others. Creating a Scanner may also be a way…
Swing is the only way to create GUI programs in java, right?
I think you exagerrate the “performance issues” of the string concatenation operator. “developers generally have horrible intuition about where the performance problems in an application will actually be.”
no, but it’s the preferred way
String.split uses regexps so something like “while((line=br.readLine()) != null) { String[] vals = line.split(” “); …} can be really costly…
awt is another (old), swt yet anouther (3rd party)
I see.
there are bindings for other graphics toolkits too, i’m sure
generally speaking, always go for swing
swing is normally the recomended way for gui apps…
~tell font about swt
font, swt is the Standard Widget Toolkit – see http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/main.html
gnome has lots of bindings, I think qt has as well…
hmm where’s that “azerues is the other swt app” reply
~azureus
DRMacIver, azureus is the other SWT app.
azureus is a bloated piece of shit
ernimril, azureus is the other SWT app.
ah
Arg, none of these CMS’s even come close to Perl’s WebGUI. Features features features.
why do swirly eclipse tabs come to mind
hmmmm, I have my javabot command before yours, but javabot told you first… guess you have your javabot command first…
yeah DRMacIver is first on my screen too
IRC lag. Yours was after DR’s in my window
i think that irc doesnt syncheronize stuff
Looks like mine came first over here. IRC isn’t great about orderings.
pwned!
I know…
i see DRMacIver also first
(and then bush became president)
hi all – anyone used jbpm?
han shot first
~tell dingo001w about anyone
dingo001w, Instead of asking whether anyone works with something you need help with, please save time by asking your actual question. If someone knows and wants/has time to help, perhaps he/she will.
i need to figure out how my architecture looks like if i embed jbpm on my application in tomcat
i dont know how to start that server that jbpm depends on, do i need a separate jbpm webapp running on the app server?
try #jboss
g[r]eek: tried that – no one there
I take it you have not had the time to implement my feature request for javabot yet? I did try to build javabot, but maven started pulling an awful lot of jars and some sites were very slow, never bothered to wait, how many jars does javabot depend upon?
wait for a response
well, there’s wicket/hibernate/spring so quite a few.
8^)=
but no, i haven’t implemented the throttling yet.
maven is the work of the devil
i’m finishing up the new javadoc stuff
in this case, it’s ant using the Maven deps tasks
which is fantastic.
bbl
i use that combo too. rocks.
javabot is the shit.
Invalid factoid name
bite me javabot.
\/win 39
Here they show how to model buttons and stuff on NetBeans http://java.sun.com/docs/books/tutorial/uiswing/learn/creatinggui.html can i do the same on eclipse?
not out of the box
there are rad plugins for eclipse. never tried them
you do not want to have a gui builder
I see.
learn to do it by hand.
Swing has a _GREAT_ tutorial.
gui builders tend to be good only for very simple/static interfaces. guis designed that way tend to be extremely clunky when they become complex.
also not sure how well the tools handle stuff like passing controll between worker and dispatch thread, etc
Roger.
it is great for doing something fast, though (those gui designers)
it’s actually really simple to create a GUI in swing; learn the layout managers
and the generated code is usually very ugly and usually has stuff like “// do not dare touch this code, it is auto generated by foo-builder…. “
where it didn’t actually generate java code
javabot tell font about layout managers
font, layout managers is http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html If the layout managers that come with the jdk dont satisfy you, have a look at FormLayout, TableLayout, PercentLayout or
HTMLLayout (ask me about each of those to learn more). Book chapter at http://javafaq.mine.nu/lookup?290
but just provide a bean where you can interact with the UI code
bbut just provide a bean where you can interact with the UI code/b
and XUL is really nice…
You are just jealous that it looks better than your own
minus the fact that it’s completely document oriented
have you looked at JavaFX? It sounds nice…
javafx doesn’t really solve the problem
ah, yes, that could be it….!
hehe
from what I’ve read of javafx, it does nothing to really separate design from logic
i’m not sure that was it’s goal really
er, its
cheeser and yeah, I’m pretty sure that isn’t its goal
damn illiterates
it doesn’t enforce that, but it makes it easier to web design a gui in a declarative way, right?
dumb down java to a point where non-java-literates can code it
bah, i should probably just go and play with it
i don’t think that was it either.
it would seem to me you don’t know much about it.
8^)=
Duesentrieb, it sure doesn’t feel like that’s how it works, at least from the demos I’ve read
ok then. hm, too bad.
but yeah, lately, I’m quite enamored with XUL
hm, with java6 containing a js engine, couldn’t XUL be bound to swing?
well, you need more than a JS engine to implement XUL
hm… how about this? http://xul.sourceforge.net/swixml.html
java via liveconnect or whatever
http://swixng.sourceforge.net/
sounds interesting
i wonder if it’s fexible enough for my needs…
it’d be nice if there were a quick page on “why swixng”
swing actions, custom components, worker threads, custom models, …
it also doesn’t seem quite as simple as mozilla’s XUL
mozilla has the right idea using a box-oriented layout with css modifiers
netbeans matisse rocks
it looks nice, but doesn’t produce gui code that I want to work with
and that’s its biggest problem
the gui code matisse produces made me want to run for the fucking hills.
well that’s why you don’t touch the gui code
maybe he doesn’t want *ANYBODY* to have to touch it.
you’re an idiot, shut up
~meeper–
meeper has a karma level of -18, whaley
I’m not touching that with a 10 foot pole.
and countint
*counting
meeper I find I always have to interact with the generated gui code, regardless of “that’s why you don’t touch the gui code”
i checked with my 8 year old neice, the correct response is “no u r”
I don’t feel like being trolled, the way to deal with him is to just nod and smile.
well, you’re arguing from ignorance so there’s nothing to convince you, but suffice to say with a little brain smart and the occasional subclassing you can build complex apps very quickly with matisse without ever touching gui code
meeper sure, go ahead and use matisse then
OHHH! but wait meeper, you argued the other day inheritance was bad.
in fact if you follow the general rule of putting as little as code as possible in the Form classes you naturally end up with a very stable MVC design
so i have this friend that was hired by a bank to do a html email page to be, as he was told, mass emailed
you’re an idiot, shut up
coughhypocritecough
*popcorn*
so he delivers, and then they tell him that it’s screwed up cuz when they forward it it doesnt look right
characters, so of course that will screw up the html
and they’re like no forwarding was a requirement how couyld you screw this up omg
anyway a day worth of emails go by
and a conference call is arranged
apparently the project manager at the bank thought that “email forwarding” was a synonym for “mass email”
and so gave them the wrong requirements
big companies rule
gotta love webpage timeouts when you hit the submit button on an order
location – the class whose resource directory contain the file
huh? “email forwarding” is a synonym for “mass email” ? say what?
what directory is a class’s resource directory
the directory where the class file is, i suppose
packaging everything up in a jar file confuses it though
man, that sucks
confuses it how?
you get them the same either way.
well, in the jar, there is Main.class and under that icons/folder.gif
that dailywtf article has to be fake
outside a jar it works fine, in the jar java hosting it doesn’t
~doesn’t work
cheeser, doesn’t work is useless. Tell us what it is, what you want it to do, and what it is doing. Consider putting some code and any errors on a pastebin. (use ~pastebin for suggestions)
FileImageDescriptor(location=class uploader.Main, name=icons/folder.gif)”
so, normally main.class is in .
and there is ./icons/folder.gif
hrm. still no code.
i want to unit test some java code that sends an email. Is there like a /dev/null you can send emails to or something?
rude
~tell saksoz about ClassLoader.getResource(*)
saksoz, I have no idea what ClassLoader.getResource(*) is.
~tell saksoz about ClassLoader.getResourceAsStream(*)
saksoz, I have no idea what ClassLoader.getResourceAsStream(*) is.
erm
how many times a day do i do that
i’ll google it
maybe i’ll send all my test emails to MS support
~tell saksoz about javadoc ClassLoader.getResourceAsStream(*)
saksoz, please see java.lang.ClassLoader.getResourceAsStream(java.lang.String): http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream(java.lang.String)
~tell saksoz about javadoc ClassLoader.getResource(*)
saksoz, please see java.lang.ClassLoader.getResource(java.lang.String): http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)
rude? i asked for code to help diagnose *your* problem. if you don’t want to provide that fine. i’m not going to play guessing games with you.
i’m using ImageDescriptor.createFromFile
google should have been your second option, your first being sun’s java host documentation
i just pasted the error, described the problem and was about to paste the code
i looked at the documentation for that method, http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/resource/ImageDescriptor.html
tell saksoz abut showus
*duh
~tell saksoz about show us
saksoz, Paste the code (and any errors) in the pastebin where we can see it. See ~pastebin for options.
usaksoz, Paste the code (and any errors) in the pastebin where we can see it. See ~pastebin for options./u
hurrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry
hold on…
the suspense is killing us…
http://forum.java.sun.com/thread.jspa?threadID=578242&messageID=2907591
that was the second hit on google for the query “java get image file in jar”
and answers your question
and I already pointed you to classloader api docs, if you need to refer to it at all
you should post his code for him
i have 11 minutes on my self-imposed lunch break, i may as well
http://paste.lisp.org/display/45854
it works fine in windows, by the way, does not work in mac
uit works fine in windows, by the way, does not work in mac/u
nice. a caches in Constants. consistency++
so this works in a jar on windows?
its fine to me
i believe so, let me double check
yes, in windows it works fine with the Main class and the images subdirectory both within the jar, does not work under the same conditions on mac os x
i’m reading whaley’s link now
is the image still on the file system?
i have a feeling your classpath includes the directories in the jar test under windows.
i’ll check that
nope, i removed it from everywhere except within the jar
still works fine
i can try whaley’s linked solution with createFromURL, though i still find it strange that it works on one OS and not in another
i blame gremlins
i still blame the environment. but, then, i’m a cynic
i told you cheeser, i made that file not exist anywhere but in the jar and it works
i know what you said. i’m holding to my convictions, though.
because i’m also an ass.
8^)=
thats all im trying to say
great, whaley’s solution doesnt work on either os
if i were you, i’d just leave and tell all your friends java sucks
~javadoc DateFormat
ojacobson, please see java.text.DateFormat: http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html
heh
right thanks for the suggestion
it’s probably what’ll happen anyway. P^)=
…
yeah
are you guys done
~smack tieTYT
and all this time i thought you had an alias setup for your smiley. that typo tells me otherwise
now we’re done.
ok, i’m gonna be stubborn
g[r]eek: 1. i *do* have an alias. 2. it’s not a typo.
why doesn’t using the classloader work
http://paste.lisp.org/display/45854
the image shows up as the default one, a red box in swt
he winking or what?
oh, shades.
what i have there is what you suggested, right?
relative vs. absolute path names…. give /icons/folder.gif a shot
okay
asuming icons is at the top level of your .jar
no, but neither is Main
g[r]eek: it’s a wink
let me try /(path to main)/icons/folder.gif
looks more like a black eye to me… =P
i’m assuming Main is a class…. it’s right where it should be, in its package directory
where in the .jar is your icons directory?
yes. relative to the jar java hosting root, the icons are in uploader/icons
when i pass “uploader/icons/folder.gif” it seems to work
seem to or does
does
i will try on mac now
cool
ok, I really need to get back to work
http://www.flickr.com/photos/10998060@N00/1040976473/
poor kid :
:/
.oO(hm, firefox gets really sluggish when you have about 600 tabs open. makes you wonder.)
excellent
ok, which of the 3 bears is using this port..
600 tabs? Bloody hell.
it works on both
you nerds may be obnoxious and combative, but at least you know your java
ReentrantReadWriteLock – if I have the read lock and then ask for the write lock in the same thread, would I be stuck or be upgraded to the write lock?
bReentrantReadWriteLock – if I have the read lock and then ask for the write lock in the same thread, would I be stuck or be upgraded to the write lock?/b
Upgraded I think.
What does the javadoc say?
don’t know. got lost in the middle
~be api barbie
Javadoc is *hard*!
I saw a downgrade example. didn’t see an upgrade examlpe
ah. nm. javadoc: // Must release read lock before acquiring write lock
See “Lock downgrading”
what are you doing with 600 tabs open? heh
In particular “#
In particular “However, upgrading from a read lock to the write lock is not possible.
oops
Ugh
Can it get a StackTrace and put it out to disk?
Is there a way just to geta stack trace?
Yes
anywhere in the code?
Yep
I can never remember what it is though. It’s probably in Runtime.
or System?
Thread
how the fuck does Exception do it?
oh
thanks.
Thread.getCurrentThread().getStackTrace()
doofus
sorre
oh
lol
alternatively, new Exception().getStackTrace()
Oh yes. Thread.
either works
Of all the places.
well, prior to java 5, it wasn’t there
in java 1.4, you could do new Exception().getStackTrace()
in java 1.3 you were SOL
getting that through Thread doesn’t really give you anything.
in java/1.3 you just wrote the exception to your own stream and parsed…
oh.
it basically does the new Exception() call
ernimril, pretty much, and I call that SOL
oh
I just wanna print out the stack to a file!
lol
because doing that is suckass
What is?
printing the stack to a file?
note that getting a stack trace can be a quite expensive operation…
svm_invictvs, then new Exception().printStackTrace(new PrintWriter(new OutputStreamWriter(new FileOutputStream(yourfile))))
Hm. So it does.
It’s just for debugging. I wanna see what thread is calling this function. There’s a thread being spawned I can’t acount for.
ick, file leak…
I’m getting two EDTs.
ernimril, of course, you shouldn’t do exactly just that
must close outputstream
if you open modal dialogs you will get more than one edt…
This is SWT
someday you’ll realize how foolish doubting me is. P^)=
ok…
what the hell is a ‘portal’?
restarting to fix a problem++
ever see Stargate? that was a portal.
8^)=
so this one time
a portal is a doorway
synonymous with “door”
well, there youg o
i actually /interviewed/ for a position maintaining a ‘portal’ software thingie
and at the end of the interview i asked the guy, “so uh, what exactly *is* a portal?”
he shrugged, said “i have no idea”
nice
he was the project manager
pffft. like they ever know anything.
I downloaded a program in a .jar file.. how do i run this program?
but within java, it looks like ‘portal’ is a very specific idea
carefully
I rarely doubt you over purely factual information. It’s your opinions I don’t trust.
java -jar blah.jar
touche!
8^)=
ok…
this.getClass().getGenericInterfaces returns a Type [] …. the Type has a string representation of “interface MyInterface”… whats the way to get just “MyInterface”
this.getClass().getGenericInterfaces returns a Type [] …. the Type has a string representation of “interface MyInterface”… whats the way to get just “MyInterface”
i had a really good project manager once
How did you cook it?
lol
nope.
rare
not that I recall at least.
get it???
http://movies.apple.com/movies/us/apple/getamac_ads2/touche_480×376.mov
Yes, but IRC is insufficiently expressive to convey the flat look of disdain I was giving you, so I didn’t bother to acknowledge.
http://www.jroller.com/objectpool/entry/first_post – please comment on the locking
http://video.google.com/videoplay?docid=2282754844569110939
http://it.slashdot.org/article.pl?sid=07/08/08/127227&from=rss
hehe
cheeser, thanks.. that ran the installer.. and I saw a file that looked like the script to start the program.. executed it and now i have a frozen spashscreen… well.. its progess..
cheeser, i see.. its missing required componants.. sax2 driver…
what’s a good way to pass ‘this’ to a method inside of an anonymous class?
OuterClass.this
Refer to it directly with MyClassname.this
thanks!
I dont’ have to synchronize access to a ThreadLocal, right?
forgot that it’s within defined state of upper class
uh…
that’s two dumb questions *today* about TL
8^)=
heh
Was about to say that
8^)=
svm_invictvs, and if you didn’t get it, the answer is NO
http://rafb.net/p/6vhYKe14.html
Grr…
WHy am I ending up with two instances in the same thread?
how do you figure
and the answer is simple
The debugger shows two distinct instances.
throw the stack trace up every time Foo() gets called
Thats’ what I’m doing, lol
and that explains why you have 2 instances in the same thread
and how do you figure it’s two distinct instances on the same thread?
why isn’t it possible that another thread created it?
because I print out the thread name before the stack trace.
so?
the stack trace is the evidence you want
Thread[main,5,main]…
SO it should only ever call the ctor once.
Thereby printing out one stacktrace, right?
pastebin the stacktraces
and what you’re using to print out the thread name
wait…
the stack traces are invariably different
Is the thread that’s running before void main() still the main thread?
huh?
maybe you can do ctrl-break to find out
http://rafb.net/p/rGI0Gr56.html
static void main
rather
svm_invictvs, print out and find out
and pastebin the stacktraces already!
if that is the class that starts your program, then yes it will be the same…
the stacktraces explain what the problem is
if your program’s entrypoint is not main, then who knows
whatever the caller’s ClassLoader runs on
if that is some random class then you can have one thread loading the class, but not creating instances of it, later on some thread may create instances and call methods
how would you create a file that is not readable?
it’s primarily for testing purposes
set permissions on it
well the File class does not have methods to set permissions
File System access sucks bad in java. There’s a proposal for a new interface to taht stuff.
afaik, you can’t set file permissions in java, period.
runtime.exec(chmod)
JNI
etc.
*in* java
yes, that’s the class that starts the program
svm_invictvs, pastebin stacktrace!!!
lol pfn
hmm.. yeah I was hoping for it to be cross-platform. Using chmod would not make it compatible on all machines
let me make the testcase, keep your pants on.
file permissions are not qavailable on all file systems
sleepster, duh, permissions are not cross-platform
you’d have to be able to live without them
well not the permissions.. I mean the command
well, how do you set a file to be non readable on windows 95/98….
(maybe not relevant today, but sure was when sun made java)
attr -w file.txt ?
well, how should the interface deal with ACL vs. POSIX permissions?
or something like that?
i sure would like a way to do this, but i can’t imagine how it should work, really
hmm.. well I was hoping to use some class to do that.. and then how its implemented is not my problem
did that really work?
svm_invictvs, wrong
ernimril, no, it doesn’t work
so I want to avoid stuff like.. shellExecute(“chmod 755 myfile”);
file attributes are a/r/s/h
sure. but what would you tell the class? “not readable” for who?
Duesentrieb yeah .. good point
i guess that’s the main reason it doesn’t exist
anyway, exec(“chmod”) is pretty nice and cross platform for all unix
and includes osx nowadays, too, I think
really?
It’s been forever
I thought you could mark a file read only in win98
and osx leopard is even “certified” unix
Certified by whome?
*whom
by x/open, who else can certify something as unix
Hello all…I’m working on my first JSF project after coming from the MVC and struts world…I’m all alone here so I’m trying to protect myself from dangerous assumptions…It seems like every example I’ve read combines the controller logic with the bean itself…Is there not a way to cleanly
separate them?
joedj, would you mind telling me again something that i lost the syntax for? I asked earlier
joedj, it was how to cast that array after one built it peicemeal
joedj, as Object[] outer = new Object[2]; outer[0] = new Object[]{something}
and then to cast it in such a way that someone could do the familiar (Object[][]) or more dimensions as normal… you had it written down but i lost it sorry
*sigh*
um, just like you’d cast any other 2-D array?
found it.
what?
I wasn’t setting the instance.
Fanook, doesn’t work
there you go
Fanook, just doint (Object[][]) won’t do it for some reason
Fanook, Object[] inner = new Object[]{7}; Object[] outer = new Object[]{inner}; Object[][] casted = (Object[][]) outer; does not work
Fanook, joedj had a way but i lost how he did it
He casted multiple times.. Something like ((Object[])outer[0])[0] or something
But – please. _Any_ use for that that I can imagine is just ugly and evil
you can, but you have to cast it like ((Object[])((Object[])a[0])[0])[0] for a 3-dim array =P
NOw, I’m getting invalid thread access, ‘doh.
ok thanks for helping me find that
blafasel, well arrays are much faster than list and if your doing something N dimensional wouldn’t you want them?
if you want to return a “multidimensional” array, you’d be better off just reconstructing it after you’ve built it piecemeal. you’re only throwing away NxM references
how are arrays much faster than lists?
if you don’t even know arrays
how could you assume that arrays are much faster than lists?
that depends on what you’re doing with them and which list implementation you’re using, really
and if you wanted do something multimensional, I wouldn’t use array of arrays
using arraylist impl and doing whatever?
pfn what would you use?
Faster in what way?
a 1 dimensional array and some simple math
e.g. array[x * y]
most of the overhead comes in resizing the list…you can always give it a predefined size which of course can and will expand if need be but think of it as a guideline…List myList = new ArrayList(5);
someArray[1] and someArrayList.elementAt(1); are both constant time
svm_invictvs, so just the same as an array then right?
pfn, and how would that work?
but that’s not a bonus of arrays vs. lists
gaillard_, you figure out the math
hello all
if you can account for the size of the array..
i am trying to start funambol and it keeps asking me to set JAVA_HOME to a valid jre path
pfn, tables and multidimensional things are always built with something of something
svm_invictvs, i can
svm_invictvs, just not the dimension
gaillard that’s not true
pfn, example?
gaillard_, 3d graphics, bitmaps, etc.
can anyone help to set JAVA_HOME pls
you can make a multidimensional arrays out of jsut a plain old array if you want the sizes to be the same.
i am using ubuntu
Pretor1ab, google
goolge!!!!!
what is google ?
~tell Pretor1ab about google
Pretor1ab, http://www.googleityoumoron.com/?go=google
pfn what is google ??
ill be back soon
you don’t know google, but you can manage to stumble into irc?
never heard if it !
in that case, never heard of java
it’s a simple environment variable setting. try ##ubuntu for system help.
no help for you
~next
Another satisfied customer. Next!
msn search is soo much superior!
add JAVA_HOME to your environmenent variables (use google here depending on your OS) and then set the value to your java web host jre home
thanks for your help pfn , remind me to come back here next time i need some help
ok thanks anyway
i pointed you to the appropriate forum.
*sigh* i was bored… http://eugeneciurana.com/pastebin/pastebin.php?show=3540
if you just want to whine about whine somewhere else.
hm
try to look it up yourself first next time, it gets annoying when people come here for things that are easily looked up, most of us are here because we’re intereseted in difficult problems, we dont want to do your tech support
if its so easy why not just tell me ?
if you have a problem with that, dont use irc
has anyone used FilePermission? I am trying to use this to set my file to read only
especially when that support is only marginally java related.
BYE!
don’t you just have to create a permissions.properties file and put it in your classpath?
sleepster, uh, FilePermission isn’t what you think it is
~javadoc FilePermission
cheeser, please see java.io.FilePermission: http://java.sun.com/javase/6/docs/api/java/io/FilePermission.html
sleepster, second–once again, java does not support file permissions, stop wasting our time
not at all?
We like to discuss the language itself, not compotent use of the JVM software :-p
I was reading that it supports it.. but only for the duration of your applicatio
it’s OS dependent.
not to offend you, but it seems like all you do all day is chat in irc, it makes me wonder how exactly you can tell when some one is wasting your time
sleepster, no, you have it wrong
sleepster, FilePermission is part of the SecurityManager ACLs
it has nothing to do with filesystem permissions
okie
the FilePermission class cheeser linked has nothing to do with File-s?
no it has nothing to do with unix file permissions
it has nothing to do with files
how come they call it File
then what files/directories do they mean?
in the javadoc?
in java6, the File class has setReadable, setWritable, etc
~securitymanager
pfn, I have no idea what securitymanager is.
~tell sleepster about javadoc securitymanager
sleepster, please see java.lang.SecurityManager: http://java.sun.com/javase/6/docs/api/java/lang/SecurityManager.html
~tell sleepster about javadoc permission
sleepster, please see java.security.Permission: http://java.sun.com/javase/6/docs/api/java/security/Permission.html
only with very minimalistic options, but it should do ok…
sleepster, please see java.security.acl.Permission: http://java.sun.com/javase/6/docs/api/java/security/acl/Permission.html
read, come back edified
never mind the SecurityManager stuff, it’s not what you want.
yes, stop wasting pfn’s obviously valuable time!
it’s called FilePermission because it pertains to permissions within the context of the java2 security api
^ right
This class represents access to a file or directory
that seems to suggest it has *something* to do with files
i’m confused about the distinction you’re making
vinse, it has nothing to do with concrete file permissions on the filesystem, happy? :p
java has its own security settings which are independent of the file system…think of it as a sandbox (java security manager) within a larger playground (file system)
so it’s permissions imposes by jvm or whatever, but not the os?
dfr more or less, yes
^ yes
okay, makes sense then!
but this only applies to code running within the JVM, nothing else
why do you want this? simple, so that when you download applets, they can’t rm -rf /
does that also imply that a file can have a jvm write permission but still cant write due to lack of OS w permission?
dfr yes
okay, i think i fully got it now
yeah and java cant override that
from my work computer, i cannot ping google/yahoo/etc. Is that a normal precaution?
cause i find it pretty annoying
you should be able to ping out just not receive the incoming response from ICMP so yea
don’t you mean, “so no”
” Is that a normal precaution?”
oh you mean the reply should be blocked
who knows, varies upon firewall, corporate policy, etc
lots of companies just turn off anything you dont absolutely need as a default
No, that is (imho) a completely arbitrary decision and very dumb. Kill your admin.
“normal precaution” yes. “makes sense” no.
yeah, i’ve got this mystery box I put a proxy server on and I can’t seem to use it for that purpose. I have no idea about its network situation but it’s different from this computer
hell, my company even gets alerted when you plugin anything into the usb port sitting in front of the computer
That makes sense
that’s the job of a network engineer to explain those details to me instead of the java programmer figuring out what’s going on himself, right?
no
Banning icmp not. Especially since most admins don’t only drop icmp echo/echo reply but everything. Which is crazy.
depends…they are trying to prevent people from taking code from the high networth drive home but what do people do to get around it? Print out pages and pages of code when they need to work on something at home
If you aren’t allowed to use basic network tools and there are people in charge for the network setup: Delegation is nice.
one of the first things i learned when i got out of school, most IT gues do not want to deal with all the persnickety requests that programmers make and expect you to do it yourself
well i don’t have the poewr to do that. I MAY have the power to diagnose the problem though
Urgs. Okay, but that’s far less critical. Unless you print new code out at home, type it back and printed the trojans that you got from all the pr0n sites in source as well.
yeah then you tell them what they need to do for you, dont bother asking them to help you with it … they’re there for the people who dont know how to use computers
If they are acting like idiots, let them do the work.
i’ve heard some companies arent liek that, but i’ve never worked at one of them
I wouldn’t waste time on fixing things if I’m obviously not invited to work with the stuff..
And breaking icmp _is_ completely brainless
well I either need port 1088 opened up (something that they have to do for me) or I need to be able to connect to this mystery box on port x-y (something they may have no knowledge/responsibility about). I guess I’ll try the first option first
i think when i’m at work tomorrow I’ll call and see if they can open a firewall port so I can watch my slingbox in time for the game on Friday
Some DSL router I’ve seen even label the “Kill icmp” option with “Prevent ICMP attacks”. Yeah. Right.
Can you ssh out to another host?
yes, that’s the mystery box I’ve connected to
where i’ve set up the socks proxy. But THIS computer can’t seem to connect to that to use the SOCKS proxy (that’s all I want to test, that the socks proxy works)
ssh -L someNumber:thatbox:1088 thatbox
After that, try localhost:someNumber as proxy. If that works: Tell the network guys that they need to open the port 1088 to that machine
and ##openssh
8^)=
Bah!
ok thanks
I’m still pissed that they silently established new “firewall rules” at my workplace and I’m now unable to access my ssh+svn:// source repositories..
run ssh on port 443 is a standard solution…
Can’t
Trac is at 443
vhost IP @ 443
simple :p
of course, you’re screwed if you only have a single IP
No, it’s not. SSL doesn’t work with vhosts.
vhost doesn’t necessarily mean same IP
Ah, different IP. No, only one. However..
I think I’ll just live without the repository until something breaks..
Don’t hit me.. Since #eclipse is pretty much dead right now: Any suggestions for using Eclipse (with a plugin) for C# as well? Google gives only (very) dated results.
don’t hit?
ls
wrong window, genius
Thanks, javabot
Not my choice. My employee sells windows-only standard software, written in C#. I’d just love to stick to eclipse and ditch VS (especially 2003).
i don’t blame you. do you at least have resharper?
~tell Blafasel about google eclipse c#
Blafasel, http://www.google.com/search?q=eclipse+c%23
eclipse 3.3 is out
yes, for several weeks now
haven’t noticed until today
too bad a lot of plugin compatability needs to be worked out…i’m still using 3.1 because of that
which plugin in particular?
JTest mainly
ah
i’m using maven for these things
That was stupid. I already said that the google results are not very helpful
And no, I don’t have resharper
The company pays for everything but infrastructure and software.. =(
isn’t maven a build manager? JTest tells you how much of your code (percentage wise) your unit tests are covering…know of an alternative that might be 3.3 compatable?
i’m using cobertura for that
don’t know if there’s a plugin for eclipse
don’t think so
cool, i’ll check it out, thanks
is the only way to access a variable across from two different classes using a static variable?
anyone know with JUnit if it is Gauranteed that the teardown method will be called
boohoo…use getter/setter methods…make the member variable private and give each a public getter/setter method
i guess so… very implementation specific
aww
tias, but – I’d bet it is, yes
this’ll work across threads?
i’ve used tear down to call a stored procedure in a database and it’s always worked for me
I am creating some files in my setup and I want to guarantee that they will be deleted in the teardown
so I don’t have files laying around
thanks.. I will FTIAS
use a tool like maven with a cleaning plugin task
Good. Tell us the results
does anyone here use the standalone jasper server?
Give me maven without XML and I’d use it right away..
haha
lazyness when you hold us
Nope. Ugliness is the word you are looking for
(However it is written/spelled)
it’s a bit too much verbose (the config file) but once it’s done it’s nice
i honestly don’t know I’ve have to try…you might want to look at http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html though
A ThreadLocal is only useful for a single thread. Ask svm_invictvs about it.
yeah, I think i’ll have to make an inner class
It’s not related to interchanging values between threads. You could use it to store your threads value, of course.. But that’s not the question.
and make the variable a static or something
hmm… I wonder if I need an inner class, I could just make the variable static, and use getter and setter methods to modify the values, alleviating the Outer$Inner.class
sleepster, try File#deleteOnExit()
who is the cat fanatic again?
Please. Not another ‘lolcat’ reference..
im in ur meme, drivin it into ur ground
lolcat? nah, i just have this funny picture of a cat i want to share with that person
I eated it.
hey
yo
~tell delparnel about hello
delparnel, Hello, delparnel
~hello delparnel
I guess the factoid ‘hello’ might be appropriate:
Hello, svm_invictvs
~
svm_invictvs, I have no idea what is.
sorry i had to leave quick, here is the cast that doesn’t make sense to me from before. Object[] inner = new Object[]{7}; Object[] outer = new Object[]{inner}; Object[][] casted = (Object[])((Object[])outer[0])[0];
haha
I don’t see how I could get an Object out of outer, that could later be casted with (Object[][])
I havne’t seen r0bby around, wher is he?
That is ugly. Don’t do that.
Blafasel, doesn’t work anyways
Why dont’ you just use collections?
Blafasel, there has to be a way to get outer into an Object that can later be casted by (Object[][])
What are you trying to do?
is it still the dimensions thing?
No, not really. Either you _know_ that it’s going to be n-dimensional (not really, java arrays are only nested) or this whole construct doesn’t make sense for me.
long program…
Blafasel, then how does Array.newInstance?
Blafasel, it is n-dimensional
Blafasel, whats wrong with that? it is useful in this case
i told you a while back already, dont group dimensions, group the dimensional objects.
http://eugeneciurana.com/pastebin/pastebin.php?show=3540
that way you get 1 array of N-dimensional objects rather than N arrays of 1 dimensional objects.
change the toString call to deepToString to get a more meaningful output
Fanook, I understand that example, i am just not sure it helps me in this context, what is the requirement to use (Object[][])?
dfr, i do in storage, but when giving a section back it has to be nested dimensions or it isn’t meaningful or difficult to use
it must be a nested array. if you want to use the [][] notation, you need to build it that way. otherwise, you just have 1D arrays containing Objects that just happen to be arrays, but the compiler doesn’t know that and can’t guarantee that
what do you mean by nested dimensions?
i dont recall that term in my math courses…
Array.newInstance, seems to do it but i don’t know how they put the built array in a state where you can easily do the (Object[][]) cast
java doesn’t really have multidimensional arrays. it just has arrays of arrays
yes. my point is not to use arrays of arrays in general.
dfr, i don’t see another option when giving stuff back from a database for example, its going to be something of something…
you convert it promptly.
dfr, what do you mean?
i disagree. if you have a data structure that naturally falls into a fixed-size grid, array notation is much cleaner than lists
well, if you need to store an n dimensional object, it’s effectively an array of its points
so when you need to save/load from DB, you iterator over the loop of those points, and load an array for each one
dfr, isn’t it effectively an array of array of array etc of its points?
but you always work with _one_ array at each time.
dfr, but if you need to return n dimensions…
you return an n dimensional object?
dfr, yes
so what’s your problem?
that assumes the problem he’s solving is simple to do in one dimension at a time
how to do what i posted and then put outer in a state to be able to do (Object[][])
no it doesnt… each object can have different dimensions.
you’ll have to give me general problem. ’cause my solutions will _not_ utilize arrays or arrays directly.
Object[] inner = new Object[]{7}; Object[] outer = new Object[]{inner}; Object[][] casted = (Object[][])outer;
i already gave you that code. after you build your array piecemeal, rebuild it to get the multidimensional array you want.
how do I initiate a HashMap that has arrays?
i need something in between outer and the cast that makes the cast possible
HashMapKeyClass, int[]
daredemo, new HashMapString, Object(); hashmap.put(a string, new Object[3]);
putting Object into generics is often stupid
Map = new HashMapString, String(){{put(“a”, “A”);}}
this works, but if the second one is a String[]?
same concept. use whatever type you need. arrays are Objects in java
Fanook, your function returned a Object[][]
anyway, i gotta go…. but gaillard_, I have had that problem before, but once you stop thinking of it in terms of n-d arrays and start thinking as arrays of n-dimensional objects, design becomes much simpler.
yes, yes it did.
or at least mine did
Fanook, i need to return an Object, that is possible to cast to whatever dimension it is
have fun guys
liek Array.newInstance does
dfr|away, ok thanks for the help, have a good night!
then declare the method to return an object and cast outside. your problem is that building it piecemeal means you have an Object[], which can hold ANY object, the compiler can’t guarantee you’re only putting other Object[]’s into it and so won’t let you cast
Fanook, i am going to go find Array.newInstance’s source because it does it…
good for you. i bet it does something very similar to the code i already gave you.
Fanook, i am just saying it is possible isn’t it?
of course it’s possible. look at the code i already gave you and remember that ALL ARRAYS in Java ARE OBJECTS
{{put(“a”, new String[2] = {“AA”, “aa”});}} didn’ work :/
Fanook, would you mind making your code return an Object that can be cast with (Object[][]) ?
or (ObjectN)
hi I need help with “File does not contain [...] Please remove or make sure it appears in the correct subdirectory of the class path.”
~tell daredemo about doesnt work
daredemo, ‘doesn’t work’ is not very helpful. What does it do, sit around on IRC all day?
I’m using NetBeans
packages dictate folder structure in java. perhaps if you gave us the entire error message…
Fanook, thanks
DProgrammierung\Java\DownCounter\src\DownCounter\downCounterUI.java
file does not contain class DownCounter.downCounterUI
Please remove or make sure it appears in the correct subdirectory of the classpath.
i have given you all the information you need. think about it for a little bit.
DProgrammierung\Java\DownCounter\src\DownCounter\downCounterUI.java
file does not contain class DownCounter.downCounterUI
Please remove or make sure it appears in the correct subdirectory of the classpath.
oh sorry
sounds like you haven’t recompiled that file, or your class isn’t public
Fanook, no one ever puts the code out that they say is easy… if i knew i wouldn’t hesitate to hand out =P
you want the method to return an Object. Have you tried changing the method’s return type?
so I need to recompile it? how do I do that in netbeans
ah F9
dunno. i’m an eclipse user. but i would expect there’s a way to do a…yeah. probably a menu item as well
Fanook, but i won’t know how many dimensions it is, i guess i was hung up on having to use a specific identifier
thanks that helps though
there’s no way to cast to a multidimensional array WITHOUT knowing what the dimensionality will be beforehand
java.lang.NoClassDefFoundError: DownCounter/downCounterUI
Exception in thread “main”
On the command line, spell it “DownCounter.downCounterUI”, and for pete’s sake fix your package and class names
Fanook, but i can put it so they can cast it outside, but it definitely requires a copy of the thing????
Fanook, seems odd
huh? i would hope that the method that builds the array piecemeal takes some user-defined data that tells it how many dimensions to expect
mMap = new HashMapString, String[](){{put(“a”, new String[2] = {“AA”, “aa”});}} doesn’t seem to work
complains about missin g”(” and illegal start of expression
but it seems everything alright
oh. duh. that’s not how you declare+init an array
with the names
~tell spazzPP2 about conventions
spazzPP2, conventions is http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html , or “ThisIsAClassName, thisIsAVariableOrMethodName, THIS_IS_A_CONSTANT_NAME”
try put(“a”, new String[] {“asdf”, “qwerty”})
i believe the ‘2′ is optional
how can i check if a cookie exists in the local filesystem?
cookie cookie cookie starts with C
from what context?
=.=
ojacobson, well, i made an xmlrpc request from an java application ( not applet )
thx@all
and the xmlrpc server sets a session cookie and browser cookie
the “browser” cookie will have been handled by your XMLRPC library
i need the client cookie in the local filesystem
check the docs for it
hello
ok ojacobson
well that’s interesting. java.lang.reflect.Array is entirely native methods
Fanook, what does that mean?
it means Array.java has no content. just declarations for methods implemented in native (i.e. C/C++) binaries
java.lang.reflect.* contains a large proportion of native methods
hmm why would i get a class cast exception when type casting myArrayList.toArray() to String [] (the arraylist contains a bunch of strings)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6588768
funny thing is im only getting the erro at runtime :/
g[r]eek: because an Object[] object is not a String[]
it compiles ok.
But an Object[] reference can point to a String[].
So there are circumstances where the cast is valid.
the compiler assumes you know what you’re doing when you explicitly cast
“the issue has always been there, just write a code generator to work around it”
Sun’s big on code gen
personally I think it’s a sign of a language weakness
However, I seem to recall telling you that’d happen
ojacobson, seems versitale..
you’re aware that static methods are not inherited, right?
ojacobson, yes i beleive you did
so basically i’d have to iterate over my arraylist, pull each object, and cast that to a string, one string at a time?
ojacobson, but i kinda changed the way i was going about it
was hoping to get a String [] out of it quickly :/
g[r]eek: of course not. there’s a utility method for that
g[r]eek: Create the original array as new String[]
or use Arrays
yeah i guess
(java.util.Arrays, the swiss army knife of champions)
which one
you can call them through a derived class#
fwiw, assuming MyCollections extends Collections was valid, if you typed ‘MyCollections.EMPTY_LIST’ the compiler would be silently replacing ‘MyCollections’ with ‘Collections’ anyways
bfwiw, assuming MyCollections extends Collections was valid, if you typed ‘MyCollections.EMPTY_LIST’ the compiler would be silently replacing ‘MyCollections’ with ‘Collections’ anyways/b
~tell g[r]eek about Arrays.copyOf(U[], int, Class extends T[])
g[r]eek, I guess the factoid ‘evil extends’ might be appropriate:
g[r]eek, evil extends is http://www.tmorris.net/pubs/extends-not-evil/
So you’re really only gaining lies
there is the generic toArray() in Arraylist
~tell g[r]eek about javadoc Arrays.copyOf(U[], int, Class extends T[])
g[r]eek, I don’t know of any documentation for Arrays.copyOf(U[], int, Class extends T[])
ah yes i know what you’re talking about
g[r]eek: feed what toArray gives you into the method the bot can’t find
thanks
sure, but so what?
gaining convenience was the point of this feature request ;-P
so type import static java.util.Collections.*; import static my.package.MyCollections.*; and call it a day if you’re going to do that
heh, i can just concatinate each string as i read it, and the Split once its done
simple enough
StringBuilder i guess
g[r]eek: aye, much nicer sol’n then playing around with Collections
bye. thanks for your help and your advices
can anyone suggest me some nice interface builder for eclipse 3.2?
the eclipse gui plugin
i will try it! thanks!
that being said, unless you’re just doing mockups, generated gui code is generally crap
why does this only return the “city” entry.- ar address_city_auto_completer = new Ajax.Autocompleter(‘address_city’, ‘address_city_auto_complete’, ‘/nirview/auto_complete_for_address_city’, {callback:function(element, value) { return ‘address[state]=state’,'address[city]=city’ }})
s/ar/var/
I want it to return both the “state” and the “city”
~pmd
svm_invictvs, pmd is a java lint tool available from http://pmd.sourceforge.net/
are you trying to return an array there? shouldn’t you have an array declaration in there somewhere?
could be…pretty new at this…can I just return the array? or does it have to be defined when I use it?
I know I can use curly braces…but I get no joy.
return new String[] {“s1″, “s2″};
cool…let me try that…thanks.
so ant geeks. i want to have something in my code that says “Build # xxyy” that matches the SVN repo number, as well as some other tidbits gathered from env.mumble. I’m thinking something like the build script generates a properties file when it builds, and when i ask the app for status, it
reads the props file. I’d -rather- have a $Id$ in a file change when i check it out. possible?