Pages

32% civilian death rate in drone attacks on pakistani soil?

Boingboing writes:

“Our study shows that the 114 reported drone strikes in northwest Pakistan, including 18 in 2010, from 2004 to the present have killed approximately between 834 and 1,216 individuals, of whom around 549 to 849 were described as militants in reliable press accounts, about 2/3 of total on average. Thus, the true civilian fatality rate since 2004 according to our analysis is approximately 32%.”.

They themselves quote http://counterterrorism.newamerica.net/drones.

It’s clearly hard to separate facts from fiction here. But 1/3 civilian casualty rate, if roughly right, is hard to justify I’d say.

soap 1.1 vs soap 1.2 media types

Playing around with Metro, I get this error in my tomcat log;

SEVERE: Unsupported Content-Type: application/soap+xml Supported ones are: [text
/xml]

I scratch my head, and find that

“These errors are related to SOAP 1.1 or 1.2 versions:
SOAP 1.1 uses text/xml
SOAP 1.2 uses application/soap+xml”

thanks to Adrian.


Get subdirs from wget and getting past robot disallows

I’m going to a place where there is no net, and was thinking of reading the metro manual. A naive approach

$ wget -r https://metro.dev.java.net/guide/

gets me nowhere however, as wget stops pretty fast and leaves a file that states

User-agent: CEE
Disallow:
User-agent: *
Disallow: /

I can do ‘-e robots=off’ mixed with some stuff from  Voelkers excellent wget examples:

wget -P guide -e robots=off -r -p -k --no-parent -nH --cut-dirs=1 -e robots=off https://metro.dev.java.net/guide/

That does the trick.

Mda driven integration

On a project I work on, we’re doing something I’ve only done as student exercises and never in a large scale commercial project. All interfaces that are exposed and used by external agents are development-wise managed by a model driven architecture (MDA). All web services exposed and file transfers that are shared with some external partner is governed this way. Let’s for brevity name all these exposed services. Architecturally, there is a separate integration server that handles all exposed services and there is an application server that relates to this integration server.

  • Now, we maintain a UML model of the exposed services, it’s dependent objetcs, as well as the service interfaces between the integration server and the application server.
  • We then use Andromda to transform the model to java source code, produce wsdl and xsds and the like.
    • We use a custom cartridge dependent on Freemarker as a template engine for producing these source files.

So what do we gain by this?

I’m not entirely sure. We’ve sort of inherited this unusual and fancy setup. A common problem with integration work is that definitions and terms are maintained separately in on each agent being part of the relation and as such needs to be kept in synch. E.g. if an object definition changes then all its serializations, be it xsd or java, needs to be updated and on all hosts that partake in some exchange based on this object.

With an MDA approach which spans multiple hosts, one needs only one update however, and then the andromda wizardry will take care of that all serializations of this definition are generated and are identical.

One may counter however, that with a traditional dependent project (a jar or a maven2 pom) which contains the shared definitions, then all that synchronization work will do itself. And that’s probably true. But without some custom script, code or other magic, you won’t get synchronized xsd’s (and possibly wsdl’s if you embed your xsd’s).

Still, the advantage is debatable given the cost of maintaining and configuring the andromda and custom cartridges though.

Finally, you get very nice documentation and overviews.  It is easier for a newbie to see the totality and understand the scope of the system.

hiding fullscreen citrix in linux

I remote to various workplaces over citrix. I’d prefer other technologies, but that’s another story. I work in fullscreen. But, I often need to switch out of my citrix environment and back to the linux host to do other things. This does the trick;

  • ctrl-f2, tells citrix that the next keystroke is to be passed through
  • alt-f9, this makes gnome pack away the window.

Thanks to Scott McDonald for this handy tip.

Mule debug and config files

1. You may attach a debugger by editing the wrapper.conf file;

wrapper.java.additional.3=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

Additionally, I added to the invocation of mule a -debug flag, e.g. in the hello example;

 exec "$MULE_BASE/bin/mule" -debug -config hello-http-config.xml

2. Let’s look at the hello example; The config.xml file consists of a set of definitional items, e.g.

 <custom-transformer name="StringToNameString"/>

and then continues with a model which consists of a set of services;

