Month: August 2008
-
Check username availability via AJAX with jQuery
HTML Checking… JavaScript $(“#loading”).hide(); var orig=$(“#loading”).html(); $(“#UserNameInputID”).blur(function() { $(“#loading”).html(orig); $(“#loading”).show(); loadTextPage(“loading”,”check.php?username=”+$(“#UserNameInputID”).val()); }); /** load a text page into this div */ function loadTextPage($pDivID,$pURL) { $.ajax({ url:$pURL, dataType:’html’, success:function (txt) { $(‘#’+$pDivID).html(txt); } }); Server-side check.php
-
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…