Thursday, June 2, 2011

Blog Post: Loading GeoRSS-Feeds with Dynamic Modules in the Bing Maps AJAX Control v7

Introduction

In May several Updates have been released to the Bing Maps AJAX Control v7 which Keith Kinnan has summarized here. Possibly the most significant one is the ability to dynamically load additional modules.

When the Bing Maps AJAX Control had been re-written for v7 some of the design goals had been to improve performance and to support mobile devices. In order to achieve these goals the Bing Maps AJAX control supports now HTML5 and it was also put on a diet in order to slim down to a size that can load quickly even on mobile devices. As a consequence the core-control itself supports only the minimum requirements that most mapping sites will have. However, the control was designed in such a way that additional modules can be optionally and dynamically added later on when needed. The general principal is explained in the SDK and in the interactive SDK you will find an example that implements client-side clustering. This module for client-side clustering adds about 14kB to the weight of the website and while it is a useful feature for some not everybody might need it and therefore it seems to be a good idea to stick it into a module and let the developer decide if and when he needs it.

Another feature that may be helpful for some is the ability to import GeoRSS-feeds. In this blog-post we will have a look at the steps to create such a custom module and load it on demand. To limit the amount of code for this blog-post we parse only GeoRSS-feeds following the Simple serialization. However a similar approach could be used to parse GeoRSS-feeds derived from GML as well as GPX- or KML-files.

GeoRSS-Feed

A GeoRSS-feed following the Simple serialization contains tags and to describe points (<georss:point>), lines (<georss:line>) and polygons (<georss:polygon>) as a sequence of latitudes and longitudes. The example below is a GeoRSS-feed that contains a polygon representing the Microsoft Office in London, a point representing the nearest underground station and a line representing the walk from the tube station to the Microsoft Office.

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:georss="
http://www.georss.org/georss" version="2.0">
  <channel>
    <title>Microsoft London</title>
    <link>
http://www.bing.com/maps</link>
    <description />
    <language>en-gb</language>
    <item>
      <title>Microsoft</title>
      <link>
http://www.bing.com/maps/?cid=42E1F70205EC8A96!14501</link>
      <description>Cardinal Place, 100 Victoria Street, London, SW1E 5JL</description>
      <guid isPermaLink="false">e7aea3b0d2e1c7b8</guid>
      <pubDate>Fri May 27 22:37:13 UTC 0100 2011</pubDate>
      <georss:polygon>51.49673999638715 -0.14145107778161137 51.496997150067386 -0.1394555142745313 51.49772184808794 -0.1397022775039014 51.497568226428456 -0.1408288052901563 51.49676003438838 -0.1414403489455518 51.49673999638715 -0.14145107778161137</georss:polygon>
    </item>
    <item>
      <title>Victoria</title>
      <link>
http://www.bing.com/maps/?cid=42E1F70205EC8A96!14501</link>
      <description>Underground Station</description>
        <guid isPermaLink="false">b03dc79bd7bdb81e</guid>
      <pubDate>Fri May 27 22:37:39 UTC 0100 2011</pubDate>
      <georss:point>51.49644610469038 -0.14391334565724278</georss:point>
    </item>
    <item>
      <title>Walk from Victoria to Cardinal Place</title>
      <link>
http://www.bing.com/maps/?cid=42E1F70205EC8A96!14501</link>
      <description>180m</description>
      <guid isPermaLink="false">bf8ee4e437813477</guid>
      <pubDate>Fri May 27 22:38:24 UTC 0100 2011</pubDate>
      <georss:line>51.496643145923684 -0.14391334565724278 51.496506219055234 -0.14225574048603917 51.49657969206017 -0.1415208152159586 51.4967199583771 -0.14146180661763097</georss:line>
    </item>
  </channel>
</rss>

We will use the location tags to draw points, lines and polygons and the text within the title and description tags as content for the InfoBox that pops up when we click on the object.

The Website

On the website we have a simple map and add a text-box to enter the path to the GeoRSS-feed as well as a button to load the module and import the GeoRSS-feed.

01

The code so far is shown below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="
http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
    <script type="text/javascript">
        var map = null;
        var MM = Microsoft.Maps;

        function GetMap() {
            var options = { credentials: "YOUR BING MAPS KEY",
                            enableClickableLogo: false,
                            enableSearchLogo: false,
                            mapTypeId: Microsoft.Maps.MapTypeId.road,
                            center: new MM.Location(51.4611794944098, -0.9259434789419174),
                            zoom:17 };
                        map = new MM.Map(document.getElementById('mapDiv'), options);
        }
      </script>
