Re: clj-ldap

2011-11-04 Thread Saul Hazledine
Hello  George,

You can use the bind? function in this fork of clj-ldap:

https://github.com/pauldorman/clj-ldap

Saul

On Nov 4, 2:03 am, gtasso geta...@gmail.com wrote:
 I am very new in Clojure. I'd like someone to how an example code on
 how we can authenticate users on a windows server using clj-ldap
 library.

 Best,

 George Tasso.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread Saul Hazledine
On Mar 29, 3:13 pm, B Smith-Mannschott bsmith.o...@gmail.com wrote:
 I can see the advantages of going this route for simple templates that
 contain no optional elements and no repetition, but that's not going
 to get me far. I still don't understand how these kinds of issues:

 (defn constructor
  [{:keys [class-name fields] :as cfg}]
  [     class-name ( (formal-params cfg) ) {\n
   (statement-list
    (for [f fields]
      [        this. f  =  f ]))
       }\n])

 ... are handled in the usual templating solutions without needing a
 turing complete templating language. But, at that point, I'm not sure
 what I've gained, as I already have a perfectly servicable programming
 language in Clojure.  How does one really separate content from
 presentation in such a case?

Unlike a lot of people, I personally I don't see the problem as
avoiding expressiveness in the templates.

I see the problem as one of context switching between generating code
and the template. The Hiccup library does this nicely by allowing
datastructures to be the template and clojure s-expressions to be the
generating code. The cost of this is that formatting is lost -
however, this is actually a feature since the minimized output is read
by a browser rather than a human being.

There are two additional problems when generating a algol-like
programming language from within Clojure. The language itself is hard
to express within clojure and the formatting is usually important.
Because of this I would recommend a templating system that has been
specifically written to preserve formatting. If you need loops then
StringTemplate supports them.

I haven't done this within Clojure but below is small example of a C++
Cheetah template:

https://gist.github.com/892415

Although it looks a bit of a mess the general structure of the C++ is
clear and the templating code is not too intrusive.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: using clojure for (java) code generation; advice sought

2011-03-29 Thread Saul Hazledine
I had a think about using Clojure rather than go to a separate
template system. Here's a horrible hack that uses eval to support
string templates:

(ns clj-template.core
  (:require [clojure.contrib.string :as string]))

