Eddorre.com

A Good Intro to SQLite

Friday March 07, 2008 23:27 | comment icon 0 Comments

  • Tags:
  • sqlite
  • iphone

While watching the iPhone SDK announcement yesterday, I noticed that SQLite has been bundled with the iPhone in what Apple calls Core Services. Most likely, the iPhone uses SQLite to store all of the user data such as contacts, phone calls, Mobile Safari Bookmarks, etc.

In addition to the iPhone, SQLite has been embedded with several applications and services that I’ve been using directly or high profile projects that I’ve come across. Some of those include Mac OS X software NetNewsWire (my RSS feed reader), SpamSieve (a client side anti-spam solution for OS X), Ruby on Rails, and Google Gears.

So, while SQLite has been on my radar screen for a while, I haven’t actually sat down for a primer on the program. That is until I came across the Google Video Introduction to SQLite a recorded talk with the author of SQLite, Richard Hipp.

It’s definitely one of the best intros to SQLite that I’ve come across.

I Still Love DST

Saturday March 08, 2008 12:41 | comment icon 0 Comments

  • Tags:
  • opinion
  • comics

This weekend is the start of Daylight Saving Time across most of America. Historically, modern Daylight Saving Time (DST) was introduced to allow for more leisure time during the summer months (as introduced by William Willet).

In the last 30-40 years, DST has been trumpeted as reducing energy costs by cutting the amount of electricity use in the afternoon hours. So prevalent was this opinion that the length of DST was increased by one month starting in 2007 by the Energy Policy Act of 2005.

A recent study purports that DST doesn’t actually reduce energy costs, but it actually does the opposite; it increases energy costs by as much as 4%. Any electricity costs that are recouped by less incandescent lighting are spent (and then some) by air conditioning cooling costs.

The news isn’t all bad for DST as it also concludes that advancing the clocks an hour increase leisure activities, reduces traffic collisions, reduces crime and helps with SAD.

Regardless of statistics, polls, and studies I know that I love DST and I’m overjoyed that it’s starting earlier (and ending later). I can remember, not too long ago, leaving work in the dead of night (5 PM) and being completely demoralized for the rest of the day. Traffic was horrible and forget about being active for the rest of the day. Of course, I’m a sun follower and always will be so I’m a little predisposed to DST.

With all of that in mind, I wanted to link to two comics (from We the Robots) by the brilliant Chris Harding (his About section is pure comedic genius especially the Biology portion) that recently made me bust up laughing. I promise, this has something to do with DST (or at least SAD).

SAD Practical by Chris Harding

Practical SAD by Chris Harding

Body in Motion

Saturday March 08, 2008 18:26 | comment icon 2 Comments

  • Tags:
  • health
  • fitness
  • life

Last week, during my code sprint to release version 4 of my home grown blogging engine, I seem to have upset my upper back. Most likely this pain can be attributed to poor posture while sitting in front of the computer (which I was doing for 10 hours+ at the time). You know the pose; lower back out, shoulders up and rolled forward and head down.

The result of neglecting my body is sharp shooting pains whenever I look down. I’ve felt this pain before, usually from “sleeping wrong” or something like that. Historically, pain in my upper back or neck tends to alleviate itself in about 2-3 days.

Unfortunately, this time it seems as if I’ve aggravated my back more than usual. So much so that I went to the doctor just to make sure that there wasn’t another underlying cause other than poor posture. After a standard exam testing my range of motion, the doc sent me on my way with a new prescription in hand; Cyclobenzaprine.

Now I’ve never taken muscle relaxers before and when I first looked at the dosage I was a little disappointed. At 10mg, I thought this isn’t going to do much. Boy was I ever wrong. He might as well have given me voodoo zombie stuff because that’s what I turned into for two days; a walking zombie. Naturally, pain relievers and the like only target the symptom and not the cause.

With that in mind, I’ve started becoming more aware of my posture both at home and at work and correcting it when I notice myself regressing to my old habits. I’ve also been stretching more so that my range of motion isn’t as limited throughout the day.

