Confoo Conference (Montreal, QC)


confoo.ca Web Techno Conference

From March 10th to 12th, 2010 I will be in Montreal, Quebec (Canada) for Confoo at the Hilton Montreal Bonaventure Hotel. I’ll be presenting a few topics while I’m there:

 

Browser MVC with YQL and YUI
The Yahoo! Query Language provides a rich and dynamic method for obtaining and manipulating data from any source or API on the internet – with YQL the internet becomes your database. Coupling the data backend of YQL with the extensive visualization and flow techniques of JavaScript through libraries such as YUI, a developer can build powerful widget and data systems using the simplified SQL syntax that YQL is based in. The marriage of YQL and JavaScript brings a robust MVC interface to the browser.

 

This talk will cover the core techniques within YQL, including server-side JavaScript with native E4X support for manipulating data, key / value pair data storage and the process of creating your own YQL tables for accessing web based content. Building upon this core, design concepts such as those of a Model View Controller pattern will be introduced to display methods for taking the base data and merging that with front-end libraries to build out production level applications.

 

The Foundations of an Application Platform
Application platforms, such as the Yahoo! Application Platform (YAP), Facebook, or Myspace, have become a core foundation of social web infrastructures. When constructing a platform to run applications, numerous layers of security and technology need to work off of each other in order to generate a secure, versatile system.

 

This talk will cover the core technologies behind the creation of a platform to host 3rd party applications. We will explore open technologies such as OpenID and OAuth for user verification, OpenSocial for architecture implementations, and the use of front-end security implementations such as Caja. This will explore the benefits and exploits from each of the implementations and the importance of open source technologies.

 

If you’re coming out to Confoo or are in the area and want to meet you send me a message. You can reach me on twitter @jcleblanc

 

- Jonathan LeBlanc

  • Share/Bookmark


Yahoo! Developer Network Updates (Second Podcast)


This is the second “State of the Yahoo! Developer Network” podcast with Gene Crawford of unmatchedstyle.com. In this episode we cover the recent upgrades to YQL and YUI, upcoming University hack events and the open source technologies being made available by Yahoo! such as traffic server, YUI gallery and BrowserPlus.

 

 

Podcast Links
YQL Upgrade
YUI 3 Open Source gallery on github
BrowserPlus open source on github
Traffic Server open source on Apache

 

- Jonathan LeBlanc

  • Share/Bookmark


Selecting a record with the next closest date using SQL


I have been recently working on a trip planner application where I have had to display the next trip that a user has coming up. This involved having to make a comparison between the starting date of the trip and the current date to find the trip that met this criteria. I thought I would share the basic query of how you can do this should anyone need to do accomplish a similar task.

 

Given the Following:
- My table name is trip_list
- The starting date of the trip (which we will compare) is named date_from
- The dates stored into the date_from field are stored in the format of dd-mm-yyyy

SELECT * FROM trip_list WHERE trip_list.date_from =
(SELECT MIN(trip_list.date_from) FROM trip_list WHERE
trip_list.date_from >= DATE_FORMAT(NOW(),'%d-%m-%Y'))

What I am doing here is selecting all columns in the table where the starting date is equal to the lowest date that is after the current date. At the end of the query I format the output of the current date to be dd-mm-yyyy for comparison since this is an application for the Australia / New Zealand region and that’s their date structure.

 

That’s all there is to it.

 

- Jonathan LeBlanc

  • Share/Bookmark


Pushing an Application Update with OpenSocial 0.8


Within the OpenSocial 0.8 specification is a definition available for pushing out a notification to the user stream automatically from an application.

 

What are updates and why should you care?

 

The update (or status) stream of a user is a listing of what they are currently doing or what they have posted for their friends and connections to see. What’s important to note here is that using this stream can drive quite a bit of traffic to your application if you use it. Personally, I never look through the application gallery of a platform like the Yahoo! Application Platform or MySpace. Most of the time I will only ever add applications when I see an app notification through one of the updates produced by one of my friends.

 

I mean – sometimes I just need to find out what Disney princess I am right?

 

In any event, using this update stream is going to push users to your application. This is one of the many tools that we can use to drive more traffic to your application.

 

How does this work?

 

Using standard JavaScript, let’s take a look at the steps that we will need to implement to insert an update. I would suggest that this JavaScript be inserted in a function that is driven by a user event, such as a click action.

var params = {}, activity;
params[opensocial.Activity.Field.TITLE] = "title";
params[opensocial.Activity.Field.URL] = "http://www.myserver.com/index.php";
params[opensocial.Activity.Field.BODY] = "body text";
activity = opensocial.newActivity(params);

