19 April 2011

Getting confused when exploring Qemu source? gcc comes to rescue!

Quick summary first: use gcc -save-temps!

Ever dig into Qemu (qemu.org) source code? OK, I assume you ever did that at least once... may I ask, what's your first impression?

Here's mine: it's complex C code...and to make it more like a nightmare, it heavily uses c (gcc, to be precise) tricks almost everywhere. ifdef, "##", define....almost endless. IMHO, since Fabrice Bellard, its author, is somekind of C compiler wizard, he somehow pull out all of those tricks so easy from his mind. I know it should make the code kinda more readable, but for me, is not.

Take one for example: INDEX_op symbols. AFAIK, it has something to do with code generation, to be precise it's an index toward instruction op which will later be translated to target. Previously, I thought it was defined somewhere in header files, but turns out (after long hours of grep and cscope sessions) they were created by preprocessor (token concatenation, to be precise -- explanation here).

So, what is the recipe? I think I found it (thanks to this URL http://stackoverflow.com/questions/3812670/what-are-the-internal-processes-involved-for-a-c-compilation/3814007#3814007) , although not really ideal. During configuration session, use extra cflags like this:
./configure --extra-cflags="-save-temps"
Put additional parameters as needed. Then do "make". Now, if you do this in main Qemu source tree:
find -iname "*.[is]"
you'll find several files. Each of them are result of  preprocessing (.i) and assembling (.s). Yeap, "-save-temps" comes to rescue, folks! So there you go... open them one by one and hopefully you get better picture on how to code works.

regards,

Mulyadi Santosa

04 April 2011

Troubleshooting failed login to GTalk in Empathy 2.30.3

Alright, I just wanna make it quick:
- Check "Ignore SSL certificate errors"
- Uncheck "Encryption required (TLS/SSL)"
- Use "443" as port
- Check "use old SSL"

OK, that's it people...it works for me, hopefully it works for you too. Cheers...

regards,

Mulyadi Santosa

02 March 2011

My writing about filesystem in DataCenter Magazine 2/2011 issue

First of all, I thank God for the opportunity and trust He had given to me. Without His bless, I can't complete this article quick enough but still in good quality.

In 2/2011 issue of Data Center Magazine, I contribute an article that discusses about what filesystem really is, understanding several basic properties of filesystems and probably the most important one: how to choose the optimal filesystem for certain workload.

I welcome you to download, read and give me constructive feedback. As I am far from top notch technical writer level, feedback would allow me to enhance the quality and at the same time correct any possible errors.

PS: I owe a lot to Greg Freemyer for his inputs and critics on the early draft. He's one of the best file system expert I ever met!

regards,

Mulyadi Santosa.

19 February 2011

Human perception on latency....

http://blog.benstrong.com/2010/11/google-and-microsoft-cheat-on-slow.html and http://books.google.com/books?id=aU0MR-MA-BMC&pg=PA292#v=onepage&q&f=false    show to me that, by experiments, when latency is under or roughly equal to 150-160 miliseconds, human sense can not feels or sees that. Good to know.... so one just need to make sure computation result is shown under 150 ms and we shall say "Dear Lord, it's magically appears" :)

30 January 2011

Fantastic CGI!


Silestone -- 'Above Everything Else' from Alex Roman on Vimeo.

Not sure about you people, but I think the above video is simply superb! And to make it even "more superb", it was made just by 2 person in 2 1/2 month. They certainly have the skill...

NB: If somehow the above embedded video isn't shown in this blog, just head over to this site to watch it.

regards,

Mulyadi

29 January 2011

Order of argument evaluation in C, left-to-right or right-to-left?

Suppose you have written the below codes:

#include
 
  int global_a = 10;
 
  int increase(void)
  {
       return global_a += 10;
  }

 int main(void)
 {
      printf("%d,%d\n", increase(), global_a);
 }
 
And you compile it, what output would you expect? "20,10"? or "20,20"? 
 
I was thinking "surely it is 20,20!". But this post says both are right! Wow.....
Note: the original poster was actually comparing GCC to TCC (Tiny C Compiler).

regards,
 
Mulyadi.

How to execute multiple commands directly as ssh argument?

 Perhaps sometimes you need to do this: ssh user@10.1.2.3 ls It is easy understand the above: run ls after getting into 10.1.2.3 via ssh. Pi...