</head>
<body onload="GetMap();">
    <div id='mapDiv' style='position:relative; width:800px; height:600px;'></div><br />
    <a>GeoRSS-Feed</a><input id="txtGeoRSS" type="text" value="MSFT_London.xml" />
    <input id="Button2" type="button" value="Import" onclick="LoadModule()" />
</body>
</html>

We add now to the website a function to register and dynamically load an additional module. To register the module we give it a unique name and point to the location of the JavaScript that contains the module. When we load the module we can optionally specify a callback-function that is being executed when the loading is completed.

function LoadModule(){
    // Register and load a new module
    MM.registerModule("GeoRSSModule", "./GeoRSSModule.js");
    MM.loadModule("GeoRSSModule", { callback: ModuleLoaded });
}

The Module

The module is a basically a separate JavaScript-file that we can register on demand in our website and that can make use of the namespace Microsoft.Maps. In this module we start by defining the style of lines and polygons.

function GeoRSSModule(map) {
    var myFillColor = new Microsoft.Maps.Color(100,255,165,0);
    var myStrokeColor = new Microsoft.Maps.Color(200,255,165,0);
    var myStrokeThickness = 5;

    var myPolygonOptions={fillColor: myFillColor,
                         strokeColor: myStrokeColor,
                         strokeThickness: myStrokeThickness};
    var myPolylineOptions={strokeColor: myStrokeColor,
                           strokeThickness: myStrokeThickness};

Next we extend the Pushpin, Polyline and Polygon classes in the namespace Microsoft.Maps with properties that can hold the title and description for these objects. For Polylines and Polygons we also add properties that can hold the position where we want the InfoBox to appear.

Microsoft.Maps.Pushpin.prototype.title = null;
Microsoft.Maps.Pushpin.prototype.description = null;
Microsoft.Maps.Polyline.prototype.title = null;
Microsoft.Maps.Polyline.prototype.description = null;
Microsoft.Maps.Polyline.prototype.anchorLat = null;
Microsoft.Maps.Polyline.prototype.anchorLon = null;
Microsoft.Maps.Polygon.prototype.title = null;
Microsoft.Maps.Polygon.prototype.description = null;
Microsoft.Maps.Polygon.prototype.anchorLat = null;
Microsoft.Maps.Polygon.prototype.anchorLon = null;

A module can have one or more functions and for our module the main logic is implemented in the function ImportGeoRSS. Before we load the GeoRSS-feed we first remove all other entities from the map.

this.ImportGeoRSS = function (MyFeed) {
    map.entities.clear();

Next we load the GeoRSS-feed.

var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", MyFeed, false);
xmlhttp.send();
var xmlDoc = xmlhttp.responseXML;

In the following part we parse the XML-feed into objects of type Microsoft.Maps.Pushpin, Polyline and Polygon – including the additional properties that we prototyped before.

var itemCount = xmlDoc.getElementsByTagName("item").length;
var allLocs = new Array()

for (i = 0; i <= itemCount - 1; i++) {
    var childNodeCount = xmlDoc.getElementsByTagName("item")[i].childNodes.length;
    var tagName = null;
    var geomType = null;
    var geom = null;
    var myTitle = null;
    var myDesc = null;
    var anchorLat = null;
    var anchorLon = null;
    for (j = 0; j <= childNodeCount - 1; j++) {
        tagName = xmlDoc.getElementsByTagName("item")[i].childNodes[j].nodeName;
        if (tagName in { 'georss:point': '', 'georss:line': '', 'georss:polygon': '' }) {
            geomType = tagName;
            geom = xmlDoc.getElementsByTagName("item")[i].childNodes[j].childNodes[0].nodeValue;
        }
        else if (tagName == "title") {
            try {
                myTitle = xmlDoc.getElementsByTagName("item")[i].childNodes[j].childNodes[0].nodeValue;
            }
            catch (err) {
            }
        }
        else if (tagName == "description") {
            try {
                myDesc = xmlDoc.getElementsByTagName("item")[i].childNodes[j].childNodes[0].nodeValue;
            }
            catch (err) {
            }
        }
    }
    var coords = new Array();
    coords = geom.split(" ");
    var thisLocs = new Array()

    var anchorCoord = null;
    if ((coords.length/2) % 2) {
        anchorCoord = coords.length / 2-1;
    }
    else {
        anchorCoord = coords.length / 2;
    }

    for (k = 0; k <= coords.length - 1; k = k + 2) {
        var thisLoc = new Microsoft.Maps.Location(coords[k], coords[k + 1]);
        thisLocs.push(thisLoc);
        allLocs.push(thisLoc);

        if (k == anchorCoord) {
            anchorLat = coords[k];
            anchorLon = coords[k + 1];
        }
    }

    var shape = null;
    switch (geomType) {
        case "georss:point":
            shape = new Microsoft.Maps.Pushpin(thisLocs[0]);
            break;
        case "georss:line":
            shape = new Microsoft.Maps.Polyline(thisLocs, myPolylineOptions);
            shape.anchorLat = anchorLat;
            shape.anchorLon = anchorLon;
            break;
        case "georss:polygon":
            shape = new Microsoft.Maps.Polygon(thisLocs, myPolygonOptions);
            shape.anchorLat = anchorLat;
            shape.anchorLon = anchorLon;
            break;
    }
    shape.title = myTitle;
    shape.description = myDesc;

We also attach an event to the object that will show an InfoBox with further information before we add the object to the map.

    pushpinClick = Microsoft.Maps.Events.addHandler(shape, 'click', showInfoBox);
    map.entities.push(shape);
}

When all objects are added to the map we set the map-view to a zoom-level and centre-point that shows all objects.

map.setView({ bounds: Microsoft.Maps.LocationRect.fromLocations(allLocs) });
}
}

