New Anime Series: Noragmi

First Episode(s) Review for: Noragmi
Summary:

A young down on his luck homeless God or as he calls himself “A delivery God” is struggling his way though life, till he is saved from a passing bus by a young girl, the incident gives the girl the ability to leave her body, something she wants fixed, enter the world of street level small gods and their regalia

Animation:

Good high detail animation the kind I associated with high action anime (I wonder if they get slowed down a lot and replayed one frame at a time), very nice and clear with excellent use of colour such as pastels at emotional times and mono chrome on the opening sequence

Plot Potential:

I have a week spot of any story to do with gods but this has tons of potential but currently no direction so I think it MIGHT be a great series, as long as the opportunity it has is not wasted.

Music:

Hooray the first MP3 player worthy opening theme this season, the rest of the music in this series is a bit ho-hum

Reminds me of:

bit of Yozakura Quartet bit of XxxHolic

Overall:

So its basically the life of a street gang but in the supernatural world, good stuff, the characters are nothing new, but its still very much worth watching especially if the plot lives up to its potential.

 

 

 

Disclaimer: These are mini reviews of anime’s that are fresh out in Japan and are not licensed in the UK, buy them once they have been licensed or at the very least buy the merchandise, remember if the anime makers make a loss, THEY WILL STOP MAKING ANIME!!

Backing Up Websphere Config

