Friday, October 1, 2010

Tips for filing a support ticket with properietary software that you use at work

1. Be friendly but make the case that you're incapable of doing some part of your job properly. People that yell the loudest (but are friendly) and make a strong case will typically have their issues fixed first. You want to create a sense of guilt at the vendor, not hate, so someone will be more likely to work overtime or bust their ass to fix your problem.
2. You describe clearly what the problem is (more than just "it doesn't work")
3. Describe clear steps to reproduce the problem from start to finish. Include your starting point, relevant data entered and items clicked. This is very important, because it takes forever to fix a bug that can't be easily duplicated. Further, you might get stuck with nothing happening because they think you're doing something wrong.
4. Describe the results you're seeing ("Error Message _____", calculation is 10 cents off, field that's allowed to be blank is required, etc)
5. Describe the results you should be seeing. This is important because the software developer should have a QA team and be able to take the steps from #2 and make sure they've actually fixed the problem instead of simply breaking something in a different way.

Thursday, August 5, 2010

Capturing Variable Type Data By Running PHP

PHP is hard to automatically convert to other languages because there is little type information hardcoded into it. Here's some sample code that uses the debug interface to extract type information out for variables. For now, it just dumps the type data to stdout. Presumably you would need to save this to some sort of sqlite database and run all of your automated tests to ensure full code coverage. Then you could translate your parsed PHP to another language with the additional information known.

// Use xdebug to determine type information about all of the executed parts of your script
// to run, 1: execute this
// 2: export XDEBUG_CONFIG="idekey=session_name remote_autostart=1 remote_host= remote_enable=1"
// 3: run your cli php script

// Set time limit to indefinite execution
set_time_limit (0);

// Set the ip and port we will listen on
$address = '';
$port = 9000;

// Create a TCP Stream socket
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
// Bind the socket to an address/port
socket_bind($sock, $address, $port) or die('Could not bind to address');
// Start listening for connections

/* Accept incoming requests and handle them as child processes */
$client = socket_accept($sock);

// Read the input from the client – 1024 bytes
$input = socket_read($client, 1024);
// Strip all white spaces from input
$output = preg_replace("/[ \t\n\r]/","",$input).chr(0);
$doc = new DOMDocument();
function read_debugger()
global $client;
$string = '';
$char = socket_read($client, 1);
while(! socket_error() && $char <> "\0") {
$string .= $char;
$char = socket_read($client, 1);
return $string;
while(! socket_last_error($client)) {
socket_write($client, "step_into -i ".$i."\0");
$file_line_info = socket_read($client, 1024);
preg_match('/filename="(.*?)"/', $file_line_info, $matches);
$line_no = $matches[1];
preg_match('/lineno="(.*?)"/', $file_line_info, $matches);
$filename = $matches[1];
echo("$filename : $line_no ");
socket_write($client, "context_get -i ".$i."\0");
$dummy = read_debugger();
$context_info = read_debugger();

if (!($doc->loadXML($context_info))) {
die("FAIL ON ".$context_info);
$propertyNodes = $doc->getElementsByTagName('property');
for($j = 0; $j < $propertyNodes->length; $j++) {
$property = $propertyNodes->item($j);
echo($property->getAttribute('fullname').':'.$property->getAttribute('type').' ');

// Close the client (child) socket

// Close the master sockets

Wednesday, April 28, 2010

Bumper Stickers

A friend is selling some here:

Sunday, November 1, 2009

removing the texture of old pictures with FFTs

Imagej ( has an awesome feature that allows you to perform an FFT on an image, edit it, and then do an inverse FFT. This is very useful for eliminating patterns from an image, such as the texture of old photographs.

Full size images for further comparison:

Monday, October 12, 2009

Booting to a raid volume using jfs

While upgrading an older debian server, I had to make some modifications to get the kernel booting. This shouldn't normally be necessary, but for some reason the hardware was not getting auto detected. I'm almost 100% sure I messed up some other step in order to require this. The system's root drive is raid1 and uses jfs. The following changes were done:

Added: /etc/initramfs-tools/modules:

modprobe raid1
modprobe md
modprobe jfs

mknod /dev/md2 b 9 2
mknod /dev/md0 b 9 0
mknod /dev/md1 b 9 1
mdadm --assemble --scan

The above script must be chmod +x'd. I copied to it /etc/initramfs-tools/scripts/local-top/probe/local-premount/ just to make sure it ran.

Modified /usr/sbin/mkinitramfs in the #modutils section:
copy_exec /sbin/mdadm /sbin
copy_exec /sbin/fsck.jfs /sbin
mkdir -p "${DESTDIR}/etc/mdadm"
cp -a /etc/mdadm/mdadm.conf "${DESTDIR}/etc/mdadm/"

The above changes were done by booting into the rescue mode of a debian installer and mounting.

Tuesday, August 25, 2009

Installing Windows Server 2008 in VirtualBox

Today I installed a beta Windows Server 2008 onto a virtual machine on my Mac using VirtualBox. After some trial and error, the following settings seem to have allowed it to work:

OS Type: Windows 7 (64 bit)
Base Memory: 500 MB
Processors: 1
VT-x/AMD-V: Enabled
Nested Paging: Enabled

Video Memory: 12MB
3D Acceleration: Enabled

Thursday, August 20, 2009

Blocking spam from Yahoo! Personals

I get approximately 10 messages a day from Yahoo! Personals, which pass through spamassassin because they're DKIM signed. As far as I can tell, there's no way to opt out on Yahoo's end, so I had to resort to blocking every message with their telltale subject. Here's the rule:

header SUBJECT_YAHOO_PERSONALS Subject =~ /Dating 101: Reviving Your Relationship/i