Obscure Error of the Day

January 29, 2010

Got this today when installing Xmetal (images needed to view this post).

Apparently there was a meeting, and my driver failed to attend. No wait, my driver’s ConfigDNS failed to attend? Or did they just fail at the meeting? Did it fall asleep during the meeting? Make too much noise?


Online Whiteboards

January 23, 2010

Sometimes, the best way to explain something is with pictures. Other times, you’re trying to show someone math over something like IM, and failing miserably. In both cases an online whiteboard application comes in handy.

The most recent one I’ve found is Dabbleboard. Not only can you draw, but you can insert text just be clicking and typing, insert math symbols, maintain a library of symbols you use often (quick and dirty schematics anyone?), insert PDF and other types of documents, and images from either your hard drive or a URL. Downsides: no flood fills, limited colors, no spray paint, and the automatic shape detection can be buggy (but you can always go freehand).

Another one I’ve used is the GE Imagination Cubed, which has the advantage of being able to use the pens as pointers, but generally  lacks a lot of the cool features Dabbleboard has, and is more difficult for inserting text.

I wonder if Google Wave has any good whiteboard applications yet… Even if it does, Dabbleboard and GE Imagination Cubed offer the advantage of just having to share a link, without the hassle of login names and registrations before your group can get started scribbling.


What did you say the units were?

January 18, 2010

Another day at work fighting with CAD tools…
Me: How high should the motherboard mounting hardware be?
Coworker: About 3 cm?
Me: I think someone set them to 3 feet…

The sad part is, this error was the highlight of my day.


Bootable VM Images?

January 16, 2010

Virtual Machines are great for testing things on and running software your native operating system won’t support. Sometimes, though, you actually want to be able to boot into them rather than run them on top of another operating system. If you run Linux for a main OS and Windows for gaming, a VM isn’t going to work that well for you due to all the extra overhead of running two operating systems at once, not to mention poor graphics frame rates on many VMs. Shouldn’t it be possible to create an image that you could both boot into like a regular partition, but also run inside a virtual machine? So far I’ve found nothing that can do this…


Cool Windows Command Line Tool

December 28, 2009

WMIC (Windows Management Instrument Command) is a nifty little Windows command that’s apparently been around since Windows XP pro. I found it when I was trying to get the command line arguments that were being passed to some process by some other process.

Some uses,

1.  To get the process list – wmic process list
2.  To get the group list – wmic group list
3.  To get the NIC Card Configuration – wmic nicconfig list
4.  To get user account list – wmic useraccount list
5.  To get the built in System account list – wmic sysaccount list
6.  To get the Environment list – wmic environment list
7.  To get the information of all shares (including hidden) – wmic share list
8.  To get the list of services – wmic services list
9.  To get the computer system details – wmic computersystem list
10. To get the volume information – wmic volume list
11. To get full startup list – wmic startup list full
12. To get Information of logical disks – wmic logicaldisk get description, filesystem, name, size
13. To get screensaver information – wmic desktop get screensaversecure, screensavertimeout
14. To get logon information – wmic logon get authenticationpackage
15. To get information about the OS – wmic os get name, servicepackmajorversion
16. To get information about QFE (Quick Fix Engineering) – wmic qfe get description,installedOn
17. To get information about the computer – wmic csproduct get name,vendor,identifyingNumber
18. To get the toal ram – wmic computersystem get TOTALPhysicalMemory,caption
19. To get the macaddress of nic card – wmic nic get macaddress,description

- source

You can format the output into html, xml, csv, and more. Just using it to pull info about your system is handy, but it can also modify network settings, start and kill processes, set the process priority,  and way more. I hate to sound like a late night Microsoft commercial, but this is the coolest command line utilities Ive found for quite some time in Windows. Go ahead and stick “wmic /?” in the command line and have fun.


On the n’th day of Christmas, my (assert love=true) love sent to me…

December 25, 2009

