Drew Brees Commencement Speech, May 2010 New Orleans LOYOLA

Drew Brees the New Orleans Saints quarterback and Super Bowl MVP speaks about perseverance, commitment, and hope in the 2010 LOYOLA Commencement Speech. There is something enduring about those who can see adversity as opportunity and hardship as a learning tool that will only serve to make the future brighter. Perhaps being hungry is the difference between those who succeed and those who fail, which can be summed up by Brees’s quote, “There are three types of people in this world, those who make it happen, those that watch it happen, and those that wake up one day and say what the heck happened, so which one are you?”

Part 1 of 2

Part 2 of 2

A little bit about JSON

A little bit about JSON, or Javascript Object Notation. As you start using the Javascript Ajax libraries, you will certainly run into JSON so it is extremely important that you get a handle on the basics of JSON.

The basic format of a properly formatted JSON string is:

{ name:'value',name:'value',name:[{sub_value:'value',sub_value:'value'},
{sub_value:'value',sub_value:'value'}]}

The values in the example above are in quotes due to the fact that they strings, if you had numeric values the quotes would be optional, as with boolean values and null. Let’s take a look at how this translates in the real world. Suppose we had the following table in a database that contained name, age, and gender.

Name Age Sex
Barney Rubble 32 Male
Fred Flintstone 33 Male
Betty Rubble 32 Female
Pebbles 1 Female
Bamm Bamm 2 Male




The JSON representation of this table would then be:

{results:5,data:[{name:'Barney Rubble',age:32,sex:'Male'},
{name:'Fred Flinstone',age:33,sex:'Male'},
{name:'Betty Rubble',age:32,sex:'Female'},
{name:'Pebbles',age:1,sex:'Female'},
{name:'Bamm Bamm',age:2,sex:'Male'}]}

You probably will not want to write the JSON by hand as in the example above, so in real life you would write a function that would convert the data from a table into the JSON format. A sample function might look like :

<cffunction name="getFlinstones" hint="get all the flinstones" returntype="string" >

<cfquery name="getData" datasource="flinstoneDB" >

        Select name, age, sex from flinstones

</cfquery>
<cfset json = "{results:#getData.recordcount#,data:[" >
<cfloop query="getData">
     <cfset json = json + "{name:'#getData.name#',age:'#getData.age#',sex:'#getData.sex#'}," >
</cfloop>
<cfset json = Trim(json)>
<cfset json = left(json, len(json)-1)>
<cfset json = json + "]}">
<cfreturn json>
</cffunction>

Of course most languages come with Json support like php: http://php.net/manual/en/book.json.php or cold fusion: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_07a.html.

Look for the editable Json grid next.

A better editable grid, how search patterns revealed a desire for a decent drop down box inside a Ajax grid.

I have been getting a lot of traffic on the YUI drop down boxes inside of the YUI grid component, which leads me to believe that there are several individuals out there that need a decent editable grid with a decent drop down component. Well, at the risk of offending the Yahoo UI camp, I have to let it be known that many of the desperate search attempts and extensions of the YUI package can be satisfied by using another Javascript grid component altogether, in fact the post below will show you just how simple it is to set up a drop down box in an editable grid, which unlike the hack that was implemented for the YUI grid doesn’t rely on the eval function and can take data from a local array, JSON string, or better yet a data store populated from the database via lookup table.

First, to compare the two apples for apples let’s take a look at the Grid From Markup, to make the following example run in your environment first download the Ext JS package by following this link, http://www.sencha.com/products/js/download.php?dl=extjs321. Unzip the package to the folder where you have placed your website, an example is provided below:

Unzip the files and place the ext folder in the root of your project

The code for the grid from markup starts off much like the YUI grid, but that is where the similarities end, first cut    and paste the lines below to get the example running on your page.

