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
> 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
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
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
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
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.
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
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
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
--~--~--
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
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
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
> 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
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
> 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
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
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
--~--~---
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
--~--~---
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
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
--~--~--
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
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
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
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 {
> 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
--~--~
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.
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
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
--~
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
> 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
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
> > 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
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,
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"
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
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 (
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
> 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
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
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
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
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
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)
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
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 "
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
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
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,
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
-
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.
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
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
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
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
> 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
> > 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
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
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
> 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
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
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
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
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)
>
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
> 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
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
66 matches
Mail list logo