Nat Pavasant

This user hasn't shared any biographical information

Homepage: http://nat.robothai.net/

Jabber/GTalk: nat3738@gmail.com


Posts by Nat Pavasant

My Choice of SCM: Git vs. Mercurial

If you Googled “Git vs. Mercurial”, you will see a long list of pages that compare Git and Mercurial. Well, I think I’m writing one of those too.

In past, normally when I was developing, I will just use local copy and backup and use diff/WinMerge utility to compare and merge files. My life change when I starting to know SCM/VCS.

I started using SCM for the first time when I start looking into Robocode’s source (as per Pavel Savara’s request to be a tester), which use Subversion. I know basic of the operation before (commit and checkout mostly), but I had never use any of it prior than that time. As I continue using SVN for Robocode’s source,  I slowly learned more about SVN including what is branches, tags and trunk. I learned about patch later.

Since then, every time I develop some project, I need to have a VCS repository for my code (either local or hosted), all are SVN since I don’t know others. I knew that there is CVS, but its idea really confused me. I also knew that CVS is dated, and many projects that used to use CVS have already migrated/are migrating to SVN or other VCS.

My view of VCS changed when simple-php-framework moved to GitHub. I learned that there are also Git, Mercurial and Bazaar, which are DVCS. I still perfectly happy with SVN, so I didn’t really care about them, as long as GitHub provide a tarball link for me.

My first project which I use hosted SVN is napv-ce. I use Subversive plug-in for Eclipse as my SVN client. I hosted my project on Google Code. As I develop, the commit part really annoyed me since sometimes it just fails. And sometimes I don’t want to connect to the internet. The idea of DVCS starting to get back into my head.

I know before that Google Code has launched Mercurial server, but many projects use Git. I read many of comparing article including Google’s one to decide. The reason for this mainly is that cafe-grader had just moved to Gitorious.

Since I’m starting a new project, I need to decide whether to continue use SVN, or switch to either Git or Mercurial. (Bazaar wasn’t on my list at all since it’s way too slow). Git has several advantages: its large use and stable project hosting, and many of project which I am watching use Git. Mercurial has another advantage: it is supported by my old project hosting, Google Code. SVN has another advantage: most developers know how to use it =)

But I considered one more thing: If I use Git I will have to hosted my project on either GitHub or Gitorious, which is space limited (Google Code also has space limited, but I can request for more). I wasn’t considering SourceForge.net at all since I have already decided to abandoned that place. It is really sloooow.

Still, I could’t decide. Just then, I saw this web page. Then I decided, I’ll use Mercurial on Google Code =)

Anyway, despite the fact that I have chosen Mercurial for my project, I have TortoiseCVS/SVN/Hg/Git/Bzr just in case so I can checkout/clone any code from any project which use any VCS. Because I still have to clone/pull some Git repository so I can peek at their source code (they hosted in their own Git server), and I still have to use SVN for Robocode =)

OOP Learning Process

Three years ago, I started to learn Java and OOP. That time, I found OOP quite interesting because it is a grouped functions. I slowly learn it from time to time.

Next year, when my teacher knew that I was into OOP, he told me to search about MVC, which I found it also quite interesting.  I searched about PHP MVC and I found several PHP framework. The one which attracted my eyes the most is CakePHP, so I decided to give it a try.

At first everything seems to go well and I love it. Separation of design and code and all of it. But as I use it for a while, I started to think that by having to many DBALs to my database, I have to learn about it all. So later I use my own Module-View design for my relatively small web, which I have Module as Controller and Model together.

Recently, when I have to code real web and I use Module-View, my webpage get dirtier and dirtier with SQL request, so I remember the MVC and move things to Model. That’s how I know the real reason of MVC.

Second thing: ORM. I was never able to understand the need of ORM library until recently. I found that ORM make my life easier if I use it with light DBAL.

I wrote this all because I want ones who fall under the smiler route with me that in order to understand the reason behind each invented things, you have to use it yourself.

Post Valentine: Poems and Haiku

