Sonntag, 26. September 2010

using a config file

Yesterday I noticed that I will need a config file. For instance if I want to call a dos command like srvrmgr.exe (Siebel ServerManager) I need to be able to configure the path to srvrmgr.exe. Also there might be more then one srvrmgr.exe binaries around and I need to make sure the right one is executed...

After short time of googling "ruby read config file" and some other keywords the decision was obvious: I will use YAML [ToDo: learn YAML]

http://www.5dollarwhitebox.org/drupal/?q=node/21
--> does not seem to be sophisticated
--> what?!? No tests, only "# FIX ME AND WRITE TESTS" in "test_parse_config.rb". No way I will use this hack...

http://otype.de/index.php?id=151
--> straigthforward, should work
--> but most probably not powerfull enough for more tricky demands

http://blog.innovativethought.net/2007/07/25/making-configuration-files-with-yaml/
http://yaml.kwiki.org/?YamlInFiveMinutes
http://www.yaml.org/YAML_for_ruby.html
--> if YAML is so easy, I don't see any reason not to use it
--> and learning YAML is a must for rails anyhow (afaik)

Freitag, 24. September 2010

STDOUT, STDERR, STDIN


this time I started to work with STDOUT, STDERR, STDIN. Handy that there is a class which handles all this for me: open3: http://ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html

While doing so I came along this piece of code:
stdin, stdout, stderr = popen3('pwd')
a = stdout.readlines()

And I started asking myself if there is a difference between
assert_equal("/cygdrive/d/BACKUP~1/SMG\n", a.to_s, 'using readlines to squeeze stdout into a string, with    braces')
assert_equal "/cygdrive/d/BACKUP~1/SMG\n", a.to_s, 'using readlines to squeeze stdout into a string, 
without braces'

I did not find an answer yet, hence a new todo was born: [ToDo: find out if there is a difference between function calls with or without braces]

What I did find out was that there are differences between strings and symbols: Have a look here: http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings/

What I also did find out was that there is a difference between "a String" and "an other String". Have a look here: http://en.wikibooks.org/wiki/Ruby_Programming/Strings#Interpolation

Donnerstag, 23. September 2010

tadaaaaa: my first unit tests

Now its time to get started. I wanna write some code. As mentioned before, I consider having tests as a MUST. Hence I will use Test::Unit from the first minute on. But how and where to start?

Of course the official reference helps: http://www.ruby-doc.org/core/classes/Test/Unit.html
Further on I had to have a short look what modules are about (I have to admit the "Test::Unit" notation reminded me far to much of PERL...) Look here: http://www.rubyfleebie.com/an-introduction-to-modules-part-1/ and here:
http://www.rubyfleebie.com/an-introduction-to-modules-part-2/

And the most important help for me was this tiny little post: But http://www.clarkware.com/cgi/blosxom/2005/03/18/RLT1 I really like the idea of just testing what the ruby language offers. Why reading books when you can play. Well, not poking around only, the combination of reading the specs and then trying/testing whether or not I got everything right is cool!

Result: I committed my first unit test to GitHub: http://github.com/SlevinMcGuigan/SMG--learn :-D   :-D   :-D

yeah, now I got a wiki :)

well, after short googling I decided to use wikispaces.com. I tried some features in the sandbox and this is much more convenient compared to Google Sites. Very, very much more!

Here we go, this is my wiki: http://slevinmcguigan.wikispaces.com/


Further on I started with git and signed on at github.com. After creating my public/private key pair I played around. Here comes the link to my github sources, a good-to-know gitref link and some git commands I consider most important
http://github.com/SlevinMcGuigan/SMG--ExecShellCommand
http://gitref.org/remotes/

git config --global user.name "Slevin McGuigan"
git config --global user.email "Slevin.McGuigan@googlemail.com"
git init
git add README
git commit -m 'first commit'
git remote add github git@github.com:SlevinMcGuigan/SMG--ExecShellCommand
git push github master
... some changes on README and README.txt ...
git add README.txt
git commit -m 'added hello world - attempt 3'
git push github master

Montag, 20. September 2010

me vs. google sites

Oh my god! I just wanted a tiny little To-Do list. Maintainable and editable like a wiki using wiki-markup (or something similar).

I tried...
I tried harder...
I fought...
...
I lost... :(

Although Google says "Erstellen Sie Websites und sichere Gruppen-Wikis" I neither managed to set up a simple (and more-or-less eye-friendly) website nor to set up a simple wiki. Grrrrrrrr!

getting started...


* getting started *
Um... some decisions to make like
- what programming language
- what to programm
- which OS
- which Tools
- ...

Without getting to much into detail, I decided to use
- windows and cygwin (as this is most easy-to-start option)
- ruby
- git

* first steps *
I just finished installing cygwin and the newest (cygwin) version of ruby and git. Now I need to learn ruby. I am pretty curious. I know C, C#, JAVA, PERL, shell-scripting. But I'm not an expert in any one of those. And I don't have a idea about ruby, except that it's young and sexy
Grrrrr. A bash. I dislike the bash shell. I prefer ksh. [ToDo: create wiki entry: how to customize ksh]

* first tutorial *
Wow, I am such a quick learner :) I just rushed through http://tryruby.org/ But is this sufficient? I guess not... [ToDo: get a good ruby book]
[EDIT 2010-09-26] Hey, this book is available online too: http://ruby-doc.org/docs/ProgrammingRuby/ Nevertheless, I prefer a hardcopy

Sonntag, 19. September 2010

about me

I am a 31 year old IT professional, working as consultant as project manager. There have been more then one project where I was pretty annoyed and disillusioned that the software development unit delivered very low quality and hundreds of bugs. I don't blame the single programmer (well, maybe a little too), I rather think they were helpless in their environment. No tools like automated CT, continous integration, static code analysis, coverage metrics, etc. etc .etc.

Well, I am not a programmer but I used to work in a project using SCRUM and some - but not all - TDD methods. This project was much more professional (from a development point of view). But just arguing "you need this, you need that" doesn't really help. That's why I decided to try it on my own. I want to get _real_ experience using _real_ technices and _real_ tools