Archive for the 'Hacks' Category

oci_bind_by_name maxlength is not so optional

on Tuesday, May 6th, 2008

If you think that the maxlength parameter in the documentation of oci_bind_by_name is optional, see this example and think again.
Lets say you have your column names in an array already and you want to bind them in a loop smartly.
Read more…

PHP APC apc_shm_create error on CLI

on Tuesday, March 11th, 2008

If you’re getting an error like this one below on Windows PHP commandline make sure that you are not running an apache server that uses apc on the same machine!

[apc-error] apc_shm_create: shmget(0, 8388608, 658) failed: No error. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment.

This was hard to figure! Tested with PHP 5.2.5, APC 3.1.0-dev.

Hack a GOV for black hat SEO

on Saturday, August 11th, 2007

It was weird when I see a keyword, that I’ve regularly watched, poped up at a .gov site.

Some blackhats, hoping to get the page rank benefits of a .gov site, hacked the forum of the site and placed a gateway like page. I guess search results come from google as well.

Check it out yourself.
nevadacityca.gov

PS: the keyword I was looking was the name of one of my sites, not cealis lol.

Sitemaps in the robots.txt Happy Harvesting

on Wednesday, April 11th, 2007

I’ve just read the Google Webmaster’s blog about the news on ask.com supporting Sitemaps.org’s sitemap format.
This is really a great news for all the people that like to be crawled faster and acurately.
For me the more interesting part about this news is that sitemaps.org’s proposal to include sitemaps into the robots.txt.

Simply you add a line into your robots.txt saying

Sitemap: <sitemap_location></sitemap_location>

This part is really cool but for site harvesters it’s an unbelivable tool. So you can handover the key to your site and web harvesters can crawl your site really easily because probably you’ve put all your site’s pages into your sitemap.

Sounds like a good plan in an ideal world. With all the cloakers and content scrapers you must be really smart not to be ripped apart.

My suggestion is to know who you’re serving the sitemap. Currently Google, Yahoo and Ask is supporting this sitemaps.xml and no other site has anything to do with it.
Here is a simple check you can add in the begining of your sitemap thing:

< ?php
    function botIsAllowed($ip){
        //get the reverse dns of the ip.
        $host = strtolower(gethostbyaddr($ip));
        $botDomains = array('.inktomisearch.com',
                                     '.googlebot.com',
                                     '.ask.com',
                             );

        //search for the reverse dns matches the white list
        foreach($botDomains as $bot){
            if (strpos(strrev($host),strrev($bot))===0){
                $qip= gethostbyname($host);
                return ($qip==$ip);
            }
        }
        return false;
}

if (!botIsAllowed($_SERVER['REMOTE_ADDR'])){
    echo "Banned!";
    exit;
}
?>

I’m sure everyone can get the idea of reverse dns and forward dns checking.
If I missed any decent site that uses the sitemaps let me know.

Note: If you’re still using static sitemaps (!) you can just include the xml after the code.

The 6 way you boss is killing you

on Monday, December 12th, 2005

Here’s a different slide show about how your boss is killing you and how you can fight back.

link

Free Credit Report

on Thursday, December 1st, 2005

To all my Canadian friends, know that you can get a free credit report from equifax.
You can get up-to 2 credit reports per year just filing our this mail-in request.
Easy heh?

  • They require two pieces of personal identification to process your request. (Example: driver’s
    licence, bank account statement, gas, phone, electricity or cable bill).
  • If your current address has changed within the last 90 days, a confirmation of address must be attached with your request in order to be
    processed. (Example: gas, phone, electricity or cable bill, bank account statement, driver’s license).
  • You can expect to receive a copy of your personal credit report via regular mail within 5 to 10 days.
  • Mail it to :
    P.O. Box 190, Station Jean-Talon,
    Montreal, Quebec
    H1S 2Z2

    Thoughts Aside:
    The american express online offers its clients personalized online access to the bank of america card as well as other financial services. City bank of America offers low interest card at the lowest interest rate of citi cards available. The citizens bank also facilitates its customers by guiding them all through the chase credit card rates now available.

    The Noguchi Filing System

    on Wednesday, October 5th, 2005

    This is an interesting article about Noguchi Yukio’s filing system.

    Google Talk

    on Wednesday, August 24th, 2005

    I’ve set my mind not to post about Google Talk but this worths posting.

    The first hack for Google Talk.
    How to Broadcast MP3’s, Podcasts and other audio over Google Talk

    Also the thing that I don’t plan to post about Google are:
    - Google OS
    - Google Wi-Fi
    - Google Desktop
    - Google Browser (why not?)

    Windows and Linux on the Sony PSP

    on Monday, August 15th, 2005

    Windows and Linux on the Sony PSP? hmm