Thursday, 4 June 2009

AS file to parse the Picasa Album atom feed

I've been asked so many times for the script to parse the atom feed provided by the picasa api for the album. The script I am posting here is simple and can be used to parse the feed for the album. Please feel free to change to your need.



/*
* PicasaAlbumParser.as
* File to parse Picasa album xml retrieved from http://picasaweb.google.com/data/feed/api/user/{username}
*
* Jatin Desai
* desaijatin@gmail.com
*
* File converts xml to array and each element contains album object.
* This class extracts the information needed for this project but feel free to change. This class was
* initially derived from Mike Chambers' website (parsing atom feeds)
* http://www.mikechambers.com/blog/2004/02/05/atom-feed-actionscript-2-class-alpha/
*
*/

package
{
import flash.xml.XMLDocument;
import flash.xml.XMLNode;

public class PicasaAlbumParser
{
public function PicasaAlbumParser()
{
}

public function ParseAlbumList( xml:XML ):Array
{
trace("*********************************************");
trace("PARSING ATOM FEED");
trace("*********************************************");
var result:XMLDocument = new XMLDocument();
var arAlbum:Array = new Array();

result.parseXML( xml.toXMLString() );

/* get the array of nodes withing response xml */
var nodes:Array = result.firstChild.childNodes;

for each( var node:XMLNode in nodes ) {
switch( node.nodeName )
{
/* we are only interested in entry node */
case "entry":
arAlbum.push( ParseAlbumEntries(node) );
break;
}
}

/* Return album */
return arAlbum;
}

/* Parse album entries node */
private function ParseAlbumEntries(entry:XMLNode):Object
{
var album:Object = new Object();
var nodes:Array = entry.childNodes;

for each( var node:XMLNode in nodes )
{
switch( node.nodeName )
{
case "id":
album.id = node.firstChild.nodeValue;
break;
case "title":
album.title = node.firstChild.nodeValue;
break;
case "gphoto:id":
album.albumid = node.firstChild.nodeValue;
break;
case "gphoto:name":
album.albumname = node.firstChild.nodeValue;
break;
case "gphoto:numphotos":
album.numphotos = node.firstChild.nodeValue;
break;
case "media:group":
album.media = ParseAlbumMediaGroup(node);
break;
}
}

/* return the album object */
return album;
}

private function ParseAlbumMediaGroup(entry:XMLNode):Object
{
var media:Object = new Object();
var nodes:Array = entry.childNodes;

for each( var node:XMLNode in nodes )
{
switch( node.nodeName )
{
case "media:description":
media.description = "";
if(node.firstChild != null)
media.description = node.firstChild.nodeValue;
break;
case "media:thumbnail":
media.thumbnail = node.attributes.url;
break;
case "media:content":
media.bigimage = node.attributes.url;
break;
}
}

/* Return media object */
return media;
}
}
}



Thanks,

Jatin

Thursday, 6 November 2008

IE & cfdump

 Internet Explorer crashes badly if you have to many "cfdump"



<!-- IE dump crash test -->

<cfloop index="i" from="1" to="500">

    <cfdump var="#i#">

</cfloop>

Use this test script and see the result.For the first time all worked well but then after reaching at some point my page was keep on doing the page refresh.

Internet explorer behaves randomly with too many dump scripts added by coldfusion in the source. So try avoiding the "cfdump" tag - rather than adding it once and reusing it.

Enjoy.

Sunday, 13 July 2008

Uploading File over HTTPS with FileReference

On friday I introduced myself with a very interesting problem. In one of my project at Learning assistant we wanted to use Flex application to uplaod file using secure url. It was going well untill I tested my application in Firefox. For some reason I was getting Error #2038: File I/O Error. After sometime searching for the solution on google I realised that not only me but so many people had the same issue. Some of them have suggested different solutions check this:

http://thanksmister.com/?p=59
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg58372.html
http://www.onflex.org/ted/2005/11/using-flash-player-under-https-with.php

I tried all of them but still the problem was the same. I tried sending back the jsessionid, cfid, cftoken with url request etc, but was getting the same file io error. I checked the IIS access log to see what's really happening. Whenever I was trying upload file using Fire fox, it was making two request to the file upload url, the response for the first request was fine but the immediate second request was served with http header 403... I still don't know why second request was not served? or why two requests were made?

