Tuesday, December 18, 2012

One Big Delivery

Last Friday, Shira and I are out for a run when we notice a whole slew of tractor trailers lined up along the side of the road. This photo doesn't do them justice:

I wonder what could possibly be going on here? Was it some sort of protest or meetup?

Then Shira nailed it: they were delivering wreaths to Arlington Cemetery for their Wreaths Across America project.

See, here's one of the tractor trailers pulling into the cemetery:

Man, that's a lot of wreaths.

Name That Plant: Green Spikey Fruit Edition

Here's another attempt at identifying the plants and trees that I pass every day, but don't actually see.

I noticed this guy while on a run near the Pentagon. How sinister does he look?

Seriously, it looks like something I might see in a tropical rain forest, not along the sidewalk in Arlington.

I used my unscientific approach to identifying this guy: I typed in a bunch of attributes into Google Image search and perused the results. In this case, I searched for green spiky weed and on the first page of the results found this picture:

Apparently, I'd found some Jimson Weed.

As the spikes suggest, this sucker is poisonous. I mean, really poisonous. It's not often you see a warning like this on a plant you find on the side of the road:

Jimson weed is a dangerous plant in inexperienced hands, and an overdose is likely to be fatal.

Yikes.

While you can't eat it, and you probably shouldn't mess with it, the plant definitely has a lot of uses. Apparently, it can be used to treat asthma, Parkinson’s and the flu. It can also, apparently, be used as a hallucinogen and other recreational drug.

Yeah, so let's just leave this guy alone.

Still, it was a nice find in my local area.

A Little Script-Fu To Help With Image Organization

