The Camera API and Geolocation Exif Data on AIR for Android

Posted by magician | Posted in Web | Posted on 19-10-2010

1

As part of my MAX session, I’ve been playing around with the camera API and wanted to pull some of the Exif data around geolocation. My first thought was that I could use the geolocation APIs in AIR to inject Exif data into the image from the camera. But the way that the AIR for Android Camera API works (which makes sense) is that when you take a picture, it creates a MediaPromise, which is a new class in AIR for Android that is similar to a FilePromise. That code includes a bunch of Exif data that Android adds. The only issue with the GPS coordinates are that they’re in sexagesimal format and need to be converted into decimal.

There are actually two ways to get images into your AIR application. The first is using the flash.media.CameraUI class. That brings up the camera controls and lets the user take a picture directly. When the user clicks “OK” on the camera, it saves the file to the SD card and then passes the file reference back to AIR where you can program an event handler to respond:

public var cameraUI:CameraUI;
 
protected function onCreationComplete():void
{
 
if(CameraUI.isSupported)
{
cameraUI = new CameraUI();
cameraUI.addEventListener(MediaEvent.COMPLETE,onComplete);
}
 
}

Then all that has to be done is to call the launch() method and that pops up the camera controls. When the user confirms the photo, the MediaEvent.COMPLETE handler deals with the photo. Or in this case, the file reference.

protected function btn_clickHandler(event:MouseEvent):void
{
cameraUI.launch(MediaType.IMAGE);
}

The other way to get access to photos is to pull them from the phone’s memory. You can do that with the flash.media.CameraRoll API. It’s a very similar process to the CameraUI. Instead of a complete event, listen for a select event, and to bring up the library of images, call the browseForImage() method.

public var cameraRoll:CameraRoll;
 
protected function onCreationComplete():void
{
if(CameraRoll.supportsBrowseForImage)
{
cameraRoll = new CameraRoll();
cameraRoll.addEventListener(MediaEvent.SELECT,onSelect);
}
}
 
protected function btn_clickHandler(event:MouseEvent):void
{
cameraRoll.browseForImage();
}

Now once the image has been taken or selected, we can pull the Exif data from it. Both the complete event and the select event will look the same because they both create a MediaPromise. I’m using the Exif library here, which uses the load() method and an event handler to deal with the Exif data when it loads.

protected function onSelect(event:MediaEvent):void
{
var request:URLRequest = new URLRequest(event.data.file.url);
var exif:ExifLoader = new ExifLoader();
exif.addEventListener(Event.COMPLETE,onExifComplete);
exif.load(request);
}

The parsing of the Exif data is pretty straightforward. Once it has been parsed, pulling out the specific tags by name for Latitude and Longitude, all that is left is to convert the sexagesimal latitude and longitude to decimal degrees.

protected function onExifComplete(event:Event):void
{
var exif:ExifInfo = event.currentTarget.exif as ExifInfo;
var gpsIfd:IFD = exif.ifds.gps;
 
// get the array of GPS coordinates from the Exif data
var exifLat:Array = gpsIfd["GPSLatitude"] as Array;
var exifLon:Array = gpsIfd["GPSLongitude"] as Array;
 
// get the decimal degrees for latitude/longitude
var latitude:Number = convertSexagesimalToDecimal(exifLat[0],exifLat[1],exifLat[2],gpsIfd["GPSLatitudeRef"]);
var longitude:Number = convertSexagesimalToDecimal(exifLon[0],exifLon[1],exifLon[2],gpsIfd["GPSLongitudeRef"]);
}
 
protected function convertSexagesimalToDecimal(degrees:int,minutes:int,seconds:Number,reference:String):Number
{
// do the conversion to decimal degrees
var decimal:Number = degrees + (minutes/60) + (seconds / 3600);
 
// figure out whether we need to use negative latitude or longitude
if(reference == "S" || reference == "E")
{
return decimal * -1;
} else {
return decimal;
}
}

So that’s a crash course in using the camera API on AIR for Android and then extracting decimal degrees out of Android’s existing Exif data.

View full post on Digital Backcountry – Ryan Stewart’s Flash Platform Blog

Charting data with Flex and PHP

Posted by magician | Posted in Web | Posted on 13-07-2010

0

This is a fairly straightforward topic but I did a quick DZone article on charting with Flex and PHP using the data-centric design wizards in Flash Builder. The wizards make it very easy to at least get the basics down and start using data in charts, and I covered some basic ways to add animations and interactivity.

I’m working on a more in-depth article with Zend that will cover grouping/sorting/etc on both the client and server side. It will provide some info on how to structure your data and make it more flexible for manipulating when it’s in the chart.

View full post on Digital Backcountry – Ryan Stewart’s Flash Platform Blog

Facebook May Share User Data With External Sites Automatically

Posted by magician | Posted in Web | Posted on 27-03-2010

0

Imagine visiting a website and finding that it already knows who you are, where you live, how old you are and who your Facebook friends are, without your ever having given it permission to access that information. If you’re logged in to Facebook and visit some as yet unnamed “pre-approved” sites around the web, those sites may soon have default access to data about your Facebook account and friends, the company announced today.

Barry Schnitt, Senior Manager, Corporate Communications and Public Policy at Facebook, told us in an email that “the right way to think about this is not like a new experience but as making the [Facebook] Connect experience even better and more seamless.” There will be new user controls made available, but this is a new experience: this makes Facebook Connect opt-out instead of opt-in.

The proposed change was first written about by Jason Kincaid on TechCrunch, who called it Facebook’s Plan To Automatically Share Your Data With Sites You Never Signed Up For.

Here’s the language Facebook used to describe the draft policy:

Pre-Approved Third-Party Websites and Applications. In order to provide you with useful social experiences off of Facebook, we occasionally need to provide General Information about you to pre-approved third party websites and applications that use Platform at the time you visit them (if you are still logged in to Facebook). Similarly, when one of your friends visits a pre-approved website or application, it will receive General Information about you so you and your friend can be connected on that website as well (if you also have an account with that website). In these cases we require these websites and applications to go through an approval process, and to enter into separate agreements designed to protect your privacy.

That sounds downright creepy. It’s nice to have one-click access to your Facebook info if you decide to share it with other sites – that’s what Facebook Connect does – but the prospect of having that information automatically shared when you show up on another website seems like an idea that won’t be well received by users. There’s a big difference between opt-in and opt-out “data portability.”

Schnitt says: “People love personalized and social experiences and that’s why Facebook and Facebook Connect have been so successful. We think there are some instances where people would benefit from this experience as soon as they arrive on a small number of trusted websites that we pre-approve.”

Shnitt is the man who told us in a previous interview about Facebook’s fundamental shift away from being private by default (Why Facebook Changed Its Privacy Strategy) that users generally go along with the company’s default privacy settings because they agree with the company’s recommendations and because the world is changing to be less private. He cited the growth of Twitter, blogging and reality TV as evidence that the world was changing this way and that people are less interested in privacy.In that interview, Schnitt also acknowledged that business reasons, like pageviews and advertising, were part of why Facebook was transforming away from privacy as well. We asked if this new opt-out Facebook Connect was the first step in a Facebook Ad Network, where your profile on Facebook is used to target ads that Facebook sells on sites all over the web. Schnitt told us, “this has absolutely nothing to do with advertising.”

Do you buy all that?

Do you trust Facebook to select trustworthy websites to automatically share your data with when you browse around the web? If you don’t trust Facebook’s judgement, you will be able to opt-out of exposing that data. But by default you’ll be sharing it.

By default, you’re sharing more and more these days, with more and more people. Perhaps that’s because of your love for Twitter and reality TV, but perhaps its because of Facebook’s cultural and commercial agenda.

Related posts:

  1. Facebook Confirms & Reconsiders Forthcoming Location Feature Facebook confirmed today that it is working on a location-based…
  2. Finally: Facebook Silences App Notification Spam Facebook is about to become a quieter, less annoying place…
  3. Facebook launches payments between friends service Social Networking site Facebook is now offering its users the…

Related posts brought to you by Yet Another Related Posts Plugin.

View full post on Web Technology Blog, Development and Social Media

How Do You Handle Data Integration in the Cloud?

Posted by magician | Posted in Web | Posted on 18-03-2010

0

At times it feels like the concept of cloud computing is as ephemeral as a towering cumulus cloud on a summer day. It passes by, changes shape and looks different to every person who views it. But like those clouds in the sky, there’s a lot of complexity out there, especially as it concerns how data is managed in a multi-tenant environment.

