Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Cool Stocking Stuffer

Dec 31

I always enjoy innovative stocking stuffers and was able to put one to work today. It’s called the GrabBag and makes it simple to carry multiple plastic bags without killing your fingers. If you’re like me you try to get every plastic bag within a single trip. Now the GrabBag (two would be better) makes this possible. Below is a photo of it in action:

bag_holder.jpg

Yes it’s one of those “why didn’t I think of that?” inventions.

Read More

Escaping Single Quotes with Ruby

Dec 31

I ran into a problem this evening when inserting data in MySQL. Some of the data had single quotes and I needed to escape them. One easy one to do this is using the following regular expression:

gsub(/[']/, ‘\\\\\”)
A simple example to run is:

puts “My name’s Dennis”.gsub(/[']/, ‘\\\\\”)

I know there are a couple of methods within the Ruby MySQL module, but I had problems and settled for the example listed above.

Read More

Installing the MySQL Module for Ruby on Linux

Dec 31

I was recently working on a project where I had the need to use pure Ruby (not Rails) to insert information into a MySQL database. My Ruby installation did not have the necessary MySQL module installed so I had to install it manually. With Linux I’m generally used to doing things the hard way, which normally consists of installing the development source, configuring, making, compiling, and installing. I went through all these steps such as the ones documented here as was to the point of giving up (after 2 hours). I had thoughts of Perl and PHP flashing in my mind as my frustration grew. As a final effort I reverted to good ole Yum, which I pretty much assumed would fail:

yum install ruby-mysql

and it worked! This taught me a valuable lesson in working with Linux. In the past I’ve been accustomed to taking the difficult approach, but times have changed and Linux is becoming much more user friendly. Maybe I should rephrase that and say more developer friendly since your average user probably won’t be installing a MySQL module for Ruby. After installing I was able to successfully run the following Ruby script:

begin
db = Mysql.real_connect(“localhost”, “root”, “root_pass”, “database_name”)
puts “Server version: ” + db.get_server_info
res = db.query(“select * from tablename”)
puts “#{res.num_rows} rows returned”
rescue Mysql::Error => e
puts “Error code: #{e.errno}”
puts “Error message: #{e.error}”
puts “Error SQLSTATE: #{e.sqlstate}” if e.respond_to?(“sqlstate”)
ensure
db.close if db
end

This simply connects to the desired database, queries a table, and then prints the number of row returned.

Read More

How to Stop a Barking Dog

Dec 27

Our neighbor’s dogs are of the most annoying type, they never stop barking and bark at everything. There are times where I feel like grabbing my Red Ryder and letting loose. Just a single pump and maybe I can tag them on the tail. So Merry Christmas to Frank and Frannie, I will be purchasing the Bark Smart Deluxe in hopes of enjoying our afternoons again and letting our daughter sleep peacefully (since they bark right outside her window). The range of the BSD is about 50 feet so I can hide it nicely in my daugther’s playhouse. I realize the ultrasonic tone will affect our dogs as well, but they don’t bark nearly as much and it will be interesting to see how it affects dogs of all types and sizes. I’ll be sure to work on a before and after video for everyone’s viewing pleasure.

dog_bark.jpg

Read More

I Got Me Some Freeline Skates

Dec 23

We had early Christmas this evening with my extended family since we’re heading out of town for the weekend. Danny and Cooter (pretty much my younger brothers), to my complete suprise, bought me a pair of freeline skates. These things are INSANE. I grew up skateboarding and rollerblading, but have never experienced anything like this. They do take a considerable amount of work to learn how to use them. I’ve by no means figured them out, but am able to skate downhill a good ways. The toughest part is figuring out how to keep momentum and “pump” them to increase speed. Your feet are completely independent of each other and can go in any direction, which ain’t a good thing. I now know what I’ll be doing most of my Christmas day. I could go on and on, but check out the videos and a huge thanks to my boys.

freeline.jpg

Read More