Finally we signal back to the map that the module is now loaded and trigger the execution of the callback-function.

Microsoft.Maps.moduleLoaded('GeoRSSModule');

Back to the Website

We had already prepared the website with a function to load the module but we still have to add the callback-function. In this callback-function we execute the ImportGeoRSS-function on a feed as specified in the text-box.

function ModuleLoaded() {
    // Use the function provided by the newly loaded module
    var myModule = new GeoRSSModule(map);
    myModule.ImportGeoRSS(document.getElementById("txtGeoRSS").value);
    collectionInfoBox = new MM.EntityCollection;
    map.entities.push(collectionInfoBox);
}

Finally we add some code to handle the InfoBoxes and we’re done.

02

 

The complete source of our website is listed below. To see the code in action follow this link and select “GeoRSS” under the accordion-pane “Miscellaneous”.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="
http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
    <script type="text/javascript">
        var map = null;
        var MM = Microsoft.Maps;
        var infobox = null;
        var collectionInfoBox = null;

        function GetMap() {
            var options = { credentials: "YOUR BING MAPS KEY",
                            enableClickableLogo: false,
                            enableSearchLogo: false,
                            mapTypeId: Microsoft.Maps.MapTypeId.road,
                            center: new MM.Location(51.4611794944098, -0.9259434789419174),
                            zoom:17 };
                        map = new MM.Map(document.getElementById('mapDiv'), options);

                        // Hide the info box when the map is moved.
                        MM.Events.addHandler(map, 'viewchange', hideInfobox);
        }

        function LoadModule(){
            // Register and load a new module
            MM.registerModule("GeoRSSModule", "./GeoRSSModule.js");
            MM.loadModule("GeoRSSModule", { callback: ModuleLoaded });
        }

        function ModuleLoaded() {
            // Use the function provided by the newly loaded module
            var myModule = new GeoRSSModule(map);
            myModule.ImportGeoRSS(document.getElementById("txtGeoRSS").value);
            collectionInfoBox = new MM.EntityCollection;
            map.entities.push(collectionInfoBox);
        }

        //Display InfoBox
        function showInfoBox(e) {
            if (e.targetType == "pushpin") {
                collectionInfoBox.clear();
                infobox = new MM.Infobox(e.target.getLocation(), { title: e.target.title, description: e.target.description, offset: new MM.Point(0, 30), visible: true });
                collectionInfoBox.push(infobox);
            }
            else if (e.targetType == "polygon" || e.targetType=="polyline") {
                collectionInfoBox.clear();
                infobox = new MM.Infobox(new MM.Location(e.target.anchorLat, e.target.anchorLon), { title: e.target.title, description: e.target.description, offset: new MM.Point(0, 0), visible: true });
                collectionInfoBox.push(infobox);
            }
        }

        function hideInfobox(e) {
            try {
                infobox.setOptions({ visible: false });
            }
            catch (err) {
            }
        }
      </script>
</head>
<body onload="GetMap();">
    <div id='mapDiv' style='position:relative; width:800px; height:600px;'></div><br />
    <a>GeoRSS-Feed</a><input id="txtGeoRSS" type="text" value="MSFT_London.xml" />
    <input id="Button2" type="button" value="Import" onclick="LoadModule()" />
</body>
</html>

Tip: Importing Bing Maps Collections in your own Website

On the Bing Maps consumer site you can create your own collections. If you wanted to use such a collection in your own websites you can simply use the “My Places Editor” to export to GeoRSS and then use the module above to import it.

