Fri, 28 Apr 2006

Dealing with blog spam

Julien, the majority of comment spam can be dealt with very simply by including a turing test. On my blog, when I first started getting comment spam, I added a check box asking if the poster was a human. For a human, it's not a massive inconvience to tick a box, but for an automated tool, it's a major problem. Was implemented in 3 lines of html and one line of python. Since I added it, I haven't recieved a single piece of spam.

I don't believe it's had a major effect on people commenting, although I currently can't tell. I could change it to hide posts that claim to be non-human until I've checked them. If spam tools work out this simple problem, I could change the nature of the test to randomly change between "I am a human" and "I am not a human". After that I could include a simple sum or some other simple question. It also has an advantage over captchas that it is accessible.

It is a simple change which massively reduces spam by increasing the cost of spamming and I'm surprised that most people don't do something similar.

[blog,spam,turing test,comments] | # Read Comments (8) |

Comments

Sun, 23 Apr 2006

Installing Oracle XE on Debian

I've spent the weekend playing around with the new Oracle XE Debian packages in preparation of having to use them at work in the near future. I've written up my experiences of setting the server and connecting remote clients in my latest article.

Talking of work, we have a position for a junior support role open. If you live in or around Brighton, England and know a little bit about Linux, Debian, Tomcat, Java, PostgreSQL and Oracle and willing to learn more, have a look at the job description and get in contact.

[Oracle,Oracle XE,Debian] | # Read Comments (0) |

Comments

Sat, 22 Apr 2006

Empty elements in XSLT

I recently wanted to deal with docbook <ulink> elements that didn't have any contents by displaying the url as the link text. I wanted to convert:

<ulink url="http://www.example.com">Example.com<ulink>
<ulink url="http://www.example.com"/>

to

<a href="http://www.example.com">Example.com<a>
<a href="http://www.example.com">http://www.example.com<a>

I originally had:

<xsl:template match="ulink">
   <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
      <xsl:apply-templates/>
   </xsl:element>
</xsl:template>

This sucessfully dealt with the first form of <ulink> that had content, but not with the second example with an empty element. The solution is the use an <xsl:choose> element with a test to see if the current node has any child nodes. Using child::node() we can get any child nodes. We can then test if the node has any children using the count() function. The resulting xslt is:

<xsl:template match="ulink">
   <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
      <xsl:choose>
         <xsl:when test="count(child::node())">
            <xsl:apply-templates/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="@url"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:element>
</xsl:template>
[XSLT,DocBook] | # Read Comments (0) |

Comments

Sat, 15 Apr 2006

Separation of Church and State

Andrew, yet at the other end of spectrum, given that America is constitutionally secular, they have "in God we trust" on their currency and don't trust atheists. Their "Pledge of Allegiance" was changed in 1954 by Dwight D. Eisenhower to include "under God". This pretty means I'm unable to visit the country. I think that's worse than trying not to offend anyone, no matter how misguided.

[] | # Read Comments (0) |

Comments

Mon, 10 Apr 2006

Creating a Certificate Authority

Sometimes you need to generate several SSL certificates, but don't want to pay money to a Trusted Root, and self-signed certificates just won't cut it. If you've ever had this dilemma, just for you, here's an article describing how to set up your own trusted root certificate and how to import it into several common applications. If you want me to add your favourite application, feel free to email me with instructions and screenshots if appropriate.

[article,SSL,certificate authority,root ca,OpenSSL] | # Read Comments (2) |

Comments