hsql and booleans
Man, the clock on this server host is
wickedly fast. If I weren't running ntp-date the machine would have
the weirdest time.
Anyway.
Good night, peepers.
Sleep tight.
night pr3d4t0r
Does ! count as an operator?
yes.
logical NOT
~tell riwa about operators
riwa, operators is http://java.sun.com/tutorial/java/nutsandbolts/operators.html
there are *ALL* the operators.
thanks
Sup dude.
not much.
Hm.
I don't have much faith in these test cases when the order I run
them in is the deciding factor for which performs the fastest.
:-/
I really need to set up a randomised test harness or
something.
yeah I had an issue come up with that once
I'm pretty sure it's a combination of the JIT kicking in plus
String optimisation magic.
But even when I aggressively intern everything up front it still
happens.
what is "it" ?
i have to (i'd like to) package a certain java web host project X to an
easily deployable .jar file... but X requires some local
configuration files... do i have to deploy them with the .jar, or
can i include them in the .jar "transparently"?
you can include them in the jar, but I'd suggest being able to
do a search, i.e. search a home directory subdirectory, then a
common config dir, then the working dir, then the static hosting configs in the
jar
"it" is the overwhelming performance differences resulting
from shuffling the test cases about.
Performance is either 3 times as slow or about 20% faster than
the benchmarking example depending on whether I run my class or the
benchmark first.
oh, try -server vs. -client
Hmm. Interesting idea.
cybereal, my motivation is to make another project Y use X as a
utility library... it would be frustrating for the developer host
of Y to have to know about the configuration files
if the results differe it'll strongly indicate JIT behavior
are they really configuration files? Will you be editing
them?
No difference.
Or at least not an immediately obvious one. I'm just printing out
results at the moment.
interesting
maybe your test is too fast, that was really short
I had this performance problem and it didn't show up until I
expanded the performance test by 2 orders of magnitude, then it was
very clear. Unfortunately that meant it took a while to test my
changes.
if they are, i suggest you distribute them seperate, grab the
user's home directory and use a .yourApp where yourApp is your
App
Yeah, possibly. It's just a quick test case intended for
making sure I'm not doing anything insanely wrong.
I'll set up more serious performance testing when I've got
actual functionality in place.
File file = new
File(System.getProperty("user.home"),".yourApp/configFile").getAbolsuteFile();
if that doesn't work, check the System javadoc
in that pattern I like to include default configs in the jar
particularly if the default settings can be used for normal
operation til someone wants to override them in their user
dir
perhaps
why not hardcode defaults, then override them with custsom config
file?
the answer lies in your question
i didn't know pr3d was a sushi fan
he is.
if it's behavioral it goes in code, configuration though, it
generally not behavioral, thus it's a great candidate for
externalization
can't imagine not liking sushi
Thanks. I've just upped the size of the things I'm testing
against and the results are a lot more consistent.
true
yeah, I had to go from 2000 iterations to 200,000 before I got a
reliable result on my test from about 4 minutes to around 30 or
so
not liking sushi is somewhat illogical.
Given that matters of taste are almost never logical, I
agree.
hehe
But it's a weird thing to say. So, that water stuff. Wet,
ain't it?
bBut it's a weird thing to say. So, that water stuff. Wet, ain't
it?/b
water is the only thing that isn't wet!
I'm quite pleased with the results of this enlarged test
actually.
Hm
If I double the size of the test again I get a PermGen space
error.
ooh cbrock would be interested in griping along with you on
tha tone
Which one? The performance tests or the permgen space?
permgen
dude, don't ever use System.getProperty("user.home")
why, sometimes I want to place it in the user's home
directory.
It's ok. I stopped interning all the strings and gave the
JVM 2GB of memory to play
with and it stopped running out of memory.
back this one up, i gotta hear this
cybereal, they are not configuration in the sense that the
clients should never edit them.. they are kind of "private" to X,
which further boosts my motivation to encapsulate them
don't ask me why, simply obey
!
no, you open your mouth, back it up
cybereal, but no probs, i'm researching the underlying code for
possibilities right now
right.
no.
you're a moron.
195
we're not gonna count you.
until meeper can prove otherwise...
Meh. Don't know what the silly JVM is complaining about. It's
only a 70MB string.
heh, yes, let me prove otherwise
very small
Hm.
140MB string.
still
otoh, no, I have nothing to prove. if you choose to not
follow my advice, so be it, you will reap what you sow
Ok, maybe 280MB as it has lots of little pieces of it floating
around.
are you interning that?
And if it's not interning things it might have a couple
copies.
your advice was you talking out of your ass
if it's not interning why would it complain?
I was, which caused the permgen. I stopped and it merely gave
heap space errors.
wtf??
oh
heh, so you have no idea how big it is?
pandora--: I don't talk out of my ass. I talk from experience
only really
Yeah, basically.
but as I said, I don't have anything to prove. I think on a
different level!
unless meeper can add any reasoning to his advice, its just
"some guy on t3h intarnets" giving free advice
hahaha
and we know how much that's worth
~meeper++
meeper has a karma level of -16, jottinger
I just read in a 500k file and doubled it repeatedly until it
looked large enough. All I needed was a big string to test against,
as I was testing relative numbers.
pandora--: well see how far that gets you
I see
what? free advice on t3h intarwebz?
not very far, as I don't listen do it
pandora--: no, not thinking
uh huh
i guess you got me.
damn.
pandora--: when somebody says 'don't do X' you should wonder
why
This is by no means a formal test. It's just there to guide
me and make sure I don't do things too badly wrong until I can set
up some proper performance testing.
yes, we are, but you're not telling anyone
odd?
About waist level in fact.
s/different/unfounded
?
is anyone familiar with the java.nio package?
pandora--: I'm not a mother. Couldn't care less about you.
But you should wonder
~ask
The Ask To Ask protocol wastes more Bandwidth host
than any version of the Ask protocol, so just ask your
question.
pandora--: drop it. He'sa lost cause
you realize, people have asked you right?
I hate it when r0bby and meeper fight.
I'm never sure which one to root for.
too busy listening to your ego to hear the rest?
it's too much like a slapfight
LOL
pandora--: I grow weary of constantly explaining myself to
those thinking on a lower level. Sometimes I just offer advice and
leave it at that
aww
you are my mother!
you care!
one of these days we're going to have to get you a sense of
humor
*hugs*
you never "leave it at that"
Yeah. But at least it's really funny to watch.
root for the one who's not a total retard
not if they disagree
Exactly!
me.
you're the best
that "thinking on another level" crap is probably the best web hosting thing meeper's
ever come up with
isn't it sad that you had to clarify?
well if somebody disagrees that's different. there is the
potential to learn
in a long, long IRC history of rubbish
yeh
Don't you grow more weary of constantly explaining why you
shouldn't explain yourself?
imma buy your book about thinking on different levels k
meepsy sweetie cakes?
no, it's a new tactic
meeper doesn't care about that.
He's a lot like Van Gogh. Has his own reality.
and it's hilarious that meeper has "tactics" on irc
I think that pretty much says it all
You know how Van Gogh cut off his own ear? meeper cut off his
own balls.
but but but... if we kick him.. we'll never know!
omgomgomg!
The parallels are astounding.
yeah
lol!
we'll all be so sad without meepsy
you know, you're not very honest
hmm, I wonder if there's a way to get info flags passed
(possibly?) to an ImageObserver when asking for height or width of
an image synchronously somewhere already
100 years from now someone will unearth the source code
written by meeper and, like Van Gogh's paintings, will frame them
as art.
"Product of a disturbed but somewhat creative mind" the captions
will read.
meeper had balls to begin with?
lol
... right alongside elephant dung, yes
Tiny one.
ftw
Only one, at that.
pandora--!
I also wonder if the ImageObserver passed to getHeight(),
getWidth() or getProperty() gets notified at all if the image is
completely loaded - the javadocs seem silent about this
! long time man
I thought meeper was ball-less
flyin up there tomorrow to go to robogames in SF
come on man, stop talking like a child
wb meeps
i missed you
i can has hugs?
pandora--: no, you're not much better than r0bby. you wear your
ignorance with pride and hide your weakness behind sarcasm
pandora--: Nice.
though yes, you can have hugs
~tell pandora-- about welcome.
pandora--,
http://eugeneciurana.com/galereya/view_photo.php?set_albumName=Humor&id=welcome
pandora--: And dogpile.com is b0rk'd.
pandora--: The aggregated results don't reflect the parts
Man, 0055.
I should be in bed.
bevin has a funny accent ^_^
0355
i guess you've out reasoned me again.
you're amazing
haha screw dogpile
pandora--: I wouldn't mind his opinion, if he backed it
up
pandora--: HeH.
I quit there a year ago
well, Infospace
pandora--: Nice. All mobile now?
I'm all mobile ya
pandora--: Schweet.
the company is mostly mobile
but, i'm doing the J2ME work
pandora--: Ah.
pandora--: I'm writing an iPhone article. Check TSS
tomorrow.
ooooh?
more speculation?
lack of java nonsense crap.
No.
pandora--: not amazing, just smarter than you. but, like with
r0bby, I have faith. you can grow. I think if you drop the cynical
pose and begin to wonder more you'll do much better
Analysis.
analysis of what?
Read it tomorrow.
so what is a bean? is it some sort of organized data storage
container?
oooh! thank you meepsy!
I'm getting tired of all these evaluations and predictions
when the device isn't out. If you don't have one of your own to be
analyzing, what's the point?
pandora--++
pandora-- has a karma level of 9, pr3d4t0r
you're so insightful, you know me better than I know myself it
seems! how grand!
It's not an evaluation or a prediction. Read it
tomorrow.
pandora--: is sarcasm all you can do?
rss feed?
http://www.theserverside.com
why shouldn't he stick to sarcasm? You're a one-trick pony, too,
you know
sarcasm is for little people
uh oh... jottinger figured it out before meeper...
I'd expect somebody to move beyond sarcasm
where will it be, just the front page? I know nothing of this
site and it looks very busy
meeper ????
nooooooo!!!!!
Big guys with little dicks like meeper just resort to pointless
aggression.
oh snaps.
he has a dick?
Front page.
he keeps it in a box with his panties under his bed
you are at least, I think, truly petty. this is better than
sarcasm because you take risks.
:: yawn ::
I think I'm going to sleep.
True pettiness might be better than fake pettiness, I
guess.
we all wish you a good night!
yeah, definitely
I dunno. I'm just glad I'm not thinking on your level.
Why... thank you.
I think I'd be embarrassed.
I was about to /kickban you on the way out. You touched my
heart.
we'll be here when you awake
Thanks us all. Meeper speaks for all of us
STFU. No threats, please.
come now, you thrive on threats
I don't threaten. I execute.
haha
pr3d4t0r++
pr3d4t0r has a karma level of 322, r0bby
pr3d4t0r++
pr3d4t0r has a karma level of 323, r0bby
He forgets that, as a skydiver, I'm trained to make important
decisions in a matter of seconds.
uHe forgets that, as a skydiver, I'm trained to make important
decisions in a matter of seconds./u
I'm going back to bed myself
g'night
:*
niiiiiiice
rock on.
'Night peeps.
Before I go:
okay, night
i thought I was going to have to send meeper some ASCII pr0n
in /msg
Should I /unban him now, or in the morning?
~pr3d4t0r++
pr3d4t0r has a karma level of 324, aditsu
in the morning
it doesn't take much to make good decisions quickly... mostly
just an amount of self-trust
rife be complicated.
Definitely in the morning.
~pr3d4t0r Leave him banned.
I guess the factoid 'be pr3d4t0r' might be appropriate:
/kick orange80
~pr3d4t0r++
Ha ha
pr3d4t0r has a karma level of 325, orange80
Morning!
ok, going to play zelda.
bbl..
I vote for never, but then again, people said that about me, so
i'm all for 50 millionth chances
What is with the pr3d4t0r praising fapsession?
any sane op would've kb'd meeper methinks
ew
tell that to the ops on efnet *runs*
wait jottinger is one
I said sane
heyas, I have a friend who just queried me.... he wants a
laymans definition of javabean ... can anyone help?
true
uh npr shuffle gone haywire, repeating the same entries
jesus
if you're gonna do it, do it where i'm active
i want that too, Firztspawn
~javabean
I guess the factoid 'javabeans' might be appropriate:
cybereal, javabeans is http://java.sun.com/products/javabeans/docs/spec.html
He, he, he...
Z z .
night :-*
pandora--: Check out the TSS videos.
pandora--: We may be in a position to do business.
pandora--: You need content. We gotz content.
cybereal; ok, but what exactly is a javabean?
welcome back meeper. I missed you baby.
pandora--: http://www.theserverside.com/news/thread.tss?thread_id=45763
- here is our latest.
that link links to a description more exact than you could
ask for
do you know what a "specification" is?
specs, set of rules
well not rules as such
standards
http://java.sun.com/products/javabeans/faq/faq.general.html#Q1
??
ok ty
it's a technically detailed description of just what a thing
is
read it, and you'll know exactly what a javabean is
First Q on the FAQ..
ty
...
does that laptop have wifi?
it has something
no really?
yes really
sorry...sarcasm
r0bby, eat a penny for me, it's so funny when you do
makes me giggle
bite me
But your metallic chassis will crack my teefer
sutherlands
http://eugeneciurana.com/site.php?page=musings&contentTag=TSS-video.html#OLPC
It includes video, laptop specs, photos, and relevant URLs.
Popular TSS feature.
I'm just thinking back to the original description before the
OLPC was something real
cracked me up
The screen is very nice.
And the machine gets 10+ hours of battery on a single
charge.
sure but the point was, the way it was described in the early
time it made it sound like a speaknspell with a handcrank
e . t . phone home
No, it didn't.
:: sigh ::
. o O o .
Yes, actually, it did. Maybe you get your info better
distilled but it still did.
it has a lit keyboard!
OLPC++
nice
I know it had a cranking handle. But to qualify it as a
SpeakNSpell is stupid.
okay
it's just the way the doubters on /. were making it sound
but comical in retrospect as it seems to have become fairly
capable
oh I see, its your inner child... I get it now
I configured mine as a server. It works just fine.
Heh.
One of the nicest features isthe WiFi.
probably but everything seems to have it these days
although nothing is more frustrating than a device that is new
but doesn't support 802.11g
It outperforms every laptop I've used or seen.
probably the software
so many laptops are bogged down with more than their brittle
architectures are meant to handle
And the antennas.
oh you mean the performancce of the wifi?
Yes.
It sounds like you are used to mac laptops
apple can't seem to make a worthwhile laptop antenna
I have a ThinkPad too.
the small vaios rock and perform very well because they have the
antenna outside, in a little piece of a plastic off to the side.
Minorly ugly but it's worth the signal boost
And MacBooks have shownme many times better wifi and more
stable.
to be fair I haven't had the opportunity to evaluate the
current gen laptops, but I will probably have a MacBook Pro soon to
try for myself
my inspiron's internal wifi card - _BLOWS_
getting hardware refresh at work
The OLPC has two multi-directional antennas
but that's to be expected
don't they have the capability to be connected in a mesh or
similar?
Yup.
well that explains the multiple antenna
I want to write better network handlers for it, though.
same deal on those "108mbps" wifi routers, just using two radios
at once
driver level or... some kind of management software?
The point is that it has excellent wifi.
yeah I got it
I don't care if it took two antennas and an armadillo
tooth.
I'd guess even one would be great outside of the mesh, just
because it's external you know
makes a big difference
nice 6db gain or better probably
I'd have to test it.
Anyway...
Oracle is a big fat meanie.
why do you say that?
Good night...
http://www.msu.edu/~nixonjos/armadillo/pets.html
I have a heisenbug.
A hindenberg?
No, a heisenbug. A bug whose nature changes when you look at
it.
I will leave it running. It's got 50% charge. Let's see if I am
still connected in the morning. Cheers!
It's taken me 2-3 days now and I've thought I've fixed it a
dozen times within that period only to have it break again as soon
as I stopped looking at it.
I thought I had a hindenberg this week, man, I refactored
this hugely important part of my project and I get this "uh btw
we're releasing GA on friday" and this hugely important code was
not tested at all
seems to be working though
I knew what you meant, just thought it was funnier to reference a
crashing baloon
That's ok. I'm sure you have a really extensive regression
test suite which makes you refactor proof.
I wish
I'd have to have time to write that
I told my boss to hire me a slave to write tests, could be an
intern, but we can never find interns
hindenberg?
~google hindenberg
http://www.google.com/search?q=hindenberg
perhaps you mean hindenburg?
although apparently hindenberg is a popular misspelling!
it doesn't really matter to me
u, e, both ways ugly
The screaming hairy armadillo is especially known for the loud
squeals it makes.
i see!
Armadillos jump up in the air when they feel threatened. This
often works to startle a predator, but against an automobile it
doesn?t work.
heh
nice
is the Armadillo the ##Java mascot ?
I have a lot of respect for the people doing OLPC
barney and baby bop are :P
Hmm
I'm just worried it will hit a little too close to home.
heh
hello
Oh well. I'm leaving in a month! [clicks send]
nobody ever uses the F6 key
why is it so damn quiet here lately?
what is going on
it's summer
im going to bed
04:56:10
THAT is why.
good time to go sleep
ty cyber
Anytime you want to go to sleep is a good time..
Uses the F6 key for what?
except while driving
anything
I do
just go pressing it, it seems to never be mapped to anything
you are just contrarian, so you do anything anyone doesn't do
even if you can't
Dammit.
... No.. It's mapped by default in my WM...
I'm thinking of someone else sorry
I had to press it in the *one* application which maps
it.
that was a mean comment from me meant for RLa
hahaha
what did it map it to?
I've tried like 5 things so far
HEH
Good for ssh
well you know in IDE's every thing is mapped it seems
Yes. But not everythign is mapped TO, which is
frustrating.
I was just reading this article about dishwashing keyboards
and the guy says "There are keys I just never use, like the F6 key
I don't even know what it does." And so now I had to try of
course.
well IDE is complicated usually
I mean sophisticated
What IDE are you talking about?
Yeah. Which is why netbeans has key bindings for "destroy the
entire world" but not "switch tabs"
Oh... Netbeans
eclipse has switch tabs but it's "Switch tabs in an entirely
random order... seriously, random."
Well, it has switch tabs in the main window. But not for the
console screen (and it routinely generates at least 3 different
output tabs)
switch tabs? Ctrl+tab?
I know I took nb for a spin
And the main tab switcher is very random as well. I think it
cycles back through your history or something.
it was horrible, interface-wise, and debugger-wise. I don't
know how you can use it. Eclipse's debugger blows it out of the
water.
but it did give me a nice motivation to improve my
build.xml
Doesn't work for the tabs in the output console.
At work, because I have to. At home, because I don't find
eclipse especialyl usable either and can't be bothered to switch
contexts between the two.
yeah eclipse's has a system but it may as well be
NP-motherf*ckingComplete to me because I don't remember what tab I
was in or what was edited or what might be related to my current
code or whatever
hi if i have String args[]=(somestring).split; how can i add
an element to the end of args? i guess args is just a reference, so
what do i do?
When I switch jobs I'll probably bite the pricetag and buy IDEA
for home use.
you can't
convert it to a list and use lists
ok
I didn't much appreciate IDEA's interface either, waz will
undoubtedly chime in and bitch about how it improved productivity
but I don't see it. I mean, it doesn't seem to have features that
would matter to me I guess.
certainly not $500 worth
maybe it makes more sense for J2EE coders or something
We'll see. I may conclude the same - I've not used it
yet.
Oh, I forgot the other reason I don't use Eclipse at home.
It's randomly unstable on my machine.
it certainly has a lot of crap but usually I only really care
about the editor and debugger
linux?
Yeah. Ubuntu running on AMD64.
yeah I had problems with it on ubuntu, until I found out I was
inadvertently running the gcj patched version
I pulled down my own version and it was fine on the sun
vm
I'm pretty sure I'm not running the gcj patched version.
I've been very emphatic to Ubuntu about not using GCJ and installed
eclipse manually rather than through the package manager.
it's the default in the package system, if you got it there,
you should check
oh well you're probably ok then
I've heard about instability from others as well
surely 64 bit doesn't help that
Yeah, eclipse is known to have issues with 64-bit linux.
more and more I despise the package manager concept used so
often in linux
it has been a long-time bullshit excuse not to unify an
installation procedure, and it's practically unusable to any entry
level user
well you know, SWT == Shitty Window Toolkit
uh oh, what
you like Swing? AWT?
I disagree. I really like the package manager concept, and miss
it terribly on windows.
I like the idea of standardized installation procedures but
not this monolithic dependency hell you get with rpms and
debs
It always seems the moment you want to step off the Yellow Gnu
Road, you have to know 1000 magical incantations to achieve your
goals. Boring if you ask me. I used to enjoy that but not
anymore.
what's the best way to check is a string only consits of
digits?
something like a JNLP for local installation would be nice
probably a regex
"12341234".matches("\\d*"); or something ... I think String has
matches now
I agree that a proper package manager independent
installation procedure is really needed.
But I also like the package manager.
yeah well more power to you
I also gripe about the aging habit of mixing up one apps files
across 5 directories in /usr
Give me apple's .app directory concept any day
even Apple .apps put stuff in Libraries etc.
yes there are always some exceptions
mostly they don't
What does volatile mean? In other languages it simply means that
compiler shouldn't make assuptions as to the value of the
variable... Does it mean something more in java? What are for
example performance implications of using volatile? Is the life
cycle of such objects any different from "normal" ones?
generally those come in the installers and ask for an admin
password so you now
er know
applets are pretty clean, and webstart stuff, but eventually
some software is always going to pull dirty tricks
volatile is a modifier for a field, not an object
it means the vm can't cache the value
and it's for a field, as psst said. has no effect on an object
itself, just the reference value of a field pointing to one, or
whatnot
you use it for things like thread behavior flags, if you go that
route instead of the better choice of messaging
so, as cybereal says, the field must be fetched from main memory
on every read, and written to it on every write (this is an
over-simplification, but it will do)
I thought volatile didn't really work?
what would be the point? You can't exit the constructor phase
without them assigned.
Theoretically it might have some effect during
construction.
well... over-simplification? Could you point me in a place where
it's described in more detail? I'd have thought that what you said
about read and writting is description enough, but if you say it's
simplified version...
it works but it doesn't do as much as some people think, i.e.
it doesn't fix the read, write dilemma of mutable
fields
brb
google for the Java Memory Model and Bill Pugh (one
recognised authority on the subject)
of course we have the atomic classes for that now so no
biggie
I have a class now that hides a constant behind getters just
so that it doesn't get compiled into every class
someone not thinking through might expect that something like
class A {int i = 1;} instOfA.i++; would be thread safe but it's
not.
well the easier trick is just don't use final
you're throwing away any tiny benefit final gave you by calling
methods, fast as they are
I am wondering whether volatile would make the compiler fetch
it from source (i.e. the original class)
hm maybe, also maybe transient? I'd look at the spec for that
question.
I am not using final for the speed, but to indicate the value is
not to be changed at runtime
the constant is a version string. I want to be able to update it
in small patches
yeah, well I understand your fear on that but either way is
overengineering, the final just requires a little more
recompiling
I see
I use resource bundles for that stuff
yeah - all 250klocs compile down to a tiny jar, so you're right
on that score
/me is just engaging in idle speculation, really.
that's what ##java is for
hi everyone
I've got a problem with using files in a jar file ... I tried to
use that:
public final File rgalleryContainer = new
File(getClass().getResource("/resources/galleryContainer.html").getFile());
but it does not work
I receive a FileNotFoundException, even though the file is in
the jar archive
but the same thing works with icons:
public final Icon rSave = new
ImageIcon(getClass().getResource("/resources/save.png"));
you are not doing the same thing at all there
cannot you tell the difference?
In the first one you're redundantly making a new file out of an
existing file that was returned from the getFile() method
now, when you do that, the new File is trying to locate the
first file and it can't because the location is a virtual
one
what you're doing is equivalent to String s = new
String(obj.toString());
virtual means that there is not really such a file, because
it is in the ram or so?
because it's in a jar that can't be directly referenced as a
file
it isn't a file, it's part of a file
the getFile method is giving you a special representation so you
can use the File methods on it
usually though you'd want to just use the regular stream access
methods
that sounds complicated ... stream access methods are e.g.
FileInputStream?
my mayor http://www.sltrib.com/news/ci_6127662
I've met this man, he's f*cking awesome. Damn anti-social hater
morons in the press really dislike him because he's pro-individual
and so forth. He's all about getting people together downtown and
hosting public events, you know, making a city into a livable
place.
I read your last statement first "I've met this man, he's ...
awesome"
nice ... we don't know mayors any more in Switzerland
ok
took that *all* wrong
apparently
It's just rare to see a politician standing up for his views,
and actively pursuing what he thinks is right in his city or
elsewhere. It's very respectable imho, but it goes very much
against the grain in this largely fat-cat republican state.
I mean, a politician with standards and principles? seriously
rare
does he place more importance in people than in
business?
very much, though he doesn't miss the point of promoting
businesses that bring people together, for example, he promotes
companies that put together fairs and cultural gatherings
downtown
his primary platform has always been bringing people together in
the city and making it a forum for the society there
sounds quite radical (and very much to be desired)
you're up early!
but the opponents want to take the city over, turn it into some
kind of combination of the vatican (but for the mormon church) and
a big office complex
late, I should be in bed but my sleepi8ng schedule... is totally
screwed
sorry, i got disconnected. did you get my message
cybereal?
last I see was you asking how to check if a string is all
digits
i asked you earlier about adding an element to the end of the
array, i think you told me to use Arrays.asList()? well i see that
method returns a fixed list, so i can't add an element to the end
of that either?
how long will your array/collection live?
not long at all
are you able to use java 1.6?
blah! I have to stop reading --- yesterday I found out that
i++ isn't atomic, and today I know that double-check locing is
broken
nope
1.5
that's too bad
It's allegedly not broken in 1.6
have an article on it?
stick to atomics
But yeah, one needs to be absurdly careful with
threading.
yeah.. jsr-133-faq
http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html
i could make a new list of n+1 elements and copy them all
over?
well you have to weight the construction of appropriate data
structures vs. some kind of silly hack, and their impact on overall
complexity in contrast with how long you'll need the data around.
You could tack on the new element to the end of the string so it
comes out in split, for example
I'm having to fret about it with the library I'm writing, and
it consists mostly of immutable objects.
How difficult is it to put an InputStream into a
StringBuffer?
More than it should be, but not very.
no i can't do that.
nl = new ArrayList(thatOriginalArray.length+1);
nl.addAll(thatOriginalArray); nl.add(newItem); you can just make a
new array one element bigger and use System.arrayCopy
too
you have a few choices, and only you'll know which is best
fact o the matter is array size is immutable
(Whoever tells you that a) Immutable means 'no set methods'
and b) Immutable objects are automatically threadsafe should be
laughed at)
are arrays generally faster to acess that lists?
than
double-check locking gets used all over the place
not by anywhere near enough to justify giving up the
conveniences of the collections classes
personally i'd never use an array for a non-primitive type
anyway, unless I was forced
well.. too bad it doesn't work than
collections classes just help make future use of my code and
alterations of it more easily accomplished
although I'm not really sure, I understand why
the type here is String, and i don't need to manipulate any
data, only access it, guess i'm going with arrays
you can't manipulate strings anyway, only make copies that are
different, partial/etc.
Do I have to do it with a loop?
you have an example of an immutable class that is not thread
safe?
if you're just going to iterate over the string array
immediately, just ... do that then do one more op out of block for
the next item
Double checked locking sortof kindof works. There are certain
guarantees it is expected to make which it doesn't.
Not in the standard libraries. But the stuff I'm writing does a
lot of cacheing / lazy loading.
which needs careful synchronization to be thread-safe?
So even though it's immutable, it needs to be very
careful.
what kind of object would have a setter but still be
immutable?
Yeah. Made worse by the fact that it's *utterly vital* that I
don't synchronize on the objects themselves. :-/
No, the other way round. No set methods but still only sortof
immutable.
HtmlPage.setCachePriority(int i)
oh yeah sure
that's mutating its state
It's immutable as far as the external world is concerned,
both in terms of what they can do to it and what htey can observe,
but internally it mutates a lot of stuff.
if the cache priority is only internally visible, then the
object is still immutable
unless that's a static method
no, that's not true
just because you can't access the changed value doesn't mean it
wasn't changed
I find the idea of immutability comical in java anyway, since it's
nearly always conceptual vs. a little reflection
hmm
we may have to agree to differ, but if the externally visible
state *and* the externally visible behaviour of an object is not
modified by any of its operations, then that is arguably an
immutable object in my book
How do you mean?
but it was modified by that set method
I wonder why SomeClass.class.isInstance(null) returns
false
Sure, you can do stupid shit with reflection.
even if it's not verifiable (which is poor design)
yes that's what I mean exactly
after all, null is assignment-compatible with every reference
type
I don't really see this as a problem
I didn't say it was a problem
It just make it hard for me to view anything as concretely
immutable
on the contrary - good design may *require* some aspects of an
object's state not to be visible
it's still state, and alteration of it is mutation
I agree with you in principle, but I'm quite happy to let
"immutable" mean "immutable if you don't do stupid
shit"
sure of course
hello!
I think you have a misunderstanding of what immutable is. The
only way that setter exists without making the object mutable is if
it's changing something else, not that object itself.
it doesn't matter how visible the change is
then we have differing definitions of mutability. Yours is
absolute, and mine is frame of reference dependent
is there a way to find out the name of a window?
I can't find it how to make a String(Buffer) out of an
InputStream
:'(
ok - so String is immutable, then?
learn to read characters from a stream then put them in a
stringbuffer
sorry, missed your earlier question. You do need to use a
loop.
excepting reflection, yeah it is
okay, thank you ...
complicated :-/
same with all of the objects for primitives (Integer, Character,
et al)
(but why simple if it also works complicated)
you can use a BufferedReader
oh, how?
I wonder why you want it in a stringbuffer anyway
~tell Granjow about javadoc BufferedReader
Granjow, please see java.io.BufferedReader:
http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html
thanks aditsu
so which thread owns the monitor for the string returned from
java.lang.Object.class.getName()?
I have to replace text there and so on
InputStreamReader should help connect them
(just to pick an example string)
remember, a string is not returned, a reference to it is
there isn't enough information to know which thread has that
monitor
alright - let me rephrase the question
there is - otherwise how could the JVM determine what to do when
a new thread enters the synchronized block?
seeing as you don't need to acquire the monitor lock to
assign or return references
what synchronized block?
a synchronized block, I mean
you ... didn't give a synchronized block
you really need one?
you just gave a method that returns a reference and asked
which thread has its monitor
you cannot imagine?
no, I can't imagine what you're not saying
I am not a mind reader
ok - let's start again
consider a string
object
and franklly locking is not a subject to be using your
imaginaion in
this object ahs a monitor
yes they all do
this object has a monitor
table
*cough*
~enter
cybereal, 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.
ok - good point - hang on...
howdy guys, wrt javaee and hot-deployable web-apps (im using
jboss) - if a single instance of a servlet is made the first time
it's called, and from then on new users access (share) that single
instance through multiple threads - then surely there is a danger
in hot-deploying a new/updated build of my app?
wanting to get your 2 cents on the matter, best practises for
updating, etc
thanks, that seems to work
yes there is a danger
so don't do it in mission critical apps
well my current strategy would be to wait until 2am for
updates :/
or something of that nature
perhaps send out an email warning to my users too
that coupled with an ability to allow current sessions to
finish but stop new sessions with warnings is a good
plan
ah nice
generally by redirecting to some static explanation for
newcomers, and some kind of "Your session is going to expire for
maintenance" banner on current pages or similar. Whatever makes
sense for your app.
ill somehow have to isolate that assertion of checking if new
sessions are allowed
probably the same way you do it to implement security
im using a declarative model so i guess i could just redirect
login attempts
bye
and tnx
ok thanks for the pointers
I'm sure you'll find a way, but the basic idea is something
I've seen so it should be acceptable to users
as a second example, eBay has its active applications masked behind
a much simpler templating system, and when that backend app needs
to be redeployed or maintained, you just lose the data on the front
end templates and get warnings about it. It keeps the site up as
much as possible while individual systems may be down.
but they are so complex, it may just be the best way for them to do
it and keep business going
i'll put that approach on my todo list for 5 years
time
hehe
clever model though
well it makes sense for them since their site has so many
separate "parts" but most web apps are viewed and architected in
some monolithic way at some level
Which is a bit of a shame really.
well it's one of the few things the dumb web2.0 guys have a
good point on
your aggregate interface doesn't have to pull from other sites
it can simply be 5 web apps in your cluster
hello every body, is there a way to convert list to
String[]
is that the same as a mashup?
List to String[]
probably but I don't know the term
Every object in Java has a monitor table, including a current
owning thread (if any) and a list of waiting threads (if any). This
table clearly has state, although it is not directly visible to
most calling code. This object state can be partially inspected by
passing the object to the static method Thread.holdsLock().
Now if every object has state, and that state can be changed,
then by your definition of immutability, no object in Java is
immutable. I propose that a more useful, if less theoreticaly pure,
definition can be arrived at by considering the visible state of an
object.
I further propose that it is good design to have any such hidden
state hidden (for all but testing purposes) from calling code which
does not need to access it. Examples of this include internal
caching of computed or retrieved values.
It is possible that some of this internal behaviour might be
changeable from outside an object. For example a time-to-live for
an object that is cached might be set immediately after object
construction based on some policy that is external to the object.
This would call for a setter, but no getter.
not sure whether it's an official term, it's just something i
heard being touted at an ibm conference
not sure whether it's an official term, it's just something i
heard being touted at an ibm conference
well yeah, I know the idea I think, it's like making an app out
of data from an rss feed and a google maps embedded on your
page
you can do that with both sources in your own lan, as an
example
and if one part goes down the rest doesn't necessarily have to
you just gave it to me, I've never seen reason in the toilet,
and you apparently are an asshole
is that a type of failover (i think that's the networking
term, not sure though), albeit from a software
perspective
I guess it could be viewed that way, but I don't know. I
think it's just a general advantage of modular systems
I'm not convinced of the utility of your definition, in that
objects which satisfy it fail to have most of the useful properties
classically associated with immutability.
also you apparently missed my comments to DRMacIver about how
I view nothing in java as truly immutable. Furthermore I would
posit that a monitor, albeit somewhat virtual, is viewed as and
acted upon as a separate entity related to the object
instance.
I'd rather see the monitor table as an unfortunate mutable
flaw on an otherwise immutable object.
finally - some reasoned comment! What properties?
Similar to my "it's immutable if you don't do stupid things
to it" defence.
indeed
hello
Thread safety advantages and an ability to not care which
instance of the object you're looking at.
If an object is immutable I can safely pass it off to other
people and not care what they do to it.
Whileas in your example if I pass my html page as simply a means
of displaying the html, some bastard might reset its cache
timeout.
is there a way to use PreparedStatement with a variable
number of parameters ("?") besides constructing the sql-String by
hand?
Its values can also be relied upon for identity (i.e.. keys in a
map)
there's a sql Array type but I think only a few dbms's support
it
unless that were a one-off setting or inaccessible to the
recipient.
also they usually view it as an individual type (but often
allow it to be used as a source of input like a
subquery)
valueForThatField ), it is assured that only correct
fieldnames and values are given, but I don't know the actual size
of the map
HashMap implements .size()
hmm, let me check
so lock it if you have to, and you'll be fine
yes, but I need to put the contents of the hashmap in the
statement
yes, and?
I know understand the significance of the "automatically" in
"Whoever tells you that Immutable objects are automatically
threadsafe should be laughed at"
s/know/now/
statically defined statements are not always viable
Yeah. Immutability is very helpful for thread safety. It's
just not in itself sufficient.
I'm happy to call objects which are only internally mutable
immutable.
say, I do a "INSERT INTO foobar (?, ?, ?) VALUES (?, ?, ?)", but
I don't know the actual number of "?" I need. I could do it by
concatenning "?"s with a loop over size of the hashmap, but that
seems quite "unelegant"
(As long as they don't expose it)
it is inelegant but it's probably the best way
But if when I pass my object to someone else they can change
its internal state, I think that's clearly mutable even if they
can't see it
ok, then I think I will live with it. Thanks
I think I prefer that too. As cybereal points out, the setter
is probably bad design if the object is supposed to be
immutable.
Although I'm considering adding a package private setter to
an immutable object for my library.
An interesting point to bring up is that I write interfaces
that imply immutability but the objects themselves are not
immutable. It just muddies the water and further dillutes the value
of the term in this type of language.
uAn interesting point to bring up is that I write interfaces
that imply immutability but the objects themselves are not
immutable. It just muddies the water and further dillutes the value
of the term in this type of language./u
that's the idea behind what I just mentioned, I have these objects
that implement an interface that's viewed as immutable but the
object is mutable and it works gloriously in its setting.
(The intended usage of the setter being 'here's where to record
the cached value for my method when you work it out', but the
implementation is external to the class for technical
reasons)
There is also the idea of being immutable after a point, i.e.
after a certain act has taken place, or initialization
finished
like you could set parameters on a HttpResponse but as soon as you
start writing it should become immutable
Yeah.
It's important to take a pragmatic approach to these things.
Whatever you do, Java isn't going to turn into Haskell. So trying
to do everything in an ultra pure immutable manner just turns your
code into a mess.
(I know, I've tried it)
The thing you have to remember as the general ideas behind
these terms and concepts are ALWAYS going to have exceptions.
People go out of their way to invent them.
So, be as immutable as is useful and no more.
const MyClass& value
I miss that stuff from C++
ruby has a freeze() method that makes an object
immutable
I remember a program in Turbo Pascal that used constant
pointer references to get around some namespace issues, as you
couldn't do things that had circular dependencies, like self
calling functions or imports that import each other
DOesn't it also have an unfreeze() method though?
heh
oh gdi, I need sleep before tomorrow, it's been scintillating as
usual
Sleep well cybereal
o/
hmm - ruby is evil:
http://www.oreillynet.com/ruby/blog/2007/04/ruby_code_that_will_swallow_yo.html
~evil
only morons use the word "evil" to refer programming practices,
IDEs, etc.
hallo
Flexibility isn't inherently evil.
You can do all sorts of strange things with reflection and
classloaders. But if you look at how they're being used in JEE5,
you'll... hmm. What was my point again?
evil is when too much flexibility gets into the hands of
people who will do horrible things with it
Like me.
then there are things that have very limited good uses, such as
goto
Hm
~random access file
I guess the factoid 'how to use file choosers' might be
appropriate:
DRMacIver, how to use file choosers is
http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html
hi. i've got a little problem... i've written a gui, that
opens a window with an image in it, via file chooser. now only in 1
of 3 cases the window is being enlarged to show the whole picture.
most of the time it's very small (~5x5xp) and i can't figure out
why. anyone any pointers?
or even C macros
did you pack it?
there's not only the picture, but all the controls to
manipulate it in that window too.
uhm... actually i don't know what that means.
~tell eNTi|notebook about javadoc Window.pack()
eNTi|notebook, please see java.awt.Window.pack(): http://java.sun.com/javase/6/docs/api/java/awt/Window.html#pack()
thankx
yes that helped a bundle
thank you
ok