Sunday, November 30, 2008

The world is flat


What the hell on earth are you saying the world is flat. After so many proofs brought by so many scientists around the world plus all the holy proofs from God, the world was never be flat. Are you living at different century friedman?

I have a lot to say on this Friedman's The World is Flat. However I won't give any comment before I complete my reading. Just 30 more pages to go. If I can give so called 'pre-comment' - This book has allowed me to see the world at different angles which was beyond my perspective before. Yes, the world was never be flat and will never be flat - physically, no one denies that. But, physical perception matter less here! Anyway, I can't wait to give some comments in this 'new theory'.

Sunday, November 23, 2008

Sample Codes: Sort an array incrementally

Today, I came forward to solve one tricky problem, by the way it's very common problems, get an array of unsorted numbers to be sorted incrementally.

It just a few lines of codes:

Public Function SortArrayIncrement(ByVal ArrNum As ArrayList) As ArrayList

For i As Integer = 0 To ArrNum.Count - 1
For j As Integer = i To ArrNum.Count - 1
If ArrNum(i) > ArrNum(j) Then
Dim NewLowest As Integer = ArrNum(j)
ArrNum(j) = ArrNum(i)
ArrNum(i) = NewLowest
End If
Next
Next

Return ArrNum

End Function


From anywhere of your the project file, you can call this function such as

Dim m_arrNumSorted as ArrayLIst = SortArrayIncrement(m_arrNum)


To try out this function, follow this:

Private Sub btnSort_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSort.Click

m_arrNum.Add("9")
m_arrNum.Add("5")
m_arrNum.Add("4")
m_arrNum.Add("7")
m_arrNum.Add("3")
m_arrNum.Add("1")

Dim m_arrNumSorted as ArrayLIst = SortArrayIncrement(m_arrNum)
Dim strNumSorted as String = ""

For k As Integer = 0 To m_arrNumSorted.Count - 1

If k = 0 Then
strNumSorted = m_arrNumSorted(k)
Me.txtArraySort.Text = strNumSorted
Else
strNumSorted = strNumSorted & ", " & m_arrNumSorted(k)
Me.txtArraySort.Text = strNumSorted
End If
Next


End Sub


Once, you click the btnSort, you will see a sorted array of numbers in the textbox called txtArraySort.

Just sharing.

Wednesday, November 19, 2008

Have you ever found .NET Application in Macintosh?

This article was written based on my rough idea related to my observation as a software engineer. No serious studies has been made. Therefore, some of the facts might not be accurate.

I'm just coming back from kick-off project meeting in ***. We spent almost 1.5 hours discussing on the project. As usual, I just listened to the conversation cause most topics doesn't seem relevant for any interruption especially from technical person like us (me and my supervisor of course). However, it was after the meeting (during makan time) that suddenly give me some interests. Somebody was talking about how cheaper it is to go for Apple Mac rather than Microsoft. There were other arguments there, but those were not involve my interest so much.

Macintosh VS Windows

