Author Archives: Andy

Can't sing, can't dance, can handle a sword a little.

Obscure Ant build errors

I’ve been using Eclipse at work now, the first time I’ve done more than toy with it.  Along with Eclipse are the attendant tools – Ant, Maven, TomCat and ClearCase (oh yes, ClearCase).

So, Ant. I came across a situation where the build was failing to deploy the WAR files to TomCat, with the following error:

build.xml:887: java.net.UnknownHostException: C

Not much use there.  As it turns out, the solution was both simple and cripplingly unintuitive: replace “file://” with “file:///”.  The extra slash makes all the difference.

For example:

Replace:

war="file://${dist.dir}/app.war"

With:

war="file:///${dist.dir}/app.war"

Picsie updated to Alpha 1.3

Picsie has a minor new feature – a little UI improvement to make it easier to load more than one window at once.

When you load an image or video with Picsie, it checks to see if any other Picsie windows are open.  If not, it opens in the middle of the screen.  If Picsie is already running, it opens wherever Windows puts it, so it doesn’t cover the previous window.

Alpha 1.3 (7 July 2010)

  • Installer (~75KB).  This will set up your file associations for you.
  • Standalone .exe (~200KB).  Use this if you already have Picsie installed and you just want the latest version.  Just drop it over the existing one.

Read More →


New images: The Happy Collection

I made the first wallpaper in this set, Endorphin, during my final exams back at university.  Having my desktop looking so happy helped me keep a sense of proportion about the whole thing.

Thumbnail of the image Endorphin

Endorphin

Shortly after I posted it I got a request from a friend, who was also doing exams,  who wanted a new version – it was great, she said, but needed more pink.  And so “Happy Smarties” was born:

Thumbnail for the image Happy Smarties

Happy Smarties

Shortly after that a different friend wanted yet another version, this time for his multi-monitor setup.  So here’s the extreme widescreen version:

Thumbnail for the image Sense of Perspective

Sense of Perspective

This set always amused me, but I’m still surprised at the amount of traffic they got on my old website.

Creative Commons License These images are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


New Image: Redshift

When I first posted this image I had this niggling feeling it was very similar to one I’d seen elsewhere. Years later, I still get that feeling. Regardless, Redshift spends more time as my desktop wallpaper than anything else I’ve made.

Thumbnail of Redshift

Redshift

Creative Commons License
This image is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


New Image: Speed of Night

One of my earlier pictures I put together with Vue D’Esprit, and one of my favourites.

Thumbnail for Speed of Night image

Speed of Night

Creative Commons License
This image is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.


Pictures

Flicking through site stats, I found out that the CG images I had on my old site actually got a fair few hits, so I’m going to sporadically upload them to this site over time, whenever I’m too busy and/or lazy to write an actual post.

The pictures are all either algorithmically generated, or composed with an old copy of Vue D’Esprit I got free with PC Format yonks ago.  As before, they are all available under a Creative Commons License (Attribution-NonCommercial-ShareAlike 3.0).


Picise updated to Alpha 1.2

A couple of quick fixes to Picsie.

Alpha 1.2 (20 June 2010)

  • Installer (~75KB).  This will set up your file associations for you.
  • Standalone .exe (~200KB).  Use this if you already have Picsie installed and you just want the latest version.  Just drop it over the existing one.

Read More →


LaTeX Includes

Latex offers a very nice way to divide large documents into manageable files – the include command.  Combined with the includeonly command you have a very powerful method of compiling your document.

Typically,  each included file is a chapter – this is apparently how it was designed, and is certainly how I – and every other LaTeX user I know – use it.  Today I decided that one chapter was far too big, and split it up into a few smaller files for easy management.  Took seconds, no problem.

Only later, when I was annotating a hard copy for my supervisor did I realise that every include finished with an implicit clearpage.  Just what you want when you’re starting a chapter, and so I’d never noticed it.  When you’re starting a new section though, that’s not what you want.

In this case, use the input command  – same format, same effect, but no implicit clearpage.  You lose the includeonly functionality, but it fixes your section breaks.

tldr/

Problem: Unwanted page breaks around include statements.

Solution:  Use the near-identical input command instead.


Unexpected LaTeX!

Somehow I forgot to mention that as well as delving into the world of C# I’m just finishing up my PhD thesis.  Having experienced the horrors of trying to manage a large document in Word, I set about learning to use LaTeX, which for this kind of work is superior in just about every imaginable way.

Once you decide on a style sheet, LaTeX pretty much manages everything for you, and lays it all out beautifully.  When it works, it works sublimely.  When it doesn’t work, you can really end up stuck.

So, I’m going to post a bunch of LaTeX problems too, since it can be really hard to find solutions when you don’t know the right vocabulary.


Mouse events on DirectX.AudioVideoPlayback Controls

This is the issue that finally pushed me over the edge to setting up this blog.  Normally when you have a coding problem, you find the answer fairly quickly and move on.  Sometimes though, the solution remains elusive.  Then you put the answer on a page of your own, to help out the next weary traveler.

Which bring me neatly to…

AudioVideoPlayback

I recently posted my lightweight media viewer, Picsie.  As well as images, it also handles some formats of videos.  The video playback was largely on a whim when I stumbled across the wonders of Microsoft.DirectX.AudioVideoPlayback.  The code to set it up and use it is endearingly simple:

Microsoft.DirectX.AudioVideoPlayback.Video videoPlayer
	= new Microsoft.DirectX.AudioVideoPlayback.Video(filename);
videoPlayer.Owner = videoPanel;
videoPlayer.Play();

Give it a video file and a control to draw on, and tell it to start.  Some form of error handling is probably wise too.

All well and good so far.  A few buttons to control playback, and you’ve got a basic but functional video player.  My problem came when I wanted the video to have the same control system as the rest of Picsie – left-double-click to centre, right-click to exit, drag to move.  These all worked for images, but when I came to test it on videos, only the drag code seemed to work.

It was pretty simple to diagnose.  MouseDown, MouseMove and MousePress all continued to function as before.  For reasons unknown, the Video object ate any Click, MouseClick, DoubleClick and MouseDoubleClick events.

At this point the Internet failed me.  No solutions, and I had two features no longer working:

  • Right-click to exit
  • Double-click to centre

Not able to find a way to get my events back, it was fairly trivial, if a little messy, to move the right-click code to the MouseUp event, with a little jiggery pokery to make sure it was a click and not a drag.  On the other hand, did I really want to write all the code to check for and handle double clicks myself?  No, no I didn’t.  Thankfully, I didn’t have to.  MouseEventArgs has a “Clicks” property (when did that appear, and why did nobody tell me?), which you can use to fake a double-click event:

private void Panel_MouseDown(object sender, MouseEventArgs e)
{
	if (e.Button == MouseButtons.Left && e.Clicks == 2) {
		//Double-click
	}
}

And there you go.  I never did find out why the Video object ate my events.  There’s probably a really simple solution somewhere, or I did something boneheaded, but more than one person faced this problem and never found an answer, so here’s mine.  Fake clicks and double-clicks.

tldr/

Problem: AudioVideoPlayback.Video eats MouseClick and MouseDoubleClick events.

Solution: Check for double-clicks using the MouseEventArgs “Clicks” property in the MouseDown/MouseUp events which aren’t eaten.