Recent Updates RSS Toggle Comment Threads | Keyboard Shortcuts

  • John 11:59 pm on January 3, 2010 Permalink | Reply
    Tags: , nautilus,   

    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.

     
  • John 8:02 pm on January 1, 2010 Permalink | Reply
    Tags: , , NAnt   

    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>
    
     
  • John 12:45 am on October 5, 2009 Permalink | Reply
    Tags: , ,   

    SVN Notify by Email 

    Svn hook to email you information in post commit hook.

    Install svnnotify which will be used to send the email

    yum install perl-CPAN
    perl -MCPAN -e 'install SVN::Notify'
    perl -MCPAN -e 'install SVN::Notify::HTML::ColorDiff'
    

    The post-commit script

    #!/bin/sh
    for i in 'email1@domain.co.uk' 'email2@domain.com'
    do
    	svnnotify --repos-path "$1" \
    		--revision "$2" \
    		--to $i \
    		--from account@example.co.uk \
    		--handler HTML::ColorDiff -d \
    done
    
     
    • SonPhan 3:20 am on November 28, 2009 Permalink | Reply

      Hi , Please help me , How can i configure my svn server auto send mail with SVN-Notify modules?
      I have did as you show, but it can’t send mail.
      :(

  • John 10:06 pm on September 26, 2009 Permalink | Reply
    Tags: , , , , ,   

    jqRunner Snapshot – Running Javascript Unit test with NUnit 

    One of the nice things about unit tests is that you can use continuous integration so that you don’t have to run them yourself. At work we use CruiseControl.NET to automate our builds and run our unit tests. Now as a number of our projects are web based we use a fair amount of javascript, mainly jQuery, though in-house plugins. In order to test these we use jqunit, this works great and allows us to use TDD when writing javascript. However as development goes on the unit tests get forgotten about as they are not automatically ran.

    In order so solve this I decided to experiment to find a method of getting cruise control to run our jqunit tests for me. To run the tests I looked at wrapping the jqunit tests with nunit tests.

    jqRunner

    jqRunner is designed so that you can us your existing jqunit tests in their existing location without changing them. jqRunner required that all the scripts that are needed to run are registered. The full path to the file is required. jqRunner then executes the tests and returns the results, which are then parsed by nunit as tests using the TestCaseSource attribute.

    var sampleTestCase = new jqUnit.TestCase('Sample Test Case', function() {
        /*setup*/
        // this.yep(1);
    }, function() {
        /*teardown*/
        // this.ok(1)
    });
    sampleTestCase.test('Sample Test 1', function() {
        this.ok(1);
    });
    sampleTestCase.test('Sample Test 2', function() {
        this.ok(0);
    });
    
    using System;
    using System.Collections.Generic;
    using NUnit.Framework;
    using jqRunner;
    using System.IO;
    using System.Reflection;
    
    namespace jqRunner.Tests
    {
        [TestFixture,RequiresSTA]
        public class TestCaseSourceTests
        {
            [Test, TestCaseSource("GetTestResults"), RequiresSTA]
            public void CheckTest(ITestResult result)
            {
                Assert.IsTrue(result.Pass, result.Name);
            }
    
            private static ITestResult[] GetTestResults()
            {
                string jsFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\jqUnitTests\SampleUnitTest.js";
                TestBed target = new TestBed();
                target.RegisterScript(jsFile);
                return target.Execute().ToArray();
            }
        }
    }
    

    This is an initial development snapshot and is bound to have plenty of problems.

    Download
    http://static.yeticode.co.uk/blog/downloads/jqRunner-snapshot.zip

     
  • John 12:18 am on September 17, 2009 Permalink | Reply
    Tags: pirate, ,   

    Pirate Day! Arr 

    So talk like a pirate day is coming around soon and saw a brilliant method of converting web pages from boring English to cool Pirate talk. So having nothing better to do at the moment I knocked up a small plugin that will convert your blog posts to pirate talk on the 19th, to give your readers something nice to look at.

    Plugin can be found at http://wordpress.org/extend/plugins/pirate-talk/

    Feel free to make it better.

     
    • Li-An 9:40 pm on September 17, 2009 Permalink | Reply

      Too bad it does not work in french…

    • BigAl 2:42 am on September 18, 2009 Permalink | Reply

      I was checking out your plug-in on wordpress, and while trying to check out the link to the yahoo thing it uses, the link leads to a 404 page. Is this going to still work or not?

    • Admiral Piratepants 9:55 am on September 18, 2009 Permalink | Reply

      Yar! This be a piratetastic site, avast!
      http://www.play-and-stay.co.uk/

      Some translation (though not the whole site), games and general piratical shenanigans.

    • JArrrrrrr 6:33 pm on September 18, 2009 Permalink | Reply

      I installed the WordPress plugin and activated it, but it doesn’t seem to be working. Is there some trick I’m missing?

    • Kelly Robinson 10:57 pm on September 18, 2009 Permalink | Reply

      I also activated this today to test it out and… nothing. Clearing my cache didn’t seem to help either.
      Any hints?

      • John 11:48 pm on September 18, 2009 Permalink | Reply

        Should only work on the 19th. If you want it to work all year round just comment out the if statement.

    • BandonRandon 7:07 am on September 20, 2009 Permalink | Reply

      Thanks for this plugin, I modified to to support local timezones and to have an option to always be on. If you would like to modify the plug in or just see what I did I posted the code on http://pastebin.com/f5c75048e
      Brooke.

    • Kelly Robinson 8:13 am on September 20, 2009 Permalink | Reply

      Thanks very much – worked like a charm. Arrrgh!

  • John 8:37 pm on September 14, 2009 Permalink | Reply  

    Epic Fail, but with a good note. 

    So last Sunday was the 2009 Yorkshireman Off Road Marathon. Everything was going great, even though the course was nothing like I had run on before, but it was not meant to be. I injured my knee running down a hill and had to drop out at 18 mile mark. Although I failed Tom managed to man it up and complete it with enough energy at the end to call me gay whilst running up the last hill towards the finish line. So the entire event was not a complete waste of time.

    Although I didn’t complete it, I did however run further and for longer than previously. If I hadn’t injured myself I’m absolutely positive that I would have completed the race. The course did give me areas that I need to work on, such as running off road more. And finding some really big ass hills to run up and down.

    The failure to complete this marathon has certainly given me more than enough drive to enter the Brighton marathon and fully prepare myself for it so that I will be able to complete it without issue.

     
    • Tom 12:31 pm on September 15, 2009 Permalink | Reply

      Don’t forget that as well as the furthest and longest run you have ever done, it was also the highest, most northern and most awesome.

  • John 8:34 pm on August 24, 2009 Permalink | Reply
    Tags: , , , ,   

    More Django Plugin Stuff 

    MonoDevelop Django

    So I’ve been working more on the support for django within monodevelop. Heres some screenshots of it.

    MonoDevelop Django

    MonoDevelop Django

     
    • Aledr 8:47 pm on December 16, 2009 Permalink | Reply

      I’ve just installed MonoDevelop 2.2 and started a new Django project but is no option to create a new App there. Is your code already integrated?

      Thanks.

      • John 11:11 am on December 17, 2009 Permalink | Reply

        I never got round to getting the code into a stable state, and submittting a patch. However I have a couple of weeks of work so I’ll see if have anytime to look at it again.

  • John 10:11 am on August 17, 2009 Permalink | Reply
    Tags: , ,   

    Hacking on Monodevelop for Django 

    MonoDevelop Django

    So I started to implement support for django with MonoDevelop. It currently has pretty good support for Python via PyBinding addon. At the moment I have only managed to add the ability to create a new django project, which acts in the same way as running

    django-admin.py startproject projectname
    

    But I aim to provide support to add new django apps to the project, once I get familiar with the MonoDevelop code base.

     
  • John 3:00 am on July 18, 2009 Permalink | Reply
    Tags: , ,   

    Plugin Crazy! 

    So after creating my first proper plugin, post-to-facebook, I decided to have a go at creating another one. This one was created after I set up a blog for my dad to post updates and photos to so that he wouldn’t have to resend the same emails to different people. The after giving him a brief overview of how to post items and upload photos I noticed that the images he was uploaded were to large to be correctly displayed, when using the light box plugin. So from this I decided to write a plugin that would allow for the maximum size an uploaded image can be, and if it is larger it is resized. I’ll submit it to wordpress for download. This plugin is ideal for people who don’t want to worry about resizing their images before they post them to wordpress, this is ideal with. The plugin homepage is can be found on the page resize-on-upload-plugin

     
  • John 10:35 pm on July 14, 2009 Permalink | Reply
    Tags: , ,   

    ‘Post to Facebook’ Wordpress Plugin 

    post-to-facebook screenshot

    After wanting to be able to post stuff to my facebook account from my blog for no other reason than “I Can”, I looked around at the plugins that exist at the moment. The ones that I found worked but they were not what I wanted. The closest I got was the plugin Publish To Facebook. What I didn’t like about this plugin was that it highjacked the publish/update button. What I wanted was the ability to press a button and publish to facebook for only the posts that choose. So I decided to write my own plugin, that add a button to the edit page to do just this.

    The can for the moment the source code can be checked out from bazaar repository, then simply upload the folder to the wp-content/plugins and you’re good to go. If you don’t like or use bazaar you can download the tar ball.

    Download: post-to-facebook.tar.gz

    bzr branch http://bzr.yeticode.co.uk/post-to-facebook
    
     
    • Karol 3:59 pm on July 15, 2009 Permalink | Reply

      Hey John,
      For some reason your plugin doesn’t work on my blog. Should I change something, some settings?
      Im using WP 2.8, could that be a reason?

      Cheers
      Karol

      • John 4:12 pm on July 15, 2009 Permalink | Reply

        What browser are you using? I have only tested it in Firefox 3.5 as I don’t have IE installed at the moment. Are you getting any errors?

        The expected result should be is that once the “Post To Facebook” button is pressed it reloads the page with a in browser popup window for the information to post to your facebook account. Is this not appearing or is there no button to press.

        Thanks for the feedback.

        • Bill 4:47 pm on July 15, 2009 Permalink | Reply

          Same issue here – no popup appears, all that happens is a screen refresh. Tested on IE7 on Windows, and FireFox on the Mac. WP 2.8.1.

          • John 4:51 pm on July 15, 2009 Permalink | Reply

            Ok I’m going to have to wait til I get home from work so I can get to a machine with a version of IE. I’ll hopefully get it fixed soon. Thanks for the feedback hopefully I can get this sorted.

    • Karol 4:00 pm on July 16, 2009 Permalink | Reply

      I’ve updated WP to 2.8.1 but still same symptoms as Bill’s. Screen refresh and that’s it.
      Tested on Google Chrome and Firefox, on Vista.

      Thanks

      • John 4:11 pm on July 16, 2009 Permalink | Reply

        What version of the plugin is it running, I made some changes last night. The current version is 1.0.3, i changed the version so I’m not sure if it will appear as plugin that has been updated. Additionally do you know if you host allows you to use session variables? As without it, it would explain the behaviour your are seeing. I’ll try and create a fresh install of wordpress this evening again to try and figure out what the problem is, as I have many plugins that are making it hard to discover why its not working

        • Karol 5:24 pm on July 16, 2009 Permalink | Reply

          I’ve updated the plug in, but still havin problems. Now i get this wornings all over my WP: Warning: session_start() [function.session-start]: open(/home/53712/data/tmp/sess_0b25d1ce1ecd2681560d6bcbbd5d60ac, O_RDWR) failed: No such file or directory (2) in /nfs/c03/h03/mnt/53712/domains/karolbednarczyk.com/html/wp-content/plugins/post-to-facebook/post-to-facebook.php on line 11

          Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /nfs/c03/h03/mnt/53712/domains/karolbednarczyk.com/html/wp-content/plugins/post-to-facebook/post-to-facebook.php:11) in /nfs/c03/h03/mnt/53712/domains/karolbednarczyk.com/html/wp-content/plugins/post-to-facebook/post-to-facebook.php on line 11

          • John 8:41 pm on July 16, 2009 Permalink | Reply

            I’ve just commited an update (1.0.4) so that the plugin does not use session variables. Hopefully this will work. If not I’ll keep at it.

            Thanks

            • Karol 8:57 pm on July 16, 2009 Permalink

              Is it updated on WP site? I’m updating through WP Dashboard panel, saves me all login’ to servers etc.

              BTW Thanks Johny, for all that work.

            • Karol 12:02 pm on July 17, 2009 Permalink

              Just checked, it works!
              Thanks a lot!

    • Ed 3:34 pm on August 13, 2009 Permalink | Reply

      I have multiple bloggers on my site. will the plugin recognize the different people and post to their individual facebook accounts? That is what I would like to do. Or will all things go to the same facebook account regardless of the author?
      Thanks
      Ed

      • John 11:39 am on August 14, 2009 Permalink | Reply

        It depends on who is using the blog at the time, as it will use the persons own facebook account. If they do not have an active session with facebook it will ask them to login otherwise it will allow them to submit it directly. So this won’t cause a problem unless you are sharing a single computer, or have multiple facebook accounts.

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel