Just another ruby/rails blog http://blog.mcmoyer.com the ramblings of a former cf developer who now embraces ruby posterous.com Sat, 31 Dec 2011 07:34:00 -0800 Installing theRubyRacer on OSX Lion w/Xcode 4.2.1 http://blog.mcmoyer.com/installing-therubyracer-on-osx-lion-wxcode-42 http://blog.mcmoyer.com/installing-therubyracer-on-osx-lion-wxcode-42

Struggled with this one quite a while last night. Turns out the solution is quite simple Everytime I would run

gem install therubyracer

I would get back an error like so:

Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
ERROR: Failed to build gem native extension.

/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for main() in -lobjc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
  --with-objclib
  --without-objclib
/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
  from /Users/marlon/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
  from /Users/marlon/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
  from /Users/marlon/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'

This is what the mkmf.log file had in it. Wasn’t much.

"/usr/bin/gcc-4.2 -o conftest -I/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin11.0.0 -I/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe conftest.c  -L. -L/Users/marlon/.rvm/rubies/ruby-1.9.2-p290/lib -L. -L/usr/local/lib     -lruby.1.9.1-static  -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

Finally got the idea to try the command in the mkmf.log and figured out that I didn’t have a gcc-4.2 on my file system anywhere, only a ‘gcc’ that happend to be version 4.2.1. A quick symlink later and theRubyRacer compiled perfectly.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Tue, 13 Sep 2011 12:50:14 -0700 nifty config tip for nginx and rails apps http://blog.mcmoyer.com/nifty-config-tip-for-nginx-and-rails-apps http://blog.mcmoyer.com/nifty-config-tip-for-nginx-and-rails-apps

If you’ve got a rails site running on nginx, you’ve more than likely seen your nginx access logs & production log polluted with calls to favicon.ico and phpinfo.php and all sorts of other stuff.  Here’s a quick and easy way for nginx to drop all those requests:   In the folder that houses the nginx.conf file, create a drop.conf file with the following:

location = /robots.txt         { access_log off; log_not_found off; }
location = /favicon.ico        { access_log off; log_not_found off; }
location ~ \.(php|asp|cfm|jsp) { access_log off; log_not_found off; return 204; }
location ~ /\.                 { access_log off; log_not_found off; deny all; }

Then at the end of your server declaration block:

server {         
  ....
  include drop.conf;
}

This will quit the logging of favicon.ico along with robots.txt.  It will drop all requests for languages not used in you app and will deny access to any dot file in your apps folders   Thanks to this site for giving me some great examples: https://calomel.org/nginx.html  

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Wed, 15 Jun 2011 11:54:45 -0700 Exporting iPad Friendly Video From MythTV http://blog.mcmoyer.com/exporting-ipad-friendly-video-from-mythtv http://blog.mcmoyer.com/exporting-ipad-friendly-video-from-mythtv I've got MythExport set up for MythTV.  I love having the ability to watch my TV shows on my iPad.  What I didn't enjoy was getting a very good looking export from MythExport.  After wrestling with ffmpeg for a while, I dumped it and went with HandbrakeCLI just for the ease of use.  Here's the config I came up with

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl

# Update this with a package name relivant to your new config.
package PortableH264HighRes;

use ExportBase;

our @ISA = qw(ExportBase);

#Example strings, replace with something relivant to your new config.
my $description = "High Resolution (1024x768) Portable MPEG4 Settings.";
my $devices = "High Resolution iPad";
my $notes = "Requires AAC, activate Medibuntu";
my $version = "1.0";

sub new{
    my $class = shift;
    my $self = $class->SUPER::new(shift, shift, $description, $devices, $notes, $version);
    bless $self, $class;
    return $self;
}

sub export{
    my( $self ) = @_;
    system("HandBrakeCLI -i \'$self->{_inputFile}\' -o \'$self->{_outputFile}$self=>{_extension}\' --preset=\'iPad\' --decomb")
}

