Gear

Pulling some old photos from my phone.

Grand Canyon, pulley gear

This is a gear from a old pulley system that serviced a mine on the west side of the Grand Canyon.

… Guano Point, is named after an old guano (bat droppings) mine that operated in the 1950’s. Guano was used primarily as a fertilizer because it is extremely rich in minerals. Daring miners would hoist hundreds of pounds of guano across the Colorado River up to the present day Guano Point. The ruins of the mine and pulley system still remain, visitors can walk right up and touch them.

from grandcanyonwest.com


android.process.acore has stopped unexpectedly

This started popping up in my existing AVD after I updated my Android SDK packages:

android.process.acore has stopped unexpectedly error message

Another reason to hate the Android emulator. *sigh*
Not sure what broke, but thankfully doesn’t it occur in newly created AVDs.


Aurora Australis

Posted by @Favidat,

Aurora Australis from the International Space Station


Elegant <img> presentation

While it’s easy to decry Flash and espouse the merits of HTML5, it’s worth taking a look at some of the positive elements found on many Flash sites and seeing what can be brought over to the HTML side. One very obvious aspect is the presentation of images. Flash sites almost never render an image in the way that an <img> tag is rendered by the browser. Flash sites will (typically) elegantly animate or fade an image in/out whereas the default browser behavior for HTML is to progressively render the image as it is received (sometimes images are 2D interlaced for a slightly better effect). Even worse, many HTML sites leave width and height as attributes to be determined dynamically for the <img> tag, resulting in page content shifting around as images are loaded.

Better image presentation is certainly possible with HTML + Javascript, and there are tons of beautiful JS image galleries on the web, but outside of such galleries most developers don’t attempt anything beyond the typical <img> presentation.

So, I did a little experiment with 2 goals in mind:

  • Elegant presentation of images with HTML + JS
  • Very simple markup, one iota above what’s necessary for a typical <img> tag

I’m pretty happy with the results.

elegant img loading

View the demo
(disable your browser cache so that loading latency is accurately taken into account)

Here’s what I did:

1. Make the <img> elements.

e.g.

<img
data-src="http://aautar.digital-radiation.com/elegant-img-loading/p1.jpg"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAQSURBVHjaYvj//z8DQIABAAj8Av7bok0WAAAAAElFTkSuQmCC"
width="200"
height="150"
alt="photo" />

Things to note:

  • The data-src attribute is an HTML 5 custom data attribute. It specifies the URL of the image to be loaded.
  • The src attribute uses the data URI scheme to load and set the initial image displayed in the img element. Leaving the src attribute blank is not desirable as it will collapse the img element and only show the alt tag (the same behavior occurs initially if a URL to an image is specified). Specifying a data URI allows the image to be loaded as part of the document itself. The data URI shown above is for a 1×1, transparent PNG. A GIF preloader would probably be a good idea here.
  • The width and height attributes are specified. This is not strictly necessary, but in keeping with the theme of elegance, this prevent other content on the page from shifting after images are loaded.

2. Write the Javascript code

<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<
script type="text/javascript">

window.onload = function ()
{
$(
'img').each(function ()
{
var imgElem = $(this);
var src = imgElem.attr('data-src');

var img = new Image();
img.src = src;
img.onload =
function ()
{

imgElem.fadeTo(
'fast', 0.0001, function ()
{
imgElem.attr(
'src', src);
imgElem.fadeTo(
'slow', 1)
});

}

});
}

</script>

For simplicity, jQuery is used.

After the page is loaded, the data-src attribute of every <img> element is read. The image, specified by the data-src attribute, is loaded via a Javascript Image object and, once loaded (Image.onload event fires):

  • The <img> element is faded out (actually faded to an alpha of 0.0001 because a total fadeOut to 0 will effectively remove the element from the document rendering).
  • The src attribute is changed to the the URL of the loaded image.
  • The <img> element is faded in.

The important bit is changing the src attribute; the effect itself, whether it’s fading, sliding, etc. is not terribly important.


Killing a Windows service stuck in the STOP_PENDING state

I ran into this issue when I attempted to restart the Windows Audio Endpoint Builder service under Windows Server 2008 R2. Thankfully I didn’t have to restart, as I found the solution here.

  1. Query the service to find the process id C:\Windows\system32>sc queryex AudioEndpointBuilder SERVICE_NAME: AudioEndpointBuilder
    TYPE : 20 WIN32_SHARE_PROCESS
    STATE : 3 STOP_PENDING
    (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
    WIN32_EXIT_CODE : 0 (0x0)
    SERVICE_EXIT_CODE : 0 (0x0)
    CHECKPOINT : 0xbc
    WAIT_HINT : 0x1388
    PID : 1008
    FLAGS :
  2. Use Task Manager or taskkill to kill the process (/F flag is to force the kill, try without first). C:\Windows\system32>taskkill /PID 1008 /F
    SUCCESS: The process with PID 1008 has been terminated.


Brightening up the subways

… for the kids!

Children's Hospital subway ad


Map directions request on webOS

Very simple, but not well documented.

First, here’s a typical call to launch the maps app and display a position (latitude, longitude + title) on the map:

this.controller.serviceRequest("palm://com.palm.applicationManager", {
method:
"open",
parameters: {
id:
"com.palm.app.maps",
params: {
query: escape(latlong) +
"(" + encodeURIComponent(title) + ")"
}
}
});

To launch the maps app and bring up the directions panel instead, replace query with daddr:

this.controller.serviceRequest("palm://com.palm.applicationManager", {
method:
"open",
parameters: {
id:
"com.palm.app.maps",
params: {
daddr: escape(latlong) +
"(" + encodeURIComponent(title) + ")"
}
}
});

google directions on webOS


CSV file detected as SYLK file in Excel

Working on some CSV export code and encountered this weird error when opening the CSV file in Excel,

Excel has detected that 'test.csv' is a SYLK file, but cannot load it. Either the file has errors or it is not a SYLK file format. Click OK to try to open the file in a different format.

The file was certainly a CSV file; I had no clue what an SYLK file was.

The issue, as I discovered here, is due to the first 2 letters in the file being “ID” (which was the name of the first column); change this to something else (e.g. “Id”) and the file loads correctly without any warnings or errors.


E: tzdata: subprocess installed post-installation script returned error exit status 1

I got the above error while attempting to install updates on a Linux Mint system. This thread provided a few possible solutions, none of which worked for me (though I was glad I discovered the grub » recovery mode » repair broken packages option, which might come in handy in the future). Digging a bit, I ran:

dpkg --configure tzdata

and noticed,

debconf: DbDriver "config": could not open /var/cache/debconf/config.dat

There was no /var/cache/debconf/ directory and, as indicated here, simply creating it would provide a fix. So a simple:

sudo mkdir /var/cache/debconf

… and I was good to go!


Net. Flix.

Netflix CEO Reed Hastings on streaming content:

“We had set up the whole business essentially for streaming, but the network wasn’t big enough years ago,” he said. “But in 2005 we clicked on YouTube and watched cats on skateboards — and we thought, it’s here! Since then, we’ve had so much fun finally delivering on our name: Net. Flix.