Just Ship – why so many fail and don’t realize how positive that might actually be in the long run.

Failing is not, fun, it’s not something that you set out to do, no one has hopes of failing big one day, you don’t hear people say I’m going to go out there and fail miserably. So what often happens is we lull ourselves into a state of negative productivity, we put off doing anything meaningful and actually accomplishing tasks in favor of backpedaling, blaming, blocking, and generally wasting time until it is someone else’s turn to do something – see that way we don’t have to ship anything, we don’t have to put our mark on anything and we can guarantee ourselves that we won’t fail – all the while ensuring that we can not succeed. Ask yourself how can you have passion for anything if you haven’t failed? Real success (especially in software development) comes in shipping and shipping often. Remember perfect is the enemy of good enough, and how many of you really use all the button on any software package that you use?

In January Seth Godin compiled a book filled with what would appear to many as common sense, however, after a cursory look at the state of things it may not be that common, so in the spirit of sharing this resource here are some of the most enlightening chapters for developers. Just today Godin released a set of books that you can use in your organization to help get your products shipped, check out the website here: http://www.squidoo.com/the-shipit-workbook

SHIP (Seth Godin)  Brainwashed – Seven ways to reinvent yourself

Scarcity creates value. People pay extra for things that are hard to get, while things that have a surplus go cheap. That’s basic economics.

So, what’s scarce?

The ability to ship.

If you can get something out the door while your competitors cringe in fear, you win. If you’re the team member that makes things happen, you become indispensable. If you and your organiza- tion are the ones (the only ones) that can get things done, close the sale, ship the product and make a difference, you’re the linchpins—the ones we can’t live without.

Shipping is difficult because of the lizard brain. The resistance doesn’t want you to ship, because if you ship, you might fail. If you ship, we might laugh at you. If you ship, you may be held account- able for the decisions you made.

The key to the reinvention of who you are, then, is to become someone who ships. The goal is to have the rare skill of actually getting things done, making them happen and creating outcomes that people seek out.

Michael Dell ships. So do Larry Ellison and Anne Mulcahy. Quieting the lizard, acknowledging it and then ignoring it—it’s the only way.

Jeff Bezos on how your series of choices through life build your story.

I believe the take away from this should be the fact that cleverness is a gift while kindness is a choice. You have to ask yourself how many times do you make the choice to be kind? There is a small piece of runners wisdom (that comes in handy when you don’t want to go out the door) that states that you never regret the runs that you do make just those that you did not make.

Free data! Really Simple Web Service Integration using the Yahoo Query Language (YQL)

The YQL Console

The YQL Console highlighting Zillow data

Yahoo has started an ambitious project that aims to open up data to developers by starting the YQL project, which contains data tables from major applications, like real time traffic, zillow home prices, weather, financial information, flicker, social media, the list goes on and on and on, and anyone with an imagination could have a field day writing applications based on the data tables. So how does this all work? First of all YQL uses an SQL like syntax, so if you are familiar with queries such as select * from tablename you will have no problem getting data from an YQL table. Yahoo has built a convenient console that lets you explore the various tables and perform queries before you put the data call into your code, you can access this console here: http://developer.yahoo.com/yql/console/ . There are some queries that require a login and some that do not, so if you want to see all of the possible tables you will have to log in to Yahoo using a yahoo user name and password.

Now that all of the introductions are out of the way let’s take a look at an example that will return the change in stock price using PHP, we will need to run a query against the Yahoo finance data which you can test here by entering a stock symbol that you know off the top of your head like GOOG, MMM, F, or GD and see the decoded JSON come back from the YQL query:

Ticker:

Here’s the code:

<h2>Using YQL to Access the Upcoming API</h2>
<form name='stock'>
Ticker: <input name='ticker' id='ticker' type='text' size='20'/><br/>
<p><button id='find_stock'>Show me the stock information</button></p>
</form>

<script>
  // Attach event handler to button
  document.getElementById("find_stock").addEventListener("click",find_stock,false);
  // Get user input and submit form
  function find_stock(){
    document.stock.ticker.value = document.getElementById('ticker').value || "F";
    document.stock.submit();
  } 
