DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 

ross's blog

seterlvl 1.1 has been released

seterlvl is a very simple utility to set the errorlevel on the command line.

You can download the binary here and the binary with the source code here.

Here's the readme.txt:

exetype 1.1 has been released

To automate the creation of .lnk files to Windows GUI applications, I needed a way to programatically determine the type of an .exe. So I wrote exetype.

You can download the binary here and the source code here.

Binaries for OpenSSL 0.9.8b for Windows Released

Details here.

Binaries of Apache 2.2.2 for Windows with OpenSSL 0.9.8b (mod_ssl) and mod_deflate support

Details here.

Binaries of Apache 2.0.58 for Windows with OpenSSL 0.9.8b (mod_ssl) and mod_deflate support

Details here.

mklnk 1.2 has been released

I needed an easy way to create .lnk files on the command line, and couldn't find one online that suited me, so I crafted my own.

You can download the binary here and the source code here.

Automating the building of a BartPE bootable disk (updated for pebuilder 3.1.10a)

To automate the tedious process of building a bootable BartPE disk, I created the Makefile pebuilder.mak to build a BartPE disk with a single command.

To build the disk, all you need to type is:

$ make -f pebuilder.mak

The Makefile, and the supporting files are available as pebuilder-makefile.zip.

Of course, to run make, you will need to install Cygwin and select the make and wget packages. Alternatively, you could unzip cygwin-1.5.23.zip, which contains only the executables needed to run make.

It helps speed the build process by telling pebuilder to not build the .ISO. It then calls InfCacheBuilder, and then calls mkisofs. Finally, it calls cdrecord. A Windows version of cdrecord is available as cdrtools-latest.zip.

Also included is inirw.exe, a small C program I wrote to read and write .ini files. inirw.exe is also available separately (including source) as inirw.zip.

Motorola Phone Tools 4.0.4 doesn't transfer home phone numbers

I was importing a vCard file, and found that the Motorola Phone Tools software didn't transfer any of the home phone numbers.

To fix this, I loaded the .vcf into my text editor, and changed all occurances of

TEL;HOME:

to

TEL;HOME;VOICE:

and saved the file. I then imported the data as usual.



Then when attempting to voice dial, the phone was choosing to dial email addresses and fax numbers, so I wrote the perl script palm2pebl.pl:

s/^TEL;HOME.*:/TEL;HOME;VOICE:/;
s/^X-Palm-Custom1.*:/NICKNAME:/;
/^EMAIL/ && next;
/FAX/ && next;
print;

which I run via:

perl -ni.bak palm2pebl.pl $1

This script is available here.

Better living thru VMWare

For our last trip to India, we didn't want to lug two laptops around. So I backed up my laptop using Ghost 9, and then ran VMWare Workstation, and imported the backup image into a vmware session, and copied that to my girlfriends system.

Next, I installed VMWare Player on her system, and loaded the image.

Here comes the fun part. While we were travelling, we would visit an internet cafe. She would plug in her laptop, and power up. I'd fire up VMWare Player, and find out the IP address that it got assigned.

Then I'd visit another workstation, and fire up MSTSC (Terminal Services Client), enter the IP address of the VMWare session, and my username/password and voila! I was using my old laptop virtually!

Cygwin Doesn't Register All Environment Variables When Using SSH

When initiating a Cygwin bash session via SSH, Cygwin only registers the environment variables for the SYSTEM account, not for the individual user's account.

So I added the following code to the end of my .bashrc file:

if [ "$SSH_TTY" ]; then
pushd . >/dev/null
for __dir in \
/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\ Manager/Environment \
/proc/registry/HKEY_CURRENT_USER/Environment
do
	cd "$__dir"
	for __var in *
	do
		__var=`echo $__var | tr '[a-z]' '[A-Z]'`
		test -z "${!__var}" && export $__var="`cat $__var`" >/dev/null 2>&1
	done
done
unset __dir
unset __var
popd >/dev/null
fi

To apply this fix for all users, add it to /etc/profile instead.

Please note, this doesn't correctly register environment variable names that are illegal in Cygwin, such as those that contain a period.

AddPath 1.0 has been released

I've found no easy way to add directory paths to the system's PATH environment variable, so I created AddPath-1.0-Win32.zip. Here is the readme.txt file describing its usage:

AddPath 1.0 - Jan  6 2006 - 10:18:11
Copyright (c) 2005-2006, Ross Smith. All Rights Reserved

Usage: AddPath [options] path [path2 ...]

Options:
-v VarName Append path(s) to environmental variable VarName (default is Path)
-s         Modify variable in the system environment (default)
-u         Modify variable in the current user's environment
-d         Modify variable in the default user environment
-e char    Change % substitution character to 'char' (default is ~)
-n         Don't add path if the variable already contains it
-p         Prepend path(s) to variable
-r         Replace the value (default is to append)
-x         Use REG_EXPAND_SZ type (default if ~ char is used)
-z         Use REG_SZ type (default)
-c         Show version and copyright statement
-?         Show this help screen

Examples:
  rem append c:\bin to the system Path variable:
  AddPath -n c:\bin

  rem prepend c:\usr\local\bin and c:\bin to the system Path:
  AddPath -n -p c:\usr\local\bin c:\bin 

  rem Add "C:\Program Files\Java\bin" to the system Path:
  AddPath -n "C:\Program Files\Java\bin"

or, even better:

  rem add or replace JAVA_HOME with %ProgramFiles%\Java
  AddPath -n -r -x -v JAVA_HOME ~ProgramFiles~\Java
  
  rem Append %JAVA_HOME%\bin to the system Path:
  AddPath -n ~JAVA_HOME~\bin

Other keywords: setx, setenv

Migrating from Oubliette to KeePass

To migrate my data from Oubliette, to KeePass, I created the HTML template keypass_xml.tpl and the bash shell script keypass_xml.sh.

Generating 63 byte WPA keys for your wireless router

Here's a quick little script to use to generate several 63 byte WPA keys for your wireless router:

#!/bin/sh

echo Generating 10 random 63 byte WPA key... >&2

for i in 1 2 3 4 5 6 7 8 9 0
do
	head -c 256 </dev/random | tr -cd "[!-~]" | head -c 63
	echo
done

Removing unused query parameters from the URL

I have a web form with several fields. When the user submits the form, they usually only enter data into one of the fields. I wanted the resulting GET url to only include the field(s) they entered any information into. Here's the code I came up with:

<script language='JavaScript' type='text/javascript'>
<!-- // <![CDATA[
function frmSubmit(thiz) {
	var e = thiz.elements;
	for (var i = 0; i < e.length; ++i)
		if (e[i].type == 'text' && e[i].value.length == 0)
			e[i].disabled = true;
	return true;
}
// ]]> -->
</script>
<form method='get' onSubmit='return frmSubmit(this)'>

This appears to work on at least the following browsers:

  • Firefox 1.0.6
  • IE 6.00
  • Opera 8.0

If anyone has a better solution, either client-side, or server-side, I would love to hear it.

Syndicate content
DeutschEspañolFrançaisItalianoNederlandsPortuguêsΕλληνικάРусскийالعربية中文(简体)中文(繁體)日本語한국어
 
Donate Bitcoins
Google
 
www smithii.com
 
Special thanks to Riester Rente Online for a generous donation!