Archive for November, 2006

PowerEdge 1950 Xen Hate

Wednesday, November 22nd, 2006

We’re trying to get Xen running on our new, fresh, Dell PowerEdge 1950 servers. The install itself was pretty uneventful. Plenty of distros offer pretty decent support for the Xen Hypervisor from their default install (we’re currently testing it with FC6). A major bummer, though, was that the networking part of Xen just plain wouldn’t start in Dom0. The network bridge just plainly didn’t want to receive back packets coming to the interface, so stuff like ARP just didn’t work at all.

It turns out the problem lies with the built-in management firmware that Dell puts on these broadcoms. You can look here for a solution. Beware, the solution involves Windows to unpack the file and MSDOS to change the IPMI settings.

g++, my nemesis

Monday, November 20th, 2006

dbmanager.cpp:626: error: request for member 'ival' in '*((+(unsigned int)(+ res)->string::operator bool()) + ((const char*)"insertid"))', which is of non-class type 'const char'

Last-modified header and IE

Monday, November 20th, 2006

when you really really really don’t want 304 on dynamic pages and you are using PHP:


header(’Last-Modified: ‘.date(’r'));

this will print the date in http://www.faqs.org/rfcs/rfc2822 formatted date.

Pyrrhic Victory Dance

Saturday, November 18th, 2006

I hate to be the one saying I told you so, but I told you so. Hardware security is only now starting to get some serious consideration. Unfortunately, I think TPM and other hardware-lockdown systems that are currently being considered have too much focus on subverting user control, they are ultimately bound to be factors of aggrevation, not mitigation, when it comes to such new threats.

Threads and your uid/gid

Thursday, November 16th, 2006

First of all, what is up with the Debian 2.4 kernel? I’m glad that Etch will default to 2.6, but the 2.4 kernel that has been with Debian for so long is just plain Ghetto. Running multithreaded applications on a non-NPTL kernel is atrocious. But, on a positive note, running into this trailer park kernel on a machine that was upgraded to Etch from an earlier version, all this did point me to an interesting tidbit about using setuid and friends: If you want to use these to drop privileges, make sure you do this before you start any threads or madness will ensue.

dpkg version sorting

Thursday, November 16th, 2006

Use this as you would use | sort | to sort package names according to dpkg versioning logic:

#!/usr/bin/perl
sub dpkgcomp
{
return 1 if(system(”dpkg –compare-versions $a lt $b”));
return -1 if(system(”dpkg –compare-versions $a gt $b”));
return 0;
}
@l = <>;
chomp(@l);
@s = sort dpkgcomp @l;
print join(”\n”, @s), “\n”;

php: isUrlOffline( $url )

Wednesday, November 15th, 2006
function isUrlOffline( $url )
{
	// setup socket with timeout of 0.1 seconds
	// return -1 for error ; false for offline

	$urlpatt = '%http:\/\/([a-z-\.0-9]+)(:(\d+)){0,1}(.*)%i’;
	$am = array();
	preg_match($urlpatt, $url, $am);

	if (empty($am[1]))
	{
		return -1;
	}
	$address = gethostbyname($am[1]);
	$service_port = empty($am[3]) ? 80 : $am[3];

	$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
	if ($socket < 0)  return -1;

	socket_set_block($socket);
	socket_set_option(
		$socket,SOL_SOCKET, SO_SNDTIMEO
		, array("sec"=>0,"usec"=>100)
	);

	$result = socket_connect($socket, $address, $service_port);
	if ($result < 0 )   return -1;

	$in = "HEAD / HTTP/1.1\\r\\n";
	$in .= "Host: " . $am[1] . "\\r\\n";
	$in .= "Connection: Close\\r\\n\\r\\n";

	socket_write($socket, $in, strlen($in));

	$buf = "";
	while ($out = socket_read($socket, 2048))
	{
		$buf .= $out;
	}
	socket_close($socket);

	return preg_match("%HTTP/.+ 200 OK%",$buf);
}

testing performancing firefox extension

Wednesday, November 15th, 2006

It seems clean enough, setting up multiple blogs is easy …
http://performancing.com/forum/firefox

the inline mode lets you browse while typing the entry for your blog, I like that