Trouble getting started

240 views
Skip to first unread message

davidjagoe

unread,
Oct 31, 2012, 6:03:55 PM10/31/12
to enf...@googlegroups.com
Hi All,

I am getting no errors, but the enfocus stuff - although it appears to be running has no effect on my DOM.

I am using the following project.clj:

(defproject osprey "0.1.0-SNAPSHOT"
  :description "Reporting Database"
  :plugins [[lein-cljsbuild "0.2.9"]]
  :source-paths ["src/clj"]
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/java.jdbc "0.2.3"]
                 [postgresql/postgresql "9.1-901.jdbc4"]
                 [clj-time "0.4.4"]
                 ;; Web stuff
                 [noir "1.3.0-beta10"]
                 [enfocus "1.0.0-SNAPSHOT"]
                 ]
  :cljsbuild {
        :builds [{
          :source-path "src/cljs"
          :compiler {
            :output-to "resources/public/js/main.js"
            :optimizations :whitespace
            :pretty-print true}}]}
  :main osprey.server)

This is what my client.cljs looks like:

(ns osprey.client
  (:require [enfocus.core :as ef])
  (:require-macros [enfocus.macros :as em]))

(em/deftemplate index-html "index.html" [])

(defn start []
  (js/alert "hello")
  (em/at js/document
         ["body"] "Hello world!")
  )


(set! (.-onload js/window) start)

And my index.html page contains no content - but does contain the body section.

I see the alert but "Hello world!" is never shown.

Can anyone offer me some help?


Thanks,
David

Creighton Kirkendall

unread,
Oct 31, 2012, 7:22:11 PM10/31/12
to enf...@googlegroups.com

Replace "Hello world!" with (em/content "Hello world").   Sorry for the short messages sent from my phone.

CK

--
 
 
 

David Jagoe

unread,
Oct 31, 2012, 10:45:08 PM10/31/12
to enf...@googlegroups.com
Hey Creighton,

Thanks for the reply. Still no luck I'm afraid:

(ns osprey.enlive
(:require [enfocus.core :as ef])
(:require-macros [enfocus.macros :as em]))

;; (em/defaction init []
;; (js/alert "init")
;; (em/at js/document ["body"] (em/content "Hello world!")))

(defn start []
(js/alert "hello")
(em/at js/document
["body"] (em/content "Hello world!")))

(set! (.-onload js/window) start)

I also tried with a defaction which resulted in the same behaviour.

I wonder if its a problem with domina, because after my last post I
tried to use domina directly with no luck. Also, I get the following
output when compiling my cljs:

Compiling ClojureScript.
Compiling "resources/public/js/main.js" from "src/cljs"...
WARNING: Use of undeclared Var domina/tag-name at line 44
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/start-wrap at line 48
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/tag-name at line 44
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/start-wrap at line 48
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/Exception at line 360
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/Exception at line 360
file:/home/david/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: filter already refers to: #'clojure.core/filter in namespace:
enfocus.macros, being replaced by: #'enfocus.macros/filter
WARNING: delay already refers to: #'clojure.core/delay in namespace:
enfocus.macros, being replaced by: #'enfocus.macros/delay
Successfully compiled "resources/public/js/main.js" in 3.236833133 seconds.


Any ideas?


Thanks,
David
> --
>
>
>

fmsbeekmans

unread,
Nov 8, 2012, 8:37:17 AM11/8/12
to enf...@googlegroups.com
Hi,

I'm having the same problem.

This is my cljs code:
(ns cleric.webclient.cljs

  (:require
   [enfocus.core :as ef])
  (:require-macros
   [enfocus.macros :as em]))


(defn setup []
  (js/alert "Hello World")
  (em/at js/document
         ["body"] (em/content "Hello World")))


(set! (.-onload js/window) setup)

I get the alert, but no Hello World.
I noticed that you mentioned to make sure to have the libs folder on your classpath, could you elaborate on that?
The enfocus.core object exists and has many functions.

Thank you,
Ferdy

ckirkendall

unread,
Nov 10, 2012, 11:22:35 AM11/10/12
to enf...@googlegroups.com
I am sorry for not responding earlier.  Can you please post your code to a github repo so I can pull it down and see what the issue is.

CK

fmsbeekmans

unread,
Nov 13, 2012, 11:01:34 AM11/13/12
to enf...@googlegroups.com
https://github.com/fmsbeekmans/enfocus-hello-world