Anyways, we discussed not to use https for the file upload still we wanted to serve the flash object through https. So we changed the upload url to send request to http rahter than https and problem was solved. But if anyone had such problem and if you got some better solution please let me know.

Jatin

Saturday, 21 June 2008

Picasa Web album Widget

Hi,

Yesterday one of my friend asked me find a small widget to display photos from his picasa album to his blog. I searched for a while but didn't like any of them and thought of creating one by myself. I quickly logged on to picasa to find the "developer api" and started working on it. After few hours of work I came up with something like this.




Features:
1) Next/Previous photos
2) Full-Screen
3) Play/pause
4) small/medium/large thumbnail view

Its in a very primary state, please try it in your own blog or website and let me know what do you think about it. If you find any errors please post it here as a comment and I will try to work on it. At the moment code is very messy, I will tidy it up and post it here. Please post a comment if you are using it in your website. Its only for my reference. You can find it here

http://desaijatin.googlepages.com/home


Add to Google

Enjoy,

Jatin

Update (26 June 2008)

Thanks for the comments. This little widget uses the qs library (visit: http://www.quietlyscheming.com/blog/ for more info.)

I have used DisplayShelf component for the Album listing and the Landscape zoomer (light table) for the photo listing.

Hope this library will help you to build something like this.

J.

Monday, 5 May 2008

3D Wall

Hi all,

Today I came accross a very effective way of displaying images in flash player. You have to check this out, this is some serious stuff.








This is very cool. They have posted 6 different examples. It reminds me of PicLense very much.

PicLense is a very good plugin for your browser, saves you clicking through "next", specially when you are browsing images on flickr, google, or facebook.

Hope you enjoy it and get more inspiration to create something cool like this. ;)

cheers,

Jatin

Thursday, 2 August 2007

Flex and Coldfusion Job at Emojo

Emojo, a dynamic and innovative software development firm, seeks talented, self motivated, creative and disciplined Coldfusion and Flex Web Developer to help us respond to our continued growth.

Job Description:

Looking for a Flex Component Developer with demonstrated and proven skills in design, development, testing, and implementation of high quality applications using Coldfusion and MS SQL 2000. Continuous learning of new concepts, technologies and functionality is a strong point.
The development environment is Flex 2.0, and back end would be Coldfusion and SQL Server 2000. Some training will be provided.

This is full-time, permanent position.

Required Skills:

Candidate must have minimum 2+ years of experience in developing Rich Internet Applications using Adobe Flex 1.5/2.0/3.0
Minimum 2+ years experience in Object Oriented Programming
Minimum 2+ years experience in Coldfusion MX7
ActionScript development skills, including retrieving and parsing XML data from an application server
Strong knowledge of MS SQL 2000 and you must be experience in writing optimised queries.
Extensive experience with one or more modern IDE’s (ie. Dreamweaver, Flex Builder)
Degree in Computer Science or Mathematics
Strong Ability to grasp functional requirements
Experience in using Source Control Software
Experience in working with team
Knowledge of working with Content Management System

Duties and Responsibilities

You will be part of a small close-knit team that is passionate about Affino, our core product. The successful candidate will create rich user interfaces for complex applications and integrating them with Affino, extending and improving the existing functionalities, bug fixing, managing client based projects and internal projects. Other will include project documentation and specification and Cold Fusion database design/development. From time to time you will be called on to perform other duties.

Remuneration

From £25,000 to £35,000 per annum, contingent on experience.

Contact

Please send your CV and covering letter to ziggy@emojo.com.
Or
alternatively post it to:

Ziggy Latif
Emojo Ltd
211 Regent Street, London, UK, W1B 4NF

Closing date:
Please send us your application before 2nd October 2007.

Applicants are welcome from the European Economic Area (EEA).

Adobe® Integrated Runtime (AIR)

Download free copy of Adobe® Integrated Runtime (AIR) for JavaScript Developers (Pocket Reference) - By Mike Chambers, Daniel Dura, and Kevin Hoyt

Adobe® Integrated Runtime (AIR) for JavaScript Developers


Content:

Chapter 1: Introduction to the Adobe Integrated Runtime (AIR)
Chapter 2: Getting Started with AIR Development
Chapter 3: Working with JavaScript and HTML Within AIR
Chapter 4: AIR Mini-Cookbook