Archive for the ‘Programming’ category

Google Web Elements add Google goodness to your web site

May 27th, 2009

Google has a number of awesome products, ranging from its traditional search to its mapping to its online office replacement.  They have now packaged several of their products as free widgets that can be embedded into a web site with ease.  They are calling this Google Web Elements.

Maps

News Videos

Search JasonJackson.com

Loading


Pretty cool stuff.

The Annotated Turing

April 30th, 2009

I just finished reading The Annotated Turing: A Guided Tour Through Alan Turing’s Historic Paper on Computability and the Turing Machine. Charles Petzold does an excellent job explaining one of the most important papers and proofs in all of mathematics and logic. I thouroughly enjoyed Petzold’s explainations intermixed with history about Turing.  He carefully crafts a story about Alan Turing in the annotations, taking important events in Turing’s short life and molding them into segues to various concepts in the paper itself.  Jumping back and forth from history to math in this way proved to be a very interesting way to read a mathematical proof (and I mean that in a good way).  

The math and logic can be a bit rigorous.  We are talking about the paper that established one of the core principles of formal math: that it is impossible to create a general algorithm to determine any truth.  Until 1936, most mathematicians thought that this was indeed possible.  A famous mathematician, David Hilbert, had issued a challenge known as the Entscheidungsproblem.  Turing, and Alonzo Church, independently answered the call by proving Hilbert’s assertion wrong.  While Church used a more formal mathematical approach, Alan Turing basically invented modern computer science to provide the concepts needed to prove that no such universal algorithm could exist.  On the path to this conclusion, he also proved that there must exist real numbers that cannot be computed.  Think about that one for a bit!  It is difficult to overstate the importance and impact Turing and his paper have had on our world in general, and in the subjects of mathematics and computer science in particular.

I highly recommend this book.  While the logic gets difficult in spots, one can skim over these sections and get to the point.  Petzold did right by Turing in this annotated version of his paper.  Its an informative and enjoyable read.

Charting

April 24th, 2009

I have been doing a lot of  graphics work lately, mostly in Silverlight.  My latest task was to create a simple pie chart.  There are several open source Silveright charting solutions online, including the charting built in to the Silverlight Control Toolkit.  I decided to write my own pie chart for a couple of reasons.  I wanted something that was light-weight to download, and I wanted to learn a little about drawing charts in Silverlight.  I also needed to write a server-side pie chart to handle the case of a user that does not have Silverlight installed.  As it turns out, Microsoft also has a charting solution for this.  However, I resorted to writing my own GDI+ pie chart for this.  Their new ASP.Net charting solution turned out to be difficult to integrate with our product.

In my research into charts I found a graph site that has nothing to do with programming, GraphJam. As I have mentioned before, I have been relearning some of my high-school math.  Algebra, Geometry and Trigonometry have all come into play (in their simplest forms) in drawing various shapes to the screen in Silverlight.  I found the chart at the bottom of the page funny.  My wife and I love the History Channel when they are actually showing shows about, um, history, so the first chart also got a good chuckle from me.  Here are the two charts:

History Channel Programming Line-Up
see more Funny Graphs

Amount of use I get from Trigonometry
see more Funny Graphs

Silverlight Command Line Arguments.

April 17th, 2009

I have been developing a fairly rich Silverlight application for the last couple of months that is meant to ultimately replace some of our existing UI.  This project has evolved from prototype to framework authoring to actual wire-frame implementations.  I have had a chance now to step back and create some small charting components for one of our existing pages.  A change of pace can be refreshing, and this one allows me to stay in Silverlight land yet spend about a week writing some production code.

There are a number of charting components available, many of them free.  I am going to take this opportunity to write my own from scratch since I really only need some simple pie charts.  I want to keep it small and simple, and yet learn from the experience.

I have run into a new situation with these small components that I had not encountered with the large application.  I need to pass “command line arguments”.  Or rather, I need to embedd some data in the HTML page for the Silverlight to pick-up and render.  This data will be the charting data.  As it turns out this is dead simple.  In the Silverlight object tag I simply include the initParams parameter with my data, comma-delimited:

  <object type="application/x-silverlight" width="100%" height="100%">
    <param name="source" value="ClientBin/MyChartingApp.xap"/>
    <!-- Command Line Arguments -->
    <param name="initParams" value="datum1=1,datum2=2,etc" />
  </object>

Then I read that data in during the application’s Load event:

  private void Application_Startup(object sender, StartupEventArgs e)
  {
    foreach (var key in e.InitParams.Keys)
    {
      var datum = e.InitParams[key];
      //do something with the datum
    }
  }

Pretty simple!  Now I just need to write some ASP.Net code to render out the desired HMTL, and I am all set.  Oh, that and write the Silverlight component.

Alan Turing and GEB

April 16th, 2009

Alan Turing is a legend in computer science. Let me set aside that fact that he is seen as the father of modern computer science, and list off a few of his accomplishments:

  • Principal participant in decoding German messages during WWII.  Turing, using his incredible intellect, was a genuine war hero, helping to defeat the Nazis and save allied lives with his work.
  • Author of the Turing Machine Thesis which outlines rules for determining artificial intelligence.  This paper spawned an entire field of research, and many of the deeper concepts in it have shaped the thoughts of computer scientists for generations.
  • “Co-author” of the Church-Turing Thesis, which outlines one of the core principals of computer science.  The concept behind this thesis might be the most important in all of computer science.