I've kept it to a minimum, gives the same results, no event handler added. Thank you.

fmsbeekmans

unread,
Nov 13, 2012, 11:02:49 AM11/13/12
to enf...@googlegroups.com
p.s. you can push to that repo too.

ckirkendall

unread,
Nov 14, 2012, 9:35:10 PM11/14/12
to enf...@googlegroups.com
The only issue I found was the main.js included in the repo was old and did not reflect the clojurescript code.  I delete the file and recompiled it and everything ran fine.  I pushed the main.js so you could see the difference.  I pushed the changes to the repo.

CK

fmsbeekmans

unread,
Nov 16, 2012, 4:10:10 PM11/16/12
to enf...@googlegroups.com
Thank you for your reply,

I did lein cljsbuild clean and then lein cljsbuild once, and i got the same result. Then changing the version of cljsbuild in the plugins section of my profiles.clj to 0.2.5 from 0.2.9 and got it to work, the pulled version also worked.

Ferdy

Matthew Molloy

unread,
Nov 25, 2012, 1:45:42 PM11/25/12
to enf...@googlegroups.com
Ferdy's github post doesn't address David's original problem which is with the enfocus.macros/at macro.  I also couldn't get the hello world working on more recent versions of enfocus, although it worked on version 0.9.1-SNAPSHOT.  I can github it as well if you'd like to check.

Matt

Creighton Kirkendall

unread,
Nov 25, 2012, 2:31:39 PM11/25/12
to enf...@googlegroups.com

Mathew,
Please send a github link.  So far every attempt to reproduce this issue has failed.   I think the issue may be linked to domina including a version cljs in its dependencies.  I excluded this from enfocus dependencies but if domina is brought in through another package it may be causing issues. 

CK

--
 
 
 

Matthew Molloy

unread,
Nov 25, 2012, 10:56:55 PM11/25/12
to enf...@googlegroups.com
Thanks for your really fast reply,

When I run the attached project the body content does not change, however I do get a match for the second selector because  chromium is logging the message 'uh oh'.  It seems that em/at is passing the root tag (in this example js/document) to all selector functions indiscriminately.  This must be why em/content does not work: it expects to  receive the body tag, not the document tag.

I've added you as a collaborator on the github post https://github.com/whamtet/enfocus-hello-world

I've put more system configuration information in README.md.  When I compile I get all these warnings:


Compiling "main.js" from "src-cljs"...
WARNING: Use of undeclared Var domina/tag-name at line 44 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/start-wrap at line 48 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/tag-name at line 44 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/start-wrap at line 48 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/nodes at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/single-node at line 98 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/Exception at line 360 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
WARNING: Use of undeclared Var domina/Exception at line 360 file:/home/huyen/.m2/repository/domina/domina/1.0.0/domina-1.0.0.jar!/domina.cljs
Successfully compiled "main.js" in 6.028364482 seconds.

Creighton Kirkendall

unread,
Nov 26, 2012, 7:08:47 AM11/26/12
to Enfocus
Mathew,
When I brought down your project I saw the issue you described but when I removed the main.js and recompiled it the issue went away.  I have a feeling the issue is related to a specific version of clojurescript and or cljsbuild.  Can you give me your cljsbuild version.  Also can you compile with your version in simple mode with pretty print so we can see what it is doing.  On the other issue, the function will always be called and passed a domina selection, in this case it is an empty sequence.  When doing custom transformations use (em/trans [node] (.log js/window "test")).

CK


--
 
 
 

Matthew Molloy

unread,
Nov 26, 2012, 7:41:26 AM11/26/12
to enf...@googlegroups.com
Hi Creighton,

I've now pushed main.js with pretty printing and simple optimisations to github.  Here are my system details.

Leiningen 2.0.0-preview10 on Java 1.6.0_24 OpenJDK 64-Bit Server VM

Ubuntu 12.04 LTS

Chromium Version 20.0.1132.47 Ubuntu 12.04 (144678)

~/.lein/profiles.clj

{:user {:plugins [[lein-swank "1.4.4"]
 [lein-noir "1.2.1"]
 [lein-cljsbuild "0.2.9"]
 [gaeshi/lein-gaeshi "0.10.0"]]}}

Many thanks

Matt

Creighton Kirkendall

