Using TinyTDS to connect to SQL Server with Ruby on Rails 3 (for Mac OSX)
By kenglish
Note: please see comments by Ken Collins (metaskills.net) at the bottom of this entry. He mentions a better way to do this without even installing FreeTDS.
You will need FreeTDS to connect to MSSQL Server on Unix-based environments. You MUST use Homebrew to install FreeTDS on the Mac. MacPorts is evil and will not install FreeTDS correctly. Installation of Homebrew is covered excellently in the Homebrew installation docs:
https://github.com/mxcl/homebrew/wiki/installation
Edit the FreeTDS configuration for the FreeTDS library:
brew edit freetds
Replace from “def install” to “end ” with:
def install args = ["--prefix=#{prefix}", "--with-tdsver=7.0", "--enable-msdblib", "--mandir=#{man}"] system "./configure", *args system 'make' system 'make install' end
Install FreeTDS:
brew install freetdsAdd an entry to the bottom of your freetds.conf for your MSSQL Server. This file is found at /usr/local/etc/freetds.conf:
[my_sql_server] host = <hostip> port = 1433 tds version = 7.0
Add the TinyTDS and activerecord-sqlserver-adapter gems to your Rails Gemfile.
gem 'tiny_tds' gem 'activerecord-sqlserver-adapter', :require => false
Run bundler to install the gems:
bundle installFinally, add the connection to your database.yml file:
development:
adapter: sqlserver
mode: dblib
dataserver: my_sql_server
database: my_database_name
username: my_username
password: xxxxx
timeout: 5000A reference for installing UnixODBC (which I don’t recommend), you can follow this tutorial:
MSSQL2005 on Rails on Snow Leopard (the easiest way I know how.)
Has comedy changed as a result of the internet?
By kenglish
Let’s think about how comedy has changed since we’ve started consuming digital video on the internet. Prior to the Internet, comedy media was consumed primarily through movies and television. However, the internet has made comedy infinitely more accessible and thus we’ve been laughing a lot harder these days at a lot of different things.
To begin, what is Comedy? The following summarizes a popular book about comedy:
Comedy Writing Secrets by Mel Helitzer
Why We laugh?
The two main motivations:
- We laugh out of surprise.
- We laugh when we feel superior.
There are six additional motivations each which supports the first two.
- We laugh out of Instinct
- We laugh at incongruity
- We laugh out of ambivalence
- We laugh out of release
- We laugh when we solve a puzzle
- We laugh to regress.
Recipe for Humor:
The following six elements must be present for any humor to work:
- Target
- Hostility
- Realism
- Exaggeration
- Emotion
- Surprise
These elements have not changed much, what has changed is the content.
How do I consume great comedy vidoes?
- Tosh.O Blog
- Redit.tv (click Happy)
This is my internet Comedy Highlight real. Since I won’t have time to show all these videos in class, I hope that the other students will visit my blog and watch them on their own time.
Early history:
Star Wars Gangsta Rap: The most popular flash-video of all time
Lenny Bruce, Eddy Murphy, Richard Pryor were all considered vulgar for their time. Now, notice that vulgarity is almost expected in interactions on the internet.
Popular Targets: Technology and Technology Workers
There is a hostility towards traditional media. Even though we’re consuming more traditional media than ever, it’s easier to make fun of it now:
Charlie Brooker – How To Report The News
Auto-tune the news with Joe Biden singing
Mixing Media:
Star Trek and Monty Python.
Don’t Taze me and MC Hammer.
Kesha/cops parody uses many internet based images.
Target/ Hostility: Popular Movies
Twilight ‘New Moon’ in one minute.
How Star Wars should have ended.
Realism (Fail Videos) Top 100 Fail Clips of 2009:
Tons of Suprises:
Misheard Metal Lyrics.
Digital video can be used to parody how ridiculous Television video is. Does this render Television obsolete or
engage us more in it. For example, before watching the Rap Chop video, I knew very little about the slap chop. Now I always check it out in the “As seen on TV” store.
Slap Chop Video.
Rooftop Comedy introduces us to new comedians in short, easy to consume forms.
Comedy by Consensus? Pride of origination?
So, has comedy changed? Not much. Our tolerance for bad comedy has certainly gone. Nothing is is off limits these days and technology has given comedy infinite more possibilities to expand.
svn2git for real men
By kenglish
On the server, set up the remote repositories:
1 2 3 | mkdir project1.git cd project1.git git --bare init |
Here’s a script to do them all in one shot, just modifiy the REPOS variable:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh REPOS="project1 project2 project3 project4" for repo in $REPOS do repo_dir="$repo.git" mkdir -p $repo_dir echo "Creating git directory $repo_dir" cd $repo_dir git --bare init cd .. done exit |
Now, on the workstation:
1 2 | sudo apt-get install git-core git-svn sudo gem install nirvdrum-svn2git --source http://gems.github.com |
Create the authors.txt in the following format:
1 2 | dburger = David Burger <email@email.com> jdoe = John Doe <jdoe@doe.com> |
For one project, do the following:
1 2 3 4 5 | mkdir project1 cd project1 svn2git https://svn.myserver.org/repos/ses --authors ../authors.txt git remote add origin hailstorm.myserver.org:/home/kenglish/repotest/ses.git git push --all |
The script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/sh REPOS="project1 project2 project3 project4" for repo in $REPOS do mkdir $repo cd $repo cmd="svn2git https://svn.myserver.org/repos/$repo --authors ../authors.txt" echo $cmd `$cmd` cmd="git remote add origin hailstorm.myserver.org:/home/kenglish/repotest/$repo.git" echo $cmd `$cmd` cmd="git push --all" echo $cmd `$cmd` cd .. echo "DONE EXPORTING $repo" done exit |
Don’t diss the shell script, I leave in the echoes in case i need to test stuff out…
Note: Another option for the authors file is place it in your home directory .svn2git/authors (e.g. /home/kenglish/.svn2git/authors). Svn2git will automatically detect it and use it.
Any questions? Comments?
Weekly Aggregate, April 20-24
By kenglish
Not too much going on this week.
Sun and Oracle
Does anyone not know about this? Is anyone nervous?
FacebookStatus.org
Hilarious! I’m gonna use the Facebook status generator for a week as a social experiment.
Ubuntu charges forward with 9.04
Great stuff. Mac people, stop trying to convert me!
Sponsor Aloha on Rails
This is going to be the best conference ever. If you haven’t been to Oahu, this is your perfect excuse to come. October is the best time to come.
Is this one viral?
Weekly Aggregate, April 13-17
By kenglish
Dad smashes daughters phone after 10,000 texts
My high-quality, thought-provoking story of the weak. 10,000 texts in one month. That’s 333.333 text per day. Assuming an 8 hour sleep schedule, that’s 20 texts an hour. Seriously. That’s not that much???? Calm down, DAD!
Jruby on Rails on Google App Engine
Some people work fast!
Why I don’t object to Array#sum and My Objections to Array#sum
Great discussion here. Start by checking the reddit comments on the link. I’m glad they brought this issue to the forefront. My next blog post will detail how my vote can be bought for or against Array#sum. As you may know, anything can be bought.
San Diego Ruby Podcast
In case you haven’t seen it, these guys have some videos of their presentations. There’s a choppy Paperclip plugin Presentation. I’m all about Paperclip now.
Weekly Aggregate, April 6-10
By kenglish
ALOHA ON RAILS
It’s official. We have a date: October 5-6, 2009. All the Rails geeks will be packing their board shorts and sunscreen to come to our awesome island. Seth didn’t hold back, settled on the Marriot in Waikiki. It’s 1 block from the beach.
App Engine Java Overview
As predicted here, Java will now be supported by the Google App Engine. Now, we just need a Java version of Mysql and everything will run like it does at home…
Microsoft fined by German, 9 Million Euros for monopoly style pricing
I wonder if paying out fines for anti-trust fines is built into Microsoft cost structure. It must be by now. Matt Asay talks about how much influence Microsoft can have by controlling the user’s first experience on the web. Too bad msversus.org doesn’t keep his site up to date anymore but if you haven’t read it, check it out NOW.
Weekly Aggregate for March 30 – April 3
By kenglish
Google Contact
Found here:www.google.com/contacts. I have a lot of my contacts in my Yahoo! address book. I am slowing moving them over to this one.
TechCrunch Layoff Tracker
This is eerily reminiscent of the old fuckedcompany.com. That Pud guy was pretty damn funny.
Japan’s Wacky Indoor Beach
Do you think the wave is more crowded that Waikiki? I wonder why come here when they can just go to this awesome place!
More pictures of the Miyazaki Ocean Dome.
RubyMine 1.0 Beta
I found this on the a Ruby Inside post I’m gonna try to use it for a week and see how it goes. The only problem is, if I’m using flex builder in Eclipse, why not use Aptana?
Playing with Ubiquity
My co-worker turned me on to Ubiquity, an amazing Firefox Plugin. If you don’t know what ubiquity is, watch this video. Be prepare to be blown away:
Ubiquity for Firefox from Aza Raskin on Vimeo.
Weekly Aggregate for March 23-27
By kenglish
‘Jaunty Jackalope’ Ubuntu springs into beta
Sounds like some good new features for my OS of choice. Full details here.
Java: Coming Soon to Google’s App Engine
Sladd got me all excited about App Engine last year. However, we quickly discovered that coming from Rails, using Python (Django or Pylons) is like going back to FoxPro. If Google’s App Engine allows Java, we can use JRuby instead of this ridiculous hack for Sneaking Ruby Through Google App Engine (and Other Strictly Python Places.)
Open Bio Google Summer of Code
If you are student and jobless, apply to Google Summer or Code. I’ve heard great things about it.
ReQall Goes Pro: Smarter Task Management for the iPhone
Geo-based tasks and task reminders. This was Tyler’s idea and these guys stole it. That’s the downside of being jacked into the Matrix: others can read your thoughts.
Php Women
I would have never switched to Ruby if I knew that chicks dig PHP. They need to add a Personals section. I could relate to “Experiences of a conference virgin” because, sadly, I too am a conferences virgin.
Sansa SlotMusic for $20.
Screw you, Ipod Shuffle! Seriously, this thing could be a good audio book buddy.
Weekly Aggregate for March 16-20
By kenglish
I’m gonna try to post a running commentary on tech news once a week….
What IBM might gain by buying Sun Microsystems
Interesting article. Too bad we have Dells and Apples everywhere. I’d like to see a demographic breakdown of who buys IBM and Sun servers. I would guess that people that came into the industry in the 70s and 80s are all over IBM while the early dot-commers from the 90s think that Sun is the bomb. Tools like me just want a Dell that they can throw Linux on. I know, I know: what about all those cool enterprise wide applications (that nobody knows how to use or install.)
Lenova’s new Pocket Yoga
I could see it as a good roadside hacking device as long as it runs Linux. I like the name too. Honestly, I was expecting to a see a small version of my first Yoga instructor, Vanessa. She used to make us hold poses for 10-15 minutes at a time. A pocket version of her would really help with my posture.
Android vs IPhone 3.0 Showdown
The only way my blog will ever go viral is if I mention the iPhone. I’m not much of a smartphone guy but this a good read.
Rackable’s New Servers Like It Hot
It’s amazing where server technology is going. Check out this one, it can run at 104 degrees. Boom! I hope never have to set up another server. Just have some guy maintain these and I’ll access everything in the cloud.
Lending Club
Wow. Social Lending. This is a pretty neat concept. They only lend to people with FICA scores over 600 and claim to only have a 3% default rate.
config.gem: Unpacked gem ezcrypto-0.7 in vendor/gems has no specification file. Run ‘rake gems:refresh_specs’ to fix this.
By kenglish
Thanks to Giles, I finally found the answer to this problem.
Open config/environment.rb and add “Rails::VendorGemSourceIndex.silence_spec_warnings = true”
1 2 3 4 5 6 | RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::VendorGemSourceIndex.silence_spec_warnings = true |
You can put an awesome comment like this guy did:
http://gilesbowkett.blogspot.com/2009/03/configgem-unpacked-gem-whatever-in.html



January 13th, 2011