Installing Ruby Curb 0.6.0.0 on Ubuntu
December 22, 2009
If you use Ubuntu and are having troubles installing ruby’s curb be sure to intall ‘libcurl4-openssl-dev’. You’ll also need ‘libcurl3′ and ‘libcurl3-gnutls’ but will likely already have those.
ActiveRecord after_initialize
August 14, 2009
If you’re using ActiveRececord’s after_initialize like this:
after_initialize :foo_bar
you might end up scratching your head. This “macro” style of using after_initialize does compile, however, it’s simply ignored. So to use after_initialize be sure to do this:
def after_initialize
foo
end
How to make everything lowercase using VI
August 13, 2009
Want to make everything lowercase using VI? Here’s how to do it:
:%s/.*/\L&/
You can make everything uppercase by swapping in \U for the \L
Using Multitech’s SMS Finder (MultiModem iSMS)
June 22, 2009
At work we decided to use the Sms Finder product from Multitech to send and receive sms’s. This device allows you some nice advantages over many other solutions:
- Cheap sms sends – buy an unlimited sms account with at&t for $30 a month (send/recive 432000 messages for $30 bucks)
- No need to ask the customer for their mobile carrier
- Receive sms (sms email gateways can’t do it)
- Don’t have to spend time learning a bunch of AT Commands and deal with serial port connections as when trying to rig a gsm modem to send text messages
Here’s a run down on how to get the Sms Finder to work!
Sending sms’s works by posting to the devices webservice. To post to the device’s webservice do the following:
- Log into the Sms Finder’s administration web app
- Set up the device with an ip address (for demonstration lets use 172.28.0.1)
- Add a “Send SMS User” – (lets use username: “demo” and password “demo”)
- Under “Send API” check the box next to “HTTP Send API Status”
- Under save and restart press “Save to Flash memory” button
- Locate a phone number you’d like to send an sms to (use your own number instead of the 15555555555 used here)
- Enter the following into a browser: http://172.28.0.1/sendmsg?user=demo&passwd=demo&cat=1&to=15555555555&text=test_message
- With any luck you’ll see “test_message” appear in your phone’s text message inbox
Receiving sms works by setting a URL in the admin interface that the device will post to when it receives an sms. To set up:
- Check the box next to “Receive API Status” and click save
- Under “server” enter a webserver you have running (Let’s say ’172.28.0.2′, you can also use dns ‘www.somename.com’) and click save
- Under “Server Default Page” enter the url that will “listen” for messages (Let’s use ‘sms_finder/receive’)
- Under save and restart press “Save to Flash memory” button
- Now the device will start posting to your webservice at ‘http:172.28.0.2/sms_finder/receive’ whenever it receives a text message
- Write some code to do something with the messages (Below is a Ruby on Rails 2.3.2 example)
Example Rails Controller
class SmsFinder < ApplicationController
def receive
# gsub is to "fix" the invalid xml the sms finder posts, I reported the bug but it's not fixed as of this blog posts writing...
message_hash = Hash.from_xml_keys_unmodified(params["XMLDATA"].gsub(/Message Notification/,"MessageNotification"))["MessageNotification"]
if message_hash["Message"] =~ /^stop/i
# unsubscribe the phone number - number can be found in message_hash["SenderNumber"]
end
end
end
To help develop your code, instead of sending text messages from your phone, curl comes in handy:
curl -d 'XMLDATA=<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><Message Notification><SenderNumber>15555555555</SenderNumber><Message>Stop!</Message><Date>22/06/09</Date><Time>12:00:00</Time></Message Notification>' http://172.28.0.2/sms_finder/receive
There you go, your own (slow) smsc that can send and receive messages for building sms applications.
UPDATE – The device is now called MultiModem iSMS Server. Since about September of 2009 the device ships with a bug fix for the “Message Notification” node.
One Blog Post to Good Health?
June 21, 2009
I’ve probably read over 100,000 pages of information on health: what to eat, how to exercise, causes of disease, raw diet, weston price diet, cave man diet, alkalizing, blah blah blah. So after reading all this what is it that I do consistently? Well here it is, fairly simple, and not the pinnacle of health but definitely in the direction of healthy.
- Take 6-12 grams of fish oil a day (or sometimes 1-2 tablespoons of Udo’s Oil)
- Eat 4-6 meals a day, and include a lean protein source in each meal
- Lift weights 3 times a week for around 45 minutes per occasion
- Make 75% of my own meals (yes I’m eating out 25% of the time)
- Eat as many fruits and vegetables as I can tolerate, including dark leafy greens (get creative and make smoothies or green veggie juice)
- Avoid high carb foods like breads, pastas, and rice except after working out heavily (I eat too much rice)
- Drink only water or tea 95% of the time (I have around 2 cokes a week, and 2 beers a week)
- Take 1 Alive! Whole Food Multivitamin a day
- Take a pro-biotic supplement each day (acidophilus pearls, non pasteurized sauerkraut, udo’s, etc)
- Do 15-20 minutes of aerobic activity 2X a week (hike, swim, uphill treadmill)
- When buying meats, whenever I can, I get the closest thing to “wild” as possible. Free-range chickens, pasture fed beef, bison, wild salmon, forest roaming pork.
- When buying veggies, whenever I can, I get the least processed and transported veggies possible. Subscribe to a CSA in the summer, buy from farmers markets, buy organic.
And that’s about it. Try it out and see if it works for you.
Drum Buying Spree
January 21, 2009
I’ve gone on a drum buying spree. Over the last two months I’ve picked up:
* 14″X5.5″ Mapex Walnut Black Panther Snare
* 6 Piece Blue Ice Mapex Pro M Set
* 20″ Ziljian A Custom Ping Ride
* 14″ Paiste Sound Formula Hats
* Audix DP7 Mic pack
* A ton of different drum heads from Remo, Evans, and Aquarian
This coming weekend I have some time and I’ll try to record all the different drums. Hopefully I’ll post sound clips of all the different sounds.
Orchestrated Metal Recording
December 1, 2008
Here’s a peice I tracked drums for a few months back: Metal Song by Dave Wesley
Drum Tracks for Ska Song
November 30, 2008
I just finished up recording some tracks for a David Wesley ska song (http://www.djwfilmmusic.com/). I’ll post the song on my website when he mixes it.