Wednesday, December 26, 2007

2/3 of the 3M

These few hard weeks of thesis write up make me remember of those 3M thingy. The 3M stands for "Membaca, Menulis Mengira" -- " Reading, Writing and Calculating" is one of the concept implemented during my primary school. This concepts stressed on student's ability in Reading, Writing and Calculating. Yeah.. it seems now that I'm not very successful in the second M (Menulis - writing) especially on technical write up. My mind is just messed up and I'm start losing focus about 15 minutes after start writing.

My personality test also shown strong tendency to do research, calculation , programming , teaching but not anything related to writing and typing and clerical work.

However luckily I like diagram so much ... Mind-mapping, block diagram, flowcharts, to do list , fish-bone diagram etc.. has been a great help.

No time for regret.. just moving forward.

Maybe this weekend i should find suitable books for guidance. I think Technical Writing for Dummies will suit me well.

p.s Since I'm busy with thesis write-up and works, this blog will be updated depend on my mood and free time.

Friday, December 14, 2007

beginners tip for NS2 tcl scripting

Assuming that NS2 has been successfully installed.
Following guide will be helpful for those who are not familiar with NS2 :

  1. run "ns basic.tcl"and other simulation scripts example , especially the example that pop up NAM. It will be very encouraging to see the animation ^_^.
  2. Open the simulation script file using text editor. Just take a look. Especially at the syntax and common command. As example you will see set , [$ns node] , duplex-link , proc etc. Please also observe the structure. It should have some structure.
  3. To help understand the structure, refer to ns manual or tutorial. Just Google it. The Microsoft power point presentation files will be very very helpful.
  4. Study also on TCL .. instead of reading, use the tclsh or ns interpreter to test basic commands. Observe the syntax of the TCL especially on the substitution ($) , grouping [] , " " etc. Please return some errors during the testing.
  5. Look again at the basic.tcl.. now deeper understanding on the command will be achieved. How does this instruction operate : set n0 [$ns node] ?
  6. Write your own simulation script. Instead of writing it from scratch , edit existing file.
That's all.. This is what me and my friends (I'm still a beginner) did ... hopefully it will helps others too..

Monday, December 10, 2007

Debugging tcl/tk program (window platform)

I used to write tcl/tk program on Linux XandrOS platform , past few days, a lot of time has been spent on writing program on windows (tcl\tk is multi-platform anyway). My laptop screen is slowly failing, few vertical lines appeared one by one. Hence, I used the desktop monitor as an alternative. Unfortunately the Linux environment cannot be displayed by my monitor at home. Last choice : windows!

There are different feels programming in Windows and Linux.

In term of program debugging , using Linux is easier , the puts instruction can always be used to display the parameter of interest, or to check for the logic. puts "some string" will display the string at Linux console. However in windows (from my very little experience) , it cannot be done. It can be done actually .. by invoking the wish(wish is the interpreter for tk) and using source command to evaluate a tcl program. However the wish interpreter will be terminated as the application developed are closed. This never happen in Linux.
Another technique , without using interpreter interactive mode, is to run program by just clicking at the .tcl file. for debugging purpose , the tk_messageBox command can be used to pop up certain message instead of using puts command.

One good thing about windows is, the GUI for my application have better looks.

Friday, December 7, 2007

Flow chart is a powerful tool/technique

Have u ever stuck in programming? Most of the time I always do , when debugging own program , or worst case is to debug other's . Yeah.. syntax errors are easy to be identified, let the assembler/compiler/interpreter handle it! But the problem lies in what is called algorithm error or the logical error.
Sitting in front of the computer wasting time looking at the lengthy program while trying to figure out the flow of the program, refer to the flowchart! No flowchart? study the program to get a brief insight then create flowchart and start it over again. There is no point to troubleshoot a program that come without a logical graphical presentation.
Some genius people may think that flowchart is not important. "There is no need for flowchart! Everything is in my head", they may say. Its up to them , but consider this few following reason:

  1. Flowchart can be translated into any programming language
  2. Flowchart can be easily understood by other non-programming people
  3. A logically wrong flowchart cannot produce a well-working program
  4. There are few people who can all programming language
  5. Trouble shoot a program takes long time, trouble shoot a flowchart takes shorter time
  6. We can review the flowchart anywhere, but to debug a program we need a computer
