with-out-str assumes Unix line ends

2009-08-06 Thread Anniepoo

Sorry for the confusion - I read this list on an email feed. Turns out
replying to a message from there and changing the subject isn't
sufficient to start a new thread. Apparently it renames the thread.
(suboptimal).

original question:
(use 'clojure.contrib.duck-streams)
(spit "C:\\test.txt"
(with-out-str
  (println "foo")
  (println "bar")
  (flush)))
On my XP Tablet OS computer results in a file with unix line endings.
Is this proper behavior?

Mike Hinchey's response:
What does this return on Windows?  (with-out-str (.println
(java.io.PrintWriter. *out*)))

If it's "\r\n", then maybe (newline) should be changed to print
(System/getProperty "line.separator") instead of \newline as it does
now.
Thoughts?
-Mike
===

On XP tablet
user=> (seq (with-out-str (.println (java.io.PrintWriter. *out*
(\return \newline)




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



http-agent

2009-08-12 Thread Anniepoo

using http-agent threw

(#)

notice the spelling error in 'setFixedLenghtSttreamingMode'  (Lenght)

this from the HEAD of trunk as of Aug 11 about 11pm PDT


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Communication: How to model it?

2010-04-14 Thread Anniepoo
what you want is just a stream in each direction.

Bob:  So, how do you feel about the Smith contract?
Fred: It's not a good deal for us

Fred: Do you think we'll have 4 engineers working on it?
Bob: Turn left here
Bob: No, more like 5

Fred: at the light?
Bob: Yes

I'd make a wrapper around a socket connection. If you want an async
call,
like Fred's last question "at the light?"  then have a different send
access that takes two args,
(ask-bob  "at the light?"   (fn [response]  ... handle the
response))

as opposed to
(tell-bob  "blah blah")
that doesn't get a response
(after all, you presumably need to know what question Bob is answering
'yes' to)

ask-bob sends bob an id along with the question, and shoves the
function into a map with id as key
when bob sends a response the function gets called

The recieving end is a good candidate for a multimethod.
the dispatch function would somehow parse the message for type
 and figure out which handler handles it.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: Restricted eval

2010-05-06 Thread Anniepoo
Mibu - I've kind of gone around this track as well.
My first reaction to the 'whitelist' was that it was kind of kludgy,
and fought it for a long time, but after a lot of looking for other
ways, I'm with Licenser, it's the best way to do it.

And yes, you have to disable java interop not because you can't
sandbox java but because it makes a backdoor to allow execution of
arbitrary clojure.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: API for posting multipart/form-data

2010-05-09 Thread Anniepoo
If you're using ring (and you should be!) there's a middleware layer
that handles it

http://mmcgrana.github.com/ring/middleware.multipart-params-api.html

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How do I run a script? This has me stumped.

2010-05-15 Thread Anniepoo
Any reason why you're using -server flag?
Sort of assuming you've checked that the jars you reference are where
you say they are

(println "Howdy I'm working")

would be reasonable file contents.

the batch file might be swallowing your output.



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: roll call of production use?

2009-11-24 Thread Anniepoo
At my workplace (University of Houston, dept. of Health and Human
Performance) Clojure is our primary language for interacting with our
virtual world presence in Second Life.
We have an automated lesson path building system currently in
production, and several other projects in various states.

automated lesson path building system - user (currently it's too
scratchy to turn the profs loose on this, so I always use it) draws a
learning path out in a 2D swing based clojure app. It compiles a set
of 'prims' that fill the needed shapes (a sort of variation on the
knapsack problem, where you also get a small 'rubber' block that can
fill in small spaces, but it's an optimal packing problem), creates
the textures, controls a C# robot (no java libs for that task) to
upload the textures, and sends commands to a robot in-world to do the
actual build.

Nutrition Goggles system - What I should be doing today, if I weren't
noodling around in Clojure  8cD
(OK, in theory the injectable agent system I'm doing today should be
usable for all these projects)
This is a HUD (tool that attaches to the users screen as additional
UI), when they look at a food item in the virtual environment it shows
the nutrition data. They also can enter nutrition data the same way.
Back end in clojure.

Summoner monitor system - I'm supposed to write this, I'd dearly love
to get there, as it's a tool that alerts me
 that I'm needed in world to help a student. (currently I depend on my
email alerter, which is suboptimal)

Configurable teleporting sign system - a web app that lets users set
up teleporters around the campus sim, while retaining some control
over the appearance of the central entry area. Might not end up being
in clojure, I might do this totally in world.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Atomic reloads and snapshots of namespaces

2009-11-26 Thread Anniepoo
I would appreciate, in a similar vein, an amplification of the "Use
with caution" advice in the api docs for remove-ns.  I'd like to use
remove-ns but am reluctant to architect a system around a function
marked 'use with caution'

(remove-ns sym)
Removes the namespace named by the symbol. Use with caution. Cannot be
used to remove the clojure namespace.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Parenthesis Inference

2009-12-18 Thread Anniepoo
  I read this and think of Roedy Green's essay on source code in
database, http://mindprod.com/project/scid.html and on Knuth's
'literate programming'  - the idea that source code is inherently not
it's representation (it's the reader output that's homoiconic, not the
file representation on disk) and that there might be several
representations.
  Reading Roedy Green's essay I think of how obsolete it sounds after
refactoring IDE's came around. Let me suggest that this is a great
idea, but one that should be part of some clojure-centric IDE, not a
part of the language.

It seems barking up the wrong tree to think that clojure will find
more acceptance if we find some method of reducing the number of
parens involved.
What's hostile to most programmers is that Clojure demands a lot more
thinking per line of code. I remember when OO came in, and then when
design patterns came in - each decreased the amount of thinking about
code and increased the amount of typing.
After all, the same java programmers who are frightened by Clojure are
happily reading nested structures in XML all the time.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clj-peg v0.6 released

2010-01-04 Thread Anniepoo
Sweet!

Wish I'd had this a few days ago, I just spent the last few days
writing parsers.



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why I have chosen not to employ clojure

2010-03-21 Thread Anniepoo
It certainly does seem strange coming from the Java world, where ear
files and deployment descriptors can be intimidating. The idea that
adding a couple jar files and the source tree to
the classpath is 'too hard' makes me wonder what language he was
coming from.

I was asked to give a simple 'hands on clojure' thing at a Java users
group. I wanted to spend
minimal time on environment setup, so I had these java developers put
the jars and my starter script in a directory, cd into it, and add .
to the classpath.
Out of the room of programmers I had one person have trouble getting
the starter project to come up pretty much immediately, and whatever
his issue was I fixed it in a few seconds.

For the record, I downloaded and installed Rebol - took about the same
time to get to where I was fiddling with code and not environment as
it did when I started clojure.
I was puzzled which version to download and had to figure out there
was a free version (under 15 sec)
828K download.
found a reasonable tutorial immediately, got my first language smell
when I discovered that they wanted me to use a built-in editor,
quickly got over that when they said most rebol programmers use an
external editor.

Learning curve - far fewer 'strange' concepts than clojure, I came up
pretty fast, but it definitely has a toy language feel. I'm guessing
it'd be a lot like programming in visual basic - quick til you need to
do something 'off the rails' like handle a UDP stream, then hellish.
Looks like another attempt to make an ultra-friendly language at the
expense of power - a 'solution' that usually doesn't get you too far.

deployment - ok, so rebol looks bad to deploy. You have to install a
runtime and give out the source, both probably not very enterprise-
solution oriented sysadmin friendly. And the server side example uses
CGI, which doesn't pass the smell test.

Conclusion -
rebol actually might be a reasonable solution for a project I'm
talking to the biz guy about. It'd involve a whole bunch of objects in
a virtual world that need controlled from some web other end. Rebol
has deployment problems, I'll agree, but don't see them as relevant to
Clojure.

I think our friend's off base.



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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


Re: Logic programming in Clojure

2010-03-23 Thread Anniepoo
As well as optimizing compilers, there are many knowledge bases
available for prolog. Most people with a practical application that
needs an expert system are probably far more invested in that
knowledge base (the prolog code is a 'knowledge base') than in
anything else.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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


Re: concurrency and rand-int

2010-03-25 Thread Anniepoo
As for the problems debugging code that calls nextInt,  call setSeed
with an arbitrary number at startup.
After setting setSeed the sequence of ints returned will be the same
every run.
You may have trouble if you don't have any synchronization between
threads.
It could still have race conditions for the nth nextInt call.
But otherwise, run it and see which of two conditions you have. Record
the number you seeded with,
change the number and run repeatedly until you get the other
condition. You now have a way to switch between
the two conditions at will.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

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