Archive

Unknown Code Ramblings

I guess there is a library somewhere to do this, but I couldn’t find it fast enough so I spit this contraption out. It’s a function that grabs the value from a URI/URL query string. Yes, writing those nasty REGEXs about drove me nuts! ;) Maybe I can save at least one soul out there some trouble. If you see an enhancement option or have ideas, please comment and let me know!

function GiveMeTheQueryStringParameterValue(parameterName) {
    parameterName = parameterName.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + parameterName + "=([^&#]*)");
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}

HTML5 is a collect of individual features, that currently are either supported or not by the current array of browsers. The best approach I’ve found at this time, is to write for HTML5 and use other tools to downgrade graceful.

The following are some detection techniques that are in use today:

Input Types: HTML5 defines over a dozen new input types for use in web forms. For determining which of these new form elements is supported use the following code, per element (yes I know, that’s a pain in the ass, but you gotta do what you gotta do)

var input = document.createElement("input");
input.setAttribute("type", "color");
return i.type !== "text";

Aha, but if you don’t want to write these input checks, Modernizr has a hash it builds to detect all of the new input types.

if (!Modernizr.inputtypes.date) {
	// ?? <- See example of this.
}

Video Formats: Video formats, or codecs, is the algorithm which is used to encode video. Checking if a video element object has the canPlayType for a particular codec will determine support.

function supports_video() {
    return !!document.createElement('video').canPlayType;
}

Again Modernizr can make this detection much simpler.

if (Modernizr.video) {
	if (Modernizr.video.ogg) {

	} else if (Modernizr.video.h264) {
		// H.264
	}
}

Canvas: The canvas element is a resolution independent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images on the fly. To check for canvas attempt to create a canvas element on the document object and retrieve the context. Context dictates if there is or is not context support.

function supports_canvas() {
	return !!document.createElement('canvas').getContext;
}

Of course, there is a Modernizr Function to determine support too.

if (Modernizr.canvastext) {
	// let's draw some text!
} else {
	// no native canvas text support available
}

Geolocation: Geolocation is the function of determining where you are by using the UP address, wireless network connection, cell tower, GPS software, or other device. The Geolocation Working Group is actually working on this feature, not particularly the HTML5 Working Group, but the feature is closely correlated to the entire HTM5 spec and is currently being integrated into most browsers.

The code snippet below can be used to determine if geolocation is available.

function supports_geolocation() {
	return !!navigator.geolocation;
}

If you don’t want to write this particular function, you could also use the Modernizer Library.

if (Modernizr.geolocation) {
	// process the location...
} else {
	// no native geolocation support, so start hacking!
}

Just some quick awesome things that were shown at OS Bridge today during some of the sessions. I went and checked out @aaronpk‘s Session on automation. Here’s some of the videos he has put together of his work he’s done (I did notice that there’s some @caseorganic rocking the geo games too though).

GPS Data Timelapse Eugene June 2008 – September 2009 from aaronpk on Vimeo.

GPS Timelapse of Portland – Oct 2009 thru June 2010 from aaronpk on Vimeo.

MapAttack at WhereCamp 2011 from aaronpk on Vimeo.

Keynote: Hacking for Freedom

(Description of Hacking for Freedom)

Day #1 has kicked off with a bang. A keynote that really pulled at the heart strings for the love of freedom and liberty! The notion of technology being involved directly to those pushing for their freedom. Below I’ve snagged a part of the description:

Description

A first-hand talk about the politics, technology and ethics of hacktivism. I’ll give an overview of some of the active groups, including Anonymous and Telecomix and discuss some of the projects I’ve worked on in the past few months. See this blog post and video of lightning talk from Pycon.

  • organizing protests in support of WikiLeaks and freedom information. Over one hundred cities in two weeks.
  • supporting communications in the Middle East: working 20 hours / day for a week for Egypt without dying
  • When the Net is up: proxies, mirrors, VPNs, encryption, retweeting
  • When the Net is down: dialup modem pools, fax blasts, ham radio
  • Works in Progress: two-way radio HOWTOs, Intranet LiveCDs

This keynote really made me realize I’ve gotten disconnected from a lot of things that pulled me into technology. The connected aspirations of people to change the world for the better is massive. The efforts that are going on around the world were described well by Peter Fein. Putting emphasis on the importance of having cell phones that can take video and get the word out when a regime is getting out of control. Having this immediate communication to call out the evil in the world has grown exponentially.

Peter Fein

Peter Fein

To learn more about what Peter Fein (@petewearspants) is up to and learn more about hacking for freedom check out Anonymous and Telecomix.  Also be sure to check out his blog at http://i.wearpants.org/.

Cloud Scaling: High Performance Even in Virtualized Environments

(Description of Cloud Scaling: High Performance Even in Virtualized Environments)