A few years back, I was taking a Tae Kwon Do class and I enjoyed the warm up before the actual class started. Taking my previous experience with me I’ve turned to Sang H. Kim’s DVD Ultimate Flexibility: Stretching for Martial Arts which I try to do for daily stretching.

The workouts are separated into Easy, Moderate, and Intense with each one lasting approximately 20 minutes. I’ve done both the Easy and Moderate workouts and I’ve been extremely happy with the routines in each.

Dear GF, who has done the Easy workout with me, remarked that some of the techniques used in the DVD borrow heavily from yoga. I’ve been interested in yoga for a long time, especially after reading Mark Verstegen’s Core Performance books which borrow extensively from yoga (in fact, I’d say that a lot of it is yoga).

To get basic comprehension on the subject, I picked up Sage Rountree’s the Athlete’s Guide to Yoga (which now has a companion DVD) and I’ve been reading it from time to time. From what I’ve read, I’m been really pleased with the format and text of the book.

Hopefully with a pairing of martial arts stretching and yoga, I can avoid injuring myself even when it’s just sitting at the computer.

Traffic Shockwave

Wednesday March 12, 2008 00:44 | comment icon 3 Comments

  • Tags:
  • traffic

It’s official. Humans are terrible at driving in traffic. A recent study by researchers from several Japanese universities observed a phenomenon referred to as a “traffic shockwave” in a live traffic simulation. They setup a 230 meter circular track and had 22 vehicles drive around in a circle at 30 km/h (around 19 mph). At first, everything is free flowing and then, out of nowhere, “pockets” of congestion begin to appear. It’s amazing to watch (see Youtube video below).

The recent study lends credence to Dear GF’s theory that cars should be computer controlled. This would effectively remove the human element and lapses in judgment that cause “traffic shockwaves.” However, I think it’s unrealistic to think that humans would give up their control of driving altogether, but I do think that a hybrid system would eventually work.

The system would work very similarly to how driving works in the 2004 movie I, Robot. When you leave your house, the vehicle would be manually controlled. When approaching large metropolitan freeways (interstates and highways, etc.) an autopilot would activate and take you to your destination exit. Once reached, you would once again regain manual control of your vehicle and travel to your final destination.

For those that wish to rebel, there would still be the option of manually driving on the freeways…for a charge and it would be restricted to one or two lanes (I can’t imagine that anyone would want to drive manually on the freeways).

You can imagine the benefits of this type of system. Pollution and fuel reduction (the vehicle could be magnetically propelled) come to mind and of course there are the time savings by reducing traffic congestion. A 30 minute trip to work wouldn’t be so bad if you could watch a show, read a book, or play a game while the vehicle drove itself to your designated exit. It could be the perfect marriage between public transportation and driving. Combining the best of both worlds.

But let’s be honest, at this point that’s just wishful thinking and fantasy, but I’m sure that there are ways to increase the efficiency of our automotive transportation system.

Most of my commute to and from work takes me through the worst traffic in the Portland metro area, so I’ve recently become fascinated with traffic analysis; the hows and whys of how traffic congestion occurs and how it can be solved. So much so that I’ve added a set of books The Road More Traveled: Why the Congestion Crisis Matters More Than You THink, and What We Can Do About It, Stuck in Traffic: Coping with Peak-Hour Traffic Congestion, and 21st Century Highways: Innovative Solutions to America’s Transportation Needs to my Amazon wishlist to eventually read.

Coming from an IT world, where static values are usually frowned upon, I’m frustrated by the fact that freeways, bridges, etc. are still built with this mentality without giving a thought to the dynamic nature of traffic.

For example, Interstate 5 (I5) in North Portland has three lanes going north and three (sometimes it cuts down to two) going south. As people commute to downtown Portland in the morning, I5 south is a complete mess and in the afternoon, I5 north (as people commute home to Southwest Washington) is a complete mess.

