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.

Tuesday, December 30, 2008

Dilbert Share Point Web Part

I have a love hate relationship with Microsoft Share Point. It has really good integration with Office products but also has a lot of irritating 'features'. Anyhow I knew there had to be a web part out there to get the latest Dilbert comic strip and after a quick Google search I found it!

http://www.nogeekleftbehind.com/2007/11/21/download-daily-dilbert-web-part-for-sharepoint/

no share point portal is complete without it!

Saturday, December 6, 2008

Rails 2.1 and 2.2 documentation

This post is for personal reference, I keep losing track of the url to this great resource. Ruby on Rails guides at http://guides.rails.info/ I think this site launched when rails 2.1 came out, it is still a work in progress but is an extremely valuable resource covering everything from 'getting started', active record associations, security, debugging, the new 2.2 Rails Internationalization API and more.

Ruby on Rails guides at http://guides.rails.info/

Saturday, November 1, 2008

Calling rake tasks from another rake task

This turns out to be pretty straight forward, but was not obvious

Rake::Task['task_name'].execute

A rake task to rebuild the development database
desc 'drop, create and rebuild development db'
task(:rebuild_development_db) do
  puts "drop the db"
  Rake::Task['db:drop'].execute 
  puts "create the db"
  Rake::Task['db:create'].execute
  puts "run the migrations"
  Rake::Task['db:migrate'].execute
  # do other stuff...
end

Resources

Thursday, October 23, 2008

Obama for president

Obama for president, yeah I think this guy should be president



http://www.youtube.com/watch?v=_9OhVMHIuO4

Sunday, October 19, 2008

Assembla to start charging for all private services

well I guess it had to happen sooner or later - Assembla to start charging for all private services

they do offer a great service and the fact that it has been free up until now has been really great!
I can understand why they need to start charging and it still seems very reasonable,
but it would be nicer if it was based purely on disk space instead of per project

read more here

Saturday, October 18, 2008

ActionView::TemplateError uninitialized constant

ActionView::TemplateError (uninitialized constant ActionView::Base::CompiledTemplates::Literals) on line #10 of ...

I just made a silly mistake which was generating this error; I have a Literals class in my Ruby on Rails application that has some strings stored as constants, everything was working great until I put this code on a server (Linux) didn't have any issues on the mac or windows machines before deploying

turned out to be so simple...
I originally named the file Literals.rb which defined the class Literals

the fix: rename Literals.rb to literals.rb

- doh!

Thursday, October 16, 2008

GE Microwaves are junk

my GE Microwave worked great until the one year warranty was up, then it developed this really cool feature where the fan will not turn off - unless...

usually if I have the fan on and want to turn it off, I setting it to off (but it stays on) and then do a quick cook of 2 minutes, 8 out of 10 times this will turn off the fan when it finishes, other times it will turn if I do the 2 minute quick cook again - but that doesn't always work either...

sometimes I have to unplug the thing to turn off the fan, out of curiosity I googled 'GE Microwave fan' and came across this youtube video that pretty much tells the tale





Don't you just love quality products...

Running Scripts on windows cscript vs wscript

what's the difference between cscript and wscript output?
wscript will send output to dialog boxes, cscript will send it to the console (where I want it)

read more here

Saturday, September 27, 2008

scRUBYt

I needed to do some screen scrapping using Ruby, so after a few google searches I came across this post which looked very promising, after a quick scan through the comments scRUBYt looked even better.

stumbling block #1: well it did take me a bit to get it installed, turns out it is currently (0.3.4) hard-wired to use RubyInline 3.6.3, but I had RubyInLine 3.7.0 installed, this post gives the details to work around this issue, otherwise you will get an error something like Gem::Exception: can't activate RubyInline (= 3.6.3), already activated RubyInline-3.7.0].


stumbling block #2: trying the simple example for scrapping google here I got the following error -  can't convert Hash into String. So I tried commenting out some of the code, just limiting it to hit the submit button, the result - no error but no output either? after looking around on the scRUBYt forums turns out scRUBYt logging is not on by default, so turn it on... Scrubyt.logger = Scrubyt::Logger.new and run the code again [ERROR] No extractor defined, exiting... ok, so un-comment the code and run it again now that I have the logging on, same error, I am obviously doing something wrong? try a couple other code samples, more fun error messages - The error occurred while evaluating nil.example_type.

Well it turns out I was jumping ahead because I was calling this code from inside a Rake task. After moving the code into a regular ruby file and calling it using ruby instead of rake everything works just great! I did not look into why this code is failing from inside the rake task but I am guessing there is some conflict with the libraries? an exercise for another day...

Sunday, August 24, 2008

Buy.com and Google checkout doesn't work

Buy.com and Google checkout doesn't work - I don't think I'll be using either product going forward.

I select 3 items, each with free shipping, select check out, select Google Checkout and I am presented with shipping costs none of which says 'Free'

I've used Google checkout a few times before without issue and I've ordered from buy.com before without issue, but after wasting my time with 'false advertising' - no more

I guess I'll go order my stuff from Amazon instead.

Saturday, August 2, 2008

Archipelago Studio Apartments Port Douglas Australia

Archipelago Studio Apartments Port Douglas Australia

72 Macrossan Street, Port Douglas, QLD 4877, Australia

http://www.archipelago.com.au/




View Larger Map

This place was great! Port Douglas is great!



Next to the door is an electric burner not as nice as cooking with gas but good enough to cook in, if you like 


Walk outside the apartments, turn to your left, yes! that is the ocean and the start of four mile beach just a few hundred yards from the apartments

Coral Tree Inn Cairns Australia

Coral Tree Inn Cairns Australia

166-172 Grafton St Cairns North, QLD 4870, Australia
http://www.coraltreeinn.com.au/



View Larger Map

This place is affordable and served its purpose for our two days in Cairns, nothing special 


Hotel George Williams YMCA, Brisbane Australia

Hotel George Williams YMCA, Brisbane Australia

325 George Street Brisbane, QLD 4000, Australia
http://www.hgw.com.au/


View Larger Map

it's a pretty small room but it served our purposes just fine

Medina Grand Harbourside Sydney Australia

Medina Grand Harbourside Sydney Australia

55 Shelley St, King Street Wharf, Sydney NSW 2000

http://www.medina.com.au


View Larger Map


Great place to stay, we didn't get a harbour view but it was very pleasant, full kitchen, in room washer and dryer - it was not cheap but no accommodation in Sydney is?








Wednesday, July 23, 2008

Australia

just got back from a vacation in Australia, some things worth knowing
  • A pitcher of beer is a jug of beer
  • ketchup is sauce
  • standard hotel checkout is 10:00am
  • the people are nice, no worries!
The travel guides we used
more posts

Seriously we had a great time - Sydney, Brisbane, Cairns and Port Douglas


Friday, June 20, 2008

Rant: Exchange drives me crazy!

At work we have a QA Inbox where tons of emails generated by our application are sent, of course nobody ever takes the time to clear it out and even after numerous requests to the IT department to automatically purge anything older then a few weeks it always seems to be really full when I get around to testing some email functionality

This post is just a rant about one thing in particular I really do not like about Exchange and Outlook - why is it so hard to delete email? if exchange would just do this on the server it would save me a lot of time

so here we go - delete all of the 'Older' mail - and there is a lot

oh look not enough memory to delete all that mail? why don't you just do the delete on the server, I don't want to bring local copies of each of them and then delete them?

ok so we select a few thousand at a time, about 1 minute to delete say 2,500 emails - just guessing but there are probably like 10,000 COM+ calls being executed from my workstation across the network to the exchange server for this operation?yeah, so now select another couple of thousand emails - what 'operation failed' - doh! re-open that inbox and try again
so then here we are 36,000 emails deleted later - now we need to purge the Deleted Items



and look at that - only 40 seconds to purge 36,000 emails from the Deleted Items - I guess this part is 'optimized'?



</rant>
.

Sunday, June 8, 2008

Your RSpec on Rails plugin is incompatible with your installed RSpec

just getting into rspec, after reading The Rails Way by Obie Fernandez, a very nice testing framework.

after installing the gems and plugins I ran into this error when trying to run my tests "Your RSpec on Rails plugin is incompatible with your installed RSpec"

a simple workaround, run spec from your local script directory

this one raises the error, because it is running from the ruby gems?
spec spec/models

this one does not raise the error because it is running the locally installed version
from your rails application root
script/spec spec/models
or make the output pretty
script/spec spec/models -fs

the install was as follows
gem install rspec (sudo gem install rspec, on some OS)
script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec
script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec_on_rails

.

Tuesday, May 20, 2008

Ruby on Rails Chron Job

This is just for reference RunnerScript

One option for running scheduled processes for a rails application.

see also HowToRunBackgroundJobsInRails

Monday, May 19, 2008

Free Rice

FreeRice.com

Just came across this site - a good idea and a great cause
Help end world hunger

From their website - http://www.freerice.com/about.html

FreeRice has two goals:

1. Provide English vocabulary to everyone for free.
2. Help end world hunger by providing rice to hungry people for free.

This is made possible by the sponsors who advertise on this site.

Sunday, May 18, 2008

MSSQL drop and re-add constraints

One of the guys at work hooked me up with this code - quite useful if you want to do a bunch of data inserts but don't want to worry about the order you apply the inserts because of foreign key constraints

Before performing data actions:
-- generate these and run
SELECT
'ALTER TABLE ' + so.NAME + ' NOCHECK CONSTRAINT ALL'
FROM sysobjects so
WHERE xtype = 'u'

After performing data actions:
-- generate these and run
SELECT
'ALTER TABLE ' + so.NAME + ' CHECK CONSTRAINT ALL'
FROM sysobjects so
WHERE xtype = 'u'

Thanks to ET for this code bit!

Wednesday, May 14, 2008

SnagIt promotional code (coupon) for $10 off

I have used SnagIt off and on over the past few years, usually with the trial version for a month here and there, finally broke down and got a license.
It runs $39.95 for single user - so I did a quick google search to see if any promotional codes were available and came across one - the promotional code SNUG will get you $10.00 off the standard price. The posting I found for this discount was from 2007 and it is now May 2008 so who knows how long it will be around?

SnagIt is a great tool - if you have never used it I recommend downloading the trial, best screen capture tool ever!

UPDATE 2009-01-07: the promo code SNUG expired on 2008-12-31, bummer; it was great while it lasted!

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!

Monday, March 3, 2008

'vincent-vega' is now 'The Tarantino Project'

The vincent-vega database change management project has been consolidated into the Tarantino project. code is available at http://code.google.com/p/tarantino/ I can't wait to check it out!

Monday, February 18, 2008

First-annual Amgen Tour of California Women's CRITERIUM

First-annual Amgen Tour of California Women's CRITERIUM

First-annual Amgen Tour of California Women's CRITERIUM

Saturday, February 16, 2008

Rails like migrations in the .NET world

I have done a few very small projects with rails; one of the really nice features with rails is database migrations

There are a few ports of rails migrations to the .NET world (that's where I spend alot of my time). I have not used any of these for 'real' but I have 'sampled' them. They all look promising but it seems like there is not very much activity on these projects.

Migratordotnet
http://code.google.com/p/migratordotnet/

RikMigrations
http://www.rikware.com/RikMigrations.html

SubSonic Migrations
I don't know if they ever did incorporate this into the official release of sub sonic? maybe it will come in a future release
http://blog.wekeroad.com/2007/10/03/subsonic-migrate-me/

I recently stumbled across vincent-vega and have begun using it on a small project and am planning to incorporate it into some of our larger applications. It is an Nant task that handles database versioning. It is not a migration in the same way as the other solutions as it uses actual sql scripts for all schema changes instead of c# code, which makes sense to me!

Vincent-Vega
[update 2008/10/14]
vincent-vega is now part of the tarantino project.
http://code.google.com/p/tarantino/
Thanks for the heads up Dan!
[/update]

 

Rhino.Mocks basics

Rhino.Mocks basics - I just threw this together real quick; personal reference material
http://house9-code-samples.blogspot.com/2008/02/rhinomocks-basics.html

The official Rhino Mocks Documentation is very good and available here
http://www.ayende.com/Wiki/(S(33lpuuuz4itdtnjwlncidy55))/Default.aspx?Page=Rhino+Mocks+Documentation

Rhino.Mocks - the basics

Started using Rhino.Mocks recently (Awesome!!!) - just wanted to list a few of the basics; the official Rhino Mocks Documentation is very good and available here. These examples are a bit rough, they have not been compiled; there may be typos.

using
using Rhino.Mocks;

The mock repository
// use the mock repository to create the mocked objects
MockRepository mocks = new Rhino.Mocks.MockRepository();
// example
System.Object someObject = mocks.CreateMock();
// set up the behaviour you want from calls to your mocked object 
Rhino.Mocks.Expect.Call(someObject.Equals(someParameter)).Return(false);
// then don't forget
mocks.ReplayAll();
// now do stuff that calls your mocked object Equals method
...

Mock a call to the db
// create our mocked repository object - IProductRepository, the real one calls the db
IProductRepository repository = mocks.CreateMock();
// tell rhino.mocks when we call the method GetProduct with the argument 33 to return null
Rhino.Mocks.Expect.Call(repository.GetProduct(33)).Return(null);
// get the mocking ready
mocks.ReplayAll();
// pass our mock to our product service layer
ProductService service = new ProductService(repository);
// service.GetProduct makes a call to the mocked repository.GetProduct which will return null
IProduct product = service.GetProduct(33);
// should be null
Assert.IsNull(product);

Ignore any arguments
// any call to GetProduct will return null no matter the value of the arg
Rhino.Mocks.Expect.Call(repository.GetProduct(null)).Return(null).IgnoreArguments();

mock a method that returns void
IProduct product = new Product("003092", "Sierra Nevada", 6.49);
// this void call will handle our product 003092
Rhino.Mocks.Expect.Call(delegate { repository.Save(product); });
// this void call will handle any argument
Rhino.Mocks.Expect.Call(delegate { repository.Save(null); }).IgnoreArguments();

Handle multiple calls to the same method
IProduct product = new Product("003092", "Sierra Nevada", 6.49);
// note the .Repeat.Any()
Rhino.Mocks.Expect.Call(repository.GetProduct("003092")).Return(product).Repeat.Any();
// send the mock to our product service object
ProductService service = new ProductService(repository);
// find by sku calls GetProduct on the mocked Product repository
IProduct beer = service.FindBySku("003092");
// find decent beer calls GetProduct on the mocked Product repository also
IProduct decentBeer = service.FindDecentBeer();

Partial Mock
// create a partial mock with constructor args (our product repository again)
IProductService service = mocks.PartialMock(repository);
// our test case data
IUser loggedOnUser = new User("John", "Doe", CustomerType.Gold);
// mock product service calls to GetLoggedOnUser
Rhino.Mocks.Expect.Call(service.GetLoggedOnUser()).Return(loggedOnUser);
// get the mocking ready
mocks.ReplayAll();
// now GetDiscount is not a mocked method but it does call the mocked GetLoggedOnUser method
decimal discount = service.GetDiscount();
// assert the result
Assert.AreSame(44.4M, discount, "Gold customer discount not correct?");
// NOTE: this will not work (compile) unless the mocked method GetLoggedOnUser is public

SyntaxHighlighter and Google Blogger

Just started using the SyntaxHighlighter on my code samples blog - here is some quick notes on what I had to do

One issue I ran into was that the google blogger automatically adds br tags where newlines appear in any content - makes the code pretty much unreadable, but the fix is well documented and easy to implement - http://code.google.com/p/syntaxhighlighter/wiki/BloggerMode

Sunday, January 6, 2008

mssql reporting services - logs

a while back I had to set up reporting services; most of the errors do not get logged to the event log, instead they are logged to a file:

{drive}\Program Files\Microsoft SQL Server\{instance}\Reporting Services\LogFiles