Re: Why I have chosen not to employ clojure

2010-03-26 Thread prhlava
Hello Ronan, > By the way, if someone has an idea about a sample application (simple, > but not trivial) which could lead the tutorial, and show different > aspects of the language, let me know ! > I was thinking about a more complete and idiomatic version of Vincent > Foley's "Fetching web comic

Re: database management: curing lock issues

2010-03-25 Thread prhlava
> Is it as simple as moving to a better database, such as > mySQL? PostgreSQL is considerably better (even than MySQL, which still uses locks AFAIK) for anything concurrent. The PostgreSQL is using multiple version concurrency (MVC) approach - the same approach the clojure STM is using. The Postg

feedback on (shortish) code wanted - parallel factorial examples

2009-12-03 Thread prhlava
Hello, I would like to extend the examples section on clojure wiki with parallel factorial example codes (one version is sligtly simpler, one performs better). Your feedback on the code is more than welcome, as I still consider myself beginner on clojure (but coming up with the algorithm + im

Re: roll call of production use?

2009-11-30 Thread prhlava
Hello, > i'd be interested to hear who has successfully used clojure in > production. i know of some, as some folks have been vocal; any other > interesting-but-so-far-silent uses people'd be willing to fess up > about? I have done a smallish project (mainly to stop my friend doing some monkey w

uploading file(s) to the "Files" section of this group

2009-11-30 Thread prhlava
Hello, What is the correct way these days to upload a file to the "Files" section of the Clojure google group? I checked the info on the group, it looks that only "managers" can upload files, but how do I do this (i.e. who do I send the files to)? The files in question are small bugfixes to the

Re: "arithmetic" change between 1.0.0 and 1.1. 0

2009-11-30 Thread prhlava
Hello Steve, > As an alternative to the code you posted, for positive integers n and m, >         (int (Math/floor (/ n m)) > is equivalent to >         (quot n m) > If negative values are possible, you could write a function based on quot > that would give the appropriate answer in all cases.

(range 1.0 10.0) versus (range 1 10) in clojure versions 1.0.0-snapshot 1.1.0-alpha

2009-11-16 Thread prhlava
Hello, ( this is related to http://groups.google.com/group/clojure/browse_thread/thread/d894a933dcb5d0f6 ) In Clojure 1.0.0-snapshot, the (range 1.0 10.0) ; 1) (range 1 10) ; 2) both yield integer numbers in result. In clojure 1.1.0-alpha-snapshot (recent), the 1) yield floats and 2) i

"arithmetic" change between 1.0.0 and 1.1. 0

2009-11-16 Thread prhlava
Hello, I was testing if my code works with Clojure 1.1.0-alpha-SNAPSHOT - the full code is attached to this group (in files section) as parallel- factorial*.clj . The code works in 1.0.0, but blows up in 1.1.0 for bigger numbers. After a bit of digging, I found that following function is the cul

Re: How to write performant functions in clojure (and other functional languages)

2009-07-26 Thread prhlava
Hello, > I wonder if any of the Clojurians on here might like to describe how > one might write the factorial function as a parallel one? Look at the files section of this group, I wrote 2 examples of parallel factorial and the sources are uploaded there... Kind regards, Vlad --~--~--

Re: breaking early from a "tight loop"

2009-06-13 Thread prhlava
Hello James, Thank you for more examples. > > (count (take-while belowCount (filter identity (map isInteresting > > pixels > This particular piece of code doesn't look like it would work, unless > I've misunderstood what Vlad is asking. I think you'd want something > more like: If I unders

Re: breaking early from a "tight loop"

2009-06-12 Thread prhlava
Hello Patrick, > I would approach it like this, and make full use of Clojure's lazy > sequences: > > (count (take-while belowCount (filter identity (map isInteresting > pixels Interesting approach - I have not thought of this. Also, it looks that I can get an array of pixels (as ints) from

breaking early from a "tight loop"

2009-06-12 Thread prhlava
Hello, I am writing a (crude) image classification which basically counts pixels within a specific RGB interval and if the count is over certain number, the image is considered "interesting". (the app runs on a grid BTW) The point is that once the count is reached, there is no point processing

Re: Clojure, GridGain and serialization error

2009-06-09 Thread prhlava
> I am playing with GridGain http://www.gridgain.com from Clojure and I > am getting > exception related to serialization. Never mind, I tool a wrong approach at first. Now I have it running, apologies for the noise... Kind regards, Vlad --~--~-~--~~~---~--~~ You

Clojure, GridGain and serialization error

2009-06-09 Thread prhlava
Hello, I am playing with GridGain http://www.gridgain.com from Clojure and I am getting exception related to serialization. >>> Type: org.gridgain.grid.GridException >>> Message: Failed to deserialize object with given class loader: >>> clojure.lang.dynamicclassloa...@667cbde6 (the full stack

Re: What books have helped you wrap your brain around FP and Clojure?

2009-06-06 Thread prhlava
> Going beyond the language-specific Programming Clojure book, what > other books have best helped you make the (sometimes mind-bending) I have not yet read anything more mind-bending than this: http://www.gp-field-guide.org.uk/ (A field guide to genetic programming) It is free download - the

Re: improoved version of parallel factorial uploaded - is it possible to push the performance further?

2009-06-06 Thread prhlava
Oops - the link above is broken, but the code is in the files section, called: parallel-factorial-example-2.clj Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

improoved version of parallel factorial uploaded - is it possible to push the performance further?

2009-06-06 Thread prhlava
Hello, Just uploaded better version of parallel factorial... Is is possible to push the performance further (short of implementing parallel multiplication algorithm)? Comments welcome. http://groups.google.com/group/clojure/files/parallel-factorial-example-2.clj Kind regards, Vlad --~--~---

Re: off topic - sending and receiving raw Ethernet frames from clojure/java

2009-05-24 Thread prhlava
Hello Mark, > Can't be done using the standard Java library. You'll have to write > some JNI code or find a JNI library. Thanks for the confirmation, after long search and asking around, the conclusion was the same - not possible without JNI or using jpcap... Kind regards, Vlad --~--~---

off topic - sending and receiving raw Ethernet frames from clojure/java

2009-05-20 Thread prhlava
Hello, Apologies for off topic post. I would like to send and receive raw ethernet frames from Clojure. So far, I found: http://netresearch.ics.uci.edu/kfujii/jpcap/doc/ but is sending and receiving raw ethernet packets possible with the latest JDK using standard networking stack of JVM? In

Re: How do you "boot-strap" clojure from java?

2009-04-26 Thread prhlava
Hello Christophe, Thank you. > clojure.lang.RT.load("my/script.clj") ; your script must be on the classpath > clojure.lang.RT.var("my.ns", "my-var").invoke("hello") ; to call a function This is good (so I should read more then main.clj source code nex time ;-) ). Kind regards, Vlad --~--~--

Re: Google announcement, version 1.0 & SCM Holy War (not really)

2009-04-26 Thread prhlava
Hello Dan, > Which version did you try? msysgit works very well. Pity that VM I used is now no-existent, but as I said it was a while ago. Maybe msysgit improoved since. The reasons I had for choosing mercurial were: 1. The hg code base is simpler and smaller that git's 2. It is more easily p

Re: How do you "boot-strap" clojure from java?

2009-04-26 Thread prhlava
Hello James, > Are you aware you can compile Clojure code directly into Java class > files? Yes, this was my 1st method of distributing clojure apps (in a .jar). It works. But what would be really cool, if I could distribute clojure code in the source form, load it into a java appliation _and

Re: possibly interesting ui 'framework'

2009-04-25 Thread prhlava
Hello Pinocchio, > So, I looked at it... it doesn't seem to be a UI framework as in a > framework for creating UIs. Its more to do with an programming editor > which helps write logically convolved code better (actually a great > talk...). I look at is as a "transactional change propagation" fr

How do you "boot-strap" clojure from java?

2009-04-25 Thread prhlava
Hello, Currently, I do the following (the clojure application is called "isi"): 1. set-up a java netbeans project (called isi) with main class 2. add the clojure.jar (and other libraries) to the project 3. in the main class: package isi; /** * loads the clojure script */ public class Main {

Re: Google announcement, version 1.0 & SCM Holy War (not really)

2009-04-25 Thread prhlava
> Git even works relatively well on Windows (I've used it lightly and not > encountered a bug yet). The last time I tried, it did not (few months back) compared to mercurial. Personally I prefer mercurial to git, but did not use either for too advanced stuff yet... Kind regards, Vlad --~--~

Re: [solved] java.lang.String cannot be cast to [Ljava.lang.CharSequence;

2009-04-16 Thread prhlava
Hello Paul, > Are you trying to give it a string, or an array of strings? > Maybe it will work with (into-array ["string"])? Thank you, this was spot on, the correct call looks like: (. query (sendKeys (into-array ["my-string"]))) Cheers! Vlad PS: Embarassingly, the hint is also in the FAQ.

java.lang.String cannot be cast to [Ljava.lang.CharSequence;

2009-04-16 Thread prhlava
Hello, I am trying to use a java library ( http://code.google.com/p/webdriver/ ), the method I need to call has signature: sendKeys(java.lang.CharSequence... keysToSend) If I give it a clojure string, the "cannot be cast" message appears in the stack trace. I have tried explicit (cast java.la

Is it possible to use clojure to build NetBeans rich client application?

2009-02-19 Thread prhlava
Hello, I am thinking of using NetBeans RCP and clojure to build an application. The clojure would be used for as much application logic as possible... Has anyone else attemted this? How would I go about it? I know that it is possible with e.g. groovy, but with clojure? Kind regards, Vlad --~

Re: building a class or jar file from clojure

2009-02-09 Thread prhlava
Hello hank, > How does one make a standard clojure based class file or jar file without > embedding clojure source files. Shameful plug: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Distributing_application_as_self_contained_.jar (the above URL should be 1 line..., it

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-05 Thread prhlava
> 2) The current directory (parent of gui2) is in the class-path -cp > option when launching Clojure Updated the guide with note about CLASSPATH - basicaly, I have current directory (".") listed in it. Also, replaced quote character with "quote" word in the code. Updated version so far only her

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-04 Thread prhlava
Hello Tim, > Feel free to use it as you wish. I have added the code (with attribution) to the guide. Also, the .java generated code listing should now compile. Updated guide is now on the same locations (including the files section of this group). >... So calling > MainFrame.main() runs the

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-03 Thread prhlava
> > You can call main very easily: (MainFrame/main nil) however seeing the > > default implementation does not return the created object, you can't > > add the action listeners, so it isn't much use. > > I thought of using it as the "start" function to make the GUI visible > (instead of .setVisi

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-03 Thread prhlava
Hello Tim, Thanks for pointing the mistakes in code and the quote thing. Will be fixed in the next version of the guide... > You can call main very easily: (MainFrame/main nil) however seeing the > default implementation does not return the created object, you can't > add the action listeners,

Re: A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-02 Thread prhlava
Cool, at least one positive response so far :-). I have also put the .pdf file into this group's files section, called: clojure-gui-and-netbeans.pdf Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure"

A short guide on how to use NetBeans to create GUI and then use this GUI from clojure available

2009-02-02 Thread prhlava
Hello, I have put a short guide on how to create Swing GUI using NetBenans and how to get hands on this generated GUI JForm (java class) from clojure. I hope someone will find this useful... http://www.dearm.co.uk/cgan/ or (.pdf version): http://www.dearm.co.uk/cgan/cgan.pdf Vlad PS: Comme

Clojure, GUI and NetBeans (a short guide on line and for download)

2009-02-02 Thread prhlava
Hello, In an attempt of returnig favour (i.e. being able to use so much good free software and getting free help while doing so), I have put together a short guide (very basic) on how to use NetBeans GUI (Swing) designer and then get hands on it from Clojure. The guide is available in 2 forms (

Re: London Clojurians

2009-02-02 Thread prhlava
Hello Tom, > If not, would anyone be interested? I live in London and would be interested... Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

Re: agents, memory usage and threads

2008-12-22 Thread prhlava
> What I found that when the JVM memory usage goes to around 26% of > available RAM, only one thread runs at the time from then on. Is this > JVM optimising? Well, it was hitting the JVM default amount of heap limit - works as expected with proper parameters to java... Sorry for the noise, Vl

agents, memory usage and threads

2008-12-20 Thread prhlava
Hello, What is you experience with using agents on multi core CPU when agents hold a considerable amount of memory allocated? What I found that when the JVM memory usage goes to around 26% of available RAM, only one thread runs at the time from then on. Is this JVM optimising? What I am trying

parallel factorial (code in the files section)

2008-12-18 Thread prhlava
Hello folks, In the process of learning agents I have written a parallel implementation of factorial function. The code is in files section as "parallel-factorial-example.clj", shared in the hope that it can help others to understand the agents. It is by no means a production code... Comments

Re: ants.clj demo and old single core CPU

2008-12-16 Thread prhlava
Well, Reducing the number of ants helped and it works... Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this

ants.clj demo and old single core CPU

2008-12-16 Thread prhlava
Hello, Is the ants.clj supposed to work on single core ~700MHZ CPU? The program loads and runs, but all ants "stay at home" (but the CPU is busy). I am using latest svn version of clojure on: java version "1.6.0_0" IcedTea6 1.3.1 Runtime Environment (build 1.6.0_0-b12) OpenJDK Client VM (buil

Re: Swing GUI Builder and Clojure

2008-12-12 Thread prhlava
Hello Rock, > Does anyone know of such a possibility? And, if not, what are the > chances of coming up with a tool like that? I'm not a Java nor a Swing > expert, so I haven't the faintest clue as to what the difficulties may > be. There is such a tool for jruby (which I tried for a basic gui)

Re: Swing GUI Builder and Clojure

2008-12-12 Thread prhlava
Swing - as it comes built in with java Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send ema

distributing a clojure application as self contained .jar - guide

2008-12-12 Thread prhlava
Hello, What is the position on distributing clojure classes with user application classes in single .jar file. Is including the license for clojure in the .jar as a text file enough? I would like to amend: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips section 1.9 so the "

distributing a cliojure application as .jar - guide

2008-12-12 Thread prhlava
Hello, What is the position on distributing clojure classes with user application classes in single .jar file. Is including the license for clojure in the .jar as a text file enough? I would like to amend: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips section 1.9 so the

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Hello Steve, > It may be that *out* gets redirected. Another difference between out > and err is that System/err is often associated with an "autoflush" > stream. It's possible that your output to *out* has ben buffered and > that you need a call to (flush) to ensure it's displayed. Not calling

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Well, The (. java.lang.System/err println "something") works from in handler (it looks that *out* gets re-directed)... Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-09 Thread prhlava
Hello Kyle, What got me started is java code on: http://www.java2s.com/Code/Java/JDK-6/LightweightHTTPServer.htm But what is strange that java code handler can print to console and clojure version (if run as a script) does not. How do you go about debugging the handler? Kind regards, Vlad -

Re: java built in HTTP server, proxy and HttpHandler interface

2008-12-08 Thread prhlava
Well, it turns out that the following works, but it only prints the "exchange" to stdout, if the code is cut and pasted to the REPL but _not_ if run as .clj script)... (import '(java.io IOException) '(java.io OutputStream) '(java.util Iterator) '(java.util List) '(java.util Set) '(com.sun.

Re: java build it HTTP server, proxy and HttpHandler interface

2008-12-08 Thread prhlava
Oops, The subject should have read: java built in HTTP server, proxy and HttpHandler interface... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

java build it HTTP server, proxy and HttpHandler interface

2008-12-08 Thread prhlava
Hello again, I am trying to use java built in HttpServer and it looks that the handle method of HttpHandler interface does not get called at all (but the server "works" - returns a blank page, which is expected as I do not write anything in the handle method). The following example is minimal i

Re: linux, named pipe (fifo) and (while ...)

2008-12-08 Thread prhlava
Hello Samantha, > Why not just stream it into a JDBC Blob to your database? The "daemon" does more than just storing it in the database (it is basicaly a postfix mail filter something like spamassassin in principle, but does different things with the e-mails). > Is there some reason the mai

Re: linux, named pipe (fifo) and (while ...)

2008-12-08 Thread prhlava
Hello Randall, > If your application is client/server, you really should just go with an > ordinary TCP connection (or, conceivably, a UDP port), define a proper > protocol and do the whole thing properly. This makes sense (if done right, the submitter can be invoked several times in parallel a

Re: linux, named pipe (fifo) and (while ...)

2008-12-07 Thread prhlava
> You're asking for the pipe to be repeatedly opened, one uninterrupted glob of > bytes read and processed and then the pipe closed. Is that really what you > intend? Yes, that was my intention, maybe a rethink is in order... > As written, this suggest a kind of "daemon" that monitors the pip

Re: linux, named pipe (fifo) and (while ...)

2008-12-07 Thread prhlava
> > The following does not work, but if I remove the (while true , it > > does... > > Characterize "does not work," if you would. Well, nothing happens with "(while" around the code... But if I take the "while" out, and run the remaining code, it does what expected - prints the content of the buf

linux, named pipe (fifo) and (while ...)

2008-12-07 Thread prhlava
Hello everyone, I am trying to read (repeatedly) from named pipe (fifo) on linux (the program will be a long running process...). The following does not work, but if I remove the (while true , it does... (def pipe-name "/tmp/my-pipe") (def buffer-size (* 1 1024)) (while true (with-ope

Re: one way to write a factorial function

2008-11-24 Thread prhlava
user=> (= (range 10) (for [x (range 10)] x)) true :-) Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this gro

Re: one way to write a factorial function

2008-11-24 Thread prhlava
> Help me understand why this isn't written > > (defn factorial [n] >   (apply * (range 1 (+ n 1))) > > instead. That is, I don't get the purpose of the for statement. Neither do I now ;-), nice, Vlad --~--~-~--~~~---~--~~ You received this message because you a

Re: one way to write a factorial function

2008-11-23 Thread prhlava
Wow, the apply version above is faster (but not much) than the version on: http://clojure.org/special_forms the "apply" version run 8.55 [minutes] the special_forms version run 9.50 [minutes] (this was for n=10 on and old P3) Beginners luck I suppose... Vlad PS: Displaying the number ta

one way to write a factorial function

2008-11-23 Thread prhlava
Hello folks, While learning, it occured to me that factorial function can be written as: (defn factorial [n] (apply * (for [x (range 1 (+ n 1))] x))) I know that it has big argument list for large numbers, but it seems to scale nicely (at least in clojure). I am sure this was discussed

Re: writing binary values (bytes) to a file

2008-11-21 Thread prhlava
Hello Jeffrey, > Code is located at: > http://github.com/jbester/cljext/tree/master/cljext%2Fbinpack.clj Thanks for the link, more food for study on how to write a generic library... Basically, I am scheme/lisp noob, learning it in my spare time, the progress is slow but rewarding... Few obs

Re: writing binary values (bytes) to a file

2008-11-20 Thread prhlava
Hello Graham, > Bonus question for the bored reader: write a function, > (byte-array-maker N), that takes a width N, and returns a function > that takes an Integer as input and returns an N-width byte array > containing the Integer in big-endian order. E.g. > > ((byte-array-maker 4) 652187261) >

Re: [SOLVED] writing binary values (bytes) to a file

2008-11-19 Thread prhlava
Hello again, Thank you all for the posts and explanations, After getting the clojure SVN version and few tweaks in the code, the working result looks like: (with-open [ofile (new java.io.FileOutputStream (str result-directory

Re: offtopic - where are you come from? (poll)

2008-11-19 Thread prhlava
> I'm from Slovakia. :) I am from my mum who was in Slovakia at the time of my birth ;-) (and I have grown up in Slovakia) Vlad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

writing binary values (bytes) to a file

2008-11-19 Thread prhlava
Hello all, I have started to play with the clojure a day ago and today I have almost finished porting simple program (from plt-scheme). The place I got stuck in is - how to write a binary value (multiple bytes) in one write operation to a file... The code uses java.io.FileWriter, but this wants