tag:blogger.com,1999:blog-13780703184461656852024-03-05T00:54:11.245-08:00blog.ikaika.orgikaika (ee-KYE-kah): Strong, powerful, sturdy, stalwart; strength, force, energy, might.Unknownnoreply@blogger.comBlogger39125tag:blogger.com,1999:blog-1378070318446165685.post-52012044504031633112022-03-27T12:57:00.000-07:002022-03-28T04:55:59.501-07:00PreferenceKey QuirksPreferenceKey has a few quirks that have tripped me up. One is the reduce(value:nextValue:) implementation. The other is that a PreferenceKey will not propagate upward past a View that has a preference(key:value:) set using the same PreferenceKey.
<br><br>
<H3>
reduce(value:nextValue:)
</H3>
I've found that PreferenceKey's reduce(value:nextValue) will be called several times, even if there are no other Views that have a preference() with the same PreferenceKey in the View tree. And sometimes nextValue() in those calls will return a nil value. Because of this, nextValue() should do more than just
<br>
<script src="https://gist.github.com/alexdioso/ab5349116597a46764d5da7ef69568df.js"></script>
<br>
One option is to reduce based on a timestamp:
<br>
<script src="https://gist.github.com/alexdioso/10638e2fee07d384215ec145bf2218ce.js"></script>
<br>
<H3>
PreferenceKey Propagation Blocked by preference(key:value:)
</H3>
Another issue I've found is a PreferenceKey will not get passed up through the View tree past any parent View that uses the same PreferenceKey in a preference(key:value:)
<br>
<script src="https://gist.github.com/alexdioso/416a476721a4156f2dda22d35b193608.js"></script>
<br>
The "Red" and "Green" buttons should generate "before" and "after" messages while the "Blue" and "Yellow" buttons should only create "after" messages and all buttons should change the color. But because of the issue the "Red" and "Green" buttons don't work as expected.
<br>
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmwixr69QftL_WShYtuqryAzm7gYtS3MeGEHF3_wbpMPCq8OzOL2cbNg_9rMNe03xblninTGqxyQh0kJnKeYxpdpgeFIGIxqCGFdirlBMgsMZVJY8BkF832NkD4SmrZK5nezkLUFuECzbC0iF_65JyF3GCtlsMO9au5ZhLtQSYND3qNPtTkiSXVpnu/s480/PreferenceKeyBlocked.gif" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" height="320" data-original-height="480" data-original-width="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmwixr69QftL_WShYtuqryAzm7gYtS3MeGEHF3_wbpMPCq8OzOL2cbNg_9rMNe03xblninTGqxyQh0kJnKeYxpdpgeFIGIxqCGFdirlBMgsMZVJY8BkF832NkD4SmrZK5nezkLUFuECzbC0iF_65JyF3GCtlsMO9au5ZhLtQSYND3qNPtTkiSXVpnu/s320/PreferenceKeyBlocked.gif"/></a></div>
<br>
A way around this is to capture the preference before using it again:
<br>
<script src="https://gist.github.com/alexdioso/3e8fdf20e0dce63ab65ef0a2c111f18a.js"></script>
<br>
Now the "Red" and "Green" buttons work as expected.
<br>
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic_dUe5DFW1qP9X_PBaWOFxSF-BenUPw0d-JJhd9T26d7TunYYqsVsSxlmOSNHV4lAk22XFNvggZQXdj9SYHfVX-EZfpENauUnhqb-hc_VtPzhi7zKaIaOHe5DMQM9KXOmN7SOD1S-1GSKgh5aIfvxjThXoV4xuDSri_zkyDjGxDcjCdj3EdVFyXFf/s480/PreferenceKeyKludge.gif" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" height="320" data-original-height="480" data-original-width="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic_dUe5DFW1qP9X_PBaWOFxSF-BenUPw0d-JJhd9T26d7TunYYqsVsSxlmOSNHV4lAk22XFNvggZQXdj9SYHfVX-EZfpENauUnhqb-hc_VtPzhi7zKaIaOHe5DMQM9KXOmN7SOD1S-1GSKgh5aIfvxjThXoV4xuDSri_zkyDjGxDcjCdj3EdVFyXFf/s320/PreferenceKeyKludge.gif"/></a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-33579247740839111502021-12-13T18:00:00.027-08:002022-03-25T10:15:35.247-07:00Spotlight on macOS using a lot of CPUIf you are a developer on macOS and notice Spotlight consuming a lot of CPU the reason could be that Spotlight is indexing the Simulator and Platforms directories. When I ran lsof and checked the files that spotlight was accessing, it was reading files in ~/Library/Developer/CoreSimulator and /Applications/Xcode.app/Contents/Developer/Platforms. Adding those two directories to the Spotlight Privacy tab and then restarting your computer will prevent Spotlight from indexing them. Go to System Preferences > Spotlight > Privacy to add them.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-29524784611333359582019-01-15T16:00:00.001-08:002022-03-25T10:15:55.202-07:00Restart Xcode PlaygroundIf your playground ever crashes and/or gets stuck try switching the playground type in the File Inspector (right panel) to a different Platform and then back. This should restart the playground simulator.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-30389102392744423262018-09-20T18:30:00.000-07:002018-09-20T18:30:00.894-07:00Simple Events in SwiftEvents are useful when you need more than one delegate or event handler. Here is a simple class that can be used to manage events:<br>
<br>
<script src="https://gist.github.com/alexdioso/9d4bc55948a1d448080a5e5c2b67152c.js"></script><br>
<br>
<br>
Use the uiSubscribe and uiUnsubscribe to have the Event class automatically run the event handler on the main DispatchQueue (for GUI related stuff). Here is an example of how to use them:<br>
<br>
<script src="https://gist.github.com/alexdioso/ef18e2e87f17dbb1f7a42cc2325bc8d9.js"></script>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-50641903554159817582018-09-18T18:30:00.000-07:002018-09-18T18:30:07.841-07:00UIColor Extension for RGBA Hex and HSLAHere is an extension for UIColor that I've found useful when working with Photoshop and Web designers. It allows you to specify a UIColor in RGBA hex or HSLA.<br><br><script src="https://gist.github.com/alexdioso/eb7c24b21db5af64433ebd9a91a9e07d.js"></script>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-60534441885203246502014-03-26T20:11:00.000-07:002014-03-26T20:11:23.120-07:00Label Sphere will be removedI will be removing the Label Sphere from the Blogger Gadgets list on April 5th. This may break the Label Sphere on your blog. If you want to keep using the Label Sphere then read on.<br />
<br />
If you have manually added the latest gadget using the url http://alexdioso.github.com/LabelSphere/LabelSphere.xml then you don't have to do anything.<br />
<br />
If you have not manually added (or don't know) then you probably added the Label Sphere using the Gadgets list. To keep using the Label Sphere:<br />
<br />
<ol>
<li>Remove the current Label Sphere on your blog.</li>
<li>Click on "Add a Gadget".</li>
<li>In the "Add a Gadget" window that opens:</li>
<ol>
<li>In the left column, click "Add your own".</li>
<li>Enter the url: http://alexdioso.github.com/LabelSphere/LabelSphere.xml</li>
<li>Click "Add by URL".</li>
</ol>
</ol>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-77694395029605100822012-04-21T13:23:00.000-07:002012-04-21T13:26:02.730-07:00Displaying user@host in tmux window titlesI use <a href="http://tmux.sourceforge.net/">tmux</a> a lot (having switched from <a href="http://www.gnu.org/software/screen/">GNU Screen</a>) and frequently ssh to different hosts from different tmux windows. One thing that I find helpful is knowing which host I'm ssh'd to in each tmux window. Here is a little trick for your .bash_aliases (on every host you ssh to) which will display user@host in each tmux window title:
<script src="https://gist.github.com/2439315.js?file=gistfile1.sh">
</script><br />
The first part sets the terminal's window title to user@host: /working/directory<br />
<blockquote class="tr_bq">
\033]2;${USER}@${HOSTNAME}: ${PWD}\007</blockquote>
The second part set's the current tmux window title to user@host<br />
<blockquote class="tr_bq">
\033k${USER}@${HOSTNAME}\033\\</blockquote>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1378070318446165685.post-52908442027839929502012-03-26T22:26:00.001-07:002012-03-27T16:46:54.987-07:00System.Workflow.* missing from Add Reference dialogRecently, I've been working with <a href="http://msdn.microsoft.com/en-us/netframework/aa663328">Windows Workflow Foundation 4</a> a lot. I wanted to use a <a href="http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.design.freeformactivitydesigner.aspx" target="">FreeformActivityDesigner</a> for something but the System.Workflow.* assemblies were not listed in the Add Reference dialog. The problem was that my Solution was targeting the .NET Framework 4 Client Profile Platform Update 1 which <a href="http://msdn.microsoft.com/en-us/library/ff462634.aspx">doesn't contain those assemblies</a>. To fix this problem just change the target to .NET Framework 4 Platform Update 1.<br />
<br />
<i>Edit:</i> It looks like the FreeformActivityDesigner is not really usable in WWF 4 and that the alternative is WorkflowItemPresenter. (<a href="http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b4f2f399-7fdf-49e5-954c-d9ef1be07dad/">forum post</a>)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-7763272873841995442011-12-31T17:50:00.000-08:002011-12-31T18:18:45.234-08:00Green SmoothiesEvery 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:<br />
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<embed flashvars="host=picasaweb.google.com&captions=1&noautoplay=1&hl=en_US&feat=flashalbum&RGB=0x000000&feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F108192339909305053186%2Falbumid%2F5692450024736069153%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCKa48s-jtp2JYg%26hl%3Den_US" height="267" pluginspage="http://www.macromedia.com/go/getflashplayer" src="https://picasaweb.google.com/s/c/bin/slideshow.swf" type="application/x-shockwave-flash" width="400"></embed></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-66679249162472702832011-12-18T15:59:00.000-08:002011-12-18T15:59:40.707-08:00BrowserID and jQueryI've been trying out <a href="https://browserid.org/">BrowserID</a> and for some reason binding BrowserID's navigator.id.getVerifiedEmail() to click events using jQuery never seems to work. I looked through BrowserID's <a href="https://github.com/lloyd/myfavoritebeer.org/blob/master/static/js/main.js">sample code</a> and found that they noticed the same thing (lines 125 - 133 as of this writing). So instead of using jQuery:<br />
<br />
<script src="https://gist.github.com/1494853.js?file=gistfile1.js">
</script>
Try something like this:
<script src="https://gist.github.com/1494860.js?file=gistfile1.js">
</script>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-60212088362337094292011-09-19T15:40:00.000-07:002018-09-15T18:49:46.402-07:00Makefile target to enable Go debugging symbolsIn my <a href="http://www.google.com/search?q=copious+free+time">copious free time</a> I've been learning <a href="http://golang.org/">Go</a>. I'm currently learning how to <a href="http://blog.golang.org/2010/11/debugging-go-code-status-report.html">debug Go programs with gdb</a>. Turns out the linkers ([68]l) need the '-e' option. Here is a simple Makefile to add a debug target.<br />
<br />
<script src="https://gist.github.com/1227804.js?file=Makefile"></script>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-23626105863406649112011-09-18T15:01:00.000-07:002011-09-18T15:01:03.015-07:00Update to Label SphereI'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<br />
<br />
<a href="http://alexdioso.github.com/LabelSphere/LabelSphere.xml">http://alexdioso.github.com/LabelSphere/LabelSphere.xml</a><br />
<br />
I've also released the gadget under the <a href="http://www.gnu.org/licenses/gpl.html">GPL</a> here<br />
<br />
<a href="https://github.com/alexdioso/LabelSphere">https://github.com/alexdioso/LabelSphere</a>Unknownnoreply@blogger.com26tag:blogger.com,1999:blog-1378070318446165685.post-60967853619613924932011-08-22T16:30:00.000-07:002011-08-22T17:14:17.027-07:00Run-time and design-time selection of a ViewModel using XAMLI'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 <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.designerproperties.getisindesignmode.aspx">GetIsInDesignMode</a>.<div>
<br /></div><div>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 <a href="http://msdn.microsoft.com/en-us/library/aa350024.aspx">Ignorable</a> (only available during design-time) then <a href="http://msdn.microsoft.com/en-us/library/bb514523(v=VS.100).aspx">AlternateContent</a> is used to select the MockViewModel if the "d" namespace is available (design-time) and fallback to the MainViewModel (run-time).</div>
<br /><script src="https://gist.github.com/1163915.js?file=DesignAndRunTime.xaml"></script>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1378070318446165685.post-74638709039744313452010-08-30T21:47:00.000-07:002010-08-30T22:15:28.421-07:00Keyboard issues with GNOME on a PowerBook G4 running OpenBSD<div>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.</div><div><br /></div><div>After much searching I finally stumbled upon a thread from OpenBSD's misc@ email list that matched my problem:</div><div><br /></div><div><a href="http://marc.info/?l=openbsd-misc&m=127040327313639&w=2">OpenBSD 4.6, powerpc, KDE, Gnome, XFCE play nicely?</a></div><div><br /></div><div>The <a href="http://marc.info/?l=openbsd-misc&m=127040726917200&w=2">next email in the thread</a> mentioned problems with XDM, and I too was also experiencing problems with GDM.</div><div><br /></div><div>The <a href="http://marc.info/?l=openbsd-misc&m=127040786917962&w=2">third email</a> pointed me to the right location for the solution, "the second parapgraph of /usr/X11R6/README" which states:</div><div><div></div><blockquote><div>To use xdm from rc.conf, it is necessary to disable /dev/ttyC0 in</div><div>/etc/ttys, change the 'status' of /dev/ttyC0 to 'off'.</div></blockquote><div></div></div><div>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.</div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-1378070318446165685.post-79864712314444359532010-08-19T14:35:00.000-07:002011-09-18T13:56:45.610-07:00Drobo and a Asus RT-N16 running DD-WRTHere are some tips on getting a <a href="http://www.drobo.com/">Drobo</a> (tested with a 1st Generation Drobo) working with an <a href="http://usa.asus.com/product.aspx?P_ID=WAa6AQFncrceRBEo">Asus RT-N16</a> running <a href="http://www.dd-wrt.com/">DD-WRT</a>.<br />
<div>
<br /></div>
<div>
DD-WRT's <a href="http://www.dd-wrt.com/wiki/index.php/Asus_RT-N16">notes</a> on the Asus RT-N16</div>
<div>
<br /></div>
<div>
First off, BACKUP your data on the Drobo. You'll probably need to change the partitions and reformat your Drobo.</div>
<div>
<br /></div>
<div>
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.</div>
<div>
<br /></div>
<div>
I think the standard Drobo tools will use a GPT. To check if your Drobo has a GPT just run fdisk on the drobo</div>
<div>
<br /></div>
<div class="code corner shadow">
<div>
<blockquote>
$ sudo fdisk -clu /dev/sdc<br />WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.<br />Disk /dev/sdc: 2199.0 GB, 2199023185920 bytes<br />87 heads, 57 sectors/track, 866095 cylinders, total 4294967160 sectors<br />Units = sectors of 1 * 512 = 512 bytes<br />Sector size (logical/physical): 512 bytes / 512 bytes<br />I/O size (minimum/optimal): 512 bytes / 512 bytes<br />Disk identifier: 0xa103ff18<br />Device Boot Start End Blocks Id System<br />/dev/sdc1 2048 4294967159 2147482556 83 Linux</blockquote>
</div>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
Did you BACKUP your Drobo?</div>
<div>
<br /></div>
<div>
To <a href="http://www.linuxquestions.org/questions/linux-general-1/cant-get-rid-of-gpt-disk-label-729209/#post3557821">remove the GPT</a>, erase the first and last sectors:</div>
<div>
<br /></div>
<div class="code corner shadow">
<div>
<blockquote>
$ sudo dd if=/dev/zero of=/dev/sdc bs=512 count=2<br />$ sudo dd if=/dev/zero of=/dev/sdc bs=512 seek=4294967159</blockquote>
</div>
</div>
<div>
<br /></div>
<div>
Now create a new partition on the Drobo with fdisk, then format the partition as ext3 as described on the <a href="http://support.datarobotics.com/app/answers/detail/a_id/165">DataRobotics website</a> (skip the GPT part).</div>
<div>
<br /></div>
<div>
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 <a href="http://drobo-utils.sourceforge.net/">drobo-utils</a> 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.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-9289618009793203432010-02-25T14:58:00.000-08:002010-02-25T17:13:05.202-08:00WOFF?!During my recent forays into web development I'm learning about using other fonts. It seems that <a href="http://en.wikipedia.org/wiki/Web_Open_Font_Format">Web Open Font Format (WOFF)</a> may be <a href="http://www.w3.org/2009/08/WebFonts/charter.html">the way</a> to incorporate a font on a web page.<div><br /></div><div>Support for WOFF:</div><div><ul><li><a href="http://blog.mozilla.com/blog/2009/10/20/mozilla-supports-web-open-font-format/">Several font foundries</a> approve of the format</li><li>Firefox (3.6) <a href="http://blog.mozilla.com/blog/2009/10/20/mozilla-supports-web-open-font-format/">supports it</a></li><li>Chrome is <a href="http://code.google.com/p/chromium/issues/detail?id=25543">investigating support</a>, star the issue to vote for it</li><li>Internet Explorer <a href="http://www.youtube.com/watch?v=BKOywf9Uc5M#t=01m21s">might support it</a> (@1:21)</li><li>Safari and Opera: I wasn't able to find any solid info</li></ul></div><div><br /></div><div>Existing TrueType/OpenType fonts can be converted to WOFF with <a href="http://people.mozilla.com/~jkew/woff/">these programs</a>. Arch Linux users can install these programs using my <a href="http://aur.archlinux.org/packages.php?ID=35011">AUR package</a>.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-30872181579435596672010-02-19T15:26:00.000-08:002010-02-19T16:06:39.164-08:00Label Sphere v2A reader <a href="http://blog.ikaika.org/2010/02/label-sphere.html#c4096048755355301075">pointed out</a> 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 (<a href="http://www.google.com/chrome">Google Chrome</a>).<div><br /></div><div>The issue with Firefox was that the label <a href="http://www.quirksmode.org/css/clearing.html">container was collapsing</a>, 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):</div><div><br /><div class="code corner shadow"><code>overflow: hidden;<br />width: 100%;<br /></code></div><br /></div>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 <a href="http://www.webdesignerwall.com/general/trash-all-ie-hacks/">I don't want to support IE6</a>) 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. <a href="http://msdn.microsoft.com/en-us/library/cc288326(VS.85).aspx#multi">IE8 doesn't support setting :visited in JavaScript</a>. It's also been <a href="http://www.webdevout.net/css-hacks#unrecommended-link_visited">documented</a> that IE7 needs both :visited and :link (eg a:link:visited) but I'm not sure if that's related. A simple <a href="http://www.w3schools.com/js/js_try_catch.asp">try</a> around the :link and :visited lines with an empty <a href="http://www.w3schools.com/js/js_try_catch.asp">catch</a> 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.<div><br /></div><div>One other thing I noticed is that the Label Sphere moved smoothly and quickly in Google Chrome, probably because of their <a href="http://code.google.com/p/v8/">V8 JavaScript Engine</a>. Firefox and IE were slower and stuttered a little.</div><div><br /></div><div>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.</div>Unknownnoreply@blogger.com32tag:blogger.com,1999:blog-1378070318446165685.post-36466328538104806292010-02-10T17:36:00.000-08:002011-09-18T13:53:48.461-07:00Global Temperature Change MapMy 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 <a href="http://www.ncdc.noaa.gov/oa/climate/ghcn-monthly/index.php">NOAA</a>. 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.<div><br /></div><div>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.</div><div><br /></div><div>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.</div><div><br /></div><div>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 <a href="https://github.com/alexdioso/public/blob/master/lib/perl/Local/Polyline.pm">Perl modulino</a> (<a href="http://en.wikipedia.org/wiki/ISC_license">ISC License</a>) to convert a set of coordinates to an <a href="http://code.google.com/apis/maps/documentation/polylinealgorithm.html">encoded polyline string</a>.</div><div><br /></div><div>The backend was rewritten to output the data in JSON instead of a kml.</div><div><br /></div><div>The frontend was rewritten to create GPolygons using the encoded polylines.</div><div><br /></div><div>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.</div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx2HuxQgys0KtpB_Gk1K43hY4MQeuwjnBGsiqvQo4_Q27V76hKKIgfmgZTFlJPGaNQ0Tw7QrFB323u8vZfGPR9faX93qQmXupy-JvaEMdUVvXwlS7GPJOPu13qcsfA0rvP0F9mI4JV-AI/s1600-h/Screenshot.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 214px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx2HuxQgys0KtpB_Gk1K43hY4MQeuwjnBGsiqvQo4_Q27V76hKKIgfmgZTFlJPGaNQ0Tw7QrFB323u8vZfGPR9faX93qQmXupy-JvaEMdUVvXwlS7GPJOPu13qcsfA0rvP0F9mI4JV-AI/s320/Screenshot.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5436879477869374050" /></a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-88860017479484631912010-02-09T16:39:00.001-08:002010-02-09T23:21:59.474-08:00Label SphereMy 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 to write one in JavaScript. I figured it would be a good learning experience. This gadget uses JavaScript and jQuery to rotate divs around a single point. Depth is represented by changing the font size and opacity. You can add my gadget to your blogger layout by adding a new gadget and searching for either "Alex Dioso" or "Label Sphere".<br /><br />I've also updated my <a href="http://blog.ikaika.org/2010/01/vimrc.html">.vimrc</a> for use with JavaScript.Unknownnoreply@blogger.com23tag:blogger.com,1999:blog-1378070318446165685.post-25464951774924416902010-01-25T11:44:00.000-08:002010-01-25T12:01:16.456-08:00Perl on Google App EngineI recently started using <a href="http://code.google.com/appengine/">Google App Engine</a> and I have to say that I like it. The only thing I would change is support for other languages, namely Perl. I don't mind learning Python, but since I already know Perl it would be nice to be able to use it.<br /><br /><div>If anyone else is interested in using Perl on Google App Engine please <b>Star</b> <a href="http://code.google.com/p/googleappengine/issues/detail?id=34">issue #34</a> (do not reply to the issue with a "me too" or "+1", it just clutters everyone's inbox). You'll have to be logged into your Google account to do this.</div><div><br /></div><div>There is also a <a href="http://code.google.com/p/perl-appengine/">Google Code project</a> working on getting Perl ready for use in Google App Engine.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-72255311356868191082010-01-22T12:24:00.000-08:002011-09-18T13:52:26.938-07:00Template.pmI've been trying to write my Perl scripts as modulinos (described in <a href="http://oreilly.com/catalog/9780596527242">Mastering Perl</a>), the basic idea being that runnable scripts written as modules can be used by later scripts. So far it has been working out well.<br /><br />Here is my <a href="https://github.com/alexdioso/public/blob/master/templates/perl/Template.pm">Template.pm</a> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-50753818825382016802010-01-22T12:19:00.000-08:002011-09-18T13:51:34.827-07:00subroutine.plMy <a href="https://github.com/alexdioso/public/blob/master/templates/perl/subroutine.pl">subroutine.pl</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-71428266339965418002010-01-22T12:14:00.000-08:002011-09-18T13:50:59.677-07:00isc_license.plThe ISC License that I use for some of my Perl scripts: <a href="https://github.com/alexdioso/public/blob/master/templates/perl/isc_license.pl">isc_license.pl</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-88353117604331354222010-01-22T12:07:00.000-08:002011-08-23T11:17:05.415-07:00.vimrcMy <a href="http://github.com/alexdioso/public/blob/master/configs/vim/vimrc">.vimrc</a>
<br />
<br />(Note that there are control characters in the last few lines)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1378070318446165685.post-60044990856754437442010-01-22T12:01:00.000-08:002011-09-18T13:50:01.523-07:00.perltidyrcMy <a href="https://github.com/alexdioso/public/blob/master/configs/perltidyrc">.perltidyrc</a>Unknownnoreply@blogger.com0