I have an interesting problem I wrote a chat server and client in java In the client I use a JEditorPane to display
Their point was that DSL's can be custom fitted to a domain while Java et al need libs devoted to those domains. And it is apparently easier to learn these DSL's than it is to learn a new lib/framework in Java.
actually, i'm not sure you do, but you might, yes.
in c/c++, you definetly need them.
it is?
i have never actually had the need to *use* this, you know
i am sure some would say that perl for example is easy to learn, but…
It's not easier. It may be more expressive once you actually learn it.
I'm not agreeing with them, I'm just throwing it in here to see if anyone has useful commentary.
mostly just hippies. On acid.
Maybe this expressiveness can suck you in and make you a lot more interested in learning it.
parsec certainly seems to have that effect.
Hah, Perl is extremely easy to learn. Even pidgin perl is an extremely powerful and expressive language.
(But 'Ruby' is not a domain specific language)
runnable line noise
would you say that enough people are clueless when it comes to creating easy to use apis in the java web hosting area, i'd agree though.
You and me both brother. I came to Java because I needed a threading model that actually worked. Now that i"m here, I am really enjoying the Java experience. Plus Netbeans is just a never ended source of entertainment.
s/ in the java area//
i mostly only know the java area, so…
people… as in Sun people contributing to JDK classes?
did you say calendar?
point made, Clackwell
Ruby may not be, but Ruby today is the same as Ruby on Rails, which is domain specific.
IBM people do help as well.
evil do loop in java http://rafb.net/p/9X6Qae99.html
what mean "domain specific"?
z++ is the end all language
i assumed he ment specialized, like perl is good for .. you know.
stop making me depressed
A language for a specific purpose.
ah ok
i don't think perl php ruby are specific
at the maximum the frameworks/libs around are a kind of specific
not the languages itselfs
no?
then again the amount of libs around perl is ..
Nonsense.
hmm
i think javafx is a cool language with innovative features
how do i use DataBinder without maven 2
?
also ruby and ecmascript4
inf?
There are plenty of people using Ruby for non-rails things. It's just that they don't get the same level of ludicrous hype as rails.
Please do not conflate marketing with work actually being done.
Hey does anybody know how to set VM options that Apache ant uses for itself and/or for the javac's it launches? I am getting outofmemoryerror and can't figure out where to adjust -Xmx
we use it here to write controllers for test equipment
you get all of the neat C file descriptor stuff like select without all of the ugly crap
and with fox you can make a decent gui pretty quickly
anyway what ruby lack is a rubyvm or a compiler targetting jvm or .net or parrot(perl6 vm)
i don't get why Exception doesn't have a way to convert its stack trace into a string
fox?
perl is obsolete
nonsense
i think that's what they chose to replace tk as the default gui included in the ruby distribution
perl6?
I pity anyone using Ruby without Rails. It is such an awkward language without anything really cool to set it apart.
i'm not saying it to troll, i honestly do not see a future to perl.
Rails doesn't really change the *language*
it'll be used for primarily the same reasons it is today, systems admin
mhall. with a perl m could be there is a merket
I know, it just adds some whizbang libs to make webdev nice.
*with parrot i mean
i'm not a big fan of virtual machines, having worked a lot on java recently to write network management software.
wouldn't that allow you to figure out which method called a certain method?
i think a lot of my problems are colored by Sun-specific frustration though, so i need to be patient and receptive to other VMs
so?
printStackTrace already does that
why not? The average machine these days has a crapload of memory and horsepower, running a VM is not a big deal for them. Also, you tend to get platform-independent code out of VMs
Ah
No comment.
tamarin(mozilla adobe), jvm(sun), mono/.net(microsoft novell), parrot(perl), yarv(ruby)
this is the war
last 2 player are a kind of small compared to others
there's also python's JVM, which is bigger than ruby, or at least I think so
there are still tons of perl programmers and hundreds of millions of lines of code to support.
this sounds a lot like not java.
oh yes forgot
err..not jvm, but vm
communities need a bit of babble so they dont fester
you can get a stack trace in String form if you use Runtime.getRuntime()
babbitt: how about you guys take it to a pm
is it okay to use databinder with wicket and hibernate ?
It kind of is. JavaPosse claimed that Java/.Net would be replaced with domain specific languages.
my objections are not based on performance
that's the point of databinder
ha
I'm shutting up now
hardly the most elegant, tho…
it's kinda not.
don't think there's another way
and I can get 3 feet behind me by walking all the way around the world in the wrong direction
there's another way
yeah, but is it good practice ?
they are based on having it be a pain to launch the applications, lots of stupid classpath stuff, missing libraries that only show up as missing when the code which requires them loads and crashes.
leaves to run errands
Sou|cutter im stuck
i love aot, but the only vm in the list that supports it is mono
figuring out the stack trace is not very OOP.
it's like, with a vm, everything is always dynamic, it'd be nice if i could make some things more static in certain cases.
it doesnt work, and the only thing I can find googling is primitives can be allocated that way
and java.lang.String
eh. I wouldn't know how to do it another way.
what are you trying to get from the stacktrace
someone knows if sun will push AOT compilation?
ask the openjdk guys
the stack trace
i want to email it to myself if something goes wrong
i have some example code which i use to print it out
i'm not asking how to do it
i'm bitching that it's not easier
i think there should be a String getStackTrace()
that'd be largely worthless
please email host sun for me, go go go
why?
what would you do with it?
email it to myself
you'd have to parse it to do anything usefule
or write it to a file
~javadoc exception
hm. how about getStackTrace() ?
I don't know of any documentation for exception
you can ship required libraries and an executable that runs your program with the copies of required libraries you gave it
i think it has to do with performance issues
exception.printStackTrace()
why?
~javadoc throwable
I don't know of any documentation for throwable
hmm….
they pass you a read-only pointer to the real stack trace rather than making a new copy
javadocs are down for now
returns a whole bunch of StackTraceElements…
oh, okay
and strings in java are very slow
i know about these things, but the JVM host invocation API is ugly
poke. http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html#getStackTrace()
i think it should be simpler to configure runtime environments… just my two cents…
Strings in Java aren't actually slow.
how would you like to make your things static, then?
They're just poorly optimised for certain operations.
it's hard to quantify
s/optimised/designed/
there's a getStackTrace that provides info as array though… you can easily write a formatter of StackTraceelement into a string
i'm not saying it as a criticism, i'm just saying they are way too slow for use in the stack trace api
that's what i always do
yues, that's the way I always do it
okay :d
…
ah, k.
I just usually do LOG.log(Level.XXX, message, exception)
I'm not convinced.
or just printStackTrace() into a StringWriter
eh. seems like a shortcut aroundstringwriter
yeah, but is it good practice ?
why not?
dunno
argh sun open but not all open
they've opened everything that's there.
i want email this exception
this is an old, known caveat
binary plugs?
make a logger handler that will mail it.
no, they'll just replace them for 1.7
in fact, that might be a reasonable solution, if you wanna mail, say, all fatal logs
seems that some native code used by the vm are not open?
and/or you can create a Level.MAIL level or something
they are needed for AOT obviusly
good point
wait, what did I just say. egad, the saga of mismatched copy/paste.
should this work in some fashion ? MyClass [] myClasss = {new MyClass("MyClass1"), new MyClass("MyClass2")};
or maybe it's not…
log4j may be lame in that respect
sun doesn't own all that code. they use 3rd party libs licensed from other companies.
[java] Execption; sql host = select pp_product_bom_id from pp_product_bom where m_product_id = ? order by validto desc limit 1; e.getMessage() = ERROR: syntax error at or near ""limit"" why doesn't this work, it works in the raw postgresql
interface
so seems sun is againts AOT because it could resize the "SUN JVM" role in using java apps
wtf are you babbling about?
huh?
mmm ok
http://databinder.net/releases/databinder-1.0.tar.gz
nm, it's hard to explain
it's corrupted ;P
it looks like SQL error.
first of all, are you sure you're looking at the right sql?
but it isn't man
yes
second of all, you may not be binding correctly and it's complaining about the wrong part
order by validto, desc limit 1; not "validto desc"
ok
told you, it's an sql error =/
i don't think your suggestion is correct
a, desc, b, desc?
i see it.
it's obvious!
8^)=
Huh. How could I possibly not have noticed that…
select * from "AA" order by name desc limit 1;
ciao a tutti
qualche italiano?
nein
net
nyet
no
ni chao?
vorrei sapere come posso modificare un file .class
~english
dfr, english is http://eugeneciurana.com/galereya/view_photo.php?set_albumName=Humor&id=Spelling_English_Jules
i need modify a file .class
i use ubuntu
do you really see it or were you joking?
nakinub, modifica .java
e poi
cambia da solo?
.class
ma lol
someone is a ble to find a JTree benas binding example on google?
argh can't find nothing
hello guys
i am getting crazy
i like so much the semplicity of java for UI development
ok
tnx
ciao
now that i need to use C++ i am kind of screwed..
so you mean the IDE? the language itself is bloated for all
for example, i really need to find a C++ SIMPLE alternative for the jFileChooser
call the os
do you know any C++ implementation that allow me to do it in such an easy way?
i'm surprised the WIN api version of jFileChooser is more complicated than java's
i hate java's
the OS?
i need a platform independent one!
wxWidgets
i tried…..
but it's way more complicated
i spent the last 2 hours
in trying to get it
but nothing
oh, i don't know but should be simple
http://www.wxwidgets.org/manuals/stable/wx_wxfiledialog.html#wxfiledialog
this one right?
ho provato
ma non è cambiato
ma devo dare un comando particolare?
da terminale?
http://www.wxwidgets.org/manuals/stable/wx_dialogfunctions.html#wxfileselector there is an example
yes
chi mi ha risposto prima??? non ricordo
seems simple: wxString filename = wxFileSelector("Choose a file to open");
~profile
I guess the factoid 'jprofiler' might be appropriate:
[krustofski], jprofiler is commercial profiler it can be found at http://www.ej-technologies.com/products/jprofiler/overview.html
i want modify a file .class
i use ubuntu
???
too numb question!
try english and patience.
lol numb
I want to modify a file .class
I use ubuntu
Is there a way that I can give a method that's implemented off an interface the option of throwing an exception? Or throw a non-terminating exception or something??
how I can make?
modify the .java file not the .class then let the java compiler recreate the .class from the .java with javac filename.java
ubuntu is not related, unusefull information
non-terminating exception?
yeah, one that will be thrown but wont stop execution
I remember reading about those a long time ago
maybe I'm just making things up in my head though…
i think you are….
either way, if you want to throw a non-runetime exception from implementation that assumes no such exceptions thrown, you can't.. i think
tnxxxxxxxx
ok
tnx
ciao a tutt!!!
.
but you can throw runtimexceptions without declaration
probably he means checked / unchecked exceptions, boh
ah
yes, sorry, I want to throw an unchecked exception.
well, maybe not, that's kinda dick
if a method does not declare to throw a (non-runtime) exception, it actually *guarantees* not to throw it.
shat.
if you need an unchecked exception, use a subclass of RuntimeException.
hoewever note that it's good practice to use checked exception for all non-trivial error cases.
unchecked exception should be removed from the language
hmm. I want to notify the programmer that some of the methods in my API havn't been implemented yet, but they exist because of they are implemented via an interface.
runtime exceptions should be reserved for situations that arise from a programming error (such as nullpointer, etc)
throw new UnsupportedOperationException()
that's a runtime exception. in fact, use UnsupportedOPerationException for that.
with a message that it's not supported yet
NotImplementedException
I can't without modifying the interface, and I don't want to modify the interface
sure you can
it's a runtime exception
Indeed you can.
~ttas
dfr, I have no idea what ttas is.
~tias
Try it and see. You learn much more by experimentation than by asking without having even tried.
there we go :d
~HARD
joed, HARD is As hard as a blind lesbians nipples at the fishmarket.
hoo hoo, it works
cheers
thx guys
~forget hard
I forgot about hard, cheeser.
are the javadocs down because you
're implementing new functionality?
[or whoever is]
nah. they're down because they worked on my dev server last night but broke on this server this morning and I haven't had a chance to fix them.
oh, okay
i usually google for it anyway
~api
cheeser, api is http://java.sun.com/javase/6/docs/api/
which method to left trim specific characters from a string?
i actually have them downloaded
look at the javadoc for String
yes done
now read said doc.
i'm stupid but i can't find a suitable method
When I create a class variable can I use Integer and int?
what do you want to do, exactly?
Sure.. use whatever you like.
new String("1233213213213123_DATA").leftTrim("123");
a) new String("foo") is redundant, "foo" is already a String
ok sorry for that
still not possible to create a namespace in Java for System.out package like you can in C++?
"1233213213213123_DATA".leftTrim("123");
b) what about "123456".leftTrim("abc") - whaw would you want this to do?
return "123456"
nothing to trim
s/package//
"abc" are the characters to trim if there are
something like.. if (str.startsWith(prefix)) { str = str.substring(prefix.length()); }
yes but for each specified char
if (str.startsWith(prefix_a)) { str = str.substring(prefix.length()); }
if (str.startsWith(prefix_b)) { str = str.substring(prefix.length()); }
so write a function..
what is this for anyway?
argh ok, is what i'm asking, String lack some usefull and standard in any language methods
bargh ok, is what i'm asking, String lack some usefull and standard in any language methods/b
Which languages?
say one
What is it lacking?
a "remove prefix if it exists"
C++
I'm rather sure there's no such standard operation in C++, or C#..
In which languages have you found this operation in-built?
ruby php perl STL C++ lib etc ect
Where is that operation in the STL or C++ standard library? What's it called in Ruby?
(or PHP)
doesn't java have that? String.replace("^somestring", "");
so far all you've done is mumble half questions and then whine that java doesn't have what you need.
trying reading more and talking less.
you mean regex?
a "remove prefix if it exists"
it has regex replacement, iirc
True - that'd be another way to do it. I don't tend to use regex for such simple tasks (not saying it shouldn't be used, just out of habit)
ooh, okay, sorry
try replaceAll
well, if you want to do it like that…
i'd use substring for that
i'd use replaceAll.
regexen are not the best thing to turn to first.
why would you do replaceAll?
there's only one start of a string
In any case, I'm still wondering what the task is that necessitates this "removing a variety of prefixes from a string"
to trim off the front part of string?
Because replaceAll is the one that takes a regex.
Trim if it exists.
wha's the other name for a throw new SomethingFunkyHapennedHereException("message") ?
why not, if the prefix pattern is complex?
as if that matters…
jk
otherwise, startsWith and substring of course
..
you are right but i really can't believe that such obvious thigs need to be written from scratch or workarounded, so i question for a confirm
oh, that's a good idea, but it didn't seem like there was a pattern
if there's no pattern, just use startsWith
Hardly from scratch. but whatever. What are you actualyl doing?
they don't have to be if you'd just actually read the docs.
And I still question where the in-built operation is for this C++.
s = s.startsWith(prefix) ? s.substring(prefix.length()) : s;
or something like that…
*nods*
Gracenotes++
gracenotes has a karma level of 1, cheeser
oh. joy .
well… I have a question about the JMM I've been typing up.
which is:
is followed by CountDownLatch counting down to zero iff the MyDataType object meets certain criteria. This is supposed to wake up latch.await() in another thread, which then calls toArray(new MyDataType[0]) to get an array of the LinkedList. So… is the array returned by this method guaranteed
to have the most recently…
…added element? (countDown() happens-before await(), btw)
kinda long. sorry.
i have a method that calls a submethod that returns a true/false if it fails to do stuff (failure should only happen due to a programming error). So I'm thinking which exception to throw in that case.. closest is UnsupportedOperationExcception but it's not quite correct…
well, what does the exception signify?
IllegalStateException? What kind of programming error?
can i add my lefttrim() method to the string class?
writing your own exceptions is trivial.
eclipse makes it a no-code operation.
IllegalStateException if someone called your function without initializing the necessary state, InvalidArgumentException if they passed in bad args, UnsupportedOperationException if the function is just not meant to be called..
yea, i know…. but I'd dervice it from something…
no you can't
throw new AssertionException() = win
Um.. you seem to be missing th epoint, and no you can't add functions to the String class.
no. you can't attach stuff to existing classes. and you can't subclass string, it'sa final class.
I'll ask again: What are you trying to do that requires you to strip various prefixes?
the object uses a deck that has different tabs that one can be selected… the exception is thrown if a tab selection fails. If the class is written correctly, that should never happen, however.
there is some class for path concatenation etc?
hm. not sure if people are *that* familiar with the JMM (/me isn't)
So there's no way this should ever be caused by external code? Only if you failed to maintain the invariants you intend to
there are FilenameUtils in apache commons
That doesn't answer my question..
precisely, yeap.
IllegalStateException, probably.
or InvalidStateException - I don't recall
even out from the java SE lol
What are you trying to do?
unfortunately, it either doesn't work with File objects or String objects, i can't remember which. Either way it's pretty damn annoying but not difficult to make your own
BE CLEAR.
i know that sometimes on the left of the string i have garbage chars
File has operations for path concatenation, depending on your exact requirements..
i want to clear this part
Define "garbage chars"
how do you distinguish them from other chars? Where does the non-garbage begin?
it's not quite illegal state though…
it's more of the "internaloperationfailed"
anyway, I think I'll just conjure up one then
?:$ this three, i don't know how/why there are this chars
thanks guys
use replaceAll. simple enough.
line per line this file comes from a customer
what causes it to fail?
Only ?: and $?
what package has the filenameutils
if an underlying deck fails to select a tab.
package? Do you mean jar?
No other characters - so you just want to remove any ?, :, and $ thate are in a contiguous sequecne at the begining of a stirng?
which one of the components
no i'm dobius about the rest of the line don't want replaceAll
maybe one of the mentioned exceptions would work but the message could say "InternalOperationException"
which should _never_ happen in a correctly functioning class.
and yes the character are mixed and not always a fixed compition of the three
str = str.replaceAll("^[\\?\$]*", ""); //something like that
oh, i like that internapoperationexception
I can't recall which things need escaping and how much..
yes also regexp works
thanks!
that's even more confusing so i'll just tell you the package org.apache.commons.io.FilenameUtils
it's in [this], so escaping isn't needed,,,
*shrugs* rightio
yp, package was IO
err. component
the package is org.apache.commons.io
i donno what a component is
http://commons.apache.org/io/apidocs/org/apache/commons/io/FilenameUtils.html
commons components… io/codec/etc
i've ever wanted such class but i've never thinked to see in 3rd parties libs
who gives a fuck
just download it if you want it
and drop it in your extensions folder and add your classpath to the system environment
plus use an IDE
and import it …
how many things to do…
vulture gave you an answer
that doesn't require that
all those suggestions were sarcastic btw
mine i mean
What kind of path related operation are you trying to perform? (I take it this is a different issue from the leading character removal)
does apache commons have a mimetype resolver
its annoying to make your own
ehi i'm being sarcastic also
i think there's an Encoder library
vulture:nevermind a simple path/filename concat
it may have that
File should be able to do that just fine then.
admittedly, i think File could benefit from some more helper methods
yes with one ctor
codec doesnt have it
Perhaps
oh i meanted codec i think
meant
i haven't looked in codec, so i donno
i need a lib that tells that .txt is text/plain etc
magiclib?
commons.codec just has base64, urlencoder etc stuff
ah no
i donno
maybe you could make your own and submit it to codec
well its basically just manual labor and/or heuristics
but i wanna spare myself of the manual labor
tomcat has its own mimetype resolver but its accessed thru ServletContext
which is kinda annoying
you can't rip it out?
havent looked into it yet
I'm stuck with Vectors :/ any good tutorials about Vectors? for some reason if I do Vector ve = null; in the constructor and then in a method I try to do ve.add(myString), I get a nullpointer exception
"for some reason"
null.add(myString) doesnt do much
from a call to String.split() ?
this isn't a vector problem, it's a basic object problem
you have to say Vector ve = new Vector()
and you probably want to use ArrayList anyway
tieTYT, oh :/
fuck
i erased a file i didn't mean to because i forgot to commit it
or how can i remove items from String[]?
um, dont think you can.
you have to learn about arrays first
don't use Vector, anyway
use ArrayList.
Vector is evil
ok
if you don't know how to use arrays, how can you judge Java vs anything?
why not Vector?
List strings = new ArrayList(Arrays.asList(s.spit()));
Vector is like the inheritance of List
?
no it's like Hans Mueller
it's slow (because it's synchronized), and it doesn't comply to the conventions of the collections framework.
thanks
i donno who that is but it sounds familiure
familiar?
first of all, by implementing List, doesn't it comply with the conventions?
why there isn't a ArrayListType(Type[] initvalues) ctor?
second, if you're not using it in a threaded environment, is it really slower?
because theres Arrays.asList(T[])
third, isn't it useful in situations because it IS synchronized?
aaaa ok
synchronized *individual* modifications to a list is almost never usefull. if you want that, Collections has factory methods for synchrionized wrappers. Read the javadoc of Vector for reasons not to use it.
~javadoc java.util.Vector
I don't know of any documentation for java.util.Vector
o_O
isn't it 6 one way or half a dozen the other?
and i'm reading the documentation, it doesn't meantion any reasons to not use it
hm, doesn't seem to be in thta file, right. there was a clear call to not use it any longer - but i wonder where i read it. google turns up stuff like this: http://groups.google.li/group/comp.lang.java.advocacy/msg/c2b5cf18e74eb152
in java is possible to declare operator[] ?
was this a long time ago?
don't think so.
operator overloading like in C++?
ah damn
java forces ya to be verbose.. whether you like it or not.
this was a long time ago, yes. here's some stuff from 2001: http://www.javaworld.com/javaworld/javaqa/2001-06/03-qa-0622-vector.html
.get(0) vs [0]
anyway if is not possible… stop
how do u convert a String to integer?
hmm, is the only think that the Vector suynchronization is usedful for is the fail-safe behavior?
Integer.parseInt
String.parseInt
Integer.parseInt
heh
ah
Integer.parseInt.
thk u
failsafe how?
wrong
what are some good weaknesses to have as a programmer
the javadoc says that if Vector is modified after issuing an iterator, iterator access will throw a ConcurrentModificationException.. that's what they call fail safe behavior…
imagine you were at an interview and they asked you what your weaknesses were…
what…
weakness for caffeine?
None at all Best weaknesses of all
dfr no like you were in an interview and they said… what are your weaknesses
that's what you could say…
on a serious note though
I find that my skills are too specific.
that's "fail fast" in my book. but anyway, that's the same for all collections.
I find that I lack in-depth understanding of design patterns
i think it's even in the spec for Iterator, at least as a suggestion
etc.
whoops, you're right on that terminilogy
that's why it has a remove() method
except ConcurrentIterator
they don't use fail-fast
oh you mean that question that every interview website says people will ask?
uh, ConcurrentIterator? how is that supposed to work, then?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4905919
2003 fuck
operator overloading is evil
very evil.
i don't want any operator overloading
fucking scrubs making Apple + Orange mean something
using operator overloading badly is evil
i *do* want a smarter array type, though
at least
I'd like Array Object; to work
there are very few cases where it wouldn't be. java forces verbosity, so someone reading the code can actually see what's going on.
I mean ArralyList Object;
if you can't be sure what *exactly* an operator does, you are fucked.
if you can't be sure what *exactly* an operator does, you are fucked.
how would oyu like to make it smarter?
"Apple" + Orange already means something
sane implementation of equals, hashCode and toString, for starters. and python-style slices.
and negative indexes
and ranges [2,10]?
I'd prefer list literals, but understandably those are a bit hard, since there are dozens of list implementations
that's what i mean by slice, yes
a *map* literal would be quite cool.
and providing implementations of equals and hashCode would be a rather non-comaptible semantic change - beisdes there are already static methods fo those in java.util.Arrays starting with 1.5
arrays work well enough to initialized lists
they would if lists provided an array constructor
yes, i know, it would be incompatible. still sucks the way it is.
hm
I just realized something
i wonder who came up with that
I go, "Hey, wouldnt' it be cool to be able ot iterate over a Pair."
Then was like, "Wiat a minute…"
{bollvar?"true":"false"}" and code inside strings?
there is also pretty-printing for arrays in java.util.Arrays, though I guess that could be made the efault toString operation
Arrays.asList - but that gives you an unmodifiable list, which may not be what you want.
yes, Arrays also has comparison, and all that
but it's basically patchwork to cover up the suckyness of the array type
I think Arrays is the way to go for your high-level array needs - you probably shouldn't be using arrays anyway, as they are what they are
for most purposes, a List or a Set makes much more sense
sure
yeah usually when i use an array i eventually turn it into a List/Set
arrays are mostly usefull for places where you want to provide a literal
I reviewed some student projects last year - they were first taught about arrays and Collections framework was only mentioned briefly
and arrays they used, it was *ugly*
were they getting a degree in Java?
bottom-up teaching is still the rule, i'm afraid.
which is stupid.
depends on what the degree is
really? *especially* if it's not about java, the higher level concepts are more relevant than the itty gritty stuff
they were passing the second mandatory Java course, on their way to M.Sc in Physics/CS mostly
on other hand, if you just teach them lists and dont teach arrays, it'd suck as well
collections make far more sense to most people thanarrays do
"what's an array?" "huh?"
yes, but bottom-up teaching with Java doesn't make any sense, it just produces unmaintainable code that is impossible to interface with
there was a conversation like this yesterday
i guess i'm just old school and i'm glad i learned about pointers and arrays
depends - if they are supposed to be java programmers, yes. if they are just supposed to learn general principles of programming, they don't really need to know about arrays. or shouldn't need too. in practice, they'll see one immediately, in main(String[] argv)
so the Q is really whether it's better to teach "list is like an array…" or "array is like a list…"
they're learning to learn how to code, they're not learning to code
that would take too much time
usually it's lower level courses of CS.. where they learn general programming with java as example…
indeed, it's a shame the course didn't have nough funds to actually *teach* them
I find it a hassle working with psuedo-dynamic arrays in Java
has to do with time too
to get the difference between arrays and lists(single/double) one need to know a lower level language
you learn a lot more using java 8 hours a day than you do 1 hour 3 times a week in a class
it was a one-semester project course, with a couple of lectures and 4 hours of TA time per student, time certainly was not the issue
that is not a lot of time..
certainly isn't
you've probably been working with java 8 hours a day for 2+ years
also, the 4 hours included reviewing the assignments as well as iving feedback, and I'm not sure if it was even 4 hours
and from that perspective you're complaining about their code instead of from theirs
I have an interesting problem. I wrote a chat server and client in java. In the client I use a JEditorPane to display html for the conversation. When new text is sent, I use setText() and the pane automatically scrolls. I know I want to use setCaretPosition to stop the scrolling, but I don't
know how to get the caret position for the displayed text and not just the last position where text was entered. Can someone help?
how effient is Java in fetching data from files?
at this moment, I have ove 600 files that all contain some text
test
daredemo, compared to that?
the bottleneck when reading from disk is the disk
daredemo, what about benchmarking it?
should I merge those files?
I'm complaining about the code that people produce after being introduced to programming and Java in the wrong way IMO
java can read as fast as your disk can serve data…
what does IMO mean?
so how'd you introduce them instead?
in my opinion
theory is, using DataChannels is a bit faster.
chances are any slowdown will be in your data processesing, not how fast you can open and close files
oh, thanks
daredemo, I/O streaming in Java is relatively quick. Do you need to parse the text in the files?
what if they have to learn C next?
wow, is it really James Gosling?
only some of them do, most of them will probably mostly write Matlab or Mathematica code in their following studies
bearded_oneder, yes, I would need to parse some of it, to get a Map(?) with data from the lines
daredemo, is the text tokenized strings?
so no problem
ro should i say delimited?
or*
bearded_oneder, it's "," delimited text/numbers
No takers on my problem from earlier?
trying to avoid the complexities of Java would be great, but I'm not sure how feasible
btrying to avoid the complexities of Java would be great, but I'm not sure how feasible/b
tazle if the assignment calls for writing java, why not teach them whatever is useful or necessary to know?
jdroid-: I'm afraid that can't be done in the time they're given, and I think it'd be more useful to learn to progrma than to learn Java
what is the course?
see, a month ago I've been trying to teach my 14yo cousin some pascal due to school (dont ask why pascal) and was amazed he has trouble understanding stuff like variables, memory, etc…. so if you start with throwing Collections framework at students, it might totally blow them over… and to
avoid that, start with arrays then build on it…. Once you know that, it looks soo obvious though…
yeah i think it's better for a programmer to understand an array in concept than a java.util.List
javac: invalid flag: C:/DOKUME~1/user/LOKALE~1/Temp/org.apache.cxf.endpoint.dynamic.DynamicClientFactory@dffa9d-1186784284250-classes Can you tell me what's wrong?
daredemo, manipulating that kind of text is realitvely quick in Java if you use I/O streams. Random parsing of text doesn't fair so well.
i agree with tfr. you gotta teach them why collections are useful in the context of a single collection and then explain why there are different ones later.
relatively*
bearded_oneder, ok, thanks
imo, the basic education should be built on principles (so arrays) but if it's a java course, provide _plenty_ of sources of how it's _really done_ in java
jdroid-: in practice it's a combination of two courses - first a lecture/exercise course where people are supposed to learn to program, and then the exercise/project course where they are suppsoed to program a larger program
if you're teaching programming, why not let them use whatever language they want and offer to teach in java?
jdroid-: because the school decided that Java is useful to teach, since people will use it in industry
my software design course worked that way. we covered algorithms and data structures in java and then software design in whatever language we wanted. i chose smalltalk
bearded_oneder, would Pattern split be the best way to go?
daredemo, how big are the text files?
on average?
wouldn't it be a huge hassle if every kid could use a different language?
if the school favors industry favorites, you're teaching the kids to follow orders, not think for themself…
it could be that at that age, he's barely starting to understand abstraction concepts
jdroid-: yea, in my understanding, universities usually choose the langauge to be taught.. it takes quite an effort to change that.
oh ya.. let me help you debug that Eiffel code
=p
bearded_oneder, the thing is, the files are relatively small, maybe 20-50 lines
that's not true. course instructors do. sometimes they base it around one language, but good luck teaching recursion in java as well as you could in lisp or scheme…
industry demand also drives what language are taught too
jdroid-: I didn't make the decision, and I didn't teach any of the courses, I was just a TA on the project course, and thus had to actually review the code
eh, approx 21000 lines
where do i define the username/password in new URL("http://www.google.com").openConnection(proxy);?
ah, well if you're TA you're not in a position to do much… just gotta go with what the prof wants
from my understanding, industry drives the people at university to select stuff
that's garbage
bearded_oneder, but in most cases I'd only need a small window from the data
mit talk intro to programming in scheme and recently switched to python
jdroid-: If a course is laballed "introduction to java", i dont think they'd let you [as instructor] to teach whatever…
jdroid-: that's mit
bearded_oneder, on my screen, anything more than 6 months is impossible to analyze if I graph it
if the course is called intro to java, then it's java… obviously.
jdroid-: I *was* a TA, mostly to see what the smart people who mostly haven't programmed before learn in their first (or only, depending on their department) programming courses
jdroid-: but it's not the course instructor who selects that
daredemo, are you just importing them into lists for sort, search, and filter?
so I'd say 100 * 30 lines
jdroid-: i do _strongly_ agree that anything about Programming100 should be taught in language-independent
jdroid-: I considered doing it again this year, but this year TAs were required to teach besides revieewing and grading projects, and I don't have tiem for that wht with real work and my own school
bearded_oneder, they are sorted, the files
the files are by date
daredemo, and the delimited lines within each file are presorted?
no the files are by fat
but I have to get given values from the files
I don't think Java is a good way to start programming - it exposes too much unnecessary complexity
bearded_oneder, let me check, I think yes, but I won't promise anything
script is better this days
I have no clue… imo, Programming100 is a silly course in general.
bearded_oneder, a random selection showed it was alphabetical
for me, that is.. it's useful for people who aren't gonna go above that in CS though
if starting teaching from ground up, starting with actual processors and machine language and moving to C would be the way to go, and if starting from the other end, there's Scheme and I guess Python nowadays
i think it depends on what you expect from the students. i think an intro to programming course in a particular language is good because people are discovering concepts and need something stable to communicate to each other with
people who already know how to program will breeze through the course anyway and will appreciate having more spare time for other things
jdroid-: um… if you're just discovering coding concepts when you get into college…. in a field you know you wanna get a degree in… sorry, that's a bit late
eheh
dfr who are you to judge?
jdroid-: good point. But when i had to take such classes, i really hated them.
freedoom
i did too. i understand your point, but it's not fair to judge.
I know some people who hadn't done any programming before university, and managed to learn well, but most don't seem to
jdroid-: because they are generally taught by profs who dont specifically want to learn it and you have to take it and blah blah blah.
some people i work with who are fantastic programmers didn't even study cs. they picked up java from studying physics and needing to write software as part of their coursework
oh, of course… but they most likely learnt most of those concepts on their own.. didnt need a course to introduce them to it…
i can't imagine anyone wants to seriously teach the intro courses… maybe they like studying the ways people learn programming from scratch
hi there
i had a prof at my school who focused entirely on effective ways to teach cs and loved the intro courses.
they needed the course to push them to *have* to learn
jdroid-: that's part of my point.. and since they dont want to teach it, it blows…. especially for advanced students.
agreed, but so it goes…
jdroid-: I think I'd find it interesting, but not on a very long term
jdroid-: also, the profs don't have free enough hands anyway
I'm a very beginner with java. If function test has prototype : int test(String[] param), can I call test( {"string1", "string2"} ) ?
~tias
Try it and see. You learn much more by experimentation than by asking without having even tried.
dunno… I would love if unis would separate the "good CS students" from "sorta CS students" in most classes.
I tried andn got "illegal somethin"
*and
’cause @ my university, that separation only starts once you get past 300 levels…
test( new String[] {"string1", "string2"} ) ?
the real question is, what's the correct way to do it
thanks
well, one thing that any course should encourage is students learning on their own and communicating with each other. the prof can answer questions and help, but shouldn't be expected to hold the hands of the students…
ywo ways of saying the same thing
at this university, some of the first-year students took operating systems, AI and compiler courses, and did well enough
most universities have advanced sections
that's sorta what i did… but i had to still take silly courses
my school also let people take grad or phd level courses if they were bored
so it's not really a problem here, since you can mostly walk into the advanced courses, and you can pass the beginner courses effortlessly
you need to say new String[] {…} i think
you've got requirements that need to be met for the degree… taking courses you may find boring is just part of that
jdroid-: yes… but you generally still ahve to satisfy the curriculum by taking that intros and other junk.
jdroid-: of course not, the TAs are for handholding
see if that works, i'm too lazy to tias
but it's still like what… 3-5 courses you need to sit through.. not to mention i tend to do poorly in them ’cause they're stupid
and you pay for them too, mind you.
you have provided only the initialization block, instead you have to put the "new" keyword type and the optional init block
sit through? for programming courses here you do the exercises and possibly go and sit the exam
i didn't particularly enjoy my physics courses, but i put up with them for sake of the courses i did like…
yeap… I do those exricses by the time I have written some neat projects on my own..
the exercises are graded using an automatic checker too, so there isn't even any need to interact with course personnel
javabot tell webustany about arrays
webustany, arrays is http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html
that depends on courses.
also, i think, despite what many people say, having a degree is very useful for getting a job while young
thanks everyone
jdroid-: huh? wha's your point?
yes, but rather small amounts, and you can always do what the nethackers do - give yourself additional conducts for passing the exercises
jdroid-: i have no problem with getting degree.. I have a problem of how to get it
on the C course it got rather silly, with the advanced students cramming some page-long programs into 87 bytes for example
hah!
that's pretty awesome.
my point is that not every class will be fun and sometimes you just gotta play the game. since you don't like that, what would you suggest instead?
daredemo, the easiset method is to read the file with a buffered file readerand use the split method of String or the java.util.regex to parse the lines into seperate fields for you list or array.
jdroid-: get classes that are fun
how do u convert a String to double ?
what would be the most efficient way to store variables if they are in alpabetical order?
jdroid-: and agian, separate the advanced students from not.
jdroid-: that will actually benefit both groups, imo.
what's fun is subjective… if every student thinks it's not fun, then surely the school would do something else or risk losing students.
and again, i'm surprised your school doesn't have advanced courses or the opportunity to take grad and phd level courses instead
jdroid-: you can.. but they're specialized.
jdroid-: you still ahve to take "general CS" courses.
jdroid-: like operating systems, etc…
so take the grad or phd one instead…
jdroid-: they dont substitute for other stuff.. at least not officially
oh… weak
jdroid-: no, don't really have a grad course in data structures.
bearded_oneder, I'm tempted to store the data in a HasMapA, MapB, C[]
what could they teach?
they most likely have a grad course that would supercede a data structures course that you could teach to fill the requirement
dunno, patterns?
but I'm not sure if it make sense
jdroid-: i dont think so… i think i would have tried…
do patterns fall under the category of data structures?
hmm, good point
anyhow.
I actually gotta run
i don't… sounds like you're just complaining instead of seeking better options.
so good weekend, guys
that was an honest question
jdroid-: i am relatively content with my current state.. i'm mostly ocmplaining as if I had to do it all over again
i don't really know the definition of a data structure. I just know that Pairs, List, Hashmap, Set, Trie, etc., are data structures
patterns typically are code layout and data structures might be part of it, but you're not designing the structure, you're making use of it.
it sorta does…. it's the "above and beyond" of data structures, sorta…
ah, fair enough. i wouldn't redo undergrad either!
maybe the Composite pattern is a data structure
why would composite be a data structure?
data structure are known ways to structure data
patterns are known solutions to structure design.. so it's pretty close
that seems like a way to structure data
anyway, have fun guys
brie!
daredemo, the most lfexible storage method would be a sortable list
bearded_oneder, can I nest sortable lists?
to have a list of lists
i need to provide a username/password to a SOCKS proxy i'm passing through. Is java.net.Authenticator the proper way to do this?
patterns have structure but i don't agree that they are data structures since a pattern can consist of many data structures working together
daredemo, the Collections class provides a modifiable list with a sort() method
a pattern can also not contain data, depending on the pattern, so that's that
bearded_oneder, hm
bearded_oneder, but can the list be accessed by "date"?
bearded_oneder, "get the ABC from 20070125"
daredemo, collections can be nested
daredemo, do you mean can you search for and sort on dates in collection's list?
bearded_oneder, I don't need to sort the dates, it's is already sorted
or… I think it is
does Java list files in alphabetical order?
fat order!?
daredemo, what do you mean
daredemo, what do you mean, "can the list be accessed by "date"?"?
accessed by KEY?
bearded_oneder, no, I mean String[] files = file.list(myFilter)
daredemo, oh the files date on the disk?
bearded_oneder, er… the name of the file
daredemo, hang on brb .. computer is wigging … have 13 progams open, not inlcuding services running in the background.
if I throw an exception in a method, will that method return?
or will it continue
if you can access the 'date' you need, write a Comparator to do the sorting for you
it will jump to the nearest catch block that matches the type of the exception you threw
s/nearest/nearest enclosing
Fanook, I'm asking do I need to do that, aren't the files accest alphabetically?
accessed*
that's entirely dependent on the order you construct the list
and when you create a catch the exception is caught but does the code inside the try block keep getting executed after that exception is caught?
Fanook, example?
the reason i am asking is cause my method can return 2 possible IllegalStateExceptions and i want to know if both IllegalStateExceptions will be thrown or if it ends after 1 is thrown
it would seem obvious that it would stop
only one, but we'd need to see your code to be sure
oh nm
and when you create a catch the exception is caught but does the code inside the try block keep getting executed after that exception is caught?
the answer to that is no
but you can easily tias that
daredemo, ok. back. sorry about that …
think about this: BufferedReader, are we gonna read a file that doesn't exist?
tis why it seemed obvious
so that alone should have answered your question.
if it's obvious, why the hell ask?
it was obvious after i asked the question
daredemo, sorting a list of files on the disk requires java.text.Collator;
import java.util.Arrays;
import java.util.Comparator;
okies.
i talk to myself to help me think, i put things out in IRC and it becomes clearer
stupid fookin' mIRC paste
bearded_oneder, and that would sort them based on what?
open a private message or a text file.
(to yourself.)
doesnt work the same, cause then i actually feel like i am talking to myself
daredemo, pretty much what ever you choose, name, date, size
i wasnt trying to do that here, but it did become obvious when i said it
okay.
bearded_oneder, i don't need to sort by date or size
the file names are "metadataYYYYMMDD.txt"
* shrug * by name alphabetically. all of the files disk attributes are returned as sortable text.
daredemo, Java world is an indispensable source of howto articles. all the questions you are asking have been asked for.
if I knew where to look for the answers…
daredemo, Using the Comparable and Comparator interfaces to sort lists is covered here … http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort.html
daredemo, sorting files and directories is covered here … http://weblog.janek.org/Archive/2005/01/16/HowtoSortFilesandDirector.html
Hmm, weird question and idk why I am asking it cause I aint going to use it. Can you change access levels on a private object's method. Say I have "private String user;" and I want to allow a anything else to call "user.length();"
idk why i am asking, lol, just curious
sorta, i think you can call it through reflection
but i don't know how, i've just heard
you have a private string, but you want to access it's length from anywhere? give whatever's enclosing the string a public method getUsernameLength() that returns user.length()
well obviously, but that wasnt the question
.length() is a public method of String. anything that can get a reference to a String can call that method
it's a better solution though if possible
the only thing restricting you from calling user.length() is the privateness of user. either change the access level so you can access user, or create a getter method to delegate the .length() call
reflection is best avoided unless you REALLY need to use it
i know that, but the question was can i modify the access levels
bearded_oneder, it seems to me that my list of files is sorted even if I don't do anything
lol
yeah you can go into the .java file and rename private to public
still wasnt the question
no. java's access levels are strict. you can use reflection to see what access level a Method has, but you can't change it
yeah actually it was
just too literal for you
~tell SkareCrow about javadoc Method
SkareCrow, I don't know of any documentation for Method
~tell SkareCrow about javadoc java.lang.reflect.Method
SkareCrow, I don't know of any documentation for java.lang.reflect.Method
ok just stop, i was told about reflection now you guys are just annoying me
all your answers are in java.lang.reflect look at Method and Modifiers
oh our bad, should we step outside until you cool off?
the question was if i can have a private object and allow an exception for a particular method without changing the overall access level of the object
i am reading stuff already
being told once is enough, i dont need to be told the same thing 4 times
daredemo, here's a code snippet I posted for importing delimited files into a simple array list using the StringTokenizer class. StringTokenizer has not yet been deprecated, but it is being phased out in favor of split method of String and the java.util.regex
daredemo, Importing delimited files into an ArrayList … http://rafb.net/p/14gDks56.html
bearded_oneder, I'm very comfortable with using regex to split it to variables
btw, "your welcome"
daredemo, well duty calls. got to go for now. bbl. hope that helps.
i consider leaving
cause it seems as though every time i come here people eaither give me shitty advice, dought what you can do, or just annoy you
ok you're ignored
you would be surprised how many timse i have came in here and have been told "No, you cannot do that." Determined to find an answer I spend the next hour just to find out that what I was told is incorrect.
people just seem to be total dicks in here all the time, suprised i ever come back
why isn't anyone ever looking for an entry level java programmer?
good question
is anyone ever looking for an entry level anything?
just send your resume out to everyone and make your experience ambiguous in your resume
getting contacted is half the work
heh
daredemo, a book I want to recommend to you is Java I/O, Elliotte Rusty Harold, O'Reilly Media, February 28, 1999. … http://www.amazon.com/Java-I-O-OReilly/dp/B00007FYHS/ref=sr_1_1/002-0265140-3797628?ie=UTF8&s=books&qid=1186788601&sr=1-1
hi
offer to work for free or 3 months
*for 3 months
heh
g[r]eek, I'm a little too old to work for free. My wife would kick my butt.
fair enough. then you should be applying for management
I'm already a manager. I want to make a mid-career switch to developer.
daredemo, it gets into the nitty gritty of Java I/O and explains how to use Java to accomplish I/O tasks mistakenly thought possible only with lower level languages. The classes used in the code are from Java 1 and earl Java 2, but it isn't diifficult to port the examples to current Java
classes. It's an indespensable addition to my Java library.
well then your guess is probably better than mine
early* Java 2
i'm using java mail and the emails i'm receiving are fucked up. It's got part of the header in the middle of the email. Has anyone ever heard of this happening?
nope. paste?
ok
one second
http://pastebin.com/m478bfa6c
i printed out the actual message body in string form and it only contains the lower half
cc me the email
Work on opensource, make a name for yourself, hang out with developers, being a sysgeek/tools/integration person might be a good way. Much development work is not that danged fun anyways, start a small business on the side, see if you like it / does it work etc.
development is fun if you don't work on other people's fuckups
Sounds like a good idea, joed. Are you a developer?
i don't think you need to put that much effort into it
just make a generic resume and cover letter you can send to any business looking for a java developer
send it out to everyone and wait
Right now yes I used to be a Infrastructure manager in a very large company about 4 weeks ago.
an even.
heh
that's how i got my first job
it took about a month
the second time i looked it was much easier
but i took the same strategy
If you have he management experience and real life experience you should have a lot of skills to draw from.
the even.
I was not interested in being a developer per se, I've always written stuff, I was more interested in the type of company and what I could do.
I want to work for Sun.
whatever you do, don't try it for 2 months and then go back to management thinking you know the best way to do everything now
~10 years
It takes 10 years to master anything. See http://www.norvig.com/21-days.html
is java old?
amen to taht.
is python now better?
get lost.
tieTYT, I don't like management. I really like being the analyst who works in front of the programmer, but those jobs are pretty scarce.
or is java more powerful than ever?
bye bye
hello…
when you say analyst, what sort of work did you do?
like a PM or such? More customer interfacing?
g[r]eek, I'm currently a Help Desk manager. Before that I was a software analyst working in between end users and vendors.
Woo! Hoo! The Second Edition (2006) of "Java I/O" is out … http://www.amazon.com/Java-I-O-Elliotte-Harold/dp/0596527500/ref=pd_bbs_sr_1/002-0265140-3797628?ie=UTF8&s=books&qid=1186789822&sr=1-1
tomcat
joed, not a PM. I want to do the requirements gathering and such. UML diagrams and all.
that requires much experience in your domain and generally in development
joed got his leg cut off by nehffarious
then got bea tdown with it
then I'd actually look towards SAP, or some such thing
lol
SAP oow yukeers
heh
but your experience in support and analysis will help
yeah
please keep quiet
hmm, 55 used & new available from $9.09 … time to whip out the master card
Since this is a no applet channel (qv topic), where would I go to find help on applet issues?
efnet
OK, I'll try it - thanks
you won't thank me
*shrug* Sometimes you find a knowledgeable and helpful person on efnet. (And sometimes you find gold in a slurryheap, but it's not something you should bank on)
This is what I'd like to do for a firm using Java - http://seeker.dice.com/jobsearch/servlet/JobSearch?op=302&dockey=xml/8/3/839618c285917928833ff23374eec849@endecaindex&source=19&FREE_TEXT=cybercoders+system+analyst