Monday, August 21, 2006

Form DateCalculator

Sometimes I need to calculate date, this form can help
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DateCalculator
{
    public partial class FrmDateCalculator : Form
    {
        public FrmDateCalculator()
        {
            InitializeComponent();
        }

        private void btnIncrease_Click(object sender, EventArgs e)
        {
            txtResult.Text = dtpDate.Value.AddDays((double)nddDays.Value).ToShortDateString();
        }

        private void btnDecrease_Click(object sender, EventArgs e)
        {
            txtResult.Text = dtpDate.Value.AddDays(-(double)nddDays.Value).ToShortDateString();
        }

        private void btnTryFeb_Click(object sender, EventArgs e)
        {
            DateTime dtm = new DateTime(DateTime.Today.Year, 2, 30);
            txtResult.Text = dtm.ToShortDateString();
        }

        private void btnGetPrevMonday_Click(object sender, EventArgs e)
        {
            DateTime dtmStart = DateTime.Today;
            DateTime dtmValue = dtpDate.Value;
            int intDayOfWeek = Convert.ToInt32(dtmValue.DayOfWeek);

            if (intDayOfWeek == 0)
            {
                dtmValue = dtmValue.AddDays(-1);
                intDayOfWeek = 6;
            }
            dtmStart = dtmValue.AddDays(-((intDayOfWeek+6)-7));
            
            DateTime dtmEnd = dtmStart.AddDays(6);
            MessageBox.Show(dtmStart.ToString("dd/MM/yyyy") + " - " + dtmEnd.ToString("dd/MM/yyyy"));
        }

        private void btnMinValue_Click(object sender, EventArgs e)
        {
            DateTime dtm1 = DateTime.MinValue;
            DateTime dtm2 = new DateTime(1900, 1, 1);
            bool blnEqual = dtm1 == dtm2;
            MessageBox.Show(dtm1.ToString("dd/MM/yyyy") + " == " + dtm2.ToString("dd/MM/yyyy") + " -> " + blnEqual.ToString());
        }
    }
    
}
As you can see, this form already using "partial" keyword. With "partial", the definition of a class, struct or interface can be splitted into multiple files.

Saturday, August 12, 2006

CVS and His Tortoise

So far, for source code repository or simply called "source control", I only using Visual Sourcesafe. My new employer is not only using Microsoft Technologies, in fact our main product is written in Borland Delphi. How we manage the source code? If you guess that we copy to another folder, backup it or zip-it, you guess it correctly. Now, this is not KISS (Keep it simple, stupid) anymore, this is really-really-really stupid. We are in urgency to look for a source control. And we stumbled upon CVS and it's Windows client; Tortoise CVS.
If you're a Windows user using CVS, and you're currently not using Tortoise CVS, I suggest you better to look into it. It integrates nicely with your Windows Explorer, ease your job significantly. Currently they are in a 1.9.x release, but I'm using the 1.8.x version (as in x.y.z, if y is an even number, it's considered stable release). Check their website for more information (and download)

Monday, June 26, 2006

New Job, New Country...

I'm hired for a job as a System Analyst in a software house in Singapore. The company is specialized in HR solutions. It's a new job, new country, new life. Hopefully I can adapt quickly (new home, new environment, different food), new colleagues, new TV Channels :D

Update (1/7/2006): The company, Timesoftware Pte Ltd currently has 5 developers (included me). My boss, Mr Raymond. Then Siong, Seng, and Vanessa. All of them are Malaysian. The shocking news: they are using Delphi, and (worse) Delphi CGI. We are in the progress to build new ASP.NET product

Sunday, October 2, 2005

Oh, Glassfish

When peoples declared that mainstream Java application server is Tomcat, honestly I can say that until now, I never use this cat. App server installed in my PC is Resin from Caucho. Previously I also use Websphere from IBM, now uninstalled to free some space in my HD. Resin is my testing server (or learning server) I used when learning Java, Servlet and JSP during my university time (and now). But now, I am interested in Sun application server. Why? Because, it’s the first commercial Java EE application server that change its license from proprietary-commercial to an Open Source license.

Sun change the license of its application server and release it as GlassFish Project Long live Sun!

Now, excuse me, I need to download and play with this aquarium…


Edited: Add picture

Monday, June 27, 2005

A Poem of Purpose Driven Life

In a book titled "Purpose Driven Life", Rick Warren included a Russel Kelfer's poem like below:

You are who you are for a reason
You're part of an intricate plan
You're a precious and perfect unique design,
Called God's special woman or man

You look like you look for a reason
Our God made no mistake
He knit you together within the womb
You're just what he wanted to make

The parents you had were the ones he chose,
And no matter how you may feel,
They were custom-designed with God's plan in mind,
And they bear the Master's seal

No, that trauma you faced was not easy
And God wept that it hurt you so;
But it was allowed to shape your heart
So that into his likeness you'd grow

You are who you are for a reason,
You've been formed by the Master's rod
You are who you are, beloved,
Because there is a GOD!

Then, I'll translated it into Indonesian:
Kau ada sebagaimana kau ada karena suatu alasan
Kau adalah bagian dari suatu rencana yang rumit
Kau adalah suatu rancangan unik yang berharga dan sempurna
Disebut pria atau wanita khusus kepunyaan Allah

Kau terlihat seperti kau sekarang karena suatu alasan
Allah kita tidak pernah membuat kesalahan
Dia merajutmu menyatu dalam kandungan
Kau tepat seperti apa yang ingin Dia ciptakan

Orang tua yang kau miliki adalah pilihanNya,
Dan tidak peduli bagaimana perasaanmu,
Mereka secara khusus dibuat dengan pertimbangan rencana Allah
Dan mereka memikul meterai Tuhan

Tidak, trauma yang kau hadapi tidaklah mudah
Dan Allah menangis atas semua yang begitu menyakitimu
Tapi hal itu ditujukan untuk membentuk hatimu
Supaya kau bertumbuh menjadi serupa denganNya

Kau ada sebagaimana kau ada karena suatu alasan,
Kau telah dibentuk dengan tongkat Tuhan
Kau adalah kau sekarang, saudara kekasih,
Karena ada Allah!