-
Recent Posts
Recent Comments
- petruchek on Confession of the occasional blogger
- petruchek on Confession of the occasional blogger
- Paul Synnott on Google Chrome: Use Space Bar to Confirm Form Resubmission
- Andrew Gunn on Google Chrome: Use Space Bar to Confirm Form Resubmission
- Andrei on Format file size
Archives
Categories
Meta
Category Archives: Uncategorized
Get number of days in month with PHP
Problem: get number of days in certain month with PHP, if $m – is a month and $y – is an year. First solution, hacker-style (source): (31 - (($m - 1) % 7 % 2) - ((($m == 2) << !!($y % 4)))) ?> This solution doesn’t work properly for years divisible by 100, and non-divisible by … Continue reading
Test before you send
This summer was really hot for my hosting provider. Here is summary of emails I’ve received from them: Jun 11: On June 27, 2010, between 06:00am and 10:00am CST, our Development and Database teams will be performing several upgrades of … Continue reading
What is mod_rewrite
I love these mod_rewrite epigraphs: The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail. Despite the tons … Continue reading
Invalid markup
Valid markups are all alike; every invalid markup is invalid in its own way. (Leo Tolstoy, Anna Karenina) Speaking about impossibility to repair invalid markup automatically for any given markup.
Format file size
Code snippet to output number of bytes with unknown capacity: function format_filesize($bytes) { if ($bytes == 0) return ’0.00 B’; $s = array(‘B’, ’Kb’, ’MB’, ’GB’, ’TB’, ’PB’); $e = floor(log($bytes)/log(1024)); return sprintf(‘%.2f ’.$s[$e], ($bytes/pow(1024, floor($e)))); } I don’t know the author of this code.
Curl — change your IP address
If you have multiple IP addresses and you want to make curl request using non-default IP, you can do it by setting CURLOPT_INTERFACE option: curl_setopt ($ch, CURLOPT_INTERFACE, ’11.22.33.44′); This will work only if you really have that another IP. If you do … Continue reading
Slow FTP Login
Angry users sent me a link to discussion of what can cause Proftpd delay during authorization. So I’ve decided to fix it. Added UseReverseDNS off to config file — didn’t help. Added GoogleDNS (8.8.8.8) to resolv.conf — didn’t help. Added … Continue reading
Easter Egg from Last.fm
What a lovely easter egg from Last.fm developers in their robots.txt file: Disallow: /harming/humans Disallow: /ignoring/human/orders Disallow: /harm/to/self Hint.
OK, let’s try
It looks like I was able to make WordPress work from single installation on two different domains in different languages without touching its core files. I do not want to touch its core files because I want to be able to upgrade … Continue reading