<?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>roachfiend.com &#187; tutorials</title>
	<atom:link href="http://roachfiend.com/archives/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://roachfiend.com</link>
	<description>firefox extension development</description>
	<lastBuildDate>Wed, 11 Aug 2010 21:00:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to write Google Chrome extensions</title>
		<link>http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/</link>
		<comments>http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 21:37:12 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/</guid>
		<description><![CDATA[Google Chrome is the latest browser to let users add, edit and contribute their own coding efforts. Extensions or plugins are what makes web browsers so handy and extendable. Firefox users have long known this&#8211; Google Chrome&#8217;s extension capabilities are so far not as well known, but hopefully will soon have a synergistic effect on [...]]]></description>
			<content:encoded><![CDATA[<p>Google Chrome is the latest browser to let users add, edit and contribute their own coding efforts. Extensions or plugins are what makes web browsers so handy and extendable. Firefox users have long known this&#8211; Google Chrome&#8217;s extension capabilities are so far not as well known, but hopefully will soon have a synergistic effect on both applications. More publicity for competing products ensures a wide array of choices.</p>
<p>Google has their own &#8220;Getting Started&#8221; tutorial which is extremely helpful. You can get your feet wet here:</p>
<p><a href="http://code.google.com/chrome/extensions/getstarted.html">http://code.google.com/chrome/extensions/getstarted.html</a></p>
<p>Note that at this point, you will need the Developer version of Chrome. You can grab it here:</p>
<p><a href="http://www.chromium.org/getting-involved/dev-channel">http://www.chromium.org/getting-involved/dev-channel</a></p>
<p>Structure</p>
<p>The Chrome extension&#8217;s backbone is the manifest file. Specifically, manifest.js. It describes what will be packaged in the extension and describes the name, a brief description, whatever explicit permissions you grant it, and other details. The fields in full are described here:</p>
<p><a href="http://code.google.com/chrome/extensions/manifest.html">http://code.google.com/chrome/extensions/manifest.html</a></p>
<p>The most basic Chrome extension only requires a manifest.js file and another javascript file. For this tutorial, we will use a pre-existing Firefox extension, which is a very basic one- Allow Right Click. This is simply a file that prevents attempts to inhibit the context menu from activating. This is seen on some web sites as a protection scheme of sorts, to try and prevent a user from saving an image or viewing the source. You can get around either of those by simply viewing the cache, but it does come in handy sometimes.</p>
<p>You can test out the effectiveness of the scripts here:</p>
<p><a href="http://www.dynamicdrive.com/dynamicindex9/noright.htm">http://www.dynamicdrive.com/dynamicindex9/noright.htm</a><br />
<a href="http://www.dynamicdrive.com/dynamicindex9/noright2.htm">http://www.dynamicdrive.com/dynamicindex9/noright2.htm</a><br />
<a href="http://www.dynamicdrive.com/dynamicindex9/noright3.htm">http://www.dynamicdrive.com/dynamicindex9/noright3.htm</a></p>
<p>Function</p>
<p>Here is the bypass script in its entirety:<br />
<code><br />
void(document.ondragstart=null);<br />
void(document.oncontextmenu=null);<br />
void(document.onselectstart=null);<br />
void(document.onclick=null);<br />
void(document.onmousedown=null);<br />
void(document.onmouseup=null);<br />
void(document.onbeforecopy=null);<br />
void(document.onbeforecut=null);<br />
void(document.oncopy=null)<br />
</code><br />
Save this in a file by itself as <b>rightclick.js</b>.<br />
This issues a series of null statements that will &#8220;void out&#8221; attempts to manipulate your context menu. The manifest file for this particular extension is below, which you can save as <b>manifest.js</b>, editing it as desired:</p>
<p><code><br />
{<br />
   &quot;authors&quot;: [ {<br />
      &quot;email&quot;: &quot;ehamiter@gmail.com&quot;,<br />
      &quot;name&quot;: &quot;Eric Hamiter&quot;<br />
   } ],<br />
   &quot;content&#95;scripts&quot;: [ {<br />
      &quot;js&quot;: [ &quot;rightclick.js&quot; ],<br />
      &quot;matches&quot;: [ &quot;http://*/*&quot; ]<br />
   } ],<br />
   &quot;description&quot;: &quot;Bypass right-click prohibited pages.&quot;,<br />
   &quot;homepage&quot;: &quot;http://erichamiter.com&quot;,<br />
   &quot;update_url&quot;: &quot;http://erichamiter.com/chrome/updates.xml&quot;,<br />
   &quot;name&quot;: &quot;Allow Right Click&quot;,<br />
   &quot;version&quot;: &quot;1.0&quot;<br />
}<br />
</code></p>
<p>The first part is self-evident. The matches section will match any web page- in this case that is precisely what we want. In some cases, though, if you only want it to activate on certain pages, you can limit it here. </p>
<p>As of now, you cannot use a wildcard domain for the <em>matches</em> section- say, images.google.*. This would be very handy instead of matching images.google.com, images.google.co.uk, et cetera. You can get around this limitation by using a javascript trick in your script:</p>
<p><code><br />
if (location.hostname.indexOf("images.google.") == 0) {</p>
<p><em>script here</em></p>
<p>}<br />
</code></p>
<p>You&#8217;ll also notice an update section. This works the same as a Firefox extension- it checks an xml file on your server to see if there is a newer version. The updates.xml relevant section on my server is below:</p>
<p><code><br />
&lt;gupdate protocol="2.0"&gt;<br />
&lt;app appid="fhbfcblhfgbemciedggloeeekecmlhcf"&gt;<br />
&lt;updatecheck codebase="http://erichamiter.com/chrome/allowrightclick.crx" version="1.0"/&gt;<br />
&lt;/app&gt;<br />
&lt;/gupdate&gt;<br />
</code></p>
<p>The app appid is generated by Chrome after you package the extension, which I will describe in a bit.</p>
<p>So, we have rightclick.js and manifest.js. Put both of these files in a single folder, named appropriately- &#8220;allowrightclick&#8221; or something similar. Simple is the best option.</p>
<p>In your Chrome browser, type in this address:</p>
<p><a href="chrome://extensions/">chrome://extensions/</a></p>
<p>Or alternatively, click on the wrench icon and select Extensions. You should see a screen similar to this one:</p>
<p><img src="http://roachfiend.com/images/extension-screen.png" alt="Extension screen" /></p>
<p>Toggle the developer mode selection, and you should see these choices: Load unpacked extension, Pack extension, Update extensions now.</p>
<p><img src="http://roachfiend.com/images/extension-screen-2.png" alt="Extension screen choices" /></p>
<p>For now, we want the first option: Load unpacked extension. Select it and it will prompt you for the location of your files. Select your folder and hit ok. I wound up with this (your ID will be random and unique, just like you):</p>
<p><img src="http://roachfiend.com/images/extension-screen-3.png" alt="Allow Right Click unpacked" /></p>
<p>Now try out the previous test sites and see if it&#8217;s working:</p>
<p><a href="http://www.dynamicdrive.com/dynamicindex9/noright.htm">http://www.dynamicdrive.com/dynamicindex9/noright.htm</a><br />
<a href="http://www.dynamicdrive.com/dynamicindex9/noright2.htm">http://www.dynamicdrive.com/dynamicindex9/noright2.htm</a><br />
<a href="http://www.dynamicdrive.com/dynamicindex9/noright3.htm">http://www.dynamicdrive.com/dynamicindex9/noright3.htm</a></p>
<p>If you can successfully right-click and get a menu, it&#8217;s working! So, to pack up the extension as a bona-fide Chrome extension, you just visit your extension page again, and select &#8220;Pack extension.&#8221; Select the previous folder, and it will prompt you for the extension root and directory and an optional private key:</p>
<p><img src="http://roachfiend.com/images/extension-screen-4.png" alt="Allow Right Click packed" /></p>
<p>Select your directory again, and you do not need the private key file. If you edit or update the extension, then you can add the private key file which will generate in a moment, and then future updates will retain the same ID.</p>
<p>Chrome will pop up an alert box reminding you that you should keep your key safe:</p>
<p><img src="http://roachfiend.com/images/extension-screen-5.png" alt="Extension safety" /></p>
<p>It saves the two files (extension.crx and extension.pem) in the parent folder of your working extension directory. The .crx file is your new Chrome extension, ready to distribute and to be added to any Beta or Developer version of Chrome. The .pem file is your personal key file and you should keep it safe somewhere. This will be needed to update the file to maintain the same ID.</p>
<p>To test out the new file, uninstall your unpacked extension, and open your .crx file with Chrome. Control-O will open a file; navigate to your .crx file; hit continue, then install. You should get a notice that it has installed successfully.</p>
<p>There are a few different places for trying out new extensions:</p>
<p><a href="https://chrome.google.com/extensions">https://chrome.google.com/extensions</a><br />
<a href="http://www.chromeextensions.org/">http://www.chromeextensions.org/</a><br />
<a href="http://www.chromeplugins.org">http://www.chromeplugins.org</a></p>
<p>There are a small but steadily growing number of cool Chrome extensions out there. Create one today and let the world know about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Hack the crap out of Firefox for some useful error pages</title>
		<link>http://roachfiend.com/archives/2006/08/20/hack-the-crap-out-of-firefox-for-some-useful-error-pages/</link>
		<comments>http://roachfiend.com/archives/2006/08/20/hack-the-crap-out-of-firefox-for-some-useful-error-pages/#comments</comments>
		<pubDate>Sun, 20 Aug 2006 05:38:29 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/archives/2006/08/20/hack-the-crap-out-of-firefox-for-some-useful-error-pages/</guid>
		<description><![CDATA[I tried to get this to work in an extension, but it ain&#8217;t happening. Update! It is now a working extension, mostly thanks to Nick, developer of InfoLister, and master of jedi XUL tricks. I&#8217;ll leave the original article as below for informational purposes. How useful is the current error page for Firefox? I&#8217;ll answer [...]]]></description>
			<content:encoded><![CDATA[<p><!--nevermore-->I tried to get this to work in an extension, but it ain&#8217;t happening.</p>
<p><b>Update!</b> It is now <a href="http://roachfiend.com/archives/2006/08/28/errorzilla-useful-error-pages-for-firefox/">a working extension</a>, mostly thanks to Nick, developer of <a href="http://mozilla.doslash.org/infolister/" rel="nofollow" target="_blank">InfoLister</a>, and master of jedi XUL tricks. I&#8217;ll leave the original article as below for informational purposes.</p>
<p><span id="more-52"></span></p>
<p>How useful is the current error page for Firefox? I&#8217;ll answer for you: not very. You have the option of trying again, which will do nothing for you 99 times out of 100. It&#8217;s a glorified reload button, except smaller and located lower. Do you ever even hit the thing? I don&#8217;t- it&#8217;s basically as useless as the screen from Internet Explorer telling you to ask your system administrator what just happened. So, I decided to spruce it up a bit.</p>
<p>Most of the time, if I run across a page that should be there but isn&#8217;t, I&#8217;d like to run a few tests on it- a trace route, a whois search or maybe ping the place. Another thing I&#8217;d like to do is see if there&#8217;s an entry in the wayback machine. The last but usually most useful is looking at google&#8217;s cache of the page. I&#8217;ve implemented all of these on this hack, as well as a superfluous use of <a href="http://meyerweb.com/eric/css/edge/complexspiral/demo.html" rel="nofollow" target="_blank">Eric Meyer&#8217;s CSS Complexspiral technique</a>.</p>
<p>To pull this off on your own, you need a vague understanding of Firefox&#8217;s structure, a text editor, and an archival program, used to compress things into zip files. Oh yeah, you&#8217;ll need these files (right-click, save as):</p>
<ul>
<li><a href="http://roachfiend.com/mozilla1.gif">mozilla1.gif</a></li>
<li><a href="http://roachfiend.com/mozilla2.gif">mozilla2.gif</a></li>
<li><a href="http://roachfiend.com/netError.xhtml">netError.xhtml</a></li>
</ul>
<p>I&#8217;m going to make a couple of assumptions, because it makes it easier on me, which is the imprtant thing. I&#8217;m assuming you&#8217;re going to use windows of some sort. Mac users can do this too, but I&#8217;m not sure exactly where all the files are you&#8217;ll need to wade through to do this. It may involve opening up some packages or something else that should be less confusing than it is. I&#8217;m also going to assume you know what Firefox is, since you&#8217;re going to be delving around under the hood of it.</p>
<p>Before you start, you will have to close Firefox. We&#8217;re going to be working on files that it uses in real-time. Read this article in its entirety before doing anything, then copy this post and paste it into your text editor.</p>
<p>Next, make backups of all of your files you might cry yourself to sleep over if you lost them. Cookies, bookmarks, extensions, etcetera. How you do this will not be discussed at the moment. Google usually knows all about <a href="http://www.google.com/search?hl=en&#038;pwst=1&#038;sa=X&#038;oi=spell&#038;resnum=0&#038;ct=result&#038;cd=1&#038;q=backup+firefox+extensions+bookmarks&#038;spell=1" rel="nofollow" target="_blank">things like that</a>. Next, navigate to your Firefox directory in your Program Files folder.</p>
<p>Under your <strong>Mozilla Firefox</strong> folder, you should see a folder called <strong>chrome</strong>. Take note of the file <code>toolkit.jar</code>. This is what we&#8217;re going to be concerned with. Make a backup of this file in case something goes awry. Put it in a safe, warm place, like your desktop, or in some archival folder. Now, rename the original <code>toolkit.jar</code> to <code>toolkit.zip</code>. Windows will ask if you really want to do that- say yes. Now unzip that file in the current directory. This should create a folder named <strong>toolkit</strong>. </p>
<p>Navigate through your directory as such:</p>
<p><strong>\toolkit\content\global</strong></p>
<p>Rename the file <code>netError.xhtml</code> to <code>netError.bak</code>. Save those three files from eariler (the two .gif files and the .xhtml file) into this directory. Take a look through the .xhtml file with a text editor and you can see how the page is laid out, and modify anything you like. This isn&#8217;t necessary, but it can give you an idea of what is actually going on behind the scenes.</p>
<p>Once those files are saved, navigate back up the directory tree to the <strong>toolkit</strong> level. This is the only tricky step in the process. You want to re-zip everything back up: only from <strong>content</strong> on. You don&#8217;t want the actual <strong>toolkit</strong> folder in this archive. I have it so I can right-click on a folder in windows explorer and invoke my archival program, but yours may vary. </p>
<p><strong>Important note:</strong> If you use WinRar, you <em>must</em> select &#8220;zip&#8221; as the archival type. A &#8220;rar&#8221; compression will corrupt the package and it will not work.</p>
<p>After the zipped file is created, rename it to <code>toolkit.jar</code>. Windows again will ask if you really want to do that- say yes. Now move it into the <strong>Mozilla Firefox/chrome</strong> folder, overwriting your original file.</p>
<p>That&#8217;s it- you&#8217;re done. Now you can have some marginally useful error pages, along with the benefit of looking underneath the hood of the Firefox engine. Don&#8217;t be afraid to poke around in there, you never know when you&#8217;ll come across something interesting.</p>
<p>Take note that if you update your browser, this file will disappear again, so make backups just as you would with anything else. I hope this has been handy for a couple of you out there. Feel free to comment on any other &#8220;hard&#8221; hacks that prove useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2006/08/20/hack-the-crap-out-of-firefox-for-some-useful-error-pages/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>If you happen to have a Linksys WRT54G wireless router&#8230;</title>
		<link>http://roachfiend.com/archives/2006/01/02/if-you-happen-to-have-a-linksys-wrt54g-wireless-router/</link>
		<comments>http://roachfiend.com/archives/2006/01/02/if-you-happen-to-have-a-linksys-wrt54g-wireless-router/#comments</comments>
		<pubDate>Mon, 02 Jan 2006 18:43:21 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/?p=40</guid>
		<description><![CDATA[&#8230;and you use an alternative firmware, say, DD-WRT, and you tend to have to reset your modem and router a lot, then I have a possible fix for you. If you don&#8217;t know what the hell it is I&#8217;m talking about, then let me explain. If you have the router in question: &#8230;and the version [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;and you use an alternative firmware, say, <a href="http://www.dd-wrt.com/">DD-WRT</a>, and you tend to have to reset your modem and router a lot, then I have a possible fix for you. If you don&#8217;t know what the hell it is I&#8217;m talking about, then let me explain.</p>
<p>If you have <a href="http://www.amazon.com/gp/redirect.html?link_code=ur2&#038;tag=roachfiendcom-20&#038;camp=1789&#038;creative=9325&#038;location=%2FLinksys-Cisco-WRT54GL-Wireless-G-Broadband-Compatible%2Fdp%2FB000BTL0OA%2Fsr%3D1-1%2Fqid%3D1157685645%2Fref%3Dpd_bbs_1%3Fie%3DUTF8%26s%3Delectronics" target="_blank">the router in question:</a> </p>
<p><script type="text/javascript"><!--
auctionads_ad_client = "69bb40015f78ded43a6d";
auctionads_ad_campaign = "09c94eb3896a21cbcde17e414ba16db1";
auctionads_ad_width = "234";
auctionads_ad_height = "60";
auctionads_ad_kw =  "wrt54g";
auctionads_color_border =  "ffffff";
auctionads_color_bg =  "f7f8fb";
auctionads_color_heading =  "c00c00";
auctionads_color_text =  "333333";
auctionads_color_link =  "c00c00";
--></script><br />
<script type="text/javascript" src="http://ads.auctionads.com/pagead/show_ads.js">
</script></p>
<p>&#8230;and <a href="http://www.linksysinfo.org/modules.php?name=Forums&#038;file=viewtopic&#038;t=10230">the version number of it is 1-4</a>, then you can upgrade the firmware in it to a <a href="http://www.linksysinfo.org/modules.php?name=Content&#038;pa=showpage&#038;pid=31">3rd-party one</a>, which will allow you to configure a bunch of things that you were previously not able to. This is a cool thing, because you can fine-tune your setup, and add in other features like static DHCP leases. That means, for example, that you can always assign the same IP address to one of your laptops so you can keep your <a href="http://en.wikipedia.org/wiki/Port_forwarding">port forwarding</a> options on it the same, but if you take your laptop down the road to Joe&#8217;s Wi_Fi spot, it will automatically grab it without you having to re-configure anything. It&#8217;s handy.</p>
<p>So, once you do it, because of the new options and wonderful toys, your once-stable connection might be dropping in and out a bit more than you would like. Some of the default settings on DD-WRT were not getting along with my modem at all. So much, in fact, that it made me question the modem&#8217;s general health, so I replaced it with a newer one. Same problems! So after scouring the internet for other people suffering from my connection&#8217;s problems, here&#8217;s a cluster of things I changed which resulted in a very solid configuration, and I have had zero dropped connections since, where they used to be one per every few hours.</p>
<p> µTorrent has <a href="http://www.utorrent.com/faq.php#Special_note_for_users_with_Linksys_WRT54G_GL_GS_routers">a tip to help:</a></p>
<blockquote><p>
<b>Special note for users with Linksys WRT54G/GL/GS routers, there are severe problems with them when running any P2P app (read for fix)</b><br \><br />
<br />
The default firmware for Linksys (and all replacement firmwares except for one) have a severe problem where they track old connections for FIVE days, which causes the router to hang when using P2P apps, or any software that generates a lot of connections. DHT only aggravates the situation because of the number of connections it generates.<br \><br />
<br />
Linksys has yet to address this issue, but there is a fix. If you use alternative firmware, you can put in a start-up script to fix this problem. DD-WRT and HyperWRT support custom start-up scripts. I am not responsible if you screw up your router, so you do this at your own risk. This page has instructions on recovering a bricked router.
</p></blockquote>
<p>
I&#8217;ll walk you through how to do it with DD-WRT- the page has instructions for both DD-WRT and HyperWRT if you run that one instead. Note that these are my settings and are working great for me, which means that it probably will be for you too, but I can&#8217;t guarantee it. I advise you to <a href="http://www.wi-fiplanet.com/tutorials/article.php/3562391">do some more research about doing this</a> if I&#8217;ve said at least one thing that you&#8217;re not toally sure about. <br \><br />
<br />
Go to <i>Admin</i> > <i>Services</i> and choose to enable SSHD. Save settings.<br />
Download <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">putty.exe</a> if you don&#8217;t have it, and run it.</p>
<p>For host name, put in your router&#8217;s IP address. The default is 192.168.1.1. Leave the port at 22, and make sure the protocol is SSH. Hit open.<br />
Login as <b>root</b>.<br />
<i>root@192.168.x.x&#8217;s password</i> is your router&#8217;s password. If you&#8217;ve never changed it from the default setting, it&#8217;s <b>admin</b>.</p>
<p>At the <b>~ #</b> prompt, enter the following (copy and paste one line at a time by copying a line below, then pasting it into putty by right clicking on putty&#8217;s screen, and hitting enter after each line):<br \></p>
<pre>
nvram set rc_startup="
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo '600 1800 120 60 120 120 10 60 30 120' > /proc/sys/net/ipv4/ip_conntrack_tcp_timeouts
"
</pre>
<p>Then you&#8217;ll be back to the <b>~ #</b> prompt. Type in </p>
<pre>
nvram commit
reboot
</pre>
<p>Then the system will tell you <i>The system is going down NOW !! Sending SIGTERM to all processes.</i>That&#8217;s fine. Once it reboots, you can close putty and go to your web management console.<br />
<br />
Go to your <i>Management</i> tab, and scroll down to <b>IP Filter Settings</b>. Change the <i>Maximum Ports</i> value to <b>4096</b> and the <i>TCP</i> and <i>UDP</i> to <b>300</b> each. Save settings.<br />
Go to  the <i>Setup</i> tab, and under <i>Basic Setup</i>, note the <b>STP</b> setting. If you have Comcast cable, disable this. <br />
Under optional settings, the <b>MTU size</b> is set to <i>auto</i>. Change it to <i>manual</i> and enter <b>1392</b>. <br />
Go to the <i>Wireless</i> tab, and then select the subheader <I>Adavnced Settings</i>. Change the <b>Xmit Power</b> to <b><strike>200</strike></b> <b>80</b>.</p>
<p>Again, these are my settings and they work well for me. I will not take responsibility if you accidentally destroy your router trying to update it. Those that feel comfortable doing some thing like this, I urge you to try it out, it&#8217;s a noticeable increase in performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2006/01/02/if-you-happen-to-have-a-linksys-wrt54g-wireless-router/feed/</wfw:commentRss>
		<slash:comments>80</slash:comments>
		</item>
		<item>
		<title>Update your extensions&#8217; maxVersion with perl</title>
		<link>http://roachfiend.com/archives/2005/12/02/update-your-extensions-maxversion-with-perl/</link>
		<comments>http://roachfiend.com/archives/2005/12/02/update-your-extensions-maxversion-with-perl/#comments</comments>
		<pubDate>Sat, 03 Dec 2005 00:48:35 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/?p=39</guid>
		<description><![CDATA[Whenever a new version of Firefox comes out, there are invariably a few extensions that won&#8217;t work with it. Not because the extension&#8217;s functionality is no longer suited, but because of a value that is set too low- the maxVersion. That tells Firefox that the extension is only compatible with a certain version of Firefox. [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever a new version of Firefox comes out, there are invariably a few extensions that won&#8217;t work with it. Not because the extension&#8217;s functionality is no longer suited, but because of a value that is set too low- the maxVersion. That tells Firefox that the extension is only compatible with a certain version of Firefox. You can update the extension by opening it up, and changing the maxVersion to the current Firefox version, or even higher. The easiest way to do this is to use a perl script to do it for you. </p>
<p>If you don&#8217;t have perl installed on your Windows machine, it&#8217;s a free download here: <a href="http://www.activestate.com/store/languages/register.plex?id=ActivePerl">ActivePerl</a></p>
<p>It&#8217;s an easy setup, just click a few buttons, then you&#8217;re done. Then copy and paste the following into a new file and call it <code>maxversion-updater.pl</code> or anything, really, as long as you have the `pl` extension.</p>
<p>The easiest way to find where your profile folder is this:</p>
<p>    Start > Run > %appdata%\Mozilla\Firefox\Profiles</p>
<p>Copy the 8 digits before the `.folder` and paste them in the script below. </p>
<p>- &#8211; -</p>
<p>    #!/usr/bin/perl</p>
<p>    use File::Find;<br />
    use strict;</p>
<p>    # Firefox extension update script, written by Eric Hamiter<br />
    #<br />
    # This script will attempt to update extensions used on<br />
    # earlier builds of Firefox by changing the maxVersion fields.<br />
    # It will probably work, but might accidentally set<br />
    # your house on fire. I don&#8217;t accept responsibility for what<br />
    # might happen, so use at your own risk.<br />
    #<br />
    # Modify the following lines to point the variable to your<br />
    # Firefox profile directory and specify the new Firefox version.</p>
<p>    my $default_folder=&#8221;xxxxxxxx.default&#8221;;<br />
    my $new_version=&#8221;1.5&#8243;;</p>
<p>    # The rest of the script requires no modification.</p>
<p>    my $max=&#8221;em:maxVersion&#8221;;<br />
    my $def=&#8221;$ENV{&#8216;APPDATA&#8217;}\\Mozilla\\Firefox\\Profiles\\$default_folder&#8221;;<br />
    my $directory=&#8221;$def\\extensions&#8221;;    </p>
<p>    find (\&#038;change, $directory);</p>
<p>    sub change<br />
    {<br />
        my @newMax;<br />
        my $oldMax;</p>
<p>        if ( $File::Find::name =~ /\.rdf$/ ) {</p>
<p>            open (FILE, $File::Find::name ) or<br />
            die &#8220;Cannot open file: $!&#8221;;</p>
<p>            print &#8220;\n&#8221; . $File::Find::name . &#8220;\n&#8221;;<br />
            while ( $oldMax = <FILE> ) {<br />
            $oldMax =~ s/<$max>.*</<$max>$new_version</i;<br />
            $oldMax =~ s/$max=".*"/$max="$new_version"/i;<br />
                push(@newMax, $oldMax);<br />
            }<br />
            close FILE;</p>
<p>            open ( OUTFILE, ">$File::Find::name&#8221; ) or<br />
            die &#8220;Cannot open file: $!&#8221;;</p>
<p>            print ( OUTFILE @newMax );<br />
            close ( OUTFILE );</p>
<p>            undef( @newMax );<br />
        }<br />
    }</p>
<p>- &#8211; -</p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2005/12/02/update-your-extensions-maxversion-with-perl/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Use your Mac laptop to utilize a Windows printer</title>
		<link>http://roachfiend.com/archives/2005/09/09/use-your-mac-laptop-to-utilize-a-windows-printer/</link>
		<comments>http://roachfiend.com/archives/2005/09/09/use-your-mac-laptop-to-utilize-a-windows-printer/#comments</comments>
		<pubDate>Fri, 09 Sep 2005 16:15:02 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/archives/2005/09/09/use-your-mac-laptop-to-utilize-a-windows-printer/</guid>
		<description><![CDATA[I recently set up a wireless connection in my apartment, consisting of a Linksys WRT54G router, a Netgear CM212 cable modem, and a desktop running Windows XP Pro and a G4 iBook running OS X 10.4.2 Tiger. I have an Epson Stylus CX5400 USB printer attached to the Windows box, and wanted to get it [...]]]></description>
			<content:encoded><![CDATA[<p>I recently set up a wireless connection in my apartment, consisting of a <a href="http://www.amazon.com/gp/redirect.html?link_code=ur2&#038;tag=roachfiendcom-20&#038;camp=1789&#038;creative=9325&#038;location=%2FLinksys-Cisco-WRT54GL-Wireless-G-Broadband-Compatible%2Fdp%2FB000BTL0OA%2Fsr%3D1-1%2Fqid%3D1157685645%2Fref%3Dpd_bbs_1%3Fie%3DUTF8%26s%3Delectronics">Linksys WRT54G router</a>, a Netgear CM212 cable modem, and a desktop running Windows XP Pro and a G4 iBook running OS X 10.4.2 Tiger. I have an Epson Stylus CX5400 USB printer attached to the Windows box, and wanted to get it working under the iBook wirelessly. Could it be done? </p>
<p><span id="more-28"></span><br />
I tried the simple method of connecting directly to the share from Finder&#8217;s Network connection, but for whatever reason, it refused me access. I could see my computer, but there was no way of connecting to the printer. I quickly ran to Google for an alternative method.</p>
<p>Google told me that I could make this work, under the re-assuring article entitled, &quot;<a href="http://iharder.sourceforge.net/macosx/winmacprinter/">How to Use a Printer Attached to a Windows XP Computer in Mac OS X</a>&#8221; which just about hit the nail on the head. Unfortunately, the exact method described did not work for me, although it got me very close to success. </p>
<p>After reading another article, entitled &quot;<a href="http://www.afp548.com/Articles/Jaguar/cups-1.html">Five Cool Things to do with CUPS</a>&quot;, I finally got it working. </p>
<p>This article is a mix and mash of the two mentioned articles, plus a few comments from myself that will hopefully be the fastest and clearest way to set up wireless printing on an OS X laptop. All of the original correct methods have been pioneered by the original authors, I&#8217;ve just taken the information and joined the bits that worked the best for me.</p>
<p>First things first: I am going to assume that your printer is already successfully hooked up and working on your Windows box. You should also have a wireless network set up and functioning correctly. I also am taking the assumption that you are at least vaguely familiar with the Windows XP and OS X environments, so if I mention the Control Panel on the XP box, you know how to get there, and so forth. If you don&#8217;t know, then ask our friend Google, he&#8217;ll help you out with a quickness.</p>
<p>Ok, now that all of that is out of the way, here&#8217;s what we need to do. </p>
<p>Get the Windows IP address. Fastest way to do this is go to <i>Start > Run ></i> and type in</p>
<p><code>cmd</code></p>
<p>Then in the new window, type</p>
<p><code>ipconfig</code></p>
<p>and write down the windows IP address; we&#8217;ll need it later. It should be in the ballpark of <code>http://192.168.1.<i>xxx</i></code> or somewhere around there.</p>
<p>We need to tell Windows that we&#8217;re going to share the printer.<br />
Click Start and then Control Panel. Then double click on Printers and Faxes. Right-click on your printer, then select Properties. Select the Sharing tab, set Sharing to on, and name the Share something short and sweet. Don&#8217;t use spaces, you don&#8217;t want to make this more complicated than you have to. My printer&#8217;s name is &#8220;printy&#8221;, which I think is accurate.</p>
<p>Ever since Service Pack 2 came out for Windows, additional security measures have been set in place, so we&#8217;ll need to manually open up an additional port, although we just told Windows to share the printer.</p>
<p>So go to <i>Start > Control Panel > My Network Places > Network Connections</i>.<br />
New task on the left: Change Windows Firewall Settings, then click on the Exceptions tab. Click on Add Port, enter &quot;OS X printer&quot; (or whatever you want) in Name and &quot;515&quot; in Port Number. Leave TCP selected, click OK, OK and you&#8217;re done.</p>
<p>You might have to enable the Print Server service in the Services section of the Administrative Tools control panel. To check this, open Control Panel, then open Administrative Tools, then Services. Click on the Extended tab. Find the service TCP/IP Print Server, start it, and set it to start automatically.</p>
<p>Now we must set up print services for Unix. Click Start and then Control Panel. Double click on Add or Remove Programs. Click on Add/Remove Windows Components. Double click Other Network File and Print Services. Select Print Services for Unix. You might need your Windows XP CD, but I didn&#8217;t. Click OK to go back to the Add/Remove panel. Close it.</p>
<p>We&#8217;re done with the Windows box, now we need to get the Mac working with it.</p>
<p>Open a terminal window and type in:</p>
<p><code>cd /usr/libexec/cups/backend/</code></p>
<p>and then type in</p>
<p><code>sudo ln -s /usr/bin/smbspool smb</code></p>
<p>This creates a symbolic link for working with CUPS (Common Unix Printing System), if you&#8217;re curious about what you just typed in. After the sudo command, it will ask you for a password, so you need to have administrator&#8217;s privileges.</p>
<p>Now start up printer sharing from the Sharing Preference Pane. If you have already started it, you need to turn it off and then on again for CUPS to pick up the changes. </p>
<p>Go to the CUPS web interface at <a href="http://127.0.0.1:631">http://127.0.0.1:631</a></p>
<p>Select &#8220;Add Printer.&#8221;<br />
Give it a name, a location, and a description. These can be whatever you want.</p>
<p>Then choose:</p>
<p><code>LPD/LPR Host or Printer</code></p>
<p>The URI is in this format:</p>
<p><code>lpd://your.windows.ipaddress.from-earlier/your-printers-shared-name</code></p>
<p>Then choose the make and model. If they don&#8217;t have it exactly, it will probably still work.</p>
<p>That&#8217;s it. Hopefully you can now print with ease from your toilet or your bed or wherever you want to now.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></p>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBWgiwVrOPhqGxq3c45Tupkzmj9lKoSQhKxaPDrIFx0ukMU/ZVvKsFsspXRrmY3ZdAJ42nKoXiVBH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Rss>http://roachfiend.com/archives/2005/09/09/use-your-mac-laptop-to-utilize-a-windows-printer/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Enabling Extension Updates</title>
		<link>http://roachfiend.com/archives/2005/03/09/enabling-extension-updates/</link>
		<comments>http://roachfiend.com/archives/2005/03/09/enabling-extension-updates/#comments</comments>
		<pubDate>Wed, 09 Mar 2005 23:16:53 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/archives/2005/03/09/enabling-extension-updates/</guid>
		<description><![CDATA[So you've learned how to <a href="http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/">write your own extension</a>. This tutorial will show you how to keep your users up to date with your latest version automatically.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.spotplex.com/send/643382/no-image.gif"></p>
<p>So you&#8217;ve learned how to <a href="http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/">write your own extension</a>. This tutorial will show you how to keep your users up to date with your latest version automatically.</p>
<p><span id="more-20"></span><br />
One of the cool things about having an update feature in your extension is the user won&#8217;t have to check your homepage all the time to see if there&#8217;s a new version available. Firefox will let them know that a new version is available as soon as you update it, thanks to a file called update.rdf.</p>
<p>update.rdf resides on your server&#8217;s directory; in my case, it&#8217;s here:</p>
<p><a href="http://extensions.roachfiend.com/update.rdf">http://extensions.roachfiend.com/update.rdf</a></p>
<p>You can take a look at it if you want. You&#8217;ll see that it&#8217;s got syntax highlighting and colors on it. This is good. That means that my server is correctly identifying it as an rdf file, and not just some random text file. This is the number one reason why things go awry when you try and set up an update file. There are two ways of remedying this if you run into problems: the first and easiest method is if you have cpanel running on your server. If so, just go to <acronym title="Multipurpose Internet Mail Extensions">MIME</acronym> types, and then add a new type as the following:</p>
<pre>
MIME type: text/xml
Extension: rdf
</pre>
<p>If you don&#8217;t have cpanel installed, but you have an Apache server, you can add this to your root directory&#8217;s .htaccess file:</p>
<pre>
AddType text/xml rdf
</pre>
<p>Ok, now your server should recognize the file we&#8217;re going to create. Here&#8217;s a sample update.rdf file you can copy and paste, and edit as necessary. In this example we&#8217;ll track just one extension, but in my file posted above, you can see that you can keep tabs on a boatload of extensions.</p>
<p><strong>Note:</strong> There is <strong>no space</strong> between <em>Description about=&#8221;urn:mozilla:extension:</em> and <em>{b4fb60db&#8230;}</em> on lines 5 and 6 below. I had to split them up because it was too long on the web page. Sorry if this is what caused your insanity. <i>Thanks, Karl!</i></p>
<pre><code class="xml">
&lt;?xml version="1.0"?&gt;
&lt;r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns="http://www.mozilla.org/2004/em-rdf#"&gt;
&lt;!-- Foo Widget Extension --&gt;
&lt;r:Description about="urn:mozilla:extension:
{b4fb60db-ac1c-4c10-b0f6-39b0b0f56ea5}"&gt;
  &lt;updates&gt;
    &lt;r:Seq&gt;
      &lt;r:li&gt;
        &lt;r:Description&gt;
          &lt;version&gt;0.1&lt;/version&gt;
          &lt;targetApplication&gt;
            &lt;r:Description&gt;
              &lt;id&gt;{ec8030f7-c20a-464f-9b0e-13a3a9e97384}&lt;/id&gt;
              &lt;minVersion&gt;0.8&lt;/minVersion&gt;
              &lt;maxVersion&gt;1.9&lt;/maxVersion&gt;
              &lt;updateLink&gt;http://www.webserver.com/foowidget.xpi&lt;/updateLink&gt;
            &lt;/r:Description&gt;
          &lt;/targetApplication&gt;
        &lt;/r:Description&gt;
      &lt;/r:li&gt;
    &lt;/r:Seq&gt;
  &lt;/updates&gt;
  &lt;version&gt;0.1&lt;/version&gt;
  &lt;updateLink&gt;http://www.webserver.com/foowidget.xpi&lt;/updateLink&gt;
&lt;/r:Description&gt;
&lt;/r:RDF&gt;
</code></pre>
<p>So you would need to replace the web address and extension path as your own, as well as the first <acronym title="Globally Unique Identifier">GUID</acronym> that starts with b4fb&#8230; with your extension&#8217;s GUID. The second one that begins with ec80&#8230; is unique to Firefox, so leave that alone.</p>
<p>You&#8217;ll notice two &lt;version&gt; tags- in the past sometimes the mechanism ignored any attributes outside of the &lt;updates&gt; tags, so having two ensured compatibility. To be honest, I don&#8217;t know if both are necessary, but it works, so hey, whatever. Put the current version number of your extension in there, so Firefox will have a new version to check against. If the number in here is greater than the user&#8217;s current release, then it will prompt them to install the new version.</p>
<p>So, we&#8217;ve got the modified update.rdf file on the server. Now we need to tell the extension to call home to see if there&#8217;s a newer version. In your install.rdf file, you need this line:</p>
<pre><code class="xml">
&lt;em:updateURL&gt;http://www.webserver.com/update.rdf&lt;/em:updateURL&gt;
</code></pre>
<p>That&#8217;s it! You can test it out by keeping an old version of an extension installed on your browser (that has the updateURL above in place) and uploading the new version on your server.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></p>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBWgiwVrOPhqGxq3c45Tupkzmj9lKoSQhKxaPDrIFx0ukMU/ZVvKsFsspXRrmY3ZdAJ42nKoXiVBHjon7D2d5zmPUBN33wfQZ9UXY9XRhIP8MdCOSULHuUGlZwtAazYzvUzcTqwl92O40e3AWXnPSoUmE/I3f/Gv4h+pjlisE9aCTELMAkGBSsOAwIaBQAwgaQGC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haW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA2MDkyMTAxMDA1NVowIwYJKoZIhvcNAQkEMRYEFJSvYyYPXryMuh4kXBu3uCbYS+wBMA0GCSqGSIb3DQEBAQUABIGAlkcAjlM0jgupPnAJv9rLizpANzIue44Q5bqESBnOVnAnkzdxTF52Qh/WULZhv7kPhV/Ez7fokK/HgDq5PHunxt7c7uVag26LvSA/3OutwugTgihqE4mYTaBttV8qh3oJi3bgSWqBEGUhKkZ+IaNN0KqgYWjRseGAJM9oKRGUivE=-----END PKCS7-----<br />
"><br />
</form>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2005/03/09/enabling-extension-updates/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>How to create Firefox extensions</title>
		<link>http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/</link>
		<comments>http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/#comments</comments>
		<pubDate>Thu, 09 Dec 2004 00:47:49 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/</guid>
		<description><![CDATA[<p>Everyone has a good idea at one time or another to implement a new feature in a web browser.
Well, with the goodness that is Mozilla Firefox, now you can do just that. You need to have a vague
understanding of <acronym title="XML User Interface Language">XUL</acronym> and Javascript, but you certainly don't need to be a master of either. When I started, I knew nothing about either one, really. I had seen some bookmarklets here and there,
and tried to figure out just how they worked. Well, that's how I made my first extension,
BugMeNot.</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.spotplex.com/send/643382/no-image.gif"></p>
<p>(If you&#8217;d like to see how to create a Google Chrome extension, you can read this article here: <a href="http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/">http://roachfiend.com/archives/2009/12/27/how-to-write-google-chrome-extensions/</a>)</p>
<p>Everyone has a good idea at one time or another to implement a new feature in a web browser. Well, with the goodness that is Mozilla Firefox, now you can do just that. You need to have a vague understanding of <acronym title="XML User Interface Language">XUL</acronym> and Javascript, but you certainly don&#8217;t need to be a master of either. When I started, I knew nothing about either one, really. I had seen some bookmarklets here and there, and tried to figure out just how they worked. Well, that&#8217;s how I made my first extension, BugMeNot.</p>
<p><span id="more-4"></span></p>
<h4><a id="contents"></a>Contents</h4>
<ol>
<li><a href="#example">Learn By Example</a></li>
<li><a href="#hello">Hello, world!</a></li>
<li><a href="#package">Looking inside the XPI</a></li>
<li><a href="#config">Re-configuring your extension&#8217;s installation</a></li>
<li><a href="#chrome">Chrome is more than a shiny bumper</a></li>
<li><a href="#skin">Skin that cat</a></li>
<li><a href="#testing">Pack it up and try it out</a></li>
<li><a href="#build">An easier way to re-build</a></li>
<li><a href="#safe">My Firefox got completely hosed up</a></li>
<li><a href="#net">Ensure server compatibility</a></li>
<li><a href="#help">Additonal help and information</a></li>
<li><a href="#comments">Comments / Feedback</a></li>
</ol>
<h4><a id="example"></a>Learn by example</h4>
<p>Everyone has a good idea at one time or another to implement a new feature in a web browser. Well, with the goodness that is Mozilla Firefox, now you can do just that. You need to have a vague understanding of <acronym title="XML User Interface Language">XUL</acronym> and Javascript, but you certainly don&#8217;t need to be a master of either. When I started, I knew nothing about either one, really. I had seen some bookmarklets here and there, and tried to figure out just how they worked. Well, that&#8217;s how I made my first extension, BugMeNot.</p>
<p>Basically, this tutorial will show you how to create your first extension from scratch. Since<br />
every programmer always learns from the famous &#8220;Hello, world!&#8221; example, I figured that would be a good way to introduce you to developing extensions.</p>
<p>Xul Planet has a nice little <a href="http://www.xulplanet.com/tutorials/xultu/advmenu.html" rel="nofollow" target="_blank">tutorial</a> which will show you the basics of creating a menu. Mozilla also has a very handy <a href="http://www.mozilla.org/docs/dom/domref/dom_window_ref.html#1004028" rel="nofollow" target="_blank">DOM Window Interface reference</a> if you&#8217;d like to take a look through that. They&#8217;re both geared toward an audience that has a good feel for programming, though, so it&#8217;s not necessary to understand everything going on to follow this tutorial.</p>
<h4><a id="hello"></a>Hello, world!</h4>
<p>Our extension will be a nice simple one that will pop up a window proclaiming &#8220;Hello, world!&#8221; after we select it either in a right-click menu, or under the <span class="prog">Tools</span> menu. Both of these places are very popular positions, and it&#8217;s relatively easy to stick something in there.</p>
<p>Let&#8217;s see what the end result looks like, so you know what to expect. First, here are the two ways to access our extension:</p>
<p>Right-clicking will get us this:</p>
<p><img src="http://extensions.roachfiend.com/rightclick.png" alt="Right-click screenshot" title="Right-click screenshot" /></p>
<p>The tools menu looks like this:</p>
<p><img src="http://extensions.roachfiend.com/tools.png" alt="Tools menu screenshot" title="Tools menu screenshot" /></p>
<p>The end result of our extension&#8217;s efforts:</p>
<p><img src="http://extensions.roachfiend.com/alert.png" alt="Alert screenshot" title="Alert screenshot" /></p>
<p>What it looks like in the extension manager:</p>
<p><img src="http://extensions.roachfiend.com/extensions.png" alt="Extension manager screenshot" title="Extension manager screenshot" /></p>
<p>Clicking on the &#8220;About&#8230;&#8221; in the extension manager will get us this:</p>
<p><img src="http://extensions.roachfiend.com/about.png" alt="About... screenshot" title="About... screenshot" /></p>
<h4><a id="package"></a>Looking inside the XPI</h4>
<p>Here&#8217;s how the extension breaks down in a nutshell, using a pre-made <span class="file">Hello, world!</span> extension as an example:</p>
<p>(You can <a href="http://extensions.roachfiend.com/helloworld.xpi">download it here</a>, just right-click and save, then you can follow along.)</p>
<p><span class="file">helloworld.xpi</span> is the packaged extension. <acronym title="Cross Platform Installer">XPI</acronym> is just an file format that your browser will recognize as a browser extension. In reality, it&#8217;s just a zipped up file. So you can rename the XPI to ZIP or even JAR if you want, then open it up using an archive program, like <a href="http://www.7-zip.org/" rel="nofollow" target="_blank">7-Zip</a> or <a href="http://rarlabs.com/" rel="nofollow" target="_blank">WinRAR</a>. So, once that&#8217;s opened up, you&#8217;ll see:</p>
<ul>
<li><span class="folder">chrome</span></li>
<li><span class="file">install.js</span></li>
<li><span class="file">install.rdf</span></li>
</ul>
<p>A folder and two files. <span class="file">install.js</span> was all you used to need for the installation, but now that the extension manager has changed (since Firefox 0.9), the <span class="file">install.rdf</span> is used instead. Now, the <span class="file">install.js</span> is used purely for earlier versions of Firefox/bird, Mozilla, and Netscape. If you want to make this extension solely for 0.9+ versions of Firefox, then you can omit this file if you&#8217;d like. I tend to<br />
keep it in because it only take a second to make, and assures a wide audience compatibility. Some extensions simply aren&#8217;t backwards-compatible, though, for example my <a href="http://extensions.roachfiend.com/index.html#listzilla">ListZilla</a><br />
extension, since it gathers all information from 0.9&#8242;s extensions manager. A nice simple &#8220;Hello, world!&#8221; prompt shouldn&#8217;t present any problems, though.</p>
<p>If you open up <span class="file">install.js</span>, you&#8217;ll see that it&#8217;s very basic, in terms of what you need to modify to make your own install script:</p>
<pre>
// --- Editable items begin ---
extFullName: 'Hello, world!', // The name displayed to the user
extShortName: 'helloworld', // The leafname of the JAR file
extVersion: '0.1',
extAuthor: 'Eric Hamiter',
extLocaleNames: null, // e.g. ['en-US', 'en-GB']
extSkinNames: null, // e.g. ['classic', 'modern']
extPostInstallMessage: 'Success! Please restart your browser to finish the
installation.'
// Set to null for no post-install message
// --- Editable items end ---
</pre>
<p>So all the hard work is done for you. I&#8217;m not going post the rest of the code, but you&#8217;ll see<br />
quite a lengthy amount of work that is fully automated.</p>
<p>Now if you open <span class="file">install.rdf</span>. you&#8217;ll see this:</p>
<pre>
&lt;?xml version="1.0"?>

&lt;RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">

	&lt;Description about="urn:mozilla:install-manifest">

		&lt;em:id>{9AA46F4F-4DC7-4c06-97AF-5035170633FE}&lt;/em:id>
		&lt;em:name>Hello, world!&lt;/em:name>
		&lt;em:version>0.1&lt;/em:version>
		&lt;em:description>Displays an alert message via right-click
		or Tools menu.&lt;/em:description>
		&lt;em:creator>Eric Hamiter&lt;/em:creator>
		&lt;em:homepageURL>http://extensions.roachfiend.com&lt;/em:homepageURL>
		&lt;em:iconURL>chrome://helloworld/skin/helloworld.png&lt;/em:iconURL>
		&lt;em:aboutURL>chrome://helloworld/content/about.xul&lt;/em:aboutURL>
		&lt;em:file>
			&lt;Description about="urn:mozilla:extension:file:helloworld.jar">
				&lt;em:package>content/helloworld/&lt;/em:package>
				&lt;em:skin>skin/classic/helloworld/&lt;/em:skin>
			&lt;/Description>
		&lt;/em:file>

		&lt;em:targetApplication>
			&lt;Description>
				&lt;em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}&lt;/em:id>
				&lt;em:minVersion>0.7&lt;/em:minVersion>
				&lt;em:maxVersion>9.9&lt;/em:maxVersion>
			&lt;/Description>
		&lt;/em:targetApplication>

	&lt;/Description>

&lt;/RDF>
</pre>
<h4><a id="config"></a>Re-configuring your extension&#8217;s installation</h4>
<p>Ok, whoa.. what is all this crap? The first thing you&#8217;ll see is the <span class="code">&lt;em:id></span> tag. This is your very own generated id that will separate your extension from anyone else&#8217;s. There are a few ways to make it. You can either use<br />
<a href="http://extensions.roachfiend.com/cgi-bin/guid.pl">an online perl script</a> to randomly generate one, or if you use Windows, you can use a program called <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=94551F58-484F-4A8C-BB39-ADB270833AFC" rel="nofollow" target="_blank">guidgen</a>,<br />
brought to us by Microsoft. How deliciously ironic. Or am I misuing the term irony here? Whatever. So if you download that, then you&#8217;ll see this when you run it:</p>
<p><img src="http://extensions.roachfiend.com/guid.png" alt="GUIID Screenshot" title="GUIID Screenshot" /></p>
<p>So choose <span class="code">4. Registry Format</span>, then hit <span class="code">New GUID</span> a few times for good measure, then <span class="code">Copy</span>. That&#8217;s it, now your new spiffy id is in your clipboard. Replace the old one with this, and you&#8217;re set.</p>
<p><span class="code">Name</span>, <span class="code">version</span>, <span class="code">description</span>, <span class="code">creator</span>, and <span class="code">homepageURL</span> are all self-explanatory. The <span class="code">iconURL</span> and <span class="code">aboutURL</span> are what shows up if someone right-clicks your extension and chooses &#8220;About Extension&#8230;&#8221;. You can leave these blank, it&#8217;s not mandatory, but it&#8217;s nice to have a little flash every now and then.</p>
<p>Underneath file, this is standard stuff. Just replace all instances of &#8220;helloworld&#8221; with your extension name. This is where the installation will try and find your files and folders. If you have any icons, you&#8217;ll include the <span class="folder">skin</span> folder. Again, it&#8217;s not mandatory.</p>
<p>Target application is what you&#8217;re gearing this for. The <span class="code">ec8030f7&#8230;</span> is unique to Firefox, so leave that alone. The <span class="code">minversion</span> and <span class="code">maxversion</span> is what versions of Firefox it will be compatible with. There was a big stink about this recently, since the developers introduced 0.9.1, shortly after telling us to make sure and only put a <span class="code">maxVersion</span> of 0.9. This does not compute. So I recently modified mine to go to 9.9, which will ensure compatibility through the next few versions of Firefox. This isn&#8217;t the type of thing that mozilla will support, since they can only recommend keeping the maxVersion to the current release, but it&#8217;s the best way to keep you sane, so you don&#8217;t have to update your extensions every few weeeks.</p>
<h4><a id="chrome"></a>Chrome is more than a shiny bumper</h4>
<p>Ok, now open up the <span class="folder">chrome</span> folder. In there you&#8217;ll find another archived file, <span class="file">helloworld.jar</span>. Open it up and extract the files. You&#8217;ll now have <span class="folder">content</span> and <span class="folder">skin</span> folders. Let&#8217;s explore <span class="folder">content</span> first. In there, we have a<br />
<span class="folder">helloworld</span> folder, and under that, these files:</p>
<ul>
<li><span class="file">about.xul</span></li>
<li><span class="file">contents.rdf</span></li>
<li><span class="file">helloworldOverlay.js</span></li>
<li><span class="file">helloworldOverlay.xul</span></li>
</ul>
<p><span class="file">about.xul</span> is the file you see when you click &#8220;About Hello, world!&#8230;&#8221; in the extensions menu. It&#8217;s pretty self-explanatory, and you&#8217;ll see that a nice man named Jed Brown wrote the template for it, so all the hard work has been done for you. Again. So just fill out the info, and that&#8217;s it.</p>
<p><span class="file">helloworldOverlay.xul</span> and <span class="file">helloworldOverlay.js</span> are what make things happen. They&#8217;re the brains behind the outfit, so to speak. And you&#8217;ll be amazed at how simple they are. Here&#8217;s <span class="file">helloworldOverlay.xul</span>:</p>
<pre>
&lt;?xml version="1.0"?>

&lt;overlay id="helloworldOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

&lt;!-- This imports our javascript. --&gt;

&lt;script type="application/x-javascript"
src="chrome://helloworld/content/helloworldOverlay.js">

&lt;/script>

&lt;!-- This is for the right click menu. --&gt;

&lt;popup id="contentAreaContextMenu">
  &lt;menuitem id="helloworld" label="Hello, world!" accesskey="H"
  insertafter="context-stop" oncommand="hello();"/>
&lt;/popup>

&lt;!-- This is for the Tools menu. --&gt;

&lt;menupopup id="menu_ToolsPopup">
	&lt;menuitem insertafter="devToolsSeparator" label="Hello, world!"
	accesskey="H" oncommand="hello();" />
&lt;/menupopup>

&lt;/overlay>
</pre>
<p>So all it says to do is to insert the javascript file, <span class="file">helloworldOverlay.js</span>, and to create a context menu entry called <span class="u">H</span>ello, world! <span class="code">accesskey=&#8221;H&#8221;</span><br />
underlines the &#8220;H&#8221;, since it&#8217;s the first letter that wasn&#8217;t taken by any other options. <span class="code">insertafter=&#8221;context-stop&#8221;</span> places the option directly underneath the Stop label. <span class="code">oncommand</span> makes it launch the window with the<br />
function <span class="code">hello</span>, which is located in the javascript file we imported earlier. The second part of the overlay tells it we also want to place an option in the <span class="prog">Tools</span> menu. Same logic as the context menu, just a different place to stick it. Here&#8217;s what <span class="file">helloworldOverlay.js</span> looks like:</p>
<pre>
// This is our javascript, which will pop up our message
// in an alert box.

function hello(){
	alert("Hello, world!");
}
</pre>
<p>Now for <span class="file">contents.rdf</span>. This is the file that tells the browser where to store this overlay information. Here&#8217;s what it looks like:</p>
<pre>
&lt;?xml version="1.0"?>

&lt;RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">

	&lt;RDF:Seq RDF:about="urn:mozilla:package:root">
		&lt;RDF:li RDF:resource="urn:mozilla:package:helloworld"/>
	&lt;/RDF:Seq>

	&lt;RDF:Seq RDF:about="urn:mozilla:overlays">
		&lt;RDF:li RDF:resource="chrome://browser/content/browser.xul"/>
		&lt;RDF:li RDF:resource="chrome://navigator/content/navigator.xul"/>
	&lt;/RDF:Seq>

	&lt;RDF:Seq RDF:about="chrome://browser/content/browser.xul">
		&lt;RDF:li>chrome://helloworld/content/helloworldOverlay.xul&lt;/RDF:li>
	&lt;/RDF:Seq>

	&lt;RDF:Seq about="chrome://navigator/content/navigator.xul">
		&lt;RDF:li>chrome://helloworld/content/helloworldOverlay.xul&lt;/RDF:li>
	&lt;/RDF:Seq>

	&lt;RDF:Description RDF:about="urn:mozilla:package:helloworld"
		chrome:displayName="Hello, world! 0.1"
		chrome:author="Eric Hamiter"
		chrome:authorURL="mailto:ehamiter@gmail.com"
		chrome:name="helloworld"
		chrome:extension="true"
		chrome:description="Displays an alert message via right-click
		or Tools menu.">
	&lt;/RDF:Description>

&lt;/RDF:RDF>
</pre>
<p>You&#8217;ll notice the address <span class="folder">chrome</span>://<span class="folder">browser</span>/<span class="folder">content</span>/<span class="file">browser.xul</span> up there. This is mozilla&#8217;s internal frame of reference.<br />
<span class="folder">browser</span> is the actual browser, and <span class="folder">navigator</span> works for non-Firefox builds, like Netscape or Mozilla. The only part you&#8217;d need to modify is the descriptions. The rest of it just implements the extension into the browsers.</p>
<h4><a id="skin"></a>Skin that cat</h4>
<p>Now let&#8217;s backtrack to the <span class="folder">skin</span> folder. In it, we&#8217;ll find a few more folders: <span class="folder">classic</span> and <span class="folder">helloworld</span>. This is just the traditional layout, and if it ain&#8217;t broke, then hey, don&#8217;t fix it. In <span class="folder">helloworld</span>, we find three files: <span class="file">helloworld.png</span>, <span class="file">helloworldb.png</span>, and a <span class="file">contents.rdf</span> file.</p>
<p><span class="file">helloworld.png</span>:</p>
<p><img src="http://extensions.roachfiend.com/helloworld.png" alt="Hello, world! small icon" title="Hello, world! small icon" /></p>
<p><span class="file">helloworldb.png</span>:</p>
<p><img src="http://extensions.roachfiend.com/helloworldb.png" alt="Hello, world! large icon" title="Hello, world! large icon" /></p>
<p>These are called from <span class="file">about.xul</span> mentioned previously,<br />
for use in the extension menu and the about menu. <span class="file">contents.rdf</span> simply maps out the paths to the skin files, so the only modification you need to change for your own extension is in the last line, which points to the folder <span class="folder">helloworld</span>.</p>
<h4><a id="testing"></a>Pack it up and try it out</h4>
<p>So now that you see how the files work, and where they&#8217;re packaged, you can modify them to your whims, and try out new things. Once you modify them, just pack them up in reverse order. Using your archive program, you would navigate back up to the <span class="folder">chrome</span> folder, and add <span class="folder">content</span> and<br />
<span class="folder">skin</span> into a zipped archive, then rename it to <span class="file">extension.jar</span>. After that, navigate up another folder, and add <span class="folder">chrome</span>, <span class="file">install.rdf</span>, and <span class="file">install.js</span> into another zipped archive, then rename it to <span class="file">extension.xpi</span>.</p>
<p>You&#8217;re ready to test it out in your browser now. Open up Firefox, and hit CTRL-O, or Open File. Load up your xpi file, and say yes to the installation. Restart Firefox, and hopefully you&#8217;ll see your new extension in the menu, and it does whatever you had hoped it would do.</p>
<h4><a id="build"></a>An easier way to re-build</h4>
<p>After a while, it gets tiresome to select your files, your folder, archive them, rename them, move them, delete them, rename them&#8230; you get my point. If you have <a href="http://www.7-zip.org/" rel="nofollow" target="_blank">7-Zip</a> installed, you can use the command line feature, so you can have this all fully automated. Here&#8217;s what you need to do:</p>
<p>Copy C:\<span class="folder">Program Files</span>\<span class="folder">7-Zip</span>\<span class="file">7z.exe</span> to C:\<span class="folder">WINDOWS</span>\<span class="folder">system32</span> (This will<br />
put <span class="file">7z.exe</span> in your system&#8217;s path, which will make it accessible from the command prompt).</p>
<p>It&#8217;s a good practice	to build your extensions somewhere far away from random scripts and clutter, so create a new folder somewhere and call it whatever your extension is named. Make sure it matches the internal .jar file that you previously referenced in your <span class="file">install.rdf</span> file. You can always rename the final xpi to something more intricate afterward, but for packaging, it&#8217;s best to keep it simple.</p>
<p>Copy the following script and paste it in a text editor and save it as <span class="file">build.bat</span> in your newly-made folder:</p>
<pre>
set x=%cd%
md build\chrome
cd chrome
7z a -tzip "%x%.jar" * -r -mx=0
move "%x%.jar" ..\build\chrome
cd ..
copy install.* build
cd build
7z a -tzip "%x%.xpi" * -r -mx=9
move "%x%.xpi" ..\
cd ..
rd build /s/q
</pre>
<p>Now, you can build or modify your extensions easily. Just use the new folder as your<br />
base of creation, so that would contain the install files and <span class="folder">chrome</span> folder. Whenever you want to create your new file, just double-click <span class="file">build.bat</span>, and your new extension will pop out in the same folder. Each time you use the <span class="file">build.bat</span> script, it will<br />
delete your old file and create a new one.</p>
<h4><a id="safe"></a>My Firefox just got completely hosed up</h4>
<p>Worst case scenario: upon restarting Firefox, it hangs with a &#8220;Firefox is still installing an<br />
extension, this may take a minute&#8230;&#8221;. This means you borked it up somehow. Don&#8217;t panic! A super easy way of uninstalling it without hosing the rest of your shit up is as follows:</p>
<p><span class="prog">Start</span> &raquo; <span class="prog">Program Files</span> &raquo; <span class="prog"> Mozilla Firefox</span> &raquo; <span class="prog">Mozilla Firefox (Safe Mode)</span></p>
<p>Then go to <span class="prog">Tools</span> &raquo; <span class="prog">Extensions</span> &raquo; [<span class="prog">right-click on your extension</span>] &raquo; <span class="prog">Uninstall</span></p>
<p>Restart Firefox, and it&#8217;ll be gone. Then modify your files and try again.</p>
<h4><a id="net"></a>Ensure server compatibility</h4>
<p>If it works, and you want to put it on your web server, but find out that it won&#8217;t install directly, and your browser is treating it as &#8220;Save File As..&#8221; then you need to modify your <span class="file">.htaccess</span> file. You can learn more about it <a href="http://www.javascriptkit.com/howto/htaccess.shtml" rel="nofollow" target="_blank">here</a>, but<br />
for brevity&#8217;s sake, you need your server to run on Apache for it to work. If you have no problem modifying the file, here&#8217;s the information you need to add:</p>
<p>Add this to your <span class="file">.htaccess</span> file:</p>
<pre>AddType application/x-xpinstall xpi</pre>
<p>And you should be set.</p>
<h4><a id="help"></a>Additional help and information</h4>
<p>If you want to take a look at any other files I&#8217;ve created, they&#8217;re on my main<br />
<a href="http://roachfiend.com/archives/category/extensions/">extensions page</a>, and I&#8217;ll list them directly here for convenience as well:</p>
<ul>
<li><a href="http://extensions.roachfiend.com/allowrightclick.xpi">Allow Right-Click</a></li>
<li><a href="http://extensions.roachfiend.com/altlinks.xpi">Alt-Text for Links</a></li>
<li><a href="http://extensions.roachfiend.com/password.xpi">Always Remember Password</a></li>
<li><a href="http://extensions.roachfiend.com/bugmenot.xpi">BugMeNot</a></li>
<li><a href="http://extensions.roachfiend.com/ext2abc.xpi">Ext2Abc</a></li>
<li><a href="http://extensions.roachfiend.com/girl.xpi">Google Images Re-Linker</a></li>
<li><a href="http://extensions.roachfiend.com/goonmenu.xpi">Goon Menu</a></li>
<li><a href="http://extensions.roachfiend.com/listzilla.xpi">ListZilla</a></li>
<li><a href="http://extensions.roachfiend.com/teleflip.xpi">Teleflip</a></li>
<li><a href="http://extensions.roachfiend.com/wordcount.xpi">Word Count</a></li>
</ul>
<p>If you&#8217;d like to put a certain snippet of Javascript on every page,<br />
<span class="file">Allow Right-Click</span> or <span class="file">Always Remember Password</span> is the way to go. <span class="file">Alt-Text for Links</span> uses javascript to control tooltips. If you&#8217;d like to create your own links menu, then <span class="file">Goon Menu</span> is good to learn from. <span class="file">BugMeNot</span> uses complex regular expressions, <span class="file">ListZilla</span> deals with<br />
setting options and using the extension manager, and <span class="file">WordCount</span> is a good way to learn how to take a bookmarklet and use it as an extension.</p>
<p>The <a href="http://forums.mozillazine.org/viewforum.php?f=19" rel="nofollow" target="_blank">Mozillazine extensions forum</a> is a great place to learn more about creating extensions. They&#8217;re under heavy loads from time to time, so they might be down when you read this, but try back again if they are, because they have a lot of useful information there.</p>
<p>Loads of other useful extensions can also be found at <a href="http://update.mozilla.org" rel="nofollow" target="_blank">Mozilla Update</a>, and there&#8217;s another place called <a href="http://extensionsmirror.nl/" rel="nofollow" target="_blank">My Extensions Mirror</a> that has forums as well as tons of extensions.</p>
<p>Well, that&#8217;s it. Hopefully this has been helpful to at least a few ambitious people, as well as a look into what goes into making one for the non-technical types. So get off your ass and make something useful!</p>
<p></p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></p>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHJwYJKoZIhvcNAQcEoIIHGDCCBxQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQ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8qh3oJi3bgSWqBEGUhKkZ+IaNN0KqgYWjRseGAJM9oKRGUivE=-----END PKCS7-----<br />
"><br />
</form>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/feed/</wfw:commentRss>
		<slash:comments>282</slash:comments>
		</item>
	</channel>
</rss>