03

Source: http://www.bing.com/community/Site_Blogs/b/maps/archive/2011/05/29/loading-georss-feeds-with-dynamic-modules-in-the-bing-maps-ajax-control-v7.aspx

MOTOROLA MOODYS MISCROSOFT OFFICE MICROSOFT MICROSEMI

Blog Post: Fun family reunion destinations

Is a family reunion in your travel plans this summer? Talk about a challenging trip to plan: You have to find a place that satisfies multiple generations and multiple interests. The kids want a pool and horseback riding; the adults want great food and a spa. Grandma and grandpa want sightseeing -- the list goes on. Pauline Frommer, a regular contributor to Bing Travel, has created a slide show that will give reunion planners some great options around the country that will satisfy even the pickiest family members. From dude ranches to Disney World, these destinations sometimes even have a special reunion coordinator to help organize activities and accommodations for large groups. See her top 12 choices in the new slide show Fun Family Reunion Destinations, now live on Bing Travel.

What’s the best reunion resort you've visited or trip you’ve taken? Leave a comment below.

Source: http://www.bing.com/community/Site_Blogs/b/travel/archive/2011/05/27/fun-family-reunion-destinations.aspx

ADVANCED SEMICONDUCTOR ENGINEERING ALLIANCE DATA SYSTEMS ALLTEL AMAZONCOM AMERICA MOVIL

Wednesday, June 1, 2011

GarageBand and iMovie for iPad updated

The iPad versions of GarageBand and iMovie have been updated today. GarageBand for iPad has been updated to version 1.0.1 and contains the following new features and fixes:

  • Support for audio output over AirPlay, Bluetooth devices and HDMI with the Apple Digital AV Adapter
  • Import of AIFF, WAV, CAF audio files and Apple Loops (16 bit, 44.1 kHz)
  • Allows copy and paste of audio from supported apps into GarageBand
  • Addresses occurrences of GarageBand freezing while playing Smart Instruments
  • Improves overall stability and addresses a number of minor issues

A support document for GarageBand 1.0.1 notes now the new audio copy/paste function works:

"You can paste an audio file from an app that supports copying audio to the clipboard. GarageBand for iPad supports uncompressed audio files with a sample rate of 44.1 kHz and 16-bit depth (the standard for audio CDs). Audio files copied from another app can be pasted to Audio Recorder or Guitar amp tracks."

iMovie for iPad/iPhone has been updated to version 1.2.1 and includes:

  • Audio plays from your HDTV when using the Apple Digital AV Adapter
  • Video plays full screen from Marquee to your HDTV when using the Apple Digital AV Adapter
  • Resolves some cases of missing media in projects
  • Provides more accurate clip grouping by date in Video browser
  • Fixes an issue where a project's background music would not fade in or out
  • Additional performance and reliability improvements

Both updates are free to existing users and available now on the App Store. Note that these updates may not show up for you if you search for them from the Apps tab in your iTunes sidebar -- Apple's two App Stores appear to be having flaky issues with updates today -- but the updated versions do show up on each app's page, and you can download the updates for free from there.

GarageBand and iMovie for iPad updated originally appeared on TUAW on Wed, 01 Jun 2011 18:05:00 EST. Please see our terms for use of feeds.

Source | Permalink | Email this | Comments

Source: http://www.tuaw.com/2011/06/01/garageband-and-imovie-for-ipad-updated/

QUANTA COMPUTER RESEARCH IN MOTION ROGERS COMMUNICATIONS SAIC SATYAM COMPUTER SERVICES

Major Beer Makers Are Suffering While The Craft Brewers Are Becoming Kings


george washington beer

The beer-making industry is generally characterized by steady and predictable growth, yet this year major brewers have had a tough time meeting expectations so far. The sector has been slow to recover in the wake of the financial crisis. In the first quarter, three of the four major U.S. beer-makers failed to meet their target earnings per share.

Leading the market in craft brews for years, Boston Beer Company (NYSE:SAM) has had a particularly tough time. Their estimated EPS was $0.45, yet the company only managed an EPS of $0.28. Part of the problem for Boston Beer might be that the demand for craft beers may have declined in favor of more affordable and recognizable brands, such as Budweiser (NYSE:BUD).

In spite of the disappointing first quarter EPS of its competitors — Anheuser-Busch InBev (NYSE:BUD), Molson Coors Brewing (NYSE:TAP), and Boston Beer (NYSE:SAM) — Constellation Brands (NYSE:STZ) beat estimates. Constellation differs from other companies, however, in that they produce wine and spirits as well as beer. In addition to the trend of consumers opting for Budweiser over say Dogfish Head, beer drinkers also seem to be preferring smaller brews to national giants, as evidenced by the success of Craft Brewers Alliance (NASDAQ:HOOK), for which revenue rose 18% and shipments increased 15% in the first quarter.

