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!





Thursday, October 30, 2008

IQ or EQ, which one matter most?

Hi all,

This morning, I tried out one IQ test from a website and got the score 145..

Referring to the normal curve chart, looks like abu umar falls under 145 - 159 group which is GENIUS :-) alhamdulillah.

Whatever it is, please don't take it so seriously since, other xQ (EQ and SQ) sometimes matter more than just an IQ itself! click at the "Some IQ geniuses" link in the website if u don't believe me, guess how many person u know or at least ever heard his/her name...

please try out the test and let me know how many of us can beat up einstein and other world geniuses...

Free IQ Tests
Free-IQTest.net - Free IQ Tests




Intelligence Interval Cognitive Designation
40 - 54 Severely challenged (Less than 1% of test takers)
55 - 69 Challenged (2.3% of test takers)
70 - 84 Below average
85 - 114 Average (68% of test takers)
115 - 129 Above average
130 - 144 Gifted (2.3% of test takers)
145 - 159 Genius (Less than 1% of test takers)
160 - 175 Extraordinary genius

Monday, July 28, 2008

.NET talk: Visual Basic VS Visual Basic.NET

This is quite and old topic but you lose nothing for reading it. Since this due to my understanding based on my working experieance and some readings, I always welcome any response, whether to add or to correct the facts.

**************************************************************************************

Quite a number of friends keep asking me what are the differences between VB and VB.NET especially those who have some experiences on using Visual Basic. (VB6 or lower).

In this posting, I'll just focus on ONE difference.


Visual Basic is compiled language while Visual Basic.NET is interpreted language

Okay, if you first time heard "interpreted language" or "compiled language" maybe you want to read this. Briefly speaking, interpreted language is referred to the programming language which is interpreted line by line during runtime by an interpreter. Some other interpreted language which is very common today are PHP, PERL, JAVA and so on.

On the other hand, compiled language is a programming which is initially compiled to a native code also called machine code and object code. This program will later be run by the CPU directly without any further interpretation, C and C++ fall in this group. Some peaple might not really agree if I said VB.Net is interpreted instead of compiled. This reason might due to the fact that VB.Net itself actually compiled before executed (remember build and rebuild button in Visual Studio). You are correct - but the code is compiled to some intermediate code which microsoft call it CIL (stands for Common Intermediate Language, initially being called MSIL - stands for Microsoft Intermediate Language). This CIL works as similar as bytecodes for JAVA. Once, the code has been transferred to CIL. It will be later executed by Just In Time interpreter. That's one of two reason why before you can run any .NET application, it is a MUST to pre-install .NET Framework.

Now back to Visual Basic, after compiling the code to EXE, do you need to further install any translator? I don't think so (Please correct me if I'm wrong).

Next post, I'll talk about why VB.Net is running as interpreted instead of compiled.

Sunday, July 27, 2008

Troubleshooting: [CrystalReport + ASP.NET]: Cannot deploy Crystal Report with ASP.NET in target machine

Building report using Crystal Report in ASP.NET website is quite straight forward. Maybe you would do these steps:
1 - Add new Crystal Report page
2 - Specify the data source of the report in Crystal Report page
3 - Drag and drop Crystal Viewer on the web page.
4 - Specify the report source
5 - Put a few line of code if needed.
6 - Run the program from Visual Studio 2005, and there your ASP.Net report come out.

These are the steps you see working in the development machine. Now, copy the webpage files to your target machine (any server without Visual Studio 2005 installed). Run it in the localhost. Can you see similar thing happen again OR another new mystery to be figured out? If the latter you see, then keep on reading...

ENVIRONMENT
=============
VS 2005
Crystal Report for VS 2005
ASP.NET 2.0
Win XP Service Pack 2


SYMPTONS
==========
1 - When open browser you've an error message " Could not load file or Assembly "CrystalDecisions.****" (The message is vary based one what kind of CrystalDecision DLL or Assembly files is missing)

REASON
=======
Some DLL or Assembly files are missing. Normally DLL files should appear under application root folder name "Bin" while the assembly must appear
in C:\WINDOWS\Assembly\

SOLUTION
=========
step 1) Copy DLL files to Bin folder.

crystaldecisions.crystalreports.engine.dll.
crystaldecisions.reportsource.dll
crystaldecisions.shared.dll
crystaldecisions.web.dll

COPY above DLL from "C:\Program Files\Common Files\Business Objects\2.7\Managed\" and PASTE them to "Visual Studio 2005\WebSites\[YourWebsiteName]\Bin\" (this path might vary depend on your initial chosen path)

Once, you've done this, you might have probably able to browse your website up to the page where the crystalreport document appears, here you'll face another problem saying

"Could not load file or assembly CrystalDecisions.ReportAppserver.*** ..."

This problem is caused by MISSING ASSEMBLY FILES which is located inside c:\windows\assembly\.

for details instruction, go to step 2.

==================================================

step 2) Install CrystalReports Assembly files

a) for 64-bit server:
COPY installation program called "CRRedist2005_x64.msi" from "C:\Program Files\Microsoft Visual Studio 8\Crystal Reports\CRRedist\X64" from development machine and paste into target machine. Then, double click on it to start the installation.

b)for 32-bit server
Donwload CRRedist2005_x86.msi from http://www.filewatcher.com/m/CRRedist2005_x86.msi.16971776.0.0.html
After download, double click on it to start the installation.

Once the installation process completed. Browse your website. Here you will be able to view the page with crystal report. You may need to restart the server or IIS if the problem still persist.

==================================================

InsyaAllah, this solution will work seamlessly!