2011-12-31

Green Smoothies

Every morning I make a green smoothie, I figure since there are protein supplements why not a fruit and vegetable supplement (not a fruit/vegetable replacement or an excuse to eat junk food). Here's how I make them:

2011-12-18

BrowserID and jQuery

I've been trying out BrowserID and for some reason binding BrowserID's navigator.id.getVerifiedEmail() to click events using jQuery never seems to work. I looked through BrowserID's sample code and found that they noticed the same thing (lines 125 - 133 as of this writing). So instead of using jQuery:

Try something like this:

2011-09-19

Makefile target to enable Go debugging symbols

In my copious free time I've been learning Go. I'm currently learning how to debug Go programs with gdb. Turns out the linkers ([68]l) need the  '-e' option. Here is a simple Makefile to add a debug target.

2011-09-18

Update to Label Sphere

I've finally had some free time to work on the Label Sphere. The new version should correctly color the labels according to your blog's color scheme on Chrome, Firefox, and IE 8. The new version has not been added to the Blogger gallery yet, but when it does get added I will post an update. To use the new version, add a new gadget to your blog, select "Add your own" and use the following URL

http://alexdioso.github.com/LabelSphere/LabelSphere.xml

I've also released the gadget under the GPL here

https://github.com/alexdioso/LabelSphere

2011-08-22

Run-time and design-time selection of a ViewModel using XAML

I've been working on a WPF project in Visual Studio 2010 and I came across a problem where Visual Studio would crash when I used the Document Outline while editing an XAML in the Design view. There seems to be several ways of solving this but all the methods seem to involve code either as a separate class such as a ViewModelLocator or in a code-behind using GetIsInDesignMode.

Here is a solution that uses (mostly) XAML. First, create a new ViewModel class that is a stub or mock. This class will also allow you to have some design-time data that won't crash Visual Studio. Then implement the following XAML to select between your main ViewModel and your mock ViewModel. The Blend XML Namespace ("d") is marked as Ignorable (only available during design-time) then AlternateContent is used to select the MockViewModel if the "d" namespace is available (design-time) and fallback to the MainViewModel (run-time).

2010-08-30

Keyboard issues with GNOME on a PowerBook G4 running OpenBSD

While setting up OpenBSD on my PowerBook, I ran across a problem with GNOME. My mouse would work fine but the moment I tried to type something, key presses would not register and mouse clicks would no longer work. The caps lock lights still worked and I could ssh to the machine so it was not locked up. Restarting X with Ctrl-Alt-Backspace seemed to be the only way out. The problem was the same if GNOME was started from GDM or from startx. FVWM from startx worked fine, so it wasn't a hardware issue.

After much searching I finally stumbled upon a thread from OpenBSD's misc@ email list that matched my problem:


The next email in the thread mentioned problems with XDM, and I too was also experiencing problems with GDM.

The third email pointed me to the right location for the solution, "the second parapgraph of /usr/X11R6/README" which states:
To use xdm from rc.conf, it is necessary to disable /dev/ttyC0 in
/etc/ttys, change the 'status' of /dev/ttyC0 to 'off'.
I remember seeing this when I initially set up X but unfortunately I didn't follow the directions (maybe because I was having the problem from startx as well as GDM). Disabling /dev/ttyC0 and rebooting solved the issue.

2010-08-19

Drobo and a Asus RT-N16 running DD-WRT

Here are some tips on getting a Drobo (tested with a 1st Generation Drobo) working with an Asus RT-N16 running DD-WRT.

DD-WRT's notes on the Asus RT-N16

First off, BACKUP your data on the Drobo. You'll probably need to change the partitions and reformat your Drobo.

It looks like DD-WRT 24 does not support GUID Partition Tables (GPT) which means you need to use a MBR partition table and you LUN size will be limited to 2TB. This was not really a problem in my case since the 1st Generation Drobo is restricted to a 2TB LUN.

I think the standard Drobo tools will use a GPT. To check if your Drobo has a GPT just run fdisk on the drobo

$ sudo fdisk -clu /dev/sdc
WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdc: 2199.0 GB, 2199023185920 bytes
87 heads, 57 sectors/track, 866095 cylinders, total 4294967160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa103ff18
Device Boot Start End Blocks Id System
/dev/sdc1 2048 4294967159 2147482556 83 Linux


Did you BACKUP your Drobo?

To remove the GPT, erase the first and last sectors:

$ sudo dd if=/dev/zero of=/dev/sdc bs=512 count=2
$ sudo dd if=/dev/zero of=/dev/sdc bs=512 seek=4294967159

Now create a new partition on the Drobo with fdisk, then format the partition as ext3 as described on the DataRobotics website (skip the GPT part).

Next up (hopefully) is a C program that will report the Drobo's status. I needed to write a C program because unfortunately the excellent drobo-utils is written in Python and Python needs more space than is available on a router. I also didn't want to install Python to external storage attached to the router, because if that storage fails, then there would be no way to determine the status of the Drobo.

PreferenceKey Quirks

PreferenceKey has a few quirks that have tripped me up. One is the reduce(value:nextValue:) implementation. The other is that a PreferenceKe...