One of the easy things about iOS app development (and I haven't found many!) is creating a splash screen. You just create an image named something like Default.png and Adobe AIR or PhoneGap do the right thing.

Things get trickier when you realize that you need to maintain a whole bunch of images, and have to have them follow a specific naming convention.

Before you know it, you've got a whole slew of files named something like Default-PortraitUpsideDown@2~ipad that you have to keep track of.

I was wrestling with just such a set of images today, when I decided I could maintain them all a lot easier if they lived in a single Gimp xcf. My goal then, became as follows:

Write some Script-Fu that takes each layer of an image and saves it off to its own file, and names it per the layer name. With a single click, a whole batch of images can be created from one source.

And here's the code I came up with to accomplish this:

;; Code It
(define (bs-script-fu-save-individual-layers img)
  (let ((layers (vector->list (second (gimp-image-get-layers img))))
        (orig-file-name (car (gimp-image-get-filename img))))
    (for-each (lambda (layer)
                (let ((name (car (gimp-drawable-get-name layer)))
                       (h    (car (gimp-drawable-height layer)))
                       (w    (car (gimp-drawable-width layer))))
                  (let* ((target (car (gimp-image-new w h RGB)))
                         (layer  (car (gimp-layer-new-from-drawable layer target)))
                         (file-name (string-append (filename-dirname orig-file-name) "\\" name ".png")))
                    (gimp-image-insert-layer target layer 0 -1)
                    (gimp-layer-set-offsets layer 0 0)
                    (file-png-save-defaults RUN-NONINTERACTIVE target layer file-name file-name))))
              layers)))
    


;; Register It
(script-fu-register
 "bs-script-fu-save-individual-layers"
 "Save Layers"
 "Save out all the layers of this image as separate files."
 "Ben Simon"
 "copyright 2012, Ideas2Executables"
 "18-Dec-2012"
 "RGB* GRAY* INDEX*"
 SF-IMAGE      "Image to split into layers and save" 0
 )
(script-fu-menu-register "bs-script-fu-save-individual-layers" "<Image>/Filters/Util")


;; Utility Functions

(define (last-string-position haystack needle)
  (define (go haystack needle position)
    (if (< (string-length haystack) (string-length needle))
      #f
      (if (equal? (substring haystack
                             (- (string-length haystack) (string-length needle))
                             (string-length haystack))
                  needle)
        position
        (go (substring haystack 0 (- (string-length haystack) 1))
            needle 
            (- position 1)))))
  (go haystack needle (- (string-length haystack) (string-length needle))))
            
(define (filename-dirname f)
  (let ((pivot (last-string-position f "\\")))
    (if pivot
      (substring f 0 pivot)
      f)))

Most of my effort went into writing filename-dirname and last-string-position, two utility functions. Especially last-string-position - coding that in terms of equals? and substring felt more like an interview question than my usual daily hacking.

I continue to believe in the power of The Gimp and Script-Fu. There's just something invaluable about being able to script your way out of tedious jobs.

Monday, December 17, 2012

Newtown Related Stories Worth Reading

Just a handful of articles I found interesting and insightful:

For more goodies, check out kottke.org, as he's blogged about a number of interesting stories.

Update: more stories added.

Friday, December 14, 2012

If You Read Only One Article On Troubleshooting Linux I/O Wait Issues, Make It This One

A bunch of my customer's VPS's were having odd performance issues. After looking in the usual places, I found myself needing to dig deeper. Before I knew it, I was running vmstat and trying to make sense of the results.

Once I wrapped my head around how much time was being spent waiting for IO, I decided I needed to track down which processes which were the culprits for this. This seemed like an obvious thing to do, but I couldn't find the command to give me this information. Then I found this article: Troubleshooting High I/O Wait in Linux, and things really clicked.

To cut to the chase, the command I was looking for was simply:

 for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "----"; sleep 5; done

Obvious, right?

Seriously, if you're struggling to make sense of how your system may be interacting with disk io, then go study this article.

Update: Actually, here's another really handy article to read: Linux File System Read Write Performance Test. You can run:

  dd if=/dev/zero of=speedtest bs=64k count=3200 conv=fdatasync

To get a quick sense of how fast disk write speed is.

Thursday, December 13, 2012

Pretty Lights and Failed Experiments

Ahhh, it's that time of year again: time to celebrate Chanukah and blog pictures of the candles to try to capture their simple beauty. Never works, but that doesn't keep me from trying.

Here are some snapshots from last night:

(The filters are the ones built into the Galaxy S3)

And I know you want an animated version, right?

Along with the usual candle setup, I had a little experiment planned, too. I was going to go old-old school and try using Olive Oil instead of candles to power a chanukiah.

I had this whole thing rigged up using shot glasses for oil vessels, paper towel for wicks, and paper clips as wick holders. See:

Shira took one look at the setup and put the kibosh on the whole experiment. In her defense, some of those shot glasses had some serious sentimental value, and I suppose it would not be wise to damage them while playing the role of the pyro-loving-Boy-Scout.

I'm not completely done with my experiment yet, though. I'm planning to pick up a cheap shot glass at the store (or something approximating it) and try using a single candle.

By the way, my setup was almost certainly not a Kosher chanukiah. Though it was probably a solid attempt to get in touch with a more authentic Hanukkah.

Regardless - here's a season of miracles. May your wife let you get away with more than you deserve!

Wednesday, December 12, 2012

Operation 8th Birthday Party

This last weekend wasn't just about busting boards. Nope, we had another first: Shira and I hosted our 8 year old's birthday party.

This, it turned out, is no minor affair. There's a theme/activity to consider, and then a location to host it at. For some reason, Shira wasn't excited to have 16 kids in our house at one time? I know, such a party pooper.

After quite a bit of research, she settled on what turned out to be the perfect combination: a video game truck to entertain the kids, and renting a space at an Arlington community center.

The video game truck is offered by Rolling Video Games and is exactly what you think it is: a truck where 16 kids can pile into and play games individually or together. Here's what the truck looks like (this is from their website, I don't have any good pictures of trucks without any kids in them):

We were told the truck would allow 16 kids to play at one time. I think we crammed a few more than that in, too. Many of the kids entered the truck, and didn't come out for 2 hours. The company provides a "game coach," which meant that we didn't have to figure out what kids wanted to play or change around games.

The outside of the truck opens up, and in our case, we used this so the the adults could play dancing and race car games. Everyone really did get entertained.

As for the community center, that too was a surprisingly enjoyable experience. They do rentals all the time, so that was no big deal. What was a big deal, was when we asked if we could host a 40 foot truck on the property. Their response: sure, that sounds like a lot of fun!

Another wrinkle: we wanted to rent the space on Sunday, but they had a group that had it reserved for months in a row. Rather than turning us away, they made special arrangements to fit us.

The whole experience made us feel like our event really mattered, and that they wanted to work hard to exceed our expectations.

With video games, cake (and cupcakes, and brownies, and M&M bars -- all baked by Shira!), there wasn't really much doubt that the party would go off well. And it did!.

