The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Saturday, May 10, 2008

Rolling Over Rails production.log file

Just came across this on a rails forum (post by Freezzo), rails production.log files can grow very large - but no chron job required - this is very handy.

config.logger = Logger.new("#{RAILS_ROOT}/log/#{ENV['RAILS_ENV']}.log", 'daily')

where 'daily' can be 'daily' to 'weekly', 'monthly', '5mb', etc...

Python MVC web framework - web2py

Recently I did a google search for a Python MVC web framework. I have never done any coding in Python but it seems to be one of the primary languages used at Google and currently the only language supported on the Google App Engine so it seemed worth getting familiar with.

Django seems to be one of the most robust python mvc frameworks around at this time and I was going to dive in and create a small toy application with it, but then I stumbled across a comment on some blog that talked about the web2py MVC framework, still in it's infancy, development is very active on the project. It seems very easy to get up to speed with the framework and even someone who does not know Python can get a simple site up and running.

I love this graphic from one of the pdfs on the site

The feature list taken directly from the site
  • No installation, no configuration, no dependencies. All in one package. You can run it off a USB drive
  • Runs on Windows, OSX, Unix/Linux, and Windows CE phones.
  • Allows development, debugging, testing, deployment, maintenance and administration, including database administration, via the provided web interface.
  • Enforces good Software Engineer practices, like the Model-View-Controller design, validation and self-submission of forms.
  • Strong on security. Prevents the most common types of vulnerabilities: Cross Site Scripting, Injection Flaws, and Malicious File Execution.
  • Talks HTML, XML, RSS, ATOM, AJAX, JSON, RTF, CSV, WIKI, XML-RPC, REST, Flash, etc.
  • Dynamically and transparently generates SQL queries for you for SQLite, MySQL, PostgreSQL and Oracle. Even creates and alters tables for you when required. Performs automatic transactions.
  • Allows you to create apps easily, byte-code compile them, and distribute them in open or closed source under any license you like.
  • Faster then the competition, designed for small as well as large projects, includes the ability to upload/download/stream large files, internationalization support, distributed transactions, ...
Web2py is worth checking out!

.

Saturday, May 3, 2008

Komodo Edit - new text editor of choice for Ruby on Rails

Komodo Edit is my new text editor of choice for ruby and rails stuff. I use windows OS and have tried alot of different editors and IDEs; most of the IDE are too slow for my tastes and I have been using an alpha version of InType or NotePad++ for any Rails development.

This product is free and available from ActiveState. Note that there is also Komodo IDE which is a full blown IDE and is not free. I have not tested out that product but may in the future.

Go to http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml click the 'Get Komodo Edit' button, ignore the contact details form, it is optional and kind of annoying? Click Continue to download, there are versions for Mac, Linux and Windows.

After installing the MSI package I only needed to make a few minor tweaks to my preferences
First things first, create a new 'Project' (File -> New -> New Project), just point to one of my existing rails applications and save the kpf file in the root. Then I actually want to see the files so View -> Tabs -> Projects


And a few tweaks; get rid of that right hand edge line, not a big fan. Edit -> Preferences -> Smart Editing -> uncheck 'Show edge line / Hightlight characters beyond...' ok - i have been converted to the dark side so, Edit - Preferences -> Fonts and Colors -> select Dark from the Scheme, bump the font size to 12 and go bold - you will be prompted to give this new scheme a name


bada bing bada boom - we are good to go

Thursday, April 24, 2008

Update: FireFox and multiple cookies for the same site

well after a few days with CookieSwap it seems a bit buggy, basically if you open two browser instances and then switch the CookieSwap profile it is updating both browser instances making it somewhat useless?

so I did some more googling and now using this technique

Initial Setup
- close all instances of firefox
- Start -> Run -> firefox.exe -ProfileManager
- create 5 or so profiles, I named them p1 - p5

Then when you want to use different profiles launch each one from the command line
- Start -> Run -> firefox.exe -P p1 -no-remote

each profile is totally distinct (history, cookies, etc...), only issue there does not seem to be an easy way to tell which profile you currently have open, I think I can live with that

Sunday, April 20, 2008

NAnt build with TFS changeset as revision number

This code sample is a nant script that
  • deletes the CommonAssembly.cs file (linked to all projects)
  • uses the nant asminfo task to recreate the CommonAssembly.cs file, but after we query TFS for the changeset (revision) number which is used in the version number
  • build the solution in release mode using the ide.exe (there are other - better ways, but this one works)
  • xcopy files to C:\temp\{app} and clean up all the source files

basically I just put together a few bits that I found on other blogs (should have saved the urls - doh!), most were related to using svn for source control and then I added in the code block for the c# stuff to query TFS.

A quick note about the linked CommonAssembly.cs file, visual studio has an option when you are adding an existing file to a project to select 'linked', click the arrow on the 'Add' button when you select your existing file

what this script does not do - get latest from TFS, I usually do that part manually or from ccnet



the c# bit that goes in the nant script block above
NOTE: see updated version of this code block



nant is awesome!

FireFox and multiple cookies for the same site

I like FireFox but still use IE most of the time; one of the main reasons is during web application development I need to login to the same web application as different users at the same time, switching back and forth between each user account. IE makes it easy just open a new instance for each individual user account.

In the past I tried to find a solution for FireFox, but always came up short. Well today I did a google search and came up with two different ones!

both are FireFox extensions

after a quik spin with both I am liking CookieSwap better

With CookiePie you right click on the individual tab to toggle seperate cookie sessions on or off; just didn't have good luck using it the way I would do stuff with IE

With CookieSwap you right click in the lower right hand status bar area of FireFox and can toggle between named profiles (default is Profile1, Profile2, Profile3) - this worked right out of the box as I would expect!