Tuesday, March 25, 2008

Microsoft scripting games

I found an interesting thing related to Perl from aero's blog

Annually Microsoft open a competition for script programming
using three languages including Perl. The competition is divided
into two division, beginners and advanced. Of course, the winners
would get prized according to their ranking.

I think I could learn a lot if I participate the competition.
Of course, I can find out how good I am. Can't wait next year!

Monday, March 17, 2008

Planning, studying, working in the way of Agile

How long do you work in a day?
8 hours? 9 hours? 10 hours? or entire day except
6 hours of sleeping?

Then think about what proportion of your working
time you are actually working? efficient? productive?

It might be around 50% or less. If you can stay
entire working time in a efficient mode, you
actually don't need to work in the company now
you are working at because you might be the
guru in the field !!

What I experienced in the Agile training was
that I was so concentrated and efficient
if I controlled the working process.

Planning before actual working with concrete
goal and time limitation. Work with time limitation.
And retrospective thinking after each process.

Since there's time limitation, I was concentrated
on what I need to do without any other thought
taking my brain.

Since there's concrete goal, I, in any form, finally
have a result on it.

And for the retrospective process, I could know
what was problem , what was needed more and what
should be done in the next process.

I think it could change my routine entirely and so my life
if I apply this Agile process to my life.

The first step getting into Agile way,


1. I will plan a day with Agile
2. I will work according to the plan
3. I will retrospect for a day.

Thursday, March 13, 2008

Remove ^M character

When you edit text file created in Windows system,
you sometimes encounter '^M' character at the end of each line
and found you can't remove '^M' because you can't type '^M' character.

The reason why those files contain ^M character is that the new line
character in Windows system '\r\n' while it's '\n' in unix system.

^M can be removed in VIM with below command
( ^M could be typed by cntl+v+enter )


:%s/^M//g

[CPAN] Inline::Files

This module makes multiple virtual files at the end of the code possible.
For example, if it's needed to use __DATA__ and __DATA2__ ,
just include this module as below.


use Inline::Files

Tuesday, March 11, 2008

TDD in Perl

Pair programming in 'Agile software development training ' was stunning experience last week. There are lots of things I learned about Extreme programming. Among them, I thought I could apply TDD in my routine.

I learned it with my pair programmer under Python environment,
my favorite language is per and I think Perl can do what Python do
even through lots of people against it.

Today, I search the CPAN library for test environment of Perl.
Among the test modules for various purposes, I think below
2 modules are enough for me to follow what I learned in the
training course.

Test::Simple
Test::More


Exam code using Test::Simple

use Test::Simple tests=>1; # indicate how many tests in the code
$expect=1;
$result=1;
ok ( $expect eq $result, 'Test1');


Exam code using Test::More


use Test::More qw(no_plan); # Possible not to determine how many tests
$expect=1;
$result=1;
ok ( $expect eq $result, 'Test1')
or is ( $expect eq $result, 'Test1');

TODO: {
ok(foo(),'Todo1");
ok(foo() ,1, "Todo2");
}

sub foo {
return 1;

}

CPAN surfing

Even my favorite programming language is PERL,
I usually didn't search CPAN, a sea of PERL module,
for my work.

When I got back from the 'Agile Bio- and Chem- software
development training course', I changed my mind to
use those usuful modules as many as possible
to improve my daily life !

The first step to use CPAN module is , of course, to
access it. Perl community provides easy way of accessing
CPAN as a module, CPAN.pm

To run CPAN.pm in shell mode,

>perl -MCPAN -e shell

If it's the first time to use it, you need to answer lots of questions.
If you done it, then you can use it to download CPAN module of
your interest.

If you want to install WWW::Robot module, just type it as below

> install WWW::Robot

That's all you have to do to install the CPAN module. Very simple!

VIM Configuration

Recently , I installed Ubuntu on a computer in the lab.
It's been a long time to handle linux configuration files for me.
When I use VI, my favorite text editor, I encountered unusual
VI environment where I can't use cursor keys to move around
the editor. Moreover there's no auto highlighting on syntax
and no auto indentation.

Yes, I needed to configure VIM and I did !
Followings are what I did for make them work in VIM.

1. Make cursor keys work !
  • First, download vim-full !
  • Type ' set nocp ' in command mode of VIM for temporal or in vimrc ( .vimrc for users ) file for permanent setting
2. Auto indentation
  • Insert ' set autoindent ' line in vimrc file

3. Auto highlighting
  • Insert ' syntax on ' line in vimrc file

4. Etc.
  • Rather than what I described above, there are more configuration you can change in configuration file (vimrc file ).
  • Each user can define own configuration file with .vimrc at the home directory