November 28, 2006
cygwin, mingw and runtime libraries
The compiler always wants to link msvcrt.dll, so to link with msvcr80 we have to create a directory containing a copy of the mingw/cygwin distribution's msvcr80.a library renamed to msvcrt.a, and then specify this directory as a library path when we link.
Wouldn't it be simpler if the distribution came set up that way?
October 01, 2006
Who Maintains the Peace in Utopia?
Consider how a single nation maintains peace within itself; any peaceful modern nation is based on some fundamental ideas - a legal system and some form of representational government, whether secular or religious. The legal system comprises a set of laws that are applied without preference or prejudice to the whole of the population, patrolled by a police force and enforced with by an independent judiciary. The application of the legal system is independent of the political system, even though the later may add to the body of law that is enforced. The political system represents the people in some way, and controls an executive that performs the day to day running of the government. The jurisprudence might by driven by a civil code, case history, or a religious code.
At the supranational level, we can identify similar bodies today. At the continental level the European union provides a functionaing model for co-operating nations, and has fairly well established parliament providing elected representation, a court system, a legislative body, an executive under the high level guidance of the European Council.
On the global scale, we have the United Nations, comprised of a representative body, an executive, a court system, the Security Council responsable for maintaining international peace, and the Economic and Social Council. Independent of the UN, we have the International Criminal Court and Interpol, the World Bank and the International Monetary Fund.
How well are these institutions working, and are they capable of maintaining peace in Utopia?
September 16, 2006
Peace in the Middle East
I would suggest, peace is attainable only when socially cohesive groups of people feel relatively safe from attack either from foreign powers or from militants within their own community, and able to exert some influence on their future lives through their good conduct and hard work. Put a little more simply this would imply economically sound, sovereign nations are a necessary precondition to sustained peace.
In the context of the Middle East this implies that Israel can only achieve peace and security through a prosperous and strong Lebanon and Palestine; that Iran will only act responsibly on the international scene if it does not feel threatened by Israel and the US.
Returning to the recent conflict, I can only see Israel's massive destruction of southern Lebanon as hindering its long term chances of peace. The destruction has certainly slowed economic development in Lebanon, strengthened Hezbollah support among some Lebanese, and generally made the elected government look weak, undermining the very processes that were leading to a stronger Lebanon.
The suppression of Palestine is similarly counterproductive. In some ways, the poverty in Palestine can be compared to that in the Weimar Republic, which the Allies duly learnt from, as seen by the contrast in the conditions of the peace treaties following the First and Second World War.
I am not suggesting that Hamas and Hezbollah are right to attack Israel, or that Israel is wrong to defend itself. Israel is now a well established country, and despite extremist Arab posturing to the contrary, it would be unthinkable to the international community for it to be destroyed.
While there are a myriad of other problems to be sorted out in the Middle East, I would like to consider the implications of strong Arab states, as I believe this gives us an interesting perspective on how a peace might be achieved.
More later ...
March 27, 2006
Using Tapestry
Tapestry is great for writing java web application hosted user interfaces. The version 4.0 with its HiveMind integration is extremely powerful. The Hivemind part of the jigsaw together with Tapestry's use of annotations encourages a clean, reusable style of coding - it took a while but i finally "got" depenendency injection. The Hivemind wiring together with EasyMock makes both unit testing and integration testing simple and very practical.
(Aside: When Tim Bray says he might have a go at writing his comments system in EE, I would heartily recommend he look at Tapestry.)
Having said that I have run up against some annoying issues.
These range from the trival:
- Can not localise a submit button
- Can not put a FieldLabel after it's component
- Finding the correct replacement (usually the service name) for deprecated methods is long winded when not specified in the JavaDoc
- The HiveMind docs are very fragmented - even now I know what I am looking for I still end up search in three different sections to find it...
There are also some other issues I ran up against in building an edit compenent for a POJO that are slightly more vexing.
- The sub-component structure of a component is fixed at compile time, and the only interface for passing info at compile time to a component is through the component's name. This means I ended up inventing a naming convention to pass information to be processed when the component specification is resolved.
- In HiveMind, the javassist integration is limited by the limited interface exported by HiveMind, and the inaccessibility of its ClassPool
I am also having problems localising a component coming from a library - but I think that is a understanding issue on how the IComponentSpecification's Location affects the message catalog resolution ...
March 26, 2006
Tapestry Edit Component
<span jwcid="@edit:EditObject" object="ognl:pojo"/>
I had already started working on such a component, after getting fed up of creating edit pages by hand. I have posted some (alpha) code at http://www3.sympatico.ca/hugo.duncan/EditComponent.tar.gz.
The component is referenced as Edit<class.name.to.display>.
The object to edit is passed using the item parameter.
The layout parameter can be used to pass a literal string selecting a layout. The default layout is "table", which produces a table, where each property is on a new table row. Template layouts can be contributed to a hivemind service. eg. TemplateLayoutTableColumns provides a layout for one row per object views of a collection.
The type of component used to display a property can be specified in the component specification, eg. Edit<class.name.to.display,myfield=TextFieldPropertyComponent>. Selecting a component of null suppresses the property from being displayed.
The default type of component selected to display and edit a property can be set by contributing a IComponentProvider to the tapestry.contrib.editor.ComponentProviders configuration point.
Bindings on this component of the form "subcomponent.parameter" are forwarded to the subcomponent.
To display collections, parameters mimicking the For component parameters are used.
A sequence parameter can be used to specify the order in which the properties are displayed.