These are a Few of My Favorite Things

Posted by Ryan Baxter Fri, 20 Jun 2008 17:17:00 GMT

A few of my favorite applications published major releases this week. The most known being the Firefox web browser. On Tuesday, the Mozilla team launched version 3 of their flagship product, Mozilla Firefox. It includes many bug fixes and an enhanced bookmarking system (love it). Within 24 hours, Firefox wracked up over 8 million downloads making it the most downloaded software ever.

The venerable Wine (Wine Is Not an Emulator) project finally reached version 1.0. For those not familiar with Unix-like operating systems, Wine allows users to execute Microsoft Windows programs on Linux, Mac OS X, FreeBSD, and Solaris. It’s a must have for those who just can’t quite give up their favorite Windows software.

This may not be considered a major release, but the folks at reddit have announced the open-sourcing of their social news website, reddit.com. IMO reddit.com takes the best elements of both slashdot.org and digg.com and combines them to make something even better. Kudos reddit, Mozilla, and Wine!

IE7's Inanimate GIF

Posted by Ryan Baxter Wed, 11 Jun 2008 12:06:00 GMT

Animated GIFs are most often used as activity indicators in modern AJAX (asynchronous JavaScript and XML) enabled websites. I decided to use a GIF (Graphic Interchange Format) from ajaxload.info on an application that I’ve been developing at work. The application performs server-side processing on files uploaded by employees. Processing time varies depending on the size of the file. Larger files take longer.

I wanted the animated GIF to appear when the file upload button was clicked so I placed the image within a DIV tag and hid it by setting a blank CSS display property. OnClick of the upload button, a JavaScript function toggled the display value to “block”, making the DIV appear. This worked as expected in Firefox and IE6, but not in IE7. The DIV appeared in IE7, but it’s GIF wasn’t moving.

A little googling turned up a helpful comment on Rick Strahl’s blog.

I’ve run into a problem with animated gifs inside of a hidden area of a Web page that is hidden with style.display=’none’. When the area is made visible again, in Internet Explorer this causes the image to not be displayed an animated GIF whatever I try. [sic]

Apparently IE7 doesn’t like to animate hidden GIFs. User submitted comments on Rick Strahl’s blog provided many solutions, but only a couple worked in my situation. The first uses the JavaScript setTimeout method to populate the image’s SRC attribute 200 ms after the function call. The second sets the DIV’s innerHTML to a string containing an IMG tag with the animated GIF.

<script language='javascript'> 
    function ShowLoading(elementId) 
    {
        document.getElementById(elementId).style.display = "block"; 
        setTimeout('document.images["loadingImage"].src = "../images/loading.gif"', 200); 
    } 
</script>

Neither solution is ideal, but setting the element’s innerHTML felt a little bit cleaner to me.

<script language='javascript'>
    function ShowLoading(elementId)
    {   
        var element = document.getElementById(elementId);    

        element.innerHTML = "<img src='../images/loading.gif'>";    
        element.style.display = "block";
    }
</script>

*IE7 may have animations disabled. Go to Tools > Internet Options > Advanced > Multimedia. Checking “Play animations in webpages” may affect how IE7 renders your animated GIFs.

Samba Network Shares with Nautilus in Hardy Heron Part 2

Posted by Ryan Baxter Sun, 01 Jun 2008 23:07:00 GMT

Nearly a month ago I wrote about my problems connecting to the network shares of my Linksys NAS200 using Nautilus in Ubuntu, Hardy Heron. My fix was simple and it worked. Unfortunately, the solution’s WAF (Wife Acceptance Factor) was low. Apparently she didn’t think it was easy enough to execute smbmount from a Terminal window. Whatever :) I have since written a small shell script that is called from Session Startup.

Initially, the script failed to connect to my network shares because my wireless network connection hadn’t finished negotiating before the script was executed. I coded around this by creating a while loop that greps the output of a ping to my router. If successful, the mount_shares function is called. Otherwise. the thread will sleep for 10 seconds and try again.

#!/bin/bash

user="thorbardin/ryan%password"
root_dir="/home/ryan/Network Shares"

mount_shares() {
  public_dir="$root_dir"/"Public on Thorbardin"
  home_dir="$root_dir"/"Home on Thorbardin"

  [ -d "$public_dir" ] || mkdir -p "$public_dir"
  [ -d "$home_dir" ] || mkdir -p "$home_dir"

  smbmount "//192.168.1.105/public disk" "$public_dir" -o user="$user"
  smbmount "//192.168.1.105/ryan" "$home_dir" -o user="$user"
}

while [ 1 ]; do
  if ping -c2 192.168.1.1 2>&1 | grep ttl; then
    mount_shares

    exit 0   
  fi
  sleep 10
done

exit 0

I’m already thinking about rewriting this script so that it scans my network using smbtree and automatically mounts all available network shares. That’ll be Part 3!