First we need to set up the parameters that will define what will be pushed out in this update. In the above example, we assign a title string, the URL that the title string will be linked to and the body (content) of the update. There are a whole series of options available within an activity request that can be added to the above. These are listed on the OpenSocial documentation here: http://wiki.opensocial.org/index.php?title=Opensocial.Activity_%28v0.8%29#Fields. We then call the newActivity() method to define the activity that we want to build. The parameter that needs to be present in the method is the parameter list that we defined right before that request.

opensocial.requestCreateActivity(
	activity,
	opensocial.CreateActivityPriority.LOW,
	callback);

We then call requestCreateActivity to actually send the request and push the update out. There are three parameters present in this method:

  1. activity – The activity we defined in the first code sample
  2. priority – This is the priority that the update should use to send out. This can either be opensocial.CreateActivityPriority.HIGH (or the string ‘HIGH’) or opensocial.CreateActivityPriority.LOW (or the string ‘LOW’). The difference is in whether the user has granted your application permission to push updates out to their stream. If you define a HIGH priority and the user has not granted your application permission to push out updates, the application will attempt to load an authentication flow to allow the user to allow the update out. If you set a LOW priority, if the user has not granted your app permission, the update will be ignored and no authentication flow will be presented.
  3. callback – The function that will be executed when the update is inserted

With a few lines of code, you now have an application that can draw in more users using the update stream.

 

- Jonathan LeBlanc

  • Share/Bookmark


Yahoo! Developer Network Updates and Events


First “State of Yahoo! Developer Network” podcast with Gene Crawford of unmatchedstyle.com. In this episode we cover upcoming events, new product launches and upgrades to YUI and YQL.

 

 

- Jonathan LeBlanc

  • Share/Bookmark


Fetching Viewer Social Data with OpenSocial 0.8


Profile information within a social network (e.g. MySpace, Orkut, YAP, Hi5) is something that users take painstaking amounts of time to input so that they can tell their friends and the world who they are. If a developer is building an application on one of these same platforms, that same profile detail is a gold mine of information that can be obtained to customize and personalize an application. Why would you ever ask a user to input their name, interests or gender if they already have this information freely available on their profile? Having the user re-enter this information is just asking for the user to drop off of your application. Using the knowledge wealth will both decrease user drop rates and make your applicatio more appealing to the masses.

 

Within a container that supports the OpenSocial 0.8 JavaScript specification, fetching the profile information of a person can be accomplished and customized with several steps.


The first thing we do is call newDataRequest to set up a new information request object within OpenSocial. Once this has been done we create our parameter list which will define what type of information we want to access within the information request. In our case here, we specify that we would like to capture “PeopleRequestFields”, namely a user’s “PROFILE_DETAILS”, and of those profile details we want to return the name and the thumbnail_url to their profile image. We can add in a whole series of profile information here, depending on what the container supports within the profile information specification. We then add to our request a newFetchPersonRequest and specify that we want the “VIEWER” profile (this could also be OWNER) and then input the params we set up to define what data we want from the viewer. Then we just name that request as “viewer_profile” so that we can access it later and send the request. The request function takes the name of the callback function as a parameter.


When the request completes and gets to our callback function, our data is returned to us with the profile information of the viewer presuming that everything completed correctly. In the callback we can call get on the returned data, inputting the name of the request, and then call getData on that. If we want a finer granularity of control over the data that is returned, we can then call the getField function with the information that we want (in this case the viewer name).

 

That’s all there is to it – with a few calls you now have all the information you need to personalize your application to every users that uses it.

 

Jonathan LeBlanc

  • Share/Bookmark


Using yml:include to create an automatically updating YAP small view


