Monthly Archives: June 2011
getting variables to an anonymous function
var x = 6; (function(y){ alert(y); })(x) I was trying to get a jQuery object into a setTimeout function. I remembered this. I didn’t get it working yet.
class Geocode
class for geocoding addresses with google service. Caches results in cache/ directory. that must be writable. <?php class Geocode{ private $address; function __construct($address){ $this->address = $address; } function getLatLng(){ $cacheKey = md5($this->address); $cacheResult = $this->checkCache($cacheKey); if($cacheResult != false){ $location … Continue reading
class XMLhelper
class with array to XML. <?php class XMLhelper{ function arrayToXML($array){ $xml = new SimpleXMLElement(‘<root/>’); $this->helper($xml->root,$array); return $xml->root->asXML(); } function helper(&$xml,&$array){ foreach($array as $key => $arrayItem){ if(is_array($arrayItem)){ $child = $xml->addChild($key); $this->helper($child,$arrayItem); } else{ $xml->addChild($key,$arrayItem); } } } } $debug = false; … Continue reading
jedit PHPparser and SideKick plugins
The search for a PHP editor with GOOD code-hinting continues. These plugins offer a pretty useful class structure window, but I’m still getting pretty terrible method / member suggestions while typing.
bridging, ip forwarding and masquerading
I spent a lot of time trying to share network connections with pretty random configurations. for example, share a laptops wifi connection over the ethernet cable which had wifi router at the other end. I installed bridge-utils in ubuntu and … Continue reading
crack WEP
first you need a wifi card that your linux dirsto understand. install wlan tools and make sure they work. install aircrck-ng. Kismet is also pretty useful for identifying networks. you can do this without packet injection but its about 100 … Continue reading
entity relationship clarification
for some reason some new PHP frameworks(cake is one) have decided it’s an ok idea to create new entity relationship rules. It’s not. these are the 3 options for relationships: 1) 1-to-1 2) 1-to-many 3) many-to-many I’m really surprised how … Continue reading
Best Linux distributions
no one really knows. most people I consider pretty smart say Debian or Ubuntu. I believe the reason is they are the free-est. surprisingly I’ve found them to be the best aswell. I’ve had a few challenges installing various distributions … Continue reading
mod_rewrite
in .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> helpful keywords: allow override, (allows .htaccess in www directories) also need mod_rewrite enabled on apache, search google I’ve had to … Continue reading
ajax back button solution
set the url to the same thing, with an anchor tag(# in the url) with variables after it. use javascript, ajax to send those variables to the server (things after the hash are not sent, unless you do it(2011)). then … Continue reading