As an excuse to get all the IDEs and compilers I might possibly need running on my Vostro, plus to get in the Christmas spirit and code something in languages I haven’t used in a while, enjoy the Twelve Days of Christmas. I got bored after MIPs, maybe I’ll get around to adding on a SKILL/LISP implementation and VHDL later.

In TCL,

set days [list\
	"first" "second" "third"\
	"fourth" "fifth" "sixth"\
	"seventh" "eighth" "ninth"\
	"tenth" "eleventh" "twelfth"]

set gifts [list\
	"partridge in a pear tree"\
	"Two turtle doves"\
	"Three French hens"\
	"Four calling birds"\
	"Five golden rings"\
	"Six geese a-laying"\
	"Seven swans a-swimming"\
	"Eight maids a-milking"\
	"Nine ladies dancing"\
	"Ten lords a-leaping"\
	"Eleven pipers piping"\
	"Twelve drummers drumming"]

for {set i 0} {$i < 12} {incr i} {
           puts "On the [lindex $days $i] day of Christmas,"
           puts "My true love sent to me,"
for {set j $i} {$j > 0} {incr j -1} {
		puts "[lindex $gifts $j],"
	}

	if {$i == 0} {
		puts "A [lindex $gifts 0].\n"
	} else {
		puts "And a [lindex $gifts 0].\n"
	}
}

In C,

#include 

int main() {
	const char *days[12] = {"first", "second", "third",
		"fourth", "fifth", "sixth",\
		"seventh", "eighth", "ninth",\
		"tenth", "eleventh", "twelfth"};

	const char *gifts[12] = {"partridge in a pear tree",\
	"Two turtle doves",\
	"Three French hens",\
	"Four calling birds",\
	"Five golden rings",\
	"Six geese a-laying",\
	"Seven swans a-swimming",\
	"Eight maids a-milking",\
	"Nine ladies dancing",\
	"Ten lords a-leaping",\
	"Eleven pipers piping",\
	"Twelve drummers drumming"};

	int i, j;
	for (i = 0; i < 12;i++) {
            printf("On the %s day of Christmas,\n", days[i]);
            printf("My true love sent to me,\n");
 		for (j = i; j > 0; j--)
			printf("%s,\n", gifts[j]);

		if (i == 0)
			printf("A %s.\n\n", gifts[0]);
		else
			printf("And a %s.\n\n", gifts[0]);
	}
}

In Java,

public class song {
	private final static String days[] = {
		"first", "second", "third",
		"fourth", "fifth", "sixth",
		"seventh", "eighth", "ninth",
		"tenth", "eleventh", "twelvth"};

	private final static String gifts[] = {
		"partridge in a pear tree",
		"Two turtle doves",
		"Three French hens",
		"Four calling birds",
		"Five golden rings",
		"Six geese a-laying",
		"Seven swans a-swimming",
		"Eight maids a-milking",
		"Nine ladies dancing",
		"Ten lords a-leaping",
		"Eleven pipers piping",
		"Twelve drummers drumming"};

	public static void main(String args[]) {
		for (int i = 0; i < 12;i++) {
                      System.out.println("On the " + days[i] + " day of Christmas,");
                      System.out.println("My true love sent to me,");
		      for (int j = i; j > 0; j--)
			  System.out.println(gifts[j]);

			if (i == 0)
				System.out.println("A " + gifts[0] + ".");
			else
				System.out.println("And a " + gifts[0]);
			System.out.println();
		}

	}
}

In MIPS,

