Sunday, December 27, 2009

Why I've chosen Ruby as main scripting language for my toolbox

There are a lot of scripting languages: Perl, Python, Lua, Tcl, Ruby, JavaScript, Scala, Groovy, Erlang, Lisp, Scheme and Bash/Awk(as shell scripting).

There are criteria I've tried to match for my scripting language of choice:
  • Easy to learn
  • Active and big community
  • Amount of books and tutorials which are available
  • How many screencasts, conference videos are on-line?
  • Can replace shell scripting?
  • Number of text editors which support selected language
  • Code for fun? Is it suitable for selected language
  • Amount of useful frameworks and libraries
Let's discuss each of them.
  • JavaScript. I like this language, but it doesn't have standard serve-side API. There are a lot of implementation, but community have to work a lot to get valuable result. Check CommonJS to get more info
  • Perl. I've never tried to dig deeply into this and code style doesn't suitable for me. I can't code for fun. Number of tutorials/books are huge. Community is big. But, it's not my language of choice.
  • Lua. There are no killer features, as for me. In general language are cool and fast. Easy to learn.
  • Tcl. I just don't like Tcl language. It's main stopper for me. Community not so big in comparison with other languages. Amount the books is limited.
  • Lisp/Scheme. Great languages, but not for shell oriented scripting (It will be awkward to write shell scripts)
  • Erlang. Interesting language, but it's not general purpose. Good for concurrency domain. I have to skip it.
  • Scala/Groovy. Yet another scripting languages. I can see hype near these languages, especially Scala in Java community. I can predict, that the next year will have got another hype language(s).
  • Bash/Awk. I'd like to learn these two, but I'm windows user and I don't have a possibility to use these during my work. I can use Cygwin/MSYS, but it will be strange, awkward. It will be unnatural. I'm sure I need to get additional experience in Bash scripting, but not now. Time is my enemy.

Python vs Ruby. These two are very similar. Both have big and active community. Both are general purpose languages. Both are great.
But I falling in love with Ruby blocks. I love http://railscasts.com/. I'm not web-developer, but Rails concept is super-productive. I just love Ruby community.

But, there is one drawback. There is a ton of libraries and frameworks which are doing the same thing. Community super productive and it's in developing. There is no consistency. So, I have to be aware of any big changes in my favorite libraries/frameworks. I know it sounds strange but it's IMHO.

Shell scripting and task automation is one of the main direction to be productive. From time to time I have to work on different OS's (Windows, Linux, OS X) and environment. But my primary work station is Windows based. I'd like to have consistent scripting and automation tools for all these OS/environments. We can automate everything with Bash, etc. But what about Windows? So, choosing scripting language was good decision to create multi-platform toolbox. So, I can use my knowledge on any machine with minimal rework (if required).

Any developer should have some scripting language in his arsenal. The right tool for the job. Keep follow this idea and you will be productive.


Wednesday, November 18, 2009

*nix-like environments for Windows

*nix like environment is good for developer and sysadmins, and really useful for end-user. That's why we've got KDE, Gnome and similar. But, I like it a lot even if I'm Windows user ;-). There are several cases to set up *nix environment on Windows:
  • setup Virtual Machine with some Linux distributive and you've got fully functional Linux. You can use VMware or VirtualBox
  • or you can setup Linux-like environment in Windows (i.e. bash, gcc, make, grep, find, sed, etc.).
Here is "my" list of choice for such environments.

  1. MinGW - Minimalist GNU for Windows. My top choice if you need GNU development programming tool set. Additional, if you need bash and similar tools install MSYS - general purpose command line environment.
  2. Cygwin -  is a Linux-like environment for Windows. It's very powerful if you need to develop OS-portable application on windows (it's provide substantial Linux API functionality). 
  3. GnuWin32 - provides ports of tools with a GNU or similar open source licenses. Check package list on their home page.
  4. UWIN - it's the similar to MinGW and GnuWin32, but less popular.
I prefer to use MinGW/MSYS and Cygwin because they have great community support.

    Monday, November 09, 2009

    GNUstep Getting Started

    Objective-C popularity aggressively increased based on TIOBE Index (for October 2009)

    The reason is simple -- iPhone and all related stuff. We should be ready to develop Objective-C based application in future. The worst thing I don't have a Mac, so I don't have development environment.
    I need to get basic Objective-C knowledge, and here several solutions:
    • buy Mac
    • install Hackintosh on PC
    • try GNU compiler and play with Objective-C
    The better choice is the last one (for me). As I'm a Windows XP user and I don't have a time to set up Linux, I'm going to use some Windows GNU GCC port: Cygwin or MinGW.
    There are two cross-platform projects which implements Objective-C Cocoa/OpenStep APIs:
    • The Cocotron -- this project uses Mac machine for build (I didn't dig into this), but built application can be run on Windows.
    •  GNUstep -- this project supports many platforms (Windows included).
    My choice is

    Here is the useful links for quick start:
    How to build your first GNUstep application in Windows?
    In general it's simple, but if you have some troubles with it here is the links:
    1. Installing and using GNUstep and Objective-C on Windows
    2. Writing GNUstep Makefiles (I highly recommend it)
    3. Compile Objective-C Programs Using gcc
    The next post will be about tuning the development environment for GNUstep .

      Saturday, August 29, 2009

      Wednesday, August 26, 2009

      Rails 2.3 migration issues with MySQL 5.1.3


      depot>rake db:migrate --trace
      (in D:/Projects/RoR/depot)
      ** Invoke db:migrate (first_time)
      ** Invoke environment (first_time)
      ** Execute environment
      ** Execute db:migrate
      rake aborted!
      Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version`
      varchar(255) NOT NULL) ENGINE=InnoDB
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract_adapter.rb:212:in `log'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/mysql_adapter.rb:320:in `execute'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract/schema_statements.rb:114:in `create_table'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/mysql_adapter.rb:473:in `create_table'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connetion_adapters/abstract/schema_statements.rb:320:in `initialize_schema_migration_table'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:436:in `initialize'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:400:in `new'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:400:in `up'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/migraion.rb:383:in `migrate'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/databases.rake:116
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with call_chain'
      d:/tools/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with call_chain'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_tas'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
      d:/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
      d:/Tools/Ruby/bin/rake:19:in `load'
      d:/Tools/Ruby/bin/rake:19

      As I understood the client MySQL library doesn't work well with Rails 2.3. We can resolve this by using the older MySQL client library (libmySQL.dll). You can get it here http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll.
      Just put it in <ruby base dir>\bin\ and restart MySQL service.

      Wednesday, June 03, 2009

      Top Ruby screencast resources

      As you know there are several way to kick-off and learn a new programming language, environment or special tools:
      • tutorial
      • screencast
      But, now screencast is more popular for effective start and feature demonstration. So, I'm trying to collect as more as possible screencast resources for learning Ruby and Rails.


      Monday, March 16, 2009

      Effective way to be an Expert

      I've found great post about How to Become an Expert. The Effective Way.
      The core idea is:
      Experts are made, not born. Experts are made by themselves. It is a long, thorny and hard road. But this road makes their life interesting, positive, meaningful and brings happiness from achieving a rare gift - mastery in the field they love.
      I invite you to read that post. Enjoy