(defn remove-templating [s]
  (string/replace-re ## \ s))

(defn build-code [s]
  (str (str \ (remove-templating s) \)))

(defmacro foreach [loop-stuff  body]
  `(apply str
  (for ~loop-stuff
(str ~@body

(defn eval-template [s]
  (- (build-code s)
  read-string
  eval))

In the templates anything surrounded by #'s (hashes) is a clojure form
that should be a compatible argument to str.

On Mar 29, 3:13 pm, B Smith-Mannschott bsmith.o...@gmail.com wrote:

 (defn constructor
  [{:keys [class-name fields] :as cfg}]
  [     class-name ( (formal-params cfg) ) {\n
   (statement-list
    (for [f fields]
      [        this. f  =  f ]))
       }\n])


Then becomes:

(eval-string 
public Example(#(format-params cfg)#)
{
#(foreach [f fields]#
this.#f# = #f#;
#)#
})

The general idea might be applicable to what you want.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Announcement: flutter - hiccup-based form field generation

2011-03-28 Thread Saul Hazledine
On Mar 27, 12:04 am, Joost jo...@zeekat.nl wrote:
 I'm currently working on a library to provide a consistent and
 extensible method for generating form fields, based on hiccup.


I think this is a cool thing to do. One thought I had was that your
approach looks very general - could it be used for all types of HTML
generation or is it limited to form fields?

 The code is at github:https://github.com/joodie/flutter

 The README should give you a decent indication of what I'm aiming for.
 In any case, this library will NOT provide validation routines (though
 it should integrate nicely with clj-decline or whatever you might
 prefer). I'm keeping my sights on the do one thing, but do it right
 goal.


I think this is a good direction to go in. I'm really interested in
how things will turn out.

One thing to look out for (it may not even be an important problem but
it has bugged me) is how attributes such as max-length end up as
validation and html. Looking at things from an MVC perspective max-
length is an attribute of the model that ends up used by the
controller for validation and also in the view html. I feel it would
be good if there was a painless way of using such attributes across
multiple libraries such as clj-decline and flutter. If people start
using HTML5 form validation, this problem multiplies.

 I'm still working on the tests, but in any case, the tests are the
 right spot to look at right now to see some examples.

 Some more convenience functions should be coming soon. For now, I've
 been mostly trying to get a consistent internal API.


I think the API is the most innovative thing about what you are doing
- the functionality is already there, entangled, in most web
applications.  I feel you would get more early feedback on your
approach if you documented the API. Personally, I struggle to get an
overview of a library from the unittests.

Good luck.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-ldap - Clojure LDAP client

2011-03-20 Thread Saul Hazledine
On Mar 16, 9:30 am, Ray Miller r...@1729.org.uk wrote:
 On 15 March 2011 08:46, Saul Hazledine shaz...@gmail.com wrote:

  On Mar 15, 1:30 am, Paul Dorman paul.dor...@gmail.com wrote:
  One thought though is that it may be quicker simply do a lookup on the
  directory server, obtain the password and then do a compare. In
  OpenLDAP, posixUser uids are indexed by default. Java libraries are
  available for most password encryption algorithms. This is the
  approach I use - do you know of any problems with my method?

 Certainly when I was running LDAP servers we did not allow passwords
 to be retrieved from the server, as they are then susceptible to an
 offline dictionary attack. To authenticate users, you had to send a
 bind request to the server.


This is a very good point which I have added to the documentation.

I have made the bind functionality public and released version 0.0.4
of clj-ldap.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-ldap - Clojure LDAP client

2011-03-15 Thread Saul Hazledine
On Mar 15, 1:30 am, Paul Dorman paul.dor...@gmail.com wrote:
 Hi Saul,

 I would like to implement a LDAP authentication in Clojure, based
 around clj-ldap. Do you think it is necessary for the bind-request
 function to be private? In LDAP v3 bind requests can be sent at any
 time during a connection, so I can run a small connection pool for
 authentication without the overhead of creating a new connection every
 time someone authenticates. My plan is to take the UID and password,
 search the directory for the matching DN, and then bind with that DN
 given the provided password.
 changes

I had no idea you could do that - cool.

One thought though is that it may be quicker simply do a lookup on the
directory server, obtain the password and then do a compare. In
OpenLDAP, posixUser uids are indexed by default. Java libraries are
available for most password encryption algorithms. This is the
approach I use - do you know of any problems with my method?

 Any enormous flaws in this approach? More specifically, would you
 consider a public bind-request function in an upcoming release?

I can see no flaws with your approach. I can do this on Friday if you
don't mind waiting. Otherwise, if you want to make the changes
yourself to the master branch, do a pull request and I'll gladly merge
in the new functionality.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-ldap - Clojure LDAP client

2011-03-15 Thread Saul Hazledine
On Mar 15, 11:16 am, Jozef Wagner jozef.wag...@gmail.com wrote:
 Hi,

 Could you please license clj-ldap under open source license?

 JW

Its in the project.clj but I'll make it clearer in the README.

(defproject clj-ldap 0.0.3
  :description Clojure ldap client
  :url https://github.com/alienscience/clj-ldap;
  :dependencies [[org.clojure/clojure 1.2.0]
 [org.clojure/clojure-contrib 1.2.0]
 [com.unboundid/unboundid-ldapsdk 2.0.0]]
  :dev-dependencies [[swank-clojure 1.2.1]
 [org.apache.directory.server/apacheds-all
1.5.5]
 [org.slf4j/slf4j-simple 1.5.6]
 [clj-file-utils 0.2.1]]
  :license {:name Eclipse Public License - v 1.0
:url http://www.eclipse.org/legal/epl-v10.html;
:distribution :repo
:comments same as Clojure})


Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-ldap - Clojure LDAP client

2011-03-15 Thread Saul Hazledine
On Mar 15, 11:14 am, Paul Dorman paul.dor...@gmail.com wrote:
 Hi Saul,

 I'm happy to wait until Friday, but check your request queue before
 you make the change yourself as I may submit one. I've made the change
 on my own fork, but I've only changed the function definition from
 private to public; I haven't looked into the changes required for
 testing and documentation.

That's totally fine. I don't mind doing tests if you don't have time.
Since you have a clearer idea on how to use the changes, I recommend
that you do the documentation (even if its just rough notes).


 I'd probably prefer the approach I described partly to keep the
 overhead of decryption on the LDAP server rather than on my
 application server. Strictly speaking from ignorance, I'd guess that
 the LDAP server would perform the decryption a little faster, and with
 a smaller memory footprint. Also, binding to the LDAP server means
 that your application only needs to know how to negotiate a secure
 connection over LDAPS, irrespective of the encryption scheme used on
 the directory server, removing the requirement to build in support for
 every scheme likely to be encountered in the wild (which might also
 introduce legal complications).

I see the advantages now.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: DDJ for Clojure/Lisp/FP

2011-03-14 Thread Saul Hazledine
On Mar 14, 3:41 am, Andreas Kostler andreas.koestler.le...@gmail.com
wrote:

 Maybe this group could finally get the ball rolling...Surely a collection of 
 highly talented individuals could initiate a forum for
 technical exchange at the level Peter suggests (somewhere between a blog and 
 a book) - basically the level DDJ is operating
 at these days.


The level you mention suggests some sort of review (possibly
anonymous?).

One possibility is to base it around a web application to make things
relatively low maintenance. Just an idea for discussion - somebody
could submit a text in the style of a blog post which is then passed
to relevant reviewers who come back with comments. If the post isn't
accepted the author doesn't loose much as they can then post it as a
normal blog.

The reviewing is work but if its kept in the style of a blog post
rather than an academic paper the overhead shouldn't be too high. The
use of an application would reduce the need for an editor.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Can this function be simpler?

2011-03-10 Thread Saul Hazledine
On Mar 10, 7:48 pm, Damien Lepage damienlep...@gmail.com wrote:
 Sorry for the dumb questions, I'll try no to be too noisy on this list.

I found this thread useful. Please keep asking questions.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Issue with lein-ring...

2011-03-09 Thread Saul Hazledine
On Mar 8, 8:31 pm, John Szakmeister j...@szakmeister.net wrote:
 I've been working on a web app, and it was using leiningen-war.  The
 author of that suggest moving to the lein-ring plugin on his github
 site... so, I did that.

Apologies if the wording in the README of leiningen-war has caused any
problems. The road to hell is paved with good intentions.

Leiningen-war remains alive and supported. I'm happy to fix bugs and
add features when requested - I use the plugin myself and will
continue to do so. However, people new to Java web development were
having problems with Leiningen-war since it does everything in the
Java style with XML config files and an unfamiliar directory
structure. This approach was obviously a barrier for newcomers using
Clojure who wanted to create a deployable web application. The lein-
ring plugin is a much easier plugin to use, it integrates well with
Ring and it has extra features. It is my hope was that all new users
start with lein-ring.

I'll change the README in leiningen-war to make it clearer.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: transaction rolled back: java.lang.InterruptedException

2011-02-25 Thread Saul Hazledine
On Feb 25, 12:28 am, clj123 ariela2...@gmail.com wrote:
 I've tried saving a much smaller number of rows and I'm still getting
 this exception.

 I also tried processing the rows (without saving to database) and put
 a Thread sleep. That also generated this exception.


Here are some more guesses if you haven't tried them already:

1. Remove the transaction if there is one. Only write a single record.

2. If you're getting the Exception when processing the rows without
doing anything with the database (including starting a transaction)
then perhaps something during the processing of the rows (or the gui?)
is calling Thread.interrupt().

Sorry these aren't very good suggestions.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: akka

2011-02-23 Thread Saul Hazledine
On Feb 23, 1:17 am, Mark Engelberg mark.engelb...@gmail.com wrote:
 3. What is Clojure's state-of-the-art for building distributed,
 fault-tolerant systems with its existing feature set and/or leveraging
 popular libraries?


I've not used it, but jobim is worth looking at since it brings
together all the components required for fault tolerant distributed
systems:

https://github.com/antoniogarrote/jobim

Although, like most people, I would love the convenience of a complete
Java implementation of ZeroMQ.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Release.Next Version Number

2011-02-23 Thread Saul Hazledine
Below are suggestions to the shortcomings you mention. I'm genuinely
interested in how they don't meet your needs.

On Feb 23, 8:42 pm, David Jacobs develo...@allthingsprogress.com
wrote:
 - definitive, simple, integrated package management
Leiningen and Cake?

 - a better REPL experience out of the box (esp. Jline support)
Slime/Emacs? I only use the REPL in very rare cases and aren't
bothered by a lack of JLine.

 - a simpler, more useful stack trace
Slime?

 - better commandline integration

https://github.com/gar3thjon3s/clargon

 - abstracting away Java concepts like excessive hierarchies for package
 definitions (src/com/mycompany/wow/this/is/getting/long/my-library.clj)

You don't have to use this convention. Personally I keep things
shallow.

 - better discovery for existing, well-tested libraries.

You can search on http://clojars.org/. This works well for me.
However, the key to well tested libraries is having people give
feedback if a library breaks or is badly documented or doesn't meet
their needs.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread Saul Hazledine
On Feb 23, 9:42 pm, clj123 ariela2...@gmail.com wrote:
 I have been getting this exception:
 java.lang.Exception: transaction rolled back:
 java.lang.InterruptedException
         at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj:
 142)

I can only take some wild guesses I'm afraid. The rollback occurs
because clojure.contrib.sql tends to wrap operations in transactions.
It appears that an InteruptedException occured during an operation and
this called the rollback.

Wild guesses:
1. The app is trying to write lots of data and a timeout has occured.
2. The database is busy and a timeout has occured.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: java.lang.Exception: transaction rolled back: java.lang.InterruptedException

2011-02-23 Thread Saul Hazledine
On Feb 23, 9:54 pm, clj123 ariela2...@gmail.com wrote:
 I'm getting the following exception trying to insert large batch data
 in the database.

I'd try to write less data at one time to the database. Start with,
say, 20 rows at a time.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: defrecord/deftype ...

2011-02-16 Thread Saul Hazledine
On Feb 16, 6:07 pm, Michael Ossareh ossa...@gmail.com wrote:
 One place it has mattered is in using compojure with ring. I'm building a
 few middlewares that permit my applications to have a good sense of
 structure (somewhat MVC ish) in that process I discovered that to be
 compojure compatible you must return a supported type or extend the
 Renderable protocol.


Do you have more details of this - it sounds interesting...

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Get digits of a number

2011-02-16 Thread Saul Hazledine
On Feb 17, 6:29 am, Andreas Kostler andreas.koestler.le...@gmail.com
wrote:
 Is there an easy and idiomatic way of getting the digits of a number in 
 clojure?

 (defn explode-to-digits [number]
         (map #(- (int %) (int \0)) (str number)))
 (explode-to-digits 123456)
 = (1 2 3 4 5 6)

I'd do it this way:

(defn explode-to-digits [number]
(seq (str number)))

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Get digits of a number

2011-02-16 Thread Saul Hazledine
On Feb 17, 6:29 am, Andreas Kostler andreas.koestler.le...@gmail.com
wrote:
 Is there an easy and idiomatic way of getting the digits of a number in 
 clojure?

 (defn explode-to-digits [number]
         (map #(- (int %) (int \0)) (str number)))
 (explode-to-digits 123456)
 = (1 2 3 4 5 6)

Sorry, my first answer was careless and stupid - this time with
numbers:

(defn explode-to-digits [number]
   (map #(Character/digit % 10) (str number)))

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Finding info about a function

2011-02-15 Thread Saul Hazledine
Hello,
  Apologies if this there is an obvious documented answer to this
question. If I write a function:

   (defn example
  Get info about a function
  [f]
  (println Arity is (arity f))
  (if (is-anonymous? f)
 (println Function is anonymous)))

I believe I can implement is-anonymous as:

   (defn is-anonymous?
  Indicates if the given function is anonymous
  [f]
  (re-find #\$eval\d+\$ (str f))

But I have no idea how to find an arity of a function. Is there a
better way of finding if a function is anonymous and is it possible to
find the arity?

Thanks in advance for any help.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Finding info about a function

2011-02-15 Thread Saul Hazledine
Very sorry. I should have searched before I wrote.

http://groups.google.com/group/clojure/msg/fb9930ba2a25d2dd


On Feb 15, 11:00 am, Saul Hazledine shaz...@gmail.com wrote:
 Hello,
   Apologies if this there is an obvious documented answer to this
 question. If I write a function:

    (defn example
       Get info about a function
       [f]
       (println Arity is (arity f))
       (if (is-anonymous? f)
          (println Function is anonymous)))

 I believe I can implement is-anonymous as:

    (defn is-anonymous?
       Indicates if the given function is anonymous
       [f]
       (re-find #\$eval\d+\$ (str f))

 But I have no idea how to find an arity of a function. Is there a
 better way of finding if a function is anonymous and is it possible to
 find the arity?

 Thanks in advance for any help.
 Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Functional program design concepts

2011-02-15 Thread Saul Hazledine
On Feb 15, 9:04 pm, MS 5lvqbw...@sneakemail.com wrote:
 Hi, I just (mostly) finished reading the Programming Clojure book and
 while it gave a great overview of the language, I'm still at a loss
 for how to design programs.

You'll get better answers later but here is my take on it.

 Maybe my mind has been polluted by OO concepts.

Maybe a combination of OO and static typing.

 For example, I'm trying to figure out how to do polymorphism in FP.
 Specifically, an electrical circuit is a type of graph (vertices and
 nodes).  

I would say an electrical circuit is a type of datastructure and you
already have those built in to the language. There's no need to set up
a type hierarchy to express it. My first approach would be to build a
datastructure that can describe an electrical circuit.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-ldap - Clojure LDAP client

2011-02-10 Thread Saul Hazledine
On Feb 10, 8:36 am, Jozef Wagner jozef.wag...@gmail.com wrote:
 One question, If I search for some entries, you return results as a sequence
 of maps. How do I get dn of some result? It seems that your entry-as-map
 converts attributes but strips away entry dn.

 I've solved this by adding :dn key in each entry map, 
 seehttps://github.com/wagjo/dredd/blob/master/src/dredd/ldap.clj#L19


Many thanks for spotting this important missing attribute. Thanks also
for the link to your code. After reading your version I realised that
clj-ldap should also allow attributes to be selected for an ldap/get.

I've fixed the problem with dn, added attribute selection to ldap/get,
improved the README slightly and released this as version 0.0.2 which
is now on clojars.org.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


[ANN] clj-ldap - Clojure LDAP client

2011-02-09 Thread Saul Hazledine
Hello
   I've written clj-ldap which is a thin layer on the unboundid ldap
sdk and allows clojure programs to talk to ldap servers. I'm keen to
get feedback on API and am happy to change it if needed.

(ns example
  (:require [clj-ldap.client :as ldap]))

(def ldap-server (ldap/connect {:host ldap.example.com}))

(ldap/get ldap-server cn=dude,ou=people,dc=example,dc=com)

  ;; Returns a map such as
  {:gidNumber 2000
   :loginShell /bin/bash
   :objectClass #{inetOrgPerson posixAccount shadowAccount}
   :mail d...@example.com
   :sn Dudeness
   :cn dude
   :uid dude
   :homeDirectory /home/dude}

The library provides access to the connection pooling, load balancing,
and failover facilities of the SDK. It supports ldaps and the
operations get, add, delete, modify and search. It also supports
spooling search results to reduce memory usage.

TODO:
Better documentation of Exceptions and error codes.
Support for the increment operation in modify
Support for LDAP controls

Github project:  https://github.com/alienscience/clj-ldap

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Time/size bounded cache?

2011-02-06 Thread Saul Hazledine
On Feb 6, 12:32 pm, Eugen Dück eu...@dueck.org wrote:
 A while back the discussion on the bounded memoize thread in this
 forum lead to Meikel writing up a nice summary of how to do caching,
 providing a pluggable strategy: lru, ttl, fifo, etc. Meikel's writeup
 can be found athttp://kotka.de/blog/2010/03/memoize_done_right.html

 It presents a bunch of different implementations, detailing whats good/
 bad about each of them.

If you need to move function calls out of the cache there is cache-dot-
clj which consists of minor changes to memoize done right:

https://github.com/alienscience/cache-dot-clj

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: AOP in Clojure

2011-02-02 Thread Saul Hazledine
On Feb 2, 2:09 pm, Nebojsa Stricevic nebojsa.strice...@gmail.com
wrote:
 Hi,

 Are there any general purpose libraries/frameworks with nice API/DSL
 for Aspect Oriented Programming for Clojure? Or is there someone
 working on it? Is it needed? Possible?


I agree with Shantanu and feel that Ring is a nice example of AOP
behaviour using functions. For a general purpose library you may find
Robert Hooke useful:

https://github.com/technomancy/robert-hooke

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Deflayout - define Swing UI declaratively

2011-02-02 Thread Saul Hazledine
On Feb 2, 7:43 pm, Alexander Yakushev yakushev.a...@gmail.com wrote:
 Usage of the lib is very easy. Here is an example from my tetris game:

 (deflayout
     frame (:border)
     :WEST gamepanel
     :EAST (deflayout
                 sidepanel (:flow :TRAILING)
                 nextpanel
                 (JButton. Exit)))


I haven't done any Swing programming in Clojure yet but this looks
really cool. It looks much nicer than the standard Java API I
struggled with a few years ago.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


LDAP library?

2011-02-01 Thread Saul Hazledine
Hello,
  This question has been asked before but it was over a year ago. I
need to start using Clojure with LDAP and I was wondering if anybody
had written a clojure library to do this rather than using the
standard Java JNDI API (which doesn't look like much fun and is a
further abstraction on top of LDAP).

I am looking for something simple that allows me to lookup/add/delete/
edit an entry for a given distinguished name without any fancy
searching. I'd like connection pools though.

I'm thinking of writing a thin layer on top of the Unbound SDK if
nothing else is available:
http://www.unboundid.com/products/ldapsdk/

Has anyone done this already?
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Enhanced Primitive Support Syntax

2011-01-15 Thread Saul Hazledine
On Jan 15, 2:40 am, Armando Blancas armando_blan...@yahoo.com wrote:
 They used to give you compile switches for that kind of stuff, not
 hope and wholesome wishes. Seems like every performance improvements
 makes the language more complex, uglier or both.


I don't feel strongly about integer limits at all and am always
surprised when this comes up. I did scientific programming on a 32 bit
platform for several years and never met anyone who hit big problems
with fixed size integers. For illustration, Long.max is:

   9 223 372 036 854 775 807

which is so much bigger than I was used to. I know encryption requires
BigInteger but I have yet to see a native clojure encryption library.
It would help people like me understand the debate if some mainstream
examples of applications requiring (seamless) BigInteger support could
be identified.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Monad newbie question

2011-01-13 Thread Saul Hazledine
Hello,
  I've never used monads but I have a problem that feels like it could
be solved elegantly with them.

 I have a sequence of functions of arbitary size and an input sequence
s. Each function is given a sequence and returns a sequence that can
be bigger than the input sequence. I want the output of one function
to be operated on using a mapcat of the next function:

(let [seq-of-fns [f1 f2 f3 ... fm]]
 (mapcat fm ... (mapcat f2 (mapcat f1 s)))

If any of the functions return nil, I'd like the computation to stop.
This seems like something that should be possible with the maybe-m in
clojure.contrib.monad but I don't understand how to do the following:

1. How do I handle an arbitary seq-of-fns [f1 f2 ... fm]?
2. How can I specify that I want a function to mapcat the return value
of the previous function?

I've read the monad tutorials linked at 
http://richhickey.github.com/clojure-contrib/monads-api.html
which have been very useful but any extra help would be appreciated.

Thanks in advance
Saul


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Monad newbie question

2011-01-13 Thread Saul Hazledine
On Jan 13, 9:18 am, Saul Hazledine shaz...@gmail.com wrote:
 Hello,
   I've never used monads but I have a problem that feels like it could
 be solved elegantly with them.

  I have a sequence of functions of arbitary size and an input sequence
 s. Each function is given a sequence and returns a sequence that can
 be bigger than the input sequence. I want the output of one function
 to be operated on using a mapcat of the next function:


Sorry, I explained that wrong. Each function takes a single item and
returns a sequence - this is why mapcat is used.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Monad newbie question

2011-01-13 Thread Saul Hazledine
On Jan 13, 7:35 pm, Ken Wesson kwess...@gmail.com wrote:

     (let [seq-of-fns [f1 f2 f3 ... fm]]
          (mapcat fm ... (mapcat f2 (mapcat f1 s)))

  If any of the functions return nil, I'd like the computation to stop.

 I don't see any real reason not to use

 (reduce #(if %1 (mapcat %2 %1)) s seq-of-fns)



That seems to work nicely thanks. I hadn't thought of using reduce to
produce a sequence before.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure 1.3 contrib development environment

2011-01-08 Thread Saul Hazledine
Hello,
  I was just using the very useful clojure.contrib.trace and had a
worry about using it with clojure 1.3. At the moment I just (use '
clojure.contrib.trace). As I see it,  in future I will have to update
my project.clj to include clojure.contrib.trace, run lein deps and
restart my development environment.

One way to be lazy in situations like this is to use the complete
clojure.contrib as a dev dependency. However, this fix has the
disadvantage that missing dependencies for the deployed application
will not be seen until deployment.

I had an idea of creating a dummy dependency that includes useful
development libraries from contrib such as the repl utils, namespace
utils and trace. I could put this on clojars but I was wondering if it
would be better in contrib in the same was as clojure.contrib/
complete?

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure Newbie trying to represent electrical circuit

2011-01-04 Thread Saul Hazledine
Hello Michael,

On Jan 3, 7:40 pm, MS 5lvqbw...@sneakemail.com wrote:
 Hi, I'm new to clojure (though I've messed around in scheme a little)
 and I'm trying to represent an electrical circuit with pins and
 nets (ie in graph terminology vertices and edges).

 I'd like to represent the nets as {:name net_name :pins #{pin1 pin2
 pin3}} etc.
 I'd like to represent each pin as {:name pin_name :net the_net :type
 pin_type}

 I want to query the net for all its attached pins, and to query any
 pin to see what net it's attached to.  The problem here is that these
 are mutually-referring things.  The net refers to the pins and each
 pin refers back to the net.


I found it difficult to find, but I remembered a thread on something
similar:

http://groups.google.com/group/clojure/browse_thread/thread/604b48a520aa0253/5e3f5d3d1d870557?lnk=gstq=cross+referencing+objects#5e3f5d3d1d870557

The answer from David Nolen mentioned some little used functions of
the Clojure language that may be useful for you.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: command line options parser

2010-12-11 Thread Saul Hazledine
On Dec 11, 7:08 am, Alan a...@malloys.org wrote:
 Have you considered instead providing a clojure wrapper around a well-
 known java command-line parser? The only one I've used is apache-
 commons-cli, which I found to be pretty lackluster, 
 buthttp://www.freebsdsoftware.org/java/java-getopt.htmlis from FreeBSD
 and claims to be a 100% compatible port of getopt. I enjoy writing
 code as much as the next guy, but I'd rather have a clojure wrapper
 around a well-tested library than something I threw together that
 seems to work.


I saw this and thought the opposite! I think it is a good thing that
somebody has done a higher level argument parsing library.

As far as I know, getopt doesn't support type conversion, help text or
field validation. Generally, higher level languages have better
argument parsing libraries than the getopt style, Python for instance:
http://docs.python.org/library/optparse.html

Saul


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: batch could be fun in clojure

2010-12-09 Thread Saul Hazledine
On Dec 8, 11:12 pm, Raoul Duke rao...@gmail.com wrote:
 another take on rpc/queries/services:

    www.odbms.org/download/2010-09-Batches-ICOODB.pdf

 apparently very preliminary, i can't find the java implementation
 referred to in the slides.

I liked the idea but was sceptical since most remote work is done
using RPC, web services or SQL. Then at the end of the presentation
they show that they have layers to handle this and I was very
impressed. The batch statement should be relatively easy to make using
macros. Cool.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Tailing a file in Clojure

2010-12-03 Thread Saul Hazledine
On Dec 2, 8:53 am, viksit vik...@gmail.com wrote:
 Hi all,

 What would you recommend as the best method to tail a file using
 Clojure? Are there any built in functions in contrib or core that
 allow a program to read the last line of a file as it is appended to?
 If not - how do people solve a problem like this?

 My aim is simple - I've got a log file and I'd like to parse it as it
 gets appended to.


I have had to do this in the past and I use unix commands:

https://gist.github.com/726875

The code above runs a unix command in a separate thread and executes a
given function, f, on a sequence of output lines. It handles restarts
if the command gets killed by a log rotation.

For the actual tail command I'd recommend looking at a recent version
of GNU tail or install inotail - a filewatching API which makes these
commands much more efficient:

http://distanz.ch/inotail/

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: ClojureQL 1.0.0 finally released as public beta

2010-11-25 Thread Saul Hazledine
On Nov 25, 8:28 am, LauJensen lau.jen...@bestinclass.dk wrote:
 ClojureQL:

 (defn oracle-take
   [tname limit]
   (- (table (str (SELECT ROW_NUMBER() OVER (ORDER BY key ASC)
                    AS rownumber,columns
                    FROM  (to-tablename tname) )))
       (select (where (= :rownumber limit)))
       (project [*])))

 (to-sql (oracle-table :users 10))
 [SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY key ASC) AS
 rownumber,columns FROM users) WHERE (rownumber = ?) 10]

 From the outset it has been my ambition to make ClojureQL extremely
 composable and as far as possible allow users to directly insert
 strings into the query to allow for backend specific customization.
 The entire design-plan of this customization is not yet thought out so
 input is welcomed. To me, flexibility and leaving with the power to
 the user is the key to wide adoption across various backends.


My experience would agree with this assumption. I looked at the
original Clojure QL for use with H2 but didn't want to put in the
effort of writing a H2 driver to TEST a library that I may want to
use. If I can play with the library and I like it, its then no problem
at all to write some small workarounds for the non-standard behaviour
of the database I'm using.

Ideally though, it would be nice if workarounds for various databases
were added to the library as the appear - so in this example I can
call oracle-take without having to write it myself.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: memcache, redis connection pooling

2010-11-25 Thread Saul Hazledine
On Nov 24, 9:12 pm, Wilson MacGyver wmacgy...@gmail.com wrote:
 I highly recommend jedis for redis java lib. It supports connection
 pooling, pub/sub.
 and works with the 2.0 protocol.

 https://github.com/xetorthio/jedis


Many thanks for that. Now it looks like the best way forward is to
wrap existing Java libraries.

 Any reason why you want to use both memcached and redis at the same time?
 redis is basically memcached++, with collection/queue support as values,
 and persist the data to disk periodically. I'm not sure what memcached
 fits in here if you already have redis.


I started with a general library for my own use copied from existing
code: (https://github.com/alienscience/cache-dot-clj). That has
evolved into a hobby project for general use. The idea is that
somebody can start with an in-process cache and move to other systems
as the application scales without changing the Clojure API. I take
your point and will go with redis support first though.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


memcache, redis connection pooling

2010-11-21 Thread Saul Hazledine
Hello,
  I am looking at adding memcache and redis support to a caching
library that I have written.

Ideally,  I'd like TCP/IP connections to be pooled and reused. Pooling
should reduce the number of open connections and remove the latency of
creating new connections. In my experience with other systems, TCP/IP
pooling is more efficient and robust than opening new connections on
every operation - however, if somebody with memcache or redis
knowledge has differing opinion it would be good to hear it.

I am considering the Whalin Java library for memcache which supports
pooling:

https://github.com/gwhalin/Memcached-Java-Client/wiki/HOWTO

Has anyone got experience of using this library with Clojure? Also, is
there a similar library for Redis?

Another possibility is forking and adding pooling to existing memcache
and redis libraries written in Clojure. If I attempted this, does
anybody know of a good TCP/IP connection pool library that works with
Clojure?

Thanks in advance for any help.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure on the AppEngine Talk

2010-11-19 Thread Saul Hazledine
On Nov 19, 7:08 am, Miki miki.teb...@gmail.com wrote:
 Greetings,

 I gave a short presentation on getting started with Clojure on the
 AppEngine tonight at the clj-la meetup.
 Slides can be found 
 athttps://docs.google.com/present/view?id=ah82mvnssv5d_1784s26pwsh

 Comments welcomed.

 Enjoy,
 --
 Miki

I'm going to restart app-engine development soon and this will be
really useful. Many thanks.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Parameterized SQL queries?

2010-11-10 Thread Saul Hazledine
On Nov 10, 6:35 pm, Daniel Bell dchristianb...@gmail.com wrote:
 I'm a newb to both SQL and Clojure, and after reading this post
 (http://groups.google.com/group/clojure/browse_thread/thread/718fa1b72...
 ) I was curious as to exactly it means to parameterize a query. Is it
 a way to automatically insert arguments into the query, a way to
 destructure the results, or what?


A normal query:
select name from employee where department = 'xfiles'

A parameterised query (prepared statement) which can be called later
with the parameter xfiles:
select name from employee where department = ?

Most databases support prepared statements which can be parsed once
and then called multiple times for improved performance. The setup
though has some overhead and you will occasionally hear people saying
that parameterised queries are overrated. However, with JDBC, prepared
statements have the advantage that the parameters, ?, are protected
from SQL injection attacks:

http://www.owasp.org/index.php/Preventing_SQL_Injection_in_Java

I'd recommend that you use prepared statements where possible - all
the clojure database libraries support them and clojure.contrib.sql
creates them behind the scenes when you do things such as insert
records.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Simple Neural Network DSL -- request for feedback

2010-11-10 Thread Saul Hazledine
On Nov 10, 11:20 pm, Eric Schulte schulte.e...@gmail.com wrote:
 Hi,

 Inspired by cgrand's regexp example [1], I've implemented a simple DSL
 for specifying neural networks using Clojure data types.  

This is really clear. The web page documentation is awesome.

 Construction of this simple language involved a number of choices as to
 where to place complexity (into the DSL or into user land), generally I
 erred on the side of leaving complexity out of the DSL resulting in
 potentially more complex usage, but in increased generality.  I'd love
 to hear any feedback on how this could be improved, simplified, or made
 more idiomatic.


Its probably not a direction you want to go in, but when using a Lisp
to specify the network architecture it opens up the possibility of
using genetic programming to design a network to fit a particular
problem. The map format doesn't fit this but, because you use
protocols in the implementation, a list format for the DSL would allow
genetic programming.

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.100.4432

Obviously though, their DSL is nowhere as clear and clean as yours.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Supporting 1.2 and 1.3

2010-11-04 Thread Saul Hazledine
Hello,
  I've put some small libraries on github. At the moment they
specifically depend on Clojure 1.2 and contrib (since its the released
version). However, I have had requests to take out the dependencies on
clojure and contrib so that they don't infect projects that use them.
Is this standard practice? Would it catch people out?

I thought about alternative approaches but have no solution. For
instance, in Leiningen, it is possible to specify a minimal version
e.g
[org.clojure/clojure-contrib [1.2,)]

This would normally be fine but in 1.3 the dependency on contrib
changes:

[org.clojure.contrib/standalone 1.3.0-alpha2]

Has anyone hit this problem? What is the best way of dealing with it?

Thanks in advance for any help.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: clj-sql 0.0.4

2010-10-24 Thread Saul Hazledine
Hello,
  clj-sql was written by developers who use clojure.contrib.sql but
needed to add a few features to support their projects. Most of the
functionality and API is inherited from clojure.contrib.sql but the
following additions have been made:

* Functions to describe tables and schema objects
* Table and field names can include dashes e.g. :customer-invoice.
* Functions to do inserts returning autogenerated ids.
* A function to retrieve query results using a database cursor.

  I'm announcing this on the main Clojure group because there has been
a release containing new useful functionality that has been discussed
here. There is also a new google group for help and support.

Many thanks to Kyle Burton who kindly provided code for the new
features.

Github:  http://github.com/alienscience/clj-sql
Clojars: http://clojars.org/clj-sql
Group:  http://groups.google.com/group/clj-sql

Feature requests, changes or new code are very welcome.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: post your feedback on the conj

2010-10-24 Thread Saul Hazledine
On Oct 24, 6:03 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
 It was terrific meeting so many of you for the first time. Thanks again to 
 all the attendees, speakers, sponsors, and volunteers for making the conj 
 great.


Is there any video of the conference available for those of us on the
other side of the Atlantic? I wanted to go but costs and time
prevented me.

Many thanks
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: sql and cursors

2010-10-17 Thread Saul Hazledine
On Oct 17, 1:04 am, Kyle R. Burton kyle.bur...@gmail.com wrote:
 As far as I can tell, contrib.sql's functions do not use database
 cursors (at least for PostgreSQL, again as far as I can tell).  For
 result sets that are larger than you'd like to load into the running
 process, but rather step through the results and have them fetched on
 demand from the server, I've tried creating a version of
 with-query-results that does this.

Somebody else had the same problem and came up a similar solution:

http://groups.google.com/group/clojure-dev/browse_thread/thread/d8334759f10f3f45

https://www.assembla.com/spaces/clojure-contrib/tickets/88-clojure-contrib-sql-runs-out-of-memory-on-very-large-datasets

I have no idea when this will get released though.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: sql utilities

2010-10-14 Thread Saul Hazledine
On Oct 14, 9:16 pm, Kyle R. Burton kyle.bur...@gmail.com wrote:
 I've written some sql helper functions that will do things like list
 the objects in the database and describe a table.  I've found these
 handy when doing interactive development as I don't have to jump over
 to another app to see what the make up of tables are.  I've also used
 it in some scenarios when generating code from the database schema.


Very cool. If you have no joy getting it into contrib you can have
write access to clj-sql if you want it:

http://github.com/alienscience/clj-sql

Otherwise, as Shanatu says, a github project of your own would be
welcome and is sure to be used by others.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Creating a new library

2010-10-13 Thread Saul Hazledine
On Oct 13, 1:21 pm, lprefonta...@softaddicts.ca wrote:
 Good to know... is this written somewhere ? I looked at Clojars yesterday
 but did not find anything...


Its mentioned near the end of the tutorial:
  http://github.com/ato/clojars-web/wiki/tutorial

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojars SSH key change?

2010-10-12 Thread Saul Hazledine
Hello,
  I just got the following error back from ssh/scp when copying
something back to clojars.org:

@@@
@   WARNING: POSSIBLE DNS SPOOFING DETECTED!  @
@@@
The RSA host key for clojars.org has changed,
and the key for the corresponding IP address 173.230.139.200
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.

I'm guessing the server has been moved/upgraded but I thought it best
to check since I couldn't see a notice of this anywhere.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Creating a new library

2010-10-12 Thread Saul Hazledine
On Oct 13, 5:31 am, lprefonta...@softaddicts.ca wrote:
 As far a publishing to Clojars, I do not know the policy.
 Uploading various jars maintained by other teams not involved in
 Clojure may pollute the repo along the way.


As I understand it, its fine to put jars from other projects on
Clojars. If you do this, it is recommended to use your own groupid or
org.clojars.your-userid as the groupid. That way people know that
the jar files aren't from the originating team. If the originating
team ever puts their package on the central maven repository the
clojars package won't be picked up by mistake by people who want the
official package.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Cross-referencing objects?

2010-10-03 Thread Saul Hazledine
On Oct 3, 9:32 am, Alan a...@malloys.org wrote:
 I've got a collection of unique objects, and I need to partition them
 into sets. That part's easy enough, but I need to have both of the
 following be efficient, and preferably easy:
 - Given an object, determine what set it's in
 - List all the objects in a given set

I'm sure you'll get better answers later but this is the pseudo code
for what I would do.

1. Separate  your objects into clojure sets. This makes it quick and
easy to list the objects in a given set.
2. To find out which set an object is in, do a get on each set until a
non nil return value is seen using (some #(% obj) [my-sets])


 I could construct all the objects and have a single global map, with
 mappings for both set-id=[objects] and object=set-id, but this seems
 kinda gross and obscures what is actually meant (objects belong to
 sets) with implementation (integers/keywords mapping to groups of
 objects, and objects mapping to integers).


3. Only the mapping, object = set, is needed and, as you say, this is
an implementation detail that should be hidden. So memoize step 2 for
performance. You get a global map but it doesn't clutter your code.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: relational data aggregation language

2010-10-02 Thread Saul Hazledine
On Oct 2, 2:55 am, Ross Gayler r.gay...@gmail.com wrote:
 I am looking at the possibility of finding/building a declarative data
 aggregation language operating on a small relational representation.
 Each query identifies a set of rows satisfying some relational
 predicate and calculates some aggregate function of a set of values
 (e.g. min, max, sum). There might be ~20 input tables of up to ~1k
 rows.  The data is immutable - it gets loaded and never changed. The
 results of the queries get loaded as new rows in other tables and are
 eventually used as input to other computations. There might be ~1k
 queries. There is no requirement for transaction management or any
 inherent concurrency (there is only one consumer of the results).
 There is no requirement for persistent storage - the aggregation is
 the only thing of interest. I would like the query language to map as
 directly as possible to the task (SQL is powerful enough, but can get
 very contorted and opaque for some of the queries).

Two things probably worth mentioning in case you weren't aware of
them.

With most clojure build tools you can pull in a full relational
database system such as H2, HSQLDB or Apache Derby and run an in
memory database.

Incanter (a R like platform for clojure) supports select and group-by
on its datasets. With Incanter you can also plot pretty graphs etc.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: disk-backed memoize?

2010-10-01 Thread Saul Hazledine
On Sep 18, 7:25 pm, David McNeil mcneil.da...@gmail.com wrote:
 http://github.com/alienscience/cache-dot-clj

 Thanks for the link. That is helpful.

  Would JDBC suit your needs as a storage medium?

 I suppose that would work, but I am thinking that an ehcache based
 plugin forcache-dot-cljmight be a good solution.


I've released cache-dot-clj version 0.0.3 and have added an ehcache
based plugin.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: appengine-magic: using Clojure with Google App Engine

2010-09-21 Thread Saul Hazledine
On Sep 20, 10:15 pm, Constantine Vetoshev gepar...@gmail.com wrote:

 http://github.com/gcv/appengine-magic

 Comments welcome, as always.


One thing that would simplify the process a little is that, when
Leiningen 1.4 is released, that appengine-magic uses the plugin
manager to install:

http://groups.google.com/group/leiningen/browse_thread/thread/d889549e445e3711

This would save having to make a lein project, edit project.clj and
delete a file.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: appengine-magic: using Clojure with Google App Engine

2010-09-20 Thread Saul Hazledine
On Sep 20, 10:15 pm, Constantine Vetoshev gepar...@gmail.com wrote:
 I'd like to announce the release of a working version of appengine-
 magic, a library designed to make it easier to get started with Google
 App Engine using Clojure.

 appengine-magic abstracts away nearly all the boilerplate necessary to
 deploy an App Engine application. It also enables interactive
 development through the REPL.

 http://github.com/gcv/appengine-magic


It took me days to get a working app-engine development environment
setup. This is very welcome indeed.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: disk-backed memoize?

2010-09-18 Thread Saul Hazledine
On Sep 18, 3:00 am, David McNeil mcneil.da...@gmail.com wrote:
 Is there a disk-backed memoize available? I have an application where
 I would like the cache of values to survive restarts of the app.


I don't know of one but in the next few weeks I was planning to add
memcache functionality to cache-dot-clj to support my use of the
google app engine:
http://github.com/alienscience/cache-dot-clj

The scary thing for me is reliably serialising and hashing the
function arguments. If this is done, adding other (out of process)
storage should be quite easy. I normally cache database accesses but I
guess you're trying to memoize something much slower.

Would JDBC suit your needs as a storage medium? You could use H2,
HSQLDB or Derby by adding a dependency in your build tool of choice.
If this is of interest I'll add it.

Also, if you come up with a solution sooner, I'd be eager to steal
your code.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A secretly Clojure web framework?

2010-09-04 Thread Saul Hazledine
On Sep 4, 5:45 am, HB hubaghd...@gmail.com wrote:
 Hey,
 Since Relevance is heavily investing in Clojure, do you think they are
 working on a Clojure web framework?
 Personally, I wish.

Its also worth looking at Conjure if you're interested in a web
framework:
http://github.com/macourtney/Conjure

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A secretly Clojure web framework?

2010-09-04 Thread Saul Hazledine
26 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
 I am interested to know what deficiencies do you see in present state
 of affairs in Clojure web development space. It would be something
 useful to discuss.

I think the packages that exist are exciting and that some of them
represent a step forwards even when compared to more established
languages.

 However, much that I hate frameworks (personal opinion not meant to
offend), they are very good for plugins that touch different layers of
an application (e.g data storage, routing and HTML generation). I
can't see a way things like Django style user management or admin
screens can be done by libraries.

Frameworks are also very good for rapid prototyping. You usually pay
for such power with inflexibility but Rails and Django seem to hit a
sweet spot where you can develop a website fast and still run a
business on them.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Web Development - templating?

2010-09-01 Thread Saul Hazledine
On Sep 1, 7:57 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Wed, Sep 1, 2010 at 12:33 AM, Laurent PETIT laurent.pe...@gmail.com 
 wrote:
 The ideal setup, in my opinion, after using all sorts of different web
 frameworks and languages over the last 14 years, is to have all the
 HTML in the template - code never generates HTML - and to have *some*
 markup in the HTML template to allow:
 * dynamic variable substitution
 * conditional selection
 * looping
 * including other templates (or some sort of 'wrapping' to make
 layouts with common elements easy to work with)

 Designers find this easy to work with (as long as you keep the dynamic
 markup to a minimum). Developers find this easy to work with because
 they can keep HTML separate from code (and therefore focus on logic in
 their code).


Personaly I use Hiccup, but I highly recommend that you take another
look at Enlive. To me it seems an evolutionary step beyond existing
templating systems. There is no logic in the templates at all which
makes it super easy for designers. Developers typically manipulate the
HTML (entirely in clojure) by setting content based on id or style.

You get all the functionality you listed only with nice twists and
features. The downside is the learning curve.

A good tutorial can be found at:
http://github.com/swannodette/enlive-tutorial

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Web Development - templating?

2010-09-01 Thread Saul Hazledine
On Sep 1, 9:09 am, Sean Corfield seancorfi...@gmail.com wrote:
 This may be better suited for the new clojure-web-dev list but I'm
 used to building web apps with primarily HTML views that have some
 embedded scripting. Is there anything similar for Clojure?


Fleet is also worth mentioning as it is an all Clojure solution that
seems to follow the approach you are most comfortable with:

http://github.com/Flamefork/fleet

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: help with native-jar files..

2010-08-25 Thread Saul Hazledine
On Aug 24, 4:43 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com
wrote:
 Could not locate de/jreality/plugin/JRViewer__init.class or
 de/jreality/plugin/JRViewer.clj on classpath:
   [Thrown class java.io.FileNotFoundException]

 I verified that the final jar that I created had JRViewer file it is
 complaining about using jarexplorer.. can anybody help me with a suggestion?
 Sunil.

This is not such a useful suggestion but I recommend you try with a
new repl after running:
lein clean  lein deps  lein repl

I had a similar problem with something yesterday and the error message
changed to a FileNotFoundException after the package was used once.

Sorry I can't be more helpful.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: FSM

2010-08-19 Thread Saul Hazledine
On Aug 16, 3:55 am, ngocdaothanh ngocdaoth...@gmail.com wrote:
 I have used Erlang's gen_fsm and like it very 
 much:http://erlang.org/doc/design_principles/fsm.html

 I want to write a game in Clojure and I need a FSM library (best if it
 supports timeout event). I would like to ask if there is any Java (or
 Clojure?) FSM library that works well with Clojure.

 Thanks.

I've not used it state machines in Clojure but I just found this
thread while searching for something else:

http://groups.google.com/group/clojure/browse_thread/thread/ec529d99e1c37de1/19e750580d203158

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure Web Programming group?

2010-08-17 Thread Saul Hazledine
Hello,
  Personally I really like the way web development in Clojure is
improving. Rather than huge frameworks there are different libraries
that are coming together to form a useful toolset. Even the framework
Conjure is lightweight and using general purpose libraries under the
hood.

One drawback of this library approach though is that it is daunting to
beginners. Not only do newcomers have to choose what tools they want
to use they have to find a way to fit them together.

I've noticed that each library is being supported in their own group/
forum. This is fine for the well used libraries but less mainstream
libraries have groups with little traffic. Also, since libraries need
to interoperate it would be nice to have a place where library users
and library developers are aware of other web development going on.

I have developed three small libraries, mostly useful for web work,
that could be of interest to other people. However, I don't want to
start three different google groups which not only see no traffic but
also separate some tools which can be best applied together. Because
of this I was going to just have one group that supported all three.

One idea I had though was to go one step further and start a Clojure
web development group so that other developers of small libraries and
users of them could go to one place for support and discussion. Would
this be uncool or would it be useful?

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Installing Clojure on OS X

2010-08-17 Thread Saul Hazledine
On Aug 17, 3:59 pm, HB hubaghd...@gmail.com wrote:
 Hey,
 How to install Clojure on Mac OS X?
 I googled the web, some use MacPorts, others write some shell scripts.
 Is there a -standard- way to install Clojure on OS X (if possible,
 please don't refer me to MacPorts)?
 Thanks all for help and time.

I used a Mac in the past and I understand your frustration with
MacPorts. I've not used Clojure on OSX but if you're bored you could
try Homebrew which is an alternative to MacPorts.

http://mxcl.github.com/homebrew/

Then: brew install clojure

Hopefully you'll get a more useful replies later.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Installing Clojure on OS X

2010-08-17 Thread Saul Hazledine
On Aug 17, 6:22 pm, Michael Gardner gardne...@gmail.com wrote:

 What's wrong with MacPorts? I've used it to install Clojure (and many other 
 things) on my Mac, without much trouble.

I've never used MacPorts with Clojure and don't use a Mac at all now
so things might have improved. However, I had 3 years of trouble using
MacPorts as a package system - broken dependencies and inconsistent
behaviour across machines being the big problems. My co-workers all
had similar experiences so I do understand why some people don't like
it.

I think the idea behind Homebrew was to address the broken dependency
problem by reducing the number of dependencies (so problems propogate
less) and to make fixing dependencies more democratic by using git.

But my opinion is pretty worthless because I don't use a Mac and I've
never used Homebrew :-)

Saul


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure Web Programming group?

2010-08-17 Thread Saul Hazledine
On Aug 17, 8:21 pm, Brian Carper briancar...@gmail.com wrote:
 On Aug 17, 7:15 am, Saul Hazledine shaz...@gmail.com wrote:

  One idea I had though was to go one step further and start a Clojure
  web development group so that other developers of small libraries and
  users of them could go to one place for support and discussion. Would
  this be uncool or would it be useful?

  Saul

 I think it would be useful.  I don't think it would replace each
 project's individual list for things like bug reports and feature
 requests.  But it would be nice to have a place for end-users of the
 various libraries to talk about using them, and talk about integrating
 them.

 --Brian

Do you think that it would be a problem is some people (ie me) used
such a forum for bug reports and feature requests?

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: A useful function?

2010-08-16 Thread Saul Hazledine
On Aug 16, 8:31 am, Alan a...@malloys.org wrote:
 (defn apply-keys [f ks]
   (zipmap ks (map f ks)))

 Does this seem useful to anyone else?

It seems very similar to memoize in that you're mapping function
arguments to their results.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Trouble upgrading to clojure 1.2

2010-08-16 Thread Saul Hazledine
Aug 16, 8:03 pm, Alan a...@malloys.org wrote:

 $ cat project.clj
 (defproject ddsolve 1.0.0-SNAPSHOT
   :description FIXME: write
   :dependencies [[org.clojure/clojure 1.2.0]
                  [org.clojure/clojure-contrib 1.2.0]]
   :dev-dependencies [[swank-clojure 1.2.0]])

You're doing everything right - its just Clojure 1.2 hasn't been
released yet. I'm currently using RC3 within Leiningen without any
problems:

[org.clojure/clojure 1.2.0-RC3]
[org.clojure/clojure-contrib 1.2.0-RC3]


Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Transactions in c.c.sql functions

2010-08-14 Thread Saul Hazledine
On Aug 13, 11:23 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:

 As far I understand, transactions belong to the user. The user should
 decide what to execute under which transaction. By beginning
 transaction inside these functions, is it assumed that the user can
 wrap bigger constructs under her own transactions and that the JDBC
 driver would support nested transactions?

I'm unsure of why clojure.contrib.sql does start transactions without
documenting them but it is a lot smarter than it first appears. My
understanding is that JDBC relies on the underlying database to
support nested transactions. However, clojure.contrib.sql supports
nested transactions on all databases by keeping a count of the level
of nesting and only executing a database transaction at the outer
level.

http://github.com/richhickey/clojure-contrib/blob/6a0483d9e216ca00fc648a4b3673996b76a2785a/src/main/clojure/clojure/contrib/sql/internal.clj#L144

I don't know if this is an ideal thing to  do but my own modest, not
mission critical, use of it has not run into any problems.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: form-dot-clj - HTML form validation and display

2010-08-13 Thread Saul Hazledine
Form-dot-clj is library for handling the display and validation of
forms. It Supports HTML5 forms, javascript validation and plain HTML.
It should work with most methods of generating HTML.

http://github.com/alienscience/form-dot-clj

In the last 10 minutes I have also found a library called pour that
works in a similar way.

http://github.com/Kaali/pour

Form-dot-clj example:

(def-field username
  [:maxlength 20]
  [:pattern [A-Za-z0-9]+ Only alphanumeric characters please])

(def-field email-address
  [:email Sorry, that style of email address is not supported])

(def-form example
  {:size 20 :required Please fill this in}
  :username (textbox username)
  :email(textbox email-address))

;; Use the following function to show the form when generating html
(show-controls example)

;; Use the following function to validate a post of this form
(on-post example params success-fn failure-fn)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: On retrieving auto-generated IDs after INSERT

2010-08-12 Thread Saul Hazledine
On Aug 11, 10:15 am, Remco van 't Veer rwvtv...@gmail.com wrote:
 There was a thread about this some months ago;

  http://groups.google.nl/group/clojure/browse_thread/thread/e95d477830...

 Somebody came up with his own version of insert-record:

  http://gist.github.com/373564#LC62


Thanks for linking to that. I left this as a gist because its such a
small bit of code. However, given that it isn't very visible I'll
start a github project for it. If anybody has any other useful extras
to clojure.contrib.sql (theres one that handles - in table names
that I'll contact the author about) I'm keen to include them.
Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: leiningen-war

2010-08-09 Thread Saul Hazledine
On Aug 9, 5:08 am, rob r.p.l...@gmail.com wrote:
 As far as I can tell, based on using it so far, the war plugin for
 leiningen requires writing a web.xml file.  I was just wondering why
 it doesn't generate that xml file for you based on the information
 you've specified already in leiningen.  Would that be a good
 contribution to make, or are there reasons why it is preferable to
 write out the xml file?

I hadn't thought about that. If you can come up with a way of doing it
that would be supercool and I'd be happy to pull in your changes. One
thing to look out for is that some people (me included) mix Java and
Clojure servlets and so there still needs to be a way of manually
writing a web.xml for people that want it.

Possible approaches I can think of are:
1. making automatic generation only happen if there is no web.xml
2. add automatic generation as an option (either in project.clj or on
the command line)
3. write an alternative plugin (e.g lein-webxml) that uses the hooks
feature of leiningen to produce a web.xml when lein war is called.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Looking to fit Clojure into my architecture and am in need of your informed advice!

2010-08-02 Thread Saul Hazledine
Hello Kent,

On Aug 1, 2:00 pm, Kent Larsson kent.lars...@gmail.com wrote:

 I'm planning to reduce my time at my full time job to create a small
 startup. And I am thinking about create a lean and mean architecture
 which will enable me to get things done.

Cool!

 I am thinking about creating a layered architecture like this:

 1. Front end
 2. Business
 3. Database

 I think that the 2. Business Layer should be Clojure. It would talk
 to the 1. Front End by a web service REST interface. Exactly how the
 data should be encoded is something I haven't though about yet. But
 JSON seems like an easy format.

Building a JSON service in Clojure and Compojure is easy to do.

 My idea is basically to create a good Customer Relationships
 Management (CRM) system and sell it as a service to companies. The
 users will input information about customers and related events and it
 will be easy to search. I'll have quite a lot of business logic which
 makes these tasks easier. The logic will most often be stuff which
 handles graphs (which SQL really has some problems handling nicely).

I've not used it but neo4j looks like it might be worth looking at:
http://neo4j.org/

 Some must have goals:

 1. If it becomes a success, it needs to be able to scale over multiple
 machines with load balancing. There will be some data which should be
 replicated between the machines, but a delay is all right.
 2. As I sell it uptime is important. If I have several machines and
 one of them dies. I'd like the service to be available using the other
 machines.

Some people have had success getting Clojure running on google app
engine. You get scaling for little effort but the BIG downside is that
your app can take over 10 seconds to respond when nobody is using it
(when under load the app runs at a decent speed).

 My questions:

 1. Do you think Wicket is a good choice for the front end for me? It
 has session state on the server which I need to replicate in more or
 less real time. If I have the state on the client using JavaScript I
 don't have to deal with that replication. But how would I achieve that
 in the most smooth way? Should I go for Compojure for the front end to
 not have to deal with two languages? And then maybe skip the
 separation of layer 1. Front End and 2. Business?

I've not used wicket. Compojure/Hiccup are wonderful, will handle
session state no problem, but they aren't a full web framework. You
will have to do extra work compared to say Ruby on Rails, Django or
Grails where you can get a front-end up in a weekend.

 2. Will it be hard to write a nice web service interface in Clojure?
 Is it a suitable communication strategy with Clojure? Maybe I am
 making it too complicated?

Web services are easy in Clojure/Compojure (that's worth saying
twice).

 3. Clojure has a lot of nice stuff for handling data in transactions.
 But if all my data resides in a database will I get to really enjoy
 this advantage? I have been thinking about actually storing the data
 using Clojure and skip the database, to get more out of Clojure. Is
 that idea too crazy? I will have to deal with data replication myself
 then, or maybe something like memcache will solve it for me?

Personally, I'd stick with some sort of database as it will have been
designed to protect your data from accidents. Clojure has lots of
advantages even if you don't use the concurrency features.


 5. Is it hard to debug Clojure? Using Java/C# today you get a real
 treat when it comes to debugging with interactive stepping, expression
 watching and a lot of other cool things. Where is Clojure debugging
 compared to other languages? Is the debugging features as necessary as
 in other languages?

Conventional debugging is harder at the moment but having a REPL or
using swank means there is less need for debugging anyway. You can
play with each function as you write it.

 7. Any other advice or thoughts you have about this?

I wouldn't worry too much about scaling. Making an application
scalable is a lot of work (unless you're using something like Google
appengine). Computers are much faster than they used to be. A single
machine running Jetty/Compojure with a database such as H2 will handle
100's/1000's of pages per second. If you exceed this your business
will be very successful, you will know your application better and
then you can concentrate on scaling.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Idiomatic Clojure namespace names

2010-07-10 Thread Saul Hazledine
On Jul 10, 12:16 am, Mike Meyer mwm-keyword-googlegroups.
620...@mired.org wrote:
 On Fri, 9 Jul 2010 12:49:05 -0700 (PDT)

 j-g-faustus johannes.fries...@gmail.com wrote:
  That said, I would leap at a chance to shorten Java names, even if it
  were just to chop off the leading com or org.

 As the owner of mired.org, but not of mired.com (and I don't know the
 registered owner) or .net, or of that domain in any other TLD, I'd have
 to call that the worst suggestion so far.

But the chances of mired.com bringing out a library called 'proclog'
are insignificant. As mentioned before in this discussion, TLDs change
owners anyway so the TLD convention can't be used to definitively
identify an owner. The aim of the convention is to reduce the chances
of library names clashing.

As another suggestion how about clj.handle.library e.g
clj.mired.proclog
clj.weavejester.compojure
clj.acme-corp.dynamite

This separates the clojure namespace from the java one, doesn't tie to
a TLD and reduces the chances of collisions at the library level.

Also, somebody mentioned dropping api/core from the core namespace in
a library. Personally, I'd be happy with that.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Idiomatic Clojure namespace names

2010-07-09 Thread Saul Hazledine
On Jul 8, 8:38 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
 My opinion: no need to create problems when there already are accepted
 solutions.

 In the java world, there are conventions for naming things. Stick with them.


I do see your point and if this is the way the consensus moves I'll
follow it. However, the java solution does create the following new
problems:

1. It leads to deep directory structures that are horrible to navigate
on the command line (even using tab completion) and when browsing
source code. I just went to github and browsed the new volt-db
library. It uses a java style naming convention and I had to click
through 4 levels of directory to get to some source code.

2. It makes the 'ns' declaration at the top of a source file harder to
read. Instead of seeing easy to recognise libraries such as compojure,
hiccup and ring the person reading has reversed tlds to parse.

Somebody ended up on another thread because they had a typo in their
title. However, I like their solution of libraryname.author.file e.g
compojure.weavejester.api
dynamite.acme-corp

The hard work of finding unique handles/authors is done by vanity
(individual or company).

Also, to add my opinion on the original question that started this
thread, I prefer 'foo.api' to 'foo.core' as it gives a clearer idea of
which namespace should be pulled in by the user.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Idiomatic Clojure namespace names

2010-07-07 Thread Saul Hazledine
On Jul 7, 5:24 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
 if you intend to share the library, then use the classical prefix notation:

   * either of the form net.reeves.james.foo  ( or any reversed tld you own )
   * either of the form com.yourcorp.foo


com.read.to.easy.that.not.its.but

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Newbie questions about leiningen

2010-07-03 Thread Saul Hazledine
On Jul 2, 6:35 pm, Nicolas Oury nicolas.o...@gmail.com wrote:

 I am looking for a way to tell leiningen what JVM options to use with the
 SWANK server. (I need a lot of Heap size to do anything useful...)

 I wasn't able to find that in the doc. Is it not the right way of
 proceeding?

I'd recommend the sample project file as a good place to look for
various settings:

http://github.com/technomancy/leiningen/blob/master/sample.project.clj

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: cache dot clj - caching impure functions

2010-07-03 Thread Saul Hazledine
cache-dot-clj Clojure library that caches the results of impure
functions.

It is almost entirely based on the memoize functions described here:
 http://kotka.de/blog/2010/03/memoize_done_right.html

I have found this useful for caching the results of database calls and
for holding HTML snippets.

This library is available at clojars.org for use with Leiningen/Maven.

Github page:
http://github.com/alienscience/cache-dot-clj

 Example Usage =

(ns an-example
  (:use cache-dot-clj.cache))

(defn get-user-from-db
  Gets a user details from a database.
  [username]
  ;; Slow database read goes here
)

;; Cache the last 1000 users read in
;; i.e support serving a 1000 concurrent users from memory
(def get-user-from-db
  (cached get-user-from-db (lru-cache-strategy 1000)))

;; First read of the user is slow
(get-user-from-db fred)

;; Second is fast
(get-user-from-db fred)

;; When fred's details are changed invalidate the cache
(invalidate-cache get-user-from-db fred)

;; The next call will read from the db and cache the result again
(get-user-from-db fred)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: cache dot clj - caching impure functions

2010-07-03 Thread Saul Hazledine
On Jul 3, 10:41 am, Nicolas Oury nicolas.o...@gmail.com wrote:
 I have a - very simple - memoizer that uses Weak/Soft/Hard Hash tables from
 the JDK or from google collections.
 (Google collections has different strategies for expiration of cache. Soft
 is the last time since used strategy. Weak is
 a good strategy for object for which identity is equality.)


If you have the code in a working state I'd be happy try to add the
google/JDK methods as algorithms to the library. Alternatively feel
free to fork the code and add them yourself and I'll incorporate your
changes.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: scala

2010-06-24 Thread Saul Hazledine
On Jun 18, 11:56 pm, cageface milese...@gmail.com wrote:

 Unfortunately there seems to be a lot more commercial momentum for
 Scala though. It's still a blip compared to the mainstream languages
 but I'm seeing more and more job posts mentioning it, and hardly any
 for Clojure. I don't think Scala is a bad language overall, but I'm
 not sure I'd dump Ruby for it. On the other hand, I can imagine
 migrating most of my dev work over to Clojure with the right project.
 Has anybody else wrestled with this choice? Any thoughts?

I started playing with Scala before I decided to make a long term
commitment to learning and using Clojure. I think Scala is both
exciting and awesome. The only thing that bothered me about it was the
community's choice of a two space indent (its very tiring to look
after a few hours).

I ended up choosing Clojure for my own needs because the availability
of macros and I enjoy programming in Clojure more than other
languages. Personally I feel big corporate style projects destroy a
language - I've seen simple elegant Java code but the culture went in
a different direction entirely. So I personally would be happier if
Scala goes mainstream and Clojure doesn't.

The really cool thing though, is that with the JVM, Clojure and Scala
can interoperate.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure web app + js libraries - any suggestions?

2010-05-16 Thread Saul Hazledine
On May 15, 5:23 pm, Base basselh...@gmail.com wrote:
 So I would love to hear what others have done in the past to integrate
 clojure into a web app.  Any info would be most appreciated.


I use compojure 0.4 with hiccup to generate the HTML. It feels like a
very old school way of developing a web application because it isn't
a do everything web framework. However, things have gone smoothly and
I've had no problems with this approach. Despite being a clojure
newbie I have found my productivity is very good with slowdowns caused
by having to write things such as user management and form validation
myself.

I haven't integrated any javascript yet and the application is
responsive enough that I may only add minimal javascript as needed
after the first release. My intention is to use jquery and scriptjure:

http://arohner.blogspot.com/2010/04/writing-jquery-code-with-scriptjure.html

I'm using an embedded H2 database engine which is low latency (5 - 10
ms to get query results back) and has made a big difference to how the
application feels.

Overall I would recommend this setup as (very) enjoyable and flexible
but if you're on a tight deadline then a full web framework may be
more appropriate.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure.contrib.sql insert id

2010-04-21 Thread Saul Hazledine
On Apr 20, 8:51 pm, Remco van 't Veer rwvtv...@gmail.com wrote:
 I am doing the following after an insert for a Derby database:

   (sql/with-query-results res
     [VALUES IDENTITY_VAL_LOCAL()]
     (first (vals (first res

 For MySQL it would be something like:

   (sql/with-query-results res
     [SELECT LAST_INSERT_ID()]
     (first (vals (first res


Thanks Remco. I'm using H2 and its seems possible to do something
similar by accessing the INFORMATION_SCHEMA. However, this also feels
wrong to me so I'm trying the JDBC route which should be more
consistent across databases. My first working attempt is at:

http://gist.github.com/373564#file_sql.clj

It contains a alternative to insert-records called 'insert-record'
which returns a database id and a macro that wraps up multiple inserts
in a transaction. The macro doesn't feel very idiomatic so I'd welcome
any feedback on how to change it.

-
extended.sql/insert-record
([table record])
  Equivalent of clojure.contrib.sql/insert-records that only inserts a
single
   record but returns the autogenerated id of that record if
available.

-
extended.sql/insert-with-id
([db  table-records])
Macro
  Insert records within a single transaction into the database
described by
   the given db spec. The record format is :table  { record-hash }.
   The record hashes can optionally access a hashmap 'id' which holds
the
   autogenerated ids of previous inserts keyed by the table name. e.g.

  (insert-with-id db-spec
  :department {:name xfiles
   :location secret}
  :employee   {:department (id :department)
   :name Mr X})

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


clojure.contrib.sql insert id

2010-04-20 Thread Saul Hazledine
Hello,
  I'm using clojure.contrib.sql/insert-records to add data to a
database. I've hit a problem where I am unable to get the
autogenerated IDs of the records that I have inserted.

I believe in JDBC this is normally done with
statement_handle.getGeneratedKeys(). Unfortunately, as far as I can
see, the statement handle is unavailable to the users of
clojure.contrib.sql. Has anyone else had this problem?

Saul Hazledine

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Choosing a Clojure build tool

2010-03-26 Thread Saul Hazledine
On Mar 25, 7:55 pm, Chas Emerick cemer...@snowtide.com wrote:
 I published a blog post earlier today, along with a short screencast  
 that might be of interest:

 Read on:http://muckandbrass.com/web/x/AgBV

The article reads to me as, don't reinvent the wheel, everyone should
use maven. Personally I disagree with this because maven
configuration is much harder than it needs to be. About an hour ago I
had to add the hierarchy, executions/execution/goals/goal to a pom.xml
file and found it needlessly tedious and wholly dependent on copy and
pasting from a webpage.

I also don't think it is necessary to choose a single build tool. I've
used different ones at various times. Leiningen works for me, is easy
to understand and extend, and interoperates well with maven --
everyone using clojure could standardise on leiningen and my existing
maven builds would still work. I also have a small bit of code using
ant/ivy and that would build fine too in a leingingen only world.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Software Training Center and Startup Incubator

2010-03-11 Thread Saul Hazledine
On Mar 10, 10:37 pm, startup jennifermorgan2...@gmail.com wrote:
 The software center would try to steer the candidates to use Lisp/
 Clojure over other languages because of the flexibility and speed with
 with ideas can be developed and the languages inherent suitability for
 large Web Scale/Cloud apps and AI.


I've started a company that is developing a web application in
Clojure. I chose Clojure because, of the available JVM languages, it
is the most fun to program -- ie I didn't choose it for good business
reasons.

I am enjoying development so far but I think it is important to point
out that, wonderful though compojure is, web development in Clojure
lacks facilities that more mature web frameworks provide in other
languages. I see this as no bad thing for me personally (I like the
unpolluted simplicity) but it will effect the competitive edge of any
startup that chooses to standardise on Clojure.

This will change with time of course, so it may be that starting a
Clojure specific incubator at this early stage is a wise move in the
long term. However, it may be advisable not to over-promise in the
early stages.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure syntax highlight for web sites

2010-03-01 Thread Saul Hazledine
On Feb 28, 10:57 pm, Ivan ivankob...@gmail.com wrote:
 Do you happen to know of any JavaScript syntax highlighting library,
 alikehttp://code.google.com/p/syntaxhighlighter/orhttp://code.google.com/p/google-code-prettify/,
  supporting Clojure and
 not just Lisp. I've been trying to find one to no avail.

I don't know if it matches your needs but http://gist.github.com/
supports clojure.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Fleet — templating system

2010-02-23 Thread Saul Hazledine
On Feb 19, 10:12 pm, Ilia Ablamonov i...@flamefork.ru wrote:
 I would like to announce an implementation of ERB/JSP/etc -like
 approach for templating with (I really believe) clear and idiomatic
 syntax and design decisions.

 Detailed description and code:http://github.com/Flamefork/fleet


Personally, I'm very happy with the compojure way of building HTML.
However, there was a discussion about a month ago on Hacker News where
someone said that the compojure method didn't suit their designers and
that they found the HTML generated by Enlive too difficult to debug.
Fleet is a more conventional way of templating HTML (which still has
some nice clojure features) and may suit such groups of people.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ANN: leiningen war plugin

2010-01-21 Thread Saul Hazledine
There is a plugin for leiningen that creates war files for use with
servlet containers:

http://github.com/alienscience/leiningen-war/
http://clojars.org/uk.org.alienscience/leiningen-war

To use it include the following dev-dependency in project.clj

:dev-dependencies [[uk.org.alienscience/leiningen-war 0.0.1]]

It meets my needs so far but I'm happy to changes -- however radical
they are.

Saul

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en