One can easily imagine a dynamic system of traffic distribution that “takes away” lanes from an unused part of the highway and “gives them” to the part that needs it. Now, I understand that comparing packets and routers to vehicles and physical infrastructure is like comparing apples to oranges, but let me explain where I got this idea from.

Last summer, my family and I went to Vancouver BC where we did the normal tourist things. While coming back from Stanley Park, I drove us over the Lions’ Gate Bridge and I noticed that traffic on the bridge can be dynamically adjusted by a series of lights (red, green, and yellow). In fact, this actually happened while I was going across the bridge. When the lane that I was driving in started flashing yellow, I had to do a double-take. After a few seconds of confusion, it made total sense. My lane was being repurposed to allow cars to come the other way.

It would be interesting if something like this is being considered for the replacement of the I5 Interstate Bridge (the total cost is in the billions of dollars) that is scheduled to take place in 2010. Until then, I’ll just have to keep my sanity by listening to podcasts and music while going to and fro.

Lions Gate Bridge from Wikipedia

Mass Effect - Bring Down the Sky

Thursday March 13, 2008 20:57 | comment icon 0 Comments

  • Tags:
  • video games
  • mass effect
  • xbox 360

I’m not sure how I missed this news when it first came out a month or so ago. Mass Effect, one of my favorite Xbox 360 games of all time now had a downloadable expansion pack called Bring Down the Sky. I just found out about it today as I was reading Penny Arcade. It includes about 90 minutes of gameplay and introduces a new race to the Mass Effect universe; the Batarians. All of this for 400 points (or 5 dollars).

According to the Mass Effect website, the plot for this expansion is as follows: “A batarian extremist group has hijacked a mobile asteroid station and set it on a collision course with Terra Nova. Only you can save millions of civilians before the asteroid completes its deadly descent.”

Now there is a catch, as Tycho from Penny Arcade writes: “The trouble with this content is that it can’t really be enjoyed by people who have beaten the game. I could go back, certainly, to some previous save, but unless I wanted to move on from there and beat the game again I’d lose anything I had earned in it.”

That seems a little short-sighted on the part of BioWare, but I’ve been itching to play the game again (and pick the baddest, biggest jerk in the universe this time) and this gives me an excuse to do just that.

Upper Back Stretching

Wednesday March 26, 2008 20:20 | comment icon 0 Comments

  • Tags:
  • yoga
  • fitness

Almost 3 weeks after I posted Body in Motion, I’m still experiencing upper back pain. The pain seems to be centered on the muscles and tendons most commonly referred to as the Erector Spinae and it’s significantly worse in the early morning.

Although the pain is still there, it’s not as severe as it was before. A combination of attention to posture and upper back stretching have seemed to lessen the pain.

I’ve found one technique on Howcast.com site that I’m really enjoying.

Although you can use a rolled up towel to do the exercise, I’ve found that using a foam roller (shown in the video) is more solid and can help to massage the back by gently rolling back and forth on it.

I’ve also ordered a Viniyoga DVD specifically targeted for the upper back, neck and shoulders. This is my first foray into any kind of yoga. Last night, I popped in the DVD and decided to give it a go.

Before you get to any techniques, there is an anatomy primer and Viniyoga primer that are interesting to watch (although you can skip them). After the primer, there is a tutorial section that goes through each technique and form in detail and finally there is the portion of the DVD that you follow along with.

Before I get to anything else, for some reason the DVD is not in widescreen format so on a TV like mine (Sharp Aquos) you’ll have bars on each side of the screen unless you adjust the aspect ratio. This is a minor niggle, so I’ll leave it at that.

The techniques appear solid and do quite a bit to target my specific pain points but as a beginner it seemed quite daunting and difficult to get down. It almost seemed mechanical at times and reminded me of the mental gymnastics that I perform while attempting to play golf; Put head down, bend your knees slightly, swing back and twist keeping you left arm as straight as possible – you get the idea.

In fact, I felt so awkward that I enrolled the help of Dear GF (a frequent practitioner of some form of yoga) to coach me through it.

The DVD isn’t bad, but it’s a bit more complicated than I thought. I’m sure that I’ll eventually get the techniques down and when I do that, it’ll help a great deal.