In a recent post I shared some thoughts about having completed reading GEB.  In GEB, Turing is a central figure along with other famous (and not so famous) intellects such as M.C. Escher, J.S. Bach, Kurt Gödel, Alonzo Church, Euclid and others.   Outside his famous AI paper Turing and others developed important theories about computation and computer science.  The design of computer languages was forever changed with the concept of Turing-completeness.  From a programming perspective, this means that no language will ever be more powerful than what we now have.  Our currently languages do a few important things that cannot be improved upon: they have variable substitution, they have recursion, and they have unbounded loops.  Turing and Church showed this, and others along with Turing have provided various logical/mathematical proofs on the subject.

After reading GEB I promised myself I would start reading about and exploring the ideas of the people quoted throughout the book.  I have started with Turing.  Charles Petzold has written a great book titled The Annotated Turing: A Guided Tour Through Alan Turing’s Historic Paper on Computability and the Turing Machine.  I actually purchased it before my recent trip to Great Britain but decided not to pack it.  I mean, there are only so many books you can pack in a single back pack and still leave room for things like clothes and toiletries!

I just started last night but I am already getting into the book.  I am looking forward to digging back into it tonight.

Before I end this post it should be mentioned that Alan Turing, a man who had a significant impact decoding German codes in WWII and was one of the most influential people in the 20th century, was gay.  Through unfortunate circumstances this fact was made public in 1952.  At the time it was considered a crime and Turing was persecuted by the British.  Turing’s friends and family describe him as a gentle soul and towering intellect.  He was found dead on June 8th, 1954 from an apparent suicide.  He was only 42.  Think what else he might have acomplished had not such a bigotted response fall upon him.

Get Rid of GMail Chat with Greasemonkey

March 20th, 2009

I love my custom Google homepage aka iGoogle.  I have subscribed to a number RSS feeds, keep GMail in a tab, and have my Google bookmarks on a tab.  Its works well, and has a customizable look and feel.  Me and iGoogle were getting along really well.  Until about a week or two ago.  That is when Google added a chat feature to the main page.  Its really annoying and just gets in the way.  I immediately wanted to remove.

I had never used Greasemonkey before, but had read about it so I was aware of its capabilities.  The jist is that it allows you to write local Javascript files that can be applied to specific domains or web pages.  Large repositories of Greasemonkey scripts are available online.  I put two and two together – I would install Greasemonkey and install a script to remove Google chat.

Well, the first part went well but I had trouble finding a script that actually removed Google Chat from iGoogle.  After about 5 minutes of research I realized how incredibly easy it is to author a Greasemonkey script.  Here is the script I wrote to remove (or hide) Google Chat from iGoogle.  Next up: figure out how to get jQuery into Greasemonkey.

// ==UserScript==
// @name           Remove GMail Chat
// @namespace      http://jasonjackson.com/scripts
// @include        http://www.google.com/ig
// ==/UserScript==

(function() {
  var chatNode = document.getElementById("bottom_nav");
  chatNode.style.display = 'none';
})();

ASP.Net MVC, IE 8 (Yawn) Released

March 19th, 2009

The first tech news coming out of Mix this morning was the release of IE 8. While its nice that they are still trying to do nice things with IE, I currently have 3 browsers installed that I prefer over IE: Firefox, Safari and Chrome. Firefox is my everyday browser. Its much faster than IE, and its plug-in ecosystem is great.  All IE 8 does is make testing of our current release more difficult.  Now we have to support 3 versions of IE.  Such is progress.

There is something cool coming out of Mix today and that something is ASP.Net MVC.  I played around with ASP.Net MVC a couple of months ago and really, really liked it.  For creating a modern web site I don’t think it gets much better.  Think Rails done right on top of a managed, strongly typed, compiled language married to great tools.  Download page here.  Microsoft has been making a lot of great moves in the web development space recently with their adoption of jQuery, release of Silverlight 2 last year and upcoming release of Silverlight 3, and now ASP.Net MVC.

Some More New Features in Silverlight 3 Announced at #Mix09

March 18th, 2009

Scott Gu and Co. have announced a few more items that are, well, kick ass.

  • A new data tier technology that will allow developers to write data services, decorate those services with a client attribute, and your Silverlight project will automatically generate proxies for those data services.  This eliminates a lot of custom code I have written to do my WCF plumbing.
  • Silverlight on the desktop on Mac and Windows!  Its pretty obvious they are going after Adobe Air here.  This gives Windows developers and easy-in to Mac desktop development.
  • A Silverlight developer plugin for Eclipse on Windows and Mac.
  • Blend 3 can import from Photoshop.  It provides granular control over importing layers from the Photoshop document.  Very nice!
  • Blend 3, in general, looks like a huge improvement over Blend 2.

New Features in Silverlight 3

March 18th, 2009

Scott Guthrie is on stage right now in Las Vegas and here are a few things he has mentioned about Silverlight 3:

  • Utilization of the GPU on the client machine for graphics acceleration.
  • Merged Dictionaries (I had to write one of these myself).
  • Style inheritance.
  • On-demand type download – I wrote this from the ground up for the current app I am building.  Its nice to see it bundled in with SL3.
  • Gestures in Windows 7 – I don’t know if this will be available in Silverlight on all platforms…
  • Playboy is putting all of its archives into a Deep Zoom powered site.  Oh, and Rolling Stone is too.

Silverlight 3 Download Links Live

March 18th, 2009

The download links for Silverlight 3 are live on Microsoft.com

Microsoft® Silverlight™ 3 SDK Beta 1

Microsoft® Silverlight™ 3 Tools Beta 1 for Visual Studio 2008 SP1

Neither the Mix site nor the Silverlight site have any SL3 details as of 9:10 CST 3/18/09.  It looks like Microsoft may have put the links live before SL3 is officially announced.

I look forward to seeing the feature list for Silverlight 3.

EDIT: WordPress went nuts and put a bunch of weird formatting in which was occasionally showing up in Firefox.  I went into the HTML and ripped out all of the junk.