.data
	day1:	.asciiz	"first"
	day2:	.asciiz	"second"
	day3:	.asciiz	"third"
	day4:	.asciiz	"fourth"
	day5:	.asciiz	"fifth"
	day6:	.asciiz	"sixth"
	day7:	.asciiz	"seventh"
	day8:	.asciiz	"eighth"
	day9:	.asciiz	"ninth"
	day10:	.asciiz	"tenth"
	day11:	.asciiz	"eleventh"
	day12:	.asciiz	"twelvth"

	gift1:	.asciiz	"partridge in a pear tree"
	gift2:	.asciiz	"Two turtle doves"
	gift3:	.asciiz	"Three French hens"
	gift4:	.asciiz	"Four calling birds"
	gift5:	.asciiz	"Five golden rings"
	gift6:	.asciiz	"Six geese a-laying"
	gift7:	.asciiz	"Seven swans a-swimming"
	gift8:	.asciiz	"Eight maids a-milking"
	gift9:	.asciiz	"Nine ladies dancing"
	gift10:	.asciiz "Ten lords a-leaping"
	gift11:	.asciiz	"Eleven pipers piping"
	gift12:	.asciiz	"Twelve drummers drumming"

	onThe: .asciiz "On the "
	dayOf: .asciiz " day of Christmas,\nMy True love sent to me,\n"
	trueLove: .asciiz "My true love sent to me,\n"
	period: .asciiz ".\n\n"
	comma: .asciiz ",\n"
	newline: .asciiz "\n"
	andA: .asciiz "And a "
	justA: .asciiz "A "

	dayAddressesArray: .word 0,0,0,0,0,0,0,0,0,0,0,0
	giftAddressesArray: .word 0,0,0,0,0,0,0,0,0,0,0,0

.text

main:

	# Put all the addresses of the day strings in an array
	la $s0, dayAddressesArray
	la $t1, day1
	sw $t1, 0($s0)
	la $t1, day2
	sw $t1, 4($s0)
	la $t1, day3
	sw $t1, 8($s0)
	la $t1, day4
	sw $t1, 12($s0)
	la $t1, day5
	sw $t1, 16($s0)
	la $t1, day6
	sw $t1, 20($s0)
	la $t1, day7
	sw $t1, 24($s0)
	la $t1, day8
	sw $t1, 28($s0)
	la $t1, day9
	sw $t1, 32($s0)
	la $t1, day10
	sw $t1, 36($s0)
	la $t1, day11
	sw $t1, 40($s0)
	la $t1, day12
	sw $t1, 44($s0)

	# Put all the addresses of the gift strings in an array
	la $s1, giftAddressesArray
	la $t1, gift1
	sw $t1, 0($s1)
	la $t1, gift2
	sw $t1, 4($s1)
	la $t1, gift3
	sw $t1, 8($s1)
	la $t1, gift4
	sw $t1, 12($s1)
	la $t1, gift5
	sw $t1, 16($s1)
	la $t1, gift6
	sw $t1, 20($s1)
	la $t1, gift7
	sw $t1, 24($s1)
	la $t1, gift8
	sw $t1, 28($s1)
	la $t1, gift9
	sw $t1, 32($s1)
	la $t1, gift10
	sw $t1, 36($s1)
	la $t1, gift11
	sw $t1, 40($s1)
	la $t1, gift12
	sw $t1, 44($s1)

	li $t0, 0 # $t0 <- outer loop index
	outerLoopStart:
		la $a0,onThe
		li $v0,4
		syscall

		move $t1, $t0
		sll $t1, $t1, 2
		add $t2, $s0, $t1 	# t2 <- address of array element with address of string
		lw $a0, 0($t2) 		# t2 <- address of string
		li $v0,4
		syscall
		la $a0, dayOf
		li $v0, 4
		syscall

		move $t1, $t0
		innerLoopStart:
			beq $t1, $zero, innerLoopEnd
			move $t3, $t1
			sll $t3, $t3, 2
			add $t3, $t3, $s1
			lw $a0, 0($t3)
			li $v0, 4
			syscall

			la $a0, comma
			li $v0, 4
			syscall

			addi $t1, -1
			beq $t1, $zero, innerLoopEnd
			j innerLoopStart
		innerLoopEnd:

		beq $t0, $zero, printA

		printAnd:
			la $a0, andA
			li $v0, 4
			syscall
			j donePrinting

		printA:
			la $a0, justA
			li $v0, 4
			syscall
		donePrinting:

		lw $a0, 0($s1)
		li $v0, 4
		syscall
		la $a0, period
		li $v0, 4
		syscall

		addi $t0, 1
		beq $t0, 12, outerLoopEnd
		j outerLoopStart

	outerLoopEnd:
		jr $ra

