Re: java gui is flashing

2010-07-25 Thread Isak Hansen
On Sat, Jul 24, 2010 at 3:11 PM, Mate Toth  wrote:
> Hi,
>
> my problem is that during execution my presentation java applet is
> flashing. There are many components which paint to a JPanel using it's
> Graphics (.getGraphics). I think maybe the problem is that I don't
> have any "paint everything now" routine..(I don't know which Java
> routine to use, how I have to synchronize it etc..) Thanks for your
> time and help.
>

Google for "double buffering".


Isak



>
> I've the following code for the gui part (fe stands for "flocking-
> enviroment", I'm making a flocking library):
>
> The main loop:
>
> (defn main [starting-fe]
>  (let [first-fe starting-fe
>        panel (new JPanel)
>        frame (new JFrame)]
>
>    ;; configuring panel
>    (. panel setPreferredSize (new Dimension width height))
>
>    ;; configuring frame
>    (. frame add panel)
>    (. frame pack)
>    (. frame setVisible true)
>
>    (loop [fe first-fe]
>      (draw-fe fe panel)
>      (Thread/sleep 100)
>      (recur ((:update-f fe) fe)
>
>
> Blanking the screen:
>
> (defn blank-panel [panel]
>    (let [g (. panel getGraphics)]
>      (. g setColor (. Color BLACK))
>      (. g fillRect 0 0 width height
>
> At the end every boid drawed by this(called by the draw-fe function):
>
> (defn draw-boid [boid panel]
>    (let [[x0 x1] (:pos boid)]
>      (let [g (. panel getGraphics)]
>        (. g setColor (:color boid))
>        (. g fillRect (- x0 2) (- x1 2) 5 5)
>
> --
> 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 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: Make a loop in a loop

2010-07-07 Thread Isak Hansen
On Wed, Jul 7, 2010 at 5:00 PM, Lars Nilsson  wrote:
>
> Maybe
>
> (doseq [year (range 1999 2010 1)]
>  (doseq [month (range 1 53 1)]
>    (print-data year range)))
>

You could also do this with dotimes instead of doseq. Doesn't matter
for Ns this small, but creating a range just so you have something to
iterate across is a bit wasteful.


Isak



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


Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Isak Hansen

On Wed, Aug 12, 2009 at 7:00 AM, John Harrop wrote:

> A very straightforward version, and 875.36796ms/1 = 8.7536796ns.
> This is on a 2.5GHz machine, so that's only about 22 native instructions per
> iteration. The theoretical minimum is over 1/2 of that:
> Four fmuls
> Three fadds and an fsub
> A floating point comparison
> An integer add and an integer comparison
> A branch back to the start of the loop
> So we're within a factor of 2 of *native* code speeds (nevermind Java) here.

It's not this straightforward. Superscalar CPUs handle multiple
instructions concurrently.

I can't give you concrete numbers on the paralellism of current processors,
but had a lot of fun trying to saturate both pipelines on my first Pentium,
writing i386 assembly ages ago.


Isak

--~--~-~--~~~---~--~~
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: Confusion on Clojure 1.0, compatible clojure-contrib, git-hub, svn, ...

2009-07-29 Thread Isak Hansen

On Mon, Jul 6, 2009 at 9:59 PM, Laurent PETIT wrote:
>
> Hi,
>
> 2009/7/6 Stephen C. Gilardi :
>>
>> On Jul 6, 2009, at 3:13 PM, Tom Emerson wrote:
>>
>> Thanks Paul, for the quick response.
>>
>> On Mon, Jul 6, 2009 at 12:56 PM, Phil Hagelberg wrote:
>>
>> That's right. Side note to folks with commit access: it would be a good
>>
>> idea to check in a note to the deprecated repositories telling people
>>
>> where to go for the latest versions.
>>
>> Or, better, do away with those obsolete repos entirely. But whatever.
>>
>> In the case of SourceForge, they have a strong preference for keeping old
>> repos around. I think it's confusing, but I recall looking into it and
>> finding that was their policy. I'm not sure whether or not Google Code has a
>> similar preference. Some clear, local indication in each repository that
>> marks it as "no longer maintained, see clojure.org for current info" would
>> be a win of course.
>>
>
> I think there could be a way to make both parts happy : rather than
> just adding the info that it is an old repo in some README file in the
> root directory of the svn repo, committing also an svn delete command
> on all the contents of trunk could help clarify this : by default,
> users checking (or updating !) trunk would have an empty working copy
> as a result (and also just the informative README file).
> But tags would still be there, and also the entire repository history,
> as a svn delete is just deleting files in the commited revision, not
> deleting the history (one could retrieve a working copy by just
> emitting svn up -r N-1  where N would be the "deletion" commit.
>

Sounds good.


-Isak

--~--~-~--~~~---~--~~
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: The Path to 1.0

2009-04-18 Thread Isak Hansen

On Thu, Apr 16, 2009 at 6:53 PM, Rich Hickey  wrote:
>
> Feedback welcome,
>

1. I'd like to see a road map of sorts; plans for where Clojure will
be going with the next couple of releases.

2. Clojure-contrib -cleanup
 - Move the clojure test suite to clojure itself
 - Move 'worthy' libraries from contrib to the standard library?
 - Make ClojureCLR and clojurescipt separate projects with their own
branches and so on.

3. I'd like to see the clojure source hooked up to some CI system,
along the lines of .


I know it's not a vote, but I use git as well.


> Rich
>
> >
>

--~--~-~--~~~---~--~~
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
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: Bug in clojure.contrib.lazy-xml: apostrophe not escaped correctly

2009-02-19 Thread Isak Hansen

On Thu, Feb 19, 2009 at 12:20 AM, Stephan Mühlstrasser
 wrote:
>
> Hi,
>
> I believe the following is a bug in clojure.contrib.lazy-xm:
>
> user=> (use 'clojure.contrib.lazy-xml)
> nil
> user=> (emit { :tag :a, :attrs { :b "bloody apostrophe's :-)" }})
> 
> 
> nil
>
> The XML is broken, because the embedded apostrophe in attribute b is
> not replaced with an XML entity.
>

While we're on this subject, I wonder why attribute values are
single-quoted in the first place?

I know it is standards compliant, and won't claim to have vast
experience working with XML, but I've never seen this 'in the wild'.


Regards,
Isak

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