Calendar
ArchivesCategoriesSyndicate This BlogBlog Administration |
Tuesday, August 17. 2010Calling Maven2 from Ant
There is a lot of information available on how to call Ant from Maven2 scripts, but very little on the reverse operation. As it happens, this is actually quite simple to manage - Maven2 is a Java app, so it can be executed by simply using the Java task from inside your Ant script with the correct classpath, Main class name and arguments. The following snippit will do this for the simple case:
CODE: <target name="execute_maven"> <java classname="org.codehaus.classworlds.Launcher" fork="yes" failonerror="true"> <arg value="${maven.target}" /> <sysproperty key="classworlds.conf" value="${maven.home}/bin/m2.conf" /> <sysproperty key="maven.home" value="${maven.home}" /> <classpath> <pathelement location="${maven.home}/boot/classworlds-1.1.jar" /> </classpath> </java> </target> Note that this depends on the property "maven.home" being set correctly, and when called it will require the "maven.target" parameter to be supplied. "maven.home" will likely be set in build.properties or similar, and calling it is as simple as CODE: <antcall target="execute_maven">
<param name="maven.target" value="install" /> </antcall> Wednesday, April 15. 2009Buying a Windows-free laptop
I have recently been on a quest to buy a new laptop that does not come with Windows. If it comes with Linux pre-installed then that's the best outcome. If it comes with nothing pre-installed - which includes if it comes with the FreeDOS that some companies are now offering - then that counts as second, and if it comes with Windows but the company will allow me to get a refund for the software then that is third.
I am looking in the £300ish price range - ideally I don't want to pay more than £300 after Windows has been removed from the equation, which means that I'm looking at laptops that cost up to £400 with Windows installed and being hopeful. I'm also looking at full size laptops and not netbooks. If I decide to go for a Netbook then the Asus EeePC 1000 wins hands down and I know where I can get one from for £300 already. If I can get a larger screen and keyboard, and better spec machine, for the same price I'm going to. :) So far, I have contacted the following companies with the following results: Insight - Insight replied to my email within one day, which was very impressive. However, Insight can not offer laptops from stock with no operating systems, and can not offer a refund for a pre-installed version of Windows. However, they do have a laptop from stock that comes with FreeDOS pre-installed instead of Windows. Dell - Dell US apparantly offer Laptops with Linux pre-installed. Dell UK don't seem to do this except for the Dell Mini range however. They do offer exactly 4 larger laptops with Linux, but prices range from £800 to £2000! Two chats with Dell on their Live Support Chat service both ended up with my being told to ring Customer Services. Ringing Customer Services ended up with my being transfered to Pre-Sales, who then told me that they couldn't answer my question, that I'd need to talk to Customer Services and gave me the number that I'd just rang. Additionally a post in the Dell Support forums has so far gone unanswered. PC World - An email to PC World has so far taken 3 days without an answer. Admittedly, the first of those three days was Easter Monday but it's still not hopeful. eBuyer - An Email to eBuyer got a response 3 days after being sent - again the first of those three days was Easter Monday - but the email just said that I would need to ring Pre-Sales. Having just spoken to them, they apparently can't offer a refund for the pre-installed Windows that comes with the computer and don't offer any computers that don't come with Windows at all. Dabs - An Email sent three days ago hasn't been answered yet. The first of those three days was Easter Monday though. Aria - An Email sent yesterday hasn't been answered yet Scan - An Email sent yesterday hasn't been answered yet Saturday, February 28. 2009Automatic testing of the Linux Kernel
I was reading fairly recently about somebody (No attribution because I really can't remember who it was or where I read it. Sorry) who has a setup where he can do automatic bisect runs on the linux kernel by building the kernel, copying the built files across to a second machine and causing the second machine to reboot. The build was then considered bad if the second machine hadn't come up within 10 minutes, and the entire process was automatic except for needing to reboot the machine by hand if it didn't come up.
This got me to thinking about ways that this can be improved. I haven't tested this yet, but in theory this would work just as well but be more streamlined. The first thought was to use a virtual machine - something like VMWare or VirtualBox - instead of a physical machine then the script can also be responsible for killing the machine if it doesn't come up. It then occured to me that this can be taken a step further by having a virtual machine booting off of a live CD - one that was specially crafted using the newly built kernel. This way, there's no requirement to have the machine be able to boot in order to install the new kernel. The entire process would be something like: ** Build kernel ** Master a new Live CD image featuring the kernel ** Fire up the virtual machine using the newly mastered Live CD ** Test if it worked ** Kill the virtual machine ** Repeat Testing if it worked is a slightly tricky one - I think the article I read used a serial console to do this, but I'm not sure if that's possible on a virtual machine. What is possible though is if the script was to run up a network server on a well known IP/Port - the script already knows these details and so can build it into the Live CD - and the Live CD run a program that connects to this network server during startup. It could even go so far as to make the only process that is loaded in startup - after all of the required networking stuff is loaded, obviously - be the client that connects to this server. The script can then determine success/failure by if the server gets a connection from the virtual machine within a known period of time - 10 minutes works, but can probably be cut down quite a lot since the virtual machine is doing very little now. I'd like to think with the amount that is being done, a boot up time of 2 minutes is slow... As I said - I've not even considered how to go about making this a reality, but it's an interesting thought that could streamline bisecting of kernels to see which ones boot with zero user intervention. Friday, November 7. 2008CMake code to support asciidoc
Asciidoc is a really useful and sensible way of allowing people to write documentation, in that the plain text source code is nearly as readable as the generated output. The following is a CMake file to allow for conversion of text input files into asciidoc generated output files
And it needs the following FindAsciidoc.cmake file available
Wednesday, April 9. 2008realpath script
One thing that always gets me is how to convert a given path - be it absolute, relative or whatever - into an absolute path on the filesystem. It turns out there's a perl module that can do exactly this, and so I've just rolled a tiny script that makes use of this and converts it's first parameter into a real path - an absolute path on the filesystem regardless of where it came from, and without any extra . or .. elements in there.
The script does require the File::PathConvert module to be installed before it will work, but then you can just drop it into /usr/local/bin or wherever and do magic with it exactly the same as dirname or basename.
Thursday, January 3. 2008Yet another IE6 Hang bug
It appears that I have just discovered yet another IE6 hang bug- though I'm probably not the first person to discover it...
I'm not sure of the exact set of circumstances that cause it to happen yet, as I've not been able to reproduce it in a simplified form unfortunatly, but at least part of what is required is as follows:
Whether or not a doctype is present does not appear to affect the outcome, so it is not a simple reproduction of the bug mentioned at this blog post. However, the following do stop the bug from manifesting:
Tuesday, December 4. 2007Git ignore lists for autotools
Having just set up a new autotools project, and started the project in Git the following is the complete .gitignore list that I've produced to capture all of the artifacts that have been produced. This only covers the artifacts that are produced by a bare project that doesn't acutally produce any output.
CODE: # The actual Makefiles produced
Makefile Makefile.in # The local aclocal.m4 file aclocal.m4 # The output of the configure script config.guess config.log config.status config.sub # The configure script itself configure # The include directory artifacts include/config.h include/stamp-h1 # Various scripts used for libtool and the like install-sh libtool ltmain.sh missing depcomp # Not sure what this one is for autom4te.cache/* Thursday, July 26. 2007XSL in the Browser and output encodings
All the major browsers have the ability to download an XML document that has an xml-stylesheet processing instruction, understand the xml-stylesheet instruction, download the referenced XSL file and transform the downloaded XML before rendering it for the user. This means that you have the ability to even more clearly seperate the data from the design when producing web pages - have an XML feed that is the pure data, have an XSL file that transforms this XML file into (X)HTML for the browser to render and then have linked CSS files to apply visual styles to the HTML that is being rendered.
Where this falls apart at first attempts is with the output encodings - specifically with IE trying to render the pages. It turns out that the encoding name that I keep using for everything is actually wrong. I always put an encoding of "utf8" on my xml documents, but the legal encoding name is actually "UTF-8". In every XML and XSL capable program that I've used, this has never been a problem which is why I never realised. Except for IE of course. In IE if you put in an encoding of "utf8" then you get the dreaded "System does not support the specified encoding" error that doesn't actually tell you anything. To make matters even more complicated, IE as an XML or HTML renderer can handle the name "utf8" perfectly well. It is only IE as an XSL processor that has trouble handling it. In other words, if you don't have an xml-stylesheet PI on your XML file, where the XML file is listed as having an encoding of "utf8" then IE will open it perfectly well, and will even process it with it's built in XSL file perfectly well. As soon as you put an xml-stylesheet PI onto this document, still with the encoding of "utf8" then it just all stops working... In short - to make sure that your XML and XSL files are going to work with IE, use an encoding name of "UTF-8" instead of "utf8"... Monday, June 11. 2007Soundex, Metaphone and Double Metaphone generator
For something I'm working on at the moment, I needed a simple way of generating Soundex, Metaphone and Double Metaphone conversions of strings. As I couldn't find anything that did this easily on the web, I wrote myself one. This is found Here
The code for this uses the modules Text::Soundex, Text::Metaphone and Text::DoubleMetaphone Thursday, May 3. 2007Compiling LDAP support for Apache 2.2.4
Apache 2.2.4 has bundled with it modules for managing authentication against an LDAP directory. Unfortunatly the obvious way to compile this doesn't actually work.
The obvious way is to us a configure line like this: Unfortunatly, this doesn't build APR or APR-Util with LDAP support, so when it comes to compile the module itself it fails. What I had to do instead is build APR and APR-Util seperatly. Of course, doing so still didn't work properly for some reason. It turns out that you have to build APR and APR-Util seperatly, then build Apache telling it exactly where these two libraries can be found. My full build script for it now looks like this: In addition, by doing it this way you need to make sure that you do a make install in both srclib/apr and srclib/apr-util in addition to just the apache source directory. Failing to do so will mean that the LDAP enabled APR and APR-Util won't be installed, and adding the LDAP modules into your httpd.conf will stop Apache from loading... You can tell you've done this if you get the error or something similar when you try to load Apache. Tuesday, March 13. 2007Google Adsense site-specific ads are awful
I've only just noticed, but the Google Adsense down the side of the blog here are really dreadful compared to the actual contents of the page they are on
On a page that is almost entirelly tech-related stuff, I'm getting ads for legal advise and pregnancy stuff - hardly the most relevant of stuff... Tuesday, January 16. 2007fmemopen for Cygwin
The GNU GLibC library defines a function called fmemopen that allows you to open an in-memory buffer as if it was a FILE * handle. The LibC that Cygwin uses doesn't define this, and so this functionality is not possible.
The below code is an implementation of fmemopen that works under Cygwin. It's far from finished, and likely to be very flakey, but simple tests do prove that it works. Currently missing features are: ** Seeking ** Writing into the buffer fmemopen.h To use it, simply #include the fmemopen.h file in your source file, and then call the fmemopen(const char * data, const size_t size, const char * mode) function to get your FILE * pointer. The fields are as follows: ** data: The data that you want to use. ** size: The size of the data to use. ** mode: Ignored, but included for footprint compatibility with the GLibC version. The actual data is memcpy'd out into an internal buffer, starting at data, and going for size bytes. Friday, January 5. 2007Lua Scripting
Not tested any of this yet, but this looks like a very concise and easy-to-understand introduction to embedding Lua in C++ code.
http://www.debian-administration.org/articles/264 Friday, November 10. 2006GPG Key Autoresponder with Procmail
I have just set up my procmail config to automatically send out my GPG Public key to anyone who sends a specially crafted email to me. Because I use exim as my MTA, I receive emails that get sent to graham-*@ and graham+*@ as well as those simply sent to graham@.
Making use of this, I've put together a procmail rule that automatically responds to all emails sent to graham-gpgkey@grahamcox.co.uk. This rule simply automatically responds to the sender with an email containing my GPG Public key. The procmail rule that does this is as follows:
Tuesday, October 10. 2006Website Templates
Web design is something that people are either very good at or very bad at. I'm one of the people who are very bad at it, and as such use as much help as possible from elsewhere to do the design of any websites I'm working on.
One such place is Open Source Web Design - a repository of free to use web templates that you can just drop into place and use. This I have used a fair bit and the work is generally quite excellent. Another place that I have just found is GetTemplate - another site with free web templates and also offering custom designs for a fee. I think this site is run by one of the publishers who has work on OSWD, and it's his work that he is offering.
(Page 1 of 2, totaling 28 entries)
» next page
|
