Thursday, September 30, 2010

Tailing Whitespace

Here's how to get rid of trailing whitespace from all your files:
# Strip trailing whitespace from files that end in .as.
# Change this to match your programming language.
# I'm not sure if the -i flag is supported by all OSs.
find . -name '*.as' | xargs sed -i 's/ *$//g'

# See if the changes look reasonable.
git diff

# There should be no changes that aren't whitespace changes.
git diff -w

Wednesday, September 15, 2010

Quotes: A Recruiter on Scala and Erlang Jobs

I got the following from a recruiter today:
Scala (and erlang while we're at it) roles are like UFO's, there are always sightings of them, but I just don't think they're real. :)
That's a pretty funny quote ;) It just reminds me of the fact that jobs are a trailing indicator of a technology's success. For instance, there are currently five jobs for COBOL on Craigslist, which is actually the same as the number of Scala jobs on Craigslist.

Tuesday, September 14, 2010

Quotes: Mark Twain on Math

"In the space of one hundred and seventy-six years the Mississippi has shortened itself two hundred and forty-two miles. Therefore ... in the Old Silurian Period the Mississippi River was upward of one million three hundred thousand miles long ... seven hundred and forty-two years from now the Mississippi will be only a mile and three-quarters long. ... There is something fascinating about science. One gets such wholesome returns of conjecture out of such a trifling investment of fact."
-- Mark Twain

Quotes: Max Levchin on Startups

"The very first company I started failed with a great bang. The second one failed a little bit less, but still failed. The third one, you know, proper failed, but it was kind of okay. I recovered quickly. Number four almost didn’t fail. It still didn’t really feel great, but it did okay. Number five was PayPal."
-- Max Levchin

Saturday, September 11, 2010

Scala: Using Akka with Play

Here's a screencast of using Akka in the context of Play. Akka's motto is, "Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors". The screencast shows how to implement a hit counter using STM (software transactional memory). It's acting as a library within the context of a Play application. That surprises me (in a good way) since I was afraid you'd have to run Akka out of process. The screencast shows how STM is able to maintain correct results under a heavy, concurrent load. It looks pretty painless. There's another screencast showing how to do the same thing with actors, and then another that shows how to do the same thing for a cluster of servers using remote actors.

Java: The Play Framework

I just watched a screencast for the Play framework. It's motto is:
Finally a Java framework made by Web developers. Discover a clean alternative to bloated enterprise Java stacks. Play focuses on developer productivity and targets RESTful architectures.
All I have to say is wow!

I plan on using Play using Scala instead of Java, but nonetheless, I'm completely amazed at how friendly, efficient (to develop), and polished it is. The API looks very much like Rails, and so does the development process. For instance, you just edit files and hit reload. Compile errors are shown directly in the browser, using a beautiful interface. The MVC approach and file layout looks like Rails, however there's an admin interface that looks like Django.

I've heard multiple people say that you can go from not knowing Play at all to having something working to show to your boss in about two days. Best of all, Play has put a lot of effort into its Scala bindings. I hate to sound like a fan boy, but I'm really excited!

Friday, September 10, 2010

Scala: Lift vs. Play! For Web Development

If you're interested in doing Web development in Scala, have a look at my Stack Overflow question and even more importantly this thread that I started on the Bay Area Scala Enthusiasts mailing list.

In it, there are some choice quotes from David Pollak such as:
In terms of Lift and older browsers, Lift doesn't support them (or at least it doesn't support them well.) At the end of the day, in order to use a Lift app, you need a modern browser (IE 6+, Firefox 1.5+ or WebKit-based [Chrome, Safari])...

Put another way, with 99%+ of the apps people are writing in Lift, they will live in a single JVM...

[When I asked whether a user's session (such as the contents of his shopping cart) was lost when new code was deployed to the server because of the statefulness of Lift, David said] Most of the site deployments that I do in production are during well defined maintenance windows in which the entire service is shut down. I realize that there's a class of services for which that's not acceptable, but the vast majority of sites (the bottom 98% or so) are going to be cool with the maintenance window. If that's not acceptable, there will be a commercial Lift Cluster Manager...

As a practical matter, the deployment and crash scenarios that folks raise are premature optimizations because in the real world, nobody notices (or cares to complain) when Lift sessions stop and are restarted elsewhere.
I'm feeling a little down since I was flamed pretty badly in that thread. Obviously, people in the Python world either like or at least tolerate me a lot more than people in the Scala world.

Anyway, my current plan of action is to learn the Play! framework and Akka. Both look very interesting and very polished. I'm hoping to find a job coding in Scala, but since I've ruled out Lift, my prospects are looking even more slim ;)

Thursday, September 09, 2010

Scala: Scala for Newbies Night at Linkedin

There's going to be a Scala for Newbies meeting at Linkedin at 7PM, Monday, September the 13th at Linkedin in Mountain View. Here's the full announcement.

Saturday, September 04, 2010

Personal: I'm a Wireless Black Hole

My wife and I both have Samsung Moment cell phones running Android on Sprint's network. I always complain that I can't get reception in the house, whereas her reception is always fine.

Today, we did an experiment. She had 4 bars on her phone. She passed her phone to me, and it dropped down to 0 bars. I gave it back, and she had 4 bars again. I decided to sit in her seat. I still only got 1 bar.

What the heck? The only thing I can think of is that she's really small, and she's a bit on the anemic side, whereas I'm fairly large and I have an abundance of iron in my blood. Does that even matter?

We just conducted the experiment again, standing next to each other, with the same results. The way we hold the phone doesn't seem to make a difference. We're both barefoot.