Internet Fame

By kenglish

I’ve been twittered: http://twitter.com/alohaonrails/status/2242129462

categoriaUncategorized commento1 Comment dataJune 19th, 2009
Read All

Example SQL Report with the Ruby Spreadsheet Gem

By kenglish

If you want to create a Excel reports for your users, this can be done rather easily in Ruby using the Spreadsheet Gem.

def spreadsheet_report(excel_filename, worksheet_name, 
                       column_order, result)
    book = Spreadsheet::Workbook.new
    sheet1 = book.create_worksheet :name => worksheet_name
 
    rownum = 0
    for column in column_order
      sheet1.row(rownum).push column
    end
    for row in result
      rownum += 1
      for column in column_order
        sheet1.row(rownum).push row[column].nil? ? 'N/A' : row[column]
      end
    end
    book.write "#{excel_filename}.xls"
 
end

Here’s what the code would like in your rake task

column_order = ["Name", "DOB", "Rank","Hire Date", 
                "Height", "Weight" ]
 
sql =<<-END
  SELECT name AS Name,
   date_of_birth AS DOB, 
   rank AS Rank,
   hire_date Hire Date,
   height AS Height,
   weight AS  Weight
  FROM fire_fighters
  ORDER BY name
END
 
conn  = ActiveRecord::Base.connection
result    = conn.select_all(sql)
 
excel_filename = "FireFighterReport#{Time.year}" 
worksheet_name = "FireFighter Report #{Time.year}"
spreadsheet_report(excel_filename, worksheet_name, 
                   column_order, result)

Now, that’s easy!

Ruby Spreadsheet Gem Documentation

categoriaMysql, Programming commento1 Comment dataJune 17th, 2009
Read All

JavaScript InfoVis Toolkit: THE JIT

By kenglish

Saw a cool post on Ajaxian about a Javascript Toolkit for Data Visualization called JavaScript InfoVis Toolkit . Looks pretty cool. Checkout the demos, I especially dig the pie charts.

categoriaUncategorized commentoNo Comments dataJune 15th, 2009
Read All

JsLint to the rescue

By kenglish

This morning my JavaScript was causing an error in IE 6. The error was : “ERROR: ‘isFormField’ is null or not an object” which makes sense only to one guy at Microsoft who also happens to have collection Sub-Saharan lizards.

I got a hint that it might be a trailing comma somewhere in my JavaScript I stated pasting my code into jslint.com and was surprised at what a useful tool this is. Not only did it help me find my trailing comma, it showed me some other cool fixes I could do to my code.

categoriaUncategorized commentoNo Comments dataJune 8th, 2009
Read All

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?

categoriaMysql, Programming, Tech commento2 Comments dataMay 21st, 2009
Read All

VI key bindings for NetBeans

By kenglish

I’ve moved to NetBeans. Sorry RubyMine but now that I know that Netbeans has a vi plugin, I’m hooked

categoriaUncategorized commento1 Comment dataApril 29th, 2009
Read All

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?

categoriaTech commentoNo Comments dataApril 24th, 2009
Read All

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.

categoriaTech commentoNo Comments dataApril 17th, 2009
Read All

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.

categoriaTech commentoNo Comments dataApril 10th, 2009
Read All

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.

categoriaTech commentoNo Comments dataApril 3rd, 2009
Read All