<model name="helloSample">
 <service name="GreeterUMO">
 </service>
 <service name="ChitChatUMO">
 </service>
 <service name="UserErrorHandler">
 </service>
 <service name="SystemErrorHandler">
 </service>
 </model>

Each service seems to feature an <inbound>, a <component> and an <outbound> section;

 <inbound>
 <inbound-endpoint address="http://localhost:8888" transformer-refs="HttpRequestToNameString" synchronous="true">
 </inbound-endpoint>
 <inbound-endpoint address="servlet://name" transformer-refs="HttpRequestToNameString" synchronous="true">
 </inbound-endpoint>
 <inbound-endpoint address="servlet://rest" transformer-refs="HttpRequestToParameter StringToNameString" responseTransformer-refs="PlainTextResponseTransformer" synchronous="true"/>

 <vm:inbound-endpoint path="greeter" transformer-refs="StringToNameString" synchronous="true"/>
 </inbound>
 <component/>
 <outbound>
 <filtering-router>
 <vm:outbound-endpoint path="chitchatter" synchronous="true"/>
 <payload-type-filter expectedType="org.mule.example.hello.NameString"/>
 </filtering-router>
 <filtering-router>
 <vm:outbound-endpoint path="userErrorHandler" synchronous="true"/>
 <payload-type-filter expectedType="java.lang.Exception"/>
 </filtering-router>
 </outbound>
 <!-- Route unexpected errors to separate error handler -->
 <default-service-exception-strategy>
 <vm:outbound-endpoint path="systemErrorHandler"/>
 </default-service-exception-strategy>

You may, it seems define multiple inbound-endpoints. It seems there is a vm:inbound-endpoint for every service and which precedes the component part.

2.1. outbound and inbound endpoints seem to match on path, e.g.

 <vm:outbound-endpoint path="chitchatter" synchronous="true"/>

matches

<vm:inbound-endpoint path="chitchatter" ../>

2.2. Which method on components are called? Seems there is a fair amount of reflection going on. With the

 <service name="ChitChatUMO">
 <inbound>
 <vm:inbound-endpoint path="chitchatter" transformer-refs="NameStringToChatString" responseTransformer-refs="ChatStringToString" synchronous="true"/>
 </inbound>
 <component/>
 </service>

mule will pick a unique public method from ChitChatter that doesn’t match

“ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]”

If there are more than one match, you add a method parameter, url style;

 <vm:inbound-endpoint path="chitchatter?method=chat1"../>

2.3. How does Mule know which types to use when calling and filtering?

a. In <inbound-endpoint address=”http://localhost:8888″ transformer-refs=”HttpRequestToNameString” synchronous=”true”>

HttpRequestToNameString is an AbstractTranformer and returns a NameString.

b. Greeter.greet(NameString) receives this data.

c. In the filtering-router, the router selects according to type; <payload-type-filter expectedType=”org.mule.example.hello.NameString”/>

d. in  <vm:inbound-endpoint path=”chitchatter” transformer-refs=”NameStringToChatString” responseTransformer-refs=”ChatStringToString” synchronous=”true”/> the component class is called after the transformer NameStringToChatString is called. Input is then ok.

Unagile TOGAF

I’m TOGAF certifying myself. Going through an 800 page book. Authorless by the way. A set of contributors are listed, but there are no editors and authors per se. That’s quite unusual.

Anyway, one cannot help but think of how software engineering was before agile came along, when one works with this framework. A majority of the methodological steps are about defining things (architectures and all that follows). As opposed to implementing and realizing. And the number of documents and textual deliverables is staggering. It seems so cumbersome and bureaucratic. It reminds me of the definitions, plans and specifications that were prescribed by pre-agile software development methods.

Now, the proponents of TOGAF will surely put forward that the framework must be tailored to the needs and constraints of the business and case at hand. And that one may, given the right circumstance, skip and trim to make the process lighter. Hmm.

That echoes arguments we heard from pre-agile s/w development method proponents when agile came with it’s fairly revolutionary approach as well.  And then there were the chorus from pre-agile s/w development method proponents saying that the agile way would go off the rails and it would be chaos without clear definitions and full specifications before the actual development could start.

I realize that enterprise architectural work is quite different from software development. And it might be that in fact you need to be as stringent and document centric as TOGAF prescribes.

