Jason Salas' WebLog

On-air and online: making people laugh, making people think, pissing people off

Sponsors

ASP.NET sites that kick ass

Pals with blogs

Podcasts I listen to

September 2005 - Posts

"eBay Hotties"? That's just wrong.

I was perusing several Slide image stream channels and noticed that one was named "eBay Hotties".  Intrigued, I checked it out, and it looks to be a gallery of corsets and other slinky regalia.  I dug it - very nicely done, artsy, and tasteful.  But my initial reaction - the very notion of promoting pictures of women and men appearing in online auctions was just difficult to latch onto.

No disrespect to the fine (and assumedly physically attractive) folks working at eBay, but that classification just sounds odd.

(That having been said, it is a very cool channel.)

Posted: Sep 29 2005, 03:32 PM by guam-aspdev | with 2 comment(s)
Filed under:
No love for my hometown in mapping apps

This is a self-defeating argument, but it irks me to no end how I can write all these cool apps integrating Google Maps and Google Earth, but there's no representation for Guam (this is so often the case with most industries).  I know it'll be there someday, but I wish I could participate in all the Flickr craze displaying my company's site, my house, my school, and other places while the technology's still in beta.

I'm sure others from small towns, impoverished areas and non-metropoli share my pain.

Posted: Sep 29 2005, 03:26 PM by guam-aspdev | with 1 comment(s)
Filed under: ,
Adrian Holovaty featured on Interactives Narratives podcast
Adrian Holovaty, who's gained worldwide acclaim for his award-winning work for ChicagoCrime.org, and who's work I mentioned a few days ago was featured in an audio interview for the Interactives Narratives podcast series.  Good listening about someone really on the cutting-edge of design & development.
CommunityWalk: cool new integrated-mapping-mash-up-service-thingy

I discovered and have been heavily messing around with CommunityWalk, a very slick web-based mapping service, which allows for all sorts of app mashups, including adding Flickr image galleries to locales.  It's got a pretty sizable amount of submissions already, and is very neat. (Check out this sample bridging a photostream with a Google Map).

Good job Jared!

Using .NET's Cache API defensively to guard against web service downtime

I ran into a problem recently with information I'm importing into a large site I run from a remote provider via XML.  The source unfortunately ran into some downtime, causing a user control on which I display the data to timeout, and therefore breaking my homepage.  I talked about in more detail on today's podcast.

This reminded me of a programming tactic I use to guard against such problems, which can be catastrophic depending on your implementation of web service, RSS feed or other types of remote data.  Basically, I call a helper method that wraps a call to such a remote data store, but rather than return the data and assign it to a local variable, the subroutine doesn't return anything.  The key is invoking the static Cache.Insert() method - storing the data within the server-side cache and assigning a lifespan for the data.  (See more of my tips & tricks for using the Cache API on MSDN)

Notice that the following code uses a longer time for a valid call (assuming nothing goes wrong) in the try block, and a much shorter span in the catch block, factoring in time for the remote administrators to fix a problem, like letting a server reboot.  In the latter case, a default "Not available..." message is stored and cached.  Then, you can just test for the presence of data within the Cache API by its unique key, and either invoke the helper method, or pull the data straight out of the Cache.

<script runat="server">
protected void Page_Load(object sender,EventArgs e)
{
        if(Cache["remoteData"] == null)
        {
            GetRemoteDataFromWebService();
        }
   
        lblremoteData.Text = (string)Cache["remoteData"];
}
   
private void GetRemoteDataFromWebService()
{
       string returnValue = string.Empty;

        try
        {
            returnValue = // call the web service (or import remote data) and return a value
            Cache.Insert("remoteData",returnValue,null,DateTime.Now.AddHours(6),TimeSpan.Zero,CacheItemPriority.Low,null);
        }
           
        catch
        {
            returnValue = "The data is not available at this time";
            Cache.Insert("remoteData",returnValue,null,DateTime.Now.AddMinutes(30),TimeSpan.Zero,CacheItemPriority.Low,null);
        }
        finally
        {
            if(reader != null)
                reader.Close();
        }
}
</script>
<asp:Label id="lblremoteData" runat="server"/>

Posted: Sep 29 2005, 10:28 AM by guam-aspdev | with no comments
Filed under:
Digital Pontification: Podcast Show Notes - September 29, 2005

Download this podcast

Leave me a voicemail, send me a shoutout, or make comments about today's podcast: 1-206-600-4JAS (4527)

EPISODE #120 - I recall my night of stress as MSNBC.com's outage causes my homepage to break, I drill down into a fantasy football segment I'm developing for TV and the idiosyncracies involved, and I wonder why Natasha Bedingfield has an alternate version of her video for "These Words" running on MTV on VH-1.

Topics Discussed:

  • MSNBC.com's 3-hour downtime kills my homepage via the imported XML that runs my national news module
  • Trying to explain the finer points of fantasy football to a room of traditional MSM people can be a real bitch
  • Why did Natasha Bedingfield have to recut her video?

Subscribe to my podcast

Posted: Sep 29 2005, 09:27 AM by guam-aspdev | with no comments
Filed under:
Digital Pontification: Podcast Show Notes - September 27, 2005

Download this podcast

Leave me a voicemail, send me a shoutout, or make comments about today's podcast: 1-206-600-4JAS (4527)

EPISODE #119 - I'm back in the office and back with tech bits for you to consider.  I totally luck out, discovering that the cup holder device that holds my iPod Mini perfectly holds my cell phone, so I've got my own digital theater (albeit streaming video on a 3"-x-2" screen with choppy audio.  But hell, it works, right?  Plus, I give you a little teaser about the new business plan I'm working on to develop KUAM's new broadband channel.

