dynamic namespace generation using clj-record

2010-10-27 Thread takashi
Hello Jimm I've been testing the clojure library clj-record and it is very usefull. But I have a question, I'm a 'noob' on clojure language and I'm wondering if it is possible to write a macro or something to get namespaces generated for every table in my database, for

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
I apologize for presenting you with a moving target. That was definitely not my attention. I should have realized I messed up the content of the files but unfortunately had no clue what all these exceptions meant. Therefore I really appreciate your detailed description of the conclusion you draw

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 14:04, Stefan Rohlfing wrote: > I really learned at lot about dealing with namespaces today. I hope you also learned a bit about error messages. ;) "No such var: user/create": That means you get past the namespace declaration. Hence they load fine. But in the user namespace the

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
You were right again. I left a code snippet from the book in charge.clj and forgot to remove it later. Now everything seems to work fine, even when importing the active- record.user namespace as 'user': (ns active-record.program.cor

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 11:35, Stefan Rohlfing wrote: > Evaluating your suggested declaration: > >  (ns active-record.program.core >    (:require [active-record.user :as u]) >    (:require [active-record.charge :as charge])) > > I get the following error message: > > ;; Unable to resolve symbol: user=>

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
Evaluating your suggested declaration: (ns active-record.program.core (:require [active-record.user :as u]) (:require [active-record.charge :as charge])) I get the following error message: ;; Unable to resolve symbol: user=> in this context ;; [Thrown class java.lang.Exception] The sam

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 11:09, Stefan Rohlfing wrote: > Yes, I also tried charge/create. The error message is different, but > it still does not work: More evidence for a problem with the user alias. Try a different one like (:require [active-record.user :as u]). Sincerely Meikel -- You received thi

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
Yes, I also tried charge/create. The error message is different, but it still does not work: ;; No such namespace: charge ;; [Thrown class java.lang.Exception] On Oct 20, 5:03 pm, Meikel Brandmeyer wrote: > Hi, > > On 20 Okt., 10:46, Stefan Rohlfing wrote: > > > You are right, there was a syn

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 10:46, Stefan Rohlfing wrote: > You are right, there was a syntax error in charge.clj. However, after > correcting the error I get the same error message as with the other > namespace declaration: Did you try the same with charge/create? Examples in books are not necessarily cor

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
You are right, there was a syntax error in charge.clj. However, after correcting the error I get the same error message as with the other namespace declaration: ;; No such var: user/create ;; [Thrown class java.lang.Exception] On Oct 20, 4:37 pm, Meikel Brandmeyer wrote: > Hi, > > On 20 Okt.,

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Meikel Brandmeyer
Hi, On 20 Okt., 10:09, Stefan Rohlfing wrote: > ;; EOF while reading > ;;  [Thrown class java.lang.Exception] Are you sure, that you don't have some syntax error somewhere? Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
:last_name "Berger" :password "secret" :email_address "r...@runa.com"}) And then there is the clj-record macro 'init-model' that creates a model out of a Clojure namespace. However,

Re: clj-record Library: Handling Namespaces

2010-10-20 Thread Michael Wood
On 20 October 2010 10:09, Stefan Rohlfing wrote: > Dear Clojure group, > > I am currently reading chapter 9.1 MySQL & clj-record of 'Clojure in > Action'. > > clj-record seems pretty awesome, but I once again got lost in > namespace jun

clj-record Library: Handling Namespaces

2010-10-20 Thread Stefan Rohlfing
Dear Clojure group, I am currently reading chapter 9.1 MySQL & clj-record of 'Clojure in Action'. clj-record seems pretty awesome, but I once again got lost in namespace jungle. Here is a concrete example: --

Re: Clj-record

2009-09-01 Thread John D. Hume
On Tue, Sep 1, 2009 at 4:43 PM, Luc Prefontaine wrote: > Hi John, > > Clj-record will make its way into production in a couple of weeks. > > It's been working flawlessly in high volume tests here. Hi Luc, That's great to hear. I recently set up a Google Group for clj-r

Clj-record

2009-09-01 Thread Luc Prefontaine
Hi John, Clj-record will make its way into production in a couple of weeks. It's been working flawlessly in high volume tests here. We added an adapter on our medical message bus to capture historical census data in messages. It records patient visits, employees dealing with patients, se

Re: Some code review for clj-record?

2009-01-11 Thread John D. Hume
Hi Emeka, Sorry for the slow response. I don't get that message with the latest clojure, clojure-contrib, and clj-record. (load-file just returns nil.) What version of clojure are you running? Do you have the base directory of clj-record on your classpath? Also, that file just contain

Re: Some code review for clj-record?

