Friday, February 22, 2008

Friday, February 8, 2008

Nesting ExtJS 2.0 TreePanel inside Accordian

The Accordian panel in ExtJS 2.0 javascript framework, will error out if an item (Ext.Component) does not possess a header. The easiest way to create an header is to set the title property.

Here's the code

var tp = new Ext.tree.TreePanel(....);
tp.title = 'title ...'; // blows up without title

var accordian = new Ext.Panel({
layout: 'accordian',
region: 'west',
items: [
tp, // tree panel passed here
{
title:'another panel',
html: 'content here..'
}
]
.....
});

Tuesday, February 5, 2008

Blog content getting truncated

My blog content was getting truncated if beyond the main content width. To fix this, I updated the template and remove css rule - overflow:hidden on #main-wrapper. Just in case other folks are using this template and want to know how.

Healthcare not available in blogger edit profile dropdown

While trying to setup my profile here at blogger, I noticed that Healthcare is not listed in the occupation dropdown.

gem install ruby-debug fails in windows

While trying to install ruby-debug in windows, I ran into the following issues
d:\tmp>gem install ruby-debug
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb install ruby-debug
creating Makefile

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.


Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/
ruby-debug-base-0.10.0 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.0/
ext/gem_make.out
This is obvious - ruby-debug is trying to build and install a native extension and fails because a default command prompt in windows does not include the compiler environment.

You need Visual Studio 2005 command prompt. It can be found under Start->All Programs->Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt. I manually invoked nmake.exe (make utility that ships with VS) on the gem generated Makefile.

Assuming you have installed ruby under C:\ruby, here's the log

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

C:\Program Files\Microsoft Visual Studio 8\VC>gem install ruby-debug
Building native extensions. This could take a while...
Successfully installed ruby-debug-base-0.10.0
Successfully installed ruby-debug-0.10.0
2 gems installed
Installing ri documentation for ruby-debug-base-0.10.0...
Installing ri documentation for ruby-debug-0.10.0...
Installing RDoc documentation for ruby-debug-base-0.10.0...
Installing RDoc documentation for ruby-debug-0.10.0...

At this point, I am ready to test it as follows
C:\Program Files\Microsoft Visual Studio 8\VC>irb -rruby-debug

But alas, I get a runtime error (R6034) as follows



So I hit Google and after some research, I realize that the manifest (which is a new concept introduced in VC++ post VC6) is not embedded into the dll (or ruby_debug.so in this case) by default when you build from command line. This is easy enough - using mt.exe I do the following

C:\Program Files\Microsoft Visual Studio 8\VC>cd C:\ruby\lib\ruby\gems\1.8\gems\ruby-debug-base-0.10.0\ext

C:\ruby\lib\ruby\gems\1.8\gems\ruby-debug-base-0.10.0\ext>mt.exe -manifest ruby_debug.so.manifest -outputresource:ruby_debug.so;2
Microsoft (R) Manifest Tool version 5.2.3790.2014
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
Don't forget to install the brand new binary as
C:\ruby\lib\ruby\gems\1.8\gems\ruby-debug-base-0.10.0\ext>nmake install

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

install -c -p -m 0755 ruby_debug.so C:\ruby\lib\ruby\gems\1.8\gems\ruby-debug-base-0.10.0\lib
Now I am back in business as seen below
C:\ruby\lib\ruby\gems\1.8\gems\ruby-debug-base-0.10.0\ext>irb -rruby-debug
irb(main):001:0>
I have included some helpful links on this topic
http://archives.windowshpc.net/blogs/dev_gen/archive/2006/10/23/671.aspx
http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=94312&SiteID=1

It would be nice if the gem itself includes mt.exe step on win32 builds. Please feel free to add if there is a better way or even another way.

find/exec in win32 (UnixUtils)

Using UnixUtils tools for win32, search for the word "tail" in all ruby files (*.rb)


find -name *.rb -exec grep -ai "tail" NIL {} ;

You can find more information on the find tool here