One of the biggest issues that many people have with the small view of a YAP open application is that the view is cached on Yahoo! servers and can only be updated with manual intervention from either the application owner or the application user. In the past, application owners had a few options for updating this small view. The most common were:

  • When the user visited the canvas view of the application the owner would have a setSmallView call set up to refresh the small view of the user (process described here: http://www.nakedtechnologist.com/?p=181. The problem with this is that it requires the user to go to the canvas view. Many users would just view their small view on My Yahoo! so the content of the app was either generic or stale.
  • The owner would set up a cron job to update the small view of their app users on regular intervals (process described here: http://www.nakedtechnologist.com/?p=220). The issue with this one is that the content will only be updated at regular times and will be stale for a user in between those times.
  • The owner would implement a yml:a tag to call a server-side script to update the small view of the user when the user clicked on the link (process described here: http://www.nakedtechnologist.com/?p=204). This relied on user interaction to function and in many cases links on the small view would need to be added just for this requirement.

Many developers, myself included, opted for a mix of all of the options above. This worked fairly well to mimic a dynamic small view, but having three solutions for a single problem was unwieldy.

 

Enter the yml:include tag
The purpose of this tag is to dynamically load content onto a page. This tag can be used in both the canvas and small views, but the real benefit to its use is the small view.

I would recommend looking over the documentation for yml:include as there is quite a lot of detail that a developer would find useful: http://developer.yahoo.com/yap/guide/include.html

The features that are most important to note here are:

  • insert – if a node id is specified in the insert parameter, the content of the include request will load into that node.
  • delay – the amount of time to delay the loading of the content (in milliseconds)

These parameters will help in setting up a dynamic small view for the user. Using these, I’ll go through two examples on how to use yml:include. The first will cover a simple single load case and the second will display how to build a continually updating small view set to update on a specific delay.

 

Simple Use Case – Single Dynamic Load
This first example will display a simple use case for yml:include. We will use the setSmallView call to insert an include tag into the small view of the current user.

 

The PHP layer to this is just to insert that yml:include tag the first time, and is only needed once. This will replace the cached small view of the user with the include tag. For my applications, I ran this in a cron job to update the small view for all users at once. Doing so replaced my need to constantly update the small view of my users on a daily basis.

 

The full details for setting up this example can be found here: http://www.nakedtechnologist.com/?p=181. This piece is the PHP layer that just sets the small view of the user with a yml:include tag and the div node that the content will be inserted into.

$html = '<yml:include params="training_sdk.php" insert="loadHere"></yml:include><div id="loadHere">REPLACE</div>';
if (!$yahoo_user->setSmallView($html)){
	echo "NO SMALL VIEW";
}

When the dropzone (my.yahoo) and application load, an AJAX GET request will be made to training_sdk.php. This file will return the content of the small view and then be inserted into the div with the id of “loadHere” (as denoted by the insert parameter). This allows us to generate whatever content we want within training_sdk.php and the small view will reflect that change as soon as the user loads the application.

 

Extended Use Case – Updating the Small View Every x seconds on a delay
Now we’re going to look into an extended use case for yml:include. This version will extend upon the basic example to refresh the small view automatically every 5000 milliseconds (every 5 seconds). We will start off with the same code that we insert into the small view to include the yml:include tag. From that point we take a look at the file that we capture the content of the small view from, training_sdk.php.

<yml:include params="training_sdk.php" insert="loadHere" delay="5000"></yml:include>
<?= time(); ?>

What we’re doing here is inserting another yml:include tag onto the page. Just like the first tag we are calling the same file, training_sdk.php, and inserting it into the same DOM node. The difference here is that we are delaying the load of this request by 5 seconds with the delay parameter. Following that all we do is display the current UNIX timestamp. What’s going to happen when this content is inserted into the small view is that the new yml:include will count down 5 seconds and then make an AJAX call to the same file and insert another UNIX timestamp and yml:include tag (which is delayed 5 seconds). So there we have it, we now have a small view that will update itself automatically every 5 seconds.

 

There’s only one catch here. There is a limit on the number of times you can call yml:include within a span of time. If too many consecutive yml:include calls are made, you will see the following error message:

 

error-243: maxIncludes limit hit for appid XXX

 

If you see this message, you have made too many yml:include calls within the particular dropzone. Currently the front page will allow unlimited yml:include calls and http://my.yahoo.com will allow 10 calls per session. My Yahoo! is looking into this at the moment so keep checking back to see if there have been changes with this tag. If you see this error, increase the delay on your yml:includes and that should solve the issue.

 

- Jonathan LeBlanc

  • Share/Bookmark


Yahoo! Talks at ConvergeSC in Columbia, SC


At the end of June myself and Robyn Tippins, the community manager for YDN, were out at ConvergeSC in South Carolina. There were a lot of great talks during this time and all have just been published to http://vimeo.com/convergesc/videos. I would recommend going through the entire gambit because there were some very impressive speakers available.

 

My talk was an overview of YDN technologies when used in conjunction with YQL. There was a main focus on YQL within this talk.

 

Jonathan LeBlanc: YQL and other Yahoo Tech from Converge SC on Vimeo.

 

Robyn covered a very intriguing story about her career and life moving towards marketing herself in her life. She finished up the day with a strong, engaging presentation.

 

Marketing Socially: Robyn Tippins from Converge SC on Vimeo.

 

- Jonathan LeBlanc

  • Share/Bookmark