unread,
Nov 26, 2012, 7:45:10 AM11/26/12
to Enfocus
Mathew,
Do me a favor and put the cljsbuild version to 0.2.5, delete and rebuild your main.js.   Let me know if this fixed the issue. I have a feeling this is an issue with domina and a specific version of clojurescript. 

CK 


--
 
 
 

ckirkendall

unread,
Nov 26, 2012, 3:59:12 PM11/26/12
to enf...@googlegroups.com
I think we have found the issue.  Not completely positive but it looks to be related to this issue in Domina.


CK

ckirkendall

unread,
Nov 26, 2012, 5:14:24 PM11/26/12
to enf...@googlegroups.com
For those that are having this issue included the following in your dependencies and it will correct the issue.
[org.clojure/google-closure-library "0.0-2029"]
[org.clojure/google-closure-library-third-party "0.0-2029"]
This issue is driven by the third party libs being packaged separately now.  So you have to specifically included them in your dependencies.  I will add them to enfocus dependencies going forward.

CK

ckirkendall

unread,
Nov 26, 2012, 7:09:14 PM11/26/12
to enf...@googlegroups.com
I think I jumped the gun on this one.  I already include this in the dependencies so this should not be an issue.  I have done some debugging on the main.js in the enfocus-hello-world and it seems there is invalid compiled code.  In particular it looks like the compilation of domina is not correct.   It looks like the domina.css object being returned contains compiled code that refernces invalid properties.  


a
domina.css.t4025.domina.css.t4025
  1. baseHTMLHtmlElement
  2. cljs$lang$protocol_mask$partition0$393216
  3. cljs$lang$protocol_mask$partition1$0
  4. expr"body"
  5. meta4026null
  6. selfunction (a, e) {
  7. __proto__Object
    1. cljs$core$IMeta$_meta$arity$1function () {
    2. cljs$core$IWithMeta$_with_meta$arity$2function (a, b) {
    3. constructorfunction (a, b, c, d) {
    4. domina$DomContent$true
    5. domina$DomContent$nodes$arity$1function () {
    6. domina$DomContent$single_node$arity$1function () {
    7. __proto__Object
>a.domina$DomContent$nodes$arity$1
function () { var a = this; return cljs.core.mapcat.call(null, function(b) { return domina.normalize_seq.call(null, goog.dom.query(a.expr__$1, b)) }, domina.nodes.call(null, a.base__$1)) }


Notice the a.expr__$1 referenced.  This should be a.expr.  I am will dive a bit deeper into it but this looks like a clojurescript compilation bug.

CK

Creighton Kirkendall

unread,
Nov 26, 2012, 8:31:18 PM11/26/12
to Enfocus
It looks like this was a bug introduced recently into clojurescript the relates to properties being showdowed in reify.  It was fixed in the most recent version of ClojuresScript by David Nolan.   Unfortunatly, lein-cljsbuild 2.9 points to the flawed version of ClojureScript.  You can move back to an earlier version of lein-cljsbuild, I know that 2.5 works.  It looks like lein-cljsbuild 2.10 includes the newest version of clojurescript but hasn't been pushed to clojars yet.  I ping Evan and see if he can't push it up.

CK


--
 
 
 

Matthew Molloy

unread,
Nov 26, 2012, 9:23:23 PM11/26/12
to enf...@googlegroups.com
Thanks for your efforts Creighton,

It looks like lein-cljsbuild 0.2.5 only works with lein 1.x, i don't quite need enfocus in my project yet so I'll wait for evan to post 0.2.10.

Matt

error message is

WARNING: using numeric exit values in plugins is deprecated.
Plugins should use leiningen.core.main/abort instead.
Support for this will be removed before the stable 2.0.0 release.
cljsbuild failed.


On Thursday, November 1, 2012 8:03:55 AM UTC+10, davidjagoe wrote:

ckirkendall

unread,
Nov 27, 2012, 6:55:31 AM11/27/12
to enf...@googlegroups.com
I have tested 0.2.7 with lein2 and everything works.

CK

Matthew Molloy

unread,
Nov 27, 2012, 10:42:33 AM11/27/12
to enf...@googlegroups.com
Yes, that's great.  Thanks for your support Creighton.

Matt

Markku Rontu

unread,
Dec 1, 2012, 11:43:02 AM12/1/12
to enf...@googlegroups.com
Thanks! I encountered this problem today and indeed 0.2.7 works. Spent two hours of mucking about enfocus :-)

-Markku
Reply all
Reply to author
Forward
0 new messages