Thursday, September 01, 2005
@echo off
call :timer start
dir
call :timer
goto :eof

:timer
if /i "%1"=="start" set timer=
for /f "tokens=2-5 delims=:,." %%a in ('echo.^|time^|find /i
"current"') do (
  set hh=%%a
  set /a mm=1%%b-100,ss=1%%c-100,dd=1%%d-100
)
set /a hh=1%hh:~1,2%-100,timer=hh*3600000+mm*60000+ss*1000+dd*10-timer
if /i not "%1"=="start" echo elapsed time = %timer% msec
goto :eof

:eof

alt.msdos.batch.nt as posted by Garry Deane
Thursday, September 01, 2005 1:15:18 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Friday, August 19, 2005
Once again, Joel is a great resource.

In this article he links to the project specs for Aardvark which is a remote help system that you can use to help your aunt get her pc working again (if she can connect to the internet).  The product itself looks nice but I'm more interested in the spec itself at this point because of the best practice gems it contains.

Example 1:  Use CSS for formatting but tables for layout because CSS layout support is so buggy in modern browsers.  This is especially true if you have to support multiple browsers.  Trying to lay this out with div's can be an extreme exercise in patience. 

There are other examples such as making the user experience as simple and easy as possible.  Don't make the user answer unnecessary questions that they don't know the answer to anyway. 

It's worth a read, especially if your looking for modern web best practices as many sites out there are still publlishing information from 1999-2000.

Friday, August 19, 2005 12:00:53 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Tuesday, August 09, 2005

This is a great tip as rsync is super fast and can work both ways.  But rsync is too good just to be a *nix only utility.  There is also a Windows version available from ITeF!x that installs cygwin, ssh and all the other goodies to get you going on the Windows side.  

Follow the installation instructions and you shouldn't have any problems.  

To make life easy I added the default install directory (C:\Program Files\cwRsync\bin) to my path.  I also added a couple of system variables for cygwin: CYGWIN = nontsec and HOME = c:\path\to\home\directory.  

Once you have rsync downloaded an installed you can alter the code above slightly to work on a Windows system.

desc "Deploy basic application directories"
task :deploy => :environment do
  dirs = %w{ app lib test public/images public/stylesheets public/javascripts db}
  dirs.each do | dir|
   onserver = "username@yourdomain.com:/home/username/web/"
   local = "/cygdrive/c/rails_app/" + dir
   cmd = "rsync -arvz -e ssh #{local} #{onserver} --exclude \"*.svn*\" --exclude \"*~\" "
    
   puts cmd
   rsync = IO.popen(cmd, "r")
   while line = rsync.gets
   end
   rsync.close     
  end
end


Notice that in the local assignment I'm not using "#{RAILS_ROOT}/".  This is because of the way cygwin has to access the NT (or FAT I suppose) file system.   "/cygdrive/c/rails_app/" evaluates to "c:\rails_app".  Notice also that I added another exclude for files ending with ~.  This is because I use VIM and it leaves these files all over and I haven't gotten around to another solution but this should serve as an example of how to exclude other file types.

Once last piece of goodness.  If you're using Textdrive (and why wouldn't you?) then you can set up certificates to authenticate with rsync instead of a password.  

Here's how it works.  Open a command prompt.  If you've added C:\Program Files\cwRsync\bin to the path then the ssh command should be available from the command line.  

Type this:

ssh-keygen -d

You will be prompted to save the key to a file.  Choose a location otherwise it will default to the value in your $HOME + \id_dsa.  When prompted for a passphrase you can leave it blank.

Now upload the *.pub file you just created to Textdrive into your  /home/username/.ssh directory and rename it to authorized_keys if this file doesn't exist otherwise copy the contents of your file into  the end of the authorized_keys file.  

Once this is done you know have a way to authenticate yourself via certificate from your machine to the Textdrive server.  This means that when you run the "rake deploy" command you won't be prompted for a password each time because you are authenticating via public/private keys.


Tuesday, August 09, 2005 10:25:37 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
Paul Graham seems to be an incredibly smart guy.

Here’s an article that covers a wide gamut of issues many of which I’ve pondered and I have to say I admire the way in which he has laid out this article and the coherent stream of consciousness it presents.

Essentially, it’s hard to work in offices, which I whole heartedly agree as I get the lion’s share of my work done at night after my wife has gone to bed and the house is quiet.  He also writes about the fact that people will work hardest for themselves and more importantly their idea and ideals. 

The idea that most intrigued me was the employer-employee paternal relationship and its implication of justice.  In other words an employer is obligated to take care of the employee and this makes the employee behave like a teenager, tugging at the reins of control imposed on him/her and resenting the cozy embrace of the parent’s house and rules.  His example of postal employees is dead on. 

Well worth the read but set aside 15 minutes of quiet time (if your office allows for such a thing) and read it.

Tuesday, August 09, 2005 9:35:04 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Saturday, August 06, 2005
Open your config/environment.rb and place this line someplace after the # Include your app's configuration here: comment.

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:tmpdir] = "#{RAILS_ROOT}/sessions/"

In this example if my application (on Windows) looks like this:
   
root/
    app
    config
    ...
    sessions

Then when you restart webrick or whatever web server you should see session data populate in the root/sessions folder.  This is an easy folder to access for session clean up if need be.

