Re: Comparing Regular Expression pattens for equality?

2014-02-27 Thread Thomas
Thanks guys,

Shame that it doesn't work that way. I've worked around it as suggested 
below.

Thomas

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


'lein pom' and 'mvn package'

2014-02-27 Thread Paul Smith
Hi,

Through restrictions, I am prevented from using Leiningen on the CI
server and I am attempting to package Clojure through Maven.

I have a core.clj with a (:gen-class) in the namespace and a (-main).

My project.clj includes a :main and :aot with the value of the main
namespace.

I can 'lein uberjar' and execute the jar successfully.

However, when I 'lein pom' and then 'mvn package' and attempt to run
the jar, I receive 'Failed to load Main-Class manifest attribute from
...'

I feel that I am missing a key/value pair in the project.clj, but I am
unsure what.

Many Thanks

Paul

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Om: trouble with goog reference

2014-02-27 Thread cig
Hi David

I tried changing :advanced mode to :whitespace mode. My index.html file 
looks as follows:


  

http://fb.me/react-0.9.0.js";>

  


my project.clj file looks as follows:
(defproject om-ho "0.0.1-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME";
  :license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html";
:distribution :repo}

  :min-lein-version "2.3.4"

  :source-paths ["src/clj" "src/cljs"]

  :dependencies [[org.clojure/clojure "1.5.1"]
 [org.clojure/clojurescript "0.0-2156"]
 [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
 [om "0.5.0"]
 [com.facebook/react "0.9.0"]]

  :plugins [[lein-cljsbuild "1.0.2"]]

  :hooks [leiningen.cljsbuild]

  :cljsbuild
  {:builds {:om-ho
{:source-paths ["src/cljs"]
 :compiler
 {:output-to "dev-resources/public/js/om_ho.js"
  :optimizations :none
  :pretty-print false)

With this setup. Evaluating core.cljs (which is taken directly from your 
Higher Order Components tutorial) I see the, "XHR finished Loading" events 
in the browser, which is a good sign, but the only text which renders is, 
"Registry". I assume this is because of the missing goog.closure lines in 
the index.html file

i.e.

goog.require("om_ho.core");

When I include these two lines I get the same errors that Chris mentioned 
above.

Would really appreciate your help.

Clifford

On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:
>
> I'm having trouble with the Om basic tutorial Higher Order 
> Components
>  using 
> emacs and a slightly modified version of 
> https://github.com/magomimmo/om-start-template that points to Om 0.5.0 
> and React 0.9.0.
> My version is https://github.com/christoferjennings/om-start-template
>
> The template doesn't have the goog/base.js out of the box. When I add it, 
> I get a "Uncaught ReferenceError: goog is not defined" (Chrome Version 
> 33.0.1750.117)
>
> Here's the final html (basically the same as in the tutorial.
> 
> 
> 
> http://fb.me/react-0.9.0.js";>
> 
> 
>  type="text/javascript">goog.require("my-stuff.core");
> 
> 
>
> There is no "out/goog/base.js", so I'm not too surprised goog is 
> undefined. I'm stumped, though, because I don't know if the goog stuff 
> that ends up in the .repl folder should be enough, or if I have to do 
> something special to get the goog stuff to be in the out folder. I've tried 
> "lein cljsbuild once" without luck.
>
> Any ideas on what I'm doing wrong?
>
> Thanks!
>
>
>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


problem catching exceptions in webapp

2014-02-27 Thread Wei Hsu
I'm having trouble catching exceptions in my Compojure web app. Made a 
small test case to illustrate the 
issue: https://github.com/yayitswei/exceptiontest

Could you take a look and spot what I'm doing wrong?

Thanks,
Wei

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-02-27 Thread edbond
Thanks. Can you compare sente with chord?

On Wednesday, February 26, 2014 3:57:24 PM UTC+2, Peter Taoussanis wrote:
>
> Hi folks,
>
> Quick post to announce a new lib release: 
> https://github.com/ptaoussanis/sente
>
> From the README:
> *Sente* is small client+server library that makes it easy to build *reliable, 
> high-performance realtime web applications with Clojure*.
>
> * *Bidirectional a/sync comms* over both *WebSockets* and *Ajax* 
> (auto-selecting).
> * *Robust*: auto keep-alives, buffering, mode fallback, reconnects.
> * edn rocks. So *send edn, get edn*: no json here.
> * *Tiny, simple API*: make-channel-socket! and you're good to go.
> * Automatic, sensible support for users connected with *multiple clients* 
> and/or 
> devices simultaneously.
> * *Flexible model*: use it anywhere you'd use WebSockets or Ajax.
> * *Fully documented, with examples* (more forthcoming).
> * Small: *less than 600 lines of code* for the entire client+server 
> implementation.
> * *Supported servers*: currently only http-kit, but easily extended.
>
> ---
> Have been using something like this in production since a little after 
> core.async came out, and wouldn't want to go back. Note that I tweaked a 
> few things for the public release so there may be some rough edges 
> initially. 
>
> An example project's included (new as of today) and there's a Leiningen 
> alias configured to handle all the fiddly bits like getting the Cljx and 
> Cljs to compile: just download, `lein start-dev` at a terminal, and you're 
> good to go.
>
> Any questions/problems/whatever, you can reach me here or on GitHub.
>
> That's it! Happy hacking, cheers! :-)
> - *Peter Taoussanis*
> https://twitter.com/ptaoussanis
> https://www.taoensso.com/clojure-libraries
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-02-27 Thread Peter Taoussanis
@Base

This looks great!  can't wait to try it out. 
> Well done.


Much appreciated, hope it's useful :-)

 @edbond

Thanks. Can you compare sente with chord?


Sure, I can try - have never actually used Chord though (it wasn't around 
when I wrote Sente's predecessor) - so I can only comment superficially on 
what I've gleaned from the README now (would appreciate any corrections!).

Similarities:
* Both seem to offer edn WebSocket messages over core.async channels.
* Both seem to require http-kit for the moment.

Primary difference seems to be that Chord supports only WebSockets (?) 
whereas Sente will fall back to Ajax when WebSockets are unavailable. This 
has ramifications for the API where Chord seems to prefer working with the 
channel directly and Sente uses a send fn to wrap away some of the protocol 
differences.

Sente's wrapping extends to allow things like optional callbacks over 
WebSockets (something not natively available) and broadcasting to multiple 
clients (e.g. when a particular user has multiple browser tabs and/or 
devices connected simultaneously, etc.) which I've found important in 
practice. Some web apps don't do this very well (even Google seems to 
struggle with it), so having a sensible solution baked in can be helpful.

Am not sure what Chord's doing in the way of reconnects, etc.

tl;dr Chord seems be a relatively close-to-the-metal mapping of WebSockets 
to edn channels where Sente is more like Socket.io with edn channels.

I'd probably select between the two based on use-case though, again, I'm 
not at all familiar with Chord or other alternatives so I may well be off 
here.

Hope that helps a little, cheers! :-)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Comparing classes in case statement

2014-02-27 Thread Markus Bader
Hello,

if I am not too dumb, it seems that comparing for classes does not work in 
case statements, like:

=> (class '(1 2 3))
clojure.lang.PersistentList

=> (case (class '(1 2 3))
clojure.lang.PersistentList :amazing
:so-sad)
:so-sad

I do not need a workaround - that is already done - and using the List is 
just for providing a simple example. It originally occurred while comparing 
Java classes.

I am just interested if this behavior is intended or a bug.

Cheers!

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Comparing classes in case statement

2014-02-27 Thread Jan Herich
>From official clojure documentation:

"The test-constants are not evaluated. They must be compile-time
literals"

Dňa štvrtok, 27. februára 2014 14:03:04 UTC+1 Markus Bader napísal(-a):
>
> Hello,
>
> if I am not too dumb, it seems that comparing for classes does not work in 
> case statements, like:
>
> => (class '(1 2 3))
> clojure.lang.PersistentList
>
> => (case (class '(1 2 3))
> clojure.lang.PersistentList :amazing
> :so-sad)
> :so-sad
>
> I do not need a workaround - that is already done - and using the List is 
> just for providing a simple example. It originally occurred while comparing 
> Java classes.
>
> I am just interested if this behavior is intended or a bug.
>
> Cheers!
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Om: trouble with goog reference

2014-02-27 Thread David Nolen
Your markup needs to look something like:


http://fb.me/react-0.9.0.js";>


goog.require("om_ho.core");

HTH,
David


On Thu, Feb 27, 2014 at 6:26 AM, cig  wrote:

> Hi David
>
> I tried changing :advanced mode to :whitespace mode. My index.html file
> looks as follows:
>
> 
>   
> 
> http://fb.me/react-0.9.0.js";>
> 
>   
> 
>
> my project.clj file looks as follows:
> (defproject om-ho "0.0.1-SNAPSHOT"
>   :description "FIXME: write description"
>   :url "http://example.com/FIXME";
>   :license {:name "Eclipse Public License - v 1.0"
> :url "http://www.eclipse.org/legal/epl-v10.html";
> :distribution :repo}
>
>   :min-lein-version "2.3.4"
>
>   :source-paths ["src/clj" "src/cljs"]
>
>   :dependencies [[org.clojure/clojure "1.5.1"]
>  [org.clojure/clojurescript "0.0-2156"]
>  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
>  [om "0.5.0"]
>  [com.facebook/react "0.9.0"]]
>
>   :plugins [[lein-cljsbuild "1.0.2"]]
>
>   :hooks [leiningen.cljsbuild]
>
>   :cljsbuild
>   {:builds {:om-ho
> {:source-paths ["src/cljs"]
>  :compiler
>  {:output-to "dev-resources/public/js/om_ho.js"
>   :optimizations :none
>   :pretty-print false)
>
> With this setup. Evaluating core.cljs (which is taken directly from your
> Higher Order Components tutorial) I see the, "XHR finished Loading" events
> in the browser, which is a good sign, but the only text which renders is,
> "Registry". I assume this is because of the missing goog.closure lines in
> the index.html file
>
> i.e.
> 
> goog.require("om_ho.core");
>
> When I include these two lines I get the same errors that Chris mentioned
> above.
>
> Would really appreciate your help.
>
> Clifford
>
> On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:
>>
>> I'm having trouble with the Om basic tutorial Higher Order 
>> Components
>>  using
>> emacs and a slightly modified version of https://github.com/
>> magomimmo/om-start-template that points to Om 0.5.0 and React 0.9.0.
>> My version is https://github.com/christoferjennings/om-start-template
>>
>> The template doesn't have the goog/base.js out of the box. When I add it,
>> I get a "Uncaught ReferenceError: goog is not defined" (Chrome Version
>> 33.0.1750.117)
>>
>> Here's the final html (basically the same as in the tutorial.
>> 
>> 
>> 
>> http://fb.me/react-0.9.0.js";>
>> 
>> 
>> 

Re: Is there a function to determine if code is run as script or library ?

2014-02-27 Thread GeekyCoder


Hi, Aaron, Rob

thank for the reply.

I actually thinking that something that is straightforward and less 
involving (without daemon or lein).

What happen is that I like to write a script in intellij editor, and then 
choose run, clojure will check for main function in current file , and 
invoke it. So kind of straightforward just like Java running a main method 
in current class.  I find this way of development useful, because I can 
quickly mook up code in main function and experiment with it quickly. This 
could be a great feature to have in clojure out of the box.

So lein way requires a namespace, maybe i can try that. Not too sure, if 
that is the way, maybe I can request if Intellij can add this ability in 
its clojure plugin.

flow will be something like:
- When run is invoked, Intellij will check the current namespace of the 
file, and then invoke  lein run -m  if main- is found .

thank :}


On Wednesday, February 26, 2014 5:50:43 PM UTC+8, macdevign mac wrote:
>
> Hi, 
> is there a function to determine if the clojure code is running as library 
> or as script ? 
>
> In ruby, there is 
>
> if __FILE__==$0
>   # this will only run if the script was the main, not load'd or require'dend
>
> In Java, we could include main method in class, and choose to run it,
>
> How about clojure ?
>
> Is there any function/macro like the following ?
>
> (run-main 
>   (code ..))  
>
>
> so that it can be run standalone, or it can be ignored running as 
> library.   I find this useful for quick experimenting.
>
> thank
>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: problem catching exceptions in webapp

2014-02-27 Thread Immo Heikkinen
(assert false) throws AssertionError which doesn't extend Exception and
therefore is not caught.

:: Immo


2014-02-27 13:42 GMT+02:00 Wei Hsu :

> I'm having trouble catching exceptions in my Compojure web app. Made a
> small test case to illustrate the issue:
> https://github.com/yayitswei/exceptiontest
>
> Could you take a look and spot what I'm doing wrong?
>
> Thanks,
> Wei
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Help with data structures and dereferencing

2014-02-27 Thread Dave Della Costa
Hi Robert,

I completely understand the desire to structure your code in a way that
isolates business logic.  It's something I struggle with all the time
and I think it's not simple when you're shifting from thinking in an OO
way (as you and I and so many folks are) to thinking more functionally
about things.  I mean, this is not simple, period--design is hard.

One point of advice I can make regarding this is that sometimes I've
found it useful to design a structure in an expedient way, asking the
question, "what makes it easiest to get at and manipulate my data?" Then
I ask questions about what that design implies: what concerns get mixed
up that I'd rather not get mixed up, what is more complex than it should
be, etc.  Then I see if I can maintain or increase the simplicity while
addressing the remaining concerns.

> my concern was that i was missing some clojure idiom for "hiding"
> whether a data structure was fully populated vs. requiring an explicit
> look ups.

You can still abstract this functionality without coupling your data and
the lookup functions.  It's fine to provide the API user with a function
that says, "get me this data, I don't care how, and here's the tree of
entity relationships."  Heck, you can even hide the entity relationship
data structure if really really need to, depending on the needs of the
API.  That maintains the abstraction of a lookup method which could be
doing anything from pulling it from memory to looking it up in a
database to making an HTTP request...etc.  But your relationships can
still be expressed in that one isolated data structure, living wherever
it lives, getting managed however it gets managed.

But I would start by designing the lowest layer to make everything
explicit and as pure as possible: a function which gets an entity id and
this resource and tries to look up the data here, a function which gets
the id and that other resource and tries to look it up there, etc.  And
then the "get-me-the-data-I-don't-care-how" function would simply be
wrapping those up in logic which figures out which one succeeds (for
example).

If you want something on top of all of that that is more semantically
meaningful and matches your domain vocabulary, you can then do that too.
 You can always wrap these functions in other functions.

Rick Hickey's comments in this interview (I could swear I saw this
interview on a different site, but can't find it...ah well) may be
pertinent here:

http://www.codequarterly.com/2011/rich-hickey/

"Fogus: Following that idea—some people are surprised by the fact that
Clojure does not engage in data-hiding encapsulation on its types. Why
did you decide to forgo data-hiding?
Hickey: Let’s be clear that Clojure strongly emphasizes programming to
abstractions. At some point though, someone is going to need to have
access to the data. And if you have a notion of “private”, you need
corresponding notions of privilege and trust. And that adds a whole ton
of complexity and little value, creates rigidity in a system, and often
forces things to live in places they shouldn’t. This is in addition to
the other losing that occurs when simple information is put into
classes. To the extent the data is immutable, there is little harm that
can come of providing access, other than that someone could come to
depend upon something that might change. Well, okay, people do that all
the time in real life, and when things change, they adapt. And if they
are rational, they know when they make a decision based upon something
that can change that they might in the future need to adapt. So, it’s a
risk management decision, one I think programmers should be free to make."

I don't think there's any magic answer to how to design something
correctly, and there are always tradeoffs and loose ends.  But perhaps
the thoughts in the quote above can provide a bit more of a basis to
start from when thinking about these kinds of design problems in Clojure.

Anyways, I was long-winded here, my apologies.  I hope at least some of
this helps.

DD

(2014/02/27 0:48), Robert Quinn wrote:
> david, 
> 
> I think you're right.  I've complicated things by conflating the two
> concepts.
> 
> the overall structure of the data is a graph. when you look at an entity
> and their relationships it's a tree.  entity (LHS) has a set of
> relationships.  that was my reason for even thinking a zipper might help
> to maintain the RHS state.  
> 
> i'm trying to pass data between the "business functions" but I need them
> to have access to the latest state.  I was trying not couple/expose the
> business functions to data access ("utility functions") so that's where
> the complexity got introduced.
> 
> the embedded functions are doing exactly what you suggest, they look up
> the related entities using the references.  the advantage (i thought) of
> having the functions embedded in the data is that the business functions
> don't have any control logic to choose an appropriate utility function,
> they j

Re: object identity

2014-02-27 Thread Andy Fingerhut
I will mention a case that I wasn't thinking about when I wrote my previous
message in this thread.

If one is commonly dealing with tree-like data structures, e.g. maps that
contains maps as keys or values, which in turn contain other maps, or
vectors, or sets, etc., it is relatively trivial in Clojure to write data
transforms on those tree-like structures such that sub-structures of the
returned value are identical to the sub-structures in the original.  For
example, the implementation of assoc on a map currently has the property
that all keys and values _that are not affected by the assoc_ are identical
to the corresponding keys and values in the original map.  Similarly assoc
on a vector returns a vector where all indices not affected by the assoc
contain values that are identical to the original vector elements.

Thus if your data transformation does not "modify" a large fraction of the
tree-like structure, most sub-structures will be identical to the
corresponding sub-structures in the original.

I am not certain, but that may be what David Nolen is referring to in this
article:
http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/

Not that the entire transformed data structure is identical to the
original, but a large fraction of the sub-structures are, so if you do a
"diff" like comparison of an older structure and a newer one, you will find
many identical sub-structures.

Andy


On Wed, Feb 26, 2014 at 6:14 PM, Andy Fingerhut wrote:

> There are likely to be common ways of writing data transforms that happen
> to return the same identical object as they were given, because
> 'primitives' like assoc often do.
>
> I don't know of anyone who intentionally relies upon this behavior for
> correctness of their code, and would strongly advise against ever doing so.
>
> I also don't know of anyone who intentionally tries to write such code in
> order to improve performance of their Clojure programs.  If they did, I
> would guess they would often be frustrated by small changes to their
> program that reduced performance by no longer returning identical objects.
>
> Andy
>
>
>
> On Wed, Feb 26, 2014 at 11:11 AM, Brian Craft wrote:
>
>> Ok, trying a different way of asking this:
>>
>> Is it common practice in clojure to write data transforms in a way that
>> will return the same object when possible (when the transform would be a
>> noop), such as the mapv vs. reduce/assoc in my example? Would you do this
>> to speed up equality checks, or to reduce gc pressure? Or is this an
>> anti-pattern like using identical?
>>
>> b.c.
>>
>>
>> On Tuesday, February 25, 2014 9:59:11 AM UTC-8, David Nolen wrote:
>>
>>> I don't really have anything to add to this thread but I will say that
>>> Om's use of identical? is an implementation detail that's likely to change.
>>> = already does an identical? check, ideally Om could use not= in the future
>>> instead of (not (identical? ...)).
>>>
>>> David
>>>
>>>
>>> On Tue, Feb 25, 2014 at 12:54 PM, Brian Craft wrote:
>>>
 No, my question isn't "is there a way" to do this. I'm sure there are a
 dozen ways to do it. My question is about a specific way of doing it. In
 particular, if your solution does not involve calling (identical? ..), then
 it's not what I'm asking about.

 In om core there's a call to identical? under the
 :shouldComponentUpdate key, which I suspect is what David was talking about
 in his blog posts about avoiding deep compares via immutable data
 structures. My question is about whether that has implications for how you
 write algorithms that update state, and whether the semantics of update-in
 (or assoc, really) that allow it to return the same object if the update
 would return an identical object, are related to this mechanism, if these
 semantics are documented, and if they depend on the data type being 
 assoc'd.



 On Monday, February 24, 2014 6:27:02 PM UTC-8, t x wrote:

> Perhaps I mis-interpreted your question.
>
> I thought the question asked was:
>
>
> GIven:
>   * pure function "func"
>   * some object "obj"
>   * (def a (func obj))
>   * (def b (func obj))
>
> Example:
>   * obj = [1 2 3]
>   * (defn func [lst] (map #(* 2 %) lst))
>
> Then:
>   * is there a O(1) way to check if (= a b) ?
>
>   In the above, we create two _different_ lists, both of which stores
> [2 4 6], thus they're equal, but not identical
>
> Proposed solution:
>   tag the returned-value with a meta object, where the meta object
> describes how the object was computed.
>
>   in this case, both [2 4 6] would have _identical_ meta objects,
> since they're both from the list [1 2 3]
>
>
>
>
>
> On Mon, Feb 24, 2014 at 5:56 PM, Brian Craft 
> wrote:
> > You're solving a similar problem, but I'm asking specifically about
> using
> > object 

[ANN] jetty9-websockets-async - A servlet implementation

2014-02-27 Thread ToBeReplaced
Hi,

Presenting a `javax.http.servlet.HttpServlet` for offloading WebSocket
communication onto `core.async` channels:

https://github.com/ToBeReplaced/jetty9-websockets-async

Note that this implements a `WebSocketServlet` using Jetty9 for the
handshakes.  The resulting servlet can be used by any web server that
uses servlets.  No `http-kit` requirement here!

There are many implementations of similar things, but none of them could
meet my use case:
https://github.com/ptaoussanis/sente
https://github.com/james-henderson/chord
https://github.com/lynaghk/jetty7-websockets-async

For commentary on differences and why I released this lib, see:
https://github.com/ptaoussanis/sente/issues/9
https://github.com/lynaghk/jetty7-websockets-async/pull/6

Cheers,
ToBeReplaced

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] lein-modules 0.2.0

2014-02-27 Thread Jim Crossley
What is lein-modules?

A leiningen plugin providing support for project aggregation, letting
you define parent-child relationships between projects to achieve
interdependence-based build ordering, project inheritance based on
leiningen profiles, and centralized dependency management.

What's in this release?

- The :inherited profile is no longer "special", though it will be
  merged in before :default, if present. All profiles defined in
  ancestors are now added to the child project and [un]merged as
  appropriate for the task.

- Profiles active in the parent should now be propagated to each child
  when running the 'modules' higher-order task unless
  'with-profile[s]' is among its arguments. In short,
  'with-profile[s]' should do The Right Thing, whether it appears to
  the left or the right of 'modules' in your command.

- By default, each child module's task is now run in a subprocess, but
  you can override this with the new [:modules :subprocess] boolean.
  When false, all child module tasks are run in the parent's process,
  like before. This is fine for most tasks, but it can lead to
  surprises when say, one of your child modules is a plugin, or you
  have incompatible hooks in your child modules, or when hooks/plugins
  make assumptions about the current directory. Leiningen itself is
  pretty good about "absolutizing" paths and relying on (:root
  project) rather than the working directory.

More details and an example available at
https://github.com/jcrossley3/lein-modules

For another example, I recently pushed my "lein-ization" of Immutant
to its master branch. Somewhat disturbingly, it can now be built with
*either* Maven or Leiningen. But I'm not advocating that. :)

Love,
Jim

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Help with data structures and dereferencing

2014-02-27 Thread Robert Quinn
That does help.  thanks for the link.  good to get feedback, I figured 
there's no magic bullet but didn't want to go to far down a path without 
soliciting advice.

I'm going to try a few things, keep it simple and see how it holds up.


thanks again dave




On Thursday, February 27, 2014 9:43:32 AM UTC-5, David Della Costa wrote:
>
> Hi Robert, 
>
> I completely understand the desire to structure your code in a way that 
> isolates business logic.  It's something I struggle with all the time 
> and I think it's not simple when you're shifting from thinking in an OO 
> way (as you and I and so many folks are) to thinking more functionally 
> about things.  I mean, this is not simple, period--design is hard. 
>
> One point of advice I can make regarding this is that sometimes I've 
> found it useful to design a structure in an expedient way, asking the 
> question, "what makes it easiest to get at and manipulate my data?" Then 
> I ask questions about what that design implies: what concerns get mixed 
> up that I'd rather not get mixed up, what is more complex than it should 
> be, etc.  Then I see if I can maintain or increase the simplicity while 
> addressing the remaining concerns. 
>
> > my concern was that i was missing some clojure idiom for "hiding" 
> > whether a data structure was fully populated vs. requiring an explicit 
> > look ups. 
>
> You can still abstract this functionality without coupling your data and 
> the lookup functions.  It's fine to provide the API user with a function 
> that says, "get me this data, I don't care how, and here's the tree of 
> entity relationships."  Heck, you can even hide the entity relationship 
> data structure if really really need to, depending on the needs of the 
> API.  That maintains the abstraction of a lookup method which could be 
> doing anything from pulling it from memory to looking it up in a 
> database to making an HTTP request...etc.  But your relationships can 
> still be expressed in that one isolated data structure, living wherever 
> it lives, getting managed however it gets managed. 
>
> But I would start by designing the lowest layer to make everything 
> explicit and as pure as possible: a function which gets an entity id and 
> this resource and tries to look up the data here, a function which gets 
> the id and that other resource and tries to look it up there, etc.  And 
> then the "get-me-the-data-I-don't-care-how" function would simply be 
> wrapping those up in logic which figures out which one succeeds (for 
> example). 
>
> If you want something on top of all of that that is more semantically 
> meaningful and matches your domain vocabulary, you can then do that too. 
>  You can always wrap these functions in other functions. 
>
> Rick Hickey's comments in this interview (I could swear I saw this 
> interview on a different site, but can't find it...ah well) may be 
> pertinent here: 
>
> http://www.codequarterly.com/2011/rich-hickey/ 
>
> "Fogus: Following that idea—some people are surprised by the fact that 
> Clojure does not engage in data-hiding encapsulation on its types. Why 
> did you decide to forgo data-hiding? 
> Hickey: Let’s be clear that Clojure strongly emphasizes programming to 
> abstractions. At some point though, someone is going to need to have 
> access to the data. And if you have a notion of “private”, you need 
> corresponding notions of privilege and trust. And that adds a whole ton 
> of complexity and little value, creates rigidity in a system, and often 
> forces things to live in places they shouldn’t. This is in addition to 
> the other losing that occurs when simple information is put into 
> classes. To the extent the data is immutable, there is little harm that 
> can come of providing access, other than that someone could come to 
> depend upon something that might change. Well, okay, people do that all 
> the time in real life, and when things change, they adapt. And if they 
> are rational, they know when they make a decision based upon something 
> that can change that they might in the future need to adapt. So, it’s a 
> risk management decision, one I think programmers should be free to make." 
>
> I don't think there's any magic answer to how to design something 
> correctly, and there are always tradeoffs and loose ends.  But perhaps 
> the thoughts in the quote above can provide a bit more of a basis to 
> start from when thinking about these kinds of design problems in Clojure. 
>
> Anyways, I was long-winded here, my apologies.  I hope at least some of 
> this helps. 
>
> DD 
>
> (2014/02/27 0:48), Robert Quinn wrote: 
> > david, 
> > 
> > I think you're right.  I've complicated things by conflating the two 
> > concepts. 
> > 
> > the overall structure of the data is a graph. when you look at an entity 
> > and their relationships it's a tree.  entity (LHS) has a set of 
> > relationships.  that was my reason for even thinking a zipper might help 
> > to maintain the RHS state.   

Re: [ANN] clojure.test.check (previously, simple-check)

2014-02-27 Thread Ambrose Bonnaire-Sergeant
Congrats!

Ambrose


On Fri, Feb 28, 2014 at 1:22 AM, Reid Draper  wrote:

> I'm happy to announce the first release of the newest Clojure contrib
> library:
> test.check [1]. Previously named simple-check [1], test.check is a
> property-based testing library, based on QuickCheck. The README has a
> guide for
> migrating from simple-check, as well as some getting-started
> documentation. I'm
> happy to answer any questions here as well. Or, stop by my Clojure/West
> talk in
> March.
>
> [1] https://github.com/clojure/test.check
> [2] https://github.com/reiddraper/simple-check
>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] clojure.test.check (previously, simple-check)

2014-02-27 Thread Reid Draper
I'm happy to announce the first release of the newest Clojure contrib 
library:
test.check [1]. Previously named simple-check [1], test.check is a
property-based testing library, based on QuickCheck. The README has a guide 
for
migrating from simple-check, as well as some getting-started documentation. 
I'm
happy to answer any questions here as well. Or, stop by my Clojure/West 
talk in
March.

[1] https://github.com/clojure/test.check
[2] https://github.com/reiddraper/simple-check

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problem with nREPL handle* function

2014-02-27 Thread Jony Hudson
Hi Folks,

 I'm stuck and would like a bit of help. This is following on from a 
question I posted to clojure.tools, but I've reduced the problem to its 
essence, and figure it might get a few more eyes on it here. My apologies 
to anyone who has to suffer reading about it twice :-)

My actual problem is that I'm unable to get a Websocket transport for 
gorilla-repl running. But I think I've boiled down the problem to something 
that doesn't involve websockets. I'm trying to handle messages with nREPL. 
If I run the following in the REPL to make an nREPL handler:

(require '[clojure.tools.nrepl.transport :as transport])
(require '[clojure.tools.nrepl.server :as nrepl-server])

(def handler (nrepl-server/default-handler))

(def trans (transport/fn-transport nil println))

(nrepl-server/handle* {:op "clone"} handler trans)

Then everything goes as I would hope. The nREPL server replies with a 
new-session message, which is printed to the console by the dopey transport 
I've provided. If I then lift the new session ID (copy and paste) and send 
an evaluation message to the nREPL handler

(nrepl-server/handle* {:op "eval" :code "(+ 1 5)" :session 
"2c8b0464-7e09-4c94-81d7-c4e0c7d1314f"} handler trans)

It works as I'd expect, replying with the value and a 'done' status message.

{status #{:done}, session 2c8b0464-7e09-4c94-81d7-c4e0c7d1314f}
{ns user, value 6, session 2c8b0464-7e09-4c94-81d7-c4e0c7d1314f}

The problem comes if I try and execute the same command again, which should 
I would have thought should give the same answer, but instead I get an 
extremely long stack trace, a snippet of which is below.

Exception in thread "nREPL-worker-0" java.lang.StackOverflowError
at clojure.lang.RestFn.applyTo(RestFn.java:130)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$prn.doInvoke(core.clj:3367)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$println.doInvoke(core.clj:3387)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.tools.nrepl.transport.FnTransport.send(transport.clj:28)
at 
clojure.tools.nrepl.middleware.pr_values$pr_values$fn$reify__2353.send(pr_values.clj:23)
at 
clojure.tools.nrepl.middleware.session$session_out$fn__2437.invoke(session.clj:51)
at 
clojure.tools.nrepl.middleware.session.proxy$java.io.Writer$0.flush(Unknown 
Source)
at 
clojure.tools.nrepl.middleware.session$session_out$fn__2444.doInvoke(session.clj:44)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at 
clojure.tools.nrepl.middleware.session.proxy$java.io.Writer$0.write(Unknown 
Source)
at java.io.PrintWriter.write(PrintWriter.java:456)
at java.io.PrintWriter.write(PrintWriter.java:473)
at clojure.core$fn__5420.invoke(core_print.clj:187)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core$pr_on.invoke(core.clj:3322)
at clojure.core$print_map$fn__5428.invoke(core_print.clj:200)
at clojure.core$print_sequential.invoke(core_print.clj:58)
at clojure.core$print_map.invoke(core_print.clj:203)
at clojure.core$fn__5431.invoke(core_print.clj:207)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at clojure.core$pr_on.invoke(core.clj:3322)
at clojure.core$pr.invoke(core.clj:3334)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$prn.doInvoke(core.clj:3367)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$println.doInvoke(core.clj:3387)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.tools.nrepl.transport.FnTransport.send(transport.clj:28)
at 
clojure.tools.nrepl.middleware.pr_values$pr_values$fn$reify__2353.send(pr_values.clj:23)
at 
clojure.tools.nrepl.middleware.session$session_out$fn__2437.invoke(session.clj:51)
at 
clojure.tools.nrepl.middleware.session.proxy$java.io.Writer$0.flush(Unknown 
Source)
at 
clojure.tools.nrepl.middleware.session$session_out$fn__2444.doInvoke(session.clj:44)
[snip]

Somehow, drawbridge gets this to work, even though as far as I can tell I'm 
doing the same thing. I can't figure out what's going on. Help!

Thanks,


Jony

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Om: trouble with goog reference

2014-02-27 Thread boz
Hi David, Clifford,

I'm pretty sure Clifford is using the Cider version from 
Mimmo. 
I've got a fork of 
itwith updates so it 
work with Om 0.5.0 and React 0.9.0 that I've used to get 
through the basic tutorial so far. Clifford and I have talked about it 
here and 
there is a pull request. 
 When using the Cider version the HTML should actually look like this 
(using "om_ho.js" to match Clifford's)...


  

http://fb.me/react-0.9.0.js";>

  



I plan to put some examples online asap, hopefully by tomorrow, so other 
newbies (like myself) can compare notes. ... One thing that I stumbled on 
was that the tutorial shows the whole HTML but really, afaik, the only 
change was the id of the div (from "app" to "registry").

I'm having a lot of fun working on this stuff, btw. Om is very cool. 
Looking forward to getting into the intermediate tutorial with Datomic too 
:)

,chris

On Thursday, February 27, 2014 6:03:22 AM UTC-8, David Nolen wrote:
>
> Your markup needs to look something like:
>
> 
> http://fb.me/react-0.9.0.js";>
> 
> 
> goog.require("om_ho.core");
>
> HTH,
> David
>
>
> On Thu, Feb 27, 2014 at 6:26 AM, cig  >wrote:
>
>> Hi David
>>
>> I tried changing :advanced mode to :whitespace mode. My index.html file 
>> looks as follows:
>>
>> 
>>   
>> 
>> http://fb.me/react-0.9.0.js";>
>> 
>>   
>> 
>>
>> my project.clj file looks as follows:
>> (defproject om-ho "0.0.1-SNAPSHOT"
>>   :description "FIXME: write description"
>>   :url "http://example.com/FIXME";
>>   :license {:name "Eclipse Public License - v 1.0"
>> :url "http://www.eclipse.org/legal/epl-v10.html";
>> :distribution :repo}
>>
>>   :min-lein-version "2.3.4"
>>
>>   :source-paths ["src/clj" "src/cljs"]
>>
>>   :dependencies [[org.clojure/clojure "1.5.1"]
>>  [org.clojure/clojurescript "0.0-2156"]
>>  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
>>  [om "0.5.0"]
>>  [com.facebook/react "0.9.0"]]
>>
>>   :plugins [[lein-cljsbuild "1.0.2"]]
>>
>>   :hooks [leiningen.cljsbuild]
>>
>>   :cljsbuild
>>   {:builds {:om-ho
>> {:source-paths ["src/cljs"]
>>  :compiler
>>  {:output-to "dev-resources/public/js/om_ho.js"
>>   :optimizations :none
>>   :pretty-print false)
>>
>> With this setup. Evaluating core.cljs (which is taken directly from your 
>> Higher Order Components tutorial) I see the, "XHR finished Loading" events 
>> in the browser, which is a good sign, but the only text which renders is, 
>> "Registry". I assume this is because of the missing goog.closure lines in 
>> the index.html file
>>
>> i.e.
>> 
>> goog.require("om_ho.core");
>>
>> When I include these two lines I get the same errors that Chris mentioned 
>> above.
>>
>> Would really appreciate your help.
>>
>> Clifford
>>
>> On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:
>>>
>>> I'm having trouble with the Om basic tutorial Higher Order 
>>> Components
>>>  using 
>>> emacs and a slightly modified version of https://github.com/
>>> magomimmo/om-start-template that points to Om 0.5.0 and React 0.9.0.
>>> My version is https://github.com/christoferjennings/om-start-template
>>>
>>> The template doesn't have the goog/base.js out of the box. When I add 
>>> it, I get a "Uncaught ReferenceError: goog is not defined" (Chrome Version 
>>> 33.0.1750.117)
>>>
>>> Here's the final html (basically the same as in the tutorial.
>>> 
>>> 
>>> 
>>> http://fb.me/react-0.9.0.js";>
>>> 
>>> 
>>> 

Re: Om: trouble with goog reference

2014-02-27 Thread boz
... should have mentioned, in case it's not obvious, I got through the 
basic tutorial using my fork of Mimmo's excellent work.
,chris (aka boz)

On Thursday, February 27, 2014 10:40:23 AM UTC-8, boz wrote:
>
> Hi David, Clifford,
>
> I'm pretty sure Clifford is using the Cider version from 
> Mimmo. 
> I've got a fork of 
> itwith updates so it 
> work with Om 0.5.0 and React 0.9.0 that I've used to get 
> through the basic tutorial so far. Clifford and I have talked about it 
> here  and there 
> is a pull request . 
>  When using the Cider version the HTML should actually look like this 
> (using "om_ho.js" to match Clifford's)...
>
> 
>   
> 
> http://fb.me/react-0.9.0.js";>
> 
>   
> 
>
>
> I plan to put some examples online asap, hopefully by tomorrow, so other 
> newbies (like myself) can compare notes. ... One thing that I stumbled on 
> was that the tutorial shows the whole HTML but really, afaik, the only 
> change was the id of the div (from "app" to "registry").
>
> I'm having a lot of fun working on this stuff, btw. Om is very cool. 
> Looking forward to getting into the intermediate tutorial with Datomic too 
> :)
>
> ,chris
>
> On Thursday, February 27, 2014 6:03:22 AM UTC-8, David Nolen wrote:
>>
>> Your markup needs to look something like:
>>
>> 
>> http://fb.me/react-0.9.0.js";>
>> 
>> 
>> goog.require("om_ho.core");
>>
>> HTH,
>> David
>>
>>
>> On Thu, Feb 27, 2014 at 6:26 AM, cig  wrote:
>>
>>> Hi David
>>>
>>> I tried changing :advanced mode to :whitespace mode. My index.html file 
>>> looks as follows:
>>>
>>> 
>>>   
>>> 
>>> http://fb.me/react-0.9.0.js";>
>>> 
>>>   
>>> 
>>>
>>> my project.clj file looks as follows:
>>> (defproject om-ho "0.0.1-SNAPSHOT"
>>>   :description "FIXME: write description"
>>>   :url "http://example.com/FIXME";
>>>   :license {:name "Eclipse Public License - v 1.0"
>>> :url "http://www.eclipse.org/legal/epl-v10.html";
>>> :distribution :repo}
>>>
>>>   :min-lein-version "2.3.4"
>>>
>>>   :source-paths ["src/clj" "src/cljs"]
>>>
>>>   :dependencies [[org.clojure/clojure "1.5.1"]
>>>  [org.clojure/clojurescript "0.0-2156"]
>>>  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
>>>  [om "0.5.0"]
>>>  [com.facebook/react "0.9.0"]]
>>>
>>>   :plugins [[lein-cljsbuild "1.0.2"]]
>>>
>>>   :hooks [leiningen.cljsbuild]
>>>
>>>   :cljsbuild
>>>   {:builds {:om-ho
>>> {:source-paths ["src/cljs"]
>>>  :compiler
>>>  {:output-to "dev-resources/public/js/om_ho.js"
>>>   :optimizations :none
>>>   :pretty-print false)
>>>
>>> With this setup. Evaluating core.cljs (which is taken directly from your 
>>> Higher Order Components tutorial) I see the, "XHR finished Loading" events 
>>> in the browser, which is a good sign, but the only text which renders is, 
>>> "Registry". I assume this is because of the missing goog.closure lines in 
>>> the index.html file
>>>
>>> i.e.
>>> 
>>> goog.require("om_ho.core");
>>>
>>> When I include these two lines I get the same errors that Chris 
>>> mentioned above.
>>>
>>> Would really appreciate your help.
>>>
>>> Clifford
>>>
>>> On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:

 I'm having trouble with the Om basic tutorial Higher Order 
 Components
  using 
 emacs and a slightly modified version of https://github.com/
 magomimmo/om-start-template that points to Om 0.5.0 and React 0.9.0.
 My version is https://github.com/christoferjennings/om-start-template

 The template doesn't have the goog/base.js out of the box. When I add 
 it, I get a "Uncaught ReferenceError: goog is not defined" (Chrome Version 
 33.0.1750.117)

 Here's the final html (basically the same as in the tutorial.
 
 
 
 http://fb.me/react-0.9.0.js";>
 
 
 

Re: Om: trouble with goog reference

2014-02-27 Thread David Nolen
Many thanks for taking the time to implement & share your solution!

David


On Thu, Feb 27, 2014 at 1:40 PM, boz  wrote:

> Hi David, Clifford,
>
> I'm pretty sure Clifford is using the Cider version from 
> Mimmo.
> I've got a fork of 
> itwith updates so it 
> work with Om 0.5.0 and React 0.9.0 that I've used to get
> through the basic tutorial so far. Clifford and I have talked about it
> here  and there
> is a pull request .
>  When using the Cider version the HTML should actually look like this
> (using "om_ho.js" to match Clifford's)...
>
> 
>   
> 
> http://fb.me/react-0.9.0.js";>
> 
>   
> 
>
>
> I plan to put some examples online asap, hopefully by tomorrow, so other
> newbies (like myself) can compare notes. ... One thing that I stumbled on
> was that the tutorial shows the whole HTML but really, afaik, the only
> change was the id of the div (from "app" to "registry").
>
> I'm having a lot of fun working on this stuff, btw. Om is very cool.
> Looking forward to getting into the intermediate tutorial with Datomic too
> :)
>
> ,chris
>
> On Thursday, February 27, 2014 6:03:22 AM UTC-8, David Nolen wrote:
>
>> Your markup needs to look something like:
>>
>> 
>> http://fb.me/react-0.9.0.js";>
>> 
>> 
>> goog.require("om_ho.core");
>>
>> HTH,
>> David
>>
>>
>> On Thu, Feb 27, 2014 at 6:26 AM, cig  wrote:
>>
>>> Hi David
>>>
>>> I tried changing :advanced mode to :whitespace mode. My index.html file
>>> looks as follows:
>>>
>>> 
>>>   
>>> 
>>> http://fb.me/react-0.9.0.js";>
>>> 
>>>   
>>> 
>>>
>>> my project.clj file looks as follows:
>>> (defproject om-ho "0.0.1-SNAPSHOT"
>>>   :description "FIXME: write description"
>>>   :url "http://example.com/FIXME";
>>>   :license {:name "Eclipse Public License - v 1.0"
>>> :url "http://www.eclipse.org/legal/epl-v10.html";
>>> :distribution :repo}
>>>
>>>   :min-lein-version "2.3.4"
>>>
>>>   :source-paths ["src/clj" "src/cljs"]
>>>
>>>   :dependencies [[org.clojure/clojure "1.5.1"]
>>>  [org.clojure/clojurescript "0.0-2156"]
>>>  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
>>>  [om "0.5.0"]
>>>  [com.facebook/react "0.9.0"]]
>>>
>>>   :plugins [[lein-cljsbuild "1.0.2"]]
>>>
>>>   :hooks [leiningen.cljsbuild]
>>>
>>>   :cljsbuild
>>>   {:builds {:om-ho
>>> {:source-paths ["src/cljs"]
>>>  :compiler
>>>  {:output-to "dev-resources/public/js/om_ho.js"
>>>   :optimizations :none
>>>   :pretty-print false)
>>>
>>> With this setup. Evaluating core.cljs (which is taken directly from your
>>> Higher Order Components tutorial) I see the, "XHR finished Loading" events
>>> in the browser, which is a good sign, but the only text which renders is,
>>> "Registry". I assume this is because of the missing goog.closure lines in
>>> the index.html file
>>>
>>> i.e.
>>> 
>>> goog.require("om_ho.core");
>>>
>>> When I include these two lines I get the same errors that Chris
>>> mentioned above.
>>>
>>> Would really appreciate your help.
>>>
>>> Clifford
>>>
>>> On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:

 I'm having trouble with the Om basic tutorial Higher Order 
 Components
  using
 emacs and a slightly modified version of https://github.com/magomimm
 o/om-start-template that points to Om 0.5.0 and React 0.9.0.
 My version is https://github.com/christoferjennings/om-start-template

 The template doesn't have the goog/base.js out of the box. When I add
 it, I get a "Uncaught ReferenceError: goog is not defined" (Chrome Version
 33.0.1750.117)

 Here's the final html (basically the same as in the tutorial.
 
 
 
 http://fb.me/react-0.9.0.js";>
 
 
 

[ANN] ILC 2014 call for papers reminder

2014-02-27 Thread Marc Feeley
ILC 2014 - International Lisp Conference
  "Lisp on the Move"

 August 14-17 2014, Université de Montréal, Montréal, Canada

  Sponsored by the Association of Lisp Users

 http://www.international-lisp-conference.org


Scope:

Lisp is one of the greatest ideas from computer science and a major
influence for almost all programming languages and for all
sufficiently complex software applications.

The International Lisp Conference is a forum for the discussion of
Lisp and, in particular, the design, implementation and application of
any of the Lisp dialects.  We encourage everyone interested in Lisp to
participate.

We invite high quality submissions in all areas involving Lisp
dialects and any other languages in the Lisp family, including, but
not limited to, ACL2, AutoLisp, Clojure, Common Lisp, ECMAScript,
Dylan, Emacs Lisp, ISLISP, Racket, Scheme, SKILL, HOP etc.

This year's focus will be directed towards integrated solutions,
including mobile computing. We especially invite submissions in the
following areas:

  * Pervasive computing
  * Interoperability
  * Portability
  * Implementation challenges/tradeoffs for embedded/mobile platforms
  * Language support for mobile toolkits and frameworks
  * Language support for distribution
  * Language support for reliability, availability, and serviceability
  * Mobile IDEs
  * Mobile applications

Contributions are also welcome in other areas, including but not
limited to:

  * Language design and implementation
  * Language integration, inter-operation and deployment
  * Applications (especially commercial)
  * Reflection, meta-object protocols, meta-programming
  * Domain-specific languages
  * Programming paradigms and environments
  * Efficient parallel and concurrent computation
  * Language support for managing both manual and automatic GC
  * Theorem proving
  * Scientific computing
  * Data mining
  * Semantic web


Technical Programme:

Original submissions in all areas related to the conference themes are
invited for the following categories:

  Papers: Technical papers of up to 10 pages that describe original
  results.

  Demonstrations: Abstracts of up to 2 pages for demonstrations of
  tools, libraries and applications.

  Workshops: Abstracts of up to 2 pages for groups of people who intend
  to work on a focused topic for half a day.

  Tutorials: Abstracts of up to 2 pages for in-depth presentations about
  topics of special interest for 1 to 2 hours.

  Panel discussions: Abstracts of up to 2 pages for discussions about
  current themes. Panel discussion proposals must mention panel member
  who are willing to partake in a discussion.

The conference will also provide slots for lightning talks, to be
registered on-site every day.

For inquiries about any other kind of participation (commercial
exhibits, advertising, prizes, book signing etc.), please see the
contacts below.


Important Dates:

 - May18, 2014: Submission deadline
 - June   09, 2014: Notification of acceptance
 - June   29, 2014: Final Papers due
 - August 14, 2014: Conference


All submissions should be formatted following the ACM SIGS guidelines
and include ACM classification categories and terms. For more
information on the submission guidelines and the ACM keywords, see:
http://www.acm.org/sigs/publications/proceedings-templates and
http://www.acm.org/about/class/1998.

Submissions should be uploaded to Easy Chair, at the following
address: https://www.easychair.org/conferences/?conf=ilc14


Organizing Committee:

General Chair:   Marc Feeley (Université de Montréal, Montréal, Canada)
Programme Chair: Didier Verna (EPITA Research lab, Paris, France)
Local chair: Marc Feeley (Université de Montréal, Montréal, Canada)

Programme Committee:
to be announced


Contacts:

  * General Questions: ilc14-organizing-committee at alu.org
  * Programme Committee: ilc14 at easychair.org


For more information, see http://www.international-lisp-conference.org

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I have no background with Java so I tend to suffer pain when dealing with 
it. I am trying to create a thumbnail for an image, but my code dies on the 
:post assertion of this function: 

(defn get-file-as-image [filename]
  {:pre [(= (type filename) java.lang.String)
 (fs/exists? filename)
 (fs/file? (io/as-file filename))]
   :post [(do (pp/pprint %) true)
  (= (type %) BufferedImage)]}
  (javax.imageio.ImageIO/read (io/as-file filename)))

"fs" refers to: 
https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj

The :pre assertions are all apparently true, so the file exists and returns 
as a file when run through (io/as-file). 

I looked here for the documentation on javax.imageio.ImageIO/read:

http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#read(java.io.File)

It reads:

"Returns a BufferedImage as the result of decoding a supplied File with an 
ImageReader chosen automatically from among those currently registered. The 
File is wrapped in an ImageInputStream. If no registeredImageReader claims 
to be able to read the resulting stream, null is returned."

I added the pprint into my :post and it prints nil. So I assume the problem 
is this: 

"If no registeredImageReader claims to be able to read the resulting 
stream, null is returned."

What does it mean to register an ImageReader? 







-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I tried this too:

(ns tma-make-thumbnails.make-images
  (:import
   (java.util UUID)
   (javax.imageio ImageIO)
   (java.awt.image BufferedImage)
   (javax.imageio ImageReader))



(defn get-file-as-image [filename]
  {:pre [(= (type filename) java.lang.String)
 (fs/exists? filename)
 (fs/file? (io/as-file filename))]
   :post [(do (pp/pprint %) true)
  (= (type %) java.awt.image.BufferedImage)]}
  (.read ImageIO (io/as-file filename)))


but that only gives me: 

Exception in thread "Thread-1" java.lang.IllegalArgumentException: No 
matching method found: read for class java.lang.Class

I don't get why ImageIO is java.lang.Class after I imported it. 





On Thursday, February 27, 2014 3:09:53 PM UTC-5, larry google groups wrote:
>
> I have no background with Java so I tend to suffer pain when dealing with 
> it. I am trying to create a thumbnail for an image, but my code dies on the 
> :post assertion of this function: 
>
> (defn get-file-as-image [filename]
>   {:pre [(= (type filename) java.lang.String)
>  (fs/exists? filename)
>  (fs/file? (io/as-file filename))]
>:post [(do (pp/pprint %) true)
>   (= (type %) BufferedImage)]}
>   (javax.imageio.ImageIO/read (io/as-file filename)))
>
> "fs" refers to: 
> https://github.com/Raynes/fs/blob/master/src/me/raynes/fs.clj
>
> The :pre assertions are all apparently true, so the file exists and 
> returns as a file when run through (io/as-file). 
>
> I looked here for the documentation on javax.imageio.ImageIO/read:
>
>
> http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#read(java.io.File)
>
> It reads:
>
> "Returns a BufferedImage as the result of decoding a supplied File with 
> an ImageReader chosen automatically from among those currently 
> registered. The File is wrapped in an ImageInputStream. If no registered
> ImageReader claims to be able to read the resulting stream, null is 
> returned."
>
> I added the pprint into my :post and it prints nil. So I assume the 
> problem is this: 
>
> "If no registeredImageReader claims to be able to read the resulting 
> stream, null is returned."
>
> What does it mean to register an ImageReader? 
>
>
>
>
>
>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Found some unexpected behavior to me

2014-02-27 Thread Brent Millare
Clojure 1.5.1

user=> (defprotocol IEmit (-emit [x]))
IEmit

user=> (defrecord css [y] IEmit (-emit [_] y))
user.css

user=> (-emit (->css 3))
3

user=> (map -emit [(->css 3)])
IllegalArgumentException No matching field found: emit for class user.css 
 clojure.lang.Reflector.getInstanceField (Reflector.java:271)

user=> (map #(-emit %) [(->css 3)])
(3)


Why can't I pass -emit as an argument to map?

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
On Thu, Feb 27, 2014 at 3:44 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> I tried this too:
>
> (ns tma-make-thumbnails.make-images
>   (:import
>(java.util UUID)
>(javax.imageio ImageIO)
>(java.awt.image BufferedImage)
>(javax.imageio ImageReader))
>
>
>
> (defn get-file-as-image [filename]
>   {:pre [(= (type filename) java.lang.String)
>  (fs/exists? filename)
>  (fs/file? (io/as-file filename))]
>:post [(do (pp/pprint %) true)
>   (= (type %) java.awt.image.BufferedImage)]}
>   (.read ImageIO (io/as-file filename)))
>

This is trying to invoke the "read" method of the Class instance
representing "javax.imageio.ImageIO". This is surely not what you want.


> but that only gives me:
>
> Exception in thread "Thread-1" java.lang.IllegalArgumentException: No
> matching method found: read for class java.lang.Class
>
> I don't get why ImageIO is java.lang.Class after I imported it.
>
>
>
>
>
> On Thursday, February 27, 2014 3:09:53 PM UTC-5, larry google groups wrote:
>>
>> I have no background with Java so I tend to suffer pain when dealing with
>> it. I am trying to create a thumbnail for an image, but my code dies on the
>> :post assertion of this function:
>>
>> (defn get-file-as-image [filename]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (fs/file? (io/as-file filename))]
>>:post [(do (pp/pprint %) true)
>>   (= (type %) BufferedImage)]}
>>   (javax.imageio.ImageIO/read (io/as-file filename)))
>>
>

This is the correct syntax for invoking a static method of a class. I'm not
sure why it's not working for you. What kind of file are you trying to load?

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Found some unexpected behavior to me

2014-02-27 Thread David Nolen
Fixed in 1.6.

David


On Thu, Feb 27, 2014 at 3:50 PM, Brent Millare wrote:

> Clojure 1.5.1
>
> user=> (defprotocol IEmit (-emit [x]))
> IEmit
>
> user=> (defrecord css [y] IEmit (-emit [_] y))
> user.css
>
> user=> (-emit (->css 3))
> 3
>
> user=> (map -emit [(->css 3)])
> IllegalArgumentException No matching field found: emit for class user.css
>  clojure.lang.Reflector.getInstanceField (Reflector.java:271)
>
> user=> (map #(-emit %) [(->css 3)])
> (3)
>
>
> Why can't I pass -emit as an argument to map?
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [GSoC]: How to participate

2014-02-27 Thread Максим Карандашов
Hello, all.

I would like to take part in GSOC 2014
And after talking to a mentor I have next questions:

1. Does the community some particular proposal form for students?
2. Are there any formal requirements for students? (like fix bug in bug 
tracker of some project of community)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Uberjar woes

2014-02-27 Thread Tom Connors
Hi Everyone,
I've been having trouble creating an uberjar of a project and I'm hoping 
someone here can point me toward a solution.
After cleaning out the target directory (with "lein clean") and 
preprocessing my cljx, I can run the project with no trouble using lein 
repl and lein run. I can package up the project (lein with-profile prd 
uberjar) and get the resultant jar files. After that, the trouble starts. 
Running the jar (java -jar my-standalone.jar) fails with a 
NoClassDefFoundError error, pointing at a protocol defined in 
weaverjester's clout - clout/core/Route. 
I highly doubt clout actually has anything to do with the problem. After 
creating the uberjar, I can no longer run the project with lein run or lein 
repl - I get the same error, and I can't do anything with lein without 
getting that error until I remove the target directory. 
I've inspected the jar and can see that it contains clout, but just 
clout/core.clj - no .class files. I edited clout's project.clj to include 
:aot :all, packaged it into a jar, replaced the clout jar in my local maven 
repo with that new jar, and re-packaged my project. At this point, when I 
ran the jar, I got another NoClassDefFoundError, this time pointing at 
another protocol, but this one from clojure.core: clojure/lang/ILookupHost.
I've been having this problem with the latest leiningen (2.3.4) and 2.2.0. 
I've been futzing with my project.clj for some time, but to no avail. Any 
help greatly appreciated.
-Tom

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups

Ah, I see what happened. There was a Microsoft Word document in my folder 
of images. It was causing the problems. I had no error handling for 
non-images. 



On Thursday, February 27, 2014 3:52:09 PM UTC-5, Aaron Cohen wrote:
>
> On Thu, Feb 27, 2014 at 3:44 PM, larry google groups 
> 
> > wrote:
>
>> I tried this too:
>>
>> (ns tma-make-thumbnails.make-images
>>   (:import
>>(java.util UUID)
>>(javax.imageio ImageIO)
>>(java.awt.image BufferedImage)
>>(javax.imageio ImageReader))
>>
>>
>>
>> (defn get-file-as-image [filename]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (fs/file? (io/as-file filename))]
>>:post [(do (pp/pprint %) true)
>>   (= (type %) java.awt.image.BufferedImage)]}
>>   (.read ImageIO (io/as-file filename)))
>>
>
> This is trying to invoke the "read" method of the Class instance 
> representing "javax.imageio.ImageIO". This is surely not what you want.
>
>
>> but that only gives me: 
>>
>> Exception in thread "Thread-1" java.lang.IllegalArgumentException: No 
>> matching method found: read for class java.lang.Class
>>
>> I don't get why ImageIO is java.lang.Class after I imported it. 
>>
>>
>>
>>
>>
>> On Thursday, February 27, 2014 3:09:53 PM UTC-5, larry google groups 
>> wrote:
>>>
>>> I have no background with Java so I tend to suffer pain when dealing 
>>> with it. I am trying to create a thumbnail for an image, but my code dies 
>>> on the :post assertion of this function: 
>>>
>>> (defn get-file-as-image [filename]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (fs/file? (io/as-file filename))]
>>>:post [(do (pp/pprint %) true)
>>>   (= (type %) BufferedImage)]}
>>>   (javax.imageio.ImageIO/read (io/as-file filename)))
>>>
>>
>
> This is the correct syntax for invoking a static method of a class. I'm 
> not sure why it's not working for you. What kind of file are you trying to 
> load?
>  
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups

Hmm, I made it a little further. Now I am trying to write a thumbnail to 
disk. I have copied the code from StackOverflow. I am using this function: 

(defn make-thumbnail [filename path-to-new-file-including-file-name width]
  {:pre [(= (type filename) java.lang.String)
 (fs/exists? filename)
 (= (type path-to-new-file-including-file-name) java.lang.String)
 (number? width)]}
  (println " we will write thumbnails to here: " (str 
path-to-new-file-including-file-name))
  (let [ext (fs/extension filename)
img (get-file-as-image filename)
imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
width (min (.getWidth img) width)
height (* (/ width (.getWidth img)) (.getHeight img))
simg (java.awt.image.BufferedImage. width height imgtype)
g (.createGraphics simg)]
(.drawImage g img 0 0 width height nil)
(.dispose g)
(pp/pprint simg)
(javax.imageio.ImageIO/write simg ext (io/as-file 
path-to-new-file-including-file-name


This line:

  (println " we will write thumbnails to here: " (str 
path-to-new-file-including-file-name))

shows me this, which is the path I want:

we will write thumbnails to here: 
 
/Users/larry/tma_files/processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG

This line:

(pp/pprint simg)

gives me: 

#

I do not get any errors or exceptions, but nothing gets written to disk. 
Can anyone suggest why? 

If I look here:

http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,
 
java.lang.String, java.io.File)

Writes an image using an arbitrary ImageWriter that supports the given 
format to a File. If there is already a Filepresent, its contents are 
discarded.
Parameters:im - a RenderedImage to be written.formatName - a String containg 
the informal name of the format.output - a File to be written to.Returns:
false if no appropriate writer is found.

I am unsure what "false if no appropriate writer is found" means. I have 
added code to be sure that only jpeg, gif and png files get to this 
function. 

Any suggestions why nothing gets written to disk? 









On Thursday, February 27, 2014 4:09:10 PM UTC-5, larry google groups wrote:
>
>
> Ah, I see what happened. There was a Microsoft Word document in my folder 
> of images. It was causing the problems. I had no error handling for 
> non-images. 
>
>
>
> On Thursday, February 27, 2014 3:52:09 PM UTC-5, Aaron Cohen wrote:
>>
>> On Thu, Feb 27, 2014 at 3:44 PM, larry google groups <
>> lawrenc...@gmail.com> wrote:
>>
>>> I tried this too:
>>>
>>> (ns tma-make-thumbnails.make-images
>>>   (:import
>>>(java.util UUID)
>>>(javax.imageio ImageIO)
>>>(java.awt.image BufferedImage)
>>>(javax.imageio ImageReader))
>>>
>>>
>>>
>>> (defn get-file-as-image [filename]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (fs/file? (io/as-file filename))]
>>>:post [(do (pp/pprint %) true)
>>>   (= (type %) java.awt.image.BufferedImage)]}
>>>   (.read ImageIO (io/as-file filename)))
>>>
>>
>> This is trying to invoke the "read" method of the Class instance 
>> representing "javax.imageio.ImageIO". This is surely not what you want.
>>
>>
>>> but that only gives me: 
>>>
>>> Exception in thread "Thread-1" java.lang.IllegalArgumentException: No 
>>> matching method found: read for class java.lang.Class
>>>
>>> I don't get why ImageIO is java.lang.Class after I imported it. 
>>>
>>>
>>>
>>>
>>>
>>> On Thursday, February 27, 2014 3:09:53 PM UTC-5, larry google groups 
>>> wrote:

 I have no background with Java so I tend to suffer pain when dealing 
 with it. I am trying to create a thumbnail for an image, but my code dies 
 on the :post assertion of this function: 

 (defn get-file-as-image [filename]
   {:pre [(= (type filename) java.lang.String)
  (fs/exists? filename)
  (fs/file? (io/as-file filename))]
:post [(do (pp/pprint %) true)
   (= (type %) BufferedImage)]}
   (javax.imageio.ImageIO/read (io/as-file filename)))

>>>
>>
>> This is the correct syntax for invoking a static method of a class. I'm 
>> not sure why it's not working for you. What kind of file are you trying to 
>> load?
>>  
>>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I wanted to see what Format strings I am allowed, so at the repl: 


user> (import 'javax.imageio.ImageIO)
javax.imageio.ImageIO

user> (require '[clojure.pprint :as pp])

user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP", 
"bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF", 
"gif"]

(fs/extension) was returning ".JPG" with a period. I thought that might be 
the problem so I removed it:

(defn make-thumbnail [filename path-to-new-file-including-file-name width]
  {:pre [(= (type filename) java.lang.String)
 (fs/exists? filename)
 (= (type path-to-new-file-including-file-name) java.lang.String)
 (number? width)]}
  (println " we will write thumbnails to here: " (str 
path-to-new-file-including-file-name))
  (let [ext (st/replace (fs/extension filename) #"\." "")
img (get-file-as-image filename)
imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
width (min (.getWidth img) width)
height (* (/ width (.getWidth img)) (.getHeight img))
simg (java.awt.image.BufferedImage. width height imgtype)
g (.createGraphics simg)]
(.drawImage g img 0 0 width height nil)
(.dispose g)
(pp/pprint simg)
(println "the extension we use:")
(pp/pprint ext)
(javax.imageio.ImageIO/write simg ext (io/as-file 
path-to-new-file-including-file-name

So the final println gives me:

the extension we use:
"JPG"

and yet now I get:

Exception in thread "Thread-1" javax.imageio.IIOException: Invalid argument 
to native writeImage
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)

which is surprising since the Format string, without the period, should be 
more correct. 





On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups wrote:
>
>
> Hmm, I made it a little further. Now I am trying to write a thumbnail to 
> disk. I have copied the code from StackOverflow. I am using this function: 
>
> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>   {:pre [(= (type filename) java.lang.String)
>  (fs/exists? filename)
>  (= (type path-to-new-file-including-file-name) java.lang.String)
>  (number? width)]}
>   (println " we will write thumbnails to here: " (str 
> path-to-new-file-including-file-name))
>   (let [ext (fs/extension filename)
> img (get-file-as-image filename)
> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
> width (min (.getWidth img) width)
> height (* (/ width (.getWidth img)) (.getHeight img))
> simg (java.awt.image.BufferedImage. width height imgtype)
> g (.createGraphics simg)]
> (.drawImage g img 0 0 width height nil)
> (.dispose g)
> (pp/pprint simg)
> (javax.imageio.ImageIO/write simg ext (io/as-file 
> path-to-new-file-including-file-name
>
>
> This line:
>
>   (println " we will write thumbnails to here: " (str 
> path-to-new-file-including-file-name))
>
> shows me this, which is the path I want:
>
> we will write thumbnails to here: 
>  
> /Users/larry/tma_files/processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>
> This line:
>
> (pp/pprint simg)
>
> gives me: 
>
> # rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster: 
> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>
> I do not get any errors or exceptions, but nothing gets written to disk. 
> Can anyone suggest why? 
>
> If I look here:
>
> http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,
>  
> java.lang.String, java.io.File)
>
> Writes an image using an arbitrary ImageWriter that supports the given 
> format to a File. If there is already a Filepresent, its contents are 
> discarded.
> Parameters:im - a RenderedImage to be written.formatName - a String containg 
> the informal name of the format.output - a File to be written to.Returns:
> false if no appropriate writer is found.
>
> I am unsure what "false if no appropriate writer is found" means. I have 
> added code to be sure that only jpeg, gif and png files get to this 
> function. 
>
> Any suggestions why nothing gets written to disk? 
>
>
>
>
>
>
>
>
>
> On Thursday, February 27, 2014 4:09:10 PM UTC-5, larry google groups wrote:
>>
>>
>> Ah, I see what happened. There was a Microsoft Word document in my folder 
>> of images. It was causing the problems. I had no error handling for 
>> non-images. 
>>
>>
>>
>> On Thursday, February 27, 2014 3:52:09 PM UTC-5, Aaron Cohen wrote:
>>>
>>> On Thu, Feb 27, 2014 at 3:44 PM, larry google groups <
>>> lawrenc...@gmail.com> wrote:
>>>
 I tried this too:

 (ns tma-make-thumbnails.make-images
   (:import
(java.util UUID)
(javax.imageio ImageIO)
(java.awt.image BufferedImage)
(javax.imageio ImageReader))



 (defn get-file-as-image [filename]
   {:pre [(= (type filename) java.lang.String)
  

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
and if I look here:

http://www.mkyong.com/java/how-to-write-an-image-to-file-imageio/

I see this example:



ImageIO.write(image, "jpg",new File("C:\\out.jpg"));
ImageIO.write(image, "gif",new File("C:\\out.gif"));
ImageIO.write(image, "png",new File("C:\\out.png"));


None of those formatting strings have a period in them. And yet when I 
remove the period from my extension, I get an error. And even with it, 
nothing happens and nothing gets written to disk. 





On Thursday, February 27, 2014 5:04:50 PM UTC-5, larry google groups wrote:
>
> I wanted to see what Format strings I am allowed, so at the repl: 
>
>
> user> (import 'javax.imageio.ImageIO)
> javax.imageio.ImageIO
>
> user> (require '[clojure.pprint :as pp])
>
> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP", 
> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF", 
> "gif"]
>
> (fs/extension) was returning ".JPG" with a period. I thought that might be 
> the problem so I removed it:
>
> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>   {:pre [(= (type filename) java.lang.String)
>  (fs/exists? filename)
>  (= (type path-to-new-file-including-file-name) java.lang.String)
>  (number? width)]}
>   (println " we will write thumbnails to here: " (str 
> path-to-new-file-including-file-name))
>   (let [ext (st/replace (fs/extension filename) #"\." "")
> img (get-file-as-image filename)
> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
> width (min (.getWidth img) width)
> height (* (/ width (.getWidth img)) (.getHeight img))
> simg (java.awt.image.BufferedImage. width height imgtype)
> g (.createGraphics simg)]
> (.drawImage g img 0 0 width height nil)
> (.dispose g)
> (pp/pprint simg)
> (println "the extension we use:")
> (pp/pprint ext)
> (javax.imageio.ImageIO/write simg ext (io/as-file 
> path-to-new-file-including-file-name
>
> So the final println gives me:
>
> the extension we use:
> "JPG"
>
> and yet now I get:
>
> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid 
> argument to native writeImage
> at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
>
> which is surprising since the Format string, without the period, should be 
> more correct. 
>
>
>
>
>
> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups wrote:
>>
>>
>> Hmm, I made it a little further. Now I am trying to write a thumbnail to 
>> disk. I have copied the code from StackOverflow. I am using this function: 
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str 
>> path-to-new-file-including-file-name))
>>   (let [ext (fs/extension filename)
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>> path-to-new-file-including-file-name
>>
>>
>> This line:
>>
>>   (println " we will write thumbnails to here: " (str 
>> path-to-new-file-including-file-name))
>>
>> shows me this, which is the path I want:
>>
>> we will write thumbnails to here: 
>>  
>> /Users/larry/tma_files/processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>
>> This line:
>>
>> (pp/pprint simg)
>>
>> gives me: 
>>
>> #> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster: 
>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>
>> I do not get any errors or exceptions, but nothing gets written to disk. 
>> Can anyone suggest why? 
>>
>> If I look here:
>>
>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,
>>  
>> java.lang.String, java.io.File)
>>
>> Writes an image using an arbitrary ImageWriter that supports the given 
>> format to a File. If there is already a Filepresent, its contents are 
>> discarded.
>> Parameters:im - a RenderedImage to be written.formatName - a String containg 
>> the informal name of the format.output - a File to be written to.Returns:
>> false if no appropriate writer is found.
>>
>> I am unsure what "false if no appropriate writer is found" means. I have 
>> added code to be sure that only jpeg, gif and png files get to this 
>> function. 
>>
>> Any suggestions why nothing gets written to disk? 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>

Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
This is going to result in a pretty ugly thumbnail because you're missing
the hints java needs to do high quality resizing. Java's shrinking also
doesn't really have a nice smoothing mode.

I'd actually recommend you look into https://github.com/mikera/imagez. It
has a resize function in core which does what you want. It uses Scalr
internally which has some good quality options.

As for why your code isn't working, it's hard to say. Can you try just
writing out the file you read (before resizing) and make sure that it's
actually loaded correctly?




On Thu, Feb 27, 2014 at 5:04 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> I wanted to see what Format strings I am allowed, so at the repl:
>
>
> user> (import 'javax.imageio.ImageIO)
> javax.imageio.ImageIO
>
> user> (require '[clojure.pprint :as pp])
>
> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP",
> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF",
> "gif"]
>
> (fs/extension) was returning ".JPG" with a period. I thought that might be
> the problem so I removed it:
>
> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>   {:pre [(= (type filename) java.lang.String)
>  (fs/exists? filename)
>  (= (type path-to-new-file-including-file-name) java.lang.String)
>  (number? width)]}
>   (println " we will write thumbnails to here: " (str
> path-to-new-file-including-file-name))
>   (let [ext (st/replace (fs/extension filename) #"\." "")
> img (get-file-as-image filename)
> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
> width (min (.getWidth img) width)
> height (* (/ width (.getWidth img)) (.getHeight img))
> simg (java.awt.image.BufferedImage. width height imgtype)
> g (.createGraphics simg)]
> (.drawImage g img 0 0 width height nil)
> (.dispose g)
> (pp/pprint simg)
> (println "the extension we use:")
> (pp/pprint ext)
> (javax.imageio.ImageIO/write simg ext (io/as-file
> path-to-new-file-including-file-name
>
> So the final println gives me:
>
> the extension we use:
> "JPG"
>
> and yet now I get:
>
> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid
> argument to native writeImage
> at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
>
> which is surprising since the Format string, without the period, should be
> more correct.
>
>
>
>
>
> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups wrote:
>>
>>
>> Hmm, I made it a little further. Now I am trying to write a thumbnail to
>> disk. I have copied the code from StackOverflow. I am using this function:
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name
>> width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str
>> path-to-new-file-including-file-name))
>>   (let [ext (fs/extension filename)
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (javax.imageio.ImageIO/write simg ext (io/as-file
>> path-to-new-file-including-file-name
>>
>>
>> This line:
>>
>>   (println " we will write thumbnails to here: " (str
>> path-to-new-file-including-file-name))
>>
>> shows me this, which is the path I want:
>>
>> we will write thumbnails to here:  /Users/larry/tma_files/
>> processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>
>> This line:
>>
>> (pp/pprint simg)
>>
>> gives me:
>>
>> #> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster:
>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>
>> I do not get any errors or exceptions, but nothing gets written to disk.
>> Can anyone suggest why?
>>
>> If I look here:
>>
>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/
>> ImageIO.html#write(java.awt.image.RenderedImage, java.lang.String,
>> java.io.File)
>>
>> Writes an image using an arbitrary ImageWriter that supports the given
>> format to a File. If there is already a Filepresent, its contents are
>> discarded.
>> Parameters:im - a RenderedImage to be written.formatName - a String containg
>> the informal name of the format.output - a File to be written to.Returns:
>> false if no appropriate writer is found.
>>
>> I am unsure what "false if no appropriate writer is found" means. I have
>> added code to be sure that only jpeg, gif and png files get to this
>> function.
>>
>> Any suggestions why nothing gets written to 

Re: [GSoC]: How to participate

2014-02-27 Thread Daniel Solano Gómez
On Thu Feb 27 13:04 2014, Максим Карандашов wrote:
> Hello, all.
> 
> I would like to take part in GSOC 2014
> And after talking to a mentor I have next questions:
> 
> 1. Does the community some particular proposal form for students?

We do have some student application guidelines up on the wiki [1].

> 2. Are there any formal requirements for students? (like fix bug in bug 
> tracker of some project of community)

Not formally, no.  Of course, you have to meet the requirements set
forth by Google [2].

Beyond that, you should make a note of what kinds of things you have
done that would make your application stronger, such as fixing bugs in a
project.

I hope this helps.

Sincerely,

Daniel

[1]: http://dev.clojure.org/display/community/Student+application+guidelines
[2]: 
http://www.google-melange.com/gsoc/document/show/gsoc_program/google/gsoc2014/help_page#1._How_does_a_mentoring_organization


> 
> -- 
> 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
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread Aaron Cohen
You definitely don't want a period in your format string.

Why are you calling(.drawImage g img 0 0 width height nil). What's the
nil for? I'd try dropping it.


On Thu, Feb 27, 2014 at 5:17 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> and if I look here:
>
> http://www.mkyong.com/java/how-to-write-an-image-to-file-imageio/
>
> I see this example:
>
>
>
> ImageIO.write(image, "jpg",new File("C:\\out.jpg"));
> ImageIO.write(image, "gif",new File("C:\\out.gif"));
> ImageIO.write(image, "png",new File("C:\\out.png"));
>
>
> None of those formatting strings have a period in them. And yet when I
> remove the period from my extension, I get an error. And even with it,
> nothing happens and nothing gets written to disk.
>
>
>
>
>
> On Thursday, February 27, 2014 5:04:50 PM UTC-5, larry google groups wrote:
>>
>> I wanted to see what Format strings I am allowed, so at the repl:
>>
>>
>> user> (import 'javax.imageio.ImageIO)
>> javax.imageio.ImageIO
>>
>> user> (require '[clojure.pprint :as pp])
>>
>> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP",
>> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF",
>> "gif"]
>>
>> (fs/extension) was returning ".JPG" with a period. I thought that might
>> be the problem so I removed it:
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name
>> width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str
>> path-to-new-file-including-file-name))
>>   (let [ext (st/replace (fs/extension filename) #"\." "")
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (println "the extension we use:")
>> (pp/pprint ext)
>> (javax.imageio.ImageIO/write simg ext (io/as-file
>> path-to-new-file-including-file-name
>>
>> So the final println gives me:
>>
>> the extension we use:
>> "JPG"
>>
>> and yet now I get:
>>
>> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid
>> argument to native writeImage
>> at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
>>
>> which is surprising since the Format string, without the period, should
>> be more correct.
>>
>>
>>
>>
>>
>> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups
>> wrote:
>>>
>>>
>>> Hmm, I made it a little further. Now I am trying to write a thumbnail to
>>> disk. I have copied the code from StackOverflow. I am using this function:
>>>
>>> (defn make-thumbnail [filename path-to-new-file-including-file-name
>>> width]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (= (type path-to-new-file-including-file-name)
>>> java.lang.String)
>>>  (number? width)]}
>>>   (println " we will write thumbnails to here: " (str
>>> path-to-new-file-including-file-name))
>>>   (let [ext (fs/extension filename)
>>> img (get-file-as-image filename)
>>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>>> width (min (.getWidth img) width)
>>> height (* (/ width (.getWidth img)) (.getHeight img))
>>> simg (java.awt.image.BufferedImage. width height imgtype)
>>> g (.createGraphics simg)]
>>> (.drawImage g img 0 0 width height nil)
>>> (.dispose g)
>>> (pp/pprint simg)
>>> (javax.imageio.ImageIO/write simg ext (io/as-file
>>> path-to-new-file-including-file-name
>>>
>>>
>>> This line:
>>>
>>>   (println " we will write thumbnails to here: " (str
>>> path-to-new-file-including-file-name))
>>>
>>> shows me this, which is the path I want:
>>>
>>> we will write thumbnails to here:  /Users/larry/tma_files/
>>> processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>>
>>> This line:
>>>
>>> (pp/pprint simg)
>>>
>>> gives me:
>>>
>>> #>> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster:
>>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>>
>>> I do not get any errors or exceptions, but nothing gets written to disk.
>>> Can anyone suggest why?
>>>
>>> If I look here:
>>>
>>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/
>>> ImageIO.html#write(java.awt.image.RenderedImage, java.lang.String,
>>> java.io.File)
>>>
>>> Writes an image using an arbitrary ImageWriter that supports the given
>>> format to a File. If there is already a Filepresent, its contents are
>>> discarded.
>>> Parameters:im - a RenderedImage to be written.formatName - a

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups

Thanks for the tip about imagez. I wanted to get something basic working 
today, but I'll give imagez a look tomorrow. As for now, I feel like I 
should not give up till I have figured out what the problem is. 


On Thursday, February 27, 2014 5:17:20 PM UTC-5, Aaron Cohen wrote:
>
> This is going to result in a pretty ugly thumbnail because you're missing 
> the hints java needs to do high quality resizing. Java's shrinking also 
> doesn't really have a nice smoothing mode.
>
> I'd actually recommend you look into https://github.com/mikera/imagez. It 
> has a resize function in core which does what you want. It uses Scalr 
> internally which has some good quality options.
>
> As for why your code isn't working, it's hard to say. Can you try just 
> writing out the file you read (before resizing) and make sure that it's 
> actually loaded correctly?
>
>
>
>
> On Thu, Feb 27, 2014 at 5:04 PM, larry google groups 
> 
> > wrote:
>
>> I wanted to see what Format strings I am allowed, so at the repl: 
>>
>>
>> user> (import 'javax.imageio.ImageIO)
>> javax.imageio.ImageIO
>>
>> user> (require '[clojure.pprint :as pp])
>>
>> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP", 
>> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF", 
>> "gif"]
>>
>> (fs/extension) was returning ".JPG" with a period. I thought that might 
>> be the problem so I removed it:
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str 
>> path-to-new-file-including-file-name))
>>   (let [ext (st/replace (fs/extension filename) #"\." "")
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (println "the extension we use:")
>> (pp/pprint ext)
>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>> path-to-new-file-including-file-name
>>
>> So the final println gives me:
>>
>> the extension we use:
>> "JPG"
>>
>> and yet now I get:
>>
>> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid 
>> argument to native writeImage
>>  at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native 
>> Method)
>>
>> which is surprising since the Format string, without the period, should 
>> be more correct. 
>>
>>
>>
>>
>>
>> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups 
>> wrote:
>>>
>>>
>>> Hmm, I made it a little further. Now I am trying to write a thumbnail to 
>>> disk. I have copied the code from StackOverflow. I am using this function: 
>>>
>>> (defn make-thumbnail [filename path-to-new-file-including-file-name 
>>> width]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (= (type path-to-new-file-including-file-name) 
>>> java.lang.String)
>>>  (number? width)]}
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>   (let [ext (fs/extension filename)
>>> img (get-file-as-image filename)
>>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>>> width (min (.getWidth img) width)
>>> height (* (/ width (.getWidth img)) (.getHeight img))
>>> simg (java.awt.image.BufferedImage. width height imgtype)
>>> g (.createGraphics simg)]
>>> (.drawImage g img 0 0 width height nil)
>>> (.dispose g)
>>> (pp/pprint simg)
>>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>>> path-to-new-file-including-file-name
>>>
>>>
>>> This line:
>>>
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>
>>> shows me this, which is the path I want:
>>>
>>> we will write thumbnails to here:  /Users/larry/tma_files/
>>> processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>>
>>> This line:
>>>
>>> (pp/pprint simg)
>>>
>>> gives me: 
>>>
>>> #>> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster: 
>>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>>
>>> I do not get any errors or exceptions, but nothing gets written to disk. 
>>> Can anyone suggest why? 
>>>
>>> If I look here:
>>>
>>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/
>>> ImageIO.html#write(java.awt.image.RenderedImage, java.lang.String, 
>>> java.io.File)
>>>
>>> Writes an image using an arbitrary ImageWriter that supports the given 
>>> format to a File. If there is already a Filepresent, 

Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups
I found this:

http://stackoverflow.com/questions/3432388/imageio-not-able-to-write-a-jpeg-file

So I changed this:

imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)

to this:

imgtype (java.awt.image.BufferedImage/TYPE_3BYTE_BGR)

and that worked for one image. The next image died, for reasons I'm still 
investigating. 



On Thursday, February 27, 2014 5:17:20 PM UTC-5, Aaron Cohen wrote:
>
> This is going to result in a pretty ugly thumbnail because you're missing 
> the hints java needs to do high quality resizing. Java's shrinking also 
> doesn't really have a nice smoothing mode.
>
> I'd actually recommend you look into https://github.com/mikera/imagez. It 
> has a resize function in core which does what you want. It uses Scalr 
> internally which has some good quality options.
>
> As for why your code isn't working, it's hard to say. Can you try just 
> writing out the file you read (before resizing) and make sure that it's 
> actually loaded correctly?
>
>
>
>
> On Thu, Feb 27, 2014 at 5:04 PM, larry google groups 
> 
> > wrote:
>
>> I wanted to see what Format strings I am allowed, so at the repl: 
>>
>>
>> user> (import 'javax.imageio.ImageIO)
>> javax.imageio.ImageIO
>>
>> user> (require '[clojure.pprint :as pp])
>>
>> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP", 
>> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF", 
>> "gif"]
>>
>> (fs/extension) was returning ".JPG" with a period. I thought that might 
>> be the problem so I removed it:
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str 
>> path-to-new-file-including-file-name))
>>   (let [ext (st/replace (fs/extension filename) #"\." "")
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (println "the extension we use:")
>> (pp/pprint ext)
>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>> path-to-new-file-including-file-name
>>
>> So the final println gives me:
>>
>> the extension we use:
>> "JPG"
>>
>> and yet now I get:
>>
>> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid 
>> argument to native writeImage
>>  at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native 
>> Method)
>>
>> which is surprising since the Format string, without the period, should 
>> be more correct. 
>>
>>
>>
>>
>>
>> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups 
>> wrote:
>>>
>>>
>>> Hmm, I made it a little further. Now I am trying to write a thumbnail to 
>>> disk. I have copied the code from StackOverflow. I am using this function: 
>>>
>>> (defn make-thumbnail [filename path-to-new-file-including-file-name 
>>> width]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (= (type path-to-new-file-including-file-name) 
>>> java.lang.String)
>>>  (number? width)]}
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>   (let [ext (fs/extension filename)
>>> img (get-file-as-image filename)
>>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>>> width (min (.getWidth img) width)
>>> height (* (/ width (.getWidth img)) (.getHeight img))
>>> simg (java.awt.image.BufferedImage. width height imgtype)
>>> g (.createGraphics simg)]
>>> (.drawImage g img 0 0 width height nil)
>>> (.dispose g)
>>> (pp/pprint simg)
>>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>>> path-to-new-file-including-file-name
>>>
>>>
>>> This line:
>>>
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>
>>> shows me this, which is the path I want:
>>>
>>> we will write thumbnails to here:  /Users/larry/tma_files/
>>> processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>>
>>> This line:
>>>
>>> (pp/pprint simg)
>>>
>>> gives me: 
>>>
>>> #>> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster: 
>>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>>
>>> I do not get any errors or exceptions, but nothing gets written to disk. 
>>> Can anyone suggest why? 
>>>
>>> If I look here:
>>>
>>> http://docs.oracle.com/javase/7/docs/api/javax/imageio/
>>> ImageIO.html#write(java.awt.image.RenderedImage, java.lang.String, 
>>> java.io.File)
>>>
>

[ANN] Clojure 1.6.0-beta2

2014-02-27 Thread Alex Miller
Clojure 1.6.0-beta1 is now available. 
 
Try it via 
- Download: http://central.maven.org/maven2/org/clojure/clojure/1.6.0-beta2
- Leiningen: [org.clojure/clojure "1.6.0-beta2"]

See the full change log here:
https://github.com/clojure/clojure/blob/master/changes.md

Clojure 1.6.0-beta2 has the following changes from 1.6.0-beta1:

- [CLJ-1355] Restore hashCode for Symbol and Keyword (regression from 
hashing changes)
- [CLJ-1363] Reflective .- should return field if field and method both 
exist
- [CLJ-1354] Make APersistentVector.SubVector public 
- Move loop locals into same clearing context as loop body (makes local 
clearing earlier on loop vars in some cases)
- [CLJ-1352] Fix regression in running test fixtures introduced in CLJ-866

Please give it a try and let us know your feedback!
Alex 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Clojure 1.6.0-beta2

2014-02-27 Thread Alex Miller
That first line should be 1.6.0-beta2 of course. :) 

On Thursday, February 27, 2014 5:37:15 PM UTC-5, Alex Miller wrote:
>
> Clojure 1.6.0-beta1 is now available. 
>  
> Try it via 
> - Download: 
> http://central.maven.org/maven2/org/clojure/clojure/1.6.0-beta2
> - Leiningen: [org.clojure/clojure "1.6.0-beta2"]
>
> See the full change log here:
> https://github.com/clojure/clojure/blob/master/changes.md
>
> Clojure 1.6.0-beta2 has the following changes from 1.6.0-beta1:
>
> - [CLJ-1355] Restore hashCode for Symbol and Keyword (regression from 
> hashing changes)
> - [CLJ-1363] Reflective .- should return field if field and method both 
> exist
> - [CLJ-1354] Make APersistentVector.SubVector public 
> - Move loop locals into same clearing context as loop body (makes local 
> clearing earlier on loop vars in some cases)
> - [CLJ-1352] Fix regression in running test fixtures introduced in CLJ-866
>
> Please give it a try and let us know your feedback!
> Alex 
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why do I have to register an ImageReader?

2014-02-27 Thread larry google groups

Okay, everything works now. Apparently that last problem had something to 
do with differences between OpenJDK and the SunJDK. I have:

java -version
openjdk version "1.7.0-ea"
OpenJDK Runtime Environment (build 1.7.0-ea-b222)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

I don't recall why I installed OpenJDK on my Mac. Do people on this mailist 
feel that the Sun JDK is better? 

I'm going to give the imagez library a try tomorrow. 






On Thursday, February 27, 2014 5:17:20 PM UTC-5, Aaron Cohen wrote:
>
> This is going to result in a pretty ugly thumbnail because you're missing 
> the hints java needs to do high quality resizing. Java's shrinking also 
> doesn't really have a nice smoothing mode.
>
> I'd actually recommend you look into https://github.com/mikera/imagez. It 
> has a resize function in core which does what you want. It uses Scalr 
> internally which has some good quality options.
>
> As for why your code isn't working, it's hard to say. Can you try just 
> writing out the file you read (before resizing) and make sure that it's 
> actually loaded correctly?
>
>
>
>
> On Thu, Feb 27, 2014 at 5:04 PM, larry google groups 
> 
> > wrote:
>
>> I wanted to see what Format strings I am allowed, so at the repl: 
>>
>>
>> user> (import 'javax.imageio.ImageIO)
>> javax.imageio.ImageIO
>>
>> user> (require '[clojure.pprint :as pp])
>>
>> user> (pp/pprint (javax.imageio.ImageIO/getReaderFormatNames))["BMP", 
>> "bmp", "jpg", "JPG", "wbmp", "jpeg", "png", "JPEG", "PNG", "WBMP", "GIF", 
>> "gif"]
>>
>> (fs/extension) was returning ".JPG" with a period. I thought that might 
>> be the problem so I removed it:
>>
>> (defn make-thumbnail [filename path-to-new-file-including-file-name width]
>>   {:pre [(= (type filename) java.lang.String)
>>  (fs/exists? filename)
>>  (= (type path-to-new-file-including-file-name) java.lang.String)
>>  (number? width)]}
>>   (println " we will write thumbnails to here: " (str 
>> path-to-new-file-including-file-name))
>>   (let [ext (st/replace (fs/extension filename) #"\." "")
>> img (get-file-as-image filename)
>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>> width (min (.getWidth img) width)
>> height (* (/ width (.getWidth img)) (.getHeight img))
>> simg (java.awt.image.BufferedImage. width height imgtype)
>> g (.createGraphics simg)]
>> (.drawImage g img 0 0 width height nil)
>> (.dispose g)
>> (pp/pprint simg)
>> (println "the extension we use:")
>> (pp/pprint ext)
>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>> path-to-new-file-including-file-name
>>
>> So the final println gives me:
>>
>> the extension we use:
>> "JPG"
>>
>> and yet now I get:
>>
>> Exception in thread "Thread-1" javax.imageio.IIOException: Invalid 
>> argument to native writeImage
>>  at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native 
>> Method)
>>
>> which is surprising since the Format string, without the period, should 
>> be more correct. 
>>
>>
>>
>>
>>
>> On Thursday, February 27, 2014 4:47:31 PM UTC-5, larry google groups 
>> wrote:
>>>
>>>
>>> Hmm, I made it a little further. Now I am trying to write a thumbnail to 
>>> disk. I have copied the code from StackOverflow. I am using this function: 
>>>
>>> (defn make-thumbnail [filename path-to-new-file-including-file-name 
>>> width]
>>>   {:pre [(= (type filename) java.lang.String)
>>>  (fs/exists? filename)
>>>  (= (type path-to-new-file-including-file-name) 
>>> java.lang.String)
>>>  (number? width)]}
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>   (let [ext (fs/extension filename)
>>> img (get-file-as-image filename)
>>> imgtype (java.awt.image.BufferedImage/TYPE_INT_ARGB)
>>> width (min (.getWidth img) width)
>>> height (* (/ width (.getWidth img)) (.getHeight img))
>>> simg (java.awt.image.BufferedImage. width height imgtype)
>>> g (.createGraphics simg)]
>>> (.drawImage g img 0 0 width height nil)
>>> (.dispose g)
>>> (pp/pprint simg)
>>> (javax.imageio.ImageIO/write simg ext (io/as-file 
>>> path-to-new-file-including-file-name
>>>
>>>
>>> This line:
>>>
>>>   (println " we will write thumbnails to here: " (str 
>>> path-to-new-file-including-file-name))
>>>
>>> shows me this, which is the path I want:
>>>
>>> we will write thumbnails to here:  /Users/larry/tma_files/
>>> processed/b5838394-a86c-411f-b556-94b30c26a553IMG_1175_180.JPG
>>>
>>> This line:
>>>
>>> (pp/pprint simg)
>>>
>>> gives me: 
>>>
>>> #>> rmask=ff gmask=ff00 bmask=ff amask=ff00 IntegerInterleavedRaster: 
>>> width = 125 height = 93 #Bands = 4 xOff = 0 yOff = 0 dataOffset[0] 0>
>>>
>>> I do not get any errors or exceptions, but nothing gets written to disk. 
>>> Can anyone suggest why? 
>>>
>>> If I look here:
>>>
>>> http://docs.oracle.com/javase/7/docs/api/j

Re: Uberjar woes

2014-02-27 Thread Sam Ritchie

Hey Tom,

Can you post your project.clj for us to take a peek?


Tom Connors 
February 27, 2014 12:49 PM
Hi Everyone,
I've been having trouble creating an uberjar of a project and I'm 
hoping someone here can point me toward a solution.
After cleaning out the target directory (with "lein clean") and 
preprocessing my cljx, I can run the project with no trouble using 
lein repl and lein run. I can package up the project (lein 
with-profile prd uberjar) and get the resultant jar files. After that, 
the trouble starts. Running the jar (java -jar my-standalone.jar) 
fails with a NoClassDefFoundError error, pointing at a protocol 
defined in weaverjester's clout - 
clout/core/Route. I highly doubt 
clout actually has anything to do with the problem. After creating the 
uberjar, I can no longer run the project with lein run or lein repl - 
I get the same error, and I can't do anything with lein without 
getting that error until I remove the target directory.
I've inspected the jar and can see that it contains clout, but just 
clout/core.clj - no .class files. I edited clout's project.clj to 
include :aot :all, packaged it into a jar, replaced the clout jar in 
my local maven repo with that new jar, and re-packaged my project. At 
this point, when I ran the jar, I got another NoClassDefFoundError, 
this time pointing at another protocol, but this one from 
clojure.core: clojure/lang/ILookupHost.
I've been having this problem with the latest leiningen (2.3.4) and 
2.2.0.
I've been futzing with my project.clj for some time, but to no avail. 
Any help greatly appreciated.

-Tom
--
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
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/groups/opt_out.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
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
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<>

Re: Macro writing macro fails with CLJS

2014-02-27 Thread Karsten Schmidt
Just to follow up on this & a note for future reference: I could get
my original macro to work in both dialects by just syntax quoting the
passed in arguments and I've also pushed out a first release of the
mini-library this is all meant for...

https://github.com/thi-ng/macromath/blob/master/index.org

Thanks once more for the pointers!

On 24 February 2014 15:10, David Nolen  wrote:
> If I recall you are allowed to splice in references to Java objects so this
> works out in Clojure.
>
>
> On Sunday, February 23, 2014, Karsten Schmidt  wrote:
>>
>> Oh man, I really do have to spend some more quality time with
>> macroexpand-1 to fully grok those "~'~" forms, and - thank you - that
>> change does work indeed! But then why does my original version work in
>> Clojure? A change in quoting usually only causes havok/failure, but
>> here it doesn't seem to...
>>
>> Thanks again! K.
>>
>>
>> On 23 February 2014 22:15, David Nolen  wrote:
>> > I think your unquoting needs tweaking?
>> >
>> > (defmacro defmathop
>> >   "Constructs a macro to build inlined nested expressions with f applied
>> >   to inner pairs and f2 to combine results."
>> >   [name f f2]
>> >   `(defmacro ~name
>> >  ([a# b# c#] `(~'~f2 (~'~f ~a# ~b#) ~c#))
>> >  ([a# b# c# d#] `(~'~f2 (~'~f ~a# ~b#) (~'~f ~c# ~d#)
>> >
>> > On Sunday, February 23, 2014, Karsten Schmidt  wrote:
>> >>
>> >> Thanks, David! I tried that already and it didn't work:
>> >>
>> >> clojure.lang.Compiler$CompilerException:
>> >> java.lang.ClassNotFoundException: cljs.core,
>> >> compiling:(macromath/macros.clj:58:1)
>> >>
>> >> I also tried to require cljs.core in that macro's namespace, but then
>> >> it complains this way:
>> >>
>> >> clojure.lang.Compiler$CompilerException: java.lang.RuntimeException:
>> >> Can't take value of a macro: #'cljs.core/+,
>> >> compiling:(macromath/macros.clj:59:1)
>> >>
>> >> Hmmm
>> >>
>> >> On 23 February 2014 19:52, David Nolen  wrote:
>> >> > You shouldn't use js*, and in this case it can be avoided. The
>> >> > problem
>> >> > you're encountering is a long outstanding wart that ClojureScript
>> >> > macros
>> >> > resolve symbols in Clojure not ClojureScript. Instead of + (which is
>> >> > actually clojure.core/+) you want to specify cljs.core/+:
>> >> >
>> >> > (defmathop cljs.core/+ cljs.core/+)
>> >> >
>> >> >
>> >> > On Sun, Feb 23, 2014 at 2:47 PM, Karsten Schmidt 
>> >> > wrote:
>> >> >>
>> >> >> After taking another look through cljs.core I managed to reformulate
>> >> >> my macro using js* templates, but am still wondering why the
>> >> >> "normal"
>> >> >> (and cross-platform) solution doesn't work and also if using the js*
>> >> >> way is actually safe in the future (i.e. not just a current
>> >> >> implementation detail)?
>> >> >>
>> >> >> (defmacro defmathop
>> >> >>   "Constructs macro to build inlined nested expressions with f
>> >> >> applied
>> >> >> to inner pairs and f2 to combine results."
>> >> >>   [name f f2]
>> >> >>   `(defmacro ~name
>> >> >>  ([a# b# c#]
>> >> >> (list '~'js* (str "((~{} " ~f " ~{}) " ~f2 " ~{})")
>> >> >>   a# b# c#))
>> >> >>  ([a# b# c# d#]
>> >> >> (list '~'js* (str "((~{} " ~f " ~{}) " ~f2 " (~{} " ~f "
>> >> >> ~{}))")
>> >> >>   a# b# c# d#
>> >> >>
>> >> >> (defmathop madd "*" "+")
>> >> >>
>> >> >> Thanks for any answers!
>> >> >>
>> >> >> On 23 February 2014 16:28, Karsten Schmidt  wrote:
>> >> >> > Btw. My cljs example above is slightly wrong due to my simplifying
>> >> >> > the
>> >> >> > email
>> >> >> > example. I originally used this ns declaration
>> >> >> >
>> >> >> > (ns macromath.test
>> >> >> >   (:require-macros [macromath.core :as m]))
>> >> >> >
>> >> >> > ...and then of course referred to (m/madd ...)
>> >> >> >
>> >> >> > But the issue remains regardless...
>> >> >> >
>> >> >> > On 23 Feb 2014 15:59, "Karsten Schmidt"  wrote:
>> >> >> >>
>> >> >> >> Hi, I've written a macro to build inline expanded math
>> >> >> >> expressions
>> >> >> >> and
>> >> >> --
>> > 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
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Clojure" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to clojure+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>> --
>> Karsten Schmidt
>> http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk
>>
>> --
>> You received this message because you are subscribed to the Goo

Re: Uberjar woes

2014-02-27 Thread Tom Connors
Hi Sam, thanks a lot for responding. Here's my project.clj: 
https://gist.github.com/tomconnors/9261413

On Thursday, February 27, 2014 2:49:38 PM UTC-5, Tom Connors wrote:
>
> Hi Everyone,
> I've been having trouble creating an uberjar of a project and I'm hoping 
> someone here can point me toward a solution.
> After cleaning out the target directory (with "lein clean") and 
> preprocessing my cljx, I can run the project with no trouble using lein 
> repl and lein run. I can package up the project (lein with-profile prd 
> uberjar) and get the resultant jar files. After that, the trouble starts. 
> Running the jar (java -jar my-standalone.jar) fails with a 
> NoClassDefFoundError error, pointing at a protocol defined in 
> weaverjester's clout - 
> clout/core/Route. 
> I highly doubt clout actually has anything to do with the problem. After 
> creating the uberjar, I can no longer run the project with lein run or lein 
> repl - I get the same error, and I can't do anything with lein without 
> getting that error until I remove the target directory. 
> I've inspected the jar and can see that it contains clout, but just 
> clout/core.clj - no .class files. I edited clout's project.clj to include 
> :aot :all, packaged it into a jar, replaced the clout jar in my local maven 
> repo with that new jar, and re-packaged my project. At this point, when I 
> ran the jar, I got another NoClassDefFoundError, this time pointing at 
> another protocol, but this one from clojure.core: clojure/lang/ILookupHost.
> I've been having this problem with the latest leiningen (2.3.4) and 2.2.0. 
> I've been futzing with my project.clj for some time, but to no avail. Any 
> help greatly appreciated.
> -Tom
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you recommend the book: "Web Development with Clojure"

2014-02-27 Thread Hari Krishnan

My experience..

1.  It is a well written book.  You will have to read sequentially.  
2. Prior knowledge of clojure is required -- list, vector, map, let etc. 
(Or at least review the clojure summary at the back first).
3. Since I knew Rails before, a lot of the concepts seemed to be straight 
forward -- routes, handlers (controllers), Urls, Ring (wardern) etc.
4. One benefit is you can build a decent web application quickly.  
5.  The auther is the creator of Luminusweb.  But he doesn't tout that 
framework.  There is only a paragraph at the end.  But if you are going to 
choose that web framework (or libraries), or similar ones such as Joodo, 
reading this book will help get us some low level understanding of all the 
pieces working together.

Worth the investment (imho).  

On Friday, February 21, 2014 8:43:59 AM UTC-8, Stefan Kanev wrote:
>
> On 19/02/14, Erlis Vidal wrote: 
> > Hi all, 
> > 
> > Have any of you read the book *Web Development with Clojure*? 
> > 
> > 
> http://www.amazon.com/Web-Development-Clojure-Build-Bulletproof/dp/1937785645 
> > 
> > There's only one review on amazon, and it's a fantastic review but I'm 
> > wondering if this is the book I should read if I wanted to start using 
> > Clojure for web programming. 
> > 
> > Any advice will be greatly appreciated. 
>
> I'll share my 2c. 
>
> Before picking the book, I already knew some Clojure, but I hadn't used 
> it for web.  The book was a nice overview of some of the "popular" tools 
> for web development in Clojure.  I enjoyed reading it.  In a few cases I 
> felt that I needed to write the example code and play with it in order 
> to truly grok what it is about. 
>
> If you know some Clojure (O'Reilly's Clojure Programming is a great book 
> for that, in my opinion), then it is a perfect follow-up if you're 
> interested in web apps (IMHO). 
>
> -- 
> Stefan Kanev  ¦  @skanev  ¦  http://skanev.com/ 
> You can measure a programmer's perspective by noting his attitude on the 
> continuing vitality of FORTRAN. 
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Database migrations

2014-02-27 Thread Chris Kuttruff
Reginald, clearly late to the game on this thread :)  but figured I'd share 
a project that I created recently ( clj-sql-up ).  It is a leiningen plugin 
that is dead simple to use, and it doesn't try to over-abstract, but it 
also allows for dynamic sql generation since it runs from the context of a 
clojure file.  I think it's simplest option out there for doing database 
migrations with clojure without sacrificing expressiveness

Please let me know if you run into any issues, but should be quite easy to 
get rolling with:
https://github.com/ckuttruff/clj-sql-up


On Friday, June 14, 2013 9:24:39 AM UTC-7, Reginald Choudari wrote:
>
> Hello all,
>
> I am trying to implement database migrations with Clojure. So far I have 
> been looking at Drift (https://github.com/macourtney/drift) as a 
> candidate for implementing this. My question is, does anyone have a 
> database migration workflow that they use and would like to share? One 
> problem I have been thinking is how to tackle database credentials/db name 
> configuration. I know in Rails its common to use a YAML to provide this 
> info, wondering if there was something more idiosyncratic to clojure?
>
> Thanks in advance
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do you recommend the book: "Web Development with Clojure"

2014-02-27 Thread Mark Engelberg
It's worth noting that the new Clojure Cookbook also has a chapter that
goes over the basics of Clojure web development.  If you already are quite
comfortable with Clojure and don't need to see a lot of extended examples,
the Cookbook chapter covers much of the same ground as the Clojure Web
Development book, albeit much more compactly.


On Thu, Feb 27, 2014 at 2:45 PM, Hari Krishnan wrote:

>
> My experience..
>
> 1.  It is a well written book.  You will have to read sequentially.
> 2. Prior knowledge of clojure is required -- list, vector, map, let etc.
> (Or at least review the clojure summary at the back first).
> 3. Since I knew Rails before, a lot of the concepts seemed to be straight
> forward -- routes, handlers (controllers), Urls, Ring (wardern) etc.
> 4. One benefit is you can build a decent web application quickly.
> 5.  The auther is the creator of Luminusweb.  But he doesn't tout that
> framework.  There is only a paragraph at the end.  But if you are going to
> choose that web framework (or libraries), or similar ones such as Joodo,
> reading this book will help get us some low level understanding of all the
> pieces working together.
>
> Worth the investment (imho).
>
>
> On Friday, February 21, 2014 8:43:59 AM UTC-8, Stefan Kanev wrote:
>>
>> On 19/02/14, Erlis Vidal wrote:
>> > Hi all,
>> >
>> > Have any of you read the book *Web Development with Clojure*?
>> >
>> > http://www.amazon.com/Web-Development-Clojure-Build-
>> Bulletproof/dp/1937785645
>> >
>> > There's only one review on amazon, and it's a fantastic review but I'm
>> > wondering if this is the book I should read if I wanted to start using
>> > Clojure for web programming.
>> >
>> > Any advice will be greatly appreciated.
>>
>> I'll share my 2c.
>>
>> Before picking the book, I already knew some Clojure, but I hadn't used
>> it for web.  The book was a nice overview of some of the "popular" tools
>> for web development in Clojure.  I enjoyed reading it.  In a few cases I
>> felt that I needed to write the example code and play with it in order
>> to truly grok what it is about.
>>
>> If you know some Clojure (O'Reilly's Clojure Programming is a great book
>> for that, in my opinion), then it is a perfect follow-up if you're
>> interested in web apps (IMHO).
>>
>> --
>> Stefan Kanev  ¦  @skanev  ¦  http://skanev.com/
>> You can measure a programmer's perspective by noting his attitude on the
>> continuing vitality of FORTRAN.
>>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Image processing

2014-02-27 Thread exel...@gmail.com
Hi Michael,

Got some good results on img processing tests. I got image resizer working 
nice, it was a resource path issue.

However after some side by side testing with graphicmagick, I found imgscalr 
outputs files at a 30% to 50% larger file size. About 30% on larger dimensions, 
50% on thumbnails.

So I've opted for graphicmagick as it processes faster, same quality, much 
smaller static files and v elegant syntax, I've been using it in ruby and 
coldfusion for years. One other thing is it bypasses java, does the buffering 
internally. 

If you have an image processing use case, hope that's helpful for anyone going 
so far as a cdn to scale static assets. Here's a couple syntax examples:

;resize to 300 proportionally
(convert photofile 
  (-antialias) 
  (-resize 300 300) 
  (str (img-path) "/lg_" new-file-name))

; resize to 150 proportionally then crop to a 150 square
(convert photofile 
  (-antialias) 
  (-resize 150 150) 
  (-gravity "Center") 
  (-extent 100 100) photofile)  

photofile is resource path and file name. I'll check into clojure-docs, see if 
I can help out on the web dev section based on my experience last few weeks.

Best,
Pardeep.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Sente - Clojure(Script) + core.async + WebSockets/Ajax

2014-02-27 Thread Peter Taoussanis
Quick addendum: I've had a few folks ask about various security 
implementations.

So first up - as I mention in the REAME, I have had to make some changes to 
the codebase for the public release so I wouldn't quite trust anything 
pre-1.0 in production just yet (there's likely at least minor bugs). Having 
said that, the general model has played out well in practice elsewhere.

A few specifics that have come up:

 * Tools.reader's read-string is used server-side, so arbitrary code 
evaluation isn't an issue.
 * It _is_ possible for the server to receive malformed or hostile requests 
(as it would be via any other protocol). The implementation itself doesn't 
depend on the accuracy of any information provided by the client, but the 
usual security measures will apply server-side for code you write: only 
respond to well-formed requests, ensure users are authenticated+authorised 
where appropriate, etc. Auth stuff is beyond the scope of Sente, but it 
won't do anything to get in your way.
 * Ring session information _is_ made available server-side for all 
requests (including WebSocket requests), so the commonest session-based 
auth methods basically work out-the-box.
 * The client-side user-id *can* be forged, but it isn't used for anything 
that's security sensitive. It's there only as an optimisation to disable 
Ajax long-polling when a user clearly isn't logged in. If someone were to 
fudge the id, the only negative effect would be an the creation of an 
unnecessary long-polling connection that is never used (the server will 
never acknowledge it).
 * HTTPS works seamlessly, even for WebSockets. When the page is served 
over HTTPS, Sente will work over HTTPS.
 * CSRF protection is baked in, but you need to do a few things on your end 
to enable it. A client-side warning will be printed when no CSRF code is 
provided. Recommend checking out the example project for details (it 
includes CSRF protection).

So tl;dr - there's a bit going on, but nothing that's fundamentally 
different from the usual Ring security model. Auth and CSRF are the 
responsibility of the app as usual, but Sente provides hooks in the 
appropriate places to plug in whatever you're using.

Will try update the README later today with the info above.

Hope that helps, happy Friday! :-)

- Peter

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Om: trouble with goog reference

2014-02-27 Thread boz
Hopefully it's helpful. :)

Here's a branch with the completed Basic tutorial. The commit log for the 
branch follows the Basic Tutorial.
https://github.com/christoferjennings/om-start-template/tree/om-0-5-0-tut/samples/om-0-5-0-tut

I still need to relaunch Cider occasionally. Basically every time the HTML 
files changes or the namespace of core.cljs changes. Don't know why.

,chris

On Thursday, February 27, 2014 10:50:03 AM UTC-8, David Nolen wrote:
>
> Many thanks for taking the time to implement & share your solution!
>
> David
>
>
> On Thu, Feb 27, 2014 at 1:40 PM, boz > wrote:
>
>> Hi David, Clifford,
>>
>> I'm pretty sure Clifford is using the Cider version from 
>> Mimmo. 
>> I've got a fork of 
>> itwith updates so 
>> it work with Om 0.5.0 and React 0.9.0 that I've used to get 
>> through the basic tutorial so far. Clifford and I have talked about it 
>> here  and there 
>> is a pull request . 
>>  When using the Cider version the HTML should actually look like this 
>> (using "om_ho.js" to match Clifford's)...
>>
>> 
>>   
>> 
>> http://fb.me/react-0.9.0.js";>
>> 
>>   
>> 
>>
>>
>> I plan to put some examples online asap, hopefully by tomorrow, so other 
>> newbies (like myself) can compare notes. ... One thing that I stumbled on 
>> was that the tutorial shows the whole HTML but really, afaik, the only 
>> change was the id of the div (from "app" to "registry").
>>
>> I'm having a lot of fun working on this stuff, btw. Om is very cool. 
>> Looking forward to getting into the intermediate tutorial with Datomic too 
>> :)
>>
>> ,chris
>>
>> On Thursday, February 27, 2014 6:03:22 AM UTC-8, David Nolen wrote:
>>
>>> Your markup needs to look something like:
>>>
>>> 
>>> http://fb.me/react-0.9.0.js";>
>>> 
>>> 
>>> goog.require("om_ho.core");
>>>
>>> HTH,
>>> David
>>>
>>>
>>> On Thu, Feb 27, 2014 at 6:26 AM, cig  wrote:
>>>
 Hi David

 I tried changing :advanced mode to :whitespace mode. My index.html file 
 looks as follows:

 
   
 
 http://fb.me/react-0.9.0.js";>
 
   
 

 my project.clj file looks as follows:
 (defproject om-ho "0.0.1-SNAPSHOT"
   :description "FIXME: write description"
   :url "http://example.com/FIXME";
   :license {:name "Eclipse Public License - v 1.0"
 :url "http://www.eclipse.org/legal/epl-v10.html";
 :distribution :repo}

   :min-lein-version "2.3.4"

   :source-paths ["src/clj" "src/cljs"]

   :dependencies [[org.clojure/clojure "1.5.1"]
  [org.clojure/clojurescript "0.0-2156"]
  [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
  [om "0.5.0"]
  [com.facebook/react "0.9.0"]]

   :plugins [[lein-cljsbuild "1.0.2"]]

   :hooks [leiningen.cljsbuild]

   :cljsbuild
   {:builds {:om-ho
 {:source-paths ["src/cljs"]
  :compiler
  {:output-to "dev-resources/public/js/om_ho.js"
   :optimizations :none
   :pretty-print false)

 With this setup. Evaluating core.cljs (which is taken directly from 
 your Higher Order Components tutorial) I see the, "XHR finished Loading" 
 events in the browser, which is a good sign, but the only text which 
 renders is, "Registry". I assume this is because of the missing 
 goog.closure lines in the index.html file

 i.e.
 
 goog.require("om_ho.core");

 When I include these two lines I get the same errors that Chris 
 mentioned above.

 Would really appreciate your help.

 Clifford

 On Monday, 24 February 2014 03:22:22 UTC+2, boz wrote:
>
> I'm having trouble with the Om basic tutorial Higher Order 
> Components
>  using 
> emacs and a slightly modified version of https://github.com/magomimm
> o/om-start-template that points to Om 0.5.0 and React 0.9.0.
> My version is https://github.com/christoferjennings/om-start-template
>
> The template doesn't have the goog/base.js out of the box. When I add 
> it, I get a "Uncaught ReferenceError: goog is not defined" (Chrome 
> Version 
> 33.0.1750.117)
>
> Here's the final html (basically the same as in the tutorial.
> 
> 
> 
> http://fb.me/react-0.9.0.js";>
>  t>
>