<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>JustinBKay.org - initio</title>
  <id>tag:justinbkay.org,2010:mephisto/</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://justinbkay.org/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://justinbkay.org/" rel="alternate" type="text/html"/>
  <updated>2010-04-21T22:17:55Z</updated>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2010-04-21:397</id>
    <published>2010-04-21T22:14:00Z</published>
    <updated>2010-04-21T22:17:55Z</updated>
    <category term="ruby"/>
    <link href="http://justinbkay.org/2010/4/21/jruby-jtds-to-ms-sql-server" rel="alternate" type="text/html"/>
    <title>jRuby jtds to MS SQL Server</title>
<content type="html">
            Here's an example of connecting to SQL Server using jRuby with the jtds driver:

&lt;pre&gt;
include Java
require 'jruby-1.4.0/lib/jtds-1.2.5.jar' # path to driver jar file

module JavaSql
  include_package 'java.sql'
end

begin
  import 'net.sourceforge.jtds.jdbc.Driver'
  conn = JavaSql::DriverManager.getConnection(&quot;jdbc:jtds:sqlserver://192.168.0.31:1433/database&quot;,&quot;username&quot;,&quot;password&quot;);
  stmt = conn.createStatement
  rs = stmt.executeQuery(&quot;select * from Property&quot;)
  while (rs.next) do
    puts rs.getString(&quot;scode&quot;)
  end
  rs.close
  stmt.close
  conn.close()
rescue JavaLang::ClassNotFoundException
  puts &quot;ClassNotFoundException&quot;
rescue JavaSql::SQLException
  puts &quot;SQLException&quot;
end

&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-12-21:361</id>
    <published>2009-12-21T18:27:00Z</published>
    <updated>2009-12-21T18:28:05Z</updated>
    <category term="Ruby"/>
    <category term="Ruby on Rails"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="ubuntu"/>
    <link href="http://justinbkay.org/2009/12/21/rails-on-ubuntu-9-10-with-ruby-1-9-1" rel="alternate" type="text/html"/>
    <title>Rails on Ubuntu 9.10 with Ruby 1.9.1</title>
<content type="html">
            &lt;p&gt;Here's a short list of what I needed to get Rails 2.3.5 running on Ubuntu 9.10 with unixodbc support on Ruby 1.9.1&lt;/p&gt;
&lt;pre&gt;
install ubuntu 9.10

sudo apt-get install ssh libssl-dev libreadline5-dev git-core mysql-server pdftk zlib1g zlib1g-dev libmysqlclient16-dev haproxy unixodbc unixodbc-dev freetds-common freetds-dev tdsodbc nginx freetds-bin postfix

install ruby1.9.1 from source
	ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz

update rubygems sudo gem update --system

http://wiki.rubyonrails.org/database-support/ms-sql
ruby-odbc from source
 	http://www.ch-werner.de/rubyodbc/ruby-odbc-0.9997.tar.gz

sudo gem install rails mysql prawn vpim activerecord-sqlserver-adapter dbd-odbc dbi daemons

configure unixodbc and freetds, and haproxy and nginx

install mongrel gem 1.1.6 
	sudo gem install mongrel --source http://gems.rubyinstaller.org

need to add self signed cert
	https://help.ubuntu.com/8.04/serverguide/C/certificates-and-security.html

add deploy user and certificates for git repo etc.
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-09-14:360</id>
    <published>2009-09-14T20:32:00Z</published>
    <updated>2009-09-14T20:34:53Z</updated>
    <category term="misc"/>
    <category term="development"/>
    <category term="mysql"/>
    <link href="http://justinbkay.org/2009/9/14/mysql-order-by-regexp" rel="alternate" type="text/html"/>
    <title>MYSQL order by regexp</title>
<content type="html">
            &lt;p&gt;So, today I found that you can use regular expressions in the order by clause in MySQL.  I'm using this for a field that can be either number, alpha, or a mix.
&lt;br /&gt;
This is what is looks like.  I'm saying that if the number starts with 0 - 9 then add 0 and it sorts like a number, otherwise, just sort on the alpha.
&lt;pre&gt;

'if(number REGEXP \'^[0-9]\',number + 0, number)'

&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-08-03:359</id>
    <published>2009-08-03T22:24:00Z</published>
    <updated>2009-08-03T22:28:27Z</updated>
    <category term="misc"/>
    <category term="bsu"/>
    <category term="BSU"/>
    <category term="iphone"/>
    <link href="http://justinbkay.org/2009/8/3/bsu-football-iphone-app" rel="alternate" type="text/html"/>
    <title>BSU Football iPhone app</title>
<content type="html">
            &lt;p&gt;I recently got my first iPhone app published to the app store.  It is an extension of my broncodashboard.com site.  It has the schedule/results, the team roster, and it displays the rss feed of the IdahoStatesman.com BSU football coverage.  I'm pretty excited to finally have it out there.  It was fun putting together an app that I will use and that I hope other people will use too.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-06-19:355</id>
    <published>2009-06-19T22:47:00Z</published>
    <updated>2009-06-19T22:49:14Z</updated>
    <category term="development"/>
    <category term="git"/>
    <link href="http://justinbkay.org/2009/6/19/push-local-git-branch-to-server" rel="alternate" type="text/html"/>
    <title>Push local git branch to server</title>
<content type="html">
            &lt;p&gt;I always forget how to do this&lt;/p&gt;
&lt;pre&gt;git push origin &amp;lt;new_branch_name&amp;gt;:refs/heads/&amp;lt;new_branch_name&amp;gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-03-21:346</id>
    <published>2009-03-21T04:27:00Z</published>
    <updated>2010-05-17T17:17:37Z</updated>
    <category term="misc"/>
    <category term="deployment"/>
    <link href="http://justinbkay.org/2009/3/21/haproxy-to-smooth-things-out" rel="alternate" type="text/html"/>
    <title>HAProxy to smooth things out</title>
<content type="html">
            &lt;p&gt;For a long time I've run a rails app behind nginx with 3 mongrels in a round robin configuration.  It has worked for me pretty well.  Recently I've added a few longish running reports and doubled my user count, and I've seen some sluggishness on my app.  The issue is not that the 3 mongrels can't handle the load, the issue is that sometimes the requests get stacked up behind the long running process when there may be a couple of free mongrels just sitting there.&lt;/p&gt;
&lt;p&gt;This is where HAProxy comes into the picture.  HAProxy is an open source tcp/http load balancer.  The magic that it gives us is the ability to only allow one connection at a time to our mongrels.  So, if we have one long running process going, that mongrel will be skipped and the other 2 will be used until the first frees up.  I've just started using this, but I think that it is making a difference already.  You can watch a &lt;a href=&quot;http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy&quot;&gt;nice screencast from Mark Imbriaco of 37 signals&lt;/a&gt; on this approach.&lt;/p&gt;

&lt;p&gt;My setup:&lt;br /&gt;
nginx ----&gt; HAProxy ----&gt; mongrels
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-03-15:343</id>
    <published>2009-03-15T16:35:00Z</published>
    <updated>2009-03-15T16:35:51Z</updated>
    <category term="Ruby"/>
    <link href="http://justinbkay.org/2009/3/15/mountainwest-rubyconf" rel="alternate" type="text/html"/>
    <title>MountainWest RubyConf</title>
<content type="html">
            &lt;p&gt;Was MountainWest RubyConf awesome?  You be the judge:&lt;/p&gt;

&lt;img src=&quot;http://img.skitch.com/20090315-n1h2y34i2c656icbu51edt4cxk.jpg&quot; /&gt;

&lt;p&gt;
Special Thanks to Mike Moore and Pat Eyler for putting on a great conference.  The speakers were great and the atmosphere was top notch.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-03-03:342</id>
    <published>2009-03-03T18:41:00Z</published>
    <updated>2009-03-03T18:57:12Z</updated>
    <category term="Ruby"/>
    <category term="Ruby on Rails"/>
    <category term="capistrano"/>
    <category term="development"/>
    <link href="http://justinbkay.org/2009/3/3/cap-deploy-web-enable" rel="alternate" type="text/html"/>
    <title>cap deploy:web:enable</title>
<content type="html">
            &lt;p&gt;I have finally decided to start putting up a warning page when doing maintenance on one of my sites.  I decided that I wanted to use capistrano to get the job done.  I checked the cap -T task list and noticed that there was already one there.  It was pretty bleak looking so I decided to just roll my own page and put up a task to change the filename when needed and it would be picked up by nginx and displayed.  I made up a page and put in on my production server under the system folder in the shared path and named it m.html.  I then wrote up a couple of cap tasks to manage the renaming of the file and put them into my deploy.rb file:
&lt;/p&gt;

&lt;pre&gt;
desc &quot;Turn on Maintenance Mode&quot;
task :maint_on, :hosts =&gt; @web do
  run &quot;mv #{shared_path}/system/m.html #{shared_path}/system/maintenance.html&quot;
end

desc &quot;Turn off Maintenance Mode&quot;
task :maint_off, :hosts =&gt; @web do
  run &quot;mv #{shared_path}/system/maintenance.html #{shared_path}/system/m.html&quot;
end
&lt;/pre&gt;

&lt;p&gt;
disclaimer: there is probably already a way to do this using the original deploy:web:enable, but I didn't want to figure it out.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2009-02-23:339</id>
    <published>2009-02-23T21:28:00Z</published>
    <updated>2009-02-23T21:32:01Z</updated>
    <category term="Family"/>
    <category term="misc"/>
    <link href="http://justinbkay.org/2009/2/23/family-directory" rel="alternate" type="text/html"/>
    <title>Family Directory</title>
<content type="html">
            &lt;p&gt;
I decided to do a little experiment.  I've written a little web application to be used as a family directory for the people on my mothers side of the family.  So far, there has been a lot of support by the potential userbase, but I wonder if it will actually be used.  The challenge might be to make is easy enough to use that it actually gets used.  
&lt;p&gt;
The other question is will there be enough peer pressure to get everyone on it.  I'm hoping for the best.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-12-12:332</id>
    <published>2008-12-12T23:14:00Z</published>
    <updated>2009-09-28T17:53:38Z</updated>
    <category term="misc"/>
    <category term="mydaddypuzzles"/>
    <link href="http://justinbkay.org/2008/12/12/mydaddypuzzles-and-extreme-makeover-home-edition-update" rel="alternate" type="text/html"/>
    <title>MyDaddyPuzzles and Extreme Makeover Home Edition update</title>
<content type="html">
            &lt;p&gt;Just posted a couple of pics from the final setup of the Extreme Makeover Home Edition puzzles.  You can see them &lt;a href=&quot;http://mydaddypuzzles.com/puzzle/extreme_makeover/&quot;&gt;here&lt;/a&gt; towards the bottom of the page. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-12-12:331</id>
    <published>2008-12-12T19:27:00Z</published>
    <updated>2008-12-12T19:31:32Z</updated>
    <category term="flex"/>
    <category term="development"/>
    <category term="flex"/>
    <link href="http://justinbkay.org/2008/12/12/gene-harris-project" rel="alternate" type="text/html"/>
    <title>Gene Harris Project</title>
<content type="html">
            &lt;p&gt;The Adobe Group that I belong to is doing a little project for the Gene Harris Jazz Festival.  We are making a little Flex Application for the display of Artists and some of their Media.  I finally got the first bit of work done on this project.  I created a datagrid for the display of the Artist, with their picture and Bio.  And started on something to add and edit the artist info.  This is part of the backend of the application, so it won't be seen by anyone.  Hopefully I'm on the right track.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-09-25:255</id>
    <published>2008-09-25T19:36:00Z</published>
    <updated>2009-02-14T21:49:42Z</updated>
    <category term="misc"/>
    <category term="bsu"/>
    <category term="BSU"/>
    <link href="http://justinbkay.org/2008/9/25/scores-on-broncodashboard-com" rel="alternate" type="text/html"/>
    <title>Scores on BroncoDashboard.com</title>
<content type="html">
            &lt;p&gt;I've added a new page to broncodashboard.com.  I'm grabbing scores for the WAC games and other teams that I find interesting so that I can check them in one place.  It is kind of a personal scoreboard, but I thought I'd put it out there for the general consumption.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-09-17:185</id>
    <published>2008-09-17T16:23:00Z</published>
    <updated>2008-10-13T20:02:26Z</updated>
    <category term="misc"/>
    <category term="Ruby on Rails"/>
    <category term="development"/>
    <link href="http://justinbkay.org/2008/9/17/mydaddypuzzles-and-extreme-makeover-home-edition" rel="alternate" type="text/html"/>
    <title>MyDaddyPuzzles and Extreme Makeover Home Edition</title>
<content type="html">
            &lt;p&gt;
MyDaddyPuzzles are being used in the upcoming Season Premier of Extreme Makeover Home Edition.  You can read about it &lt;a href=&quot;http://mydaddypuzzles.com/puzzle/extreme_makeover&quot;&gt;here&lt;/a&gt;. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-09-16:183</id>
    <published>2008-09-16T15:10:00Z</published>
    <updated>2008-10-14T16:08:26Z</updated>
    <category term="Ruby on Rails"/>
    <category term="deployment"/>
    <link href="http://justinbkay.org/2008/9/16/rails-nginx-and-ssl" rel="alternate" type="text/html"/>
    <title>rails, nginx, and SSL</title>
<content type="html">
            &lt;p&gt;
This week I decided to buy an ssl certificate to start using with one of my websites.  The site is running Rails 2.1.1, behind &lt;a href=&quot;http://wiki.codemongers.com/Main&quot;&gt;nginx&lt;/a&gt; as a reverse proxy.  It was a learning experience to be sure and I'll try to document some of the steps that I had to take to get it working.  
&lt;/p&gt;

&lt;p&gt;
The first trick was getting the ca-bundle.crt file to be served by nginx.  This is the intermediate ca file that allows browsers to recognize your certificate authority.  The trick is to concatonate your certificate file and the ca-bundle.crt file and then place them on the webserver.  I found that tidbit &lt;a href=&quot;http://hostingfu.com/article/godaddy-turbossl-certificate-nginx&quot;&gt;here&lt;/a&gt;.  With Apache, you have a server directive for the ca-bundle file so this step is not necessary.
&lt;/p&gt;

&lt;p&gt;
The next trick was to get nginx to let the rails app know what protocol was being used when requests came in using ssl.  The magic is this line in the nginx.conf file &lt;pre&gt; proxy_set_header X-FORWARDED_PROTO https; &lt;/pre&gt; which I found &lt;a href=&quot;http://rubyjudo.com/2006/11/2/nginx-ssl-rails&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
You also need to install the ssl_requirement plugin: &lt;strong&gt;ruby script/plugin install ssl_requirement&lt;/strong&gt;.  Which you can read about &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/HowToEnableSSL&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Last, but not least, you need to tell nginx to turn on ssl and let it know where your certificates are, which is documented &lt;a href=&quot;http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-nginx-ssl-and-vhosts&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
That should about get you going with nginx, rails, and 3rd party ssl certificates.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://justinbkay.org/">
    <author>
      <name>justin</name>
    </author>
    <id>tag:justinbkay.org,2008-09-10:178</id>
    <published>2008-09-10T16:25:00Z</published>
    <updated>2008-10-03T17:27:45Z</updated>
    <category term="Ruby on Rails"/>
    <category term="development"/>
    <link href="http://justinbkay.org/2008/9/10/ical-is-back" rel="alternate" type="text/html"/>
    <title>ical is back</title>
<content type="html">
            &lt;p&gt;
I found a free host for the iCal calendar of the broncodashboard.com iCal.  So, it has been added back onto broncodashboard.com.  I also added a scoreboard page that auto-updates with some WAC scores as well as some other teams that I like to follow.  I used Hpricot, the Ruby library to gather the scores from espn.
&lt;/p&gt;
          </content>  </entry>
</feed>
