Tuesday, September 22, 2009

Set Default Terminal Size in Gnome

This was difficult to find. You CAN set the default size of Gnome Terminal. The following instructions apply to Ubuntu 9.04, so your milage may vary:

Open /usr/share/vte/termcap/xterm:
sudo gedit /usr/share/vte/termcap/xterm
Find the line containing :co#80:it#8:li#24:\ (line 10 in Ubunto 9.04)
Replace the 80 with desired column width, and 24 with the desired row height.
Save and close all terminals.

Sunday, August 30, 2009

Lone Star Ruby Conference 2009

I must say that the conference this year was amazing. This is the first time I have been to a Ruby conference. Though I could have easily learned any of the subjects presented myself, the insight and enthusiasm from the speakers gave me better ideas for implementation and more excitement to actually do something.

I have been inspired and now I want to give a talk next year.

I am still stoked from the experience.

Sunday, August 16, 2009

De-Interlace Video in AcidRip

To enable deinterlacing of video when converting DVD video with AcidRip, add the following to the "Post Filters" field under the "Video" tab: "pp=lb"

Saturday, August 01, 2009

Apple Exploits




Hackers are having a seeming field day with Apple products. Between the Apple Keyboard Firmware hack, the Intel processor firmware hack (this one is OS agnostic), and the iPhone SMS hack it's a bad day to be an Apple fanboy or user.



I'll stick to doing my online banking on my Linux machine.

Sunday, July 19, 2009

Must Read Book for Web Developers

Today I got my copy of Programming Collective Intelligence and I wish I had bought this book back when it came out. In my day job, I am developing mostly social networking type sites, and I could have saved days of hair pulling.

Some days it seems as if I am just writing the same old "dumb" web-sites, and I never really understood how other programmers integrated the massive amounts of data we collect every day into a usable and actionable form, both for user and stake-holder. I figured it involved complicated maths that I either don't remember or never took (dotcom college dropout here). Tobey Segaran puts data mining concepts into readable English and sample code.

I never post book reviews, but I am only 3 chapters in, and I love it.

Monday, June 22, 2009

Adium won't connect to Yahoo Messenger

Do you have Yahoo Messenger connection problems with Adium or Pidgin.  The Adium 1.4 beta fixes the issue.  beta.adium.im

More here.

Wednesday, June 10, 2009

View Contents of SSL CSR

openssl req -text -noout -in host.csr

Monday, May 25, 2009

Pushing to a Gitosis Git Repo for the first time

git push origin master:refs/heads/master

Saturday, May 09, 2009

Errors when Running GWT from Eclipse

I was able to get a preview release of the Google AppEngine SDK for Java last week, and finally had an opportunity to play with it. I installed Eclipse on my 64bit Ubuntu Linux box and all the plugins as suggested by Google's Java docs. Everything worked great until I tried to debug the default app as generated by the Eclipse Plugin.
I got an error in the GWT (Google Web Toolkit) packages saying (among other things)

libswt-pi-gtk-3235.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

With a little digging, I found that this was related to 32bit compiled java libraries being run under the 64bit Java runtime. The solution is to install the 32bit Java runtime binary, and instruct Eclipse to use it.

#From Terminal
sudo apt-get install sun-java-6-bin ia32-sun-java6-bin
sudo apt-get remove gij
sudo update-alternatives --config java
# Select the 32bit runtime


From Eclipse go to Window -> Preferences -> Java -> Installed JRE's -> Add -> Standard VM and use the path /usr/lib/jvm/ia32-java-6-sun-1.6.0.13

Now you can Run -> Debug As -> Web Application

Tuesday, April 21, 2009

Rails and form_for() within Partials

This one tripped me up for almost 2 hours.

When using form_for() within a partial, use the variable reference instead of a symbol when specifying the form object. i.e. Use form_for(@user){|user_form|}, instead of form_for(:user){|user_form|}

I was creating a multi-model form with nested attributes using the new Rails 2.3 fields_for semantics, and the nested model field id's didn't have the numbered "*_attributes_0" suffix string. Ruling out syntax errors, I inspected the nested form objects and found that my user_form.object was nil, and thus the form_for method was not assigning the form object. When led me to find that my use of form_for(:user) was broken. form_for(@user) worked perfectly.

My conclusion may be incorrect, but it appears that using a symbolic reference as an object attribute for form_for() within a partial is broken.

The moral of the story is, just use the variable reference.

Saturday, March 28, 2009

