<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Virtual Clouds &#187; code</title>
	<atom:link href="http://www.virtual-clouds.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.virtual-clouds.com</link>
	<description>Erlang and Other Animals</description>
	<lastBuildDate>Mon, 19 Jul 2010 17:42:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>everymark</title>
		<link>http://www.virtual-clouds.com/2009/11/112/everymark/</link>
		<comments>http://www.virtual-clouds.com/2009/11/112/everymark/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 21:41:30 +0000</pubDate>
		<dc:creator>ofer affias</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.virtual-clouds.com/?p=112</guid>
		<description><![CDATA[i have just finished writing my first google chrome extension. took my half a day overall, few of hours here and there, but compared to firefox the red-tape stuff was much easier. actually it is very simple, you make a new direcotry, and create &#8216;manifest.json&#8217; description file, it includes all of the extension official stuff, <a href='http://www.virtual-clouds.com/2009/11/112/everymark/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.virtual-clouds.com/wp-content/uploads/2009/11/everymark.png" alt="everymark" title="everymark" width="300" height="94" class="alignleft size-full wp-image-136" /> i have just finished writing my first google chrome extension. took my half a day overall, few of hours here and there, but compared to firefox the red-tape stuff was much easier.</p>
<p>actually it is very simple, you make a new direcotry, and create &#8216;manifest.json&#8217; description file, it includes all of the extension official stuff, like name, version, description and permissions. it also include pointers to other files &#8211; html and javascripts.</p>
<p>that&#8217;s it, from here it is plain web: html/css and javascript.</p>
<p>one thing worth mentioning is that if you change the manifest file you need to explicitly reload your extension on your chrome://extensions/ page, otherwise things like permissions are not updated. other stuff like html/javascript files are reloaded each time you invoke your extension, so no need to do nothing on this case.</p>
<p>what i was working on? well, long time ago i have found out that the old school method of cataloging things and then searching them by their location is not very effective, you pay a lot of time on the WRITE side and you pay as well on the READ side, using metaphor from the database world.</p>
<p>the search capability of <a href="http://www.voidtools.com/">everything</a> and <a href="/2009/10/64/sublime-text-the-vi-modern-alternative/">sublime text projects</a> are far better, just see all the database as one flat list and start filtering it by your search term. so that what i did on my bookmarks, and here is the result:</p>
<p><a href="https://chrome.google.com/extensions/detail/ccgmhgakppaknnnnbgkmpdlnpjokhcpb">everymark &#8211; &#8216;everything&#8217; search on my bookmark</a>.</p>
<p>when clicking the icon, a nice popup will appear, populated with a list of all your bookmarks and their links, whenever you start typing search terms the list will shrink to contain only the relevant bookmarks &#8211; neat <img src='http://www.virtual-clouds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; any way enjoy.</p>
<p><a href="http://www.virtual-clouds.com/wp-content/uploads/2009/11/everymark-screenshot.png"><img src="http://www.virtual-clouds.com/wp-content/uploads/2009/11/everymark-screenshot1-300x208.png" alt="everymark-screenshot" title="everymark-screenshot" width="300" height="208" class="alignnone size-medium wp-image-113" /></a></p>
<p>btw, for references about writing the extension i have use the following pages:</p>
<p><a href="http://code.google.com/chrome/extensions/devguide.html">http://code.google.com/chrome/extensions/devguide.html</a><br />
<a href="http://code.google.com/chrome/extensions/api_index.html">http://code.google.com/chrome/extensions/api_index.html</a><br />
<a href="http://code.google.com/chrome/extensions/tut_debugging.html">http://code.google.com/chrome/extensions/tut_debugging.html</a></p>
<p>* * *</p>
<p><strong>revisions:</strong></p>
<table class="my-basic">
<tbody>
<tr>
<td><a href="https://chrome.google.com/extensions/detail/ccgmhgakppaknnnnbgkmpdlnpjokhcpb">v1.8.3</a></td>
<td>startup speed improvements on favicons</td>
</tr>
<tr>
<td><a href="/share/everymark-1.8.2.crx">v1.8.2</a></td>
<td>fixed selection bug on v1.8.1</td>
</tr>
<tr>
<td><a href="/share/everymark-1.8.1.crx">v1.8.1</a></td>
<td>un-obfuscated  </td>
</tr>
<tr>
<td><a href="/share/everymark-1.8.crx">v1.8</a></td>
<td>show full URL as tooltip on hover</td>
</tr>
<tr>
<td><a href="/share/everymark-1.7.1.crx">v1.7.1</a></td>
<td>show full URL as tooltip on hover</td>
</tr>
<tr>
<td><a href="/share/everymark-1.7.crx">v1.7</a></td>
<td>show sites&#8217; favicons</td>
</tr>
<tr>
<td><a href="/share/everymark-1.6.1.crx">v1.6.1</a></td>
<td>better visualization on deletion of bookmark</td>
</tr>
<tr>
<td><a href="/share/everymark-1.6.crx">v1.6</a></td>
<td>sort by date, double click to open, tooltip on extension icon</td>
</tr>
<tr>
<td><a href="/share/everymark-1.5.1.crx">v1.5.1</a></td>
<td>filter bookmarklets (thanks to Darío Macchi), better context menu</td>
</tr>
<tr>
<td><a href="/share/everymark-1.5.crx">v1.5</a></td>
<td>columns can be sorted, revised context menu</td>
</tr>
<tr>
<td><a href="/share/everymark-1.4.crx">v1.4</a></td>
<td>added context menu (right click) with option to delete bookmark</td>
</tr>
<tr>
<td><a href="/share/everymark-1.3.1.crx">v1.3.1</a></td>
<td>filter groups/folders from the list</td>
</tr>
<tr>
<td><a href="/share/everymark-1.3.crx">v1.3</a></td>
<td>wraps row selection on table edges</td>
</tr>
<tr>
<td><a href="/share/everymark-1.2.1.crx">v1.2.1</a></td>
<td>supports auto-update</td>
</tr>
<tr>
<td><a href="/share/everymark-1.2.crx">v1.2</a></td>
<td>supports multiple search terms (space separated)</td>
</tr>
<tr>
<td><a href="/share/everymark-1.1.crx">v1.1</a></td>
<td>supports manual selection with arrow keys and launching with enter key</td>
</tr>
<tr>
<td><a href="/share/everymark-1.0.2.crx">v1.0.2</a></td>
<td>few minor fixes</td>
</tr>
<tr>
<td><a href="/share/everymark-1.0.1.crx">v1.0.1</a></td>
<td>added extension icons</td>
</tr>
<tr>
<td><a href="/share/everymark-1.0.crx">v1.0</a></td>
<td>initial release</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.virtual-clouds.com/2009/11/112/everymark/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>perl one liners = magic</title>
		<link>http://www.virtual-clouds.com/2009/10/81/magic-perl-one-liners/</link>
		<comments>http://www.virtual-clouds.com/2009/10/81/magic-perl-one-liners/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 22:41:24 +0000</pubDate>
		<dc:creator>ofer affias</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.virtual-clouds.com/?p=81</guid>
		<description><![CDATA[a word about the power of unix shell commands: perl one liners, i.e. one line of perl that can save you hours of error-prone hand changes. when i want to do some massive changes in my code this is what i use. say you need replcae a record name from abc_record to xyz_record, first if <a href='http://www.virtual-clouds.com/2009/10/81/magic-perl-one-liners/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.virtual-clouds.com/wp-content/uploads/2009/10/perl-150x150.jpg" alt="perl" title="perl" width="150" height="150" class="alignleft size-thumbnail wp-image-89" />a word about the power of unix shell commands: perl one liners, i.e. one line of <a href="http://www.perl.org/">perl</a> that can save you hours of error-prone hand changes. when i want to do some massive changes in my code this is what i use.</p>
<p>say you need replcae a record name from abc_record to xyz_record, first if you use perl recursivlly it will touch all files and revision control will makr them for commit. you don&#8217;t want that. so use grep to filter the relevant files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;#abc_record\b&quot;</span> . <span style="color: #660033;">-rl</span></pre></div></div>

<p>next, do the replace:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-pe</span> s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">&quot;#abc_record\b&quot;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">&quot;xyz_record&quot;</span><span style="color: #000000; font-weight: bold;">/</span>g <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;#abc_record\b&quot;</span> src -rl<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>note the use of \b to mark a word boundary.</p>
<p>a more complex replace is if you need to change the code from using a record to use a wrapper function. so for exmaple we have the record:</p>

<div class="wp_syntax"><div class="code"><pre class="erlang" style="font-family:monospace;"><span style="color: #014ea4;">-</span><span style="color: #5400b3;">record</span><span style="color: #109ab8;">&#40;</span><span style="color: #d400ed;">abc_record</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#123;</span>fld<span style="color: #109ab8;">&#125;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span></pre></div></div>

<p>and we want to start use a wrapper module:</p>

<div class="wp_syntax"><div class="code"><pre class="erlang" style="font-family:monospace;"><span style="color: #014ea4;">-</span><span style="color: #5400b3;">module</span><span style="color: #109ab8;">&#40;</span>rtools<span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
<span style="color: #014ea4;">-</span><span style="color: #5400b3;">export</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span>fld<span style="color: #014ea4;">/</span><span style="color: #ff9600;">1</span><span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">fld</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">R</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #45b3e6;">R</span><span style="color: #ff9600;">#</span><span style="color: #d400ed;">abc_record</span><span style="color: #6bb810;">.</span>fld<span style="color: #6bb810;">.</span></pre></div></div>

<p>so we can do it instantly like that:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-pe</span> s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">&quot;\b(\w+)#abc_record\.fld&quot;</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">&quot;rtools:fld(\1)&quot;</span><span style="color: #000000; font-weight: bold;">/</span>g <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;#abc_record\.fld&quot;</span> src -rl<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>here we have switched from using A#abc_record.fld to record_tools:fld(A)</p>
<p>another trick is to remove complete lines (!), so for exmaple you can get rid of all the -compile(export_all) you have fullishly inserted into your code:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-nle</span> <span style="color: #ff0000;">'print if !/-compile\(export_all\)/'</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">grep</span> export_all src -rl<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>one safty tip, omit the -i first to try before you actuall change files.</p>
<p>this was just a learn-by-example, more info can be found at:<br />
<a href="http://sial.org/howto/perl/one-liner">http://sial.org/howto/perl/one-liner</a><br />
<a href="http://www.unixguide.net/unix/perl_oneliners.shtml">http://www.unixguide.net/unix/perl_oneliners.shtml</a>	</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtual-clouds.com/2009/10/81/magic-perl-one-liners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