In SKILL,

days = ‘(“first” “second” “third” “fourth” “fifth” “sixth”\
		” seventh” “eighth” “ninth” “tenth” “eleventh” “twelvth”)

gifts = ‘(“partridge in a pear tree”\
	“Two turtle doves”\
	“Three French hens”\
	“Four calling birds”\
	“Five golden rings”\
	“Six geese a-laying”\
	“Seven swans a-swimming”\
	“Eight maids a-milking”\
	“Nine ladies dancing”\
	“Ten lords a-leaping”\
	“Eleven pipers piping”\
	“Twelve drummers drumming”)

(defun sing ()
	(for i 0 11
		(printf “On the %s day of Christmas,\n” nth(i days))
		(printf “My true love sent to me,\n”)

		j = i
		(while j > 0
			(printf “%s,\n” nth(j gifts))
			j = j – 1
		)

		(if i == 0 then
			(printf “A %s.\n\n” (car gifts))
		else
			(printf “And a %s.\n\n” (car gifts))
		)
	)
)


Event/Emergency APRS Network Brainstorming

December 24, 2009

APRS is a wireless packet network system used by ham radio operators to transmit position information. Packets are encoded using the AX.25 data link protocol, which occupies the first, second, and third layers of the OSI networking model, and transmitted using half duplex radios usually on VHF or UHF frequencies. The default transfer rate is 1200 or 9600 baud. Packets are transmitted by a station and in general consist of a callsign to identify the sender, an icon/symbol code, a GPS string to show the sender’s exact position, and a short text status. It is also possible to send text messages or other small amounts of data.

Digipeaters are the basic nodes of the network, repeating signals from the stations to propagate them. The exact structure of the network is limited to the geography of the area and hardware available.

A basic representation of an APRS network can be achieved using a graph with the nodes representing the digipeaters and the edges representing which digipeaters can hear each other. In theory this would be an undirected graph, but on occasion phenomena arise which cause one digipeater to hear another, but not vice versa. This is a rare occurrence and will not be considered in most cases. The goal of a general purpose APRS network is to propagate the signal packet through the nodes to a certain depth from it’s original location.

In a general purpose APRS network, collisions between stations can and will occur as congestion increases, due to the almost random nature of transmission times. Collisions between the digipeaters should, however, be minimized.

In Event/Emergency Specific APRS, APRS is often used to track mobile emergency vehicles or event vehicles. The main difference of event specific APRS is that the stations have the ability to use controlled methods such as preasigned time slotting, so that no collisions will occur between stations.

For example, 10 stations transmitting position packets every 60 seconds can be programmed before the event to transmit one after the other every at 6 second intervals, allowing the most time possible for the signal to propagate through the network. Using the station’s GPS receivers to continually synchronize their internal clocks, they can achieve very accurate transmission times.

Beyond this, during an event the coordinators have more control over the content on the network, and can limit it to decrease network congestion. Messages or excess data for example, can be banned from the network, making relatively small standard packet length for all the stations in order to increase the number of time slots that can be assigned.

In a general purpose APRS network collisions and lost packets are considered acceptable. In an event/emergency specific APRS network, it should be engineered to have no collisions or lost packets as long as the station is able to be heard by at least one digipeater.

Generally, event specific networks cover a much smaller area. A general purpose APRS network might cover the entire country, but an event specific network will likely only cover some portion of a state and be perhaps less than 10 nodes.