For her own good

There’s one who I love
Who I care about the most
Who I really want to spend time with
Who I’m going to lost.

Yet, there is still a hope;
Not much, but worth living.
I don’t want to lose her,
But I don’t know if it is a good thing

I may just being selfish,
But I’m not in the mood.
I know she has to go,
’Cause she is leaving for her own good.

But chances are, she may not leave.
Wht? — I don’t really know.
I don’t care — as long as she stayed;
I can’t afford losing her, no…

I really hope that she won’t leave,
And leave me alone in rain…
I know I may be just a mad,
Like a git without brain.

She isn’t leaving

I was very sad and depressed,
I couldn’t walk and talk like I used to be.
’Cause my heart longed for her,
Only her could fulfill me.

She was leaving…..
To where I couldn’t reach her.
For once, I really know my feeling,
That I really, really love her.

But now, she comes back.
She isn’t leaving anymore.
My heart bright — I was happy.
I really, really need her more.

It is a very colorful day,
Sun shines over the glowing moutain.
Flowers bloom — wind blows.
She makes nature alive again.

Two post-valentine poems. End of my poem series =) Remember, reward if you can figure which girl I’m talking about (and therefore who I secretly love). UPDATE: Within 23:59 of 17 Feb ICT (UTC+7)

Extra: A Valentine 5-7-5 Haiku. Not so good compare to the poems =P

It was an old past,
that I do not know her so fast,
and she is the last.

There was a short time
I fall in love for other prime,
but I quickly stop.

Then it was moment
I really know she is meant,
to be with me, fate.

Love grows stronger
I need her, for my good life
I need her better.

And there I can see.
The end of two-paths of me,
either crossed, or broke.

Also my and her paths,
May crossed, may not, just on luck.
Or maybe just a good ruck.

NOTE: Only “Gain and Loss” poem is fully copyrighted. Other poems and Haiku are under CC-BY Some rights reserved license.

More Valentine Poems

EDIT: A link to my poem posted pre-valentine: Gain and Loss

These poems should be songs, but due to much works I don’t have time to compose the melodies for them. Well, here are poems:

Some times I have noticed you

For once, I have never felt before,
Not before I notice you.
I feel calm, I can control my anger
Because of you, and only you.

Form the past, I don’t even know you.
From the time of bad, I noticed you.
In the time that worse, I found love in you.
Best of all, you guide me through. (secretly)

I notice you for some times,
Since when I don’t even know.
But I know I love her now,
I do not want to leave you, no.

It’s the time that we spent apart.
For years that we don’t know each other.
Just now that I know you, you,
And love you… Our time is almost over…..

And here’s another one:

Will I ever see her again

It’s a time for me to accepted.
That she is no longer with me.
And she has gone forever.
No more hope to be.

It’s not that she had someone.
But she’s moving out, with my pain.
And I don’t know what to do.
Will I ever see her again.

I should blame myself
For not asking her sooner.
Because both of us know it
That we love each other.

I shall love her forever.
Despite the fact that she has gone.
I would never love any other.
Even that mean I’ll have to be alone.

Nice? Now, reward to anyone who guess correctly who I’m talking about in all my three poems. =D And I won’t reveal anything unless anyone guessed correctly, or the one who I’m talking asked for the answer.

Valentine Poem: Gain and Loss

Gain and Loss

It was a time that I missed her
That I know I love her.
Who I have never noticed before,
These times passed like a blur.

But on the other day,
Her beauty stunned my mind.
She helps me control myself
Better than the days I used to cried.

Yes, I do love her,
Very much indeed.
The thought makes me warm;
The feels of love and need.

I seem to notice, that her,
She seems to fancied me too.
But the simple fact that both of us
Still unsure what to do.

After all, I am a coward;
I never have enough courage to ask her.
If not by luck and chances,
I wouldn’t have even talked to her.

Chances and luck,
Is what I owe, I know forever.
Strange time it is for me,
But finally I know her better.

