Writing and Programming
The two have more in common than you may think. Both are a method of expression of an idea in your head. In language you use verbs, adjectives, metaphors and other literary devices to express something. In programming you use if statements, for loops, while loops, and other mechanisms to solve a specific problem.
That feeling you get when you read a clean and elegant piece of code is the same feeling you get reading a well written article.
I think are complimentary skill sets.
If you want to improve your programming, try writing. If you want to improve your writing, try programming.
What the January 18th SOPA blackout accomplished.
New Years Resolutions
I never really have new years resolutions. Partly because I never stick to them, and partly because if theres something you want to change or do, just do it. The ones I’ve come up with, I just came across randomly and either already started doing or it’s been on my mind for a while and something just pushed me a bit to commit to it. It also happens to only be the 5th day into the new year, so I might as well make them new years resolutions.
Work out at least once a week
This is the most cliche one resolution ever, but it really just started happening by accident. I’ve been kind of bored at at home, so I started going for runs. I’d like to at least keep this going once a week. It’s not meant to be anything big or completely life changing, but just to get me outside a bit and see where it leads to.
Drink more water
My boss/colleague/friend Kelly got us these nifty glass water bottles in the beginning of December. Since getting it, I’ve already been using it on a daily basis. You’re suppose to drink at least 3 of these things a day. Since that makes me use the bathroom a million times, I’m going to set my goal to just 1 a day. It’s more water than I was drinking before, and I’ve already started drinking more than 1 just out of habit now.
Dress Better
Anyone who really knows me, this is quite a shocking thing to hear from me. My wardrobe consists of jeans, cargo shorts and black t-shirts. When I go out, I only have a couple shirts that I cycle through. I’d like to first change this by upgrading and expanding what I wear going out downtown, bars, restaurants etc, then gradually change what I wear every day.
Take my time in committing code
When I code, I’m very rapid and I code, test, commit, and test in my mind, sort of fast. I’d like to slow this process down a bit in hopes of avoiding all those minor changes commits and produce a smoother workflow. Before I commit, to visually just go over my code, then test more, and then once I’m certain about things, I’ll commit.
Don’t go around saying the world owes you a living. The world owes you nothing. It was here first.
Mark Twain said that.
Some food for thought. How do you want your career to grow? Do you want to wait for opportunities to come to you, or do you want to make your own?
Save power with automatic wake on lan
Computers can use a lot of power depending on the computer and what it’s used for. I have two at home, one thats a power-house gaming machine, and the other is a file server with 11 drives in it. These two machines always being on can add a good $70-100 dollars to my electric bill, but it’s just not very convenient to have to always turn these computers on and off (particularly the file server which sits in my closet).
If only there was a way these computers could turn on and off automatically!
Luckily there is and it involves (1) smart phone (an iphone in my case), (1) netbook (or any low power device, even a router, arduino, etc), (X) wake on lan capable computers, and (1) home network.
The base concept is my computers don’t need to be on when I’m not home or asleep and when I am home, they should be on.
The two scenarios that need to know if I’m home or not are easiest to solve by checking whether or not my phone is connected to the wifi network by pinging it. What I have set up is a little rails app that runs on my low powered netbook (which is always on) that constantly checks to see if my phone is connected and decides whether or not to turn things on or off, it’s my “Mission Control” app as I call it.
The logic with turning things on or off is:
- If phone is connected, and computers are off, turn on
- If phone is not connected for >= 15 and computers are on, turn computers off
This is the script I put together that incorporates the above logic in the Mission Control rails app:
https://gist.github.com/1562959
You may be questioning a couple things in the script like, what does Machine.alive?, sleep, and wake actually do? They are the functions in the Machine model that ping the machine to see if it’s alive and tell it to go to sleep or not.
http://gist.github.com/1563033
You may notice that I’m ssh’ing into a Windows machine and the reason for that is I have ssh setup with cygwin. The alternative to this would be to shut down via RPC command, but I could only get it to turn completely off, not hibernate which was what I needed in order to utilize wake on lan.
I also mentioned a third scenario, going to sleep, how is this accomplished? Going to sleep is an override of the logic that is in checker.rb. In the machine control rails app, there is a simple mobile site using jquery mobile that shows that status of machines and has a simple sleep/wake button (there is a shake to refresh if you have Mission Control setup).
If you wanna check out the code or even set this up for yourself it’s up on Github. The rails app may actually be a little overkill. Everything it does can be accomplished in a bash script, but I intend to build it out some more, maybe include some XBMC integration or some more advanced control.
Time to start fresh
It’s a new year, new blog. I’m scrapping all my blog posts from the past 3 years or so and starting over. Everything started to feel too messy and cluttered. I want blogging to be a clear and concise avenue of my thoughts. Another reason why I’m dumping blogger and moving to Tumblr. Blogger is a neat service with tons of features, but I find it distracting and it’s a pain to customize.
So heres, to a fresh start!

Q:ROBOTS OR DINOSAURS?
Robot dinosaurs.
Source: parislemon
