Thursday, 23 April 2009

33% Additional Disk Space

Hurray! The nice fokes at linode have decided to give all of their customers 33% Additional Disk Space. Now if only all hosting companies were as nice as this.

Wednesday, 22 April 2009

Final Year Project

I've just handed in my final year project, nicely bound and professional. Now that that's out of the way, until the poster day, I can concentrate on getting the gtk-cctray project to work properly using build servers that are not connected via .NET Remoting.

Tuesday, 14 April 2009

SVN Log to Latex

Needed to add a table of my svn log into my project write up so created a simple style sheet that would parse the xml output from svn. The xslt only generates the table

svnlog-gen.sh

#usage svnlog-gen.sh [repo-path] [output-file]
svn log --xml $1 > tmp.out; xsltproc svnlog.xslt tmp.out > $2; rm tmp.out

svnlog.xslt

Example Output

Thursday, 9 April 2009

C# Style for lstinputlisting

After getting latex to format my code nicely I noticed that it did not have build in support for C#, which read of the manual and knocked one up. Share and Enjoy


\lstdefinelanguage{cs}
{morekeywords={abstract,event,new,struct,as,explicit,null,switch
base,extern,object,this,bool,false,operator,throw,
break,finally,out,true,byte,fixed,override,try,
case,float,params,typeof,catch,for,private,uint,
char,foreach,protected,ulong,checked,goto,public,unchecked,
class,if,readonly,unsafe,const,implicit,ref,ushort,
continue,in,return,using,decimal,int,sbyte,virtual,
default,interface,sealed,volatile,delegate,internal,short,void,
do,is,sizeof,while,double,lock,stackalloc,
else,long,static,enum,namespace,string, },
sensitive=false,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
}


Usage

\lstinputlisting[language=cs]{test-class.cs}

Wednesday, 8 April 2009

New Hosting

Got myself some new hosting over at lindoe. Virtual linux server all to myself. Spent a day trying out the configuration and decided to go with a Ubuntu 8.10.

Wednesday, 1 April 2009

Simple SVN WordPress Widget

After getting bored on working on my final year project I decided to take a look at creating widgets word my blog. There are SVN hooks on my repositories that store the commit details in a SQL database. I thought I would create a widget that would pull out the last message and display it.


/*
Plugin Name: LastCommit
Plugin URI: http://blog.yeticode.co.uk/
Description: Gets Last Commit Message
Author: John Tindell
Version: 1
Author URI: http://blog.yeticode.co.uk/
*/
function lastCommit_widget() {

$server = 'localhost';
$link = mssql_connect($server, 'username', '************');
echo '
  • ';
    echo "

    Last Commit

    ";
    if($link)
    {
    mssql_select_db('svnyeti', $link);
    $query = mssql_query('select top 1 * from SVNLog order by liLogEntryPk desc', $link);
    $row = mssql_fetch_array($query);
    print '

    ' . $row['lszLogEntry'] . '

    ';
    }
    echo '
  • ';
    }
    function init_lastCommit(){
    register_sidebar_widget("LastCommit", "lastCommit_widget");
    }
    add_action("plugins_loaded", "init_lastCommit");


    When I get more time I will develop this a bit more.

    Problems With Yum On Fedora 10

    So every now and again YUM stops working and throwing out error messages usually after I've been to uni.

    rpmdb: Thread/process 4348/3087935168 failed: Thread died in Berkeley DB library
    error: db4 error(-30975) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
    error: cannot open Packages index using db3 - (-30975)
    error: cannot open Packages database in /var/lib/rpm
    Traceback (most recent call last):
    File "/usr/bin/yum", line 29, in
    yummain.user_main(sys.argv[1:], exit_code=True)
    File "/usr/share/yum-cli/yummain.py", line 229, in user_main
    errcode = main(args)
    File "/usr/share/yum-cli/yummain.py", line 84, in main
    base.getOptionsConfig(args)
    File "/usr/share/yum-cli/cli.py", line 184, in getOptionsConfig
    enabled_plugins=self.optparser._splitArg(opts.enableplugins))
    File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 192, in _getConfig
    self._conf = config.readMainConfig(startupconf)
    File "/usr/lib/python2.5/site-packages/yum/config.py", line 774, in readMainConfig
    yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
    File "/usr/lib/python2.5/site-packages/yum/config.py", line 844, in _getsysver
    idx = ts.dbMatch('provides', distroverpkg)
    TypeError: rpmdb open failed


    After a quick search I found a solution. Deleting the __db.* files in /var/lib/rpm fixes it


    $ sudo rm /var/lib/rpm/__db.*