Wednesday, February 11, 2009

AWK Programming Language [revisit]

I'm now revisiting AWK language for trace file processing. Awk has been widely used for trace file processing, since (I believe) it is easy to do column filtering.

The column can be represented using $1 for column 1, $2 for column 2 etc.. , using other language like Tcl requires list manipulation which is not as straight as using AWK.

However, of course, the syntax of AWK is a little bit different than Tcl and C.

I will be "reusing" AWK to calculate throughput , loss , jitter etc. There are quite a few AWK codes available in the net for this purpose, however I want to make the code as flexible as possible and cater for our group needs.

First, I will be looking back at RFC's and papers on the network performance formula.Then, get available AWKs from the net (to enhance understanding) and modify the code to suit our need.

Our new research assistant maybe can help me working on this??

Performance of AWK?? Hrmm... anybody have experience using AWKs? How is the speed compared to C and Tcl (or MATLAB?)

I will not focus on performance for now , I believe it is acceptable, for now the main factor is whether it make my work easier or not.

"Live life in this modern world is complex enough! Programming Work Shouldn't Be "

Wednesday, February 4, 2009

Random Thought: Flow chart! Write it down!

I have been conducting microcontroller lab for a while as a lab instructor.
Microcontroller consists of both Hardware and Software. A microcontroller application need to read to read data from input , process it and make decision, then send data to the output based on the decision. Seems easy right? This is not what I want to write this time.

In a lab usually students are given a manual where in the manual the first part, the program is given and in the last part, student need to write their own program for certain application.

Believe it or not! Most of them "drawing flowchart in their mind" and getting confused of the program flow. Most of the time is wasted here, some takes about one hour for a program with simple if-else structure. Sometimes I wonder, Is it that hard to hold a pen and sketch it down? Or is it because they have full confidence of their capabilities. At the end what they do is asking the lab instructor to help trouble shooting the code! Some of them (not all - just a few) blaming the computers/compiler or even the microcontroller for not working.

I don't know about others, but me myself, without sketching and flowcharting, I will get lost in the flow, my minds keep being creative to do this and that, and its getting tired easily. I need a flowchart or diagram! if during that time I am tired of looking at the flowchart, I'll write the "story line", I dont want to get lost!

If the path is straight there is no need to go left or to go right, just go forward!

Enough for today, I want to start writing TCL program based on the diagram and result of discussion with taufiq last night.

Wish me luck and success!

Tuesday, February 3, 2009

Random Thought : Programming

Hey you!! do this and do that!

I don't know whether it is correct or not , I'm not a programming expert.

As far as I made to understand, doing programming is all about giving instruction to the target machine to do "this" and "that". The machine will always obey the instruction provided that the command can be understood by the machine?

Machine only understand binary !

The problem is how we are gonna give instruction, "binary" is not our language. Furthermore "Binary language" is differs depends on each machine architecture, the instruction for Motorola and the instruction for Intel , of course will be different.

Tadaaa... Programming Language is here!! Please, use it!! Instruct the machine. Fear not, your instruction will be converted to their "binary language". Just make sure that you know the language well - the format, the instruction and the "grammar".

Please choose a few type of language from lower level language to higher level language, once again worry not , there are assembler, compiler, and interpreter to convert the language into the "binary language".

Ok, there are programming language. The machine will always obeys ( if there are no errors in the language )

It is about the programmer!

The machine will always obey! If the application work, it is me who give instructions to the machine. If my application crash it is my fault and I'm responsible to rephrase it. Simple!

If I'm good the machine will show me the good result! If I'm not good enough, the result will not be good!

I should spent time programming (re-programming?) myself, I wish I can obey my command. 90% is more than enough! Shouldn't I?