After the keynote I attended the Cloud Scaling Session by Gavin McQuillan (@gmcquillan) who works at Urban Airship and blogs at Omnifarious.

Gavin spoke about how to design an architecture, primarily using Amazon Web Services, to build for scalability and uptime. Some of the main take home points I tweeted:

Adron HallThe ongoing problem with the cloud is high volume/throughput/iops w/ storage. < Is there a pending solution? #osb11 #aws
Adron Hall#osb11 Only get ~10G of true local storage? <- me: why are you depending heavily on this? Use S3, SimpleDB, or other?
to which I received a follow up…
Vanessa Alvarez@adronbh interested in the answer to that, if anyone dares
Vanessa Alvarez@adronbh yes, would agree on #EMC #Isilon, still kind of hard and expensive;-)
…to which I ponder also, who is working on a legitimate price conscious, reasonable, high volume and high throughput storage medium that can be utilized via cloud computing?
All that and tons more, before lunch. :) Stay tuned for more coverage of the OS Bridge Conference.  Cheers!

Windows Azure AppFabric is arguably the main feature set that truly sets Windows Azure apart from any cloud services on the market today. The AppFabric allows cloud users to hookup on-premises services to their cloud services, to secure cloud & on-premises services with new or existing security frameworks (identity based, active directory, or otherwise), cache Internet or other content, and on top of all that build out and enable composite application integration.

At the same time that Windows Azure AppFabric is one of the main features that sets Windows Azure apart from the competition, it is often one of the most misunderstood or unknown parts of the entire offering. In this chapter I’ll cover the main parts of the AppFabric including the service bus, access control, caching, integration, and patterns for integrating composite applications.

Home of Windows Azure AppFabric

The first thing to do in order to begin building with the Windows Azure AppFabric is to download the SDK, check out the various Windows Azure AppFabric Sites and familiarize yourself with what it is and how it works into the Windows Azure Platform.

The main web presence is located at http://www.microsoft.com/windowsazure/AppFabric/Overview/default.aspx

Windows Azure AppFabric Site

Windows Azure AppFabric Site

On the main site you will primarily find a marketing presence, but with links to many locations with useful architectural, development, and related technical information.  On the left hand side of the site there is a navigation bar that provides access to specific information describing the service bus, access control, and other features of the Windows Azure AppFabric.

The next major web presence that is extremely useful for Windows Azure AppFabric is the Windows Azure AppFabric Team Blob. It is located at http://blogs.msdn.com/b/windowsazureappfabric/. This site is regularly updated with development tips, patterns and practices, related MVP and Microsoft Enangelist links, updates on the SDK, CTPs, and other technical information.

The last major link that should be reviewed and checked often in relation to Windows Azure AppFabric Development is the Windows Azure AppFabric Developers’ Center located at http://msdn.microsoft.com/en-us/windowsazure/appfabric.aspx. Next to the blog, which often links to this page, this site is probably the most useful in relation to AppFabric Development. There are headlines, quick starts, and other documentation related to AppFabric Development with Ruby, Java, and other languages and technology stacks.

I don’t want to provide a direct link to the SDK. The reason is that Microsoft’s method for tracking and providing download links to SDKs, CTPs, and other related software often changes. The best way to find the current download location for the Windows Azure AppFabric SDK is to use a search engine and enter the keywords “Windows Azure AppFabric SDK” (click the link as I setup the search for you). The first links provided will get you to the current location to download the SDK & other related files discussed below.

As of the current v1.0 release of the SDK there are several downloads that are matched along with it for documentation and samples. There is also a specific WindowsAzureAppFabricSDK-x64.msi and a WindowsAzureAppFabricSDK-x86.msi.  Each of these are different and specific to the 32 or 64 bit architecture. Along with the SDK there is a v1.0 C# and Visual Basic file available for download that includes multiple examples of how Windows Azure AppFabric works. The last file that is included with the Windows Azure AppFabric download page is the WindowsAzureAppFabric.chm. This is simply a documentation file for the Windows Azure AppFabric SDK.

What Exactly is Windows Azure AppFabric?

Windows Azure AppFabric can be seen as the all encompassing fabric that interconnects on-premises solutions to Windows Azure solutions, and even Windows Azure solution to other solutions within the cloud. Windows Azure AppFabric is broken down into two main feature offerings simply called the service bus and access control. Some new features are coming online in the very near future; the main one I’ll discuss is the Windows Azure AppFabric Caching.

Windows Azure AppFabric

Windows Azure AppFabric

That’s all I have right now, and would love any feedback on things I should mention, discuss or otherwise add to this write up.  I’m thinking of using it as an intro to AppFabric in some of the pending presentations I have coming up.  So please throw in some feedback on what else you might like.  -thanks

Follow

Get every new post delivered to your Inbox.

Join 3,712 other followers