Archive for the 'middleware' Category

the fade anything technique

Problem You want to add something flash to your site.A color loads, which you then want to change Solution Well cool “Fade Anything Technique”!Really simple implementation, just copy and then any divs, etc with an id of fade-xxx will fade from that color. Many more options, check out these highly recommended articles. Example <head> … [...]

Scrape Web Site – Create Graph or Chart

Problem Looking for a free online tool, that scrapes web site content and produces graphs for HTML tables? Solution Here it is! Click to access my free online HTML table to Chart tool. Example From THIS to THIS Reference to come …

epoch generation and converting

Problem You want to generate the current epoch offset for UNIX. The count forward since 8am on 1st Jan 1970.Or conversely you want to see the date and time, for a given epoch offset. Solution You can use perl’s mktime or localtime – or just use my tools below. Example Either enter epoch:Or enter the [...]

Free online vertical text image creator

Enter the text to super-impose here and your colours BackgroundR: G: B: ForegroundR: G: B:       label: image will appear here If you want to see the code here it is | Free online vertical text image creator

Vertical label creation

Problem You want to generate a vertical image, with text over the top. Solution Here is some code I wrote, which is used extensively on my sites:<?phpheader(“Content-type: image/png”);$string = $_GET['label'];$symbols=array(‘r’,'g’,'b’);for($i=0;$i<count($symbols);$i++) {    $mythis=$symbols[$i]; if(is_numeric($_GET[$mythis])) { $$mythis=$_GET[$mythis]; } else { $$mythis=0; }}$symbols=array(‘tr’,'tg’,'tb’);for($i=0;$i<count($symbols);$i++) {    $mythis=$symbols[$i]; if(is_numeric($_GET[$mythis])) { $$mythis=$_GET[$mythis]; } else { $$mythis=”255″; }}if(isset($_GET['font'])) { $font = $_GET['font']; } else { $font=”2″; }$len=strlen($string);$text_width = imagefontwidth($font);$text_height = imagefontwidth($font);$im  = imagecreate (20, ($len*$text_height)+10); /* Create a blank image */$bgc = imagecolorallocate ($im, $r, $g, $b);$tc  = imagecolorallocate ($im, $tr, $tg, $tb);imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);imagestringup($im, $font, 4, ($len*$text_height)+3, $string, $tc);imagepng($im);imagedestroy($im);?> Example Reference Give it a blast on this site, like this: http://coding-school.com/common/label-up.php?label=your+text+hereAutomatically calculates size required. You can also add font=# – where # is 1 to 5, like [...]

libcurl lookup taking long time

Problem You notice for some hosts curl and/or libcurl are taking 7 or so secs to lookup the host. But nslookup or dig respond almost immediately. Solution Try doing curl -4 -w “time_namelookup: %{time_namelookup}\n” …. and try without the -4. If you see drastic differences, you could be falling foul of the IPV6 bug. To [...]

Perform HTTP Basic Authentication with HTTP headers and libcurl

Problem Came across an interesting problem with curl.For curl to perform HTTP Basic Authentication, it is easy to pass –user to the curl command, but harder with libcurl.Suspect there is an attribute that can be set, but I monitor a multitude of web sites through some perl scripts and libcurl. I did n’t want to [...]

IP, TCP, UDP, and ICMP Header Drawings

Problem Solution Example Courtesy of Digg."Here are some drawings I did to better understand the structure of the headers for IP, TCP, UDP and ICMP. Please feel free to used them for personal uses. If you would like to include them in a publication, please contact me at the address in the drawings. I created [...]

How to Crack a Website – XSS, Cookies, Sessions

Problem Solution Example Reference Courtesy of Digg.“Informit.com provides an insiders look at a real life XSS attack and how it was used to bypass the authentication scheme of an online web application, leading to “shell” access, and admin account, and more. XSS attacks are often discussed in theory �� this walk through illustrates just how [...]

Simple Basic Encryption – Main differences between algorithms

Problem Solution Example Reference Symmetric Algo – one key to encrypt and decrypt.Asymmetric Algo – separate key to encrypt and decrypt.Stream ciphers – encrypt each bit in sequence.Block ciphers – encrypt specific blocks of bits.Hash/Message Digests – one way ciphers, create fingerprints of data.