The issue keeps coming up. First off, there are no existing standards for moving data in the cloud. Third party vendors like CloudSwitch are providing ways to “drag and drop,” data from on-premise to a cloud environments. But there is just no standardized way to move information between cloud networks.

But there are some ways to manage the complexity. Informatica’s David Linthicum wrote a blog post yesterday on the topic. We agree with Linthicum to some extent but his declarations don’t entirely reflect the current reality.

Linthicum outlines some of the inherent issues that come with data integration in the cloud. The biggest issue comes down to the cloud computing providers. They do not provide syncing back to the customer’s on-premise environment. Linthicum points out that Salesforce.com is the exception to the rule in this regard.

So, according to Linthicum, what should the customer consider?

  • Backup: This is the first and foremost issue for Linthicum. You need to have an on-premise backup in case of cloud computing outages,cloud service providers going out of business or to prevent the headaches that can happen when the new owner of your cloud computing provider decides that it’s really not interested in that business at all.
  • Data Movement: It’s the data integration that drives processes between systems that may be in the cloud or on-premise. How do you manage all this information that may be dispersed over geographically distant platforms? It’s a different world than dealing with systems that exist in one data center.

We agree to a point but there are lots of various options to these issues. First off, it’s often a matter of what cloud computing platform you choose. The large service providers offer the safest bet. They are vested in the future of cloud computing and are developing ecosystems that consist of third-party partners. A number of these partners specialize in cloud-based application deployments.

And cloud-based security is making advances that make data loss as rare as if the data is on-premise.

Linthicum does offer some sound advice that may seem more like common sense but it is worth noting:

“First, consider the overall requirements of the business. Sounds obvious, but many who deploy cloud computing systems do not have a complete understanding of the overall business requirements.Second, focus on the holistic architecture, on-premise and cloud-delivered, including how they will and should exchange data to support the core business.

Finally, select the right data integration technology for the job, and do so only after taking everything into account. You’ll find that there are both on-premise and on-demand options, and in many instances you may have to mix and match solutions.”

There are a lot of options out there. We do not necessarily agree that the hybrid approach is the best way to go. There is no one formula. Standardizing on the cloud has its advantages.

But, still, the over riding issue is really how data passes between systems. Without standards for managing data transfer, the issues Linthicum points out will never go away.

Related posts:

  1. Cloud Computing Is Disrupting Microsoft Office 2010 and its Profit Margins Microsoft President Stephen Elop says the cloud has created a…

Related posts brought to you by Yet Another Related Posts Plugin.

View full post on Web Technology Blog, Development and Social Media

Google Opens Public Data Explorer Lab

Posted by magician | Posted in Web | Posted on 09-03-2010

0

Google looks to be following up the addition of its Google Chart Tools with a neat addition to Google Labs – the Public Data Explorer.

The purpose of the new tool, Google says on the new lab’s page, is to make “large datasets easy to explore, visualize and communicate”.

Google, with its access to an immense assortment of information, is in the perfect position to help us with ways to display this information.

Just as with the Chart Tools, Google’s Public Data Explorer will allow users to directly embed charts and other visual tools onto their websites. The charts will be dynamically created, so if the data updates, so will the chart.

Google first got into the public data game about a year ago and has been including this type of data in its search results.

Right now, there are 13 datasets available, ranging from something as specific as Education Statistics of California to World Development Indicators from the World Bank. Google has just added five new public data sources: the U.S. Center for Disease Control (think Google’s Flu Trends), the U.S. Bureau of Economic Analysis, Eurostat, the Organization for Economic Co-Operation and Development, and the California Department of Education.

There are four choices for visualization styles – bar graph, line graph, map or bubble, and each has its advantage. After choosing a visual style, you can select what data points you would like to see and set variables such as time period.

Just as with the chart tools, we look forward to seeing how useful a tool like this can be for all those smaller organizations that don’t have the resources to hire a full-time web design team, but want to visually display data to help visualize trends. This could be a great tool for smaller journalistic organizations to compete with some of the big dogs.

Related posts:

  1. Open Data Internet is huge these days and even you can tell…

Related posts brought to you by Yet Another Related Posts Plugin.

View full post on Web Technology Blog, Development and Social Media

Powered by Yahoo! Answers