ok so i upload my files to someplace outside my war but then i want in teh simplest case an html file fileshtml

or what that be tends to 1. probability etc
*would that be

I'm off the phone again… I tried to keep the J2EE crud to a minimum (servlet and JSP only) where I could. I was tempted to use EJBs just to be a dick.

ironic. busy working on an ejb-less j2ee web hosting crud myself
heavy use of custom tags. they rock
when used properly.

g[r]eek: ejb3 works well. ejb2 is a festering shitpile.
g[r]eek: eg, not jstl sql tags?

yeah.

hehe no problem. i might as well learn ejb too

g[r]eek: or just write some code using them (and then discover servlet injection doesn't work in any non-beta jboss yet)

hehe yeah, pain that. what jboss hosting you running?

I can rewrite that example using jboss + ejb3 instead of JDBC if you like.
4.2.1.GA

i'm using 4.0.5ga - nice and stable

I've tried 5b2 a couple of times, it still has teething issues
and yet another thing to deploy via XML

hey o, i don't suppose you have any ideas on that getResource problem i was doing before, do ya?

g[r]eek: whats tss?

we're running 4.2.

they hate spring, so they reinvented spring as "pojo deployers"

(4.0.5ga has some bugs

theserverside.com

oh right, it was you and not g[r]eek
g[r]eek: sorry about that

ojacobson:

I'll cook up an example that works, one sec

mk

nahh, its ok.

mon diue
there's no StringBuilder.clear() method?

setLength(0)
is the best way

except I want to actually reuse the instance

you can

that allows you to do that
setLength is not permanent, it just changes the current length

setLength doesn't change the capacity

no, that allocates a new array. and when I call setLength(25) again it allocates yet another new array

no…

repeat after me - "I am not smarter than the garbage collector yet."

muahahaha. Finally!

http://pastebin.stonekeep.com/629
that's the current situation. myPrefs keeps returning a null

It's great to find a bug workaround from a bug submitted in 2002 still is a workaround, and still not fixed!
I can not copy/paste from Office/Open Office into a HtmlDoc. Unfortunately I can't go the other way around, but oh well

meeper, setLength only allocates a new array if the new length is greater than the current capacity
see line 144 of java.lang.AbstractStringBuilder.java

~tell meeper about javadoc stringbuilder.setlength(int)

meeper, I don't know of any documentation for stringbuilder.setlength(int)

in JDK1.5.0_10 anyway

~tell meeper about javadoc stringbuilder.setlength(*)

meeper, I don't know of any documentation for stringbuilder.setlength(*)

stupid stupid bot

~javadoc stringbuilder

[krustofski], please see java.lang.StringBuilder: http://java.sun.com/javase/6/docs/api/java/lang/StringBuilder.html

~tell Fanook about tool

Fanook, A tool is only as good as its user. Tool.

ok ok already

/win 13
oops

/lose 1

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6392086
Whyyy?!?!?!

well that's interesting. the bot's javadocs are incomplete…

no, he's just case-sensitive on method names I think

That whole Javadoc bit is pretty much re-written, away from the xml thing.

no, he's case-insensitive for the docs afaik
it's just missing some methods
hmm, i may look at that later now

look at what?

Fanook, what is it missing?

has it moved to a db

heh

StringBuilder.setLength(int), for one

cooking demo, almost done

~javadoc stringbuilder.setlength(*)

I don't know of any documentation for stringbuilder.setlength(*)

k

:-o

wow my security is all borked. i'm using declarative model, and have pretty much put the entire web-app below the webapp_root/secure/ folder. but i also have a .htaccess file which prevents directory listings. so when i link to an uploaded file that is sitting below WEB-INF, and try click on
it, i get File Not Found error…

something feels very wrong with this whole picture and i'm too darn tired to give it a proper think-through… :
~javadoc StringBuilder.capacity

I don't know of any documentation for StringBuilder.capacity

like i said, too tired.

~javadoc StringBuilder.capacity(*)

I don't know of any documentation for StringBuilder.capacity(*)

WEB-INF is not served

hmm, it doesn't like stringbuilder. does it?

speak to me oh might ojacobson
+y

Nothing in WEB-INF is served as a resource under the servlet hosting URL.
er,. context URL.

this is all confusing me. i read somewhere that uploaded files go below WEB-INF so that they can be linked to / downloaded from your html output

er, we may be using contradictory meanings of "below"
below to me means WEB-INF appears somewhere in the path

sure i could write uploaded files to any folder on the system that i have write access too, but then my browser users cannot link to it
root/WEB-INF/folder/file-below-web-inf
i reckon my htaccess is the problem.

WEB-INF exists to be a location besides META-INF (why, I don't know) where resources can be placed that will not be served by the servlet container
if you point your browser at http://example.com/mywar/WEB-INF/web.xml, you should (conforming impl) get a 404, not the web descriptor.
if you point your browser at a href="http://example.com/mywar/WEB-INF/web.xml"http://example.com/mywar/WEB-INF/web.xml/a, you should (conforming impl) get a 404, not the web descriptor.

in web.xml, set to a 404.html page

http://bast.lionsanctuary.net/svn/beanwar-example-parent/resources-demo/src/main/java/net/lionsanctuary/examples/resources/DumpTextServlet.java

yup
whats up?
oh was i interrupting, my bad

http://bast.lionsanctuary.net/svn/beanwar-example-parent/resources-demo/src/main/webapp/WEB-INF/web.xml
hello.txt ends up in WEB-INF/classes/
(maven build, root is up from there at resources-demo)

so you use Thread.currentThread

talking to me now?

i'm not sure if i've done that.

suggesting i try go below WEB-INF/classes

g[r]eek: both of you, really

heh

eidolon's problem is very similar to yours, but without the upload part
WEB-INF/classes/ is the package root for class files and resources "baked into" the war file (rather than as JARs)

so i don't understand resourcePath
i have my build.properties in WEB-INF/classes.

ok

so it should be 'on the path',yes?

So you'd refer to it as /build.properties
(since it's at the package root)

im still getting 404

ah.

g[r]eek: since you're storing uploaded files, you should probably store them above (outside) web-inf, not below (in) it.

is it okay that i browse your svn?

if I didn't want it to be public, it wouldn't be public

i've done a simple test case. i've got my exploded war. i've stuck hello.txt inside mywebapp.war/WEB-INF/classes/uploads/hello.txt - and hard-coded this link (full url) in my webapp, tried to click on it, 404.

g[r]eek: that's as expected
move it to mywebapp.war/hello.txt
Ideally outside your WAR structure entirely (even though it's a dir and not a war host file) but baby steps, right?

man why would this article go on about uploading files to somewhere below web-inf. totally thrown me off

Because "below" is imprecise and probably meant something different to him

AHA

http://bast.lionsanctuary.net/svn/hello-world/trunk/src/main/java/net/lionsanctuary/hello/HelloBean.java

yeah - i figured that makes more sense too, since then im not limited to _having_ to deploy exploded wars

i love that.

InputStream myPrefs = getClass().getResourceAsStream("/build.properties");
that worked
just adding the /

It beats "brillant!", right?

yeh

for what it's worth I tried it with the servlet context first

I should code — but i can't think straight tonight :/

heh
it was the hard path that did it.

Clearly I need to read up on the servlet context resource lookup first

that'll help

i feel ya.

grab roller-dist/trunk and run it
(you'll have to check it out, it has externals

ok so i upload my files to someplace outside my war. but then i want, in teh simplest case, an html file (files.html) which is in my war (browsable online) to have a list of links to these files that were uploaded. but it won't allow links to anywhere outside my war right? so i'm basically
forced to having it at mywebapp.war/uploads correct?

g[r]eek: hueh?

do i need to deploy or anything?

Oh, I see.

you recommended i upload files to a location outside my war structure

no, it's a standalone swing app

but then how do i have links to them?

g[r]eek: oh, yeah, you'd have to write a servlet or something.
commons-fileupload may have one.

thus, since i need this direct linkage, i'd have to have the files uploaded to someplace like mywebapp.war/files/
ok

Both for listing them and serving them.
(note that resources inside your WAR are served via a servlet too)
(at least under tomcat)
In fact if you ever need a good laugh find the 4.x source for DefaultServlet

hey then at least i can write my files to somewhere completely outside of my war hoorah

(the servlet used for resources)

no more exploded dirs.

war file = yes

thanks for help

and to think
the extent of my servlet programming was "I know how to get Struts up and running" a few days ago

I need to get a subversion repo set up and i couldn't :|
i clearly suck.

~ridicule r0bby
Need a hand? I'm in #svn too.

holy crap, I think I found a jvm bug

nah

you're imagining it.

I'll use IDEA's local version control

Hi all

actually it might be a bug in IDEA's compiler…

you only started coding servlets a few days ago? and you know so much? are you for real?

time to bust out the javap

Is there a way to show all the reference to a variable in a project in Eclipse?

your server crapped out on me

g[r]eek: I'd written "hello world" a few years ago as a servlet

i use Sun's compiler..

rather don't answer that and save me from my misery

yes. highlight the name, right click-references

g[r]eek: but beyond that, my day job is mostly arch with some struts thrown in as punishment for my crimes

and he cursed at me with it!

architecture? cool

Fanook, Thanks a lot!

hands-on arch, not uml arch

working on out-sourcing some work myself

eg., I write code that sees production, not diagrams that see managers

i quite enjoy it

oh, fuck, I probably didn't fix the externals there yet
one sec

heh

(Moved from "verdandi.lionsanctuary.net" to "bast.lionsanctuary.net" earlier this year)
Try now.

verdandi? manga fan?

No, not from ah my goddess.
Goddammit, why does everyone…

so just mythology?

Yes.

cool

You're like the fourth person to ask that.
(heh, "belldandy")

hehe. there are many of us…and we're all annoying

(best mistranslation ever)

i name all my dedicated servers after greek philosophers and / or mythological gods

pfft, just because japanese doesn't have 'v' or 'r'…

This year's crop of names are all egyptian
bast, hathor, osiris (my mac), isis (my ipod)

hiro nakamura

oh, i forgot to ask, what came of the dumbass autoupgrader complaint?

i spent monday morning re-installing it before doing any work. it's happy now. boss is on vacation this week
0 to around 1, not counting

g[r]eek: if it helps any, the reason I grokked servlets so fast is because I finally got irritated enough to find out what the ejb-ref element in web.xml is *supposed* to do
and promptly lost three days reading the java ee specs

fair enough

if you've been working with it on gut instinct for a while, the specs make more sense.

guess i coulda plagued you with API questions to make myself feel less noob

you could've. I would've pointed you at the javaee javadoc a lot though

touche.

jboss setup, deployment descriptor issues, packaging and other stuff less javadoccable, though…

gotta say, i love that about javabot. i might not know the answer to a question, but i can always come across as if i do

(btw, FUCK jboss's documentation.)

yeah, i went through a period of writing down _everything_ when it came to configuring jboss. i can do it blindfolded now
there documentation is intentionally ill i'd say. to, uhm, "encourage" their "professional" open source business model

g[r]eek: and adrian in the forums is a complete and utter cock.

haha
dimitri andriadis

If I ever find him I don't promise to kill him, but he'll probably wish I had

machine.
(jboss AS lead)

So can I blame him for hot-deploy being broken in jboss 5, then?

and for many other things, yes

4.0.5

Man, I hated that thing

because installers are lame?

it's been convenient in my case

Besides, the 'default' and 'all' configs in jboss 4.2.x are actually fairly thorough.

setting up jboss in one command via ssh is great

that command being "unzip"

g[r]eek: get this one.

heh

POJO web services in jbossws 1.2.1 (jbas 4.2.0) can have WebServiceContext injected, but not EJBs (since they run in the servlet container)
EJB3 web services can have EJBs injected, but not either MessageContext or WebServiceContext.
That's the kind of eye-stabbing thing that makes me hate the entire jboss edifice.
(There is no plan to fix that, and installing jbossws 2.0 on jboss 4 is a bitch)

yeah but marc fleury is such a nice guy :/
:P

anyways, my machine naming is somewhat eclectic. i currently have thinker (winxp desktop), athena (slackware), pan (ipod), and coder (winxp laptop). in the past i've named my main box Q, but felt like a change this time

one-letter hostnames are nice when you're doing remote admin

'shutdown -h now'

heh. i was thinking more star trek

athena ftw

aye. goddess of technology and strategy
oh, and wisdom

The two servers I used to maintain as a volunteer were kepler and copernicus

k i was thinking of wisdom
indeed
hehe

~literal c2

I have no factoid called "c2"

~literal c2 $1

http://c2.com/cgi/wiki?$1

awesome
~c2 AnAthena

ojacobson, c2 AnAthena is http://c2.com/cgi/wiki?AnAthena

No further comment (

heh… our core servers were melkor, gorbadoc, sauron, meriadoc, bilbo and smaug

hurr
Is the monitoring system named palantir?
If not, you fail it

~ojacobson++

ojacobson has a karma level of 15, g[r]eek

I managed to name the core machine in the UK butterbur

struts2 sucks less, but louder

orange80!

(seriously, the stacktraces are longer than even jboss can manage.)

r0bby!

wicket++

g[r]eek: trust me, writing servlets will drive you to it eventually.

wicket+=200;

we've built up somewhat of a decent reusable custom tag library :/

the wicket i've seen made me wanna have its babies

that's purely for the sake of avoiding jsp coding

No JSP!!!!!!

i'll remember your point when i do indeed grow tired of servlet

g[r]eek: Well, that's wise, but shit, dude, if you're doing enough with JSP to need custom tags, consider getting a real templating tool

No ActionForm horseshit. No XML magic hell.

(since that's all JSP is good for
oh, fuck actionform

seriously, if you know swing, Wicket should be comfortable, then you write a simple HTML file.

that was the one thing that sold me on struts2 as a struts user

haha

and it's _REALLY_ easy.

Exactly

(granted, struts2's habit of making each action a stateful, disposable javabean is kind of weird, too)

form fields)

finally that damn calculation works… I didn't know that you can't use the resultset to update in a query using a join… actually that renders such update-capatibilities pretty useless…

we don't care

I do, I was there.

meh i'm zonked. later fellas. bed time.

so besides doing a fake iteration over the table I also have to do a single update for every single sql-update-statement row on the table… fun

I never used it anyways
Updatable rowsets are less cool than SQL

well… i think it would be pretty straight forward if you have something like an "iterator-like" resultset that you could simply modify the row which just came in… it would also possibly result in less seeks of the hard-drive… but noooo, you have to do like 2879875 queries with
intermixed updates… I think that's pretty bad in performance…

nobody cares

next you'll tell me tacoma narrows had design problems.

I mean, my cpu load is so low, I could even use the tower as a fridge…
while the hd seeks and seeks…

"I think" and talking about performance don't misk
mix
measure and test
that said, consider breaking down these huge transactions into smaller, logically isolated transactions

What do you do about a neighbor's dog that won't stop barking?

Databases (at least good ones) are reasonably good at keeping pages in RAM if possible
if yours isn't, stop loading the entire table every time (indexes!) or turn up the page count
refactor into a separate Dog class and VoiceBox class
leave both on your neighbour's porch

hah
I Like it

well, it's one table… from top to bottom, last column needs to be calculated… 4 log10(), a factorial… and that acutally should stress the cpu if the hd could only give me more than 2MB/s

calculate on insert, or calculate at select time
(which also makes the row uneditable, but at least then the value is guaranteed correct)
If you do calc on insert, do one massive update to calculate all the existing rows first, then carry on
(If I understand right, the last column contains a function of the other N columns for that row)

yupp… it's an association measure on word cooccurrences… the db is not in a live system, so I'm the only one on it… still I think "it could all have been soooo nice and easy"
which in most cases is true for java

You are, of course, free to find or write a DB driver (or wrapper layer) that supports what you want
(But that's a useless suggestion; don't take it seriously)

well… next time I'd go for writing a plugin for mysql, which would most probably be the fastest way (implementation + runtime)
u well… next time I'd go for writing a plugin for mysql, which would most probably be the fastest way (implementation + runtime)/u

postgresql + calculated index?
(postgres has the charming ability to index on, say, 'LOWER(username)'. Uniquely, if you want.)
(Works with UDFs, too.)

well… postgresql would indeed be a charming alternative…
whicked… that even supports factorials… WHY DID I CHOSE MYSQL?

Familiarity?
postgres has a slightly larger coefficient of administrative friction, too
less mysql_admin and more emacs postgresql.conf

how can I log with a custom level? (i.e. having a Level variable)

what's Level, org.apache.log4j.Level?

… yupp… but I think the time for coding all the calculations in java would be sort of equal to the time of setting up postgres and writing a single sql-statement

hm… good point

question, actually, and honet too, but if it helped…

the slf4j api seems to include log4j Level and Logger, but it works with its own slf4j Logger, I'm not sure how they are tied together

I'm reading now
It looks like the slf4j is a wrapper… you'd have to use the log4j logger directly instead
(why yet another logging framework? Argh!)

I'm not actually using log4j in this project; the point is I should be able to replace the actual logger with no changes in the code

that should be the name for a yast logger

yalf? definitely.

:P

but the slf4j logger doesn't seem to have a log(Level, …) method

so I see. The log4j adapter does, but then you're losing some of your flexibility.
Stop wanting that, or change logging frameworks to one that does what you want, or ask the slf4j guys

I'll try to find out what those log4j things are doing inside slf4j

*nod*

hm.. so you guys were talking about mysql vs postgres? I found mysql to be too lenient and postgres too anal :p

~mysql

whaley, mysql is a network-attached spreadsheet used by pr0n sites and other dodgy entities across the Internet. You can learn more about it at http://www.mysql.com - free download of the open-source version, including JDBC drivers.

~postgresql

whaley, postgresql is a highly scalable, SQL compliant, open source object-relational database management system. See http://www.postgresql.org/

lol

well, at least the bot's not biased

bet you can't guess which one we're biased to :P

~mysql

ojacobson, mysql is a network-attached spreadsheet used by pr0n sites and other dodgy entities across the Internet. You can learn more about it at http://www.mysql.com - free download of the open-source version, including JDBC drivers.

wow.
~firebird

ojacobson, I have no idea what firebird is.

travesty!

~oracle

I guess the factoid 'oracle linux' might be appropriate:

~db2

aditsu, oracle linux is an interesting way for Oracle to get new customers by offering RH Linux, their service, etc. pr3d4t0r wrote an analysis piece about it here: http://www.theserverside.com/news/thread.tss?thread_id=42818
whaley, I have no idea what db2 is.

I work with DB2 for my day job

~berkdb

whaley, I have no idea what berkdb is.

you know why I like db2 v9?

~sql server

I guess the factoid 'postgresql' might be appropriate:

ALTER TABLE DROP COLUMN. That's all it took

aditsu, postgresql is a highly scalable, SQL compliant, open source object-relational database management system. See http://www.postgresql.org/

~pm

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

haha

~~

ok, back to work
haha Fanook
way to try tricking the bot and failing miserably

who said i was trying to trick the bot?

~=.

aditsu, I have no idea what = is.

that was a flea with a flamethrower…

~shoot aditsu

boom

~aditsu++

aditsu has a karma level of 16, whaley

you guys are really united

~sucks

All software sucks. All hardware sucks. The best you can do is pick a poison that tastes good.

~tell aditsu about russian roulette

aditsu, click

~api barbie

I guess the factoid 'be api barbie' might be appropriate:
Javadoc is *hard*!

hmm… it seems that slf4j has a log4j wrapper over it! I'm getting dizzy…

ow, my brain

so you log to log4j, which sends to slf4j, which sends to whichever logging library… hm, kinda makes sense, but… so convoluted

well, presumably that's to support apps written with log4j logging to something other than log4j

yeah
it just has the log4j "interface"

logging frameworks, much like web app frameworks, will eventually destroy the programming industry.

hopefully the really bad ones will eventually die…

commons-logging is still with us.
I am not optimistic.

well, it's partly the classloader system's fault
so anyways, the core slf4j api has no notion of "level", I guess I could make my own

good night

so strange that it's missing

jesus backpedalling christ
why must jboss open every service known to mankind to the network at large and go "COME 'ERE, BIG BOY"

because it likes to eat firewalls?

If that's not bad enoug
It also exposes every JMS queue, JMX object, and EJB via http, too
(relatively) easy to turn off, but still
As defaults go, that's pretty brain-damaged.

haider everyone

is it possible to reverse a modulus?

did you just say 'hi there' in stupidese?

it is an auto-join message :P

so….yes. ok
anyways, to your question. do you know the base of the mod?

yes

cool, I wrote my own SLFLevel enum and SLFLog utility class, problem solved

then yes. it's simple arithmetic
er. wait, duh. no

heh you'd have to already have what you would want to reverse to in order to reverse to it

You can narrow it down from "somewhere in Z+" to "Somewhere in this subset of Z+", but that's it

mod just gives you the remainder. you still need the quotient

That subset is still excessively large

if you want to get a, you need b, c and d (all of them)

if you have both the quotient (/) and remainder (%) and the divisor it's trivial
if you're missing any of those three it's much harder or impossible

lmao if you have all three then it's DONE it's not trivial, it's finished.

i'm trying to find the original number
before i used it in the logarithm

To no avail!

logarithm?

yes

~show us
dammit!

then you should already have the original number

Pastebin the code, you're being unclear enough that I'd rather see than be told

int i = 5368;
i = ((i 16) % 500);

oh.
No.

in this case though
i want to find the 5368

What you ask is impossible given what you have.

you have it, it's i

i know

and there's no logarithm there

but imagining that I do not have original

that is throwing away data so you're SOL

both the and the % are

it bitshift before I use the modulus though?

yep

bii*

parens say it do
and … you just INcorrected yourself

yea :P
anyway
bitshifting can easily be reversed
by bitshifting in the other direction

haha no

you realize you're asking "I have a black box which output n. tell me what number i started with."

bitshift throws away the bits, it's not rotating them

if I have a number 5368
and I bitshift it 16 left

you can only reverse if there was no overflow

i just tested it..

for any given integer x, where 0 = x 500, x % 500 will be x, (x + 500) % x = x, etc

~wb

so you have one case, out of a possible Integer.MAX_INT

1 == 0

Thank you, aditsu.

hmm

Instead of reusing i, assign the expression to (say) j
and keep both variables.

http://pastebin.ca/651933

16 == 0xFFFFFFFF. Keep saying you're not losing information…

ah sign extension. what joy

well, there's

he still loses information

so what are you trying to do, undo a hash?

not in that particular case, but in general, of course it loses
haha, that would be the ultimate compression alg.
put the whole internet on a floppy :p

compress everything down to a single bit!

Somewhere in this zero bit is all my porn
dammit fanook

that's an old WTF

irc…. channel…. text…. blurry…. need sleep….

caffeine perfusion running out?

0 each

that
that's when i usually start coding. granted i'm getting home from work around 6:30-7:00

I had the internet on a floppy
until I found porn then i had to put it on a hard dsik

did it have AOL written on it?

hehe no, actually I had a floppy with all the tools necessary to fully use what the internet was at the time in dos

0, and my normal routine is to eat, watch an episode of something that's 30 minutes over dinner, and then get to

so like, a ppp TSR, and clients for stuff like telnet, ftp, gopher, archie, and even a web browser, arachne

but i can only go for about 3 hours at night after a day of work

hm.. bbs days ^^

yep

I found that after a day of work, and 2 hours spent commuting, I don't really want to code anymore in the evening

I sorta have to do… if i want to finish my masters at least
-do

full-time job and masters? ouch

trying to wrap up a thesis that I've hardly written
well, i'm done with all of the courses
just have to finish writing a thesis and I'm done…. but I spend the majority of my time writing code for the thing

what are you doing that for anyway?

do you mean the degree?

yeah

i was an mis undergrad, but i discovered shortly after that I liked coding
so I took a masters program and originally studied software engineering
i had a scholarship, mind you…i wouldn't have done it unless it was free
but after a year I dropped the whole software engineering bit because I thought the courses were kind of lame and started a research thesis instead

heh
well, good luck with that then

this thesis is a royal pain in the ass… but I've learned infitinely more form it than I would have from sitting through 2 more lecture courses
thanks
s/form/from
im tired

what is said thesis in regards to?

[krustofski]: collaborative filtering/recommenation using the netflix prize dataset
*recommendation

agh yes, you showed me that before
or well mentioned it and i looked into it

i hit a roadblock earlier… the cluster i'm working on back at the univ (in nc… i'm in cali now) upgraded its storage to some massive san… but managed to lose all of my files with no backups
this was on tuesday night
i was going to re-run bunches of stuff anyway… but now I guess I have to

hm, i have a noobie question…
anyone about?

Nope
~next

http://rifers.org/paste/show/5237 is probably not what I want a public-facing web service returning in event of violent failure.

Another satisfied customer. Next!

damn!
hehe
ok well il ask anyway
maybe someone will show up

wise.

if i have 2 points (x1,y1) and (x2,y2), which are floating point numbers. And I want to subtract on point from the other. Can i do (x1 - x2) and (y1 - y2) to give me the new subtracted point?
is that accurate?

within the limits of floating point subtraction, it will be as close to -1 times what you want as possible.
You probably mean (x2 - x1), (y2 - y1)

im working out the distance between two points
so i can predict a collision

Ah, so it's irrelevant.

phew, ok, just wanted to check before i went ahead with it

If your numbers are relatively small (single- or double-digit power of ten) and close together then double should have more than enough precision

doesnt have to be perfectly accurate, im using pythagoras theorem to calculate the collision and such

ew, don't do that

dont worry, il try sphere - sphere after that

calculate the square of the collision distance, and use the square of the distance. Multiplication is way faster than sqrt. Usually. (Profile and see, of course.)
(square with x*x, not pow(x, 2)… pow will be about as fast as sqry)

hm.. okay

so.. is a HashMap thread-safe if it's statically initialized and then the code only reads from it?

cheers guys, im sure il have more questions hehe

If stuff only reads from it, there is no modification, and it doesn't need to be thread-safe.

by thread-safe I mean it will work properly when accessed concurrently from different threads
(for reading only, in this case)

so long as comparison and hashcode implementations are thread-safe, yes, it should be
that's one of those wonderful assumptions that's not actually guaranteed anywhere; my answer was based on examining the implementation but it's possible sun could change that.
TreeMap, for example, could (if it were evil) rebalance on reads
semantically empty but would make concurrency hell

Is it possible to do an HTTP connection with a URL object, but use a different name for a Host header.
I want to connect to 10.0.0.1, but send foo.bar.com as the hostname
With any object for that matter

even if it doesn't actually modify the map, a bad implementation could use a private field for searching in the map
or something like that

~tell fifo_ about httpclient

fifo_, httpclient is http://jakarta.apache.org/commons/httpclient/

iirc, you can set all of the headers manually with that library when making http requests

grr, java.util.logging.Level is not an enum and the api doesn't seem to give me a list of all the levels

I 3 JNDI *spit*

besides, they have very s**tty names

Do people somewhere actually use java.util.logging? That'd be news to me, but I'm kind of parochial.

well, yes, the only advantage being that it's included in the api/jre
we'd never use it on the server side though
slf4j makes it bearable, but I still have to deal with the util.logging for handlers & stuff

Hello

^(\d\d\d)+$, will i always get one captured group, or a different number of captured groups depending on how often it matched ?

string needs a startswithignorecase method :|

I have a MySQL table with some settings of an external device. If any settings on the device are changed, the device sends the changed settings to the server which stores it in the table

Or you could, ya know, string.toLower().startsWith(string2.toLower())

yuck

peace-keeper: if it finds a match, you're guaranteed 1 group. i assume you'll get none if no match

Hey, it gives the desired result.

hello

kamoricks, ya, i could but bitching so much more productive

yeah, but what if it matches more than once, e.g. if i apply it to "123456" ?

how do we feel about java mail? does it scale well?

peace-keeper: er, on second thought. you might get multiples. tias

the proper way is with substring and equalsIgnoreCase

peace-keeper: it won't match at all

why not

peace-keeper: or it will match all of it
I missed the +
anyway why don't you tias?

good idea

aditsu, orly?

[krustofski]: yarly

who decides whats proper nowadays

everyone on their own

now I'm not sure if I should create a new dataset with only the changed settings or find a way to read the last whole dataset (=row), change the new settings in this row and write a whole new dataset. I need a new dataset in order to keep a change history.
What would you guys do?

aditsu, well then i want a damn startswithignorecase!

Who made String a final class anyway? -.-

ok i tried it out and the answer is it returns only one group, which contains the LAST match (i.e. 456)

[krustofski]: talk to Sun

just in case any one is interested

peace-keeper: interesting…are you sure about that?

sure i'm sure

then we're testing different things. my test captured the entire string

you got + inside the )

did you use Pattern and Matcher ?
and matcher.group(1) ?
not matcher.group(0)

nope, copied the pattern as given
peace-keeper: i'm outputting all groups captured
~pastebin

http://rifers.org/paste

http://rifers.org/paste/show/5238

See Anonymous Coward's post at http://rifers.org/paste/show/5239

lol i'm the anonymous coward
yeah you only output m.group(0), but you should output m.group(1)
group 0 always exists and always is the entire input

ah

isn't it the entire matched input?

yep sry
in our case that's the same

yep, but matches() tries to match the entire output, returning true if it does

it matches the output but the group selected is only the tail of it apparently

no, the matches tells us that the entire input is a match, stored in group(0). it happens that the tail ALSO matches the pattern and is stored in group(1)

does import java.util.* generate worse code than say java.util.ArrayList; ?
or does the compiler only compile what it needs?

it doesn't really matter

if it doesn't match the entire input, it doesn't store any groups

it's just a matter of taste

but from the programmer's perspective, it can potentially add more to your namespace than you want

imports just tell the compiler where to look for classes. that being said, .* imports can lead to name collisions and less clear code

i thought so

Hi Guys. Does anyone know how to change how TabbedPanes appear when run on a mac? Rather than wrap to the next line, if there's multiple TabbedPanes you get a drop down box that lists the rest

I just like 7 java.util.something imports, and was thinking should I just do a .*, cause I have 11 import lines

in eclipse you just press ctrl+shift+O, and select what you want from a list

i.e., never import both java.util.* and java.sql.* you'll get a collision on Date

hmmm ok

kamoricks, even worse than the final String class is the final URL class

they should have made Object final…

and private

package-private!

btw
why isnt URL a subclass of URI ?

jboss' classloader strikes again

peace-keeper: why would it be? URI isn't a parent of URL in concept, it's a replacement or really, a clarification
peace-keeper: that being said, it's probably the same reason that StringBuilder and StringBuffer don't live harmoniously in some kind of hierarchy

but every URL is a URI..

no it isn't
ever URL is a URI *instead*
there is no such thing as a URL if you are a standards nazi

Hola.

the concept is deprecated

all URLs are URIs, but its only a subset

much like StringTokenizer?

no, URL are URI like Tomato is a Fruit not a Vegetable

URI is just a way of pointing to a resource, URL is too, but only a subset of the all, like http ftp etc

I'm sorry you are wrong

but anyway, url is going the way of the dinosaur
as a "specification"

URI propagated as a replacement to URL which was more generic, not a parent definition or some such nonsense

i didnt mean it was a parent

you are trying to say there is some relationship, well the relationship is URI replaces URL entirely such that URL no longer exists at all in such scope

yep

and alas, this is why it makes sense for URL to not be a subclass of URI or vice versa (which would make even less sense)
of course you'll notice they both have conversion methods for horizontal translation

Anyone know why if I scale an image down and add it to a JPanel it turns out all black on a mac (works fine in windows). If I remove it and re-add it , then it appears fine
is that going to be a memory issue?
I'm readding the same image

Perhaps you're doing it incorrectly but the implementation is more forgiving on sun's vm

quite possibly

before you bother any further you should search around for similar problems to see if it's a known bug

yeah i found similar bugs but they are supposedly fixed
although i found another one earlier that said it was fixed on 6 beta 2 and it wasn't
you can't copy from word or open office to a htmldocument without a workaround. I still can't figure out the other way around though
But the workaround on sun's site worked for one direction
There's quite a few people ending up with black images on sun's forums, it's the readding that doesn't make sense. I guess I'll need to spend some time and make a small example
oh i see the problem. Exception in thread "Image Fetcher -" java.lan.OutOfMemoryError: Java Heap Space
running outta heap space!

or, leaking memory :P

Possilby, I don't see that in the profiler in windows, but maybe the vm is more forgiving like cybereal said, guess i need to run it in mac
brb

Maybe you are being assumptive about the max heap

yeah im trying to find it right now
Ok, increasing heap size allowed me to add 20 photos without a hitch (didn't try adding more). Now to see if there's a leak
deafult on mac is 640k to 64m. I made it 64m to 128m , works great

how does one use charAt to find the last letter of a word
for instance
say other = string array
and i = for loop counter
a[i] = other[i].charAt(other[i].length);

chartAt(string.length()-1)

oh

Increasing heap size does not seem like a viable solution if you have to do it repeatedly.

no the problem is on win it's default higher than on mac

a[i] = other[i].charAt(other[i].length()-1);
sounds good
when do you need the parenthesis after length
and when do you not
?

if it's a method call

k

almost always except on arrays it'll be a method call

thought so
thanks
int = (int)34.7;
works or no?

it truncates, but you don't have a variable name…
int i = (int)34.7; also it's pointless. May as well just assign 37
er 34

yeah thats what i mean

there's a typhoon here

sorry if the questions seem a bit basic, im studying for my final (pulling an allnighter during the summer, gotta love it)

morning

does anyone remember me asking about a modulo operation's answer because I was lost?
I asked about the answer to 19%5 in a Java expression

19 % 5 is a java expression, what's your question?

now I'm trying to explain the answer that someone in here helped me find, and I'm at a lost of how to explain it

You don't know what modulo does?

holy fucking shit
IT LIVES
I don't have to touch jboss again for *days*!

¿qué?

Working on a web service for something… It works as far as I can tell with SoapUI now

How… interesting…

Not having to touch enterprise is always good news.

quicke, if something is private and static, when can it not be accessted?

The JAXB XML annotation stuff is hard to grok unless you already know XML Schema, and that's like being voluntarily brain-damaged

outside the package right?

(more than j2ee in general)
outside the declaring class

~tell jblade about access modifiers

jblade, access modifiers is http://java.sun.com/tutorial/java/javaOO/accesscontrol.html

outside the class

so whats the point of making it static ?

static methods can be invoked without creating an object first

if ur not going to be ble to access it anyways

perhaps the class needs it to be static

So it can be shared across members of the same class.

don't ask such questions, it only shows your inexperience

i have a final tomorrow and im asking questions i never really thought of

someday you'll say "oh it would be good if this static method was private because it's specific to this class and I don't want anyone to use it or I'll have to add all kinds of protection measures, etc." or something like that

yeah, but why make it static
your going to only be using it in that class

exactly

'Cuz you need it static.

it makes no difference

thats all i am wondering

a static field however, that could matter

'private' tells you where you can access it from, 'static' says how.

A static method can be invoked in a static initializer

yeah i understand all the basic stuff
i was just wondering why a person would declare a private object static
whats the benefit basically

it is shared by all instances

mind making a pseudo code example ?
I have class car, with wheels tires etc..

heh

private static final int BUF_SIZE = 65336;

ok car is fine, you have a static private int nextVin = 0;

ok

in each constructor for all subclasses it assigns this.vin = nextVin++;
well that'd only work in Car instances but um yeah
example of sorts

ok that makes sense
so basically it a benefit for the subclasses

no forget that part
subclasses don't get private stuff
I have been awake too long to be tutoring

lol
i mean
Class Car{
has methods in it
private static vin

private static things have the exact same benefits as public static but they are only accessible by the declaring class

can be called in those methods
i understand that

my example was a field, not a method
i don't know why you'd do a method except maybe ojacobson's idea of using them in static initializer

what i dont understand is why declare it static when your not going to be calling it outside of tehe class

sometimes you need a helper method

Car.Vin would only be used in the car class

I had a brainfart and made a private static final method once.

the point of static is not that, it is that you don't need an instance to call the method

Bet you didn't know java even allowed that

ok
i guess that makes sense

final has other implications on optimizations being allowed so I'm not entirely surprised

circumvents getters basically

It should give a warning, though.

It did, someone here (surial?) mocked me for it

No, bigger than that. It's shared across all instnaces of a class.

yeah ok

no it doesn't circumvent getters. You can circumvent getters, perhaps using static private whatever, but that's not something it does on its own.

private methods are final, right?

as opposed to public.static which would be shared across the package
correct?

'public' makes it shared across everything.

no

no, they just can't be overridden

Like a public restroom. ANYONE can go in.

k

they are not inherited but java uses final as an optimization hint too so maybe it can make a difference, wouldn't know

ok so my question is then
why have a private bathroom lableed whites only
if u get my drift

~tell jblade about aolbonics

jblade, aolbonics is talking like a retard using speech as if you were on AIM or using single letters for you, are, you are, you're, see, etc. Talking like this is frowned upon in ##java and may result in you being silenced. You have a full keyboard so use it. We don't care if you talk like an
idiot with your friends but we don't want to sit through stuff like this: http://forums.oracle.com/forums/thread.jspa?threadID=499980&start=0&tstart=0

thank you
your input was greatly appreciated

he

~tell dangertools about he

what's the difference if you explicitly make it final?

dangertools, I have no idea what he is.

Look.

semantically nothing

'static' does not affect WHO can access it. Just how it is accessed.

some JVMs are more aggressive about inlining private final methods

ok, then that answers my question

ahh
i got it now im pretty sure
thank you

~tell jblade about static

jblade, static is http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html, also see http://mindprod.com/jgloss/static.html

light went off
i mean on*

if there's no semantic diff. and the compiler is smart, it will treat them as final anyway
s/smart/not stupid

so as opposed to going into the private bathroom through the frontdoor

mu. I program for clarity.

final things can be inlined, like in an inner class maybe, it could have an effect, but as a programmer you probably don't need to think too much on it

you can go through it many ways
i think i got it

private final then?

no.

then you're not making it clear whether it should be treated as final

~tell about void

The user about is not on ##java

~tell jblade about void

jblade, I have no idea what void is.

just ~void would be enough
no need to tell yourself

Another basic one that I skipped over, i know public void doesnt return anything

the public doesn't matter here

but hows it different from just public method(){

you cannot do public method(){}

it compiles

if method is not the constructor

oh
duh
haha im an idiot

duh!
19 % 5, that's 19 / 5 = 3.8, strip the part that is not the remainder, and round the remainder up
answer is 4

s/4/42/

wrong its 3
:P

it is?
….
is it, or is it not?

it truncates, not round.
3.8 becomes 3.

19/5 is 3, 19%5 is 4

19 mod (%) 5 would be 3
so is 19/5
mod is remainder

wrong
19-3*5=?

who in here agrees the answer is 4?

~tell jblade about math

jblade, barbieMath is hard, Ken!/barbie

lol
doh
your right

sure

the answer is 4, but has nothing to do with rounding
it's all integer math

i blame spider pig

hehe spider pig!

if it has nothing to do with rounding, then how did I get the correct answer by doing exactly as just described about 2 min. ago by me?

r0bby, what are you talking about ? % is mod, it doesn't truncate it gives the remainder

if it doesn't have anything to do with rounding, then the way I figured out the correct answer will break given a more complex expression

does anyone uses java code in comments ?

~abstract

jblade, abstract is http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html

ferret you don't ’round the remainder up'

i was thinking integers sorry

19 / 5 is 3 remainder 4

im tired

no problem

whats the point of an abstract
seems like an interface

because the remainder rounds up to 4

so 19 % 5 is 4

but not

no
not because the remainder rounds to 4
the remainder IS 4

it is a lot like one but you can't implement it, but you can put code in it

i guess interface can only containt static and final right?
yeah i understand that

wtf?

you cant implement it
i understand that

jblade abstract class has also and implementations on it
public abstract class MyClass { public String add(String a,String b) { return a+b"; } public abstract void someMethod(); }}

an abstract class is just a partially implemented class

this child of this class has to implement someMethod

javabot tell jblade about interfaces

jblade, interfaces is http://java.sun.com/docs/books/tutorial/java/concepts/interface.html

and can use also method add
that is in parrent class

I'm algebra age

mgneov, then it cant… what?

you probably need an introductory java book for beginners

prolly
or a better teacher
the fact is, i understand a lot of the stuff when i code it

ferret_0567. You should know division in algebra

i just cant explain it

mod (%) is defined such that, for a DIV b = c R d: a = c * b + d. a / b = c, a % b = d.

ferret_0567. % means remainder.

where DIV is complete integer division

~base

I guess the factoid 'database' might be appropriate:
There are many database engines for/written in Java. See database section at http://javafaq.mine.nu/ and check out http://developers.sun.com/prodtech/javadb/

~super

jblade, super is http://mindprod.com/jgloss/super.html

ojacobson, that might be a bit much for someone working on algebra

~tell jblade about bibles

1) Sun Java Tutorial (http://java.sun.com/docs/books/tutorial) 2) Bruce Eckel's "Thinking in Java" (http://www.mindview.net/Books/TIJ) (Get the 3rd edition, the 4th is only freely available up
to chapter 7.)

ojacobson, you know, just starting to use variables

maybe, maybe not. We'll see.

ferret_0567, why are you doing java? Are you taking a class?

I'm not taking a class

Oh, ok. I just finished the scheduling for our high school. I don't let people take programming unless they have completed Algebra
Preferably finished geometry and in algebra 2

ridiculous

I'm trying to do this on my own, trying to prepare for the future

ferret_0567, dont

java does late binding right? so if dog-is-a animal and both implement a method of legs, when calling the dog.leg class it over rides the animal
to access the animal legs, id have to do super
but when is base needed?

what is base?

ferret_0567, you can try with a reallly good book. but it is extremely hard if you don't understand algebra

all your base are belong to us?

wohoo

there is no base

~the base

the only thing youi need from algebra is variables

ok, then if i have a type of dog

I believe I have a really good book, at least

base would be dogs?
and super would be animals?

you overrate math comprehension in the realm of app programming

I think I understand the basic concepts, minus some things dealing with math

i have my 2d game that can now switch between fullscreen and windowed mode on demand…i would like to know how i can get rid of the window decoration when entering fullscreen? i would like to keep window decoration only for windowed mode .. here's the code so far: http://rafb.net/p/igi5aL64.html i do the fullscreen/window mode change in sSetUp() method …. oh and the code is horribly messy i know ..

cybereal, well, i've been teaching math and programming for 10 years so I'm not exactly overrating it

you're just carrying a torch

cybereal, i have worked out the stats for kids pre and post algebra and their grades

grades in high school mean nothing

school means nothing in real world performance

cybereal, not good. You must know algebra. If you cant figure out 5 + x = 8 then you can't program

Clearly the teachers are affected by the artificial reality of high school too

algebra teaches you about storing values

someone can help ? how can i keept window decoration in windowed mode and getting rid of it when entering fullscreen mode ?

the most basic concept, and it can be picked up easily in the reverse. I learned to program long before I learned algebra.

cybereal, yes but you were smart enough to understand the concepts
cybereal, it's just that no one had showed them to you

I don't think I was any more advanced, just interested.

jblade, lets compare the salaries of those who finished with 3.75+ gpas vs those in the 2.0-2.5 range

cybereal, it's not just that they haven't taken algebra. if you get to high school and you haven't taken algebra yet it means that your math skills are lacking
cybereal, otherwise you have would have taken it at least once in junior high
cybereal, at our school you'd also be taking it in summer school before you attend (private school)
if your still taking it your frosh year you've probably failed it

and what I'm saying is that it has minimal impact on basic programming

cybereal, i completely disagree

Obviously

more exposure gives you a different thought process

[krustofski]: that applies universally

indeed

cybereal, i have taught 180 students a year. it's very clear the programming learning ability is directly related to their ability to learn math and knowledge of math

so to assume math before programming is better than programming before math is a bias

specifically algrebra

Perhaps their ability to learn it, but I disagree about their existing knowledge of it

krustofski

[krustofski], exactly. Algebra teaches you how to think like a programmer

salary is standard of living
it has nohting to do with performance

cybereal, oh sure, i don't think existing knowledge is as needed

jblade, keep telling yourself that

I definitely found having done a maths degree helpful when attempting to become a programmer. But the plural of anecdote is not statistic.

its comparing apples to oranges

pfft these days…

yeah if u do well in school ul make more money

cybereal, i taught my brother to program in 5th grade way before algebra. it's the ability to learn the math

~tell jblade about u

jblade, U is Dutch for "you" or an aolbonic meaning "I am stupid".

but doesnt mean ull invent the internet

~tell jblade about aolbonics

jblade, aolbonics is talking like a retard using speech as if you were on AIM or using single letters for you, are, you are, you're, see, etc. Talking like this is frowned upon in ##java and may result in you being silenced. You have a full keyboard so use it. We don't care if you talk like an
idiot with your friends but we don't want to sit through stuff like this: http://forums.oracle.com/forums/thread.jspa?threadID=499980&start=0&tstart=0

shut it

lol

we have rules here, you are free to /part

sorry
Im trying to save bandwith and therefore fight big Oil
every yo not typed is money saved
haha

As you can see, your usage of aolbonics in this channel has backfired on that attempt and caused far more bandwith to be used

hahaha

unfortunately
gas prices will probally go up as a result

read javachannels.net
it clearly says you _MAY_ be silenced if you use aolbonics. Now either stop or risk being silenced.

[krustofski]: http://www.youtube.com/watch?v=ljbI-363A2Q

I will state that pr3d4t0r will _NOT_ put up with it.

watch that

http://blog.bluendo.com/ff/mina-and-twisted-matrix-benchmarks
whineBut python is sloooow/whine

jblade, im into hippy propaganda
and that takes the prize

u watch it?

fucking christ

wrong one

_STOP_ using aolbonics

http://www.youtube.com/watch?v=pMcfrLYDm2U

haha

Um what's the point of this video? Stating obvious things?

~ops

cheeser, pr3d4t0r, jottinger, Javageek, jor, Logi, Sou|cutter, {aaron}, kinabalu, flippo, and joed. If you have an issue with channel operations, contact any of the above.

He's lucky pr3d4t0r isn't around
uh oh
Now you've done it
haha

thank you pr3d4t0r

I thought I'd heard my name.

hey pr3d4t0r

you did.

pr3d4t0r is a lurker

I love debugging javabot.

twisted matrix is good stuff

Have a good night, kids.

I think he's got a nice sound that beeps when people shout his name

you too

ahh, it's only 1

bedtime for me too.

Z z .

me too

Mm. I've heard good things about it. But it's written in python. :-/

it escapes python's primary flaw, the global interpreter lock, and achieves its good performance thanks primarily to that guiding principal

How does it manage that?
Lots of C?

it's an asynchronous approach instead of threading

didn't jblade come in here once before and defy orders to stop using aolbonics?

Ah, righto.

I try to combine the approaches because the async can become quickly slowed if the atomicity of your tasks grows too great, this benchmark is probably really unfair in that one would handle a different kind of task better than the other if you get my meaning

Yeah, almost certainly.
It just amused me.
I wonder how well twisted would interact with stackless.

the better part of it all is that it's viewed as a java vs. python performance thing which it isn't, at all, it's a twisted vs. mina

I think some of that is related to the performance of the relevant IO implementations.

I think java vs. python impacts more the original design decisions than the outcome of performance honestly

Mm.
We're still trying to make a Java vs. Scala decision at work.

They are each adapted to their environment, so to speak

(With a ruby programmer occasionally interjecting with "You shouldn't use Scala! It sucks because it's not Ruby!", but fortunately he's not on the project )

ciao

salut

Ruby does functional programming now?

If i have a class any class Holder, say HolderString, and i have a Class object representing that class and i do not know the type of ?, how do i find out it is a String?

you missed the point of generics

you can't

Hasn't it always?

actually you can under certain circumestances

Considering I am inspecting other peoples classes cybereal, no i do not

through methods called on getClass() returned Class

They actually return a class extends T
through a little bit of magic on the part of the compiler.

~tell Stewy about type erasure

Stewy, type erasure is the notion that all generics info (the T bit in public class SomethingT extends Comparable) is GONE after compilation.

I don't know, I don't know ruby, i didn't think it did though

It has 'blocks' which are first class functions which Ruby programmers assure me are totally unique to ruby and even though they're mathematically equivalent to first class functions are really special and new and make everything wonderful.
And they're certainly nothing at all like Smalltalk's blocks.

Hello. I have a question about SFTP connection from JAVA applet. I try write program, those will be connect to sftp server with using DSA key. What library(s) I should use and my be someone know any documentation about it? P.S. Sorry for bad English

check out jsch

ah, certianly, I forgot that ruby was the original source of much of the software engineering field..

 Web Hosting Provider | Hosting Provider

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: