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.

Thursday, September 27, 2007

TFS and the pain

We have been using TFS (Microsoft Team Foundation System) at work for Source Control for a few months now; we've run into numerous issues none of which I am going to get into now; this post is really just some notes for my future reference.

if you get into real trouble with TFS the following steps should almost definitely get you back to a fresh place
  • Start -> Programs -> Visual Studio 2005 Tools -> command line
  • tf workspaces
  • - this will show you your workspace name; probably the same as your machine
  • tf workspaces /remove:*
  • - this will remove local system cache of TFS
  • tf workspace /delete /server:{servername} {workspacename}
  • - this will remove from the server
  • - it will prompt you to verify - type in y
  • tf workspace /new /server:{servername} {newworkspacename}
  • - this will launch the GUI to map the server to your local system
  • - server = $/
  • - local = C:\TFS
  • cd C:\TFS
  • tf get
  • - pull down all the files

This maps the root of the TFS server to C:\TFS, you may of course want it mapped to another location on your drive.

Check out tf command on msdn

Friday, September 21, 2007

First Rails Project

so off and on the last month I have messed around with bits of rails stuff; reading books, coding associations, migrations, and installing plugins - oh yeah! ActiveScaffold is very sweet! finally got the integration with FCKeditor and the calendar control working as well; so now I am ready to actually build a web site.

a few years back I built a site for my wife's cycling team. It is a pretty simple site but with data driven content, this seems like a good project to convert over to rails as it will give me a little bit of everything. So here we go...

Day 1 - 2007.09.21 2:00pm

rails nor_cal_velo, add it to svn, create a blank database on mysql, then onto the migrations; already had the database tables pencil sketched on paper, similar to what I had before in the previous site but this time a little simpler as I will be using ActiveRecord (of course) and not stored procedures...

4 hours later: migrations and db created, active scaffold hooked in and up and running for a single controller; but got side tracked trying to push before_create_save event down into a controller base class as I do not wish to duplicate the same code for every controller.
Posted to active_scaffold groups, got to be a way around this
http://groups.google.com/group/activescaffold/browse_thread/thread/58bc7fae33b62a57

going to do some html / css stuff for awhile and get the layout section taken care of then onto more active scaffold controllers

Day 2 - 2007.09.22
spent a few hours tweaking css overrides for active scaffold and figured out the issue with the controller base class see the thread above for the solution. Still have a small glitch with overrides of the Delete function, I am setting the is_active flag to false instead of actually deleting the record, everything works great except the ajax code actually removes the record from the visible list of records, if you refresh the page the inactivated record reappears and is marked as is_active = false as it should be

Side Tracked
Ok, got side tracked messing around with rails and some fun ajax stuff, my first rails project has changed to something much smaller in scope; I'll be back on this project at some point though as long as the day job doesn't consume me...

Saturday, September 1, 2007

Ruby and Rails

Taking a few hours a week to try and learn Ruby and Rails

notes and links for future reference

Books

Ruby and Rails resources

IDE and text editors for Windows

Some notes and code stuff

Ruby Notes - part 1 - dynamic object creation

I am starting to learn Ruby and Rails (just for fun) - took awhile to find a good example of creating an object at runtime given a string representing the objects name; finally came across this post http://www.ruby-forum.com/topic/96222;

in theses 2 examples - given an ActiveRecord object 'Project' and a database table named 'projects', invoke the Project and execute some methods on it

# using eval
def test_dynamic_invoke_with_eval
__object_name = "Project"
__o = eval(object_name)

__p "object name is '" + o.to_s + "'"
__p "object table name is '" + o.table_name + "'"
end



# using Object.const_get
def test_dynamic_invoke_with_object_const_get
__object_name = "Project"
__o = Object.const_get(object_name)

__p "object name is '" + o.to_s + "'"
__p "object table name is '" + o.table_name + "'"
end



Check the ruby forum link above as well - the last entry posted by 'unknown (Guest)'; this is probably the true ruby way to do it? extend the String object with a helper method so you can turn any string into an object? code from that post

# extend String
class String
__def to_class
___Object.const_get(self)
__end__
end