A place where I share my daily experience in both technical and non technical issues. Expect to read Linux kernel related posts too.
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" :)
17 February 2011
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:
int main(void)
{
printf("%d,%d\n", increase(), global_a);
}
#include
int global_a = 10;
int increase(void)
{
return global_a += 10;
}
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.
27 January 2011
Making latest 2.6.x Linux kernel works with recent Linux distro
If you wanna compile new Linux kernel, let's say 2.6.35 onwards and you want it to run on fairly "old" distro, let's say CentOS 5.5, you might find it weird that it refuses to boot somewhere during root device mount?
Note: Wait, you say CentOS 5.5 is "old"? What I mean here is not "old" as "it's released 6-8 years ago", but old as "using quite old userspace tools"
What happen? You might think that you missed to enable (or possibly) include the filesystem driver in the initrd/initramfs. It's not. Thanks to various discussion archieve I found in Internet, it's a matter of enabling these two items in kernel config:
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
If you're confused where to find them, it's in "General Setup". The item is named "enable deprecated sysfs features to support old userspace too". Then you're ready to plunge the new kernel into the distro.
regards,
Mulyadi
Note: Wait, you say CentOS 5.5 is "old"? What I mean here is not "old" as "it's released 6-8 years ago", but old as "using quite old userspace tools"
What happen? You might think that you missed to enable (or possibly) include the filesystem driver in the initrd/initramfs. It's not. Thanks to various discussion archieve I found in Internet, it's a matter of enabling these two items in kernel config:
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
If you're confused where to find them, it's in "General Setup". The item is named "enable deprecated sysfs features to support old userspace too". Then you're ready to plunge the new kernel into the distro.
regards,
Mulyadi
23 January 2011
gdb trick for printing array content
This is taken from Fedora planet, somekind of blog aggregator of the member of Fedora Community. This post discusses about the way we can print array values in gdb.
Here is the link http://wagiaalla.com/2011/01/20/gdb-tricks-printing-arrays/, written by Sami Wagiaalla.
....And here is some excerpt from it:
int main(){
int *a;
int b[3] = {1,2,3};
a = b;
int *c[3] = {a, b, 0};
int **d = c;
return 0;
}
While debugging the above code if you do:
(gdb) print b
$4 = {1, 2, 3}
that works.
(gdb) print a
$5 = (int *) 0x7fffffffe0f0
that works too, but in order to print a as an array you must do:
(gdb) print (int []) *a
$7 = {1}
and when you specify the size it gets better:
(gdb) print (int [3]) *a
$8 = {1, 2, 3}
regards,
Mulyadi
Here is the link http://wagiaalla.com/2011/01/20/gdb-tricks-printing-arrays/, written by Sami Wagiaalla.
....And here is some excerpt from it:
int main(){
int *a;
int b[3] = {1,2,3};
a = b;
int *c[3] = {a, b, 0};
int **d = c;
return 0;
}
While debugging the above code if you do:
(gdb) print b
$4 = {1, 2, 3}
that works.
(gdb) print a
$5 = (int *) 0x7fffffffe0f0
that works too, but in order to print a as an array you must do:
(gdb) print (int []) *a
$7 = {1}
and when you specify the size it gets better:
(gdb) print (int [3]) *a
$8 = {1, 2, 3}
regards,
Mulyadi
Subscribe to:
Posts (Atom)
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...
-
Update: June 14th, 2016 6:01 PM UTC+7: using direct I/O or raw access also bypass filesystem caching. This also has effect to avoid double...
-
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 ...
-
Ever saw something like below messages inside your KVM (Kernel Virtual Machine) guest's console? " BUG: soft lockup - CPU#0 stuck f...