Sunday, June 07, 2009

Ballpark art

While at the ballgame we met up some of Shira's family. Check out the excellent work Rebecca and Max created on my G1.

As always, I only had to point them in the vaguest of directions and they figured out the whole drawing thing in no time.

Perfect day for a ball game

The sun is shining, we got great seats and are on the hunt for Kosher hot dogs. What more could one ask from a Sunday at the ballpark?

An Apple A Day...

What?! A guy can't have apples for breakfast?

Thanks to my mother-in-law for all the delicious treats, including this breakfast-apple flavored health food.

Test: video and blogging by email

Did this 4 second video I recorded and e-mailed to blogger get published

Update: Holy smokes, it worked! You can shoot video on the G1 and mail it into blogger and it renders it properly. Perhaps this is a replacement for 12seconds.tv as it publishes right to the blog?

Friday, June 05, 2009

Smallest. Harvest. Ever.

Our strawberries planting experiment is actually yielding fruit. True, we're getting about 1 strawberry every 3 days - but they are there. And tasty. Our tomato experiment hasn't produced anything edible yet, though it has grown pretty well.

It's amazing what throwing some dirt into a planter along with a couple of strawberry/tomato plants will do.

I love gardening in ignorance. With such low expectations, it's easy to be surprised.

Thursday, June 04, 2009

In Support Of Multiple Return Values

Lately I've been working on a gambling app for a client (fun stuff!) and I find myself making pretty heavy use of multiple return values. Here's an example:

 (define (deal deck count)
   ...
   (values the-dealt-cards the-updated-deck))

In this case, I've got a nice and functional interface for dealing cards - send in a deck and the number of cards I want dealt and get back the cards and the updated deck. This makes for plenty of let-values but I'm not finding them too clunky. For example:

  (define (play ...)
   (let-values ([(player1 deck) (deal deck 5)])
     (let-values ([player2 deck) (deal deck 5)])
       ;; player 1 & 2 both have 5 cards and our deck has 10 fewer cards
       ...)))

The multiple values approach seems to work well here, as it avoids me having to come up with a structure to describe the result or use a list. In either case, I don't have to worry about destructuring the results later on.

What do you think? Should I be considering an alternate approach than values?

I was going to lament the lack of multiple return values in other languages, but, PHP kinda sorta handles it somewhat gracefully. You can say:

  function deal($deck, $count) {
    ...magic...
    return array($the_cards, $the_updated_deck);
  }

  list($cards, $deck) = deal($deck, 10);

Not great, but at least list makes it easy to get a hold of the multiple values.

I'm not sure I'd want to try this in Java though...

The New Look Explained

It was time. The blog needed a refresh in look. If I saw that ugly yellow'ish color one more time...

And more importantly than that, I wanted to upgrade to the new (now quite old, actually) Blogger layout system that allows me to plug in widgets easily. This should make adding to the site easy(ier) in the future.

So why stick with Blogger? I still believe that Blogger provides the best ratio of features (your own custom domain name, e-mail to blogging capability, etc.) to simplicity in use. That simplicity is key, as one of my goals of this blog is for it to be repeatable by even the most novice of users. That is, if you want to start publishing content, this blog should serve as an example of how easy it is to do just that.

That's not to say Blogger is perfect. Why the heck do they still have the same 9'ish templates they've always had? I mean really, you can't come up with 3 new ones a month or something? I guess I should just Google around for templates and use one from a 3rd party site.