As a connections developer you will be fiddling with you local Websphere configuration, and down that road madness lays, so before you touch anything the make the whole thing go BANG! (and quite frankly that can be anything, you need to know how to backup and restore the config.

To do this first go to the bin directory of your deployment manager, in my test server’s case that is (yours will most likely be very similar except for it being on “E”)

E:IBMWebSphereAppServerprofilesDmgr01bin>

and just enter “backupconfig” giving the location of a new zip file you want created for everything to be stored in and wait for the stream of little dots to finish,

backupconfig e:preLDAPchange.zip

On a web sphere server with a ‘medium’ Connections installation on it, This will give you a Zip file of about 775Meg so make sure you have the space (on a side note go have a look inside the zip it’s fascinating, like some sort of config abattoir)
hopefully you wont want it but say your change broke everything and you need to put it all back as it was, you run the ‘restoreconfig’ comand, as follows using the Zip file you created

restoreconfig e:preLDAPchange.zip

Again, just wait for it to be done, and things should start working again.
Of course its all fully documented on the IBM website if you know to look [Here](http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frxml_restoreconfig.html) And [Here](http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frxml_restoreconfig.html)
_NOTE: I’m not a proper Web Sphere admin, If you want proper Web Sphere and Connections admin you want [the Turtle Partnership](http://www.turtleweb.com/)_

New Anime Series: Nobunagun

First Episode(s) Review for: Nobunagun
Summary:

Violent dreams haunt a somewhat forgetful and easy goring girl, she is a bit of a flake but bumbles though life happily enough, that is until aliens arrive at a field trip, and she turns out to have the memories of a great Japanese military commander and the giant cannons to match.

Animation:

A mix of open and cheerful for the human areas and dark and brooding the the dream sequences, A very nice touch is the use of coloured shadows to show a persons type i.e. normal girls get flowers in their shadows while the heroine gets camouflage colours

Plot Potential:

This depends, it could be as a simple power ranger series or as serious a samurai drama, hard to tell at this point as there is a mix of smiling bouncy bits and people with swords thought their bellies

Music:

Alt Rock though out, fairly generic stuff but good beats

Reminds me of:

Time travel between Neon Genesis Evangelion and Samurai Gun with a chunk of the plot of Gate Keepers

Overall:

I am pleasantly surprised with this Anime it feels like it should be a jolly little jokey super powered team Anime, but it is far darker in execution, a real dark horse of the season, well worth watching.

 

 

 

Disclaimer: These are mini reviews of anime’s that are fresh out in Japan and are not licensed in the UK, buy them once they have been licensed or at the very least buy the merchandise, remember if the anime makers make a loss, THEY WILL STOP MAKING ANIME!!

Inserting HTML into word documents

Document generation is one of the most useful things that any system can do for users as basically users tend to think in terms of Microsoft word and Excel documents and in my opinion the best library for producing them via Java is http://www.docx4java.org/

This library (I am using version 2.8) allows you to build everything from scratch, but its far easier to start with a template document normally supplied by a client and just substitute the values you want

so lets do that:

First create your empty “WordprocessingMLPackage” package which is the holding object for your word document, and create a normal java File object using your template file

Then load that file into your WordprocessingMLPackage

WordprocessingMLPackage wordMLPackage;
File templatefile = new File("C:\mytemplatefile.docx");
wordMLPackage = WordprocessingMLPackage.load(templatefile);

Ok, so now we have a word document, but its just a generic document its not personalised to our clients needs, to personalise it we first need to put placeholders in the template for our data to go in, these are just text in the word document in the format ${xxxxxxx} as you can see below

docx4j1.png

Once these are in you can use them to substitute your text
first build and populate yourself a hashmap of the values you want substituting

HashMap<String, String> mappings = new HashMap<String, String>();
mappings.put("Replace_Tex1", "This is some custome data");

As you can see the first part needs to be the placeholder name and the second part the value you want to be inserted.
Once that is ready you can do the substitution, but first you need to convert your existing WordprocessingMLPackage to XML so you have something easier to work with

String xml = XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true);

with the resultant xml and the hashmap we can use the XmlUtils.unmarshallFromTemplate function to do the swap then stuff the result back into the WordprocessingMLPackage

wordMLPackage.getMainDocumentPart().setJaxbElement((org.docx4j.wml.Document) XmlUtils.unmarshallFromTemplate(xml, mappings));

And that is us done we can just “SaveToZipFile” (basically docx files are just renamed zip files with XML inside them) and save the file to the fie system

SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
saver.save("C:\finaldocument.docx");

But where you ask was the html insertion you promised, you have just shown us plain text, where is the formatted html inserts.
For that dear reader with need to add a bunch more code
There is no built in function to do that for HTML so we are going to have to:
1. Get a list of all the object (such as paragraphs, lines of text etc etc) in the WordprocessingMLPackage
2. Search though then to find the location of the text we want to replace (the placeholder)
3. Remove the Place holder text.
4. Add a wrapper object to our HTML, convert it to DOCX XML and insert it at the correct place.
for No.1 we will pinch from the fabulous Jos Dirksen’s [Create complex Word documents programatically with docx4j](http://www.smartjava.org/content/create-complex-word-docx-documents-programatically-docx4j) to get our list of objects.

private static List<Object> getAllElementFromObject(Object obj, Class<?> toSearch) {
    List<Object> result = new ArrayList<Object>();
    if (obj instanceof JAXBElement) obj = ((JAXBElement<?>) obj).getValue();
    if (obj.getClass().equals(toSearch))
        result.add(obj);
    else if (obj instanceof ContentAccessor) {
        List<?> children = ((ContentAccessor) obj).getContent();
        for (Object child : children) {
            result.addAll(getAllElementFromObject(child, toSearch));
        }
    }
    return result;
}

That done we will use that function to go though and search each object for the placeholder text and if its found return the integer that tells us its location in the document (and while its at it, it removes the place holder text)

private int findPlaceHolder(String placeholder, WordprocessingMLPackage template) {
    int index = 0;
    List<Object> paragraphs = getAllElementFromObject(template.getMainDocumentPart(), P.class);
    P toReplace = null;
    for (Object p : paragraphs) {
        List<Object> texts = getAllElementFromObject(p, Text.class);
        for (Object t : texts) {
            Text content = (Text) t;
            if (content.getValue().equals(placeholder)) {
                toReplace = (P) p;
                index = template.getMainDocumentPart().getContent().indexOf(toReplace);
                break;
            }
        }
    }
    if ( toReplace != null ) {
        //remove placeholder
        ((ContentAccessor)toReplace.getParent()).getContent().remove(toReplace);    
    }
    return index;
}

This finally gives us a way to insert the HTML at the correct place, so we do our mapping again, but this time with HTML rather than plain text

mappings.put("Replace_Tex1", "<b>This is some custom html data</b>");

Then loop though the HashMap, finding the correct location, importing the HTML and inserting the HTML into the WordprocessingMLPackage using the addall function.

Iterator iterator = mappings.entrySet().iterator();
while (iterator.hasNext()) {
    Map.Entry mapEntry = (Map.Entry) iterator.next();
    String xhtml = "<div>" + mapEntry.getValue().toString() + "</div>"; 
    int locationOfItem =  findPlaceHolder(mapEntry.getKey().toString(), wordMLPackage);
    if (locationOfItem > 0) {
        wordMLPackage.getMainDocumentPart().getContent().addAll(locationOfItem , XHTMLImporter.convert(xhtml, null, wordMLPackage)  );   
    }
    xhtml = "";
}

Thats it you can now insert any HTML you want anywhere you want into an existing Document
You can see that I had to wrap the HTML in a “DIV” (any root element will do but DIV is easiest), you have to do this or the XHTMLImporter will fail its validation, also the smallest item the HTML will import in as is a Paragraph so you can not use this method to change text and formatting inside an existing line, you will always get a paragraph break before and after (not really a limitation given the use cases)
As always yell if anything seems off.

New Anime Series: Magical Warfare

First Episode(s) Review for: Magical Warfare
Summary:

A normal Japanese high school boy who happens to be good at Kendo (stop me if you have heard this one before) Saves a young female magician who is being being hunted by her brain washed brother and his gang of evil magicians, the young lads friends join the fight and start manifesting magic of their own (to much comic surprise)

Animation:

The quality varies at different times, you get the feeling that the the artists who are painting the backgrounds are more talented than the ones drawing the characters, but still excellent quality all rounds

Plot Potential:

After a very grim start, it moves happily into “you perv” misunderstanding territory and then back to grim, then on to standard high school battle territory (where the only loser seems to be concrete), it looks like we are going to have to save the world again with the help of epic battles series, but I do like the “attack a magician with magic in the living world and get stripped of your magic” touch

Music:

Good rousing opening music and solid rock end theme, the kind of music that makes people new to anime go “Cooo!! they have proper music on these cartoons”

Reminds me of:

Code Geass is obviously a huge influence but with shades of Tenchi Muyo and a pinch of Needless

Overall:

The visual aspect of this anime totally out ways the plot, but hopefully that should improve, in the mean time its a solid series you could recommend to someone new to the genre, minor note: whats with the bloody stupid swords!!, there are hundreds of viable sword shapes without making up ones that would be naff to use

 

 

 

Disclaimer: These are mini reviews of anime’s that are fresh out in Japan and are not licensed in the UK, buy them once they have been licensed or at the very least buy the merchandise, remember if the anime makers make a loss, THEY WILL STOP MAKING ANIME!!