Flowcharts can be a very powerful technique, followings are some tips:
  1. Start with a simple main flowchart to get an overall picture. Maybe without any if else structure or do while structure , just a plain sequence by sequence. Use suitable wordings for each block.
  2. Start zoom in every block/process and roughly estimate the complexity of the flowchart (or sub flowchart) for each block/process.
  3. Draw the flow chart for each process, start from the simplest one.
  4. Repeat step 2 and 3 if needed.
  5. Try to combine the flowchart altogether and analyze it ( maybe this step is not needed, but sometimes it helps)
For programming part
  1. Test all modules and main flow first, trace the flow by printing out some values in text files or in console if the debugging tools are not available.
  2. If all the modules work as expected combine it to follow the main flow. Else, recheck again the flowchart.
  3. Another tips is try replace each block/process with a two/three line of program before typing.

Te given technique are very powerful when dealing with low level language , however i believe that it can also be used for high level language.

NS2 installation

Today i want to write a little bit on NS2 installation .. not on how to install but focus more on problems occurred during installation. On installation guide please refer to NS2 website (the link are given in my favourite link). Take note that I'm using Linux Xandros 2.0 for the NS2. Given are the 3 common problem (Red) and possible solutions (Green):

Make fail because of no gcc compiler detected
Install the older version of gcc compiler ( Not sure with version of gcc? install all the version ! )

Error due tk not detected
Normally the TCL\TK will be installed using the allinone ns2 installation package, however in Xandros the installation of TCL\TK need to be done separately before the installation of NS2. Install the TCL\TK through Xandros Network then proceed with the installation of NS2.

The installation is successful but error: "ns command not found " occurred when invoking the ns interpreter.
Edit the .bash profile so that ns can be access from any folder. The .bash_profile is hidden in home directory. Restart the computer after the file has been edited and try to run ns again.

From experience the second problem will not be encountered if the NS allinone package are installed in Red Hat platform.

Wednesday, December 5, 2007

Talk by Sir Robin Saxby of ARM

Tun Mahathir Lecture Series

Attended Tun Mahathir Lecture Series at UNITEN, talk by Sir Robin Saxby on his success story of bringing his company to global level & beyond. His company is the one that promotes and design the ARM architecture - A microprocessor architecture used in PDA, hand phone etc.