And what the heck's up with not having a way to search through the thousands of widgets you guys have? You do recall that you're owned by Google, the pros at search? [D'oh, I totally missed the little search box at the top of the Gadget popup. Of course, you can search.]

But enough complaining - the upgrade in look was easy to do and now future changes should be a breeze. And besides, what do you want for free?

Wednesday, June 03, 2009

A Weather Man I'm Not

To go for a run, or not to go for a run? I checked weather.com, and while they were calling for rain, my reading of the radar was that it wasn't going to hit till 10pm tonight. I had plenty of time.

I even had the thought, as I was running, that with the technology getting so good we won't even need weather people.

And of course, I was totally wrong. A few minutes after I finished my run, the sky opened up and we had this:


Arlington Rain on 12seconds.tv

Take Weather Man off my list of natural abilities. That's what I get for backcasting.

Husband In Chief

Allow me to put my marriage counselor / national psychologist hat on for a second...

So the Obama date night is raising some crticism. And while some of it may be deserved, I keep having this thought: I really like that he took his wife out on date night.

There's so much talk in Washington about family values, sanctity of marriage, who's having an affair with who, blah, blah, blah. To me, this kind of public act of showing a strong marital relationship, represents an excellent example and sends a powerful message.

I'd like to believe that I'd be impressed with this stunt regardless of the party in power. I'm pro showing your wife a good time.

Oh, and for the record, Bush made 77 trips, at a cost $226,072 each. So, what are the Obama's going to do for the next 76 date nights?

Site Of The Day: SimpleCDN

In my quest to do some performance improvements to a site, I decided to bring in a Content Delivery Network. A CDN is a simple concept, in that you can offload your content to a 3rd party, and let them worry about managing all the servers doing the work.

It didn't take me long to figure out that the cost of working with a CDN can be pretty hefty. In a lot of cases, there's good reason for this - the company needs to host a large number of geographically diverse servers. But for my needs, this was overkill. I just wanted a service who would promise to deliver images, stylesheets and other static content - I really didn't care how sophisticated they were about it.

While poking around, I stumbled on SimpleCDN. Wow, these guys are nearly the exact opposite of the big guys Akama. Consider:

  • There's no need to go through multiple levels of sales to get a price tag, the prices are spelled out right on the website
  • Setup is instant - just sign up, create a new content bucket, and you're off and running
  • The pricing is nothing short of amazing - $0.039 cents per gigabyte if you use their Lightning plan. That means that if you serve up 100Gig of data in a month, you'll be paying a little under four bucks for a CDN. Tell that price to Akamai, and they'll laugh.
  • There's no commitment of any kind and they provide you with $15.00 in your account to experiment with. This is a surprisingly generous amount of budget to start with, it would probably be enough to keep a small site going for half a year or even longer.

I made use of their online sales support and found the representative helpful.

Clearly, at such rock bottom prices, there have to be limits to the SimpleCDN service. It's certainly not a replacement for the big guys out there. But, if you're experimenting with dropping a CDN in place, or you need one for a problem you're having Right This Second, they are hard to beat.

Tuesday, June 02, 2009

Feeling Welcome At Temple Beth Shalom Of Long Beach

Perhaps what's most remarkable about my experience visiting Temple Beth Shalom of Long Beach is just how unremarkable it was. For this last holiday of Shavuot I was out of town, and wanted to make sure I went to temple. A quick Google Search and I found Temple Beth Shalom.

I thought about giving them a call, but I realized I had nothing to ask. I knew the service start time and their address, what else was there to know?

So, using Google's walking directions (an essential resource for those who don't drive on Shabbat and Yom Tov), I found my way to the shul. And of course, everything went great - the service and welcome were exactly what I would have expected from my own shul. And of course, after just a few minutes of talking, I realized that we had friends in common.

And so there you have it, I was able to go to the complete other side of the country and yet feel right at home. That's the norm when going from shul to shul, but still, that's pretty dang impressive, right?

If you do make it to Beth Shalom, say that Ben from Washington, DC sent you.

India Through First Time Visitors' Eyes

Ever curious about what it would be like to visit India? And I'm not talking some sanitized tour, but really get around and see the country?

If so, you should check out our friend's Lauren and Nick's blog. They are currently traveling in India, and doing an excellent job of blogging their experience.

Hey, even if you aren't interested in visiting India - check out what they have to say, they might just change your mind.

Ahhh, armchair travel - all the adventure, none of the jet lag.

Monday, June 01, 2009

Multiple Gmail Accounts On The G1 - And how to Keep your sanity

When you setup your G1/Android phone you have to enter a Gmail address. This gives you seamless access to your Google Account.

But what if you have two Gmail accounts? I've got my business Google Apps account and my person @gmail address.

I found the business apps account integrated perfectly. But when I plugged my Gmail address into the mail client, it was a disaster - mail never seemed to be delivered reliably, and my inbox was a mess. Plus, I had now way to cleanup the hundreds of messages that got downloaded unintentionally.

