<?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>PCR&#039;s notepad &#187; web development</title>
	<atom:link href="http://notepad.patheticcockroach.com/category/internet/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://notepad.patheticcockroach.com</link>
	<description>The area in patheticcockroach.com where the EEG isn&#039;t isoelectric</description>
	<lastBuildDate>Fri, 30 Jul 2010 11:13:31 +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>Adding PostgreSQL portable to XAMPP (on Windows)</title>
		<link>http://notepad.patheticcockroach.com/628/adding-postgresql-portable-to-xampp-on-windows/</link>
		<comments>http://notepad.patheticcockroach.com/628/adding-postgresql-portable-to-xampp-on-windows/#comments</comments>
		<pubDate>Wed, 19 May 2010 17:13:25 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[portable software]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=628</guid>
		<description><![CDATA[For those who don&#8217;t know it, XAMPP is a package containing the main things you need to setup and run a local webserver within a few minutes (configured as a testing/dev platform, not a production platform). I used to be reluctant to using it, but I eventually found out that the Lite version used without [...]]]></description>
			<content:encoded><![CDATA[<p>For those who don&#8217;t know it, XAMPP is a package containing the main things you need to setup and run a local webserver within a few minutes (configured as a testing/dev platform, not a production platform). I used to be reluctant to using it, but I eventually found out that the Lite version used without the installer was really useful, notably on PCs where I don&#8217;t have admin rights. XAMPP has a few limitations, though. Notably, there&#8217;s no PostgreSQL (even in the &#8220;not-Lite&#8221; version). So, here&#8217;s how to add PostgreSQL to XAMPP Lite (or not Lite).</p>
<h2>PostgreSQL</h2>
<p>First, get PostgreSQL portable <a href="http://greg.webhop.net/postgresql_portable/">here</a> (<a href="http://www.portablefreeware.com/forums/viewtopic.php?p=23148">topic on portable freeware</a>).<br />
Unzip it anywhere you want, then launch PostgreSqlPortable.exe. At first you&#8217;ll need to initialize the database: click on &#8220;Initialize PostgreSQL 8.3&#8243;, choose a user name (you can leave the default on, I chose &#8220;root&#8221;), a password and the port (leaving the default 5432 is good, it will let you configure phpPgAdmin faster). The database initialization will then take a few seconds (over 15 seconds on my very slow PC&#8230;). Then click on &#8220;Start PostgreSQL 8.3&#8243;. On a restricted computer, you may get an error message &#8220;Error starting PostgreSQL&#8221;. This seems to be an issue on the launcher: PostgreSQL is probably still running successfully (check in the task manager if you see a few running postgres.exe).</p>
<p>Now, all you need is to configure PHP to be PostgreSQL-enabled. In XAMPP&#8217;s folder, find <em>php/php.ini</em> and uncomment (or create) the line <code>extension=php_pgsql.dll</code>. Restart Apache and voilà, PostgreSQL is now usable from your XAMPP installation.</p>
<h2>phpPgAdmin</h2>
<p>phpPgAdmin is to PostgreSQL what phpMyAdmin is to MySQL: every newbie needs it, most power-users enjoy it. It can be downloaded from <a href="http://phppgadmin.sourceforge.net/">phppgadmin.sourceforge.net</a>. Extract it in XAMPP&#8217;s htdocs folder (e.g. in <em>htdocs/phppgadmin</em>). Copy the default configuration file (<em>conf/config.inc.php-dist</em>) and rename it to <em>conf/config.inc.php</em>. Then in this file edit the following lines:</p>
<ul>
<li><code>$conf['servers'][0]['host'] = 'localhost';</code></li>
<li><code>$conf['servers'][0]['defaultdb'] = 'postgres';</code>: not sure if that&#8217;s really needed but I configured it this way&#8230;</li>
<li><code>$conf['extra_login_security'] = false;</code>: so you can log in as root on the database. Not needed if you chose a custom username as the admin username (during the database initialization process). But I chose root, so leaving it to true gave me the infamous &#8220;Login disallowed for security reasons.&#8221; error.</li>
</ul>
<p>Finally, phpPgAdmin triggers a deprecation warning in PHP 5.3. And this deprecation warning is quite misplaced, as you can see from the error it generates:</p>
<blockquote><p>Warning: session_start() [function.session-start]: Cannot send session cookie &#8211; headers already sent by (output started at xampplite\htdocs\phppgadmin\classes\Misc.php:344) in xampplite\htdocs\phppgadmin\libraries\lib.inc.php  on line 56</p></blockquote>
<p>To fix this, you can either:<br />
- fix Misc.php: replace, on line 344, <code>$data =&#038; new $_type($_connection->conn);</code> with <code>unset($data);$data = new $_type($_connection->conn);</code><br />
- or turn off deprecation notices (NB: not tested): in php.ini, replace <code>error_reporting = E_ALL &#038; ~E_NOTICE &#038; ~E_DEPRECATED</code> with <code>error_reporting = E_ALL &#038; ~E_NOTICE</code> or even <code>error_reporting = 0</code>.</p>
<p>That&#8217;s it, you can now access phpPgAdmin at <a href="http://127.0.0.1/phppgadmin/">http://127.0.0.1/phppgadmin/</a> (that is, if you chose the same path as me).</p>
<h2>Sources and versions</h2>
<ul>
<li><a href="http://sql-info.de/postgresql/notes/installing-phppgadmin.html">Installing phpPgAdmin</a></li>
<li><a href="http://php.net/manual/en/errorfunc.configuration.php">PHP documentation &#8211; Runtime configuration</a></li>
<li><a href="http://php.net/manual/en/language.references.php">PHP.net &#8211; References Explained</a> &#8211; comment by Anonymous on 01-Sep-2009 08:07 about fixing the &#8220;Assigning the return value of new by reference is deprecated&#8221; notice in PHP 5.3</li>
</ul>
<p>For this short guide I used:</p>
<ul>
<li>PostgreSQL Portable v1.2.0 (contains PostgreSQL v8.3.7-1), 23 Aug 2009</li>
<li>XAMPP Lite 1.7.3 with PHP patched to 5.3.2 (see upcoming tutorial about this)</li>
<li>phpPgAdmin 4.2.3, 29 March 2010</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/628/adding-postgresql-portable-to-xampp-on-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Preventing search engines from publishing a cached version of your contents</title>
		<link>http://notepad.patheticcockroach.com/526/preventing-search-engines-from-publishing-a-cached-version-of-your-contents/</link>
		<comments>http://notepad.patheticcockroach.com/526/preventing-search-engines-from-publishing-a-cached-version-of-your-contents/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 17:30:50 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=526</guid>
		<description><![CDATA[In a &#8220;random&#8221; browsing session (see at the bottom if you want the uninteresting complete history) I found out that it was possible to disable search engine caching (or, more precisely, to hide the cache from searchers). This was something I&#8217;d been interested in doing for a while, but I never cared enough to just [...]]]></description>
			<content:encoded><![CDATA[<p>In a &#8220;random&#8221; browsing session (see at the bottom if you want the uninteresting complete history) I found out that it was possible to disable search engine caching (or, more precisely, to hide the cache from searchers). This was something I&#8217;d been interested in doing for a while, but I never cared enough to just check if it was actually possible. Now that I had stumbled upon the answer, this decided me to go farther. The info I <a href="http://en.wikipedia.org/wiki/Criticism_of_Google">originally found</a> said that &#8220;caching be disabled via the robots.txt file&#8221;. I searched a bit around that and only found out a way using meta tags:</p>
<ul>
<li><code>&lt;meta name="robots" content="noarchive" /&gt;</code> seems to be the &#8220;standard&#8221; one, &#8220;officially supported by Google, Yahoo!, Bing and Ask&#8221; (<a href="http://www.antezeta.com/blog/avoid-search-engine-indexing">source</a>). This tag is enough, the other methods I&#8217;ll list are just here for informational purpose. On a side note, this noarchive option seems pretty old, I found a reference to it <a href="http://www.webmasterworld.com/forum10003/16.htm">back in 2000</a>.</li>
<li><code>&lt;meta name="googlebot" content="noarchive" /&gt;</code> is Google-specific, that&#8217;s if you want to disable caching just for Google.</li>
<li><code>&lt;meta name="robots" content="nocache " /&gt;</code> is Bing-specific. But since Bing supports noarchive too, there&#8217;s no reason to use it&#8230;</li>
</ul>
<p>On a side note, it&#8217;s also possible to disable the page snippet/abstract, at least on Google, using the following: <code>&lt;meta name="googlebot" content="nosnippet" /&gt;</code>. Note that this option will also disable the cache.</p>
<p>Sources:</p>
<ul>
<li><a href="http://www.webmasterworld.com/forum10003/16.htm">Disabling the Google Cache:New Meta Tag : NOARCHIVE</a></li>
<li><a href="http://www.antezeta.com/blog/avoid-search-engine-indexing">6 methods to control what and how your content appears in search engines</a></li>
<li><a href="http://googleblog.blogspot.com/2007/02/robots-exclusion-protocol.html">Official Google Blog: The Robots Exclusion Protocol</a></li>
<li><a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&#038;answer=35256">Special Google searches &#8211; Webmaster Tools Help</a></li>
<li><a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&#038;answer=79812">Meta tags &#8211; Webmaster Tools Help</a></li>
</ul>
<p>As promised at the beginning, the uninteresting complete history:<br />
- someone sent me the following funky Google error message:</p>
<blockquote><p>In class com.google.gaia.frontend.page.ServiceLogin: com.google.gaia.client.GaiaRemoteException: Backend not available (backend says: Cookie decode task expired while queued) </p></blockquote>
<p>- I search for it, then for parts of it, and eventually ended up on <a href="http://blogoscoped.com/">Google Blogoscoped</a><br />
- this site referred <a href="http://blogoscoped.com/archive/2010-03-08-n13.html">at some point</a> to a Wikipedia page dedicated to <a href="http://en.wikipedia.org/wiki/Criticism_of_Google">criticism of Google</a>, where I found out that caching can be disabled.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/526/preventing-search-engines-from-publishing-a-cached-version-of-your-contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Erepublik internals exposed</title>
		<link>http://notepad.patheticcockroach.com/522/some-erepublik-internals-exposed/</link>
		<comments>http://notepad.patheticcockroach.com/522/some-erepublik-internals-exposed/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 10:25:08 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[funnies]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=522</guid>
		<description><![CDATA[Those of you who play Erepublik most likely know about the standard useless error message you get almost every day: Although fun at the first time, this isn&#8217;t exactly exciting when you keep getting it 25% of the time. The dominant hypothesis about this recurring issue was a global site overload, but I could never [...]]]></description>
			<content:encoded><![CDATA[<p>Those of you who play Erepublik most likely know about the standard useless error message you get almost every day:<br />
<a href="http://img.patheticcockroach.com/01/Erepublik_std_error.png"><img src="http://img.patheticcockroach.com/01/Erepublik_std_error.png" alt="Erepublik: Oops something went wrong (again)" width="500" height="203"/></a><br />
Although fun at the first time, this isn&#8217;t exactly exciting when you keep getting it 25% of the time. The dominant hypothesis about this recurring issue was a global site overload, but I could never see a clear proof of it. Well, today I finally got a real error message, in the form of a pretty detailed <a href="http://img.patheticcockroach.com/01/Erepublik_symfony_error.htm">symfony exception report</a>.<br />
From this, we notably learn that:<br />
- Erepublik runs in PHP 5.2.6 with Apache 2.2.9 on <a href="http://www.debian.org/">Debian</a> Lenny, using MySQL.<br />
- Erepublik uses the <a href="http://www.symfony-project.org/">symphony framework</a>, version 1.0.19 (NB: current stable version is 1.4.1&#8230;)<br />
- their <a href="http://recaptcha.net/">reCAPTCHA</a> private key was: 6LfEGgIAAAAAAByJ6OCst1yen_O1TPe6vE4LtQ6t (I guess they should change it now&#8230;)<br />
- they must have so frequent errors that they apparently didn&#8217;t configure symfony to e-mail them the errors (<code>app_sfErrorNotifier_emailTo: error@mysite.com</code>)<br />
- they seem to have a memcache server at 10.100.5.16:11211<br />
- the error does come from an overloaded database (too many connections)<br />
See the <a href="http://img.patheticcockroach.com/01/Erepublik_symfony_error.htm">complete error file</a> for more details. All this isn&#8217;t really fascinating, but it helped me wait until the overload calmed down <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Edit: bonus, the maintenance picture (rarer than the error one, although not exceptional) just popped up too. Here it is:<br />
<a href="http://img.patheticcockroach.com/01/Erepublik_maintenance.png"><img src="http://img.patheticcockroach.com/01/Erepublik_maintenance.png" alt="Erepublik: Under maintenance" width="500" height="217"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/522/some-erepublik-internals-exposed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rel=nofollow in MyBB&#8217;s links</title>
		<link>http://notepad.patheticcockroach.com/519/relnofollow-in-mybbs-links/</link>
		<comments>http://notepad.patheticcockroach.com/519/relnofollow-in-mybbs-links/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 06:30:33 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MyBB]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=519</guid>
		<description><![CDATA[Yesterday I had to do some cleaning on the low-traffic Wiki4Games BBS, running MyBB. Basically the spammers registered accounts which never posted (so I barely noticed those account creations) and had a few (usually 1 or 2) spam links in their signature. In case you start thinking a spam signature is harmless as long as [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I had to do some cleaning on the low-traffic Wiki4Games BBS, running MyBB. Basically the spammers registered accounts which never posted (so I barely noticed those account creations) and had a few (usually 1 or 2) spam links in their signature. In case you start thinking a spam signature is harmless as long as you don&#8217;t post with it, let me remind you that the signature appears on the user&#8217;s profile. So it gets seen by you-know-who-who-browses-everywhere. I found a <a href="http://mods.mybboard.net/view/nofollow-website-links">MyBB mod to nofollow user websites</a>, but no equivalent for signatures. I don&#8217;t think it&#8217;s easily feasible to nofollow specifically the links in the signature, so I went for the parser, i.e. I tried to nofollow all links posted within a [url] tag (NB: this also works on URLs posted without the url tag, as long as they&#8217;re identified as url by the parser). No further ado, here it is:</p>
<ul>
<li>Open <em>inc/class_parser.php</em></li>
<li>In <code>function mycode_parse_url</code>, find:<br />
<code>$link = "&lt;a href=\"$fullurl\" target=\"_blank\"&gt;$name&lt;/a&gt;";</code></li>
<li>Replace it with:<br />
<code>$link = "&lt;a href=\"$fullurl\" target=\"_blank\" rel=\"nofollow\"&gt;$name&lt;/a&gt;";</code></li>
</ul>
<p>Save, upload, and you&#8217;re done.</p>
<p>As for the website URL from the website field, well, do as indicated on <a href="http://mods.mybboard.net/view-resource/change-users-website-url-to-nofollow">this tutorial</a>, which summarizes as: add rel=nofollow in the postbit_www template. Or, better (this will also deal with the website on the user profile page and not just on the &#8220;www&#8221; button), install the previously mentionned <a href="http://mods.mybboard.net/view/nofollow-website-links">NoFollow Website Links</a> extension.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/519/relnofollow-in-mybbs-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controling signature size in MyBB</title>
		<link>http://notepad.patheticcockroach.com/370/controling-signature-size-in-mybb/</link>
		<comments>http://notepad.patheticcockroach.com/370/controling-signature-size-in-mybb/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 08:09:32 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MyBB]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=370</guid>
		<description><![CDATA[Today on the Wiki4Games BBS I had to deal with a way too large user signature. Eventually, I came up with several ways to solve the problem: At first I installed a plugin called Image signature Limit. I don&#8217;t know for sure if it works fine, as I didn&#8217;t test it specifically. The problem with [...]]]></description>
			<content:encoded><![CDATA[<p>Today on the Wiki4Games BBS I had to deal with a way too large user signature. Eventually, I came up with several ways to solve the problem:</p>
<p>At first I installed a plugin called <a href="http://mods.mybboard.net/view/image-signature-limit-1-0">Image signature Limit</a>. I don&#8217;t know for sure if it works fine, as I didn&#8217;t test it specifically. The problem with this plugin is that it doesn&#8217;t fix signatures which have been created in the past, and also it only takes care about the pictures, not the text size. So I left it enabled to prevent further submissions of too huge sig pictures, and I looked after another solution: manual style edits.</p>
<p>In MyBB you can edit templates and styles from the admin panel. Of course this is very tedious if you use several templates, but luckily for me I use only one, so this solution is good for me.</p>
<ol>
<li>open the <em>postbit_signature</em> template. Its content should be:<br />
<code>&lt;hr size="1" width="25%"  align="left" /&gt;<br />
{$post['signature']}</code><br />
Replace it with<br />
<code>&lt;div class="signature"&gt;<br />
{$post['signature']}<br />
&lt;/div&gt;</code></li>
<li>open <em>global.css</em> and add:<br />
<code>.signature img {max-width:600px; max-height:150px; overflow:hidden;}<br />
.signature {border-top: 1px solid #aaaaaa; width:100%; margin-top:1em; padding-top:0.2em; max-height:200px; overflow:hidden;}</code></li>
</ol>
<p>That&#8217;s it. You can change the maximum height and width you want, of course. We also replaced the very ugly &lt;hr&gt; with a lighter 100% width border, of course this part is optional, it&#8217;s not needed to limit the signature size but very needed to give a decent look to the board IMO. The max-height and max-width attributes are, as far as I know, part of the CSS 2 specification, and work on Firefox, Opera, Safari, MSIE 7+.</p>
<p>This &#8220;tutorial&#8221; was tested using the Default theme on MyBB 1.4.7. At the time I&#8217;m writing you can view the result on <a href="http://bbs.wiki4games.com">http://bbs.wiki4games.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/370/controling-signature-size-in-mybb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a sitemap with MediaWiki&#8230; and how to submit it to Google</title>
		<link>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/</link>
		<comments>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:00:25 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=352</guid>
		<description><![CDATA[Creating the map MediaWiki does have a function to generate its own sitemap. The script is located in the maintenance folder and is called generateSitemap.php. It have to be run from the console (thus you need the php-cli package). In order to have a regularly updated map, we chose to configure its generation to run [...]]]></description>
			<content:encoded><![CDATA[<h2>Creating the map</h2>
<p>MediaWiki does have a function to generate its own sitemap. The script is located in the maintenance folder and is called generateSitemap.php. It have to be run from the console (thus you need the php-cli package). In order to have a regularly updated map, we chose to configure its generation to run as a daily Cron job. The command is quite straightforward:</p>
<blockquote><p><code>php /home/username/www/maintenance/generateSitemap.php --fspath="/home/username/www" --server="http://www.wiki4games.com" --compress=no</code></p></blockquote>
<p>NB: as for some or most of the maintenance scripts, this script requires <em>AdminSettings.php</em> (in the wiki&#8217;s root folder) to be filled properly. This file basically contains the login and password for a database user, and can be created based on <em>AdminSettings.sample</em>.</p>
<ul>
<li>/home/username/www/maintenance/generateSitemap.php is obviously the absolute path to generateSitemap.php</li>
<li>&#8211;fspath=&#8221;/home/username/www&#8221; is the path to the folder where you want to save the sitemaps. The script will generate quite a few files, at <strong>it will create one sitemap per namespace</strong>. Yet, if you want to submit it to Google, you must not place the sitemaps in a subfolder of the wiki (see farther)</li>
<li>&#8211;server=&#8221;http://www.wiki4games.com&#8221; is optional (use it if auto detection fails&#8230; or systematically if you prefer)</li>
<li>&#8211;compress=no disable sitemap compression. I don&#8217;t know if Google is able to read compressed sitemaps, so I disabled it (default is yes)</li>
</ul>
<h2>Submitting the map</h2>
<p>To submit the sitemap to Google, go verify your site to <a href="https://www.google.com/webmasters/tools">Google Webmaster Tools</a> (if you have soft 404 errors you&#8217;ll need to choose the meta tag verification, to add a meta tag just edit your default skin &#8211; eg skins/MonoBook.php -, search for &#8220;&lt;head&gt;&#8221; and add the meta tag somewhere after it) then submit the sitemap index, which is named something like sitemap-index-[database name]-[table prefix].xml. And wait for it to be crawled (should take a few minutes).</p>
<h2>Fixing the errors</h2>
<h3>URL not allowed</h3>
<blockquote><p>URL not allowed<br />
This url is not allowed for a Sitemap at this location.</p></blockquote>
<p>This means that you placed your sitemap either in a level inferior to the pages you are listing (ie in a subfolder), either on another domain (if you&#8217;re listing https://www.mywiki.com, you can&#8217;t place the sitemaps in http://www.mywiki.com nor in https://www.mywiki.com/mymaps). So just move the sitemap to an appropriate place (very same domain and higher or same level as all the URLs listed).</p>
<h3>Invalid URL</h3>
<blockquote><p>Invalid URL<br />
We&#8217;ve detected that a Sitemap you&#8217;ve listed doesn&#8217;t include the full URL.</p></blockquote>
<p>This is just a warning that shouldn&#8217;t prevent indexing. Yet for a nicer icon (valid instead of warning <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) you may want to fix it. This warning is due to the fact that the sitemap index created by the script uses relatives URLs instead of absolute ones. To fix it, you&#8217;ll have to edit the script:</p>
<ul>
<li>open generateSitemap.php</li>
<li>search for <code>function indexEntry</code></li>
<li>in this function, find <code>"\t\t<loc>$filename</loc>\n"</code> and add the path need to make the URL complete. For instance if your sitemap index is on <code>http://www.mywiki.com/sitemap-index-wiki4games-wg_.xml</code>, replace this text with <code>"\t\t<loc>http://www.mywiki.com/$filename</loc>\n"</code> (note the slash!)</li>
</ul>
<p>Regenerate your sitemap, then resubmit it to Google. All should be fine now&#8230; except if one of your maps has over 50k URLs (Google doesn&#8217;t accept this, you need to split them&#8230; and I don&#8217;t know how to do this :/)</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/352/creating-a-sitemap-with-mediawiki-and-how-to-submit-it-to-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Adsense in MediaWiki 1.14.0</title>
		<link>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/</link>
		<comments>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 14:27:07 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=295</guid>
		<description><![CDATA[Here is how we set up Google Adsense (and more generally, a customized ad area which will show Google Adsense on pages where it is allowed, and another ad on other pages) to show in MediaWiki 1.14.0: 1. Force the monobook skin for everyone (unless you want to edit every skin…) by putting this setting [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how we set up Google Adsense (and more generally, a customized ad area which will show Google Adsense on pages where it is allowed, and another ad on other pages) to show in MediaWiki 1.14.0:</p>
<p>1. Force the monobook skin for everyone (unless you want to edit every skin…) by putting this setting in LocalSettings.php:<br />
<code>$wgAllowUserSkin = false;</code><br />
NB: this setting is new to MediaWiki 1.14! If you have an older version, either upgrade or see <a href="http://notepad.patheticcockroach.com/209/google-adsense-in-mediawiki-1130/">our previous tutorial</a></p>
<p>2. In your skins folder, create a file within a subfolder (for instance “0custom/ad_vertical.php”) with the following content (edit with your own Google Adsense code as well as your own alternative ad; also, make sure to choose a VERTICAL ad, since we are adding code in the left sidebar!):<br />
<code>&lt;?php<br />
if(!strstr($_SERVER['REQUEST_URI'], "Special:") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "action=submit") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "action=edit") &#038;&#038;<br />
!strstr($_SERVER['REQUEST_URI'], "Template:"))<br />
echo '&lt;div id="v-g-ads" class="portlet"&gt;<br />
&lt;h5&gt;Google ads&lt;/h5&gt;<br />
&lt;div class="pBody"&gt;<br />
&lt;script type="text/javascript"&gt;&lt;!--<br />
google_ad_client = "pub-9471398824076666";<br />
/* 120x240 for Wiki4Games sidebar */<br />
google_ad_slot = "3512091103";<br />
google_ad_width = 120;<br />
google_ad_height = 240;<br />
//--&gt;<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript"<br />
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;<br />
&lt;/script&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;';<br />
else echo '&lt;div id="v-g-ads" class="portlet"&gt;<br />
&lt;h5&gt;Ads&lt;/h5&gt;<br />
&lt;div class="pBody"&gt;<br />
&lt;a href="http://proxify.com/r/?s=1320"&gt;&lt;img src="http://proxify.com/i/info-110x110.gif" width="110" height="110" alt="disable proxy" border="0"&gt;&lt;/a&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;';<br />
?&gt;</code></p>
<p>3. Edit MonoBook.php as follow:<br />
Replace:<br />
<code>	function languageBox() {<br />
		if( $this-&gt;data['language_urls'] ) {<br />
?&gt;<br />
	&lt;div id="p-lang" class="portlet"&gt;<br />
		&lt;h5&gt;&lt;?php $this-&gt;msg('otherlanguages') ?&gt;&lt;/h5&gt;<br />
		&lt;div class="pBody"&gt;<br />
			&lt;ul&gt;<br />
&lt;?php		foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />
				&lt;li class="&lt;?php echo htmlspecialchars($langlink['class'])?&gt;"&gt;&lt;?php<br />
				?&gt;&lt;a href="&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;"&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php		} ?&gt;<br />
			&lt;/ul&gt;<br />
		&lt;/div&gt;<br />
	&lt;/div&gt;<br />
&lt;?php<br />
		}<br />
	}</code><br />
With:<br />
<code>	function languageBox() {<br />
		if( $this-&gt;data['language_urls'] ) {<br />
?&gt;<br />
	&lt;div id="p-lang" class="portlet"&gt;<br />
		&lt;h5&gt;&lt;?php $this-&gt;msg('otherlanguages') ?&gt;&lt;/h5&gt;<br />
		&lt;div class="pBody"&gt;<br />
			&lt;ul&gt;<br />
&lt;?php		foreach($this-&gt;data['language_urls'] as $langlink) { ?&gt;<br />
				&lt;li class="&lt;?php echo htmlspecialchars($langlink['class'])?&gt;"&gt;&lt;?php<br />
				?&gt;&lt;a href="&lt;?php echo htmlspecialchars($langlink['href']) ?&gt;"&gt;&lt;?php echo $langlink['text'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />
&lt;?php		} ?&gt;<br />
			&lt;/ul&gt;<br />
		&lt;/div&gt;<br />
	&lt;/div&gt;<br />
&lt;?php<br />
		}<br />
include("0custom/ad_vertical.php");<br />
	}</code><br />
NB: In fact we&#8217;re just adding the include at the end of the function.</p>
<p>4. Upload the stuff (don’t forget there are 2 files to upload, not just one), and you&#8217;re done <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/295/google-adsense-in-mediawiki-1140/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Preventing MediaWiki from revealing your server versions</title>
		<link>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/</link>
		<comments>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 13:32:33 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=273</guid>
		<description><![CDATA[MediaWiki features a special page, Special:Version, which displays MediaWiki&#8217;s license, but also a list of the currently installed extensions (with their version), as well as the versions of MediaWiki, PHP and MySQL. For security reasons, you may want to avoid displaying all these versions. As far as I know, no setting can disable the display [...]]]></description>
			<content:encoded><![CDATA[<p>MediaWiki features a special page, <a href="http://www.wiki4games.com/index.php?title=Special:Version">Special:Version</a>, which displays MediaWiki&#8217;s license, but also a list of the currently installed extensions (with their version), as well as the versions of MediaWiki, PHP and MySQL. For security reasons, you may want to avoid displaying all these versions. As far as I know, no setting can disable the display of versions. But you can directly edit MediaWiki&#8217;s source to do so, which is quite straightforward:</p>
<p>1. Open &#8220;includes/specials/SpecialVersion.php&#8221; with a text editor</p>
<p>2. Find the lines:<br />
<code>$this->softwareInformation() .<br />
$this->extensionCredits();</code></p>
<p>3. Comment out the lines you want to hide (the first one is for MediaWiki, PHP and MySQL; the second one for the extensions), for instance if I want to only hide MediaWiki, PHP and MySQL versions, the new code is:<br />
<code>//$this->softwareInformation() .<br />
$this->extensionCredits();</code></p>
<p>4. Upload the new file to your server.</p>
<p>That&#8217;s it. Don&#8217;t forget to reapply this &#8220;patch&#8221; every time you upgrade MediaWiki though!</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/273/preventing-mediawiki-from-revealing-your-server-versions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost your admin password in LimeSurvey?</title>
		<link>http://notepad.patheticcockroach.com/264/lost-your-admin-password-in-limesurvey/</link>
		<comments>http://notepad.patheticcockroach.com/264/lost-your-admin-password-in-limesurvey/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 06:16:54 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=264</guid>
		<description><![CDATA[If you lose your LimeSurvey admin password, you can&#8217;t easily change it in the database because it&#8217;s hashed in sha256 + saved as blob. A possibility (which I didn&#8217;t test) would be to create a tiny PHP page that outputs just the hash of your wanted new pass, save this as a text file and [...]]]></description>
			<content:encoded><![CDATA[<p>If you lose your LimeSurvey admin password, you can&#8217;t easily change it in the database because it&#8217;s hashed in sha256 + saved as blob.</p>
<p>A possibility (which I didn&#8217;t test) would be to create a tiny PHP page that outputs just the hash of your wanted new pass, save this as a text file and upload it in phpMyAdmin.</p>
<p>Another possibility is to follow the <a href="http://docs.limesurvey.org/tiki-index.php?page=General+FAQ#5_I_forgot_my_admin_password_How_do_I_reset_it_">LimeSurvey wiki</a>, which says to restore the install folder and run a password reset script (btw, this explains a lot why you need to delete/move the install folder after the installation process&#8230;).</p>
<p>My personal favorite, because I think it&#8217;s the fastest, is:</p>
<ol>
<li>edit the file admin/usercontrol.php as follow:<br/><br />
find <code>if (SHA256::hash($_POST['password']) == $fields['password'])</code> (in LimeSurvey 1.72 it&#8217;s on line 115)<br />
replace it with <code>if(true)</code></li>
<li>now log in using your proper admin login and any password</li>
<li>go to user management and edit the your password (don&#8217;t worry, it won&#8217;t ask you to enter your old password)</li>
<li>edit admin/usercontrol.php back to normal, i.e. replace:<br />
<code>if(true)</code><br />
with<br />
<code>if (SHA256::hash($_POST['password']) == $fields['password'])</code></li>
</ol>
<p>Now you&#8217;re done <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
It should be noted that with this method, anyone can log in to any account provided that they know the name of this account. So if your admin account is easy to guess (random example: if you let the defaut name &#8220;admin&#8221;), the method is a bit risky, particularly if you&#8217;re slow. In this case, putting an .htacces like the following one in the admin folder would be more reasonable:<br />
<code>Order Deny,Allow<br />
    Deny from all<br />
    Allow from [put your IP here]<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/264/lost-your-admin-password-in-limesurvey/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A bit on regular expressions: my .htaccess files</title>
		<link>http://notepad.patheticcockroach.com/237/a-bit-on-regular-expressions-my-htaccess-files/</link>
		<comments>http://notepad.patheticcockroach.com/237/a-bit-on-regular-expressions-my-htaccess-files/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 06:00:39 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=237</guid>
		<description><![CDATA[I totally hate regular expressions. I never managed to find a decent manual or reference properly explaining them. By properly I mean a manual that gives me all the details I need (which isn&#8217;t quite much indeed) while being short enough to not make me fall asleep in boredom (which for regex should mean something [...]]]></description>
			<content:encoded><![CDATA[<p>I totally hate regular expressions. I never managed to find a decent manual or reference properly explaining them. By properly I mean a manual that gives me all the details I need (which isn&#8217;t quite much indeed) while being short enough to not make me fall asleep in boredom (which for regex should mean something like less than 2 printed pages&#8230; or just something with tons of examples). This sounds easy enough. Well, it doesn&#8217;t seem to exist though. So I&#8217;ll be posting some regexp that I eventually managed to find around, or even to create myself (woo!).<br />
Let&#8217;s start with:<br />
<code>^http://[A-Za-z0-9]*\.patheticcockroach\.com/.*$</code></p>
<p>I needed this one for various anti-leech protections, including on this very site (notably for the img server), as used in this .htaccess file:</p>
<p><code>RewriteEngine on<br />
RewriteCond %{HTTP_REFERER} !^http://patheticcockroach\.com/.*$      [NC]<br />
RewriteCond %{HTTP_REFERER} !^http://patheticcockroach\.com$      [NC]<br />
RewriteCond %{HTTP_REFERER} !^http://[A-Za-z0-9]*\.patheticcockroach\.com/.*$      [NC]<br />
RewriteCond %{HTTP_REFERER} !^http://[A-Za-z0-9]*\.patheticcockroach\.com$      [NC]<br />
RewriteCond %{HTTP_REFERER} !^$      [NC]<br />
RewriteRule \.(jpg|jpeg|gif|png|bmp|7z|exe|xpi)$ - [F,NC]</code></p>
<ul>
<li>RewriteEngine on: loads mod_rewrite (NB: you still need to have mod_rewrite enabled in your Apache configuration, though)</li>
<li>RewriteCond %{HTTP_REFERER} !^http://patheticcockroach\.com$      [NC]: RewriteCond is a directive which defines a condition under which rewriting will take place. The syntax is RewriteCond $StringToTest $Regex [$flags].<br />
%{HTTP_REFERER} refers to the referrer HTTP header (variable names have to be used like: %{variable name}). &#8220;!&#8221; means (like usual) &#8220;not&#8221;.<br />
^http://patheticcockroach\.com$ is the regexp to which we compare the referrer. &#8220;^&#8221; means string start, &#8220;\&#8221; is used to escape the dots (which otherwise are part of regex syntax), &#8220;$&#8221; means string end.<br />
[NC] means we don&#8217;t care about the case.<br />
So this regex will match &#8220;http://patheticcockroach.com&#8221;, and with the additional mod_rewrite NC flag, this will also match, for instance &#8220;http://PATHETICcockroach.com&#8221;</li>
<li>RewriteCond %{HTTP_REFERER} !^http://patheticcockroach\.com/.*$      [NC]: almost the same, except for the &#8220;.*&#8221;. &#8220;.&#8221; (dot) means &#8220;any character&#8221;. &#8220;*&#8221; (asterisk) means &#8220;the preceding element can be there zero to an infinite number of times&#8221;.<br />
So this will match, for instance &#8220;http://patheticcockroach.com/mpam4/?p=4&#8243;.</li>
<li>RewriteCond %{HTTP_REFERER} !^http://[A-Za-z0-9]*\.patheticcockroach\.com$      [NC]: [A-Za-z0-9] means &#8220;one character in the range A to Z, a to z or 0 to 9&#8243;. As we saw earlier, &#8220;*&#8221; means &#8220;the preceding element can be there zero to an infinite number of times&#8221;.<br />
So this will match things like &#8220;http://notepad.patheticcockroach.com&#8221; or &#8220;http://ngfdg45FD.patheticcockroach.com&#8221;. Note that specifying A to Z AND a to z is redundant, since we specify at the end &#8220;[NC]&#8220;.</li>
<li>RewriteCond %{HTTP_REFERER} !^$      [NC]: ^$ is the empty string, so if the user uses a very old browser which doesn&#8217;t send referrers (or most likely a browser configured to not send referrers), we still accept it.</li>
<li>RewriteRule \.(jpg|jpeg|gif|png|bmp|7z|exe|xpi)$ &#8211; [F,NC]: RewriteRule is a directive which defines rules for the rewriting engine. The syntax is RewriteRule $Regex $Substitution [$flags].<br />
\.(jpg|jpeg|gif|png|bmp|7z|exe|xpi)$ matches &#8220;.jpg&#8221;, &#8220;.jpeg&#8221;, &#8220;.gif&#8221;, &#8220;.png&#8221;, &#8220;.bmp&#8221;, &#8220;.7z&#8221;, &#8220;.exe&#8221;, &#8220;.xpi&#8221;. We already saw the meanings of &#8220;\&#8221; (backslash), &#8220;.&#8221; and &#8220;$&#8221;. The parentheses are used the same way as most often, to group/sort operators. &#8220;|&#8221; (vertical bar) means &#8220;or&#8221;. So jpg|png means jpg or png. And \.(jpg|png) means .jpg or .png.<br />
&#8220;-&#8221; (dash) means we do no substitution. We already saw the NC flag. The F flag means the requested URL will be forbidden (if the RewriteConds are all true, eg if the URL doesn&#8217;t match our regex.</li>
</ul>
<p>The funny thing is that, as I wrote this post, I got a bit more friendly to regexp and mod_rewrite&#8230; well, that was part of the objective I guess. The references I used today:</p>
<ul>
<li><a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite in the Apache 2.2 documentation</a> (talks about RewriteEngine, RewriteCond, RewriteRule and much more)</li>
<li><a href="http://en.wikipedia.org/wiki/Regular_expression">Regular expressions on Wikipedia</a>: not the &#8220;decent manual&#8221; I was talking about in the intro, but still decent indeed <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/hs600312(VS.80).aspx">Some page on regex on Micro$oft</a>. I didn&#8217;t really use it, but this is what decided me to make this post, and there are some elements I&#8217;d like to check later&#8230; Okay, I&#8217;m just making a bookmark.</li>
<li><a href="http://www.regular-expressions.info/javascriptexample.html">A regex tester</a> (making another bookmark indeed).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/237/a-bit-on-regular-expressions-my-htaccess-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
