Happy Coding or Status Quo

… This presentation brought to you by Brains on Trains—The leading supplier of hosed-up thought processes.

Ok. Spent too big of a portion of last year FIGHTING with Micro$oft VS .NET 2003/2005 and trying desperately to show that my dying VB6 apps can be converted to them. Well, conversion doesn’t work, at least on my KLOC applications with major hacks embedded for unit testing and robust error handling.

Found the Rails in Feb 05 and basically “didn’t look back”. It took ‘till Nov 05 to get approval for the first app, and we were desperate. Success rate on that was HIGH as my off-the-cuff estimate “It’ll take 1 to 2 months” was right on target. Deployed critical-features version of app for public consumption at end of Nov. and then deployed final feature-rich (to the level that this rewrite needed) at end of Dec. Managers happy. Uesrs happy. Application admins (tech-support staff) happy. CODER HAPPY

I can’t say I”ve ever felt “Happy” coding in M$ anything. Always a catch, always a missing feature. Always a black box to deal with. Always some reason to spend 2 days googling and searching M$ forums for obscure answers.
Also, no support, unfriendly forum users, unhelpful forum “experts”.

I continue to hash around the balance between the pros and cons of this argument. It seems really clear on paper which is the better choice for continuing development… UNTIL the emotional ties to employer-loyalty, cost conciousness, time conciousness (both calendar time and timecard time) all get in the way. I have also voiced the concern to coworkers that with all the money M$ uses for VS development… how can it NOT be better??!!

In the final analysis, M$ CAN “not be better”. The 800lb Gorilla has lots of hair to shed and leaves a VERY large footprint.

With Ruby and Rails, my experience in learning curve was that the curve was low and short. Peaking the hill of learning these technologies was manageable, doable. Even without learning how to flex the technologies (I still don’t grok the metaclass), I have been able to overcome some serious design hurdles with the convenient flexibility of Ruby and the Rails framework.

Looking up, I notice ONE bolded phrase

CODER HAPPY

The reference… Ruby and Rails.

Hm..

I have an approved rails app to work on.

coder team alpha Out!

Apache/SCGI on Windows XP / 2003

I’m trying to configure a production-mode Win2003 server for rails apps.