How ironic was it that my Google phone made reading my Gmail mail nearly impossible, while my Sidekick did fine with it.

Then, while poking around the phone checking out Cupcake changes it hit me. Why aren't I using imap support with gmail and the e-mail app?

Out of force of habit, I had selected POP settings when I setup my @gmail address. That was a definite mistake - POP wants to slurp down my e-mail into the handset. A bad idea.

Imap on the other hand allows the phone to act as a portal into my Gmail account. Changes made in the account show up on the handset, and vice versa.

The system isn't as flawless as the custom Gmail app, but it's a night and day difference. All of a sudden, my e-mail is managable and in sync in both the phone and on the web.

Do yourself a favor - when using multiple Gmail accounts on your phne, use imap. You'll be amazed at how well it can work.

The Joy Of The Red Eye

G'night all - when we wake up, we'll be on the other side of the country. Assuming we get to sleep in the first place.

Ahhh, I love air travel.

I've Been Cupcake'd

I got a treat today - my Android G1 picked up the latest software update, Cupcake (1.5).

My first reaction was that not much had changed after a reboot. But, after going into the settings section on the home screen, I was able to enable cool features of the on screen keyboard and turn on the auto flip of the screen based on the phone orientation. I've also noticed that the UI is a bit more polished.

The video capability that was promised seems to work OK. I was psyched to learn that the e-mail submission to 12seconds.tv works smoothly. This means that I can use this clever little service. Publishing directly to youtube.com also works, which is a plus.

There are other goodies too - for example, the e-mail client allows you to operate on multiple messages at the same time. I'm sure there are other handy features too that I'll stumble upon as I go along.

All in all, it's a good day to be a G1 user.

Submarning With Mike

This evening, our buddy Mike met us in Long Beach to hang out. It's been over a year since we saw him, but it felt just like old times. Mike knew a bit about Long Beach, so he took us down to where the Queen Mary is docked and we had a most excellent walk around.

While we didn't go on the QM, we did tour the Russian Sub, Scorpion that was docked next to it. Naturally, I was impressed. Perhaps what was most remarkable with this cramped and stark boat was that it was built in the 1970's, not the late 1940's that it felt like. Russian submariners must have been tough as nails. 78 men, 3 toilets, 2 showers - you do the math.

Below are some photos from our little adventure.

Finally, I couldn't resist playing with my new found video capability on my cell phone. Here's a 12seconds.tv clip of the Long Beach area:


View From Long Beach on 12seconds.tv

Thursday, May 28, 2009

Going Out For Lunch. Way Out.

You could say that Shira and I went out for lunch today. Way out. Like, to the other side of the country out.

We're in Long Beach, CA - and as you might guess from the photos, the weather is perfect. I think I could get used to this...

5½ Strategies For Coming Up With Fresh Ideas

I found this article on coming up with fresh ideas to be an excellent read. I definitely liked the discussion about organizing your thoughts before bed and solving problems in your sleep - I've had good success doing this.

The article lists 5 approaches - you may be wondering where the ½ part comes from. Well, I'd like to submit an approach I've been using of late. I'm not quite sure how solidified it is yet, so I'll only count it as ½ a suggestion.

Here's what you do:

Pick a problem you'd like to solve, and ahead of time, commit to coming up with a fixed number of solutions (say, 3 for example).

Now, work through the problem and develop the ideal solution. Once you're done crafting this solution, you should feel like you've found The One True solution.

Now, throw this idea out. Banish it from the list of possibilities. Assume that it's a complete failure. Now develop another solution. If you've done the first part right, this should be hard to do. After all, you found the True Solution, why do you need to come up with another? But that's where the fun begins - you've got to develop a second solution that solves the problem completely differently than the first.

Keep doing this process of coming up with the perfect solution and throwing it out, till you've reached your goal number of solutions.

Now, put all the solutions back on the table and marvel at the novel ideas you've come up with.

There's probably a sexy name for this technique and I can't imagine I'm the first to employ it - but it sure does seem to be useful.

Wednesday, May 27, 2009

Books that make you go Hmmm...

