<?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>Ben Jao Ming &#187; Web</title>
	<atom:link href="http://overtag.dk/wordpress/category/computers/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://overtag.dk/wordpress</link>
	<description>101% objective... always</description>
	<lastBuildDate>Wed, 02 May 2012 13:16:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Stopforumspam Django Middleware</title>
		<link>http://overtag.dk/wordpress/2011/09/stopforumspam-django-middleware/</link>
		<comments>http://overtag.dk/wordpress/2011/09/stopforumspam-django-middleware/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 03:07:32 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=269</guid>
		<description><![CDATA[I have created a new Django app for keeping out spammers on the basis of data collected by stopforumspam.com. Read all about it here » It&#8217;s free, open source, and I hope people will make it better on github.]]></description>
			<content:encoded><![CDATA[<p><a href="http://overtag.dk/wordpress/wp-content/uploads/Screenshot.png"><img class="alignright size-thumbnail wp-image-272" title="Screenshot" src="http://overtag.dk/wordpress/wp-content/uploads/Screenshot-150x150.png" alt="" width="150" height="150" /></a>I have created a new Django app for keeping out spammers on the basis of data collected by stopforumspam.com. <a title="Stopforumspam Django Middleware" href="http://overtag.dk/wordpress/projects/stopforumspam-django-middleware/">Read all about it here »</a></p>
<p>It&#8217;s free, open source, and I hope people will make it better on github.</p>
]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2011/09/stopforumspam-django-middleware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating stopforumspam.com ASAP (updated!)</title>
		<link>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com-updated/</link>
		<comments>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com-updated/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 19:06:41 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[stopforumspam.com]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=254</guid>
		<description><![CDATA[In case you need a quick way of getting rid of spammers on your apache server, use this method as a temporary solution until you find a better one. Please take not that it will evaluate EVERY SINGLE REQUEST through &#8230; <a href="http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you need a quick way of getting rid of spammers on your apache server, use this method as a temporary solution until you find a better one.</p>
<p>Please take not that it will evaluate EVERY SINGLE REQUEST through a Deny policy in Apache&#8217;s mod_access &#8211; it does not halt your performance much if you&#8217;re just running a site with few requests. But I only suggest this solution as a temporary one until you have a better integration. I am currently working on a Django middleware that will only check the client&#8217;s IP address in case it is a POST request directed at a certain URL.</p>
<p>Since I&#8217;ve been told that Apache doesn&#8217;t use /etc/hosts.deny, you should probably use this method instead, unless you have a webserver that actually uses hosts.deny. Another method would be to add the IP addresses to iptables, if you&#8217;re running that &#8212; this is probably more efficient than using Apache configuration policies.</p>
<p>This method creates a file that you can include in httpd.conf (to cover ALL your virtual hosts). The overall goal is to avoid .htaccess files since they are evaluated at runtime. Thus, you won&#8217;t have to configure each site, and you save a but of CPU time.</p>
<ol>
<li>Copy the script below to a file on your server, eg. <strong>/usr/sbin/stopforumspam.py</strong>. You might want to read it quickly as it will pretty much explain itself&#8230;</li>
<li>Make the file executable, eg. <strong>chmod +x /usr/sbin/stopforumspam.py</strong></li>
<li>Add it to your crontab for automatic execution each night, eg. <strong>crontab -e</strong> and then insert the line <strong>0 0 * * * /usr/sbin/stopforumspam.py &amp;&amp; /etc/init.d/apache2 reload </strong></li>
<li>By default, we will ban an entire class C subnet if more than 5 IP addresses are in this space. You can configure this behavior by giving stopforumspam.py a single argument, ie. <strong>/usr/sbin/stopforumspam.py 10</strong> would mean that at least 10 IPs have to be within the class C subnet to qualify it for a ban.</li>
<li>By default stopforumspam.py creates <strong>/etc/apache2/stopforumspam.conf</strong> &#8211; you can change this by editing the script.</li>
<li>Add <strong>Include /etc/apache2/stopforumspam.conf</strong> to <strong>/etc/apache2/httpd.conf</strong> (Debian/Ubuntu).</li>
<li><strong style="color: #C00">Caution!</strong> Make sure that you DO NOT change the <strong>Order Deny,Allow</strong> option in VirtualHost directives or .htaccess files as this unblock the deny policies.</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">zipfile</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff4500;">1</span>:
    SUBNET_THRESHOLD = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
    SUBNET_THRESHOLD = <span style="color: #ff4500;">5</span>
&nbsp;
DOWNLOAD_ZIP = <span style="color: #483d8b;">&quot;http://www.stopforumspam.com/downloads/listed_ip_7.zip&quot;</span>
ZIP_FILENAME = <span style="color: #483d8b;">&quot;listed_ip_7.txt&quot;</span>
&nbsp;
HTTPD_CONFIG_INCLUDE = <span style="color: #483d8b;">&quot;/etc/apache2/stopforumspam.conf&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># For security purposes we test that each line is actually an IP address</span>
IP_MATCH = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;^(<span style="color: #000099; font-weight: bold;">\d</span>+)<span style="color: #000099; font-weight: bold;">\.</span>(<span style="color: #000099; font-weight: bold;">\d</span>+)<span style="color: #000099; font-weight: bold;">\.</span>(<span style="color: #000099; font-weight: bold;">\d</span>+)<span style="color: #000099; font-weight: bold;">\.</span>(<span style="color: #000099; font-weight: bold;">\d</span>+)$&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
filename, headers = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlretrieve</span><span style="color: black;">&#40;</span>DOWNLOAD_ZIP<span style="color: black;">&#41;</span>
&nbsp;
z = <span style="color: #dc143c;">zipfile</span>.<span style="color: black;">ZipFile</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>
ips = z.<span style="color: black;">read</span><span style="color: black;">&#40;</span>ZIP_FILENAME<span style="color: black;">&#41;</span>
&nbsp;
ips = ips.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Remove non-ip members</span>
ips = <span style="color: #008000;">filter</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> ip: IP_MATCH.<span style="color: black;">match</span><span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>, ips<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_ip_segments<span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>:
    segments_match = IP_MATCH.<span style="color: black;">search</span><span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>segments_match.<span style="color: black;">group</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> convert_ip_to_number<span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>:
    numeric_value = <span style="color: #ff4500;">0</span>
    ip_segs = get_ip_segments<span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>:
      numeric_value += ip_segs<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: #66cc66;">*</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">255</span><span style="color: #66cc66;">**</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">4</span>-i<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> numeric_value
&nbsp;
<span style="color: #808080; font-style: italic;"># Sort everything first</span>
ips.<span style="color: black;">sort</span><span style="color: black;">&#40;</span>key=convert_ip_to_number<span style="color: black;">&#41;</span>
&nbsp;
subnets = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> ip <span style="color: #ff7700;font-weight:bold;">in</span> ips:
    ip_segs = get_ip_segments<span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>
    key = <span style="color: black;">&#40;</span>ip_segs<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, ip_segs<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, ip_segs<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> key <span style="color: #ff7700;font-weight:bold;">in</span> subnets.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        subnets<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span>ip<span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        subnets<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>
&nbsp;
final_list = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> subnet, subnet_ips <span style="color: #ff7700;font-weight:bold;">in</span> subnets.<span style="color: black;">items</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>subnet_ips<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> SUBNET_THRESHOLD:
        <span style="color: #808080; font-style: italic;"># Ban the whole subnet</span>
        final_list.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span>, subnet<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;.0/24&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        final_list = final_list + subnet_ips
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Lengh of original list: %d&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>ips<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Lengh of final list: %d&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>final_list<span style="color: black;">&#41;</span>
&nbsp;
apache_conf_file = <span style="color: #008000;">file</span><span style="color: black;">&#40;</span>HTTPD_CONFIG_INCLUDE, <span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
apache_conf_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
apache_conf_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;    Order Deny,Allow<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> entry <span style="color: #ff7700;font-weight:bold;">in</span> final_list:
    apache_conf_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;    Deny from %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> entry<span style="color: black;">&#41;</span>
&nbsp;
apache_conf_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
apache_conf_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automating stopforumspam.com</title>
		<link>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com/</link>
		<comments>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 22:33:40 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=251</guid>
		<description><![CDATA[THIS DOES NOT WORK WITH APACHE SINCE IT DOES NOT USE /etc/hosts.deny &#8211; See this post instead Use the following Python script to maintain a file in the hosts.deny syntax so that your Debian/Ubuntu box (or other Linux server) is &#8230; <a href="http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color: #ff0000;">THIS DOES NOT WORK WITH APACHE SINCE IT DOES NOT USE /etc/hosts.deny<span style="color: #000000;"> &#8211; <a href="http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com-updated/">See this post instead</a></span></span></strong></p>
<p>Use the following Python script to maintain a file in the hosts.deny syntax so that your Debian/Ubuntu box (or other Linux server) is kept undisturbed by forum spammers &#8212; COMPLETELY undisturbed, as the spammer is disallowed all access to the system.</p>
<p>1. Copy the script to a file on your server, eg. <strong>/usr/sbin/stopforumspam.py</strong><br />
2. Make the file executable, eg. <strong>chmod +x /usr/sbin/stopforumspam.py</strong><br />
3. Add it to your crontab for automatic execution each night, eg. <strong>crontab -e</strong> and then insert the line <strong>0 0 * * * /usr/sbin/stopforumspam.py</strong><br />
4. Add the path to the file containing the ip list to /etc/hosts.deny by inserting this line: <strong>ALL: /etc/hosts.deny.stopforumspam</strong></p>
<p>The script itself is here, modify it as you need.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">zipfile</span>
&nbsp;
DOWNLOAD_ZIP = <span style="color: #483d8b;">&quot;http://www.stopforumspam.com/downloads/listed_ip_7.zip&quot;</span>
ZIP_FILENAME = <span style="color: #483d8b;">&quot;listed_ip_7.txt&quot;</span>
&nbsp;
HOSTS_DENY = <span style="color: #483d8b;">&quot;hosts.deny.stopforumspam&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># For security purposes we test that each line is actually an IP address</span>
IP_MATCH = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\d</span>+<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>+<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>+<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>+&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
filename, headers = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlretrieve</span><span style="color: black;">&#40;</span>DOWNLOAD_ZIP<span style="color: black;">&#41;</span>
&nbsp;
z = <span style="color: #dc143c;">zipfile</span>.<span style="color: black;">ZipFile</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>
ips = z.<span style="color: black;">read</span><span style="color: black;">&#40;</span>ZIP_FILENAME<span style="color: black;">&#41;</span>
&nbsp;
deny_file = <span style="color: #008000;">file</span><span style="color: black;">&#40;</span>HOSTS_DENY, <span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> ip <span style="color: #ff7700;font-weight:bold;">in</span> ips.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> IP_MATCH.<span style="color: black;">match</span><span style="color: black;">&#40;</span>ip<span style="color: black;">&#41;</span>:
        deny_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> ip<span style="color: black;">&#41;</span>
&nbsp;
deny_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2011/09/automating-stopforumspam-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uservoice feedback widget: Changing its style</title>
		<link>http://overtag.dk/wordpress/2009/09/uservoice-feedback-widget-changing-its-style/</link>
		<comments>http://overtag.dk/wordpress/2009/09/uservoice-feedback-widget-changing-its-style/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 09:19:49 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[feedback]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[uservoice]]></category>
		<category><![CDATA[vertical]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=173</guid>
		<description><![CDATA[I have a feedback tab that&#8217;s blocking vital content on a website. Here&#8217;s how to alter the style of the Uservoice Feedback Tab &#8212; for instance the vertical offset: You have to insert this AFTER your widget js code, so &#8230; <a href="http://overtag.dk/wordpress/2009/09/uservoice-feedback-widget-changing-its-style/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have a feedback tab that&#8217;s blocking vital content on a website. Here&#8217;s how to alter the style of the Uservoice Feedback Tab &#8212; for instance the vertical offset: You have to insert this AFTER your widget js code, so that it will effectively overwrite the CSS declarations generated by Uservoice. Also it&#8217;s pretty annoying that it shows up on printed media, so the last style block is to remove it from print.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
  body a<span style="color: #cc00cc;">#uservoice-feedback-tab</span><span style="color: #00AA00;">,</span>
  body a<span style="color: #cc00cc;">#uservoice-feedback-tab</span><span style="color: #3333ff;">:link
  </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> !important<span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span>
&lt;style rel<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> media<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;print&quot;</span><span style="color: #00AA00;">&gt;</span>
  body a<span style="color: #cc00cc;">#uservoice-feedback-tab</span><span style="color: #00AA00;">,</span>
  body a<span style="color: #cc00cc;">#uservoice-feedback-tab</span><span style="color: #3333ff;">:link
  </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span> !important<span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2009/09/uservoice-feedback-widget-changing-its-style/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MarkItUp Markdown footnote button</title>
		<link>http://overtag.dk/wordpress/2009/09/markitup-markdown-footnote-button/</link>
		<comments>http://overtag.dk/wordpress/2009/09/markitup-markdown-footnote-button/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 11:51:05 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[markitup]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=164</guid>
		<description><![CDATA[Here&#8217;s a simple addition to markItUp, that will prompt the user for a footnote number, a footnote text and then insert the number after the selection and the footnote text at the end of the full text. As handy extra &#8230; <a href="http://overtag.dk/wordpress/2009/09/markitup-markdown-footnote-button/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple addition to markItUp, that will prompt the user for a footnote number, a footnote text and then insert the number after the selection and the footnote text at the end of the full text. As handy extra feature, the plugin will save the previous entered footnote and not ask for further numbers during the session, but instead increment the number each time the button is pressed.</p>
<p>Add this to your code to <strong>set.js</strong> inside your settings object:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'Insert footnote'</span><span style="color: #339933;">,</span>
	beforeInsert<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		instructions <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Type in the number of the footnote:)&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>h.<span style="color: #660066;">last_footnote</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			h.<span style="color: #660066;">last_footnote</span> <span style="color: #339933;">=</span> <span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span>instructions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isNaN<span style="color: #009900;">&#40;</span>h.<span style="color: #660066;">last_footnote</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				h.<span style="color: #660066;">last_footnote</span> <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>h.<span style="color: #660066;">last_footnote</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">else</span>
				h.<span style="color: #660066;">last_footnote</span> <span style="color: #339933;">=</span> <span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span>instructions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		h.<span style="color: #660066;">footnote_content</span> <span style="color: #339933;">=</span> <span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Type in the text of the footnote:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	closeWith<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'[^'</span> <span style="color: #339933;">+</span> h.<span style="color: #660066;">last_footnote</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
	afterInsert<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		h.<span style="color: #660066;">textarea</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'[^'</span> <span style="color: #339933;">+</span> h.<span style="color: #660066;">last_footnote</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']: '</span> <span style="color: #339933;">+</span>
			h.<span style="color: #660066;">footnote_content</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span></pre></div></div>

<p>And put this icon in the set&#8217;s <strong>images</strong> folder: <a href="http://overtag.dk/wordpress/wp-content/uploads/footnote.png"><img src="http://overtag.dk/wordpress/wp-content/uploads/footnote.png" alt="footnote" title="footnote" width="16" height="16" class="alignnone size-full wp-image-167" /></a></p>
<p>After that be sure to modify style.css so it says something like (if 14 was the placement of the footnote button):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.markItUp</span> <span style="color: #6666ff;">.markItUpButton14</span> a	<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/footnote.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2009/09/markitup-markdown-footnote-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip: Extending Django flatpages</title>
		<link>http://overtag.dk/wordpress/2008/07/tip-extending-django-flatpages/</link>
		<comments>http://overtag.dk/wordpress/2008/07/tip-extending-django-flatpages/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 22:59:28 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=53</guid>
		<description><![CDATA[I did a Google search and since nothing came up, I&#8217;m writing this little tip on creating your own CMS by extending Django&#8217;s flatpages. What&#8217;s good about flatpages is that they&#8217;re included in Django and has some basic code to &#8230; <a href="http://overtag.dk/wordpress/2008/07/tip-extending-django-flatpages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I did a Google search and since nothing came up, I&#8217;m writing this little tip on creating your own CMS by extending Django&#8217;s flatpages. What&#8217;s good about flatpages is that they&#8217;re included in Django and has some basic code to get you started. But clearly they&#8217;re not enough if you want other people to administer a site.. you&#8217;ll want to add extra fields and special help texts for the admin. But we still don&#8217;t want to rewrite those ~150 lines of code, and they can really help you get past all the boring stuff and into the action.</p>
<p>Simply do the following:</p>
<blockquote><p>
cp -R /usr/share/python-support/python-django/django/contrib/flatpages my_project/my_flatpages
</p></blockquote>
<p><i>views.py</i></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> my_project.<span style="color: black;">my_flatpages</span>.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> FlatPage</pre></td></tr></table></div>

<p><i>middleware.py</i></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> my_project.<span style="color: black;">my_flatpages</span>.<span style="color: black;">views</span> <span style="color: #ff7700;font-weight:bold;">import</span> flatpage</pre></td></tr></table></div>

<p><i>urls.py</i></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
4
5
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">urlpatterns = patterns<span style="color: black;">&#40;</span><span style="color: #483d8b;">'my_project.my_flatpages.views'</span>,
    <span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^(?P&lt;url&gt;.*)$'</span>, <span style="color: #483d8b;">'flatpage'</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p><em>my_project.my_flatpages.middleware.FlatpageFallbackMiddleware</em> has to be added to your <strong>MIDDLEWARE_CLASSES</strong> and <em>my_project.my_flatpages</em> to your <strong>INSTALLED_APPS</strong> and you&#8217;ll need to run <em>manage.py syncdb</em>, possibly changing the table name in <em>models.py</em>, so it doesn&#8217;t conflict with the old flatpages table. That&#8217;s basically it. After that you can work on the templates as described in the other howto&#8217;s, but now you have your own model to extend.</p>
]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2008/07/tip-extending-django-flatpages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A web-based clipboard &#8211; useful at least!</title>
		<link>http://overtag.dk/wordpress/2005/10/a-web-based-clipboard-useful-at-least/</link>
		<comments>http://overtag.dk/wordpress/2005/10/a-web-based-clipboard-useful-at-least/#comments</comments>
		<pubDate>Tue, 11 Oct 2005 00:06:38 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=6</guid>
		<description><![CDATA[Here&#8217;s your problem: You&#8217;re working on different computers. Maybe because you&#8217;re at school doing an assignment, maybe because you&#8217;re at work making notes for tonights TV Schedule, maybe you own a KVM Switch or maybe because you&#8217;re running back and &#8230; <a href="http://overtag.dk/wordpress/2005/10/a-web-based-clipboard-useful-at-least/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s your problem: <b>You&#8217;re working on different computers</b>. Maybe because you&#8217;re at school doing an assignment, maybe because you&#8217;re at work making notes for tonights TV Schedule, maybe you own a KVM Switch or maybe because you&#8217;re running back and forth doing system administration.</p>
<p>This is what you usually do: Copy text to some file on a LAN share, send yourself an e-mail, an SMS or <b>even worse: You write it on paper!</b></p>
<p>Well, now you won&#8217;t have to do that anymore! With your new OSS PHP Clipboard <b>you can just type in whatever you like and press save.</b> Your content will then remain accessible until you choose to save something else.</p>
<p>Go try the demo or download it and put it on your own server:</p>
<ul>
<li><a href="/blog/scripts/clipboard.php" target="_blank">Demo</a></li>
<li><a href="/blog/scripts/clipboard.php.tar.gz" target="_blank">Download tar.gz</a></li>
</ul>
<p><b>Installation is easy!</b> Just put the .php file on your webserver somewhere safe from people and bots. Chmod the file 777 and it&#8217;ll work.</p>
<p>This is an early version, but please help me develope the idea and the code. Right now I&#8217;m thinking that it should be able to do optional IP and/or login checking. And maybe there should be a file upload feature, too&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2005/10/a-web-based-clipboard-useful-at-least/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SuDoKu &#8211; A JavaScript version</title>
		<link>http://overtag.dk/wordpress/2005/10/sudoku-a-javascript-version/</link>
		<comments>http://overtag.dk/wordpress/2005/10/sudoku-a-javascript-version/#comments</comments>
		<pubDate>Sun, 09 Oct 2005 13:55:15 +0000</pubDate>
		<dc:creator>benjamin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://overtag.dk/wordpress/?p=5</guid>
		<description><![CDATA[The Linux Format Bounty round 1 has finished, and I was one of the competers. I ended up doing a JS version of SuDoKu because of my own skills and the fact that JS/HTML is so cross-platform and easy to &#8230; <a href="http://overtag.dk/wordpress/2005/10/sudoku-a-javascript-version/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.linuxformat.co.uk/bounty" target="_blank">Linux Format Bounty</a> round 1 has finished, and I was one of the competers. I ended up doing a JS version of SuDoKu because of my own skills and the fact that JS/HTML is so cross-platform and easy to do GUIs in. I also thought that SuDoKu would be easy on performance, but I was wrong there. It takes alot of resources and JS is slow as a politician&#8217;s brain. Anyways, it all ended up very playable.</p>
<p>Anyways, <a href="/sudoku/sudoku.html" target="_blank">check out the game</a> or grab a version with <a href="/sudoku/sudoku_source_code.html" target="_blank">readable, commented JS</a>.</p>
<p><b style="color: #c00">Important update:</b> <b>I fixed a bug showing off solutions for every field in &#8220;field info&#8221;. It was worth a few laughs, though =)</b></p>
]]></content:encoded>
			<wfw:commentRss>http://overtag.dk/wordpress/2005/10/sudoku-a-javascript-version/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