I ran down the rabbit hole for all of the following configurations :

  • Cygwin/lighttpd SCGI/FastCGI: compiling errors on both my dev machine and vmware test.
  • InstantRails / SCGI : well, after figuring out how to run production-mode scgi_server as a windows service (details below), I still have trouble getting InstantRails to run as a “service” itself. This is not the fault of InstantRails, and Curt, you get KUDOS KUDOS KUDOS for the work in gettting InstantRails to work at all! (see below for some details on how to auotmate the scgi-as-a-service installation, when you get InstantRails running as a service itself (or at least the apache/mysql servers).
  • IIS / FastCGI : 404 error every time. With no log output, there’s nothign to see and nothing to do.. except look elsewhere for a solution!

Here’s the final solution :

Apache SCGI Configuration

Sexy is only skin deep in software

So I just watched the “5 minute video” by Iron Designer for .NET

Very sexy.  Very very sexy.

As an MSDN subscriber (thanks to my corporate sponsors employers) and MCP (SQL Designer test or something, I’ve forgotten), this is very enticing…

AND .NET has failed me in several situations where I was trying to do something “outside the box”.

How does Ruby on Rails compare to this ?

Well the 10 minute video is almost a religious experience to many.  AND Ruby and Rails DOES NOT fail us in situations where we wish to go “outside the box” in order to accomplish something.

That is all

Apache/SCGI on Windows XP / 2003

I ran down the rabbit hole for all of the following configurations :

  • Cygwin/lighttpd SCGI/FastCGI: compiling errors on both my dev machine and vmware test.
  • InstantRails / SCGI : well, after figuring out how to run production-mode scgi_server as a windows service (details below), I still have trouble getting InstantRails to run as a “service” itself. This is not the fault of InstantRails, and Curt, you get KUDOS KUDOS KUDOS for the work in gettting InstantRails to work at all! (see below for some details on how to auotmate the scgi-as-a-service installation, when you get InstantRails running as a service itself (or at least the apache/mysql servers).
  • IIS / FastCGI : 404 error every time. With no log output, there’s nothign to see and nothing to do.. except look elsewhere for a solution!

Here’s the final solution :

  1. Assuming your’e doing this on a virgin server : install ruby and rails and your rails app.. .test on webrick.
  2. Install Apache 2 (follow the directions, etc.)… test it for basic functionality “You were expecting your site but you got this page instead”.
  3. Go to Zed Shaw’s SCGI Rails Runner Howto site.
  4. Get the scgi gem and install it.
  5. Get the mod_scgi binary and copy to /modules (that link is assuming Apache 2… Zed has Apache 1 on the site as well.
  6. Configure /conf/httpd.conf according to the howto. This includes a LoadModule line and a configuration.
  7. Get srvany.exe kit from vbRad. Expand it to a simple location like C:srvanykit.
  8. Run C:srvanykitinstsrvw.exe. Follow the wizard. The PATH TO THE APPLICATION.EXE IS : C:srvanykitsrvany.exe. THIS IS REQUIRED. You will configure the actual path to scgi_server in a minute.
  9. Run regedit. Find the key for your service at :
    HKLM/System/CurrentControlSet/Services/
  10. Add a new key : /Parameters
  11. Add a new string value : Parameters/Application.
    Value = (path-to-ruby) (path-to-scgi_server)
    Ie “C:rubybinruby.exe C:rubybinscgi_server”
  12. Add a new string value : Parameters/AppDirectory.
    Value = (path-to-rails-app-root)
    Ie “D:rails_appscookbook”
  13. Open Service control panel (Start -> Control Panel -> Adminstrative Tools -> Services). Find your service. Start it… should be running!
  14. Test the rails app: Go to http://localhost.
  15. If you have a routes issue it needs to be addressed now.

I’ll edit this post with updates as they are necessary.

VS 2005 Beta 2 RTM & TDD

Ok, it’s been a while… a loong loong while.
All my projects are now in process of being converted to VS.NET 2.0. Currently using the Sept.05 CTP.
Now that a couple of the projects are deployed (using the Beta 2 go-live license, of course… only build on Beta 2… CTP’s are not licenced!) I’m going into TDD and Mocking mode. Looks like RhinoMock gets the win as currently having a build on NetFx 2.0. I’m in the less-work-win-bid category right now… all projects are officially behind due to rewrite.

So, my next post will outline a simple way to test a home-grown data-access web service.

Black Belt TDD in VB6

Ahh, testing again in VB6. Learning all about the black art of WinAPI programming and control of mouse events.

Here’s what I’ve learned that can be passed on to you, Grasshopper.

  • Test a Pop-Up menu… seek your history, Grasshopper, and learn that PopupMenu is a BLOCKING function. Therefore, a out-of-thread timer is required to handle the call. Oh, and when you get ready to SendKeys to the menu… Make NO OTHER CALLS before sending the keys, and send them all at once. The container form of the popup menu will readily take back keyboard focus and you’ll lose your menu control otherwise.
  • Testing a TreeView with Mouse Events. Getting the windows handle of the selected TreeView node requires you to go down the rabbit hole of WinAPI. SendMessage with TVM_GETNEXTITEM, TVGN_CARET and TVM_GETNEXTITEM, TVGN_ROOT will be very beneficial.
  • A nice dll out-of-thread timer can be found at http://www.vbaccelerator.com/home/VB/Code/Libraries/HiResTimer/article.asp

Oh, how this is fun!

Why no code? Because as a student of the black art the education is in your research, and the joy is in watching your code do what you wanted after long long efforts.