Here are two books that I've stumbled across lately, and have been impressed with. I'd recommend checking them out if you have a chance.

Happiness by Rabbi Zelig Pliskin

Every since I read Finding Flow, I've been especially conscious about how being happy is a mental state, not merely a physical one. As such, it's far more useful to hack your brain to be happy, rather than say, try to accumulate lots of crap in the hope that the result will be a happier you.

Happiness, it turns out, is a nice little book to help in this effort. The book is organized as a series of short, readable chapters. Each chapter essentially provides a mind hack or strategy for being happy.

The book is written by a Rabbi and definitely makes reference to spirituality and The Creator. However, to me, the messages came across as universal, with the content being equally useful to Jews and non-Jews alike.

Perhaps the best part of the book is that it's so easy to experiment with. You just need to adopt a recommendation or two for a few days, and see if you like the outcome. Hey, it's way cheaper than buying a sports car or the latest Mac laptop.

Window Seat, Reading the Landscape From The Air by Gregory Dicum

Window Seat caught my eye as I was looking through the travel books at the library. The book is designed to brought along on your next flight and used to give you some appreciation for what you're flying over. The book is a fun mix of history, geography, geology and random facts. You also get an education as to how to interpret and aerial scene from 30,000 feet.

I like all of this. But, what I really like was the notion the author laid out in the intro of the book:

Taking a commercial passenger flight is one of the unheralded joys of life in the modern world. The food might be utilitarian, the seat cramped and your neighbor annoying, but the sheer pleasure of contemplating our planet from 30,000 feet in the air is worth any price. A century ago, nobody on Earth could have hoped to see this view, and it's yours-free-with every flight you take.

What an excellent point. How often do we have remarkable, even miraculous, scenery and events around us, yet we effective phase them out. Well, I for one, will try a little harder to appreciate the incredible opportunity to play planetary explorer, rather than kvetch about how little leg room I have.

Amazon Wish Lists Go Universal

You Need A Wish List

A wish list is a series of items you are interested in, and if friends and family bought them for you, you'd be overjoyed. Think wedding registry, but without the wedding part.

If you don't have wish list setup, then it's time to make one. And if you've got kids, then it's absolutely time they made theirs. Why do you need a wish list? Lots of reasons...

  1. People want to buy you stuff. They want to buy you stuff you want to have. Why the heck not make this easy on them? Give them a handy list of items that they know exactly what they can buy you to make you happy.
  2. A wish list will insure you'll get the exact model of gadget, or edition of book you want. Really, why make people guess if you want a 1GB or 10GB music player?
  3. A wish list will signal to people what you're interested in. Have a wish list full of photography items, excellent, people know it's safe to buy you photography stuff. This is especially important for kids - fill up your wish list with Legos, and your uncle will know that Legos are a safe buy, rather than say, Barbi like he stereotypically thought.
  4. A wish list can be a useful way to manage your impulse buying. While I don't claim to understand the psychology of why it works, for myself, adding an item to my wish list gives my brain a chance to stop dwelling on the purchase. This often saves me from making the purchase altogether. It's as I've done the research, picked exactly the item I want and can now step away from the whole process. If I still want the item a few days or weeks later, I'll go ahead and buy it.
  5. It resolves the "What do you want for your Birthday/Christmas/Purim?" question. My usual answer to this is "Nothing," which as I said above, doesn't do anyone any good. Even if I did have an answer, how would I know that I was suggesting items in the price range this person wants to buy? A well stocked wish list, with cheap books to fancy electronics, and everything in between is the perfect solution.

Amazon's Wish List Improvement

I've traditionally kept my wish list at Amazon. And for the most part, I've been happy about this. Amazon carries just about every item on the planet and is a reliable place to buy stuff. However, occasionally, I'd come across an item that I couldn't find on Amazon. This usually meant that I had to keep it off the Wish List.

Not any more - Amazon has added the ability to add any item on the web to your wish list. This Universal Wish List capability is drop dead simple - you just click a Bookmarklet on a page, and a window pops up asking you to confirm/fill in details about the item shown. You do so, click OK, and poof, it's now on your wish list.

Other sites have had this capability for quite some time, so Amazon is definitely lagging behind here. But, to their credit, they've caught up.

