Don't Let The Batch Bug Bite

The number one problem with Windows Batch is that it just doesn't always work like you think it should. Even the simple stuff. Batch is buggy buggy buggy! Batch makes you appreciate #!/bin/bash all the more.

I share my KeePass file among my work and home computers using Wuala. Since it takes the computers a few minutes to login to Wuala, I should wait to open KeePass. Therefore, I wanted to write a quick script to loop infinitely and check if my KeePass file exists before trying to open the password file. The same logic would apply for KeePass files on a network share.

However, there arose a problem. Read more to find out about how Windows batch disappoints me.

PHP Python Bypass safe_mode Vulnerability

It is possible to use the python extension in php version 5 or less to execute system commands (for example, get a list of passwords). I found an example script of this vulnerability from the milw0rm website. However, there is an error in the code from that site.

Parse error: syntax error, unexpected T_STRING in ~/php_python_bypass.php on line 16

This error is because there are no escaped single quotes and you have the syntax ('foo' illegal 'bar'). The correct code adjustment (with double quotes instead of single quotes) can be seen by clicking on read more.

Deltacopy (rsync) vs Robocopy

As a systems administrator, I've been exposed to more third party tools than I can recollect. A couple of those tools robocopy and rsync. Backups are often the last thought on many users minds. Backups are often treated like the red-headed stepchild of the technical industry because no one wants to spend extra money and then later when data is lost - tears are shed.

Hamachi VPN and VMware

After installing VMware on a WinXP Professional (host) machine I created a Debian (guest) virtual machine sandbox to play around with. I setup bridged networking and halfway thru the install noticed that Debian could establish a network connection with an ip address but could not reach internet destination. Turns out it was getting an IP address from my Hamachi VPN network connection instead of Local Area Network and thus it could acquire an IP address but no DNS information.

Therefore, if you have both Hamachi VPN and VMware installed on your then you will most likely need to run the steps below to fix networking issues in your guest operating system. Basically, bridged networking does not work with VMware and Hamchi. Your virtual machine will acquire an IP address from the Hamachi DHCP server successfully but won’t be able to reach a DNS server and thus you won’t have internet access. To resolve the problem you need to disable the VMware bridge protocol for the Hamachi network connection. I have included a few of screen shots and simple steps on how to do disable the VMware bridge for Hamachi VPN.

Convert wma to mp3 in Linux (ffmpeg + lame)

in

I like to listen to music while I'm at work. Either I'm on pandora.com or streaming music from my home computers with subsonic.  One of the neat features of Subsonic is transparency in transcoding different codecs. If I have 3 different songs, for example: foo.ape foo.wma foo.mp3; my client needs to be able to play all of the songs seemlessly. Subsonic automatically attempts transcoding but it needs certain 3rd party tools to do the conversions.

In my case, I couldn't listen to songs with wma format. Subsonic suggests useing a Windows executable called wmadec.exe to sample the input for lame conversion. However, since I'm running Subsonic in Tomcat under Debian (Linux) this tool isn't available.

GRE practice test is tricky (almost incorrect)

The GRE math section seems fairly simple but I missed a few questions since I was not being careful. There was one problem that annoyed me greatly, see below.

Install Debian on USB

in

It's no secret that the reliability of flash memory (usb sticks, solid state harddrives, camera memory sticks) decreases based on the writes made to the device. Depending on how the manufacturer designed memory usage, single level cell (SLC) or multi-level cell (MLC) memory, determines the typical lifetime of your drive. SLC drives usually last 100,000 writes and MLC comes in at a considerably less 10,000 writes. If you're intersted on more information about limiting factors of usbdrives then go here. 

However, this article is not about expected usb lifetime but rather an introduction on how to install an operating system (OS) on a USB drive. Since an OS can potentially write an abundance of unseen data to the harddrive, it's important that the reader understand that if we simply install our OS normally on a USB stick, the drive will become unreadable within a short amount of time.

Mixing Math and CSS Sprites

CSS Sprites? Neat idea!

I should give credit where credit is due. I got the idea to use sprited images from a friend, Adam Ducker, who works with CSS daily (for a living) and after playing with my camera I managed to conjure sprite animations on a webpage.

Square vs Rectangle

Proof

We can show that a rectangle of perimeter p yields less area than a square with the same perimeter p.

Let $ w $ be the width and $ h $ be the height of our square such that $ p = 2w + 2h $ and $ x = w = h $. This means that the area of our square is $ A = (x)(x) = x^2 $.

Now assume that we change our square to a rectangle. In order to keep the same perimeter $ p $, whatever we subtract from the width must be added to the height. This means our width is now $ x - n $ and our height is $ x + n $ where $ 0 < n < x $. Our area of the rectangle is now $ A = (x+n)(x-n) = x^2 - n^2 $

In order not to contridict ourselves, $ x^2 > x^2 - n^2 $ for all $ 0 < n < x $ and $ x > 0 $ (we are working with real numbers and not imaginary, plus it's hard for a shape to have a negative width isn't it?).

Guess and Check

High schoolers may still encounter problems in which the solution is to Guess and Check. In fact, in our Algebra (high school) class we spent weeks on Guess and Check. Remembering the atrocities of the G and C method and the trouble it gave me, almost makes me want to stop writing this article and bathe. I dis-liked G & C because it lacked coherent structure.

There is much more to math than guessing. Being innovative is never a bad thing in math but innovative teenagers probably doesn't lead down a road full of math formulas and nifty equations. Here is a classic example of guess and check.

Syndicate content