<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Left Logic</title>
	<link>http://leftlogic.com/lounge</link>
	<description>Left Logic articles and news / Left Logic is a Brighton based web development and design consultancy</description>
	<pubDate>Wed, 14 Nov 2007 12:28:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>
	<language>en</language>
			<item>
		<title>Bookmarklet Coding</title>
		<link>http://leftlogic.com/lounge/articles/bookmarklet-coding/</link>
		<comments>http://leftlogic.com/lounge/articles/bookmarklet-coding/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 10:07:34 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[Articles]]></category>
<category>bookmarklet</category><category>javascript</category><category>microformats</category><category>tutorial</category>
		<guid isPermaLink="false">http://leftlogic.com/lounge/articles/bookmarklet-coding/</guid>
		<description><![CDATA[If you're familiar with my work, then you'll know I'm an avid user of bookmarklets.  

They can be little snippets of code, or more complex applications such as the Microformats or the Speech Bubble bookmarklets that entirely hijack the web page for a new function.

Here I'll share my experience writing bookmarklets and offer some [...]]]></description>
			<content:encoded><![CDATA[<p>If you're familiar with my work, then you'll know I'm an avid user of <a href="http://en.wikipedia.org/wiki/Bookmarklets" title="Wikipedia Entry: Bookmarklet">bookmarklets</a>.  </p>

<p>They can be little snippets of code, or more complex applications such as the <a href="http://leftlogic.com/lounge/articles/microformats_bookmarklet/" title="Microformats Bookmarklet">Microformats</a> or the <a href="http://leftlogic.com/lounge/articles/speech-bubbles/" title="Speech Bubbles">Speech Bubble</a> bookmarklets that entirely hijack the web page for a new function.</p>

<p>Here I'll share my experience writing bookmarklets and offer some tips for development.</p>

<p><a class="more" id="more-18"></a></p>

<h3 id="code">Think BIG, code small</h3>

<p>The majority of bookmarklets are tiny pieces of JavaScript, succinctly written for a single task.  A few others will be more complicated and rely on a much larger library behind the scenes.  Either way, developing your bookmarklet you will be faced with a series of limitations.</p>

<h4>Limitations</h4>

<p>First and foremost, if you want your bookmarklet to work in all browsers, it has to adhere to length limits:</p>

<ul>
<li>IE 5 - 2084 bytes</li>
<li>IE 6 - 508 bytes</li>
<li>IE 6 SP 2 - <strong>488 bytes</strong></li>
<li>IE 7 - 2084 bytes</li>
<li>Firefox + Safari - > 2000 bytes</li>
</ul>

<p>IE6 has the smallest length, and that includes the <code>javascript:</code> pseudo protocol.</p>

<h4>Don't quote me</h4>

<p>Avoid the double quote character (").  Since the user is going to install your bookmarklet from a link, it will be wrapped with quotes (assuming xhtml).  If you absolutely require quotes, try using the entity: <code>%22</code></p>

<h4>Optimise to be short</h4>

<p>When you declare your variable, do it all at once. i.e.:</p>

<pre><code class="prettyprint">var ctr, doc, loc = window.location, max = 23, user = "remy";</code></pre>

<p>This should be taken as far as possible.  You can also consider whether you want to reuse variables to reduce the number you have to declare (watch out for inadvertently obfuscating your own code!).</p>

<h4>Minify is your friend</h4>

<p>Minify your code, and compare the benefit of Base62 encoding over shrinking variables.  I highly recommend <a href="http://dean.edwards.name/packer/" title="/packer/">Dean Edwards' Packer</a>.</p>

<h4>If it just doesn't fit...</h4>

<p>If you simply can't meet the length restrictions, you can load your bookmarklet externally (<a href="#injection">see below</a>).  However, if you do, make sure that you let your users see the source if they want to because your bookmarklet will have to act responsibly.</p>

<h3 id="installation">Installation</h3>

<p>Most browsers will allow the user to drag the bookmarklet to their bookmark bar - however, IE is slightly different.  To install in IE, you will need to right click on the link (that holds the bookmarklet) and add to favourites.  </p>

<h3 id="play_nice">Play Nice</h3>

<p>If you want your bookmarklet to interact with the existing page (rather than just redirecting off elsewhere), think about variable scope, in particular you may need to be careful not to overwrite existing variables.</p>

<h4>Encapsulate</h4>

<p>Rather than using <code>void</code> to run your bookmarklet, use the following:</p>

<pre><code class="prettyprint">javascript:(function(){ /* bookmarklet code */ })()</code></pre>

<p>Then when you declare your variables, they'll be within the private scope of the anonymous function.</p>

<h4>Style injection</h4>

<p>If supporting IE6, and you need to apply new styles, you'll have to set them directly on the element, rather than injecting a <code>link</code> tag. i.e.</p>

<pre><code class="prettyprint">element.style.display = 'none';</code></pre>

<h3 id="injection">Script Injection</h3>

<p>Using script injection is a perfectly legitimate way to get your code to run on the page when it's longer than 488 bytes.  </p>

<p>However, if your bookmarklet depends on external libraries (e.g. <a href="http://jquery.com">jQuery</a> or <a href="http://prototypejs.org">Prototype</a>) you need to be wary of race conditions if your code relies on these being in place <em>first</em>.</p>

<p>In this case, you need to use a test &amp; callback/load combo as shown below in <a href="#multiscript">multi-script inject</a>.</p>

<h4>Single script injection</h4>

<p>If you're only loading a single script that will execute or offer functionality when loaded, then the following will do fine (obviously all on one line):</p>

<pre><code class="prettyprint">javascript:(function () {
  var s=document.createElement('script');
  s.src='http://www.mysite.com/js/script.js';
  document.body.appendChild(s);
})();</code></pre>

<p>There's some argument to insert the script in to the <code>head</code> tag.  I disagree.  With bookmarklets like these, we're hijacking the web page, so perfect and semantic html doesn't have such a big play. I'd like to hear other people's thought on this.</p>

<h4 id="multiscript">Multi-script injection</h4>

<p>The following function is the best way I've found to inject an external script and continue once it's confirmed to have been loaded.</p>

<p><small>Note: this is the server side bookmarklet code.</small></p>

<pre><code class="prettyprint">function MyBookmarklet() {
  console.log('Testing whether jQuery is loaded (' + !!(typeof jQuery == 'function') + ')');

  if (waitingForScript('http://jquery.com/src/jquery-latest.js', 'jQuery')) return;

  console.log('Do some action with jQuery');
}

/**
* Only returns true when the external script has been loaded
* in to the DOM.  It uses arguments.callee.caller to work out
* which function is the callback.
*
* @param url {String} URL of external script
* @param obj {String} The name of a function or variable within
* the external script to test for.
* @license: Creative Commons License - 
*   ShareAlike http://creativecommons.org/licenses/by-sa/3.0/
* @author Remy Sharp / leftlogic.com
*/
function waitingForScript(url, obj) {
  function lateLoader(u,id,test,fn){            
    var d = document;
    if (!d.getElementById(i)) {
      var s = d.createElement('script');
      s.src = u;
      s.id = id;
      d.body.appendChild(s);
    }

    var timer = setInterval(function (){
      var ok = false;
      try {
        ok = t.call();
      } catch(e) {}

      if (ok) {
        clearInterval(timer);
        fn.call();
      }
    }, 10);
  }

  var callback = arguments.callee.caller;

  if ((typeof window[obj] == 'undefined') &amp;&amp; !window['loading' + obj]) {
    window['loading' + obj] = true;
    lateLoader(url, '_' + obj, function () {
      return (typeof window[obj] != 'undefined');
    }, callback);
    return true;
  } else if (typeof window[obj] == 'undefined') {
    return true;
  } else {
    return false;
  }
}</code></pre>

<h3 id="examples">Bookmarklet Examples</h3>

<p>Some personal favourites:</p>

<ul>
<li><a href="http://leftlogic.com/lounge/articles/microformats_bookmarklet/">Microformats</a> - displays Microformats on the page and allows individual download (IE, FF &amp; Safari)</li>
<li><a href="javascript:(function(){var q=document.createElement('script');q.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');document.body.appendChild(q)})()">jQueryify</a> - loads jQuery for console debugging</li>
<li><a href="javascript:(function(){var q=document.createElement('script');q.setAttribute('src', 'http://prototypejs.org/javascripts/prototype.js');document.body.appendChild(q)})()">Prototypeify</a> - loads Prototype for console debugging</li>
<li><a href="javascript:javascript:location.href='http://del.icio.us/post?v=4;url='+encodeURIComponent(location.href)+';title='+encodeURIComponent(document.title)">del.icio.us</a> - bookmarks a page on del.icio.us</li>
<li><a href="javascript:(function(){var%20h=document.getElementsByTagName('html');h[0].setAttribute('debug','true');if(!document.getElementById('_fb')){h=document.createElement('script');h.setAttribute('id','_fb');h.setAttribute('src','http://remysharp.com/wp-content/uploads/2007/03/firebug.js');document.body.appendChild(h);void(h);}else{void(window.console.open());}})()">Firebug</a> - dynamically loads Firebug Lite (IE + Safari)</li>
<li><a href="javascript:(function(){var a={},b=[],d=document,e,f,i,w=window,g={},v=(prompt('Ignore filter (comma sep)?','')||'').split(','),i=v.length,f=d.createElement('iframe');while(i--){g[v[i]]=1}for(v in window){a[v]={'type':typeof window[v],'val':window[v]}}f.style.display='none';d.body.appendChild(f);f.src='about:blank';f=f.contentWindow||f.contentDocument;for(v in a){if(typeof f[v] != 'undefined')delete a[v];else if(g[a[v].type])delete a[v]}e='addEventListener,document,location,navigator,window'.split(',');i=e.length;while(--i){delete a[e[i]]}console.dir(a)})()">Globals</a> - dumps global variables in Firebug console (FF only)</li>
<li><a href="javascript:s=window.getSelection().toString();window.location='http://wikipedia.com/wiki/'+s">Wikipedia</a> - takes a selection on the page and loads the wiki entry for it.</li>
</ul>
<a href="http://leftlogic.com/lounge/tag/bookmarklet" rel="tag">bookmarklet</a>, <a href="http://leftlogic.com/lounge/tag/javascript" rel="tag">javascript</a>, <a href="http://leftlogic.com/lounge/tag/microformats" rel="tag">microformats</a>, <a href="http://leftlogic.com/lounge/tag/tutorial" rel="tag">tutorial</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/articles/bookmarklet-coding/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tweaks to Microformats Bookmarklet</title>
		<link>http://leftlogic.com/lounge/news/tweaks-to-microformats-bookmarklet/</link>
		<comments>http://leftlogic.com/lounge/news/tweaks-to-microformats-bookmarklet/#comments</comments>
		<pubDate>Sun, 21 Oct 2007 23:31:59 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://leftlogic.com/lounge/news/tweaks-to-microformats-bookmarklet/</guid>
		<description><![CDATA[It's worth pointing out that there have been a couple of tweaks to the Microformats bookmarklet in the last few weeks.



The feature tweaks have been entirely down to feedback in the Microformats universe by Jeremy Keith.  

Here's a quick summary:


Using abbr to use more natural language when referencing the .fn - i.e. &#60;abbr class=&#34;fn&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>It's worth pointing out that there have been a couple of tweaks to the Microformats bookmarklet in the last few weeks.</p>

<p><a class="more" id="more-17"></a></p>

<p>The feature tweaks have been entirely down to feedback in the Microformats universe by <a href="http://adactio.com">Jeremy Keith</a>.  </p>

<p>Here's a quick summary:</p>

<ol>
<li>Using <code>abbr</code> to use more natural language when referencing the <code>.fn</code> - i.e. <code>&lt;abbr class=&quot;fn&quot; title=&quot;Joe Blogs&quot;&gt;Joe&lt;/abbr&gt;</code></li>
<li>The bookmarklet will now also delve in to iframes on the page, at any depth, and so long as the browser has permission to access the content, it will pull out the hCard - as seen on the <a href="http://maps.google.com/maps/user?uid=109330852418236875528">Google personalised map pages</a>.</li>
<li>Fixed a bug, that if the notes contained breaks it may not import the hCard correctly.</li>
<li>Fixed the URL length for IE6.</li>
</ol>

<p><a href="http://leftlogic.com/lounge/articles/microformats_bookmarklet/">Read more to add the Microformats Bookmarklet to your browser</a></p>
No Tags]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/news/tweaks-to-microformats-bookmarklet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Microformats Bookmarklet now for IE</title>
		<link>http://leftlogic.com/lounge/news/micrformats-bookmarket-for-ie/</link>
		<comments>http://leftlogic.com/lounge/news/micrformats-bookmarket-for-ie/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 02:36:23 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[News]]></category>
<category>dconstruct07</category><category>ie</category><category>microformats</category>
		<guid isPermaLink="false">http://leftlogic.com/lounge/news/micrformats-bookmarket-for-ie/</guid>
		<description><![CDATA[Since I am attending dConstruct this Friday, I thought it was time the Microformats Bookmarklet received an upgrade.



In particular, due to some key work by Mark McLaren and some steep learning on IE + JavaScript based CSS injection, you can now use the Microformats bookmarklet in IE6 and IE7 as you would in Safari and [...]]]></description>
			<content:encoded><![CDATA[<p>Since I am attending <a href="http://2007.dconstruct.org/">dConstruct</a> this Friday, I thought it was time the <a href="http://leftlogic.com/lounge/articles/microformats_bookmarklet/">Microformats Bookmarklet</a> received an upgrade.</p>

<p><a class="more" id="more-16"></a></p>

<p>In particular, due to some <a href="http://leftlogic.com/lounge/articles/microformats_bookmarklet/#comment-272">key work</a> by <a href="http://cse-mjmcl.cse.bris.ac.uk/blog/">Mark McLaren</a> and some steep learning on IE + JavaScript based CSS injection, you can now use the Microformats bookmarklet in IE6 and IE7 as you would in Safari and Firefox.</p>

<p>The only gripe I have is that I can't specify the filename that IE prompts for and it defaults to an HTML filename - so you need to name the file appropriately.  This said, I'm am looking at alternatives to this.</p>

<p>I've also had a chance to address a couple of bug that have been bothering me, in particular, the bookmarklet now works in the Microformat heavy site of <a href="http://adactio.com/journal/">Jeremy Keith: Overload of Microformats</a>, as you can see below:</p>

<p><img src="http://leftlogic.com/images/articles/microformats-at-adactio.jpg" alt="Microformats Bookmarklet in IE" title="" /></p>

<p>Here's the bookmarklet if you don't have it already:</p>

<p style="font-size: 150%;" ><a href="javascript:(function(){function%20l(u,i,t,b){var%20d=document;if(!d.getElementById(i)){var s=d.createElement('script');s.src=u;s.id=i;d.body.appendChild(s)}s=setInterval(function(){u=0;try{u=t.call()}catch(i){}if(u){clearInterval(s);b.call()}},200)}l('http://leftlogic.com/js/microformats.js','MF_loader',function(){return!!(typeof MicroformatsBookmarklet=='function')}, function(){MicroformatsBookmarklet()})})();">Microformats Bookmarklet</a></p>
<a href="http://leftlogic.com/lounge/tag/dconstruct07" rel="tag">dconstruct07</a>, <a href="http://leftlogic.com/lounge/tag/ie" rel="tag">ie</a>, <a href="http://leftlogic.com/lounge/tag/microformats" rel="tag">microformats</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/news/micrformats-bookmarket-for-ie/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Speech Bubbles</title>
		<link>http://leftlogic.com/lounge/articles/speech-bubbles/</link>
		<comments>http://leftlogic.com/lounge/articles/speech-bubbles/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 07:23:11 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[Articles]]></category>
<category>fun</category><category>javascript</category><category>jquery</category><category>speech bubbles</category>
		<guid isPermaLink="false">http://leftlogic.com/lounge/articles/speech-bubbles/</guid>
		<description><![CDATA[How many times have you looked at a photo on the Internet and wanted to add your own commentary with a speech bubble?

Now you can, to any picture on the Internet - and you can share it with friends, or even start your own competition if you like.



How to install &#38; demonstration

The following short video [...]]]></description>
			<content:encoded><![CDATA[<p>How many times have you looked at a photo on the Internet and wanted to add your own commentary with a speech bubble?</p>

<p>Now you can, to <strong>any</strong> picture on the Internet - and you can share it with friends, or even start your own competition if you like.</p>

<p><a class="more" id="more-15"></a></p>

<h3 id="how">How to install &amp; demonstration</h3>

<p>The following short video shows how to easily install speech bubbles, and how they work.  Once you've copied the link, you can then email the speech bubbles to your friends.</p>

<p class="centre">
<object width="528" height="330" type="application/x-shockwave-flash" data="/downloads/flvplayer.swf">
<param name="bgcolor" value="#FFFFFF" />
<param name="flashvars" value="file=/downloads/speech-bubble-demo.flv&#038;image=/images/articles/bubble-demo.jpg"/>
<param name="allowfullscreen" value="true"/>
</object>
</p>

<h3 id="install">Install speech bubbles</h3>

<p>To install, in Firefox and Safari, drag the link below to your bookmarks bar.  In Internet Explorer, right click and 'Add to favourites' and select 'Links'.</p>

<p style="font-size: 150%;" class="centre">&raquo; <a href="javascript:function ls(src,id,t,cb){if(!document.getElementById(id)){var s=document.createElement('script');s.src=src;s.id=id;document.body.appendChild(s)}var ct=setInterval(function(){var call=false;try{call=t.call()}catch(e){}if(call){clearInterval(ct);cb.call()}},100)}function ljq(cb){ls('http://jquery.com/src/jquery-latest.js','_jq',function(){return!!(typeof jQuery=='function')},cb)}function lb(cb){ls('http://leftlogic.com/js/bubble/bubble.js','_bubble',function(){return!!(typeof Bubbles=='function')},cb)}(function(){ljq(function(){lb(function(){var b=new Bubbles();b.create()})})})();">Speech Bubbles</a> &laquo;</p>

<p>Please note that currently, we are <strong>not</strong> storing the speech bubbles that are created.  The web sites that the bubble is created on could replicate the speech bubble (by checking through their referrer logs), but with larger web sites like <a href="http://flickr.com">Flickr</a> and <a href="http://facebook.com">Facebook</a> it would be extremely unlikely.</p>

<p>There are plans in the future to allow you to save a history of speech bubbles.</p>

<h3 id="usage">Usage</h3>

<p>The speech bubbles are very easy to use.  </p>

<ol>
<li>Click on the bookmarked link (from above) on the page you wish to add the speech bubble on to.</li>
<li>Move the speech bubble to the right place, by clicking and dragging.</li>
<li>Enter your text.</li>
<li>To share either click the 'copy' link and a link to the speech bubble is automatically created and copied to your clipboard - or - right click on the 'copy' link and manually copy to your clipboard.</li>
<li>To close, click the 'x'.</li>
</ol>

<p class="centre"><a href="http://tinyurl.com/2x3sw9"><img src="/images/articles/bubble-example.jpg" alt="Speech bubble example" height="139" width="517" /></a></p>

<h3 id="how-does-it-work">How does it work?</h3>

<p>The speech bubble is broken in to two sections.  The bookmarklet and the public speech bubble.</p>

<h4>Bookmarklet</h4>

<p>The bookmarklet firstly loads in <a href="http://jquery.com">jQuery</a> for simplified DOM access, then loads in the <a href="/js/bubble/bubble.js">speech bubble code</a>.  Once loaded it fires the creation function within the bubble code.</p>

<p>There are some security concerns that loading an external library could be considered a bad idea from the browsers point of view.  Originally I had designed the whole bubble code as a bookmarklet, but IE being the browser it is, doesn't support long strings as locations (lending weight to the idea that browsers just aren't supposed to do this kind of stuff).  </p>

<p>Anyone is welcome to host the <a href="/js/bubble/bubble.js">bubble.js</a> on their own server and change the link in the bookmarklet.</p>

<p>However, the natural upside of the file being loaded from Left Logic's servers, is that you will receive an automatic upgrade as features are extended or bugs are fixed.</p>

<h4>Public Speech Bubble</h4>

<p>Using the information in the URL, we load one large iframe containing the source URL, then load over the bubble, creating the effect that allows us to run our script on another web site.</p>

<h3 id="browsers">Compatibility</h3>

<p>The speech bubbles supports the latest versions of Internet Explorer, Safari, Firefox and Opera.</p>

<p>Internet Explorer 6 is not currently supported as it doesn't appear to load in the external scripts when required.  On going testing and development will aim to include IE6 if possible.</p>
<a href="http://leftlogic.com/lounge/tag/fun" rel="tag">fun</a>, <a href="http://leftlogic.com/lounge/tag/javascript" rel="tag">javascript</a>, <a href="http://leftlogic.com/lounge/tag/jquery" rel="tag">jquery</a>, <a href="http://leftlogic.com/lounge/tag/speech-bubbles" rel="tag">speech bubbles</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/articles/speech-bubbles/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Search for HTML character codes from your browser</title>
		<link>http://leftlogic.com/lounge/news/search-for-html-character-codes-from-your-browser/</link>
		<comments>http://leftlogic.com/lounge/news/search-for-html-character-codes-from-your-browser/#comments</comments>
		<pubDate>Thu, 28 Jun 2007 08:11:09 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[News]]></category>
<category>lookup</category><category>plugin</category><category>search</category><category>tool</category>
		<guid isPermaLink="false">http://leftlogic.com/lounge/news/search-for-html-character-codes-from-your-browser/</guid>
		<description><![CDATA[If you're using Firefox or IE7 then you can now search for HTML character codes directly from your browser.



Although your browser should automatically detect the search plugin, you can directly install the HTML character code search plugin.


$(function () {
    $('a.searchPluginLink').click(function () {
        try {
  [...]]]></description>
			<content:encoded><![CDATA[<p>If you're using Firefox or <abbr title="Internet Explorer">IE7</abbr> then you can now search for HTML character codes directly from your browser.</p>

<p><a class="more" id="more-14"></a></p>

<p>Although your browser should automatically detect the search plugin, you can directly install the <a class="searchPluginLink" href="http://leftlogic.com/lounge/articles/entity-lookup/?p=copy">HTML character code search plugin</a>.</p>

<script type="text/javascript" charset="utf-8">
$(function () {
    $('a.searchPluginLink').click(function () {
        try {
            window.external.AddSearchProvider('http://leftlogic.com/downloads/html-character-codes.xml');
        } catch (e) {
            alert("You need to be using IE7 or Firefox2 to add a search engine\r\nYou can also install search plugins by using the drop down menu to the right of the search box.");
        }
        return false;
    });
});
</script>
<a href="http://leftlogic.com/lounge/tag/lookup" rel="tag">lookup</a>, <a href="http://leftlogic.com/lounge/tag/plugin" rel="tag">plugin</a>, <a href="http://leftlogic.com/lounge/tag/search" rel="tag">search</a>, <a href="http://leftlogic.com/lounge/tag/tool" rel="tag">tool</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/news/search-for-html-character-codes-from-your-browser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updates to html character codes tool</title>
		<link>http://leftlogic.com/lounge/news/updates-to-html-character-codes-tool/</link>
		<comments>http://leftlogic.com/lounge/news/updates-to-html-character-codes-tool/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 16:52:18 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://leftlogic.com/lounge/news/updates-to-html-character-codes-tool/</guid>
		<description><![CDATA[Based on a number of requests the html character code lookup tool has seen a number of improvements since going live just less than two weeks ago.



The upgrades to the web front end include:


The ability to associate your own keywords or characters to a result.  This is stored in the cookie, so if you [...]]]></description>
			<content:encoded><![CDATA[<p>Based on a number of requests the <a href="http://leftlogic.com/lounge/articles/entity-lookup/">html character code lookup</a> tool has seen a number of improvements since going live just less than two weeks ago.</p>

<p><a class="more" id="more-13"></a></p>

<p>The upgrades to the web front end include:</p>

<ul>
<li>The ability to associate your own keywords or characters to a result.  This is stored in the cookie, so if you need to reset, simply clear the cookie out.</li>
<li>Copy the entity to your clipboard.</li>
<li>Optional output view to allow more items to appear above the fold.</li>
<li>The total number of matches displayed.</li>
<li>Support for the extended Latin entity block.</li>
<li>Partial matching - so you can search for 'cop', or 'copy' or 'copyrig' to match the copyright symbol.</li>
<li>The find and results code has been optimised to run a little faster during matches.</li>
</ul>

<p>The <a href="http://leftlogic.com/lounge/articles/entity-lookup/#widget">dashboard widget</a> hasn't been upgraded to support the custom keywords as yet, but it will do.  </p>

<p>We are also looking at supporting the widget as a <a href="http://widgets.yahoo.com/">Yahoo! widget</a> for PC users too - so keep an ear out.</p>
No Tags]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/news/updates-to-html-character-codes-tool/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HTML Entity Character Lookup</title>
		<link>http://leftlogic.com/lounge/articles/entity-lookup/</link>
		<comments>http://leftlogic.com/lounge/articles/entity-lookup/#comments</comments>
		<pubDate>Thu, 31 May 2007 12:02:53 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[Articles]]></category>
<category>dashboard</category><category>html</category><category>javascript</category><category>mac</category><category>tool</category><category>widget</category>
		<guid isPermaLink="false">http://leftlogic.com/lounge/articles/entity-lookup/</guid>
		<description><![CDATA[Using HTML entities is the right way to ensure all the characters on your page are validated.  However, often finding the right entity code requires scanning through 250 rows of characters.



This lookup allows you to quickly find the entity based on how it looks, e.g. like an &#60; or the letter c.

HTML Entity Lookup


 [...]]]></description>
			<content:encoded><![CDATA[<p>Using <abbr title="Hyper Text Markup Languge">HTML</abbr> entities is the right way to ensure all the characters on your page are <a href="http://validator.w3.org/check/referrer">validated</a>.  However, often finding the right entity code requires scanning through 250 rows of characters.</p>

<p><a class="more" id="more-12"></a></p>

<p>This lookup allows you to quickly find the entity based on how it looks, e.g. like an <a href="?q=&lt;" rel="&lt;" class="lookupExample">&lt;</a> or the letter <a href="?q=c" rel="c" class="lookupExample">c</a>.</p>

<h3 id="html_entity_lookup">HTML Entity Lookup</h3>

<form action="" id="lookupForm">
  <fieldset>
    <legend>Lookup</legend>
    <div class="floatL">
      <label for="s">HTML entities like, space separate for more:</label>
      <input type="text" name="s" value="" id="s" style="width: 360px;" />
    </div>
    <fieldset class="floatR">
      <legend>Options</legend>
      <input type="checkbox" name="compressChk" value="" id="compress" /> <label class="inline" for="compress">Small output</label>
      <div class="clear"></div>
      <input type="checkbox" name="extendedChk" value="" id="extended" /> <label class="inline" title="Include extended character sets in search" for="extended">Incl. extended</label>
      <!-- <label for="related" class="inline">Show related symbols?</label>
      <input type="checkbox" name="relatedChk" value="" id="related" /> -->
    </fieldset>
    <div class="clear"></div>
  </fieldset>
</form>

<div id="results"></div>

<script src="/js/entity-lookup/entities.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/entity-lookup/entity.data.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/highlightFade.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/entity-lookup/entity-lookup.js" type="text/javascript" charset="utf-8"></script>

<h3 id="widget">Dashboard Widget</h3>

<p><img src="/images/articles/entity-lookup.jpg" height="215" width="284" style="padding: 0 0 2px 0;" alt="Dashboard Widget Screenshot" title="HTML entity lookup widget" class="floatR" /></p>

<p>The HTML entity lookup is also available as a <a href="http://www.apple.com/macosx/dashboard/">Dashboard</a> widget.</p>

<p>The widget works in the same way the web version does, and does not require an Internet connection to function.</p>

<p>Clicking on the particular row will copy the html entity code to the clipboard.</p>

<p><a href="/downloads/entities.zip">Download the dashboard Entity Lookup widget</a></p>

<div class="clear"></div>

<h3 id="features">Features</h3>

<ul>
<li>Search for entity characters based on how they look (taken from the <a href="http://www.w3.org/TR/html401/sgml/entities.html">W3C list of entities</a>)</li>
<li>Switch between standard and compressed views</li>
<li>Copy the HTML entity to the clipboard</li>
<li>Add your own keyword terms and characters to entities</li>
<li>Settings stored in a browser cookie</li>
<li>Available to be <a class="searchPluginLink" href="/downloads/html-character-codes.xml">installed as a search plugin</a></li>
<li>Available as a <a href="http://www.yining.org/2007/07/26/html-entity-char-lookup-firefox-extension/">Firefox plugin</a> - thanks to <a href="#comment-1332">Yining</a></li>
</ul>

<script type="text/javascript" charset="utf-8">
<!--
$(function () {
    $('a.searchPluginLink').click(function () {
        try {
            window.external.AddSearchProvider('http://leftlogic.com/downloads/html-character-codes.xml');
        } catch (e) {
            alert("You need to be using IE7 or Firefox2 to add a search engine\r\nYou can also install search plugins by using the drop down menu to the right of the search box.");
        }
        return false;
    });
});
-->
</script>

<p>To reset the keywords, clear your cookies for this page and the default keyword dictionary.</p>

<h3 id="howitworks">How it Works</h3>

<p>The lookup searches the html entities for matches to the searched character based on how your character looks. For instance, the letter <a href="?q=c" rel="c" class="lookupExample">c</a> would match &copy; and &cent; entity, because of the way they look.</p>

<p>There's no clever logic behind this, only the most powerful computer known to man - man's own brain.</p>

<p>Each entity has had a list of 'like' matches added to them by hand and eye.  This is stored in a local dictionary file and loaded in during start-up (since it's so small there's no point in using an AJAX like solution).</p>

<p>The entity lookup also supports word searches and multiple searches space separated, such as <a rel="copy and cent" href="?q=copy%20and%20cent" class="lookupExample">copy and cent</a>.</p>

<p>Comments, feedback and suggestions are welcome.</p>
<a href="http://leftlogic.com/lounge/tag/dashboard" rel="tag">dashboard</a>, <a href="http://leftlogic.com/lounge/tag/html" rel="tag">html</a>, <a href="http://leftlogic.com/lounge/tag/javascript" rel="tag">javascript</a>, <a href="http://leftlogic.com/lounge/tag/mac" rel="tag">mac</a>, <a href="http://leftlogic.com/lounge/tag/tool" rel="tag">tool</a>, <a href="http://leftlogic.com/lounge/tag/widget" rel="tag">widget</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/articles/entity-lookup/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Design</title>
		<link>http://leftlogic.com/lounge/news/new-design/</link>
		<comments>http://leftlogic.com/lounge/news/new-design/#comments</comments>
		<pubDate>Sat, 12 May 2007 22:30:26 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://offline.leftlogic.com/info/news/new-design/</guid>
		<description><![CDATA[After months of dipping in and out of a redesign, and having a new logo designed back in 2006, Left Logic has finally received it's face lift.



The focus of the new design was to a) add the content that explains the services offered and show some of the recent work, and b) improve the readability [...]]]></description>
			<content:encoded><![CDATA[<p>After months of dipping in and out of a redesign, and having a new logo designed back in 2006, Left Logic has finally received it's face lift.</p>

<p><a class="more" id="more-8"></a></p>

<p>The focus of the new design was to a) add the content that explains the <a href="/services">services</a> offered and show some of the <a href="/portfolio">recent work</a>, and b) improve the readability of the <a href="/lounge/articles">articles</a> section.</p>

<p>Other particular areas that have been upgraded include:</p>

<ul>
<li>New print style sheet taking advantage of the full width of the page.</li>
<li>Large and normal font zoom in the header - with a touch of extra code, the logo also zooms cleanly.</li>
<li>Tags on the articles.</li>
<li>Comments support markdown.</li>
<li><a href="http://del.icio.us">del.icio.us</a> links that we think are noteworthy.</li>
</ul>

<p>Finally - if you notice <strong>any</strong> problems please drop a comment here or get in <a href="/contact">contact</a> and it will be looked in to as soon as possible.</p>
No Tags]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/news/new-design/feed/</wfw:commentRss>
		</item>
		<item>
		<title>del.icio.us-like Text Grow</title>
		<link>http://leftlogic.com/lounge/articles/auto_grow_text/</link>
		<comments>http://leftlogic.com/lounge/articles/auto_grow_text/#comments</comments>
		<pubDate>Tue, 28 Nov 2006 07:00:13 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[Articles]]></category>
<category>del.icio.us</category><category>javascript</category><category>jquery</category><category>plugin</category>
		<guid isPermaLink="false">http://offline.leftlogic.com/info/articles/delicious-like-text-grow/</guid>
		<description><![CDATA[If you're familiar with the del.icio.us tag search box, then you'll know it will grow with the length of the content you enter.

This is particularly useful for search boxes or tagging entry boxes, though the only downfall (I think) of del.icio.us's entry box is that it can grow to become wider than the entire page [...]]]></description>
			<content:encoded><![CDATA[<p>If you're familiar with the <a href="http://del.icio.us/remy.sharp">del.icio.us</a> tag search box, then you'll know it will grow with the length of the content you enter.</p>

<p>This is particularly useful for search boxes or tagging entry boxes, though the only downfall (I think) of del.icio.us's entry box is that it can grow to become wider than the entire page width.</p>

<p><a class="more" id="more-5"></a></p>

<p>I've written a <a href="http://jquery.com">jQuery</a> <a href="http://jquery.com/plugins">plugin</a> that plugs the same functionality in to any text box - but also includes the max-width limiting functionality.</p>

<p><a href="http://leftlogic.com/jquery/textgrow.js">Download textGrow</a></p>

<h3 id="example">Example</h3>

<script charset="utf-8" type="text/javascript" src="http://leftlogic.com/jquery/textgrow.js"></script>

<script charset="utf-8" type="text/javascript"> 
    $(function(){ jQuery("input.ctlTextGrowExample").textGrow({ pad: 25 }); }) 
</script>

<p>Search web site: <input type="text" class="ctlTextGrowExample" name="s" style="min-width: 25px; max-width: 250px; width: 25px;"/></p>

<h3 id="usage">Usage</h3>

<pre><code class="prettyprint">jQuery('input').textGrow({
  pad: 25, min_width: 25, max_width: 300
});</code></pre>

<ul>
<li>pad: trailing padding in pixels - default 25</li>
<li>min_width: minimum width of the text box in pixels</li>
<li>max_width: maximum width of the text box in pixels</li>
</ul>

<p>However, you don't need to pass the min and max width via the JavaScript, to offer even more flexibility this can be read through the <abbr title="Cascading Style Sheets">CSS</abbr> (and itâ€™s legal CSS too). This will be read from the style attribute, or the class definitions in the CSS.</p>

<p>You can use min-width and max-width to apply specific control to text boxes, for example:</p>

<pre><code class="prettyprint">&lt;input type=&quot;text&quot; 
  <b>style=&quot;min-width: 25px; max-width: 300px&quot;</b>
  name=&quot;s&quot; /&gt;</code></pre>

<h3 id="howitworks">How it Works</h3>

<p>Following in del.icio.us's example, when you type in to the text input box, behind the scenes an invisible (rather than hidden) is matching the content.</p>

<p>The width of that DIV is read in pixels and used to style the width of the input box.</p>

<p>If you have any comments, bugs or suggestions please drop me a comment below.</p>
<a href="http://leftlogic.com/lounge/tag/del.icio.us" rel="tag">del.icio.us</a>, <a href="http://leftlogic.com/lounge/tag/javascript" rel="tag">javascript</a>, <a href="http://leftlogic.com/lounge/tag/jquery" rel="tag">jquery</a>, <a href="http://leftlogic.com/lounge/tag/plugin" rel="tag">plugin</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/articles/auto_grow_text/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Quick and Dirty Intro to Perl Objects</title>
		<link>http://leftlogic.com/lounge/articles/perl_objects/</link>
		<comments>http://leftlogic.com/lounge/articles/perl_objects/#comments</comments>
		<pubDate>Sat, 18 Nov 2006 10:41:54 +0000</pubDate>
		<dc:creator>Remy Sharp</dc:creator>
		
		<category><![CDATA[Articles]]></category>
<category>beginner</category><category>object</category><category>OOP</category><category>perl</category>
		<guid isPermaLink="false">http://offline.leftlogic.com/info/articles/quick-and-dirty-intro-to-perl-objects/</guid>
		<description><![CDATA[Although I've been writing Perl for a long time, OO Perl (also known as Poop!) has been remained somewhat of a mystery to me.

On first inspection it doesn't resemble any typical OO language, but if you scratch a little under the surface, you'll see there's nothing really to them.



This tutorial assumes you have an understanding [...]]]></description>
			<content:encoded><![CDATA[<p>Although I've been writing Perl for a long time, OO Perl (also known as Poop!) has been remained somewhat of a mystery to me.</p>

<p>On first inspection it doesn't resemble any typical OO language, but if you scratch a little under the surface, you'll see there's nothing really to them.</p>

<p><a class="more" id="more-4"></a></p>

<p>This tutorial assumes you have an understanding of Perl and have a basic grasp of object orientated programming, but want a quick step introduction to Perl objects.</p>

<h3>Example Class</h3>

<p>If you know a little about OO, then you'll recognise pretty much all of this code with the exception of the new function.</p>

<pre><code class="prettyprint">use strict; # strict error handling

package MyClass; # the class name

sub new
{
  # get a reference to the object
  # class from the implicit @_ variable
  my $class = shift;

  # collect the parameters passed in via a hash
  my %params = @_;

  # bind the class methods and attributes
  # to $self using bless
  my $self = {};
  bless $self, $class;

  # arbitrary start up functions - always referring
  # to $self to change the state of our object
  $self-&gt;setValue(%params{&#39;value&#39;} || &#39;13&#39;);

  # return the reference to the object
  return $self;
}

# class methods
sub setValue
{
  my $self = shift; # reference to object instance
  $self-&gt;{&#39;my_value&#39;} = shift;
}

sub timesTen
{
  my $self = shift;
  return $self-&gt;{&#39;my_value&#39;} * 10;
}</code></pre>

<h3>Example Usage</h3>

<pre><code class="prettyprint">#!/usr/local/bin/perl
use strict;

# create a new instance of &#39;MyClass&#39;
my $obj = MyClass-&gt;new(value =&gt; 13);

# simple example of method execution
print $obj-&gt;timesTen();
print &quot; &quot;;

$obj-&gt;setValue(35);
print $obj-&gt;timesTen();
print &quot; &quot;;

# Output of script:
# &gt; 130
# &gt; 350</code></pre>

<h3>Conventions</h3>

<p>There's a few conventions used by Perl OO.</p>

<ol>
<li>Packages (aka class names) are written in title case with no underscores, e.g. MyReallyCoolClass. If the class resides in a sub directory, the naming conventions follow and the paths are separated by '::', e.g. GenericClasses::MyReallyCoolClass.</li>
<li>Perl uses $self as the reference that most people will know as 'this'.</li>
<li>To create a new object the call is generally:
<code>my $obj = MyClass-&gt;new();</code> rather than <code>my $obj = new MyClass;</code></li>
</ol>

<h3>Further Reading</h3>

<ul>
<li>Perl Objects on search.cpan.org</li>
<li>Perl function list by category</li>
<li>Object-oriented tutorial for perl: from the command line, type: perldoc perltoot</li>
</ul>
<a href="http://leftlogic.com/lounge/tag/beginner" rel="tag">beginner</a>, <a href="http://leftlogic.com/lounge/tag/object" rel="tag">object</a>, <a href="http://leftlogic.com/lounge/tag/oop" rel="tag">OOP</a>, <a href="http://leftlogic.com/lounge/tag/perl" rel="tag">perl</a>]]></content:encoded>
			<wfw:commentRss>http://leftlogic.com/lounge/articles/perl_objects/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