I took many, many photos. The vast majority of which aren't appropriate to publish. But, I just have to put up this one photo. It's of one of our younger guests (he must be about 4 now - maybe?) clobbering David in Wii Sword Fighting. This kid was unstoppable!









Tuesday, December 11, 2012

Caption Me, DC at Night Edition

Last night, we totally lived it up. We went to dinner in Chinatown and took an evening stroll. There's just something magical about DC at night. Or, maybe it's just the feeling of knowing that you've got a baby sitter at home and not a care in the world.

Regardless, it seemed like I should take some pictures to capture the mood. I don't think I managed to do that, but at least I tried.

Quick story: we were outside the Whitehouse, and I was bragging to a friend about how slick my new Galaxy S3's camera is. I explained it had voice operation, and proceeded to hold it up and loudly say: "Shoot! Shoot!" - at which point I realized that probably wasn't the right phrase to be yelling in that location. I then switched to "Capture!" Less chance of getting tackled by Secret Service.

Anyone care to tack a crack at captioning these guys?

Come on, you know you've got a caption for these guys:

Monday, December 10, 2012

Gotcha of the Day: Galaxy SIII + USB - Not Recognized by Windows 7

Here's the deal. I connected my Galaxy SIII to my Windows 7 box by way of a USB cord. The laptop beeped and chirped, and then came up with the message:

