Computer Programming
RAID 5 Parity. What is it, and how does it work?
Submitted by johnk on Mon, 07/07/2008 - 10:17.One morning, I started wondering how RAID 5 parity works to rebuild a disk array. It seemed "magical" to me, that you can get redundancy and still use most of your disk capacity. So I searched for it... and turned up not very much info, and one other person's unanswered question. A few articles explained it, but in a little more detail about performance, and less detail about the actual parity function. So that's why this page exists. The good articles were at:
Lazy Evalutation in PHP (sorta)
Submitted by johnk on Thu, 07/03/2008 - 17:48.This is a nice little example that will show you how to do something really useful and cool. It'll also show you how PHP kinda sucks:
<?php
function f( $x )
{
say("function f called with $x...");
return create_function( '', " return quote('$x'); ");
}
function quote( $s )
{
say('quote called...');
return '***'.$s.'***';
}
say('starting...');
$x = f( 'hello, world' );
say('$x defined as '.$x.'...');
print $x();
///// utility funcs
function say( $s ) { echo $s.'<p>'; }
The results look like this:
starting... function f called with hello, world... $x defined as �lambda_6... quote called... ***hello, world***
Computer Programmer's Union?
Submitted by johnk on Wed, 05/28/2008 - 03:01.This is a short list of links to groups that organize unions for programmers and other computer-based workers, and lobby organizations.
First off, Techsunite has a good list to start with:
http://www.techsunite.org/resources/orgs/index.cfm
http://www.programmersguild.org/
http://www.ieeeusa.org/
http://www.washtech.org/
http://www.techsunite.org/
http://www.dpeaflcio.org/about.htm - an AFL CIO department for professionals
http://www.ifpte.org/ - organizes NASA and other engineers
Resolve IP Addresses to DNS Names
Submitted by johnk on Sun, 05/11/2008 - 11:19.Sometimes, you have textual data, like log files, with IP addresses. You sometimes want this data to show hostnames instead.
This script converts IP addresses in the standard input to hostnames. (Script is based on one I found in perlmonks.org.)
#!/usr/bin/perl -w
#
# Resolve IP addresses in web logs.
# Diego Zamboni, Feb 7, 2000
# John Kawakami, May 12, 2008
use Socket;
# Local domain mame
$localdomain = 'slaptech.net';
while (my $l = <>) {
if ($l =~ /^(.*?)(\d+\.\d+\.\d+\.\d+)(.*?)$/) {
$pre = $1;
$address = $2;
$post = $3;
if ($cache{$address}) {
$addr = $cache{$address};
}
else {
$addr=inet_aton($address);
if ($addr) {
$name=gethostbyaddr($addr, AF_INET);
if ($name) {Routers Hacked via Browser
Submitted by johnk on Thu, 05/08/2008 - 23:36.This is uncool: Router hacked through a web browser.
A page will log into your router and force an update with a bad firmware. The only fix would be to reload good firmware, and then fix your router to be less hackable.
I just started on a network where the router had been hacked, but only inasmuch as the DNS was pointing to a nameserver that resolved bad addresses to a Ukrainian search engine.