A somewhat simplified version of the problem can be described as follows for a small event network,

  • A station may be heard by any subset of the total digipeaters when it sends a packet
  • Only one node or station should be transmitting on the network at a time to avoid any chance of collisions
  • Time may be discretized into slots the length of the longest transmission time to send a packet
  • It can be assumed that only one mobile station will send a packet at a time, and all other mobile stations will hold off a set amount of time in order to allow for that packet to propagate through the network (in other words, all stations will be time slotted)
  • Packets should be retransmitted by all nodes exactly once
  • A digipeater can tell if a packet was heard directly or by an adjacent digipeater
  • A digipeater can tell if it has digipeated a packet before, either by each station including a timestamp inside the packet, or by the digipeaters just keeping track of anything they transmitted and received during a station’s time slot.

Therefore, the problem is how to propagate the packet through the entire network in the least amount of time slots, and taking into an account a digipeater’s only information is what it’s heard.

Method 1: Simple Algorithm to avoid collisions by use of delays

Even this very simplified and ideal problem, where stations will always transmit inside their time slots, proves to be a challenge to keep the digipeaters from colliding. Suppose you have a chain of digipeaters as shown below,

Even in this almost simplest layout, it’s impossible to get an efficient use of time slots when the number of digipeaters increases. Suppose we have a chain of 4 digipeaters such that, digipeater 1 can hear 2, 2 can hear 1 and 3, 3 can hear 2 and 4, etc.

Here is a simple way to ensure no two transmit at the same time.

If a direct packet hits digipeater 1, it can transmit immediately. However, if 1 hears a packet from 2, it must wait two timeslots to ensure that 3 and 4 are not transmitting (the case 2 hears the packet, but 1 does not).

If a packet is heard direct by 2, it can transmit only after a delay of 1 time slot to ensure 1 did not also hear the packet and repeat. If a packet is heard by 2 from 3, it must wait one timeslot to ensure that 4 does not transmit next (the case when 3 is the only one to hear the packet).

If digipeater 3 hears a packet direct, it must wait two timeslots to ensure that neither digipeater 1 or 2 are going to fill the time slot transmitting the packet. If 3 hears a packet from 4, it can transmit immediately.

If digipeater 4 hears a packet, it must wait three timeslots to transmit.

Now, suppose a packet is heard by digipeater 1. In this case, the path is 1->2->3->4 with no pauses. However, if 4 hears the packet, it must wait 3 timeslots to ensure neither 1, 2, or 3 are transmitting. It can then transmit the packet. After that, 3 can transmit the packet. Now when 2 hears a packet from 3, it’s possible that 3 was the first and only station to hear the packet, so 2 must wait a timeslot in case 4 has to go. The path then looks like,

P->P->P->4->3->P->2->P->P->1

For a line of digipeaters of length 6 the longest path is,

P->P->P->P->P->P->6->5->P->4->P->P->3->P->P->P->2->P->P->P->P->1

For a line of N digipeaters using this method, it takes 2N+[(N-2)+(N-3)+(N-4)+...+2+1]-1 = O(N^2) for the longest possible path. This is due to the fact digipeaters have no idea what’s going on further down the chain.

For a group of digipeaters where they can all hear eachother, a routing algorithm like this can be improved slightly, down to 2N hops worse case, but this is still too many to be useful for any sort of large network. Also, in most cases there will be some mix of digipeaters being able to hear eachother and being chained.

Because time slotting must be assigned to take into account the worse case propagation through the network, a better method is needed than simple logic on the digipeaters to ensure no collisions and higher throughput (such as a high speed back bone between digipeaters, multiple channels, request to send protocols, etc).


EE101 Hummerbot Videos

December 16, 2009

Finally got around to posting some old videos of the robot I made back in EE101 a year ago.

The hummerbot (my team’s robot) on the ramp,

http://www.youtube.com/watch?v=IVMj-MIEGfM

http://www.youtube.com/watch?v=fBgCe5NAAxU

The hummerbot on the can course,

http://www.youtube.com/watch?v=UeFmm4FkRnU

