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
ikaika (ee-KYE-kah): Strong, powerful, sturdy, stalwart; strength, force, energy, might.
2011-09-18
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.
2010-02-25
WOFF?!
During my recent forays into web development I'm learning about using other fonts. It seems that Web Open Font Format (WOFF) may be the way to incorporate a font on a web page.
Support for WOFF:
- Several font foundries approve of the format
- Firefox (3.6) supports it
- Chrome is investigating support, star the issue to vote for it
- Internet Explorer might support it (@1:21)
- Safari and Opera: I wasn't able to find any solid info
Existing TrueType/OpenType fonts can be converted to WOFF with these programs. Arch Linux users can install these programs using my AUR package.
2010-02-19
Label Sphere v2
A reader pointed out that my Label Sphere wasn't working as advertised. I took a look at both our blogs and they both looked fine, then I realized it must be a browser issue. I looked again with Firefox and sure enough the labels were all stacked on each other at the bottom of the gadget. I made the mistake of only testing in one browser (Google Chrome).
For the sake of completeness I checked the Label Sphere using IE8 on my gf's computer (the only IE I can get on Arch Linux is IE6 and I've decided I don't want to support IE6) and sure enough IE8 had a JavaScript error about "Object doesn't support this property or method". This error occurred while trying to set the a:link and a:visited colors to the current blogs theme. IE8 doesn't support setting :visited in JavaScript. It's also been documented that IE7 needs both :visited and :link (eg a:link:visited) but I'm not sure if that's related. A simple try around the :link and :visited lines with an empty catch worked around this problem. The only downside is that a blog's visitors using IE8 won't see the blog's link and visited color scheme in the Label Sphere.
The issue with Firefox was that the label container was collapsing, then JavaScript got a very small height for the container which resulted in a very small sphere. To keep the container from collapsing I added the following to the style of the container (as stated in the link):
overflow: hidden;
width: 100%;
One other thing I noticed is that the Label Sphere moved smoothly and quickly in Google Chrome, probably because of their V8 JavaScript Engine. Firefox and IE were slower and stuttered a little.
So for anyone using IE6 (or any other outdated browser) it's time you upgrade! And if you aren't using Google Chrome you should give it a try.
2010-02-10
Global Temperature Change Map
My first project with Google App Engine was a Google Map that displayed temperature data for a given date. I used monthly grid data provided by NOAA. With this data the Earth is divided up into 5x5 degree grids for a total of 2592 grids. I wrote a simple Perl script to parse the NOAA data, find the min and max temperatures, generalize each temperature point into a scale of 1 (min) to 9 (max), calculate the latitude and longitude for each corner of the grid, and write a CSV file suitable for upload to the datastore.
For the backend I wrote a Python script that created a kml of the data for the requested date. In the kml, each temperature range is a separate Placemark, and within each Placemark are GPolygons representing the grid data.
The frontend used JavaScript and jQuery to load the kml as a GGeoXml. There was also a play button that steps through all the available dates.
Unfortunately only 1 GPolygon for each Placemark would load. So I re-wrote the Perl script to output encoded polylines instead of latitude, longitude coordinates. I also wrote a Perl modulino (ISC License) to convert a set of coordinates to an encoded polyline string.
The backend was rewritten to output the data in JSON instead of a kml.
The frontend was rewritten to create GPolygons using the encoded polylines.
This time all the polygons were created correctly. The first date I tested was 1880-01 with around 200 temperature grids. With this many grids, the tab running my map consumed over 300MB of memory. Therefore, I didn't even try loading the most recent date, as it probably had over 2000 temperature grids. My conclusion from this project is that only a few polygons can be created on a Google Map. Here is a screenshot of the application. Note that the date range is only from 1880-01 to 1880-11 so the temperature range is quite small.
Subscribe to:
Posts (Atom)
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...
-
A reader pointed out that my Label Sphere wasn't working as advertised. I took a look at both our blogs and they both looked fine, the...
-
My first Google Gadget is at the top of the left column of my blog. I've seen label clouds around and they all used flash so I decided ...
-
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...