How I Made the Cloud Thing

I’ve already been asked several times how I did the floating cloud bit in the header, so here it goes. Fair warning: if you were expecting some miraculous bit of coding here you’re going to be sorely disappointed.

First, I’m using jQuery for this, so stick a reference to the Google CDN in your head.


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">

</script>

Happy cloud is happy.

Next, you need an image to go blundering about on your web page. If you don’t want it to obscure the page underneath it, you’re going to have to do some creative transparency. Here I made a cloud with a radial shading so the edges are less transparent than the middle. But you could use or make anything you want here. I used and recommend Inkscape if you don’t have a favorite vector graphics editor yet.

We’re going to use the image as a background to a div, which you should stick in whatever container div you want the image to roam around in, probably at the bottom. I stuck it in a div creatively named “page-head”.


<div id="cloud"></div>

Now let’s style that div a bit.


/* moving image */
#cloud {
position: relative;
top: 10px;
left: 0;
width: 299px;
height: 173px;
background: transparent url(img/cloud.png) no-repeat scroll 0 0;
}

Nothing special here. Use the top property to move the image up or down to where you want it. Note I’m setting the left property even though I’m starting it the default (0). This is important as you’ll see in a minute.

Now on to the JavaScript.


$(document).ready(function() {
animateCloud();
});

function animateCloud() {
$("#cloud").animate({
'left':  $("#page-head").width() - $("#cloud").width() - parseInt($("#cloud").css("left")) }, 50000, 'linear', function() {            animateCloud();        });
}

When the page is ready, we call the animateCloud function. From there we’re running a jQuery animation where we change the left property of the could by the container width – the width of the cloud image – the current left property of the image. So when the image is at the starting position, we get the width of the container – the width of the cloud div, since the starting left property of the cloud is 0. This is why we had to specify the position even though it’s 0 – if you didn’t, jQuery would return a NaN for this value. So the image goes across the screen over the course of 50 seconds (50000ms), and when it gets to the end it calls itself again. This time we set the left to 0, since container width – cloud div width – cloud div left property will equal 0. Back it moves, calls itself, ad nauseam.

Told you you’d be disappointed.

No Comments »

News Roundup – Geodesign, ArcGIS 9.4 Goes to 10, Haiti Disaster Response

What follows is notable news and happenings that I want to purge from my bookmarks folder. It will be a combination of things you already know spiced with things you probably won’t care about. I apologize in advance.

First up is geodesign, which has had an ESRI summit and a brand new Wikipedia entry. What is geodesign you ask?

Geodesign is a set of techniques and enabling technologies for planning built and natural environments in an integrated process, including project conceptualization, analysis, design specification, stakeholder participation and collaboration, design creation, simulation, and evaluation (among other stages). “Geodesign is a design and planning method which tightly couples the creation of design proposals with impact simulations informed by geographic contexts.”

So it’s….basically all the stuff we’ve been doing for years. GIS as a field tends to have random taxonomy/nomenclature fluctuations. Remember when we become geospatial people instead of geographic people? Did it change your life? Neither will this. Moving on.

As was widely reported, ArcGIS 9.4 has been re-branded as ArcGIS 10. The big changes here are the merging of ArcCatalog and ArcMap (ArcCataMap?) and, like it or love it, the adoption of the MS Office ribbon interface. That’s enough for a major version number change in my book.

Haiti dominated the news this month, and there are a couple of projects helping out that I want to highlight.  In particular, check out what people did on OSM in just a few short days.

Hats off to everybody that worked around the clock to update that area. Via Red Hat’s new opensource.com, a couple of other great FOSS projects that have been helping out in Haiti are Ushahidi and CrisisCamp. Proprietary vendors have historically been very gracious in putting aside licensing and cost concerns during crises, but it’s always quicker when those things aren’t an issue at all.

On the browser front, Chrome passed Safari and is the #3 browser on the web. I never thought I’d see the day I’d use something other than Firefox as my main browser, but I’ve been using Chrome 90% of the time lately. It’s significantly faster, generally stable, and now that the extension ecosystem has taken off I find myself opening Firefox less and less. Sigh. I think Chrome is helping Firefox get out of a rut though. Since it came out Firefox has sped up significantly, and now they’re moving to rolling release schedule to push out improvements more quickly.