http://www.youtube.com/watch?v=MrN54sZcY6A

One of our competitor robots (slow and steady wins the race?),

http://www.youtube.com/watch?v=VdETMfP_kmc

http://www.youtube.com/watch?v=_9wO-Xzdf_c

A blooper of a not so competitve robot,

http://www.youtube.com/watch?v=5NlHOx8KUh0

Aah good times. When we walked into the lab and saw the other robots, we said, “Well… we’re either going to get an A because our robot is the most awesome thing here, or we’re going to fail since we hacked a microcontroller on an RC hummer instead of building ours from scratch and duct tape.” We ended up getting an A.


Windows 7 Startup Repair Tool Unhelpful Results

November 19, 2009

Being impatient, I hit the power button when I went past the bootloader and started loading Windows 7 by mistake. Next time I booted into Windows it asked if I wanted to run the Startup Repair Tool. Not paying attention, and assuming it was just the usual file system checking after an unsafe shutdown, I went ahead and let it run. 20 minutes later, after I moved to my netbook and started Googling, I found that the tool does all sorts of stuff that I really didn’t want it to.. In the end, it finally came out with the following as my problem,

Root cause found: Unspecified changes to system configuration might have caused the problem.

Thank you Windows… for diagnosing the root cause of all my problems, as some UNSPECIFIED configuration change which MIGHT have caused the also unspecified problems.


Back to Slack? Part 2

November 16, 2009

I got the dual booting to work finally, as well as the wireless. For the dual boot, I reinstalled the Windows 7 bootloader as I said last time, then used easyBCD to add an entry for Linux. Finally I booted Slack up using my install DVD and ran liloconfig, this time installing lilo locally rather than to the MBR. Windows 7 boot loader now lets me chainload into lilo.

As for the wireless, an lspci gives,

0c:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01)

The B43 module loads fine, but to make it work you need to grab the firmware from here: http://linuxwireless.org/en/users/Drivers/b43. The instructions are,

wget http://bu3sch.de/b43/fwcutter/b43-fwcutter-012.tar.bz2
tar xjf b43-fwcutter-012.tar.bz2
cd b43-fwcutter-012
make
cd ..
export FIRMWARE_INSTALL_DIR=”/lib/firmware”
wget http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
tar xjf broadcom-wl-4.150.10.5.tar.bz2
cd broadcom-wl-4.150.10.5/driver
sudo ../../b43-fwcutter-012/b43-fwcutter -w “$FIRMWARE_INSTALL_DIR” wl_apsta_mimo.o

Simple enough. According to that page, the firmware can’t be distributed due to copyrighting. Oddly though, this all works just fine in Ubuntu or Backtrack right after the install…

As for the actual wireless configuration, Slackware 13 still doesn’t have a decent GUI configuration utility for wireless. For WPA, the easiest way is to just edit /etc/rc.d/rc.local and add,

iwconfig wlan0 essid “Your ESSID”
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf &
dhcpcd wlan0

Then go and edit /etc/wpa_supplicant and make sure it looks something like,

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=0
fast_reauth=1

# WPA protected network, supply your own ESSID and WPAPSK here:
network={
scan_ssid=1
ssid=”Your ESSID”
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP WEP104 WEP40
psk=”Your WPA Pass Phrase”
priority=10
}

Make sure for both the ESSID and Pass Phrase you include the quotes. The only problem left is that in dmesg I keep seeing,

b43-phy0 ERROR: PHY transmission error

This isn’t new though, I had the same error all the time with Ubuntu. My home connection seems to work fine, but some access points I’ve gotten random dropping of the connection and the above error. Considering I don’t take this laptop anywhere much now that I have my netbook, I’m not too worried about it right now.

Now to go configure Slackware the way I like it. So far, even this is being difficult…

root@vostro:/home/pherricoxide# xorgsetup
Only root can configure X.
root@vostro:/home/pherricoxide# whoami
root