(That's: USB Device Not Device Not Recognized)

This is especially strange, because I'd been connecting up the device and various laptops for the last few days without incident.

A few days earlier I had installed the Samsung Drivers which originally allowed me to connect the device and computer. My first thought: perhaps Windows "lost" these drivers and I needed to reinstall them? Crazy, but then again, so is Windows.

I installed the drivers again. That didn't fix anything.

I rebooted the phone. Again, didn't fix anything.

I rebooted the laptop. Again, didn't fix anything.

Out of desperation, I installed Samsung Kies, thinking maybe that would nudge the setup back to working. Alas, it didn't fix anything.

Then I got to thinking: what was I doing differently today that I hadn't been doing for the last few days. I know, I was using a different USB cable.

Surely, the USB cable isn't to blame? After all, it fits into both the computer and the phone. I know that Samsung would tell me to use the original cable that came with the phone. But that's just them being pedantic, right?

Apparently not. I retrieved the cable I had been using, and sure enough, the device was immediately recognized.

So there you have it. If you can't get your Galaxy S3 (or any random device) to be detected by Windows 7, step one should be to find a new (modern?) cable.

Haaaaaayaaaaah!!

For the last couple months, our 8 year old has been attending a Creative Martial Arts after school intro program. He's brought home numerous insights about jabs, crosses, and both snap and roundhouse kick. He's definitely enjoyed it quite a bit.

This last weekend, though, was the big test. If the students performed well enough, they'd earn their White Belts and get a chance to break a board.

Well, as you can imagine, the class rose to the occasion and put on quite a martial-arts show. Indeed, they all earned the right to crack a board in half using nothing but their fist.

I've got to admit, I was surprised at the challenge in front of these kids. It's scary enough to think that you're going to be punching a solid slab of wood, it's another to do it in front of 40+ onlooking parents.

And how'd our kid do? Well, check it out!

That there is the real deal: a board broken in half by a single cross punch.

While we were proud of our little Ninja, I was just as impressed with the studio that put on the class. They talk about how martial arts can be used to teach confidence, disciple and fitness - and we saw all that on display. That, and a lot of patience and positive reinforcement.

If you're in Arlington, and looking for a fun after school activity or camp, you should check them out.

Thursday, December 06, 2012

A Brand New Set of Strings

A few weeks back I take my tallis out of my tallit bag and noticed a small piece of debris fall out. I do Shabbat services, and when I'm putting my tallit away I finally get a glimpse of what the debris was: a tiny piece of tzitzit. Naturally, I approach Rabbi wondering what I should do.

She then breaks the bad news to me: sure, it may have been only a tiny bit of tzitzit, but that doesn't matter, the entire tallit is no longer kosher. I assume I need to fix that one fringe and I'll be all set. Wrong again. All four fringes need to be replaced. Not only that, but the fringes that are no longer kosher aren't just tossed out in the trash; they are stored in a genizah before they are properly buried.

I imagined that tzitzit had special status, but apparently I misunderstood just how sensitive they are. In hindsight, this makes sense. But still.

The Rabbi was kind enough to provide me with a set of kosher tzitzit, as well as a demonstration of how they are wrapped. Turns out, it's a combination knot tying and Pioneering Merit badge. While I tied one fringe on, the Rabbi tied on the other three.

As long as I was doing a bit of tallit maintenance, I decided I should tack down part of my atarah that's come loose. Luckily my Mom provided me with a sewing kit, and the Boy Scouts provided me with enough know-how to do an adequate job.

Considering my tallit has been maintenance free 20+ years, I suppose I can't really complain that I've finally got to take some action.

It was actually nice learning some of the laws of tzitzit. But that wasn't the best part. Nope, the best part was using a needle threader for the first time, and realizing that it wasn't some bit of decoration included in the sewing kit. What an amazing little device!

Some photos of my adventure...

And finally, my favorite new tool:

Wednesday, December 05, 2012

Meadowlark's Walk of Lights

Shira got quite an unexpected gift on her birthday yesterday: it was just about 70°F! To celebrate both her birthday, as well as the benefits of global warming, we visited Meadowlark Graden's Walk of Lights. I would have been satisfied just visiting a new set of gardens, but to tour the lights, and not need a parka, well, that was just too much.

I tried a number of approaches to capturing the lights with my DSLR, but in the end, I wasn't really impressed with any of the results. They just don't do the gardens justice.

If you're in the area, it's definitely worth checking out.

Tuesday, December 04, 2012

Fixed

See rule #2.

Yeah, it's not the cleanest fix, but it seems solid enough to me.

Funny story about the Army Criminal Investigation Lab: back in 1952 Disney allowed the Army to use Mickey Mouse's likeness, what do you know, it stuck.

Monday, December 03, 2012

Name that Tree: Red Berry Edition

I'm making my way through The Forger's Harvest, and absolutely loving it. But I've had enough of sitting on the sidelines and reading about plants, today I decided to do something about. So, on my way to the bus stop I snapped some photos of a tree and decided that later in the morning I'd identify it.

I picked this particular tree because the red berries helped it stand out. Besides, I was curios if the advice we'd given our 8 year old held for this tree: eat the berries and you probably won't die, but you'll get awfully sick to your stomach. After all, that's always the advice I'd been given.

I figured I'd go about this as scientifically as possible, and so I started with the aborday.org's tree identifier. After answering a few questions, I realized that I was no longer being asked anything nearly relevant about the leaves in question.

After a few more formal identification attempts, and I came up with nothing. So I totally cheated and typed tree identification berry. I scanned the pictures and realized I had a match with this one.

The caption claimed I was looking at American Holly. I did some further examination and realized that was the case. I suppose if I had to have guessed, I probably would have thought it was holly - but not celebrating Christmas, and having never had a holly wreath, it would have been just that - a guess.

This left me with two questions: (a) are the berries poisonous? (b) are there any uses for the tree?

Yes, apparently they are poisonous:

The berries of various species are slightly toxic to humans, although its poisonous properties have been exaggerated and poisoning deaths are almost unknown. Berries attract birds that eat them after the frosts have reduced toxicity. However, if household pets ingest Holly, they are very liable to be poisoned, and it is a very good idea to keep Holly decorations out of reach of pets and/or children

Well what do you know, the advice we gave our kid was exactly correct. Huh.

And does it have a use? Yes! Ignoring its magical properties for now, it can be used to create a tea. Apparently the American Holly version doesn't contain caffeine, but other variants of Holly do, can make for some excellent tea.

Apparently, American Holly can be made into tea as well - so if I get the chance to collect some leaves I may in fact give this a try. By the way, the act of drying the leaves is apparently enough to detoxify them. Without that step, you'll apparently puke your guts out.

All in all, very educational. I wonder what I can discover on the next trip to the bus stop.

Morning

There was just something pleasantly dramatic about the sunrise we caught on the way to the bus stop this morning. Perhaps it was the jet plain streaking across the sky leaving a fresh set of contrails.

Taken with my Galaxy S3

Sunday, December 02, 2012

Meeting Laguna

What a treat! Cousins Ralph and Rachel were in town, and so we had the opportunity to meet their adorable little one - Laguna. She's soooooo cute! She was even kind enough to let me snap a couple hundred (not quite, but it felt that way) photos of her.

She's was so precious to play with. At 6 months old, she's super curious, and really active - especially considering I'm sure we had her past her bed time. What a joy it was getting to spend time with her.