<!HTML>
<html>
    <head>
        <title>Grid From Markup</title>

        <!-- These four links are all you need for all of the Ext components -->
        <link rel="stylesheet" type="text/css" href="/ext-3.2.1/resources/css/ext-all.css" />
        <script type="text/javascript" src="ext-3.2.1/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="ext-3.2.1/ext-all.js"></script>
        <script type="text/javascript" src="ext-3.2.1/examples/ux/TableGrid.js"></script>

    </head>
    <body>
        <h1>Grid From Markup</h1>

       <table cellspacing="0" id="the-table">
        <thead>
            <tr style="background:#eeeeee;">
                <th>Name</th>
                <th style="width: 40px;">Age</th>
                <th>Sex</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Barney Rubble</td>
                <td>32</td>
                <td>Male</td>
            </tr>
            <tr>
                <td>Fred Flintstone</td>
                <td>33</td>
                <td>Male</td>
            </tr>
            <tr>
                <td>Betty Rubble</td>
                <td>32</td>
                <td>Female</td>
            </tr>
            <tr>
                <td>Pebbles</td>
                <td>1</td>
                <td>Female</td>
            </tr>
            <tr>
                <td>Bamm Bamm</td>
                <td>2</td>
                <td>Male</td>
            </tr>
        </tbody>
    </table>

    </body>
     <script>

              Ext.onReady(function(){
                      // create the grid
                      var grid = new Ext.ux.grid.TableGrid("the-table", {
                          stripeRows: true // stripe alternate rows
                      });
                      grid.render();
              });

        </script>
</html>

Not too much to it, there are four Ext scripts that will change this basic html table into a sortable data table ala YUI, and guess what, these four scripts will also do all of the other functions, like layout, menus, drag and drop, ……. No more hunting for the million includes, and no need for a separate app to just find out what order the include files should go in!

Here’s a look at the finished table, complete with sorting and hideable columns.

The simplest Ext grid still has sorting and hide-able columns.

The simplest Ext grid still has sorting and hide-able columns.



Choices

The new HTML 5 Video Tag – How To Embed Video for Mobile Sites

One tag and you get a first class video player complete with controls!

HTML 5’s new Video Tag
One of the most talked about features in HTML 5 is the video tag, this tag much like the image tag is used to include a video into a webpage. In the past (meaning now) placing video in a web page really meant placing video in some type of player, perhaps Adobe Flash using a .flv video file to ‘stream’ the video to the user and to provide a basic set of controls, like a play, pause, and stop button, or volume controls. This was time consuming and relied on a plugin. In HTML 5 all you have to do to get the controls and video is to add the following tag:

HTML 5’s new Video Tag
One of the most talked about features in HTML 5 is the video tag, this tag much like the image tag is used to include a video into a webpage. In the past (meaning now) placing video in a web page really meant placing video in some type of player, perhaps Adobe Flash using a .flv video file to ‘stream’ the video to the user and to provide a basic set of controls, like a play, pause, and stop button, or volume controls. This was time consuming and relied on a plugin. In HTML 5 all you have to do to get the controls and video is to add the following tag:

<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Check Out The HTML 5 Video Tag!</title>
	</head>
	<body>
		<video src="Snow Storm Collage.mov" controls="controls" >
			Sorry, your browser does not support the video tag how about an upgrade?
		</video>
	</body>
</html>

Of course the tag comes with a few attributes that you might want to use in order to get your video display just right.

  • autoplay=”autoplay” – This will start the video immediately
  • width=’500px’ – This will set the width just replace the e500 with your desired width in pixels
  • height=’300px’ – This will set the height, and just like the width, just substitute the pixels for your actual value.
  • controls=’controls’ – You never know, you may not want controls with that video, you might be programming one of those annoying advertisements that do not have controls.
  • loop=’loop’ – This is self explanatory, it will loop the video.
  • preload=’preload’ – this will load the video when the page initially loads, I would not really recommend this unless you want a page delay.
  • src=’This is your video.video’ – this is the path to your video file.