</script>
<?php
  $BASE_URL = "http://query.yahooapis.com/v1/public/yql?";

  if(isset($_GET['ticker']) ){
    $location = $_GET['ticker'];
    $events="";
     
    // Form YQL query and build URI to YQL Web service
    $yql_query = "select * from yahoo.finance.quotes where symbol in ('$location')";
    $yql_query_url = $BASE_URL . "q=" . urlencode($yql_query) . 
"&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env";

    // Make call with cURL
    $session = curl_init($yql_query_url);
    curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
    $json = curl_exec($session);
    // Convert JSON to PHP object 
    $phpObj =  json_decode($json);
   
    // Confirm that results were returned before parsing
    if(!is_null($phpObj->query->results)){
      //// ->query->results->quote->ChangeFromYearLow;
       echo var_dump($phpObj);
       }
    // No results were returned
    if(empty($phpObj->query->results)){
      $events = "Sorry, no stock information for ticker symbol $location";
    }
    // Display results and unset the global array $_GET
   
    unset($_GET);
  }
?>

Loading an External Page into an ExtJs panel and allowing the page to execute script

There will come a time when you want to load external pages into a panel, be it a plain panel, a tab panel … or whatever type you wish, they all will act the same, they will eagerly take the content in the ‘autoLoad’ parameter and place it inside your layout, but they will leave you wondering why simple DOM calls, alert boxes, or any other scripts just stopped working! Luckily, there is an easy solution to this, just one simple property inside the autoLoad parameter will set your scripts free.

// The elusive scripts:true value for your autoload parameter
     autoLoad:{url:’your_url_containing_scripts.htm’,scripts:true}

.. and when you want to update the panel with new content like on a row click, or button click just pass the following line ..

 Ext.getCmp('some_panel_id').load({url:’your_url_containing_scripts.htm’,scripts:true, params:{something:else}});

Multi Select combo box in Extjs

Multi Select Combobox

The combobox in action

Another common task that used to cause a lot of heartburn is the addition of a multi select box, or a way for a user to populate a control with multiple values. Fortunately, there is an excellent user extension that will allow you to do this with some style, using the common email to line style where the selected values are displayed in the form field and the additional selections are displayed in a drop down type box.

First you will have to download the extension (http://www.sencha.com/forum/showthread.php?69090-Ext.ux.form.SuperBoxSelect-as-seen-on-facebook-and-hotmail ) – or – (http://www.technomedia.co.uk/SuperBoxSelect/examples3.html )

Once downloaded make sure you add the references to it in the of your html document, and include the CSS and images as well (otherwise you will not see the ‘x’ or down arrow that basically tells the user how to work with this control). The code for adding the select box is identical to the code for adding a normal combo box :

var sampleSuperSelect = new Ext.ux.form.SuperBoxSelect({
       store:sample_store,
       fieldLabel:'Test',
       allowBlank:false,
       id:'sample_pk_id',
       mode:'local',
       displayField: 'sample_display_value',
       valueField: 'sample_pk_id',
       name:'sample_pk_id',
       anchor:'95%'
});

The trick to every multiple select box is to figure out a way to populate the multiple values that you have stored in your database, with this control it is a simple comma separated list that does all of the work. The ExtJs JSON that would be needed to populate the box with existing values based on the following sample table structure would be:

Main data table

sample_pk_id int
sample_name varchar(50)

Linked table that holds multiple values for each main type

sample_linked_pk_id int
sample_linked_name varchar(50)
fk_sample_pk_id int

Now in order to show the selected values in the multi select box you would just have to query the second table based on the primary key of the top table, so something like:

select sample_linked_pk_id from linked table where fk_sample_pk_id = main_table.sample_pk_id

The JSON that the multi select box requires when passing in the selected values looks like this (where the numbers in the values property = your keys that are the value field of the multi select box above:

{success:true, values:’3,5,6,9….’}

An example Ext Ajax call that would populate the multiple values is shown below:

Ext.Ajax.request({
           url: 'some_values.php',
           params:{'sample_pk_id':sample_pk_id},
           success: function(action){
               var return_statement = Ext.decode(action.responseText); 
                    if (return_statement.success == true){   
// This is the statement that does the work!
 Ext.getCmp('sample_pk_id').setValue(return_statement.values); 

                     } else {
                                  Ext.Msg('Whoa!', 'There has been an error populating the multi-select box.'); 
                      }
           },
               failure: function(action){ 
                   // Something happened that prevented the record from being updated
                              Ext.Msg('Whoa!', 'There has been an error populating the multi-select box.');
 }); 

Hopefully this will help you navigate the multiple value problem that seems to consume way too much time, way too often.