Mindblown: a blog about philosophy.

  • jQuery odd/even selector bug?

    For some reason I have not been able to identify and test, this code would not work (show the same color or same color for subsequent rows, does not seem to have a pattern): $(“#tableid tbody tr:even”).addClass(“even”); $(“#tableid tbody tr:odd”).addClass(“odd”); But this does work: $(“#tableid tbody tr:nth-child(even)”).addClass(“even”); $(“#tableid tbody tr:nth-child(odd)”).addClass(“odd”); Any thought?

  • jQuery eq() typical mistake

    With all the open/close quote, you might write this code: var i = 123; $(“:checkbox:eq(i)”).removeAttr(“disabled”); Since the selector string is within the quotes, the correct statement should be: $(“:checkbox:eq(“+i+”)”).removeAttr(“disabled”);

  • vmstat – Get an overview look at your server

    Get an update every one second [root@s14 trungson]# vmstat 1 procs ———–memory———- —swap– —–io—- –system– —-cpu—- r b swpd free buff cache si so bi bo in cs us sy id wa 3 0 41200 33324 2152 1489108 0 0 4 27 0 1 5 3 91 0 2 0 41200 33500 2152 1489108 0…

  • Duplicate value under Binlog_Do_DB

    If you see Binlog_Do_DB show duplicate values and you mention them only once in my.cnf. For example: db1,db2,db1,db2. You would suspect that something is reading your my.cnf twice. That would be correct as it’s a MySQL bug #20748

  • Some Hack Script

    After my fare share of performing security audit, these are some hacking script I found, not for the purpose of hacking, but for education, analysis and prevention. function ConvertBytes($number) { $len = strlen($number); if($len < 4) { return sprintf("%d b", $number); } if($len >= 4 && $len = 7 && $len

  • Use ethtool or mii-tool to detect problems with ethernet card

    [root@s2 adserver]# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Full Advertised auto-negotiation: Yes Speed: Unknown! (0) Duplex: Half Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) Link…

  • Ad Server with AJAX

    Normally, JavaScript document.write is used by ad servers to write the ad code directly into the page (AdSense, AdSpeed, OpenX, etc.) To reload ads automatically without a page reload, we use AJAX with JSONP (JSON with padding). Partial content reloading uses DOM to update the content. jQuery 1.2.x has this built-in, or you can write…

  • Linux CentOS – Kernel panic

    This looks like an error with memory by sim. Anyone has a better clue? The kernel version is 2.6.9-67.0.4.EL, then we rebooted and upgraded to 2.6.9-67.0.20.EL. Any kernel bug I should be aware of? Jul 13 04:03:13 host syslogd 1.4.1: restart. Jul 16 08:00:01 host kernel: swap_free: Unused swap offset entry 00010000 Jul 16 08:00:01…

  • jQuery, Google AJAX APIs

    We recently implemented jQuery into our ad server, majorly for future feature expansions and hopefully convert some of the existing JS enhancements using jQuery for a simpler codebase. Google AJAX API is nice but does not support SSL, which is quite inconvenient.

  • Frustrations with Google AdWords

    Google withholds lots of data for their own data-mining purposes. The stated level of click frauds is definitely questionable from our own experience. Don’t forget to check your own click logs and adjust your account promptly or Google and their affiliates are wasting your budget. Their customer service representative often replies with a very long…

Got any book recommendations?