1;

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Wed, 08 Jun 2011 09:42:00 -0700 Gnome 3 and crashing http://blog.mcmoyer.com/gnome-3-and-crashing http://blog.mcmoyer.com/gnome-3-and-crashing

I've really been liking Gnome3, but there's this nagging crashing issue that's been driving me buggy.  In my error logs, I get stuff like "widget outside GTKWindow" and other odd GTK errors. 

After googling for a while and getting nowhere, I did stumble upon a hint where somebody had replaced gdm with kdm.  I tried it and lo and behold, I can run git-cola without it crashing my session. 

I do get errors still, like: Gtk-Message: Failed to load module "canberra-gtk-moduleanberra-gtk-module", but hey, as long as it doesn't crash, I'm fine!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 24 Mar 2011 14:30:00 -0700 Using RVM Gemsets for deploying http://blog.mcmoyer.com/using-rvm-gemsets-for-deploying http://blog.mcmoyer.com/using-rvm-gemsets-for-deploying

Recently I’ve switched to using RVM Gemsets in my deployment vs using Bundler’s deployment option. I started having issues with compiling native extensions with the bundler capistrano tasks. Since an error in that causes a rollback of the deployment, it’s not easy to troubleshoot.

That’s why I started using gemsets for each application I deploy. When I deploy, the first thing capistrano does is create the gemset. After the code updates, the bundle command will run and install all the required gems into the application’s gemset. If you do have an issue with compiled gem, it’s as easy as ssh'ing to the machine and:

rvm 1.9.2@myGemSet

gem install myProblematicGem

Below are the two tasks that I use in my deploy.rb:

# add these to your deploy.rb
before "deploy", "deploy:create_gemset"

after "deploy:finalize_update", "deploy:bundle"

namespace :deploy do
  desc "Create the gemset"
  task :create_gemset do
    run "rvm #{rvm_ruby_string} --create"
  end

  desc "Install the bundle"
  task :bundle do
    run "bundle install --gemfile #{release_path}/Gemfile --without development test"
  end
end

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Wed, 09 Mar 2011 09:38:01 -0800 Screen grab from Kennedy Space Center workstation http://blog.mcmoyer.com/screen-grab-from-kennedy-space-center-worksta http://blog.mcmoyer.com/screen-grab-from-kennedy-space-center-worksta
Used_shuttle_pricing

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 11 Nov 2010 07:51:00 -0800 Moving sites from windows to linux http://blog.mcmoyer.com/moving-sites-from-windows-to-linux http://blog.mcmoyer.com/moving-sites-from-windows-to-linux

I’m helping a friend in his move from windows based hosting to linux based hosting.  One of the big issues so far has been case sensitivity in the linux file system.  After using the tried and true method of clicking until you find a broken link, I came up with a better idea.  Just run this ruby script inside the root directory of your site and it will show you filenames and which files have case issues with it.

#!/usr/bin/ruby
files = Dir['**/**'].sort

files.each do |file|
  #do a case insensitve search first
  all_matches = `ack -lic "#{file}"`.split("\n")
  puts "found #{all_matches.length} matches for #{file}"
  exact_matches = `ack -lc "#{file}"`.split("\n")

  difference = all_matches - exact_matches

  unless difference.empty?
    puts "#{difference.join("\n")}\n\n-----------------------------------------"
  end
end

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 02 Sep 2010 09:07:00 -0700 Unicorn_rails, rvm & Ubuntu's upstart scripts http://blog.mcmoyer.com/unicornrails-ubuntus-upstart-scripts http://blog.mcmoyer.com/unicornrails-ubuntus-upstart-scripts

After hours of hacking and searching and not getting anywhere near successfully autostarting my unicorn_rails process, I stumbled onto it.

This script will run as my deployment user, use rvm to switch to a specific ruby and then start the app server

1
2
3
4
5
6
7
8
9
10
11
# start this task as deployer

description "Starts the rails app server(unicorn) as the user 'deployer'"

start on filesystem