So go, create a wish list and start adding to it. You might actually enjoy getting the things you really want.

SnapPhoto - Doing it's part to improve the G1's camera

I have lots of things I like about my G1. It's a fantastic phone - but it has one major flaw: the camera is awful.

I know, I know, I shouldn't be depending on a cell phone camera for quality. Why not? The wifi and GPS work great. The web browsing is quite powerful. The camera is a 3+ megapixel camera, why can't it behave like one?

And here's the part that really gets me - Shira's Blackerry's camera does wondefully. Even the flash works well on it. Low light, inside, outside, whatever, it takes perfectly reasonable photos.

The G1, under perfect lighting does OK. But that lighting can't be outdoors, too low, etc. or you end up with junk.

My buddy Nick suggested a solution: buy the SnapPhotoPro app. Boy, was he right. Best 99 cents I've ever spent.

This app gives the G1's camera a fighting chance. You can tweak the color balance and color levels of the photos, which is huge. It also has better shutter control - at times, I find it frustrating just getting the built it camera to snap a photo. Any photo.

If you use the camera on the G1 you need this app.

Perhaps the next software upgrade, Cupcake, will fix all these issues. Though, I'm not optimistic. In the mean time, I'm going to continue to play with SnapPhoto and hope for the best.

Tuesday, May 26, 2009

The Map The Fallen Project

While technically no longer Memorial Day, it still seems quite appropriate to share this remarkable project: Map The Fallen. Map The Fallen is an attempt to collate data about casualties in Iraq and Afghanistan, and render them on Google Earth.

It's an impressive project and points to a variety of sites that provide this casualty data in other forms. I found Washington Post's Faces Of The Fallen project to be especially powerful.

Take some time and review these sites - it's so easy to look at these wars as statistics, when they are really made up of remarkable human loss. These sites do their part to help you appreciate that.

I'd like to send out a profound thanks to all those who have serve and sacrifice for our country.

Sunday, May 24, 2009

Riding The Duck

Tonight we had a real treat - we took a Duck Tour of Boston. A Duck Tour makes use of a WWII DUKW amphibious vehicle, which means we did a tour of the streets and then took a dip on the Charles river.

The tour was a good way to get an overview of the sites of Boson. Now, I can't wait to come back and check out some of the highlights I saw.

Chana and I even got to drive the Duck when it was out in open water. We were just two kids, having a great time.

A Walk Through Arnold Arboretum

The twins got their first trip to an arboretum today - and it was a wonderful one at that. I typed in my sister-in-law's address into Google Maps and zoomed out till I found an interesting landmark. That landmark was Arnold Arboretum. It's part of Harvard University, but we won't hold that against it.

The arboretum provided a nice main road and even some well groomed trails that the stroller was able to tackle. All the trees provided plenty of nice shade. If you're in the area, I definitely recommend you stop by and take a walk.

We finished off the adventure with a fresh round of diapers, a feeding and a rousing reading of One Fish Two Fish Red Fish Blue Fish - everyone had a great time.

Bye, bye manhood

Me, Chana and a baby sling.

I feel like such a liberated man.

The things I do for family!

Friday, May 22, 2009

A Long Weekend With The Twins

Shira and I are delighted that we were able to get up here for the long weekend to spend it with The Twins. Oh, and we're happy to see Shira's Mom, Sister and Shmuel, too.

We took a 6:00am flight to Boston, so we were able to spend the day playing uncle and aunt. As expected, we've had tons of fun - we took the kids for a walk (we walked, they slept), rocked out to Groove Salad and I even read Chana my first bedtime story. For the record, it was Where The Wild Things Are, and technically, she wasn't ready for bed. But we still had a good time.

And of course, there's photos. Lots and lots of photos - here are some of the highlights:

Cool Wordpress Plugin: Draw Comments

I'm not sure why you need it, but the Draw Comments plugin is too cool not to mention. The idea is that along with a textual comment, you can also leave a drawing.

Neat, eh?

Perhaps you could use this as a little whiteboard for each comment? Regardless, it's clever, and is a good demonstration as to how flexible WordPress plugins can be.

Chiming in on the MIT Scheme to Python Switch

