Tue, 29 Apr 2008
Groovy released version 1.5.6, so making a Gant release was something to think about. People had been
using 1.2.0-SNAPSHOT for a while and there appear to be no problems. All in all it seemed right to
shift from 1.1.x to 1.2.x -- there are some breaking changes as well as lots of new goodies and some
important bug fixes.
As ever distributions are available at http://dist.codehaus.org/gant. For those who use Maven 2,
the repository URL is http://repository.codehaus.org, the
groupId is org.codehaus.gant, the artifactId is gant , and the version is 1.2.0.
The Gant webpage has the documentation.
Mon, 07 Apr 2008
Another great ACCU
conference, but a very busy one for me, I gave two solo sessions and joint session with Jim Hague.
Also I was on the closing panel with Tom Gilb, Jim Coplien, Peter Somerlad and Hubert Matthews, run by
Giovanni Asproni. For proof that I was there, see Anna-Jayne Metcalfe's photo of the
event -- OK she caught me at a bad moment, so whilst it is a horrible shot of me at least it
proves I was there!
-
Them Threads, Them
Threads, Them Useless Threads was taking a look at what programming support we have in the
brave, new world of multicore (and hence parallel) hardware. The answer is of course threads, and
they are not a good tool. Systems such as OpenMP and MPI purport to be the programmer's friend
but... Also there are functional languages such as Haskell and Erlang that take a very different
view of parallelism.
-
Functional
Programming Matters was part of the functional programming track of the conference and was
to augment the tutorial sessions by Joe Armstrong and Simon Peyton Jones to show that Erlang and
Haskell don't have to actually be used to have influence and importance. The ideas of no side
effects and referential transparency can be used in C, C++, Java, Python, Perl, Groovy, Ruby, etc. Also of course, things like list
comprehensions have been taken up by Python, Perl, Groovy,
Ruby, etc. Programming is generally becoming a more declarative thing even in imperative languages.
The C++ standard library is a case in point: why program a loop when you can apply a function. The
killer point is that you have no hope of programming using C++ templates unless you know how to
program using a functional language.
-
To Distribute Or Not To
Distribute: How to know your DVCS from your CVCS This was originally intended to be a three
person session, but Tim Penhey was not able to get to ACCU this year even though he originally
planned to, so Jim Hague and myself did it as a two hander. This was really an introduction to
distributed version control (Bazaar, Mercurial, and Git) for people only versed in centralized version control (Subversion).
The PDF files are all held on the Concertant LLP website.
Sun, 06 Apr 2008
John Pinner asked if I would revamp and present at UKUUG
Spring 2008 one of the talks I did at PyCon UK 2007. The
talk is entitled "The Great Languages Debate" but it isn't really a debate. It is a small tour
through a few comparative programming language examples. The main aim is to show that dynamic
programming languages are the languages of applications development. Also whilst functional
programming languages may not be mainstream, the techniques and idioms are very important -- so much
so that many of them are introduced into mainstream languages.
A PDF of the
slides for the talk can be found on the Concertant LLP
website.
The UKUUG Spring 2008 conference was very enjoyable, and everyone there entered into the right spirit
of competition between Python and Perl. I was not lynched for stating categorically that Perl is an
"execute only" programming language.
Thu, 06 Mar 2008
Not only are we now up to Groovy 1.5.4, there were a number of fixes and additions in the Gant code
base, so it seemed appropriate to make a new release -- which actually happened last night.
Highlights of the release are:
- Ivy and Maven Ant Task jars actually included in the distributions.
- Allow control of directory paths in Maven target set.
- Alter the Execute tool to avoid any blocking.
- Added AntFile tool for reading Ant files into Gant.
- Added -L | --lib options a la Ant.
- ~/.gant/lib added as path to search for jars along with ~/.ant/lib.
- depends can now take a list of mixed strings and Closures.
As ever distributions are available at http://dist.codehaus.org/gant. For those who use Maven 2,
the repository URL is http://snapshots.repository.codehaus.org, the
groupId is org.codehaus.gant, the artifactId is gant , and the version is 1.1.1.
The Gant webpage has the documentation.
Fri, 22 Feb 2008
Thu, 31 Jan 2008
Groovy 1.5.2 was released, and so, as announced, Gant 1.1.0 was released -- it all happened last
Tuesday, I have only just got round to writing about it. As noted in the pre-announcement,
distributions are available at http://dist.codehaus.org/gant. For those who use Maven 2,
the repository URL is http://snapshots.repository.codehaus.org, the
groupId is org.codehaus.gant, the artifactId is gant , and the version is 1.1.0.
The Gant webpage, has the documentation.
Gant: the freedom of using all the Ant tasks with a dynamic programming language (Groovy) and no XML
in sight :-)
Sat, 26 Jan 2008
It seems I failed to write a note here when Gant 1.0.0 and later 1.0.2 were released. How very remiss
of me. What is worse, I failed to write a note when Gant was turned into a project in its own right
at Codehaus. Clearly I need to get better at doing these notes.
Groovy 1.5.2 is soon to be released. To stay in synchrony with the Groovy releases, Gant 1.1.0 is
being prepared for release. Snapshots compiled against Groovy 1.5.2-SNAPSHOT are available as a
release candidate. Distributions are available at http://dist.codehaus.org/gant. For those who use Maven 2,
the URL is http://snapshots.repository.codehaus.org, the
groupId is org.codehaus.gant, the artifactId is gant , and the version is 1.1.0-SNAPSHOT.
The Gant webpage, has the documentation.
If you give this version a whirl, that would be great. Do let me know if there are problems, or
better still (of course) let me know if it works without problems out-of-the-box :-)
Highlights of the new release:
- Updated Ivy usage to Ivy 2.0.0-beta1.
- Added a Gant Ant Task.
- Added Cobertura coverage reporting.
- Altered the constructors of the Gant class to make programmatic calling of Gant a lot
easier.
- Improved the Maven target set.
- Improved the LaTeX tool.
There are also a few fixes. The addition of the Gant Ant Task has meant that it is not
straightforward to compile Gant with Groovy 1.0. After consulting with Groovy users on the mailing
list it was agreed that this was not a problem. So for the moment, Groovy 1.0 is not supported, only
Groovy 1.5.x. This can be fixed though if it needs to be.
Thu, 24 Jan 2008
I have been more and more coming to believe that Java is no longer the right programming language for
teaching people programming. Java has to be learnt, it is after all one the most important
programming languages of the moment. However, I now believe that dynamic programming languages, in
particular Python and Groovy, are better languages for the first introduction to
programming. Following this you can introduce type, compilation, design patterns and all the good
software engineering material as second courses on programming using languages like Java and C++. Of
course, everyone interested in programming should also learn languages like Haskell, Erlang, Prolog,
but that issue is for another time.
I started thinking about Python as a first programming language for university courses back in 2003.
The idea bubbled as a publishing project but didn't really take off until 2005. I was introduced to
Sarah Mount and James Shuttleworth (then both at Coventry University, Sarah has now moved to
University of Wolverhampton) who were using Python to teach their introductory courses to physicists,
economists, art and design students, as well as computer science students. We immediately waded into
taking all our material and forming it into a book. The result is Python for Rookies published by Thomson Learning
(now called Cengage Learning). This should be in the bookshops next week.
Buy this book, you know you want to :-)
PS It is true that Graham Roberts and I authored the book Developing Java Software as a first programming course
using Java (and we'd like you to buy that as well :-). We are however in the process of writing a
book using Groovy instead. More on this at a later date.
PPS The Python for Rookies website has only
just been started so it doesn't have much on it yet. Over the next few weeks more and more material
will be added.
Wed, 24 Oct 2007
Last week was the Grails eXchange 2007 conference, which was
great fun. It was really nice to meet face-to-face many of the people that are active in the Groovy
and Grails community that I had only ever “met” by email on the mail lists. I gave a talk
on Gant. A PDF of the slide can be found here from the Concertant LLP presentations page.
Many moons ago Ric Parkin asked if I would do a talk on dynamic languages to the Cambridge sub-group
of ACCU. Given an opportunity to plug Groovy and Gant,
I immediately said yes. The talk was on 2007-10-04 but I failed to put this note up till now. A PDF
of the slide can be found here from the Concertant LLP presentations page.
Sat, 22 Sep 2007
To stay in synchrony with the Groovy releases, Gant 0.3.2 has been released to coincide with the
release of Groovy 1.1-beta-3. There are only a few minor bug fixes over 0.3.1 but they are worth
releasing.
The new distributions are available from the Gant
webpage, there is a build for Groovy 1.0, and a build against Groovy 1.1-beta-3, as well as
the source tar and zip files.
Tue, 11 Sep 2007
PyCon UK 2007 was great. The talks were good, and all the
delegates I met were both knowledgeable and sociable. Definitely a conference to prepare to attend
next year!
Both the presentations I proposed got accepted, which was exciting for me, since I got to speak on two
topics I find really interesting: programming languages
comparisons, and build systems (a
comparison!) – the links are to the PDF files of the slides held on the Concertant LLP presentations page. The
conclusions of the first presentation were that dynamic languages (Python, Ruby and Groovy) are much better than static languages like C++ and Java
for building applications, and Python is just great. The second talk concluded that Gant is great but that SCons is also extremely good – dynamic languages and DSLs rock
for build systems, and SCons (written in Python) is well ahead of the field.
LugRadio recorded most of the talks from the conference, it
will be interesting to see what the result is.
Sun, 02 Sep 2007
I
was asked to give the Groovy and Grails User Group
presentation at the No
Fluff, Just Stuff eXchange event which was held in London 2007-08-29/2007-08-31. Naturally (!) I
chose to talk about Gant. As it was the final
presentation before the party, I decided to announce the “Death of XML as a Build Specification
Notation”. The original title of the talk was slightly different, but then that is dynamic
binding for you. A PDF of the slides can be found here from the Concertant LLP presentations page.
Thu, 19 Jul 2007
Graham Roberts and myself were some having
problems using Ant optional tasks with Gant, so I added
extra classpath things:
- A --lib <path> option to add specific items to the classpath.
- ~/.ant/lib/ has all contents added to the classpath.
- if the environment variable ANT_HOME is set then ANT_HOME/lib/ant-*.jar are added to the
classpath
Kohsuke
Kawaguchi pointed out that Gant failed to return a sensible exit code and this was hindering
Gant's use in the Hudson continuous integration system.
This definitely required fixing!
The new distributions are available from the Gant
webpage, there is a build for Groovy 1.0, and a build against Subversion Head r6962, as well as
the source tar and zip files.
Fri, 18 May 2007
The people organizing the Grails eXchange conference in October have asked me to do a talk on Gant.
It is currently scheduled for 2007-10-17 15:10. It is going to be good to meet face-to-face all the
people I have only been emailing with!
Fri, 11 May 2007
With the release of Groovy 1.1-beta-1 and various little things added to Gant that people had asked
for, it seemed about the right time to make a new release of Gant. A major change is that targets are
now called targets and are not called tasks. This seemed like a good enough reason to call this
version of Gant 0.3.0. Do let me know if you like it and/or have any feedback.
Jar files compiled against the Groovy 1.0 and 1.1-beta-1 distributions can be
found on the webpage at http://groovy.codehaus.org/Gant
Thu, 26 Apr 2007
The buzz around the Groovy programming language will
certainly increase now, it won first prize at the the prestigious 2007 JAX Innovation Awards announced
recently. More details here,
Here's a picture of Dierk receiving
the prize at the ceremony. Nice one Dierk :-) Here's a picture of the award certificate
itself as proof!
Mon, 16 Apr 2007
Last week was the ACCU 2007 Conference and it was as good as ever. Serious
praise to Ewan Milne, Julie Archer and all the rest of the conference committee for organizing such an
enjoyable event.
Although the origins of ACCU is in C and C++ programming, Python, Ruby and
Groovy are all well represented in the talks as well. As are
higher level issues such as design patterns. It is generally a mix of very high quality development
people taking things seriously and having a lot of fun.
I gave two presentations:
- C++ has no useful purpose
- Builders: How MOPs make life easy
As you can imagine from the title, the first was intended to be contentious. The room was full to
bursting and included many from the BSI C++ Standard Committee and some from WG21 (the ISO C++
Standards Committee, which is meeting this week in exactly the same hotel we had the conference last
week – this is by design not by accident). I opened with a variation on a Shakespeare quote:
Friends, ACCUers, programmers, lend me your prejudice
I come to bury C++, not to praise it
The evil that languages do lives after them
The good is oft interred with their compilers
So, let it be with C++.
However, in the end I got far less heckling than I expected, almost none in fact. The session was
nicely interactive, but no heckling. I guess I should have been more controversial. In case you are
wondering, my basic messages were:
- C++ templates are too complicated.
- Python, Ruby, and Groovy are the dynamic programming languages of applications development.
- Java is the static language of applications development. (Possibly also C# but...)
- Parallelism is here now (finally) and the functional programming languages (Haskell, etc.) are in a better shape
to make use of this than any of the imperative languages.
Alan Lenton had promised to organize a
lynching party, but people got too excited about the language debate, which at no time descended
into flaming or language wars, and completely forgot, so I made it out. I really enjoyed the session,
I hope the attendees did.
The second session was really trying to excite people about domain specific languages (DSLs) as tools
for systems development. The core concept is that programming is about constructing a language in
which to easily express the solution to a problem. Currently programming is creating the classes or
functions to solve the problem, a side-effect of which is to construct a language to describe that
solution. The “DSL Way” is to construct a domain specific language, a side effect of
which is a solution to the current problem. People generally think you need a dynamic language
(e.g. Python, Ruby, Groovy) to create a DSL, and indeed these languages are very good for creating
DSLs. However, it is important to remember that C++ is also a very good language for creating DSLs
– yes, the irony of being positive about C++ in this talk and negative about it in the previous
talk is not lost on me.
I have made the slides and some of the code materials available:
Fri, 16 Mar 2007
I made a presentation on Builders (in Groovy) last evening
at the GGUG London meeting (held at Skills Matter). Well it
should have been a presentation but it was only half a presentation due to:
The projector not talking sensibly to my computers – plural, neither of them was able to work
sensibly with the projector, even though one of them had 3 months ago. Eventually I managed to get
one to do something reasonable enough to do something.
Definitely embarrassing. Still I managed to talk a bit about metaobject protocols (MOPs) and how the
Groovy MOP not only uses metaclasses, but also looks for the method invokeMethod in the
object itself as part of method look-up, and how this allows Builders to be constructed almost
trivially.
As a mentioned in the entry for the last
session I did, sessions such as these are not really the place for heavyweight presentations, so
although the idea was to ensure everyone understood how Builders work in Groovy, it was a fairly light
talk and the slides I used have next to nothing on them. However, it seems reasonable to make them
available, so you can get a PDF of them here.
Groovy has a good selection of Builders: SAXBuilder, StreamingSAXBuilder, DOMBuilder,
StreamingDOMBuilder, SwingBuilder, AntBuilder, to name just a few of the obviously most useful. Since
I avoid XML as much as possible, SwingBuilder and AntBuilder are the ones I have most familiarity
with. SwingBuilder makes creating Swing user interfaces so much easier than writing Java code, and
AntBuilder has a plethora of uses, some of them even associated with managing builds. Of course, I
only use Gant now for managing builds using Ant tasks
– it saves having to work with XML!
I am scheduled to give a talk on Gant at Grails eXchange, so if you want to hear
more about how to manage Ant-based builds without using XML, come along. In case you weren't aware,
Gant is used within Grails for managing all the activities.
Sat, 03 Mar 2007
More and more people are using Gant as their build system in preference to Ant, so I thought it time
to create a new release so that people can be using all the latest features. So, I am pleased to
announce Gant 0.2.4.
Jar files compiled against the Groovy 1.0 distribution can be
found on the webpage at http://groovy.codehaus.org/Gant
In case you were wondering if there really were any high-profile projects using Gant, then look no further
than Grails which uses Gant for managing all task scheduling
– in preference to Ant.
Let me emphasize Gant does not totally replace Ant, exactly the opposite, it relies on the Ant tasks.
What Gant does is replace the use of XML as the build specification language, with scripts written in
Groovy. An increasing number of people prefer using a dynamic programming language for describing
builds rather than using XML. Can you blame them :-)
Thu, 22 Feb 2007
It was irritating me that GFontBrowser didn't allow you to quickly display a font using
gnome-font-viewer as is possible in Nautilus, so I added it. Double clicking a font does the job.
See here for more on GFontBrowser.
Mon, 30 Oct 2006
Paddy Gallagher, supported by Skills Matter, has started
organizing some regular Groovy and Grails User Group meetings in London – at Skills Matter's
premises in fact. He asked if I could do a talk on AntBuilder and Gant for last week's meeting, which I was happy to do.
Sessions such as these are not really the place for heavyweight presentations, so I talked around
Gant code from real projects. Consequently, the slides I used have next to nothing on them.
Nonetheless, people asked for them to be available. So you can get a PDF of the slides here.
For this talk, the main point was that using a dynamic programming language such as Groovy makes
creating build systems so much easier. In the case of Groovy, there is AntBuilder allowing systems to
be based on using all the ready-made tasks from the Ant library – and no XML, unlike with Ant
and Maven.
Gant is basically an infrastructure framework around the AntBuilder, providing a command-line
user interface and a ways of modularizing build scripts. Oh, and it provides an internal domain
specific language to make Gant scripts look more like the classic Make, Rant, Ant, Maven type
thing where there are targets that the system has to achieve.
If you are interested in a JVM-based build system, that doesn't use XML, but does provide the same
sort of facilities as Make, Ant, SCons, Rant, etc. then take a look at Gant.
Tue, 24 Oct 2006
Justin Lee has created a build tool he calls Gosling(*) which he ‘announced’ here. Like Justin, I believe
that XML is not a good language for specifying builds and yet the Ant tasks are a massive resource for
build infrastructure. This is why I created Gant
I disagree with Justin when he says Java is good for describing builds. I think a dynamic language such
as Groovy, is far better than Java for describing these things. SCons, Waf and Rant have shown that
using dynamic languages and creating internal DSLs is the way forward for build systems. Unlike
SCons, Waf and Rant, Gant does not (currently anyway) create a complete relationship/dependency
graphs. Currently, Gant is a way of scripting Ant (and other, e.g. Ivy) tasks using Groovy, bringing
in the power of using a general-purpose, dynamic programming language.
Justin presents a part of his build system for Gosling as:
@Default
@Description("Builds the Gosling project")
public void build() {
new Javac(this, BUILD_DIR)
.addSources(new FileSet("src/java")
.addInclude("**/*.java"))
.addOption("-Xlint:unchecked")
.addOption("-Xlint:deprecated")
.addOption("-g")
.execute();
new Copy(this)
.setDestDir(new File(BUILD_DIR))
.addFileSet(new FileSet(JAVA_SRC_DIR)
.addExclude("**/*.java"))
.execute();
}
Using Gant, this looks something like:
task ( build : 'Builds the Gosling project' ) {
Ant.javac ( srcdir : 'src/java' , destdir : 'build' ) {
compilerarg ( line : '-Xlint:unchecked -Xlint:deprecated -g' )
}
}
task ( 'default' : '' ) { build ( ) }
I feel that the power of Groovy's AntBuilder, and its harmony with the Ant XML labelling, makes Gant
the tool of choice. Certainly I use it for builds where I would previously have used Ant. But then I
would, wouldn't I.
(*) Even though Justin claims the original of the name Gosling is not derived from James Gosling's
surname, it is a master stroke of publicity to use it. I hope the connection was intentional and not
an accident.
Mon, 23 Oct 2006
Neal Gafter has released v0.3 of the Closures for Java proposal on his blog. The new syntax Neal et
al. are proposing is:
{ int , int => int } plus = { int x , int y => x + y }
This is going to irritate people as they have to replicate the types of the parameters to the
closure. Why not just let the compiler do the work and have:
{ int , int => int } plus = { x , y => x + y }
Of course, this is getting closer (or should that be closure!) to the Groovy syntax for closures:
plus = { x , y -> x + y }
or if you really have to have static types:
plus = { int x , int y -> x + y }
For now I shall stick with Groovy for closure-based programming.
Thu, 19 Oct 2006
Well, for various reasons, it has been a long time coming, but finally, it is here. Developing
Java Software is now in it's third edition. My advanced copies arrived with yesterday and it
should be in the bookshops (at least in the US and UK) next week.
This third edition is very different to the second in so many ways:
-
The overall scope of the book has been cut down so that it is better for use in 1 and 2
semester/term courses at universities. The material on algorithms and data structures and the ADS
package has been taken out and will appear in a new book.
-
Test-driven development has been made a core feature of the whole presentation. We always did push
the unit testing line, now it is absolutely ‘front and centre’. We use TestNG as the
unit test framework, as this looks destined to supplant JUnit as the de facto standard unit test
framework.
-
Java SE 5.0 is assumed. We don't make a huge song and dance about generics and annotations, we just
use them as though they have always been there, in a way we think is entirely suitable for people
learning Java as a first programming language.
-
We have introduced material on Ant and Subversion so that people are learning about the tools of the
trade at the same time that they are learning about programming itself.
We have set up a website to host support material associated
with the book: http://www.devjavasoft.org.
We are regularly adding more and more answers to the questions set in the book onto the website so
that people have a reference. Feel free to send in answers to questions not yet answered, or
alternative answers to the ones we have – we will ensure any submissions are attributed.
Thanks to Amanda Makepeace for painting ‘The
Forest Of Wic’ which is the basis for the artwork of the book cover.
Tue, 03 Oct 2006
On his blog,
Neal Gafter has written about the for keyword that he is proposing for addition to Java to
support closures. I am a great fan of closures and closure-based programming, so I like Groovy and
Ruby. The declarative expression that is achievable with languages like these makes for short programs
with fewer errors. In this sense, adding closures to Java seems quite exciting. However, I wonder if
this is going to end badly, like the generics situation – I believe erasure has been, and
continues to be, a bit of a disaster (I have written previously on this).
This makes me wonder if closures should actually be left out of Java and that more use should be made
of Groovy and dynamic languages like it for creating JVM-based systems &ndash after all Groovy is
symbiotic with Java, not a competitor.
Neal starts with a Java method:
private Droid seekDroid ( final Map map ) {
for ( Map.Entry entry : map.entrySet ( ) ) {
final String droidName = entry.getKey ( ) ;
final Droid droid = entry.getValue ( ) ;
if ( droid.isSought ( ) ) {
System.out.printf ( "'%s' is the droid we seek.%n", droidName ) ;
return droid ;
}
}
return null ;
}
and proposes that a better way of expressing this is:
Droid seekDroid(Map map) {
for eachEntry(String droidName, Droid droid : map) {
if (droid.isSought()) {
System.out.printf("'%s' is the droid we seek.%n", droidName);
return droid;
}
}
}
OK, a little bit less boilerplate (at the expense of a new keyword) but that is all it is. The example
does not get to the heart of what closures should be used for. The above is still an explicit iteration
construct, and the whole point of closures is to invert flow control completely. In Groovy the above
can be written:
def seekDroid ( map ) {
def droid = map.find { droid -> droid.value.isSought ( ) }
if ( droid != null ) { printf ( "'%s' is the droid we seek.%n", droid.value.name ) ; }
droid
}
The point here is that the iteration is inside the find method that Groovy adds to the
Map class (via its meta-object protocol). Neal says they do not want to add methods like
this in Java because of incompatibilities with existing interfaces. He then proceeds to propose
adding a method to java.util.Collections, which appears to be becoming the dumping ground
for all the things people want but can't have due to backwards compatibility.
It seems then that backwards compatibility is going to drive all discussion of closures and Java, just
as it did generics and Java. Generics only made it in to Java by ignoring all the parameterized type
information at run time, i.e. we got type erasure. This is a horrible thing avoided by all other
languages with parameterized types, C# for example.
It seems the fudges to get closures into Java are starting. Of course, it would be nice if Neal and
co. find a way of doing it nicely and cleanly, I fear they will not, and Java will get messier.
Personally I use Groovy, it already has what Neal wants to put into Java, cleanly and neatly. Case
closured.
Sat, 19 Aug 2006
I like the features and functionality of Ant as a build tool but I really don't like XML.
Also, having used SCons, Waf, Rake and Rant, I have come to believe that a build tool
needs to be hosted on a programming language – SCons and Waf are Python-based
systems, Rake and Rant are Ruby-based. Note here that Maven is a totally different sort
of beast, not better or worse just different. Where Maven 2 is applicable it looks very
good but there are situations where tools like Ant are applicable and tools like Maven 2
are not.
The obvious thing to me is to use Groovy as a base language for a build tool. Most of the
work is already done of course, the AntBuilder class does almost all the work! However
there is infrastructure needed to create a tool. Without such infrastructure everyone
ends up building their own versions and there is nowhere for best practice to be reified.
In January I started an exchange on the Groovy User email list about this and there was
some strong encouragement that having a pure Groovy script way of scripting Ant tasks in a
framework would be a good thing. Over the last couple of week I have managed to put a
start together for this. It isn't in release form yet but it does do the job. Gant can build and install itself in a Groovy installation. I also use it for building
websites.
If you want to give it a whirl then check out the webpage here. Remember though this is not a finished
tool it is a start to enable people to try it out and give constructive feedback so that
it can evolve into a good and useful tool.
Sat, 12 Aug 2006
Recently I decided to give Rant a go having heard
that it was better than Rake. Installing it on
Ubuntu is a bit of a mission (well not really) – as the rant package only very
recently made it into Debian Unstable, it isn't in the Ubuntu store just yet so apt-get
doesn't do the job. Taking life in hands I downloaded and installed the Debian Unstable
package and... it worked fine. The only problem is that there is no Bash completion
script in the distribution. Easy to fix, write one. Having done one for SCons recently, taking the script from the rake
package and amending it for Rant was relatively trivial. You can find it here.
Wed, 02 Aug 2006
I have written a bash completion script for SCons. My page on this is here. I have also added a
page to the SCons wiki which can be accessed via the SCons
webpage
Sun, 16 Jul 2006
Having got my P900 working as a modem, I thought – I just got a new phone for my
wife and it is a 3G phone, I wonder if a 3G connection is any faster than a
GPRS connection?
I got everything working with the Sony Ericsson v600i using both the Bluetooth and the
USB cable and the speed is the same using either route and it is 3 times
faster than GPRS.
I have written up some notes on my experience which can be seen here
A few weeks ago, I was in the position of having to use my P900 as a modem or risk losing
money. I had previously tried to get this working and researched lots of websites, set up
phone, computer and Vodafone account but no joy. Vodafone do not support Linux and as I
am using Ubuntu 6.06 Dapper Drake this means no technical support from them. Well it used
to.
This time I had no alternative and had to the P900 as a modem. I went to my local
Vodafone shop to rant and rave about their incompetance and discrimination against Linux
users, threatening to change network operator but the very nice people in the shop
remained cool and calm and told me that Vodafone had totally revamped its technical
support and that I should try again rather than switch to another network operator.
Having done the cathartic ranting, I just did what they told me and phoned technical
support again and was pleasantly surprised by the change of attitude in technical support.
Rather than fob me off with ‘Linux is not supported, you should switch to Windows or
Mac’, they said ‘We can't help you but here is the phone number of a group who
can’ and I phoned and they could. It turns out everything had been right about the
set up I had in the first place except that I was using the wrong phone account because 3
didn't mean 3 it meant 1 – i.e. I changed a 3 to a 1 in my chat script and
everything has worked since.
Of course this mechanism of getting an Internet connection is extortionately expensive but
when you have to do it, it is good that it works.
I have written up some notes on my experience which can be seen here
Mon, 12 Jun 2006
Back in April I gave a talk on Groovy at the ACCU 2006 conference. As I mentioned on
2006-04-24, I wrote an article for the ACCU journal `{CVU}' based on some of the material.
This has now appeared:
Russel Winder (2006) ‘Hello Groovy’, {CVU} 18(3), pp.3–7.
Unfortunately, there are a few typos in the printed code listings. If you want to see the
original manuscript I sent in, you can get a PDF file by clicking here.
Java used to be a simply typed system. This led to lots of type errors but there was a sort of
consistency. Then came Generics which were supposed to give us extra type safety and in simple
cases do. However, as soon as you try to do anything half way sophisticated, erasure hits you
over the head .
At compile time X<A> and X<B> are different types. This
is good and very consistent with type theory. However at run time X<A>
and X<B> are the same type — they are both just X
because of the erasure system Sun invented. Now this wouldn't be a problem if there was
only static typing but there isn't, Java has dynamic type checking and casting — not
full dynamic typing but enough to cause real problems for the programming model. For
example, If I define a generic type with value equality rather than identity equality
then:
assertTrue ( ( new X<A> ( ) ).equals ( new X<B> ( ) ) ) ;
does not fail as a run time statement which is almost certainly totally surprising to the
reader of the code since they are looking at the statement and thinking in compile time
types. The conflict arises here because equals has to be written with a
parameter of type Object to get overriding.
Then of course, we have the compile time / run time conflict associated with casting. For
example:
X<A> xa = (X<A>) p ;
causes a compile time warning since the cast is actually (X) p due to
erasure. However if you write:
X<A> xa = (X) p ;
the compiler issues an error because of the inconsistency between the use of a
parameterized type and the raw type. So Java has a built in conflict and it appears not
to be going away in the near future.
I have other examples that get worse but they are too large to put up here.
Sun introduced this wonderful new technology of type erasure in the name of backward
compatibility and not changing the JVM. But then they went and changed the JVM anyway but
not by introducing the small changes that would allow run time types to include type
parameters — unlike C# which got it right from the outset. Like C#, Python and Ruby
do not have this problem. Groovy avoids the problem by ignoring Java 5.0 and sticking
with Java 1.4, at the expense of having all the problems of the underlying Java type
system. However, it is a totally dynamic language like Python and Ruby so the mindset is
different.
So my (bold) assertion is that Java is being ruined by the type erasure system and the
programmer confusion it causes. Sun should alter the JVM to implement run time
parameterized types properly. I don't see why this wasn't done for Java 5.0 — it is
clear that an extension to the JVM can be made that has no problem executing already
compiled classes fine.
Or does anyone have a way of thinking about the Java type system and erasure that creates
a nice consistent mental model?
Mon, 24 Apr 2006
The ACCU 2006 conference was last week and was as good as ever. ACCU is a group of
programmers, designers and trainers who are interested in C++, Python, Java, etc. -- see
here for the ACCU website. On the Friday, I did a 90
minute presentation on Groovy and included a bit
on Grails. A PDF file of the slides can be found here. I have
no idea why OpenOffice.org2 rendered the slides so badly, when I view them with ooimpress2
they look a lot nicer – all green for a start, no white. If there is a clamour for
the ODF format file, I will put it up.
All the source code for the presentation can be found here. I am in the middle of
writing the talk up as a paper for the ACCU journal just now so, rather than write a long
article here with all the code explained in context, I will leave you on tenterhooks
awating publication of the paper!
Sat, 03 Sep 2005
I have just been using a JList for the first time in ages. I see that (in
JDK1.5 — why isn't it JDK5.0?) there is a constructor taking an array and one taking
a Vector but not one taking a List, ArrayList or
LinkedList. I would have thought that the requirement for the data to a
JList was that it was a sequence. In Java, List is the type for
a sequence so why isn't it allowed? Why pick out Vector for special
treatment? I can see that discrimination against LinkedList is more or less
acceptable because a LinkedList is not a random access sequence —
indexed access is O(n) instead of O(1) and so this is not a good data structure for the
model of a JList. ArrayList however is a perfectly adequate
random access sequence yet you have to use ArrayList.toArray() to create an
array to provide the model for a JList.
Unless I am missing something really obvious, it seems that the people who develop Swing
do not believe in The Collections Framework. Sun say that ArrayList is to be
preferred over Vector but it seems that Sun is not listening to its own
message, continuing to ignore Collections in Swing. I assume that the use of
Vector is a hang over from pre-Collections days, which is many, many moons
ago now. Given that a Vector is a List and the
toArray method works fine, why haven't they deprecated the
Vector constructor and/or replaced it with a List constructor?
If anyone knows the answer to this trivial but irritating conundrum do tell.
Thu, 24 Feb 2005
I have tried a number of times in the past to get my Sony Ericsson P900 connected to my
workstation (which runs Debian GNU/Linux Testing with the odd bit of Unstable, basically Mono
and a couple of C#applications) either by Bluetooth or using the USB cradle. I have never
managed to achieve the real goal which is managing the phone's filestore from the workstation
and synchronizing the phone with Evolution. This time I decided I had to get it all working.
Getting basic file transfer using Bluetooth is actually relatively easy. I am running kernel
2.6.8-2 which means that all the necessary bits that need to be in the kernel are already in
the stock kernel. So by loading the standard Bluetooth packages and getting Edd Dumbill's
Gnome Bluetooth packages and using gnome-obex-server and gnome-obex-send I have Bluetooth file
transfer in both directions. The site I used as a driver for my actions was Stefan Bellon's page on Debian GNU/Linux and the
P900.
Next step was to follow Stefan's instructions for getting p3nfs working. The p3nfs package
downloads and installs fine. Stefan then says load nfsapp into your phone. OK, so where is
nfsapp? It is not in the downloaded package anywhere as far as I can see. Looking in
/usr/share/p3nfs, it seems the package includes the source and you are supposed to build it
yourself but that means loading the whole Symbian SDK in order to do the compilation. On
speculation I downloaded the p3nfs source package and there was a precompiled file:
bin/nfsapp-2.8-UIQ.sis. I used gnome-obex-push to send it to the phone and it worked
nicely. Well it started and seemed to be behaving sensibly anyway. I wonder if the p3nfs
packager needs to think a bit more carefully about the p3nfs binary package so that the
prebuilt nfsapp actually arrives with the binary package.
Stefan's page then tells you to configure the rfcomm stuff which is easy except that he
doesn't mention how to get the , i.e. the bluetooth address of the phone. He assumes
you know that using "hcitool scan" gets you the information. OK so /etc/bluetooth/rfcomm.conf
is set up. Stefan then says run "p3nfsd -UIQ -tty /dev/rfcomm11 -dir " (where
for me is /media/RLW-P900) after having started nfsclient (presumably nfsapp!) on
the phone -- NB I had already added set uid on the p3nfs command. Easily done and fails. I
got:
|> p3nfsd -UIQ -tty /dev/rfcomm11 -dir /media/RLW-P900
p3nfsd: version 5.15, using /dev/rfcomm11 (115200), mounting on /media/RLW-P900
/dev/rfcomm11: No such device
but of course it is there:
|> ll /dev/rfcomm11
crw-rw---- 1 root dialout 216, 11 2005-02-18 19:28 /dev/rfcomm11
and I am in group dialout and p3nfs is set uid so I can run it as me rather than root. I
emailed Stefan about this and we agreed that it may well be a udev problem. More
experimentation needed to sort this out.
So I then looked at the p3nfs documentation (/usr/share/doc/p3nfs/doc/bluetooth.linux). It
proposes using /dev/rfcomm0 rather than /dev/rfcomm11 and performing the rfcomm port binding
manually rather than using the configuration file. I notice that the p3nfs documentation
assumes you already have nfsapp (or is it nfsclient :-) loaded on the phone but following the
instructions at least caused some communication between workstation and phone. Starting the
nfsapp on the phone already starts the Bluetooth mode (despite what the documentation says in
Point 7, do "rfcomm bind /dev/rfcomm0 11" as root or using sudo followed by "p3nfsd
-UIQ -tty /dev/rfcomm0 -dir /media/RLW-P900" and I get a dialogue on the phone asking if I
wish to accept the connection. Looking good. Press accept. And it worked. Amazing :-)
|> p3nfsd -UIQ -tty /dev/rfcomm0 -dir /media/RLW-P900
p3nfsd: version 5.15, using /dev/rfcomm0 (115200), mounting on /media/RLW-P900
p3nfsd: to stop the server do "ls /media/RLW-P900/exit". (pid 22305)
I was then able to wander around the A:, C:, D: and Z: drives of the phone from the workstation.
Wonderful. OK, it may seem sad to find such a trivial thing exciting but it is progress and a lot further
than I have got before.
Further experimentation indicates that using /dev/rfcomm11 works fine as Stefan said it would
if the binding is done manually rather than relying on the /etc/bluetooth/rfcomm.conf file. I
guess Stefan's instructions would have worked if whatever it is in the rfcomm system was doing
what it should be doing. I guess the manual bind forces something that doesn't happen if you
rely on the rfcomm configuration to do the binding. More experimentation needed.
Anyway enough for now. Next I try the cradle.
Mon, 07 Feb 2005
I spent some time recently learning much more about C++ templates and generic programming in
C++. As part of this I wrote a subrange type for C++. It seems only reasonable to release
this (under the Boost Licence version 1.0)
in case it is any use to anyone. More details on subrange are here.
Sat, 29 Jan 2005
I have been having a problem with fonts and font selection in OpenOffice.org on my Debian
GNU/Linux system. In particular, I am having problems with fontconfig not correctly
organizing the fonts into typefaces and styles. Also I have some fonts where I have both Type
1 and TTF files of the font in the fontconfig path and things are getting mightily confused
but this is actually just another aspect of the basic naming problem.
The basic naming problem is that fontconfig assumes that the font will present font names,
typeface names and style names in a consistent and known way. There seems to be no problem
with Type 1 fonts, except occasionally Book is replaced by Regular as the style but this is
not really a problem at all. TTF fonts on the other hand seem very problematic. The scheme
for naming fonts, typefaces and styles seems either not to exist or to be flouted for some
reason. I have no idea if Micro$oft Windows gets round the problem as I do not use that
system but fontconfig clearly does not. To investigate this I need a browser of the fonts on
my system that can more carefully deconstruct information about and browse fonts.
I have in the past used gfontview. However this has a number of problems: it is a GTK1
application and I am using GTK2 and, more importantly, it only displays fonts for a given
directory and does not assemble fonts into typefaces and styles. However, it has many of the
features of the sort of display I want. Nautilus of course provides thumbnail previews of
fonts and by double clicking gives the individual font viewer. This is nice in many ways but
doesn't allow easy browsing since the thumbnails only display Aa and it is directory at a
time. OK so it is possible to have multiple Nautilus windows up but you have to specify each
and every directory and so you end up with 9 or 10 windows and there isn't enough screen
space. Also this does not allow fontconfig driven browsing. There is of course the GTK font
selection dialogue. This understands fontconfig but it doesn't give information about the
source of the font — if there was a way of finding the file name for the given style of
a give typeface using this dialogue I probably would be using that and not writing this!
So I am looking for a font browser which must:
-
Be able to work by being given a list of directories to show the fonts for or use fontconfig
to work with the set of fonts available to GTK applications. So two distinct modes of working.
-
Be a browser of a catalogue of fonts rather than a simple chooser, i.e. I want to be able to
see all the fonts all at once — OK not entirely possible but I do want to be able to
make a selection of a set of fonts and see them all displayed together.
Asking around, the two most helpful comments I got were "Its a 20minute hack in PyGTK." and
"There are lots of new font browsers being worked on." For all the searching of Google I
cannot find mention of any new font browsers but this may just be my bad searching ability.
If anyone knows of any work please email me. So it seemed to be time to think about doing it
myself. I have masses of other things to do and don't really have the time but it has to be
done.
The immediate question then is which language? Well GTK etc. are all C-based systems but C is
basically assembler so we don't want to use that. GTKMM gives a binding for C++ so that is
one possibility. Python has PyGTK. Ruby has Ruby-Gnome. Java has Java-Gnome. Groovy is
also a possibility since it can use Java-Gnome. So I did a little experiment: I wrote a
program in each of these languages to put up the GTK font selection dialogue box just to see
how painful each of the languages were. The idea being that if the project ended up being
half-way useful then it would probably need to be written in C but for prototyping use the
easiest language possible. So here are the various versions:
-
C++
-
Python
-
Ruby
-
Java
-
Groovy This is not groovy Groovy. It needs
rewriting to use closures but this may entail writing a complete GTK builder like the
SwingBuilder and the SWTBuilder.
In many ways they are all much of a muchness. Java, Groovy and Ruby allow signal handlers to
be defined at the connection call using either anonymous classes or closures and that is
nice. Very nice. C++ and Python are much more mainstream for these sorts of application.
Decisions, decisions. Time for some more dithering.
Sun, 16 Jan 2005
It is probably just me not looking hard enough or, perhaps, just not knowing enough
(i.e. maybe everyone who installs PyBlosxom with Apache2 just knows this) but I couldn't find
anywhere on the Web or the PyBlosxom 2 documentation the details of how to make Apache2 do the
right thing. The PyBlosxom documentation itself says nothing but I did find How to Install PyBlosxom, Section
1.5 of which at least had something but it wasn't really the right answer.
I hassled Ross Burton as is traditional for me in this
sort of situation and after a few email exchanges put some rewrite rules into the Apaches2
configuration file — you can also use .htaccess files of course. Here is the relevant
Directory section:
<Directory /home/www/russel.org.uk/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
RewriteEngine on
RewriteBase /
RewriteRule ^$ blog/
RewriteRule ^index.htm.*$ blog/
RewriteRule ^default.htm.*$ blog/
RewriteRule ^blog$ /cgi-bin/pyblosxom.cgi
RewriteRule ^blog/(.*) /cgi-bin/pyblosxom.cgi/$1
</Directory>
The trick of redirecting everything through a dummy URL may well be standard and in hindsight
it is obvious but it wasn't until Ross told me about it. (Many thanks to Ross for answering
all my emails with patience and real facts.)
Thu, 13 Jan 2005
Prompted by the very widespread use of blog software for running Web sites, I decided to try
the idea out. Given that Ross Burton uses PyBlosxom,
I decided to try that. I already run Apache2 so installation of PyBlosxom was really as easy
as "follow the instructions". Then there was the task of creating the flavour that actually
gives the site its style, this was a totally different matter from the ease and simplicity of
installing PyBlosxom but I found ideas from various Web sites and ended up with what you see
here. It will change.
Perhaps the hardest two bits of getting going were: a. getting Apache to do the right thing
and b. deciding on how to layout all the non-PyBlosxom controlled material. And trying to stop
my UPS from spontaneously switching off all my machines.
Of course it is unlikely that anyone will actually read the stuff I put up but I have found so
much good material that has helped me put up by others I thought it only fair to put stuff up
that might be helpful to others.