Capistrano deploy.rb for Git and Phusion Passenger

Here is my Capsitrano deploy.rb script/recipe for use with Git repos on servers powered by Phusion Passenger (mod_rails).

http://gist.github.com/87207

Friday, January 09, 2009

Telnet SMTP Escape Character

When connecting to an SMTP server via telnet (i.e. telnet mail.example.com 25), you will be informed that "Escape character is '^]'." This means you need to press CTRL-] (control plus right-bracket)

I am embarrassed how long it took me to realize that.

Sunday, January 04, 2009

MySpace Mobsters Calculator and Strategy Helper

I wrote a Mobsters helper this weekend to help in choosing the best weapons configuration. Enjoy!

I am liking Google AppEngine so far, and this weekend project has really put me onboard with jQuery.

Friday, December 05, 2008

Error Updating RubyGems

If you get the following error:
undefined local variable or method `remote_gemspecs’

Then run:
sudo gem install rubygems-update
sudo gem update

Set JAVA_HOME on Mac OSX

If you want to install the rjb Ruby Gem, you will need to set the JAVA_HOME environment variable.

Add the following line to ~/.login or /etc/profile and restart your terminal.

setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home

Tuesday, October 21, 2008

Rails Application in A Subdirectory

If you want to have a Rails application work under a subdirectory, as in http://www.example.com/rails_app , then add this line to your config/environment.rb.

ActionController::AbstractRequest.relative_url_root = "/rails_app"

Thursday, October 16, 2008

Using Ruby Java Bindings on Dreamhost

Getting rjb, also known as "Ruby Java Bindings' to work in a Dreamhost account can be somewhat problematic. Fortunately, it is also fairly straightforward. You just have to install all the dependencies in the user directory.

In my case, I was setting up a Rails Application that used the iText Java library to fill in PDF documents for user download. Of course, the server environment was not using Sun Java and the Java headers were not present, so gem install rjb failed. Joy.

The first course of action was to do a local install of Java.

Download jdk-6u7-linux-x64.bin and jre-6u7-linux-x64.bin from the Sun Java site. Then create an ~/opt directory and extract the JRE and JDK (you will need to chmod u+x both files then call them from the command line). Move the resulting folders to ~/opt . I renamed the folders to jdk and jre for simplicity.

Now you ensure that user gems are enabled in cPanel. Then add the following 3 lines to ~/.bash_profile

export JAVA_HOME=/home/username/opt/jdk
export GEM_PATH=/home/username/ruby/gems
export GEM_HOME=/home/username/ruby/gems

Run source ~/.bash_profile to load the paths.

Now you can run gem install rjb without any problems. You will likely have to re-install Rails and other gems because we will be telling our Rails app to load gems from the user directory. Just use the regular gem install syntax.

Add the following 2 lines to your config/environment.rb at the top

ENV['GEM_PATH']='/home/username/ruby/gems'
ENV['JAVA_HOME']='/home/username/opt/jdk'

That's pretty much it.

I will concede that these probably aren't the best instructions, but this is the real meat of the solution. If you keep getting "no such file to load" errors, you will need to extract the gems to the vendor/plugins directory. cd RAILS_ROOT/vendor/plugins and gem unpack gem_name for each problematic gem. I believe this is an issue with Passenger.

Please correct me if I am wrong about any of this, it was a very long day!

A big thank-you to the Planet

Thanks for getting hacked, you made my day a whole lot more interesting!

Saturday, September 27, 2008

Problems with IE7 Sessions Not Saved in Rails or PHP

If you are unlucky, your login routine will work in Firefox, Internet Explorer 6, Safari, Opera, or whatever, but it won't persist in Internet Explorer 7. x

I spent days on this one: Login worked great in Firefox, but in IE7 the same credentials resulted in a page that looked like I never attempted to log in. The logs showed me that the user credentials were accepted and the page redirected as expected, but the subsequent page load was absent any sign that I logged in.

Well, check your subdomain. You can't have an underscore in a subdomain. http://support.microsoft.com/kb/909264

In this instance, IE7 is inconsistently supporting standards. The browser will accept a badly formatted domain and show you the page in your browser, but will refuse to set the session cookie. Firefox and Safari are not quite so strict.

Thursday, July 03, 2008

Rails: Get controller route hash from url string

This is somewhat uncommon, but to get the routing hash from a URL string:

ActionController::Routing::Routes.recognize_path('/users/1')
# => {:controller => 'users', :action => 'show', :id => '1' }