But still..

reuse of visual content in java projects

Hm.. what are my options when you want to reuse some visual content rendered by some other runtime component?

Let’s say you have war A that renders some pages. Let’s say you’re writing another war (B)  and you suddenly want to reuse some ot the content from A. Let’s say you want to inherit, but also tweak. Parameterize I guess. I could..

  • do: jstl <c:import url=”<absolute or relative url>”/>in a jsp page. This includes rendered content however, so you don’t get to influence the content before rendering.
  • do: response.sendRedirect(<absolute or relative url); on the server side. Ditto disadvantage as above.
  • make a jsp taglib. I principle I guess you may put anything in the start and end tag methods, but in practice it is at best an unelegant method for reusing visual content with some size and layout
  • use maven2’s war plugin’s overlay functionality. This works, but is somewhat crude, and requires good control over naming and directories.
  • make a (jsf 2.0+) facelet taglib. No disadvantages, but a huge added bonus that you may include all kinds of fancy layout and composition as you would normally do with facelets. And paramterization works just fine. :-D

So this last option is the only good option in my opinion. Let’s have a look;

Component A

In web.xml you define the taglib;

<context-param>
 <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
 <param-value>
 /META-INF/mfoTags.taglib.xml
 </param-value>
 </context-param>

In META-INF (nowhere else, or the inter-module/war dependency will not work) you define mfoTags.taglib.xml (and it needs to have both taglib and xml as postfixes) :

<?xml version="1.0" encoding="UTF-8"?>
 <facelet-taglib>
 <namespace>http://yarc.name/mfoFaceletTags</namespace>
 <tag>
 <tag-name>siteNav</tag-name>
 <source>../WEB-INF/tags/siteNav.xhtml</source>
 </tag>
 </facelet-taglib>

..and you need (at least) an empty faces-config.xml:

<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
 "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
 "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
</faces-config>

Finally, you need to package this as a jar (not a war). My solution here was to make a symbolic link since I wanted component A to remain a war since it is used as a war component on it’s own.

That’s it. Now for the user of this component;

Component B

You need to include a classpath ref to the above mentioned jar.

In the .xhtml file you’re going to refer to the facelet tag

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:mf="http://yarc.name/mfoFaceletTags"

...

>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 ...
 </head>
 <body>
 ...
 <mf:siteNav/>
 </body>
 </html>

If that isn’t simple and beautiful, then I don’t know what. Almost poetry. :-)

Week-end time!

Thanks to Laliluna for small tricks and hints and the excellent facelet documentation.

Wow and wine on ubuntu 9.04 64 bit

I find you quite frequently need to have a fresh development version of Wine to play world of warcraft on linux. So, these are the steps I followed:

  • GitWine – sets you up with Wine’s latest development snapshot. Only section 2 applies for those of us who do not contribute.
  • Building 32-bit Wine on a 64-bit (x86-64) system:
    • “Building Wine on Ubuntu / Kubuntu 9.04 (Jaunty Jackalope)” section worked for me. A plain “make” doesn’t work out of the box and the
sudo apt-get build-dep wine

is crucial.

After that, one may do

wine InstallWoW.exe

..from the account management download client page. Now, the wow login page will fail with a “runtime error” r6034. Thanks to Neckrippa at http://forums.worldofwarcraft.com/thread.html?topicId=21723844202&sid=1 there is a fix;

Change the version number in

<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.4053" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>

in the Microsoft.VC80.CRT.manifest (wow install directory) with

version="8.0.50727.762"

Then login is ok, and the game is works well.

secure copy which continues where you left off if interrupted

If I’m at liberty, I’ll in 10/10 cases be ssh based when communicating between hosts. Secure, easy, terminal with graphics (ssh -X), copy (scp) , remote filesystem (sshfs) and only one port to keep track of. Large copy operations are a bit annoying over a normal scp however, since if the copy is interrupted for some reason, you have to start all over again. Combined with rsync however, this problem goes away;

$ rsync -avz –partial -e ssh me@remotehost:/remotedir localdir

The z flag is dependent on the tradeoff between cpu power, bandwidth and the nature of the files I guess.

The only other annoying thing I can think of is the lack of sshfs support with Windows. But NTFS is a dinosaur, so what can one expect I guess..