Monday, Jun 29th, 2009 by
admin
Category:
Programming Tags:
asm,
c,
trick
Let’s say for some reason you don’t have a disassembler and you wanted to find the address of a place in your program. This is useful for things like finding out how the size of a function, stack, or some code.
There are many ways to do this.
Probably the easiest way is to use GCC, a free compiler.
int main()
{
int c;
here:
c = 5;
printf("Address: %p", **here);
return 0;
}
Read the rest of this entry »
Saturday, Jun 27th, 2009 by
admin
Category:
Internet Tags:
google,
myths,
optimization,
tips,
web
Google recently published a website called Let’s make the web faster.
Aimed mostly at newbies, they have a few tips that made people cringe despite having Google’s Seal of Approval. We will look at some of these optimizations and see if they really help.

Micro-optimization
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. – C.A.R. Hoare
Read the rest of this entry »
Thursday, Jun 25th, 2009 by
admin
Category:
IT Tags:
monit,
php,
web
Just a couple hours ago, you may have noticed that this website was showing blank pages.
For some reason, PHP decided to stop working. Every PHP page was blank. I simply restarted it, and it worked again.
Unfortunately the error-logs are disabled for PHP in the default “production site” configuration. So be sure to enable that option.
Another option is to use Monit to monitor whenever PHP stops working. The trick is to use the “checksum” option:
[Usual monit php configuration here]
if failed host www.codexon.com port 80
protocol http and request "/monit.php"
with checksum 5eb63bbbe01eeed093cb22bb8f5acdc3
then restart
Where checksum is the MD5 value of the file. Then we create monit.php.
<?php
echo "hello world";
?>
So whenever PHP starts choking and serving blank pages, Monit will restart your PHP for you.
For those interested, this is the PHP I am running. All of which are from the Ubuntu 9.04 repository.
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli)
(built: Apr 23 2009 14:37:14)
APC 3.0.19-2
Wednesday, Jun 24th, 2009 by
admin
Category:
Browser Tags:
benchmark,
chrome,
Firefox,
ie,
myths,
Opera,
Safari
(An improved benchmark is being developed. A link to it will be here when it is completed.)
When it comes to a browser benchmark people act like this:

xkcd
The problem with browser benchmarks today is that they are extremely synthetic. A majority of them are Javascript only because its easier to test.
Read the rest of this entry »
Sunday, Jun 21st, 2009 by
admin
Category:
Codexon Tags:
php,
web,
wordpress
You might have noticed that the database loading times on here have doubled.
I looked at the database and had a true WTF moment.

In as little as 1 week a WordPress plugin created 25,660 entries of visits, each one recording 1-5 visits.
Amazingly, this is one of few web counter plugins available for WordPress, and it even has over 17,000 downloads.
Update
I am currently helping the author debug this problem but for now I have already switched to another plugin which cut down database query time by 300%.