So, by now you've no doubt heard - MIT is moving from Scheme to Python for their intro CS courses. I can't help but weigh in on the discussion.

I find the first part of the explanation rather puzzling. According to the post, the old way of writing the software was like so:

In 1980, computer engineering was based on starting with clearly-defined things (primitives or small programs) and using them to build larger things that ended up being clearly-defined. Composition of these fragments was the name of the game.

And the new way of writing software is described as:

However, nowadays, a real engineer is given a big software library, with a 300-page manual that’s full of errors. He’s also given a robot, whose exact behavior is extremely hard to characterize (what happens when a wheel slips?). The engineer must learn to perform scientific experiments to find out how the software and hardware actually work, at least enough to accomplish the job at hand.

Huh? Now perhaps I'm not a real engineer, so my experience doesn't apply. But, how exactly do you write software if you don't start with small working primitives (like unit tested classes, PLT scheme modules, or a PHP library script)? Isn't taking a complex problem and breaking it down into testable/reliable chunks a fundamental principal of writing software?

And yes, nowadays a programmer does typically start with a large API. But I'd hardly say that they are "full of errors." Sure, there may be some issues with the Google Finance API or JDK, but I'd hardly say that the main issue a programmer has is these errors. And besides, thanks to Forum Effect - any issue you have has most likely already been discussed on a forum somewhere, and is just a Google search away.

And yes, it's critical that a programmer learns to run little experiments - but that process is essentially debugging and has certainly been required since the 1980's, if not since the days of ENIAC.

The explanation continues to be a little whacky to me:

The new approach also has the big advantage that it combines computer science with electrical engineering, whereas the old one taught them as entirely separate disciplines. This way, students see how they interrelate.

Again, huh? How is computer science interrelated with electrical engineering? Computer science, to me, is the study of problem solving - not electricity whizzing through CPUs and RAM.

And finally we arrive at the point in the argument that I can appreciate:

There is extensive lab work, making robots and mobile applications.

Aha! By mixing EE and CS, you've put yourself in a position where you can program some hardware - the result is that you're doing something fun, like programming a robot. Instead of doing boring math, you're doing fun robotics.

The Ideal Education

If you ask me (and certainly, nobody in their right mind would), your ideal intro CS eduction should try to balance two competing goals:

  1. Make programming fun/relevant so folks will want to put up with the pain of learning how to do it well.

  2. Teach as many good habits, and as few bad habits in the process

MIT, it seems to me, has solved at least part of the above equation. They're doing fun lab work instead of traditional (read: boring) programming. I'm not sure why they think they need to justify the fun by associating it with EE, when you could easily mix programming with finance, music, biology or any other discipline. But hey, robots are cool. Along with the fun, I suppose you can learn good style with Python, so perhaps they have the second point nailed too.

The best example of teaching programming that I've seen to date is Moby Scheme + Project Bootstrap.

They accomplish goal #1 above by targeting the Android phone platform. Students can write games and apps that make use of the phone's GPS, accelerometer and networking capability among other items. Definitely no boring code here.

They accomplish goal #2 by using a modified version of the Scheme language known as the Beginning Student Language. Because of the rules of the language, students end up with small, easily testable procedures. This starts students down the path of learning important lessons about modularity and debugging, and avoids dependence on global variables or other habits to be unlearned later.

The Moby Scheme project is still in its infancy - but I think the team is really on to something.

So, you heard it here first: MIT went from Scheme to Python, and in a couple of years, will be back to Scheme.

Two Local Businesses That Deserve Another Shout Out

I've blogged about both these businesses before - but I continue to be so impressed by them, I can't help but mention them again.

Handy Ben

Handy Ben is guy / small business that does our landscaping and other odd jobs around the house (like the gutters). He's exactly what you'd want in a landscaper / handyman: proactive, reliable, does a wonderful job, and leaves the whole yard cleaner than when he found it. Oh, and he's affordable too.

I love that I get to support the little guy, rather than some big lawn company. If you need your lawn mowed, or other stuff around the house - give Ben a call 202-413-9292 or drop him a note at handyben@yahoo.com.

Flour Power Desserts

