6:34 Lau_of_DK: Hey guys
10:04 Anybody here familiar with a good Java FTP lib ?
10:13 I'm going with sun.net.ftp.FtpClient - If anybody is aware of a better alternative for simple up/downloads, then let me know
13:32 Lau_of_DK: blackdog, that looks pretty sweet - its supposed to outperform Javas native threading?
13:35 blackdog: didn't really look into it , but i listened to rhickey concurrency video recently where he was asked about such things
13:39 Lau_of_DK: One thing that I was a little onsure of, is that are we supposed to used threading via send-off and such, or is it nessacary to get comfortable with Java Thread. lib ?
13:39 rhickey: blackdog: saw that, thanks
13:59 Lau_of_DK: IO Writers seem to default to writing in the home directory on Linux - Is there a global I can use to redirect to the folder the .clj file is executed from that will work on mac/win/nix ?
14:01 blackdog: (defn getCwd
14:01 "get current working directory"
14:01  (. System getProperty "user.dir"))
14:01 that's where the program is started in
14:02 i move myself into my app dir first before firing up java
14:03 or you could do an explicit (. System getenv key)) and get a working dir from an environement variable
14:03 there may be other ways
14:04 Lau_of_DK: Thanks blackdog, good tips :)
14:05 blackdog: yw
15:04 Lau_of_DK: rhickey: Generally for starting single worker threads, it send-off the best way to go about it ?
15:05 rhickey: if the threads don't block, send is better than send-off
15:05 Lau_of_DK: ok - They dont. So there's really no reason to start using all of Javas .Thread functions for this type of job?
15:06 rhickey: no, agents wrap all of that
15:06 Lau_of_DK: sweet - Thanks
15:21 I've got a question about the primitive support
15:22 byte a = new byte
15:22 (make-array byte 10240)
15:22 Thats how I would have imagined the port, but it throws a class erorr
15:22 why ?
15:24 rhickey: the class corresponding to byte is Byte.TYPE
15:25 Lau_of_DK: Ok thats works. If I didnt have you to ask - Where would I find this info? I read through the Java-Interop section of Clojure.com
15:49 rhickey: Ok thats works. If I didnt have you to ask - Where would I find this info? I read through the Java-Interop section of Clojure.com
16:50 Lau_of_DK: Gents - This function (upload-file) sorta works. It tries to upload the file, it uploads the correct amount of bytes, but the data is throughly corrupted. Any input is very welcomed! :)
16:51 Chouser_: are you uploading a binary file? you might trying using binary mode.
16:53 Lau_of_DK: hehe
16:53 gimme 1 sec
16:58 Chouser: Im sure you're right, it has to do with switching to binary, unfortunately this old sun lib is causing alot of trouble, so now Im getting array out of bounds error, will take some time to sort out
16:58 but thanks for lending me your sharp eyes
17:08 Lau_of_DK: Ok, I'd say that the upload procedure is pretty textbook, switching to binary throws index out of bounds exception - is this a clojure bug?
17:08 (def bytes (. in read buffer)) & (. out write buffer 0 bytes), shouldnt produce this error unless either read or write was failing ?
17:12 Chouser_: when will that loop terminate?
17:12 Lau_of_DK: the the reader returns a negative value
17:12 EOF = -1
17:12 Chouser_: which you then add to counter, right?
17:13 Lau_of_DK: 1 sec
17:13 it was supposed to say "bytes"
17:14 ok, except for a picture quality issue, the upload is working now
17:14 Sorry about the level of stupidity introduced here tonight :)
17:15 Chouser_: no need to be ashamed of bugs in your code. We all write bugs.
17:15 In any given example, though, the chances of the bug being in clojure are pretty low.
17:15 Lau_of_DK: Why ?
17:16 Chouser_: because there are lots of people beating on clojure from lots of different angles, compared to how many people have been beating on any one example any of us may come up with.
17:17 Lau_of_DK: Sure - I looked through the Googlegroups and I wondered how the guys who posted Clojure bugs (that Rich ended up fixing) could be so confident that it was bugs, so I figured - I'll act confident :)
17:17 Chouser_: heh. well, that's one approach...
17:18 Lau_of_DK: which I'll change, but anyway, I've actually made a small image manipulation program now, that uploads the resulting files on an ftp server, thats progress
17:22 Chouser_: cool!
17:24 If you think you've found a bug in Clojure, but you want to be sure, just try to isolate it yourself -- try to track down the simplest thing that will trigger the bug. You'll either produce a nice compact bug report for Rich to look at, or find the bug in your own code.
17:24 I generally end up with the latter result. :-)
17:24 Lau_of_DK: Thats definately the way to go - And I need some practice on isolating stuff
22:02 jcrites: hey
22:03 how do I call a static function?
22:03 I tried...
22:03 (. java.net.InetAddress getAllByName "localhost")
22:03 I got it.
22:03 (. java.net.InetAddress (getAllByName "localhost"))
22:07 dudleyf: jcrites: or
22:07 (.getAllByName java.net.InetAdress "localhost")
22:07 jcrites: how can I print out the type contained in some Var?
22:08 I'm trying to figure out how to process the result of that function call but don't know quite what type it is ;-)
22:09 dudleyf: (.getClass varname)
22:09 But, that call returns a Java array
22:10 jcrites: well an array has a class doesn't it ? :-(
22:10 something isn't working right ?
22:11 I did this:
22:11 (def a (. java.net.InetAddress (getAllByName "localhost")) )
22:11 now I'm trying:
22:11 (. a toString) or (.toString a)
22:11 I don't expect it to return a useful value, but I'm getting an error saying:
22:11 Unable to resolve symbol toString in this context
22:12 hmmm, maybe Java arrays actually aren't Object....
22:12 dudleyf: I get "[Ljava.net.InetAddress;@1bbbafc"
22:12 Which is what I would expect
22:13 You can use (vec a) to get a Clojure vector from that array
22:13 jcrites: user=> (def a (. java.net.InetAddress (getAllByName "localhost")) ) #<Var: user/a>
22:13 user=> (.toString a) java.lang.Exception: Unable to resolve symbol: .toString in this context clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:13: Unable to resolve symbol: .toString in this context
22:13 am I doing something wrong?
22:13 vec is definitely in a later version than I am using
22:14 maybe I just need to upgrade?
22:14 dudleyf: Definitely
22:15 You may have a version before the (.javaMethod) syntax was legal
22:16 jcrites: but (. a toString) should still work?
22:16 no matching field found: toString
22:16 I will just upgrade; no use spending time debugging this before doing that
22:16 dudleyf: Absolutely right.
22:21 jcrites: interesting
22:21 does def do something different in the new version?
22:21 now it says #'user/a rather than something about var
22:21 hey, is there a page describing Clojure shorthand syntax?
22:21 I remember someone showing me a shortcut fn syntax
22:25 And I think Vars just print differently
22:25 jcrites: ah ok :-) thanks for your help!
22:26 dudleyf: jcrites: anytime
22:28 jcrites: (#(+ %1 %2) 1 2)
22:28 I love Clojure :D
22:28 such short nice syntax, such library elegance