This post originally appeared at Wall St. Cheat Sheet.

For the latest investing news, visit Money Game. Follow us on Twitter and Facebook.

Join the conversation about this story »

See Also:



Source: http://feedproxy.google.com/~r/businessinsider/~3/SKzygwO9RxE/beer-sales-indicate-americans-are-staying-more-sober-2011-5

FORMFACTOR FISERV FIRST SOLAR FINISAR FEI COMPANY

TripAdvisor app for Windows Phone 7 now available

tripadvisor windows phone 7TripAdvisor, the popular travel planning tool, has just launched an app for Windows Phone 7. Just like the mobile website, the app allows you to search for anything travel-related -- from hotels and flights to restaurants and points-of-interest to visit once you reach your destination.

Geolocation is supported, which allows TripAdvisor to quickly locate places nearby. But while that's a neat feature, it's also a bit of a downer -- because, really, it's about the only feature TripAdvisor for WP7 brings to the table that its mobile Web app doesn't already offer (its browser-based geolocation doesn't work with WP7 at the moment).

While it's nice to see Windows Phone 7 users getting some big-name apps, it'd be even nicer if we saw some packing a bit more swagger.

Still, TripAdvisor for WP7 might just be worth installing on your device if you're frequently on the go -- at least until a better browser arrives with the Mango update.

TripAdvisor app for Windows Phone 7 now available originally appeared on Download Squad on Tue, 05 Apr 2011 09:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

Source: http://downloadsquad.switched.com/2011/04/05/tripadvisor-app-for-windows-phone-7-now-available/

RF MICRO DEVICES RED HAT RADISYS RACKABLE SYSTEMS QUEST SOFTWARE

Auslogics Disk Defrag 3.2 gets smarter, faster

auslogics defrag
Auslogics Disk Defrag has been part of my system maintenance toolkit for quite some time. With the release of version 3.2, it's now even better at tidying up and optimizing your system's hard disk drives. In addition to a cleaner, easier-to-use interface, Disk Defrag 3.2 offers improved single file and folder defragging, better processing of multiple disks, a simplified scheduling screen, and more informative tool tips. Auslogics has also fine-tuned the program's defragmentation and file consolidation algorithms.

For laptop users, there's a new option to lock the program if your system is running on battery power -- so scheduled operations don't kick in and drain your power source at an inopportune moment. If you happen to have an SSD installed in your PC, you can head to the Disk Defrag options and exclude it from scanning (many think that defragmenting an SSD is a very bad idea).

Auslogics Disk Defrag is a free download and works with most versions of Windows.

Auslogics Disk Defrag 3.2 gets smarter, faster originally appeared on Download Squad on Mon, 11 Apr 2011 11:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

Source: http://downloadsquad.switched.com/2011/04/11/auslogics-disk-defrag-3-2-gets-smarter-faster/

MICROS SYSTEMS MICRON TECHNOLOGY MICROCHIP TECHNOLOGY METHODE ELECTRONICS MENTOR GRAPHICS

Facebook launches unified mobile site, announces 250 million mobile users

Facebook has announced that its two mobile sites -- m.facebook.com and touch.facebook.com -- have been unified, bringing a simpler mobile experience to Facebook users. And there are a lot of those -- a quarter billion, according to Facebook.

Smartphone users won't be losing any functionality because of the consolidation. If your phone supported the enhacned features offered by touch.facebook.com, the new site will automatically flip the switch when you visit.

Rolling the sites together helps simplify things for Facebook's developer team. Now changes can be pushed to a single site instead of two separate sites, which makes it easier to ensure that all mobile users receive a nearly identical experience regardless of the device they're using.

The new Facebook mobile can also check to see if your phone supports geolocation. If it doesn't, you won't be seeing much of Facebook Places -- which obviously relies heavily on geolocation. Images can also be optimized on the fly to keep page performance from suffering on less powerful devices. You can see the three different versions of the share button below, courtesy our friends at TechCrunch.

Facebook launches unified mobile site, announces 250 million mobile users originally appeared on Download Squad on Fri, 01 Apr 2011 10:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

Source: http://downloadsquad.switched.com/2011/04/01/facebook-launches-unified-mobile-site-announces-250-million-mob/

EPICOR SOFTWARE EMULEX EMS TECHNOLOGIES EMC ELECTRONICS FOR IMAGING