One of my birthday gifts was a selection of desserts by Flour Power Desserts. They're made with all Kosher ingredients, and the ones Shira got for me didn't have have any dairy products in them - so they were the perfect ending to a yummy meat meal. We bought enough of a selection that we decided to freeze a bunch of them before they went bad.

Over the last couple weeks, I'd occasionally go into the freezer, pull out a treat, and get to enjoy a little birthday happiness all over again.

Last night, when I went to pull out one of the last Woopie pies, I noticed it wasn't where I thought I had left it. I dug around, and sure enough, it was in the freezer. And still, it tasted delish.

This morning, I commented on the misplaced morsel - and wouldn't you know it, Shira specifically hid it from me so she could get to it first?

So there you have it, desserts so good, your own wife will hide them from you in the interest of getting first dibs. If that's not an endorsement for how good the food is, then I don't know what is!

Check out their website and give them a call at 240-426-7154 today - you're sure to be glad you did. Who knew supporting local small businesses could taste so good?

Thursday, May 21, 2009

Warming Up To log4j - Actually giving it a chance

The other day, I couldn't resist blurting out the following Facebook status:

Ben Simon is wondering if it's time to blog, yet again, about how much he dislikes logging in code? Yuck. Exactly how is a 42Meg log file going to help me solve anything?

As you may or may not know, I'm not a fan of logging. In past experiences, I've found it clutters the code, never seems to have quite the right info I need for debugging, is too loud on matters I don't care about and silent on matters I'm interested in. And then there's my favorite, when the log message is out of date and says one thing, but the code does another.

But enough about kvetching about logging - that's not the point of this post. The point of this post is that I've actually gotten some value from Log4j on a new project I'm working on. And I'd like to (a) celebrate (whoo!) and (b) document what I did so that perhaps future logging-cynics can get some value from this.

The Setup

In this particular case, I'm trying to debug a fairly large system (about 1000 Java files). The files have pretty extensive logging in them, though they suffer from the issues mentioned above.

If I turned on all the logging I ended up with a 42Meg log file that had so much chatter in it that meant nothing to me. If I turned off all the logging, I saw critical exceptions, but was left scratching my head wondering what the app was doing.

Finally, after I don't know how many years, I decided it was time to embrace Log4j and get a tiny bit fancy. I wrote up the following logging.properties:

# Setup the log handlers, which will be configured below
handlers=1con.java.util.logging.ConsoleHandler,2fh.java.util.logging.FileHandler

# Set the default logging level to SEVERE. In other words, by default,
# I only want to see the most urgent of messages.
.level=SEVERE

# Configure the logging to the screen. Set `level' to FINE to essentially
# catch all messages that are logged. But remember, above we set the 
# level to .SEVERE, so there shouldn't be anything to log
1con.java.util.logging.ConsoleHandler.level=FINE
1con.java.util.logging.ConsoleHandler.formatter=org.x4juli.formatter.PatternFormatter
1con.org.x4juli.formatter.PatternFormatter.pattern=[%t] - %d{MM/dd/yyyy HH:mm:ss} [%c{1}] %p: %m%n%throwable


# Same as above, but with logging turned on 
2fh.java.util.logging.FileHandler.level=FINE
2fh.java.util.logging.FileHandler.formatter=org.x4juli.formatter.PatternFormatter
2fh.org.x4juli.formatter.PatternFormatter.pattern=[%t] - %d{MM/dd/yyyy HH:mm:ss} [%c{1}] %p: %m%n%throwable
2fh.java.util.logging.FileHandler.pattern=output.log
2fh.java.util.logging.FileHandler.append=true

At this point, you've got a logging configuration which only generates the SEVERE messages. You also have log handlers ready to log any messages that are actually generated.

Now I got a little bit tricky. I'd find a class that I thought was central to the process I was studying and add the following to my logging.properties file:

com.foo.MailSender.level=INFO

Now when I run the system, I get a bunch of log messages - but they are ones that I actually have a chance of being interested in.

I also found that I can easily monitor a bunch of related objects, just by tweaking the logging at the package level. Consider this logging.properties change:

com.foo.mail.handlers.level=INFO