chdir /srv/www/{path_to_my_app}

exec sudo -u deployer -i 'rvm ree; unicorn_rails -c /srv/www/{path_to_my_app}/config/unicorn.rb -E production'

respawn

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Tue, 10 Aug 2010 11:26:00 -0700 My Mac Development Setup http://blog.mcmoyer.com/my-mac-development-setup http://blog.mcmoyer.com/my-mac-development-setup

From powering on a new mac to ready to develop, here's my setup:

Install Dropbox and make symbolic links to all my dot files, .vim,  .vimrc, .zshrc, etc

Install SIMBL

Install a nice, easy to read terminal theme such as this one:

Install XCode

Install Homebrew

    brew install git

    brew install macvim

    brew install mysql

    brew install ack

    brew install imagemagick

install rvm with:

install Ruby Enterprise Edition with 

    rvm install ree

    rvm use default

    sudo gem install livereload # this uses some rubycocoa libraries that aren't in Ruby Enterprise Edition
    sudo gem install compass

    rvm use ree

    gem install rails
    gem install mysqlplus
    gem install compass
    gem install activerecord-sqlserver-adapter
    gem install unicorn

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Mon, 09 Aug 2010 21:40:00 -0700 Moving from a case-sensitive fs to a case ignorant one http://blog.mcmoyer.com/moving-from-a-case-sensitive-fs-to-a-case-ign http://blog.mcmoyer.com/moving-from-a-case-sensitive-fs-to-a-case-ign

I'm moving to a new mbp. I've got a time machine backup disk, but it's a case sensitive fs and my new mb is not. I've got a few music files that don't match up perfectly like "Lady Gaga" and "Lady GaGa"....hey, you gotta admit, she's got some catchy tunes.

Anyway, in order to find these and manually copy them over, I drop into the command line and run this:

find ./ | tr 'A-Z' 'a-z' | sort -rn | uniq -d

This will give you a list of all the directories/files that are duplicates of each other in everything but their case. It's up to you after that to move the files to one directory or another.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 22 Jul 2010 19:17:00 -0700 Mail.app and the case of the "descending order" http://blog.mcmoyer.com/mailapp-and-the-case-of-the-descending-order http://blog.mcmoyer.com/mailapp-and-the-case-of-the-descending-order

So after trying to use the Gmail web interface for a few weeks, I spooled up Mail.app. I like Mail.app. It can sometimes seem like it's syncing with gmail forever, but in general I like the app a lot. When I started it though, I noticed that my emails were all in Date Received Descending order.

Now, I'm really not sure who likes to read mail in Date Received Descending order. It's kinda like reading a book from back to front for me. So dutifully, I clicked the column to sort it ascending. Went to my next folder and found it was descending order also. Clicked - Sorted, next folder..hmmm, okay, I started noticing a pattern. What was even more odd was that when I went back to the first folder, it was once again descending order. I thought I'd fix it by sorting by another column and then back to date. Nope, everytime you leave and come back, it's back to descending order.

In the end, interestingly and unsurprisingly at the same time, it was LCC...or Logitech Control Center. Once that was uninstalled, my mail folders remain sorted the correct way. Anyway, who needs my Logitech mouse now that I have the Magic Mouse :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Wed, 14 Jul 2010 19:02:00 -0700 2006 Uplander Bearing replacement http://blog.mcmoyer.com/2006-uplander-bearing-replacement http://blog.mcmoyer.com/2006-uplander-bearing-replacement
It's funny, but I really don't have any Ruby related posts yet, but who knows, maybe this will help someone else.

A few months back, my wife started complaining about a noise her car was making.  Like all car problems, it disappeared the instant I tried to check it out.  Fast forward a couple months, I used my wife's car for an errand.  I couldn't believe the howling it was making.  I quickly checked into taking it into the shop.  I couldn't believe it when the shop wanted to charge me over $600.00 to replace the bearing.  I instantly started calling the auto parts stores and found a replacement bearing for $118.00.  With that price difference, I was committed :)
 
 
Here are the tools I used.  The air wrench definitely helped out quite a bit.  The other tools pictured are a puller.  A socket wrench with a 4 inch extension and a 2 inch extension, a bearing socket obtained from Oreilly's, and a torque wrench.
Dsc_0976
 