All South Park Episodes Online For Free

Wednesday March 26, 2008 20:39 | comment icon 1 Comment

  • Tags:
  • south park

Looks like Matt and Trey have released every episode to every season for South Park online.

Now I can watch All About the Mormons? whenever I want to.

Using SSH Keys for Remote Logins

Thursday March 27, 2008 03:09 | comment icon 0 Comments

  • Tags:
  • ssh
  • sysadmin
  • linux
  • mac

When I had Windows servers at home, I would use the Remote Desktop tool to remotely login and manage everything from my Windows workstation.

Now that all of my servers have been converted over to Linux, I use the time honored tradition of using SSH to login and manage everything from my Macs (iMac and MacBook). Although with 5 Linux servers, it gets quite tiring typing in your password to authenticate each and every time I want to connect. Above and beyond that, password-less SSH logins come in handy when you have backup scripts running or when you’re deploying applications using Capistrano.

You can avoid pitfall by using SSH keys that are generated on your workstation and then stored on your servers.

I should note that this method doesn’t make your systems more secure, in fact it makes security weaker. If someone were to get a hold of your private keys, they could automatically login to any servers that use this method! Use at your own risk.

As I’ve said, I’m using my Mac as a client (specifically OS X Leopard) so these instructions are written with that client in mind. With that being said, I’m sure that the instructions can easily be ported to Linux or *BSD with minimal effort.

Open up a terminal window and type in “ssh-keygen -t [rsa|dsa]”. You can choose either RSA encryption or DSA encryption. As to which one is better, that’s open for debate. For my application, either one is equally suitable. One thing seems to be certain in my cursory research RSA key generation is slower that DSA, but RSA is faster when verifying. For the rest of the example, I’ll be using an RSA key pair.

Once you run the ssh-keygen command, it will start generating a public and private key pair. You’ll be prompted to save the private key, I would choose the default which would normally be something like this: /Users/[username]/.ssh/id_rsa.

After choosing the directory where the private key is stored, you’ll be prompted for a passphrase. This is the passphrase for the private key and as such you’ll want to choose a strong passphrase. Something like, “I wouldn’t vote for Hillary for all of the tea in China!” Again, make this as strong as possible and DO NOT FORGET IT!

Once that has been completed, you should have two files in the directory that you chose earlier; a public key (id_rsa.pub) and a private key (id_rsa).

This public key now has to be copied to the server. You can do this with one command: “cat .ssh/id_rsa.pub | ssh [username]@[servername] “cat >> .ssh/authorized_keys”. Since the public key hasn’t been copied, you’ll have to enter in your password for the remote server. This should be the last time that you’ll need to do that if everything has gone well.

One last thing, if you want a deeper understanding of encryption, decryption and public key cryptography the book, Cryptography Decrypted, is an excellent resource.

Almost-April Snow

Friday March 28, 2008 19:15 | comment icon 0 Comments

  • Tags:
  • snow
  • life
  • crazy batshit weather

It’s almost April and it’s snowing in Washington. WTF is that?

If you didn’t know any better, you’d think that this was taken mid-December in Saskatchewan.

Almost April Snow

Presidential Salary

Monday March 31, 2008 02:02 | comment icon 0 Comments

  • Tags:
  • politics
  • opinion

Politicians rarely surprise my be doing something inspiring. So, I was shocked to read that Lee Myung-Bak, the new president of South Korea, has promised to donate his salary to the poor during his entire five year term (his salary remains unknown).

That’s truly inspiring. The gesture reminds me of Steve Jobs, Eric Schmidt, Larry Page, and Sergey Brin only getting $1 for an annual salary.

An American president makes $400,000 annually for serving their country. In my lifetime, I’ve never known an American president that wasn’t already wealthy by the time that they went to the White House and I suspect that it isn’t likely to change in the future. Given that, I think American presidents (and perhaps some wealthy Senators and House members) should step up to the plate and follow Myung-Bak’s example.

end kanji