Sunday, 3 January 2010

Upload Image to Imgur.com

I was looking for an easy way to upload images from my laptop to imgur.com without having to open my browser up. I found a post explaining how to upload an image from nautilus. The script worked well enough however I didn't like the information it displayed to you at the end. So I rewrote the script in python so that it displays a dialog with link buttons for the available options for the image.

upload to imgur screenshot


The code is hosted at google.

Update

Thanks to the people over at reddit the script now supports automatically copies the url to the clipboard, and also correctly loads the glade file.

Friday, 1 January 2010

NAnt.ToDo a NAnt Plugin

This simple plugin for NAnt parses your source code and creates a report of all the TODO and comment tags in your source code. The code is hosted over at google code.

Comments


The task automatically identify comments in the following style

//TODO: First Test to do Item
//FIXME: First Fix me Item
//HACK: First Hack Item


Additional matches can be made by adding in Token elements to the NAnt task.

Sample



<ToDo source="path/to/source" output="report.xml" searchpattern="*.cs;*.txt">
<Tokens>
<Tokens Value="BUGFIX" />
</Tokens>
</ToDo>


Output



<ToDo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Items>
<Item>
<Message>First Test to do Item</Message>
<File>NAnt.ToDo\ToDoTask.cs</File>
<Line>0</Line>
<Type>TODO</Type>
</Item>
<Item>
<Message>First Hack Item</Message>
<File>NAnt.ToDo\ToDoTask.cs</File>
<Line>0</Line>
<Type>HACK</Type>
</Item>
<Item>
<Message>First Fix me Item</Message>
<File>NAnt.ToDo\ToDoTask.cs</File>
<Line>0</Line>
<Type>FIXME</Type>
</Item>
</Items>
</ToDo>


Cruise Control Xsl


Below is a basic xsl style sheet that can be used with CruiseControl.NET to display the output from NAnt.ToDo.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:param name="applicationPath"/>
<xsl:template match="/">
<div id="ToDo">
<h1>ToDo List</h1>
<div id="Summary">
<h3>To Do</h3>
<table>
<tbody>
<xsl:for-each select="//ToDo/Items/Item">
<tr>
<td>
<xsl:value-of select="Type/text()"/>
</td>
<td>
<xsl:value-of select="Message/text()"/>
</td>
<td>
<xsl:value-of select="File/text()"/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</div>    
</div>
</xsl:template>
</xsl:stylesheet>