A couple of interesting developments in the FOSS world this month. California is taking steps to define and encourage open source software use in government. From what I can tell it looks like what I consider the best policy – to put FOSS on the same level as proprietary solutions, not grant it special favoritism. There was an interesting story from New Zealand this month about a school that went almost completely open source (some virtualized Windows desktops are still there). As tight as school budgets are I’ve never understood how that happens so infrequently.

Via Slashdot, the map of the month goes to the New York Time’s interactive map of Netflix queues by neighborhood. Check it out now before the news industry points a paywall gun at its head and kills itself.

And finally, as both a Linux geek and a remarkably unaccomplished guitarist, I couldn’t pass this up without a mention. Behold – the Gentoo guitar!

Can I has? Pleaseeeeee?

No Comments »

TED Talk: Geomedicine

TED Talks has a good presentation by Bill Davenhall titled Your health depends on where you live. It’s an interesting talk on the new science of geomedicine (so new I couldn’t find geomedicine on Wikipedia). This must be why Dr. House orders his staff to do so many home invasions.

No Comments »

Internet Explorer Aurora Exploit in the Wild

Score!

I’m happy to note that according to Google Analytics only 28% of you are using Internet Explorer. My hat’s off to 72% of you. If you are in that other 28%, however, unless you like your personal data compromised or you want to feel the thrill of having your PC ride in a botnet herd, use it to download Chrome or Firefox or Opera or Safari or whatever and don’t open it again until Microsoft gets out a patch for the Aurora exploit.

If you’ve read the hubub about China hacking into Google to go after dissidents and others in recent days, you may have heard that IE was a primary attack vector. The exploit is now in the wild and was added to Metasploit, an open source security testing framework that is a ton of fun to play with at wifi hotspots (so I’ve heard) but can otherwise be used to ruin your whole day. This video should send chills down your spine:

No social engineering hacks required. Just clicking on a link can compromise your system. Reports are indicating that all versions of IE, 6 to 8, are affected.

If you think I’m being over-reactionary or that my anti-Microsoft bias is shining through, note that Germany has recommended everyone stop using Internet Explorer immediately and over 20 other tech companies have been hacked. Right now there is no patch from Microsoft.

Hopefully by the time you read this Microsoft will have a patch out, but if that isn’t the case, don’t click on the big blue E unless it’s to download a different browser.

*Edit: France has now joined Germany in advising its people to stop using Internet Explorer until there’s a fix.

1 Comment »

Make Smarter – Apache Lucene and Solr, iPhone Development, GIS Intro

First up in this month’s Make Smarter is a Location-aware search with Apache Lucene and Solr, courtesy of IBM. Lucene is high performance text search engine, Solr is a search platform using Lucene, and they are both open source projects from Apache. Lucene recently added some basic geospatial functionality. By basic we’re talking point features only (XY) and bounding box and distance searches round out the functionality, but the big thing here is speed and search engine integration. It’s a really information article and shows a glimpse at where spatial tech is going.

Via Ars, Stanford has updated their iPhone development course to cover the latest 3.1 SDK. If you’re looking to develop iPhone apps, this course has received very good reviews and last year’s course was downloaded over 4 million times. The only downer is you’ll need iTunes to get the content at Stanford at iTunes U. Mayhaps I can find a torrent…

I’m a big fan and user of Inkscape, and Máirín Duffy is posting the course contents of an 8 session Inkscape course she’s teaching at a Boston middle school. The 1st and 2nd class notes are out there now, with more to come. It’s a very good introduction Inkscape so far, and since I tend to jump into software in the middle it’s helping me learn a lot of stuff I skipped by. Once you’ve gotten comfortable with Inkscape, check out some of the tutorials at Screencasters.HeathenX.Org.

GIS Lounge highlighted A Gentle Introduction to GIS (PDF), a free 114 page ebook aimed at educators and people new to the field and utilizing QGIS. It’s not only a great introduction to the field and key concepts like rasters, vectors, and topology, by using QGIS it lets newcomers do the things they’re learning about at now cost. It’s a great resource and a high quality book. You can find videos, worksheets, and sample data to complement the book at the QGIS site.

If you’re a Flex developer, InfoQ has a good article on the state of the Flex development ecosystem. It’s more or less a long list of Flex resources, from IDE’s to application frameworks.

Finally, via Between the Poles, all the FOSS4G presentations and videos are now online. Links for presentations and videos can be found in the workshop and session abstracts.

2 Comments »