This day I’m losing her,
Fairly quickly, not like I want it.
But here we are still, like the past,
Barely talk, interact to finish.

I know she has been stolen
Glances at me, occasionally.
But I also know that
She caught me do it frequently.

I can’t afford losing her,
For she holds my heart for too long.
Especially when it was still young;
The feeling is just too strong.

I don’t think I’ll ever love any others;
Something told me she is the right one.
And I’m not pressing my luck,
Which may leave me and her alone.

My heart missed her a lot;
When she has gone, what am I doing?
I need her, very much to help me,
Otherwise I may broke down, like promising…

Nat Pavasant
13-Feb-2009
Valentine Eve

© 2010 Nat Pavasant; All right reserved.

SCORE Computer : analysis on failure of the contest environment

Well, firstly to whom doesn’t know yet, on the 4th of December my school hosted a programming contest called ‘SCORE Compute Contest’. It is just a basic programming contest that the competitor have to write a C program to solve given problems. To make this more fun and not IOI-like, the Head make an extra system for it, but that’s out of scope for this post.

I’ve been assigned to write a contest environment (i.e. grader). It is a system, mostly web-based, for the competitor to submit their solution to be compile and grade using the restricted environment (i.e., sandbox-ed). My code was MVC-based PHP code that I use very clear variable name, for I have little time and it must have as less bugs as possible.

While I was testing it, I have fixed almost all important bug. It ran very well that time. But the problem come when the real competition was started. Some solution putting the grader in full-locked situation! I don’t know what caused that, and I’m very stressed, so I blame the sandbox which I use the Moe Contest Environment’s. So far, our Head have a solution, and therefore the contest end pretty well.

After many hours of sleep, my head went bright and I realise what caused it. Guess guess guess…. It is the IPC!?! Old way I use is to pipe the sandbox process’s output through streams. I carefully check that I have already closed all stream before terminating the process (proc_close(), my grader is written in PHP). But somehow I realise, that IPC may caused deadlock if not very well implemented. And I’m not sure that the wrapper for piping process’s I/O I quickly cook was really bug-free. So far yesterday I come back to the grader and change from piping through the stream to piping to filesystem. And it works!

UPDATE: The working system I wrote can be found at http://napv-ce.googlecode.com/ There will be no more update to it.

The Flow of thought — then get interrupted!

Have you ever face this before? When you were in the middle of your wonderful and flowing thought and was writing it down quickly. You know that this opportunity of getting this flowing thought is very low. But then your parents interrupted you, claiming that is is time to blah blah blah… So your flow of thought was interrupted, and it never come back again!

Well, my thought really flowing this afternoon. I was writing a rather hard essay, then I was interrupted and now I don’t know what to write any more — it’s all gone! How annoying!

A Contest Environment Writing – Part I

OK, I know I’m lack of update. But that is because I have been busy writing the ‘Contest Environment‘.

This part I’ll explain what the contest environment is.

The Contest Environment is a system that allow you to upload a source code that solve tasks, compile your submission, run it with the test cases and grade the result. The one of the well-known contest environment around today is the Moe Contest Environment (formally known as mo-eval). This Moe system’s most famous is its sandbox, which is used in many competition around today, including many of the IOI (International Olympiad on Informatics) contests such as the recent POI (Plovdiv International Olympiad on Informatics: IOI2009) and also on Thai contest environment — the cafe grader.

More >

Restaurant City on Facebook

Restaurant city popularity

Not sure if this is normal, but I’m quite proud of my level 13 and popularity of 40.5 (average 39.5, though). And I start playing this last Monday (Oct 26, ‘09)!!!

EDIT: I have 50 now, but it is normal for 18th level player to achieve maximum popularity.

Next term in a day!

Oh! So surprise. Next term is starting on this Wednesday, yet I don’t feel I have any rest yet. Perhaps I’m to much on the internet? I don’t know.

OK, the point is, there is a lot I need to do in this school holiday, but none finished. Yet most of them have ~80% progress. I think I spent too much time on nonsenses thing (like late sleep for a whole week =))