2009-01-08 Thread Emeka
user=> (load-file "clj_record/core.clj") I got clj_record/util not in system path. Why is it so? Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Some code review for clj-record?

2009-01-05 Thread Michael Reid
> I guess it comes down to what belongs in metadata. While errors are > certainly data about other data, they don't feel to me like metadata a > la :doc, :tag, :file, :line, and :test. They're the sort of thing I'd > show in an application's UI as part of normal user interactions, > rather than so

Re: Some code review for clj-record?

2009-01-05 Thread John D. Hume
On Mon, Jan 5, 2009 at 1:29 AM, Brian Doyle wrote: > ... Instead of > just returning a hash of errors what about returning the record with the > errors hash in > the metadata? That way you just have the data and the errors in one That's an interesting idea. On the one hand it seems weird to m

Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
John, I was looking at the validates method and I had a thought I'd bounce off you. Instead of just returning a hash of errors what about returning the record with the errors hash in the metadata? That way you just have the data and the errors in one "object" similar to an ActiveRecord model.

Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
Looks good. I didn't know about the *file* var. On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume wrote: > > Brian, > I incorporated your changes and then made changes to load and run all > clj_record/test/*-test.clj files. Thanks again. > -hume. > > > > --~--~-~--~~~---

Re: Some code review for clj-record?

2009-01-04 Thread John D. Hume
Brian, I incorporated your changes and then made changes to load and run all clj_record/test/*-test.clj files. Thanks again. -hume. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: Some code review for clj-record?

2009-01-03 Thread John D. Hume
Hi Brian, On Sat, Jan 3, 2009 at 12:53 AM, Brian Doyle wrote: > I changed the end of the clj-record/test/main.clj script to this: > > main.clj >>>> > (def files ["core-test" "validation-test" "associations-test"]) > (doseq [file files] &

Re: Some code review for clj-record?

2009-01-02 Thread Brian Doyle
John, I was looking around at your tests just to get a feel for using the test-is stuff in the contrib library. I noticed that when I ran main.clj it would run not only the tests in clj-record, but all of the tests in the clojure.contrib as well. I was curious so I attempted to figure out what

Re: Some code review for clj-record?

2008-12-31 Thread John D. Hume
Hi Brian, On Tue, Dec 30, 2008 at 11:41 AM, Brian Doyle wrote: > (ns com.example.user) > (clj-record.core/init-model) > > but when I do that I get the error: > > java.lang.ClassNotFoundException: clj-record.core ... > (first (reverse (re-split #"\." (name (ns-name *ns*) > > and could be ch

Re: Some code review for clj-record?

2008-12-30 Thread Brian Doyle
I see what you are doing with the validations and defining them in the init-modelcall. I think that's a good idea actually and like it better than my solution to putting the callbacks in the model namespace. A couple of small things that I noticed when starting to play around with clj-record

Re: Some code review for clj-record?

2008-12-29 Thread John D. Hume
On Mon, Dec 29, 2008 at 7:15 PM, Brian Doyle wrote: > I noticed that in the init-model macro you are creating a 'defn table [] > ...' function in the > model namespace and was wondering why you didn't just make it a def instead, > since > it doesn't take any args? That didn't occur to me. I do l

Re: Some code review for clj-record?

2008-12-29 Thread Brian Doyle
That seems to be working better now John. I looked over most of the code and it seems like a good start. I'm no expert when it comes to functional programming or Clojure, so I'm not sure how to critic the code exactly. If I was doing the porting I would prolly do it in very OO way, since that'

Re: Some code review for clj-record?

2008-12-28 Thread John D. Hume
Ok, please pull the latest and try again. git clone git://github.com/duelinmarkers/clj-record.git The problem was due to something I've seen a couple other messages about: When running a file as a script, it starts out in the clojure.core namespace. I was doing (def db {...}) before any (ns ...)

Re: Some code review for clj-record?

2008-12-28 Thread John D. Hume
x27;m sure it's something I'm doing wrong but I do have derby.jar on my > classpath. Thanks. > > > On Sat, Dec 27, 2008 at 1:48 PM, John D. Hume > wrote: >> >> Hi all, >> As a learning exercise, I've started working on a sort of clojure >> clone

Re: Some code review for clj-record?

2008-12-28 Thread Brian Doyle
see it here: > http://github.com/duelinmarkers/clj-record/tree/master > > The model used in the tests is defined in files here: > > http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/model > > And the tests most worth reading are: > > http://github.co

Some code review for clj-record?

2008-12-27 Thread John D. Hume
Hi all, As a learning exercise, I've started working on a sort of clojure clone of ActiveRecord (from Rails). You can see it here: http://github.com/duelinmarkers/clj-record/tree/master The model used in the tests is defined in files here: http://github.com/duelinmarkers/clj-record/tree/m