Johnny's Software Saloon

Weblog where I discuss things that really interest me. Things like Java software development, Ruby, Ruby on Rails, Macintosh software, Cocoa, Eclipse IDE, OOP, content management, XML technologies, CSS and XSLT document styling, artificial intelligence, standard document formats, and cool non-computing technologies.

My Photo
Name:
Location: Germantown, Maryland, United States

I like writing software, listening to music (mostly country and rock but a little of everything), walking around outside, reading (when I have the time), relaxing in front of my TV watching my TiVo, playing with my cat, and riding around in my hybrid gas/electric car.

Wednesday, August 17, 2005

Bruce Eckel's MindView, Inc: 10-22-04 Using Function Objects as Strategies

Bruce Eckel's MindView, Inc: 10-22-04 Using Function Objects as Strategies

Bruce Eckel wrote a nice implementation of the old C++ trick called "expression templates" in Java 1.5. It was a decent, and even type-safe, implementation of functional programming using the new generics feature of the language.



However, it took a whole page of source code.



On the comments page for his blog entry, I did a program that did the exact same thing as his example program in just three lines of Python!




>>> def compute(low_boundary, values):
... return reduce(lambda x,y: x*y, filter(lambda low_bound:low_bound>low_boundary, values))
...
>>> compute(4, [1, 2, 3, 4, 5, 6, 7])
210


Which would you rather type on - a page of code or 3 lines?

Saturday, August 13, 2005

Ready, Set, Breakfast!

Ready, Set, Breakfast!

It's 11:22 p.m. and I haven't had breakfast yet. And no, I didn't drink any coffee either. I did have some tea last night though.



That's freaking post meridian time! Not morning - night! Yikes, midnight almost.



I did stay up at work kind of late. Which reminds me, I have a little practicing and studying to do. Maybe I will grab a sandwhich first.



Lately, I have been trying to eat less processed starchy foods. Did pretty well for a couple weeks but last night I did have a couple pieces of junk food - though during the day I ate pretty well.



Perhaps I should read this breakfast nutrition page I seem to have stumbled upon....

Dido Live

Dido Live

There are some really great music videos of Dido performing some of her best songs at this Dido Live site. My favorite is Here With Me. It sounds so cool and it was the theme song of the Roswell TV series that I really got into when it was on a few years ago.



I really like the White Flag song a lot too, from her new album.



Give it a listen and a view, if your bored. I am sure it will improve your mood.



It's a little melancholy sounding. But, in a happy, upbeat way. :-)



By the way, I bought both her CDs and a DVD of one or two of her music videos. So I am not a total moocher!


Related pages & news