Topics Discussed:

Subscribe to my podcast

Posted: Sep 27 2005, 10:19 AM by guam-aspdev | with 176 comment(s)
Filed under:
Is a blog without an RSS feed *really* a blog?

I just now had a very Scoble-ian thought: can a blog without an RSS feed to which people can subscribe really be considered a blog?  I've been discovering several sites lately that claim to have blogs, and they pretty much hit the mark in terms of features indicative of the medium (reverse chronoligical posts, categorized/hierarchial sorting, contact info, etc.), but no RSS feed. 

It's a real bitch when an interesting site with enough posts to captivate my attention can't be locked into my newsreader. 

Posted: Sep 26 2005, 04:21 PM by guam-aspdev | with 6 comment(s)
Filed under:
Generating maps dynamically with Google Maps and ASP.NET 1.x

I spent part of the weekend tapping the Google Maps API, developing a custom ASP.NET 1.x app that pinpoints some of the more memorable locations during my brief residency in Seattle (see my sample here).  Bill Pierce created a .NET custom server control to use Google Maps in ASP.NET 1.x, which basically acts as a wrapper for the public API so that you can use server-side event handlers that automatically generate client-side code that display a map.  Bill's process really makes the effort easy. 

But if you'd prefer to be like me and do things the manual way, the hard part of the process is working with the necessary client-side code, passing in arguments that generates maps dynamically.  I'm assuming that if you're using a platform like PHP, ASP/ASP.NET or JSP with Google Maps, you're working with scripting code to generate maps on-the-fly.  I've found that assembling a long string containing all the client-side JavaScript in a server-side StringBuilder object and calling Page.RegisterClientScriptBlock(), passing an abstract script block name and the StringBuilder object works best for generating dynamic maps.  Passing in the latitudes/longitudes for a map if extracting such data from a database or XML file gets tricky if it's all hard-coded within the page, so I prefer writing out such values within server-side events in a code-behind class and then spitting this out on the page. 

The neat thing about RegisterClientScriptBlock() is that the JavaScript generated gets written within the page immediately after the opening server-side <FORM> tag, ensuring that the internal reference made to the map control (Google recommends placing a map in a <DIV>) can be referenced easily in DOM-like fashion.  I pull this off in a helper method, into which I pass the latitude, longitude, address and other data.  In this instance, I'd pass it data to point to Microsoft's Redmond headquarters - to generate the following client-side code:

<script type="text/javascript">
//<![CDATA[
if(GBrowserIsCompatible()) {
function ShowMap() {
var map = new GMap(document.getElementById("map"));

// DEFAULT LOCATION
var point = new GPoint(-85.144740, 41.092104)
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(point,2);

// ADD PUSHPIN
var edo = new GPoint(-85.144740, 41.092104);
var marker = new GMarker(point);
map.addOverlay(marker);

// ADD LISTENER EVENT TO HANDLE --CLICK-- EVENT
GEvent.addListener(marker,"click",function() {
marker.openInfoWindowHtml("<b>Microsoft</b><br/><font size='2'>1 Microsoft Way</font><br/><font size='1'>Redmond, 98052</font>");
});}
}

//]]>
</script>

<div id="map" style="width: 600px; height: 400px"></div>

...I call this helper method in my code-behind class.

private void WriteGoogleMapsClientSideCode(string lng, string lat,string address)
{
            StringBuilder sb = new StringBuilder();
            sb.Append("<script type=\"text/javascript\">\n\t//<![CDATA[\n\t\t");
            sb.Append("if(GBrowserIsCompatible()) {\n\t\tfunction ShowMap() {\n\t\t\tvar map = new GMap(document.getElementById(\"map\"));\n\n\t\t\t");
            sb.Append("// DEFAULT LOCATION\n\t\t\tvar point = new GPoint(" + lng + ", " + lat + ")\n\t\t\tmap.addControl(new GLargeMapControl());\n\t\t\tmap.addControl(new GMapTypeControl());\n\t\t\tmap.centerAndZoom(point,2);\n\n\t\t\t");
            sb.Append("// ADD PUSHPIN\n\t\t\tvar edo = new GPoint(" + lng + ", " + lat + ");\n\t\t\tvar marker = new GMarker(point);\n\t\t\tmap.addOverlay(marker);\n\n\t\t\t");         
            sb.Append("// ADD LISTENER EVENT TO HANDLE --CLICK-- EVENT\n\t\t\tGEvent.addListener(marker,\"click\",function() {\n\t\t\tmarker.openInfoWindowHtml(\"" + address + "\");\n\t\t});");
            sb.Append("}\n\t}\n\n\t//]]>\n\t</script>");
           
            if(!this.IsClientScriptBlockRegistered("GoogleMapClientCode"))
            {
                this.Page.RegisterClientScriptBlock("GoogleMapClientCode",sb.ToString());
            }
}

It's actually quite easy to generate dynamic maps in Google Maps using ASP.NET.  Good luck in your own projects!

Neat little CSV with US/territorial zip & area codes

Bill Bercik has a nice little Ajax programming tutorial in PHP for dynamically displaying city names and area codes after a user specifices a zip code.  The key component of the downloadable source code is a CSV that contains nearly 42,800 zip codes and area codes for U.S. cities and cities within U.S. territories, which can be easily imported into a database.  It's a great source for data if you're developing apps or utilities involving geocoding.

You can download the tutorial containing the CSV here: http://www.webpasties.com/xmlHttpRequest/complete.zip

Thanks Bill!

 

More Posts Next page »