In production you could set up a task in cron or task schedule to delete these files periodically.
 | 
Saturday, August 06, 2005 3:54:02 PM (Central Standard Time, UTC-06:00)  #    Comments [0]

One thing that I love about Ruby on Rails is the fact that I can concentrate on adding functionality without the hassles I used to have with ASP.NET.  I just downloaded the search generator (gem install search_generator) which allows me to add a simple search feature to my site and even integrate some of the features from OpenSearch (http://opensearch.a9.com/). 

Once again the generators usually provide simple code generation which generates models, views, helpers or controller classes etc which you can then extend to your heart’s desire.  Usually the generators integrate or weave some feature into your application that just makes your life much easier. 

The beauty of rails is that you KNOW where things are at.  Where’s the business logic?  Controllers or Models.  Where’s the display logic?  Helpers or Views.  And it’s the same with each app. No need to scrounge around an inconsistent application looking for bits and pieces of some functionality. 

Rails is a shining example of some best practices and some pragmatic ideas combined with patterns and OOP to make one heck of a productive application. 

Saturday, August 06, 2005 3:45:20 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Friday, August 05, 2005
I uploaded my latest project to http://Textdrive.com the other night and at first I was disappointed with the response speed.  Then I remembered I was using cgi instead of fcgi.  I made the config change and the speed blew me away.  I’m used to ASP.NET application speed and the usual compile and load time each page normally takes.  Also with WEBrick I was used to a slower response time.  All I can say is that the UI was nice and zippy and just felt good. 

It’s one of those times when something surpasses your expectations.  Textdrive is a pretty good host and I recommend them.  I’ve had quite a few hosts to this point and I have to say their tech support has been great.  They also support the Ruby on Rails project which is great also. 

So far I’m enjoying life on the rails.

Friday, August 05, 2005 7:22:33 PM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Wednesday, August 03, 2005
I'm working right now on creating a service that operates on messages with javascript.  The service is java and javascript makes a natural choice since almost everyone has to use javascript these days for that pesky web development. 

I'm using the Rhino package from Mozilla.  Right now I'm very impressed with the ease of use of this package. 

The main driver behind this is processing plain text.  Plain text just can't be changed to XML via XSLT.  So obviously a nice scripting language could manipulate the message to add tags and parse for naughty characters that XML doesn't like. 

I will post on how this turns out.
 | 
Wednesday, August 03, 2005 9:52:21 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Wednesday, July 27, 2005
Again taking inspiration from Joel:

http://www.joelonsoftware.com/news/20020715.html

Major point of article:  Coders in large shops are often rewarded for writing lots of buggy code and then swooping in at the last minute to fix their own mess and make themselves the hero.

I worked with a guy; let's call him Squirrels, who was just this kind of coder.  He would churn out volumes of code.  Whereas some coders progressively improve their craft, this guy progressively randomized his output.  You could tell when he read a new article in MSDN because that code would go into his project.  Most programmers are somewhat guilty of this but this guy was the extreme.  He would try out something new and cool (or not so cool) while neglecting the basics of simplicity and readability let alone the niceties of error handling and maintainability. 

He would race ahead of his disasters, making junior programmers responsible for fixing his messes and then moving from Visual Basic to web development to database development and management seemingly just to avoid having to work on his own evil machinations.

I learned a valuable lesion, more != better and quality is sometimes hard to quantify especially for a little bald dude with a Napoleon complex and an ex-auto mechanic turned axe-man.  But that’s another post…




Wednesday, July 27, 2005 9:36:41 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
Man this guy has a way of saying things:

http://www.joelonsoftware.com/articles/HighNotes.html

I wonder why I stay up till 1 am making that last tweak to polish the UI.  I'm hoping to hit the high note...
Wednesday, July 27, 2005 9:14:36 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
 Friday, July 08, 2005
I've been thinking seriously about business oppurtunities and for some reason there is a general conception among many people that a business idea has to be new and original.  I've got news for ya' brotha' there ain't nothing new under the sun.  Well there is but the these ideas are few and far betweena and they are mostly improvements on old ideas. 

Hence the point of this post.  Pick a business, fiind a way to do it better, faster, cheaper etc then make money.  Recently I read an article that reinforced this belief:

http://www.joelonsoftware.com/articles/AardvarkMidtermReport.html

Joel came up with an idea for an improved remote computer assistance software.  The key word is improved, not new, just better. 

Now to the point, I've been kicking around the idea of a sort of cross bread between a certain electronics shack, a certain big box store and a cell phone dealer. 

We will handle small personal electronic items and networking of digital appliances whether these are cell phones, pda's, pc's or a fridge that has a NIC card.  The emphasis is on small high margin devices which are wireless.  The key to this goal is service.  We will out service any competitor.  All employees are A+ certified or equivalent and customer friendly which means no rude high school kids!  We will not carry low margin big box merchandise.  Our customers are SOHO (small office home office) and individuals.  Our goals is to make the customers digitial devices work together to increase value (see Metcalfes law).  

This is the template to move forward with.  The working name is Gadget Tree.  To be continued...
Friday, July 08, 2005 10:17:02 AM (Central Standard Time, UTC-06:00)  #    Comments [0]