Some key notes (that i can remember - not in the right order)
1. Sir Robin Saxby start as a Design Engineer.
2. The company is founded by 12 technically skillful engineers where the engineers later equipped with the soft skills to market the product.
3. Sir Robin Saxby uses SWOT analysis for planning
4. Academic, Business and Politics are very different in nature.
5. In business, pulling the customers are more important than pushing the technologies!
6. Family is very important.
7. Good engineers knows both software and hardware architecture well.
8. Think the impossible but get back to the reality
9. Sir Robin understands his fields very well , and aware of the technology growth.
10. Turn enemy into friends , and be neutral. (It's hard!!)

The talks are very motivating, thanks to the organizer (UNITEN n TNB ).

Tuesday, December 4, 2007

Electronic for (very) beginner

This morning.. my friends invite me for one or two hours of my weekend to teach some kids on electronics. Electronic for early beginners.. a good effort though n of course very interesting!

But after a thoughtful (?) 2 or 3 minutes , i decided not to commit .. too busy with my own works schedule. It will be started on january, if all my plans work according to schedule, then i can reconsider the offer. I just being careful.

Today , A PCB workshop has been conducted, the coordinator ask me to attend it.. Hm.. maybe I'll join later (at the end of the session) .

Thursday, November 15, 2007

Graph Thoery Algorithm

Graph teori ?? Mula2 baca tajuk ni memang konfius.. mula2 ingtakan macam graf biasa, ada paksi x paksi Y tapi bila baca2 rupa2 nya bukan macam tu .. abis tu ?macammana?

Graph teori salah satu cabang dalam matematik dimana , connection /edge (samaada logikal atau conceptual) antara node (Vertex) di modelkan dalam bentuk seperti berikut:

G = (V,E)
V = set vertices
E = set of edge

maksudnya , satu set graph terdiri daripada set of vertex (v)/node dan set of edge (e)
so senang ceritanya

contohnya jika 3 node yang bersambung antara satu sama lain , bolehlah ditulis seperti berikut:

G = (V,E)
E = { 1 ,2 ,3 }
V = { { 1,2} , { 2,3} , {1,3 } }

maksudnya: ada node 1 2 dan 3 , kemudian ada connection dari node 1 ke node 2 , node 2 ke node 3 dan node 1 ke node 3. Perhatikan perkataan "ke" disitu , Ini menunjukkan arah jika graph tersebut si assumekan sebagai directed graph , tapi jika graf tersebut adalah jenis yang tiada arah .. maka perkataan ke kat situ bolehlah ditukarkan kepada perkataan "dan"

Untuk menulis program berkaitan dengan Graph Theory ni yang penting ialah data structure yang perlu digunakan. Paling jelas ialah dengan menggunakan list atau linked list atau lagi jelas menggunakan teknik list didalam list. Teknik yang kediua ialah dengan menggunakan array untuk represent matrix , connection setiap node diwakili oleh nilai 1 manakala jika tiada connection diwakili oleh nilai 0?

dari segi praktikaliti , faktor yang penting (saya rasa la... ) untuk memilih jenis struktur data ialah 1. Programming Language, 2. Aplikasi yang hendak dibangunkan

dari segi programming language contohnya jika menggunakan MATLAB, cara matrix tentulah lebih elok sebab memang MATLAB terkenal untuk matrix calculation, tapi jika menggunakan TCL lebih elok menggunakan list memandangkan salah satu strengh TCL ialah dekat List dan String processing.

Okey .. tu dulu..

nak kena belajar banyak lagi nih..

Sunday, May 20, 2007

Conference etc

Its about more than one week i' not updating my blog..


I'm busy with a conference , where i need to present my research findings or result, its an international conference on Internet and telecommunication. At first its quite nervous to present in quite international conference. They seems very experts in their respective fields. I must work hard to be like them!

Most of them are experts but very humble person and most importantly they are willing to share their knowledge. In Internet simulation area most of them are using NS2 for their simulation works. I'm on the right track!!

Sorry , for now i cannot reveal yet the content of my paper until it is published by the organizer.

Assembly Language vs TCL\TK

I use to do programming in Assembly Language for Motorola Microcontroller, and now I'm learning TCL\TK, two different type of language, the first one is very low level and the second one is a high level language.

Personally it is quite difficult to change the way of thinking when switching from low to high level language.

In assembly language the syntax is very simple, its arranged column by column, e.g first column is label follows by instructions column , and data/memory column. Simple! The data structure is also very simple, only a hexadecimal number. which can represent decimal number, ASCII code, floating point number etc depends on standards and application to be developed.

But using high level language need you to familiarize with the syntax, and the syntax for C language of course not the same with TCL\TK , Perl , Python etc.
The data structure also defers, as example the data structure for TCL\TK is based on string not integer or floating point. For C , data can be integer, Boolean , long integer ..... [ refer to any C programming book]

Data structure of TCL\TK

After a few study and reading , and searching Internet,
I come to conclusion that in TCL\TK, there are only two type of abstract data structure : List and Array

If I want to make complex data structure for my application i need to design it ( or just use any package designed by others) based on List and Array.

For my case, i try to use a data structure which is based on combination of arrays and lists [specifically, linked-list]


A few of my colleague are very enthusiastic to learn NS2 which can be used for network simulation purpose. Very good news for me! Now I have more people to discussed with.

Programming = Chess= Gaming??

One day , my friends and me have a "coffee chit-chat" about playing chess, and the conversation continues with programming and gaming.
We come into a conclusion :

Programming = Chess = Gaming. This three subject have one common similarities, "you have to play within the rules in order to achieve your objective!"

Thursday, May 10, 2007

Kenapa saya mem'blog'?

Ada segelintir kawan2 tanya.. kenapa saya buat blog? pasal programing pulak tu..
nak tunjuk pandai ke?

Antara sebab2 nak tulis blog ni saya senaraikan seperti berikut:

1. Saya cepat lupa apa yang saya belajar, saya tulis konse2 yang saya belajar dalam bentuk yang kurang supaya bolehlah saya rujuk kembali.
2. menulis dalam Microsoft Word atau text editor yang lain sangat membosankan
3. Saya tak pandai .. dan juga tak pandai bertanya - Setiap kali saya bertanya soalan biasanya orang akan rasa soalan tu complex dan meyusahkan diorang untuk menjawab soalan. So instead of going around asking for people's opinion , saya tulis pengalaman dan apa yang saya faham disini , kalau sesiapa nak baiki silap dan salah , terima kasih banyak2 saya dahulukan.
4. Ada yang ingin belajar - saya percaya ramai jugak yang tak pandai buat programming tapi berminat nak belajar dan ada pengalaman macam saya jugak . Bolehlah kita yang sama2 tak pandai berkongsi ilmu!

Okeh ituh jer yang nak ditulis, kalau nak bagi reason lagi .. banyak lagi boleh letak... tapi maleh ahh...

nak tunjuk pandai? yer ! Berdasarkan sebab2 diatas tadi memang saya nak tunjuk pandai!

Wednesday, May 9, 2007

Belajar data Structure

Today and yesterday.. spent some of my time .. understanding data structure by reading from the wiki..

somehow i get lost somewhere to understand the data structure,
there are so many type of data structure e.g list, array,tree , list of array, hash table etc.
however after nearly an hour reading the article i get bored, and still doesn't get the idea .. i

however today.. just now after dinner with my friend (who works in a software company).

I ask a few questions about data structure.
What are data structure?
what data structure is good for certain application (like P-Spice , Maxplus ) ?
and the most important question is : why do it so hard to understand text books and Internet article?

My friends said: data structure is a basic knowledge in computer programming, however when learn programming , usually we cannot get the concept of the topic but more focused on syntax and usually we lost there.. without getting to grab the main idea. And usually while reading books we are more focused on the implementation (coding) .

Then after a few discussion , this is the idea of main structure that has been required:

the main idea of data structure is to hold data,

the type of data structure selected determine by : application to be developed, the programming language itself , and the performance required.

what we need to know to study data structure?

1. How to store data ?
2. How to retrieve data ?
3. How to delete data?
4. How to replace data?
5. How to sort data?
6. How to relate data?

That's all , now everything become clearer and clearer. Good or not the type of data structure selected is depends on the application to be developed.

Tuesday, May 8, 2007

First entry..

This is my first entry for this blog.. , i used to have a blog before.. but i'm too lazy to update or sharing personal life with other people. However i decided to write some of my experiences learning programming here in this blog.

Programming wise, I'm not an expert, not in computer science or software engineering background.

I'm already familiar with:
  1. Assembly Language (68HC11 motorola,68000 motorola assembly language)
  2. PIC C language for PIC microcontroller : A costumized C - based language for PIC
  3. Network Simulator 2[NS2] : Scripting Language for network simulation.

I used to learn :
  1. C++, Visual C++
  2. Visual Basic
  3. Intel 8086 Assembly Language
Now I'm learning :
  1. Awk - A tool used in linux for text processing purposes
  2. TCL/TK language - a free open source scripting language
I also going to learn this knowledges:
  1. Data structure
  2. Geometry Programming ( Graph)
  3. A little bit in software architecture

Hm.. i guess thats all as a starter