<body topmargin=0><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=1847318901978695218&amp;blogName=Nick+Holmes+a+Court&amp;publishMode=PUBLISH_MODE_HOSTED&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http://www.nickhac.com/search&amp;blogLocale=en&amp;homepageUrl=http://www.nickhac.com/&amp;vt=5069520967288021443" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>

Sunday, May 22, 2011

Recently ive decided to learn NodeJS, so a few weeks back i wrote a hello world application. Ive been using Microsoft .NET commercially for around 10 years and although we do use a fair amount of open source technology at BuzzNumbers, i dont write that much code these days so i wanted to get my hands dirty.

I had been looking for a real world application to build in NodeJS and over the last week a requirement emerged for an service that enables me to input a company name in a IMG SRC and get back the company logo.

This gives me flexability so i can just hotlink a company logo anytime when ever im blogging or as part of a client reporting application and the company logo will embed nicely

For Example

src=" http://companylogogenerator.nickhac.com?q=qantas"
or src=" http://companylogogenerator.nickhac.com?q=westpac"
    

To achieve this i had to use overcome a number of technical challenges...
  • Extract parameters from querystring to get the company name
  • Build up a URL based on the URL and Company Name
  • Download HTML from an Image Search Webpage
  • Parse the HTML and extract URL's of Images
  • Redirect the Web Request to serve up the image from the 3rd party suite
  • Keep the Web Server Always Online and handle errors (using forever)
Here is the code http://pastebin.com/iY2gwUDM

Posted by Nick HaC @ 10:26 PM


0 Comments:

Post a Comment

<< Home



Copyright 1998-2010 Nick Holmes a Court