Most people know both Apple and Microsoft was, is and will be rival forever unless, one of them switch their core business into other field as what has happened to rolls-royce (they are in Jet industry instead of automative if you don't aware). As long as they are building and selling software and particularly Operating System, these two giants will never be good friend. The reason for war between these two is actually more compared to their war with others, Linux distro for example, since their target user was not so much different. However, here in Malaysia, the money might be the reason no 1 why Apple doesn't seems to be better choice for Malaysians. However, once there are arguments saying that, it is a lot more cheaper going for Apple Macintosh rather than Microsoft Windows when you sum up the price with the hardware cost, then I'm now thinking that the future might be different for Microsoft. Of course the effect is not an independence effect where only effecting Microsoft profit and loss but it is also effect any other parties who are depending so much on the Microsoft technology such as product distributor, technology supplier including the software company (software engineer of course).

Going for Platform-Independence?

Yesterday, this question is sometimes sounds more commercial rather than technical. However, today, it looks like both. Here comes the reason why the sofware company has to be dynamic enough to face the challenge. They must get ready to invest on time and money any time from now. I'm not saying this is an urgent process. But, what I really mean, a local software company cannot be so rigid on providing the solution. Yes, most markets in Malaysia are still using Microsoft technology and will use it few years down the road. How about the world market, have we ever think about it? is it impossible to the local market to be shrinking so much until we can't get any single project in a year. Or, are we waiting for the worst case to happen only we gonna crash our head thinking about the market in China or United Kingdom while never have information on what platform the majority are using in United States or Saudi Arabia?

This is the time for us to get ready. This might sound good for the company that already applied Platform-independence technology in their development. It's good, really good. But, did you really take this oppoturnity to really explore bigger market? If the answer is yes, why not take this oppoturnity to really go in front and leave all the close-minded local software company far behind. Stop depending so much on the local market.

Facing Challenge

The future for software companies is always a challenge. Greater challenge would be faced by them 5 years from now compared to now. This might required them to have 'foretune teller' in the company that can predict what the challenge will. I, a poor little software engineer, really believe that the next challenge will be the demand on platform-independence technology as the monopoly will be wiped out in this world in a day that is becoming closer by now. The reasons for this to happen is now clearer than ever!


Nasrul Muhaimin b Mohd Zain
November 20, 2008

Reading XML file using XmlDocument

Extensible Markup Language or pupularly known XML is one of the latest standard to share data across different platforms. You can write your application in VB.NET under Windows which pass the data to be read by C++ application done in Linux using this method. Does it sounds great?

To make this happen, .NET framework since 1.0 version has introduced several classes and functions to be used for XML. One of the frequently used class is XMLDocument. In this example I'll show how you can read the XML file using XMLDocument class.

Given this xml file called Customer.xml


Customer.xml

Now, we gonna use XmlDocument class to read the file.

Dim xDoc As New XmlDocument
xDoc.Load("C:\Temp\Customer.xml)

Dim nodes As XmlNodeList = xDoc.SelectNodes("Report/Customer")

For Each node As XmlNode In nodes

Dim strFirstName As String = node("FirstName").InnerXml.Trim
Dim strLastName As String = node("LastName").InnerXml.Trim
MsgBox("First Name:" & strFirstName)
MsgBox("Last Name:" & strLastName)

Next



Actually there are several ways to read the xml file, but for me, XmlDocument method is still the best way that always satisfy me.

A burden, A Hope

"If we fail in this project, this would become the great loss to us. Failure in this project will not be compromised!"

A task to complete a project is a responsibilty you can never escape. It is a burden in a glance, but also a good chance that could change your life. The burden would be a lot heavier if the task to be completed is done by fewer people. Especially when the dateline doesn't seem so helpful. In my 4 years of experience as a software engineer, I have been so 'lucky' to have this kind of burden. Almost 80% of the project I involved done by maximum of 2 persons. My supervisor and me.

Despite of all the difficulties and hardships, there is always one thing that make us moving forward no matter what. It was (it is and it will) a HOPE. The HOPE to be better equipped with soft skill and hard skill. The HOPE to have better way to handle emotion in the hardest time. The HOPE to gain better way to solve critical problem in the limited time. It is the HOPE to be better in life.

Monday, November 17, 2008

Handling problem in stress state

Earlier this morning as always, I rushed up to solve groups of pending task which was not purposely left pended in the first place. You know, once you're thinking that you've completed the task, sometimes your boss doesn't really think that it was completed. This kind of 'dilemma' always haunted my mind. The reason sometimes comes from you yourself didn't communicate well with your clients BUT it was not always the reason.

People sometimes saying something different from what they think. Worse, if the thing they said was actually opposite from what they were thinking. Unfortunately, you can't do much on that. You won't be able to prepare any voice recorder stuff so that everytime your clients 'change' their mind and keep saying something like "I've said this and that earlier", then you can always replay what they were really saying in that earlier time.

That is one of thousands or maybe millions issues once you deal with people....so just be patient
and remember what robinson said "Keep Moving Forward!"

Unforgiven mistake

Today my application log file show an error was happening since last friday (14th Nov). It was a simple error - regarding error on data type conversion, unhandled integer conversion from string - which is a very typical and kind of beginner mistake and also something that u don't want people to know about it (especially your boss and your 'bossy' client).

This mistake again!

One whole day I was sitting and figuring out what was the real problem..
One whole day I was wondering, why this error suddenly came out after quite number of months this system was deployed.

8 hours of figuring, searching, wandering, praying and finally.....again a 'complex'-like problem which was actually required an extremely easy solution. One column in a table of SQL server database was left 'null' while it was supposed to be some integer input inside. That was the root cause. Actually, It was a record of my testing few weeks ogo. I should have deleted this record in the first place at least. But I didn't.

I might have experienced this before (sure I have), but the point is, why I kept on doing same simple mistake which required simple solution. But in the middle wasting so much time that I can do so many useful things such as upgrading the system, or learning the better way to design the system or, start planning for the future project which is just around the corner (which actually the start date fall on today). Then, what was the real issue?

Start it with planning

Few weeks before I've faced a problem on this system. Something bad happened to the system. It was a bad timing since I was busy with other project. Straightly rushing into server room, log in to the server and quickly start troubleshooting on the basis so-called self-instinct. No proper planning was written on paper or indeed not even in my mind. The goal was to solve the problem as soon as possible so that I can jumped into the project at hand. The good thing was I finally solved the problem. While the bad thing was hidden to me until ..... this morning. This problem won't appear if proper planning was made just few minutes before I started troubleshooting. If the problem still arise, at least I can always refer to it for the next troubleshooting because if you're familiar with coding, it always happen that, most recent modification have major possibility of introducing new bugs. Therefore, with a proper write up, I could have saved a lot of resources (time + energy + money + peace of mind).


Never give excuses!

So, if you're facing problem while at the same time busy with some other things. Never ever started troubleshooting it without planning. Don't give excuse such as "I don't have time to plan, I have to finish this very soon so that I can jump into that sooner..". Indeed your time will be more likely to be waste if you didn't plan. Remember, 5 minutes of planing can save you hours or days if it is properly done.

Just sharing!