Pull of the tire.  With the tire removed, remove the brake caliper (warning - these bolts are tough to get off!) and remove the nut holding the disc on.
Dsc_0974

 
With the brake caliper and disc out of the way, you can remove the bearing.  Three bolts hold the bearing.  I found it easier to turn the steering wheel all the way to the left and right to be able to remove the bolts.  The ABS sensor wire will unclip relatively easily.
Dsc_0970

 
If needed, use the pull to remove the bearing assembly from the frame.  
Dsc_0971

 
The new one will slide right into place over the spindle.  Don't forget to hook up the ABS sensor wire!
Dsc_0973
 

Dsc_0977
The old bearing rear view
 

Dsc_0978
The old bearing front view
 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Wed, 14 Jul 2010 14:29:00 -0700 xRefresh, Firefox soft css updates and SASS http://blog.mcmoyer.com/xrefresh-firefox-soft-css-updates-and-sass http://blog.mcmoyer.com/xrefresh-firefox-soft-css-updates-and-sass

So, I’ve just recently found the excellent tool of xRefresh (http://xrefresh.binaryage.com/). I really wanted the soft css updates to work with sass, but every time I would update my SASS file, the whole page would reload.

So I figured out I needed to exclude it:

xrefresh-server -e '^(\.(log|sass)'

Unfortunately, when I did that, it wouldn’t recognize the changes to the css anymore. I had forgotten that the SASS file is recompiled during the request. I hate to admit it, but it took me a while to figure that out. So, the solution is pretty simple — in another terminal window start the compass watcher

compass watch

Voila…your changes to your css appear without a complete reload of the page!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 01 Jul 2010 17:29:00 -0700 Setting up Ubuntu 10.4 on Citrix ZenServer 5.5 DomU http://blog.mcmoyer.com/setting-up-ubuntu-104-on-citrix-zenserver-55 http://blog.mcmoyer.com/setting-up-ubuntu-104-on-citrix-zenserver-55

This is how I got Ubuntu 10.4 64bit running under DomU on Citrix ZenServer 5.5. I’m not sure if the 32bit version can install in DomU — I’ve been told only the 64bit Kernels include the citrix modules   First off, start out by setting up a new machine.

Screen_shot_2010-04-15_at_6
Next, let the auto partitioner set up the disk, but don’t write the changes yet.
Screen_shot_2010-04-15_at_7
Next, edit the partition table.  Delete the primary partition, leaving the swap.
Screen_shot_2010-04-15_at_7
0screen_shot_2010-04-15_at_7
Screen_shot_2010-04-15_at_7
Next, create a 256Mb primary partition at the beginning with Ext 2 with a mount point of /boot
Screen_shot_2010-04-15_at_7
Then create an Ext 4 primary partition with a mount point of /
Screen_shot_2010-04-15_at_7
Write the changes to disk and continue the install as normal
0screen_shot_2010-04-15_at_7
After the installation, Ubuntu will reboot into HVM mode.  Login and run the following commands  

sudo aptitude update  
sudo aptitude safe-upgrade

Next, follow the instructions I found on http://brettshaffer.com/blog/linux/downgrade-grub-2/ to downgrade Grub2 to Grub1

sudo cp /etc/default/grub /etc/default/grub.old
sudo cp -R /etc/grub.d /etc/grub.d.old
sudo cp -R /boot/grub /boot/grub.old

sudo apt-get purge grub-common grub-pc
-- answer yes to remove grub2

sudo apt-get install grub
sudo update-grub
sudo grub-install /dev/sdX

echo "grub hold" | sudo dpkg --set-selections

  Then set up getty to listen to the hvc0 console

cd /etc/init
cp tty1.conf hvc0.conf

Change all references from tty1 to hvc0 In your fstab, change /dev/scd0 to /dev/xvdd. Reboot into HVM again to make sure the grub install went okay

Look in the /boot directory and copy down the vmlinuz & initrd versions

ssh into the xen console:

find the machine and copy the uuid of it:

xe vm-list

once you have that:

xe vm-param-set uuid=uuid-of-machine HVM-boot-policy=
xe vm-param-set uuid=uuid-of-machine PV-bootloader=pygrub
xe vm-param-set uuid=uuid-of-machine PV-bootloader-args="--kernel /vmlinuz-2.6.31-20-server --ramdisk /initrd.img-2.6.31-20-server"
xe vm-param-set uuid=uuid-of-machine PV-args="root=/dev/xvda3 console=hvc0"

find the uuid of the VBD

xe vm-disk-list uuid=uuid-of-machine
xe vbd-param-set uuid=uuid-of-vbd bootable=true

check to make sure the boot partition is readable

xe-edit-bootloader -u uuid-of-machine -p 1

start the VM – The VM should start in PV mode – Reboot and Shutdown buttons should be active now.

—hint: if you can’t type in the console, you may have to restart citrix center

Login and start an sh shell instead of bash

Mount the xs-tools.iso and install the tools. You’ll get an “Unexpected Operator” message, but the tools install.

sudo mount /dev/xvdd /mnt
cd /mnt/Linux
sudo dpkg -i xe-guest-utilities_5.5.0-466_amd64.deb

Now, the suspend button should be active. Edit the /boot/grub/menu.lst and change the value of indomU to false so that grub will pick up the standard kernels. Also, set the value of groot=(hd0) and update grub again

sudo update-grub

Now, go back to the xen ssh session and clear out the PV-bootloader-args

xe vm-param-set uuid=889ee104-56a7-c5db-677a-f4ec71d63fb8 PV-bootloader-args=

Reboot! Your server should be running in DomU mode and should be booting from the grub menu. When your kernel updates, it will automatically be picked up now and become the default kernel.

Screen_shot_2010-04-15_at_8

I did have some issues with the tools not always starting correctly. I rectified that by moving them back in the boot order.

sudo update-rc.d -f xe-linux-distribution remove

sudo update-rc.d xe-linux-distribution defaults 86

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 01 Jul 2010 13:36:00 -0700 Iphone4 battery life http://blog.mcmoyer.com/iphone4-battery-life http://blog.mcmoyer.com/iphone4-battery-life

Not to shabby performance wise, over two days of standby usage with over 7 hours of active usage!

Photo

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Thu, 01 Jul 2010 07:55:37 -0700 Untitled http://blog.mcmoyer.com/21787206 http://blog.mcmoyer.com/21787206

"Hey, things look different!"

Yeah, that's right, things have changed.  Blogging had really slowed down for me just because of the tediousness of prepping articles.  I stumbled up this site Posterous.com and found a solution to my tedium!  I can create entries straight from my phone...and who doesn't have their phone on them 99% of the time nowadays.  Anyway, look forward to more articles.  I don't know if I'll import any of my old articles or not...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Tue, 02 Feb 2010 15:55:00 -0800 Nginx and Railo http://blog.mcmoyer.com/nginx-and-railo http://blog.mcmoyer.com/nginx-and-railo

I still have to do maintenance on my older CF sites. Luckily, I found the excellent Railo CF Server. I’ve also transitioned to using Nginx as my development and production web server…..mainly because of the ease of configuration…well, that and the speed and the reduced memory footprint compared to Apache.

In my development environment, I’ve symlinked the cfm source directory in the /railo-install-dir/webapps/ROOT path so I have something similar to this:

/railo-install-dir/webapps/ROOT/website-1/
/railo-install-dir/webapps/ROOT/website-2/

Then, in my nginx.conf file, I have an entry like this:

server {
  listen      80;
  server_name website-1.local;
  index             index.cfm index.html index.html;

  location ~ \.cfm$ {
    #proxy_pass can't have a uri so we use rewrite to change the uri to pass to Railo
    rewrite ^(.*)$ /website-1/$1;
    proxy_pass       http://127.0.0.1:8600;
    proxy_redirect   off;
    proxy_set_header Host                          $host;
    proxy_set_header X-Real-IP                     $remote_addr;
    proxy_set_header X-Forwarded_For               $proxy_add_x_forwarded_for;
    break;
  }
  location ~ / {      
    root             /home/myuser/cf_sites/public;
  }

}

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Mon, 16 Nov 2009 16:02:00 -0800 Couldn't have said it better myself http://blog.mcmoyer.com/couldnt-have-said-it-better-myself http://blog.mcmoyer.com/couldnt-have-said-it-better-myself

Hal Helms was one of the original creators of the Fusebox framework for ColdFusion. I started using that framework at version 2 for all of my ColdFusion development. Back in 2006-ish, I discovered Ruby and Ruby On Rails. I was hooked and even though I had around 8 years of CF experience at the time, I went whole hog on RoR.

I’ve been watching members of the CF community slowly switch over to RoR. I’d always thought the CF programmers were a pragmatic bunch. Afterall, CF was the best tool for the job back in the dark ages of web development. It only made sense to me that they’d figure out that Ruby was an even better tool.

Today Hal Helms posted his farewell to CF blog post. It’s affirming to me to see something like this and I gladly welcome him to the community.

Hals Blog Entry

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer
Sat, 21 Feb 2009 16:15:00 -0800 Getting FreeTDS to work on CentOS 5.2 http://blog.mcmoyer.com/getting-freetds-to-work-on-centos-52 http://blog.mcmoyer.com/getting-freetds-to-work-on-centos-52

Recently I had to finally bite the bullet and get my Linux VM’s talking with MS SqlServer. After much trial and error and umpteen tutorial sites, I have finally figured out how to do this…..and the amazing thing is that is dead simple.

First off, all of this was executed as root:

yum install freetds-devel unixODBC-devel

This will install not only these packages, but the freetds and unixODBC ones as well and install the libraries ‘libtdsS.so’ and ‘libtdsodbc.so’ in the /usr/lib folder

vim /etc/freetds.conf
  • in the global section change “tds version” to 8.0

    #!bash vim /etc/odbcinst.ini — add an entry for FreeTDS

    #!bash [FreeTDS] Description = ODBC for SqlServer Driver = /usr/lib/libtdsodbc.so Setup = /usr/lib/libtdsS.so FileUsage = 1

once this has been done, you should be able to connection up to your SqlServer machine

tsql -S  -U  -P

you will now be in a shell and can test is by doing this

use 
go
select * from mytable
go

Normally, at this point, I install Ruby Enterprise Edition. I use this as my only ruby installation on the machine. I won’t go into how to install it because http://www.rubyenterpriseedition.com/ has great documentation already.

Next, download ruby-odbc from http://www.ch-werner.de/rubyodbc/

Once downloaded, do the following

tar zxvf ruby-odbc-0.xxxx #replace the xxxx with the current version
cd ruby-odbc-0.xxxx 
ruby extconf.rb
make
make install

Next, grab the gems you’ll need

gem install dbi
gem install dbd-odbc
gem install rails-sqlserver-2000-2005-adapter -s http://gems.github.com

That’s it! At this point you can make a new rails app and modify the database.yml file to look similar to this:

development:
  adapter: sqlserver
  mode: odbc
  dsn: Driver=FreeTDS;Server=10.x.x.x;Database=dbBoring;Uid=sa;Pwd=password1

There is an option to edit the file /etc/odbc.ini and define your dsn’s there, but that didn’t feel too dry to me so I define them only in the database.yml file.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/621488/Photo_on_2010-05-18_at_12.49__2.jpg http://posterous.com/users/5BhBlHQJcxH3 Marlon Moyer mcmoyer Marlon Moyer