Thanks to the log messages in place and the structure of the code - the above tricks actually produce useful output. I do find myself using my programmer's scratchpad to write little scripts to parse the log file, but even without these scripts, the right level of logging makes all the difference.

Perhaps the real lesson I've learned about Log4j is that it works best when you use it in an iterative fashion. Turn on some logging, run the app, see what you can learn. As your needs change, tweak the logging configuration some more. It's not about finding the ultimate logging settings and never touching things again.

So there you have it, I'm actually thankful for Log4j. I'd keep an eye out for flying pigs, if I were you.

Geek Humor - A History Of Programming Languages

This history of programming languages post is absolutely hilarious. Take the description of C, for example:

1972 - Dennis Ritchie invents a powerful gun that shoots both forward and backward simultaneously. Not satisfied with the number of deaths and permanent maimings from that invention he invents C and Unix.

It's funny, because it's true.

Wednesday, May 20, 2009

Twitter Search As Sanity Checker

This morning I woke up to a whole stream of alerts about sites of mine being down. Ugh. Not a way to start the day. After some quick debugging, I noticed that all the hosts had their DNS with GoDaddy.

Was it possible that GoDaddy was having a major outage. Unlikely, but it's the best theory I had.

I picked up the phone and called GoDaddy, and their wait queue was something like 30 minutes. That's could be a sign of a major outage, or just an understaffed customer service center.

So I popped over to search.twitter.com and searched for GoDaddy DNS. And I quickly got my answer:

ntheory: Looks like GoDaddy is having serious trouble this morning. Web interface down, DNS down...

Here's the page full of results:

While Google and most news sites are fast at updating, finding this kind of real time information is surprisingly difficult on the web. Two support this you need a way to have a great many folks publish information, and a powerful search engine to sift through it all - and in this case, Twitter has both.

Tuesday, May 19, 2009

An Unexpected Booklist

The folks over at TPE have put together a fun list of unexpected entrepreneurial books.

There's plenty of interesting choices - time to fill up your wishlist with all sorts of goodies.

If I had to add one title to the collection it would probably be Make Your Own Damn Movie by Lloyd Kaufman. This motivational/how-to guide for aspiring film makers offers plenty of advice for entrepreneurial folks, too.

Of course, The Dip, Sun Tzu's The Art of War and The Tipping Point belong on your reading list - but those fall into the typical-business-book category.

What book surprised you with it's business value?

Monday, May 18, 2009

Yahoo BOSS - Freer Than Free

A client of mine asked me about the Yahoo BOSS API. I hadn't heard of it, so I poked around. It appears to be your typical search API, which has Google has been offering for for some time. But, with a key difference:

Search APIs are nothing new, but typically they've included rate limits, strict terms of service regarding the re-ordering and presentation of results, and provided little or no opportunity for monetization. These constraints have limited the innovation and commercial viability of new search solutions.

In other words, Yahoo wants to build your next app on their infrastructure, and will not only give you it for free, but let you customize it and take all the credit.

I think this is a really clever solution for dealing with a competitor (Google) that's giving away a product for free. Yahoo's taking the notion of free, and stepping it up a notch, to include more than one would expect.

And it seems like it would work too - if I'm building my startup on the cheap, why wouldn't I choose the Yahoo API that makes it look like I did all the development, versus the Google API that is plastered with Powered By Google.

To me, Yahoo looked at the rules (you have to give attribution to the search engine) and then broke them. Well played Yahoo.

Sunday, May 17, 2009

The 2009 Join Services Open House Air Show, Or, Guy Heaven

Today we made our way to the Joint Services Open House. Which is a really fancy way of saying, military air show. Not only did they have various planes and helicopters performing and folks jumping from the sky, they also had a a significant number of planes on the ground you could oggle and walk through. You could chat it up with the folks who flew the planes as well, which was definitely a treat. All in all, the 10 year old boy in me was in heaven. Big planes, big helicopters and guns - what else could a guy want?

The weather even behaved, and while a bit on the chilly side, didn't rain on us.

We didn't quite stay long enough to see the Thunderbirds perform, we did see one of my favorite planes - the A10 Thunderbolt do its thing.

I think Shira even enjoyed the day a bit. Though, I don't think she walked around with her jaw open like I did.