Friday 30 October 2009

eContent - The start of a new "home" project

have been ruminating about a home project (rather than work) that will exercise my Domino and Flex muscles [ Flex my Flex if you will ;) ] and I am sort of settled on a content managment system called eContent. I have got all the ideas in my head at the minute and they are currently being Mind-Mapped into some form of sensible order.

I have got the front page and logon up and running and I may be asking for volunteers to road test it in the next couple of weeks. It will [when and if it is finished ] be released open-source, so if anyone is interested in idiot testing it when I get something to test, please drop me an email.

This is the front screen [click for a bigger image] and I shall be blogging the life cycle of the project as I go for the moment there isn't a lot to say other than .. Happy Birthday "eContent"


Saturday 24 October 2009

Rage, rage against the dying of the light! Teenage Zombies, Shopping and the cost of a cup of Coffee

It has been one of those days....
As I sit here in McDonagh Central, the words of Dylan Thomas come rocketing into my mind
Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.
Yes I have been shopping in Londonderry / Derry (affectionatly known as "Stroke City" cos the Prods afix the suffix London and the Catholics do not , hence "Stroke City"). But that is not ther reason for this rant....

After a quick wander around PC world to look at the tech and all things geeky, sundry females dictated that it was time to hit Foyleside Shopping Centre, what our American cousins call "a mall". Oh Joy Unbounded!

To me shopping centres of any type are as Douglas Adams would have it "..the long dark tea time of the soul" and on this late October day never was it more true. Gales and heavy rain had moved in from the Atlantic and the north coast of Ireland was being drenched and blown hither and thither in equal measure.

So there I was abandoned in one of the temples of Mamon with not a great deal to do for a couple of hours. Don't get me wrong there is a place in the world for clothes shops otherwise we would all be naked and in the case of Northern Europeans blue with the cold. However the nature of clothes shops is defined by a select group of deamons that have slipped through a dimensional gateway and rather than douse everyone in nasty smelling ectoplasm have instead taken it upon themselves to damn humanity to a multitude of evils wrapped up in the gaudy glitter of "department stores".

It being close to Halloween, the store fronts are packed with the tat all parents of the under 10's are nagged incessantly for. Witches harts, skeletons of varying sizes, colour and luminosoty (all of which are anatomically total crap!) gouls, ghosties and other miscellanea that go bump in the night. (perhaps only in the minds of people that have had too much cheese before bed - nocturnal Stilton nibblers have a lot to answer for!)

I sat at the central crossroads of the four "legs" of the mall, three floors above and two below and let a seething horde of humantiy bumble past. It struck me there really wasn't that much difference between the shuffling gait of these Halloween consumers and that of the Zombies in the "[insert time of day here]... Of the Dead" movies.. All they needed was a little less colour and some dribble and it would have been perfect.
Way and above any other group represented in this mass of humanity was the packs of PPTGs [Post Pubescent Teenage Girls]. Now I am the father of a 20 something male, a fact that I give thanks for every waking day for I as a father would not let any daughter of mine out on the street looking anything like these lassies.

There was a palable tension as each group of PPTGs passed by. Where as teenage boys seldom are not awake enough at 3pm to pose any threat (other than the sudden discovery of last night's socks in the linen basket) these lassies where on the hunt, tracking down their prey by some form of collective telepathy... or could it be the high pitched giggling and overly enthusiastic ejectualations of camardarie - Hmmm there could be rich pickings for a piece of scientific study there.

I retired to the relative peace and quiet of the Gentleman's department of Debenhams which has one small floor in the basement which is around the same size as the portion of the next floor up set aside to sell handbag deodourisation utensils.

There amongst the suits, 3 colours in a variety of sizes from "Skinny Git" to "Fat Bastard" I found a modicum of sanity and peace. This was not a place for the predatory packs of PPTGs or there older but much more deadly YMWPs  [Young Mother With Pram] or the vicious solitary MAWLFAPFs [Middle Aged Woman Looking For A Party Frock] I spent a pleasant hour picking through a sizeable array of goods branded by "Stig" from Top Gear. (you can get Stig on a Rope if you feel the need to wash those intimate places with a dark visored helmeted Racing driver!) and some suits by "Rocca, John Rocca" why on earth does he need to have name mentioned twice .. it is not like it is a difficult name.. and I heard it the first time.. so WTF is there twice for?

Venturing back into the meleé i girded my loins and set off in search of a cup of coffee. Now I have said this before and I will say it again.. I WANT A FECKING CUP OF COFFEE. I do not want a trough, a bath or a small resevoir of the fecking stuff flavoured with caramel, cinnamon and essence of Papal Sweat!
I want a simple uncomplicated cup of coffee that taste of coffee, with perhaps a splash of milk, milk that came from an ordinary cow, not a skinny or lord perserve me a Soya cow! I want to be able to go up to the spotty oik behind the counter and say "A cup of coffee please" and not have to endure the endless fecking questions about the additional extras. Was not my instruction simple enough and put in such a way that there should be no misunderstanding? So to all you "baristas" out there, you are NOT some form of intellectual giant whose right it is to question the nature of the universe and coffee's place in it, you are there to give me a cup of smegging coffee when I ask for one and take whatever mortage level price your establishment is currently selling it for.How in gods green earth does some hot water, coffee beans and a serving attitude taught by Attilla the Starbucks Paradgim Moderator come to £3 fecking 50?

Ah well tis over for another wee while, I have been there done that and now I am at home, with the computer, a coffee and a good book, so for now I have done my "Rage Rage..." bit and the night having come lies ahead
Toodle pip for the now gentle reader :-)

Friday 23 October 2009

FLEX - Logging onto a Domino server from inside a FLEX app

Now don't queue up to shout at me.. this is a bit of a kludge and it works, however it does rely on some facilities of domino that may or may not be continued to be supported.

When you have Session Authentication enabled on your server and you log onto the server a cookie is dropped called DomAuthSessId and this cookie is passed back and forth to the server with every HTML page that is served.

Luckly in FLEX when you  log on to the server and use the HTTPService or WEBService objects this cookie is passed back to the server on each POST or GET that you call.. But how do you get this cookie there in the first place? Well the easiest way is to lock down your NSF so that Anonymous has no access and when accessed from the web the default server logon screen is displayed. Now far be it from me to say that it looks like shite but lets be fair is is rather 1990's in appearance. It would be much nicer if you could log on from the nice shiney RIA that Flex provides.

This is how I did it.

I need a HTTPService object to do the logon
<mx:HTTPService id        ="myLogon"
                    url      ="http://www.mynotesserver.com/names.nsf?logon"
                    method   ="POST"                
                    fault    ="logonFail()"    
                    result   ="logonResult(event)">    
                    <mx:request xmlns="">
                            <username>{username.text}</username>
                            <password>{password.text}</password>
                            <redirectto>http://www.mynotesserver.com/logonok?openagent</redirectto>
                    </mx:request>
</mx:HTTPService>
OK what's happening above
The HTTP Server i have defined will goto the URL specified in the URL setting which as you can see is the familiar names.nsf?logon URL and it will be a POST transaction rather than a GET
If the call successfully returns well formated XML actionscript function logonresult() will fire. If the connection fails OR poorly formatted XML is returned (as is the case if the call returns an HTML error page) the actionscript function logonFail() is called.
At the bottom i have defined 3 Paramaters that will be passed username, password and redirectto. Username is bound to a text input field called username in the flex application likewise password is bound to a similar field. Redirectto on the other hand points at logonok?openagent and this agent will be called if and only if the logon is processed by the server and the user is authenticated.

The logonFail() function looks like this

private function logonFail():void
{            
                Alert.show("Sorry - Your Logon Attempt failed")
}
The logonResult() function looks like this
private function logonResult(event:ResultEvent):void
            {                    
                 Alert.show("Hello there You are In!");        
            }
And the LS agent LogOnOk looks like this
Sub Initialize
    Print |Content-Type:text/xml|        
    Print |<?xml version="1.0" encoding="ISO-8859-1"?>|    
    Print | <loggedon>yes</loggedon> |    
End Sub

As you can see the LS simply returns some well formed if relatively meaningless XML should the signon fail for any reason some nasty HTML will be returned which will cause Flex to fire the logonFail() function.

I then place the USERNAME and PASSWORD field somewhere in the FLEX app with a LOGON button which calls actionscript myLogon.send() (myLogon being the ID of the HTTPService) and .send() initiates the call to the server.

Now although FLEX does not refresh the page the SWF is embedded in every time the server is contacted it does accept the cookies that are sent back from the server and placed them as normal on the page. So when you do something like the above in your own Flex app, and logon is sucessful when you go and look you will see the DomAuthSessId cookie appear, this then gets passed on each successive HTTPService call to your server (for as long as the cookie survives)

FLEX - What to do when your returned data has only one record

In Flex the easiest way to get data back from the server (any server) is to provide it with nicely formatted XML which Flex can cope with very easily and pop it into an ArrayCollection object. However what happens when your data set has only one record?

Yes Flex falls over because it cannot force the returned single item data type into an ArrayCollection object for example you may have this actionscript assuming you have some XML coming down that is called myData with rows of myArticles that have fields called myType and myKey in it
private var myData:ArrayCollectionmy;
Data = event.result.myData.myArticle;
If only one or no records are returned then flex throws an error and you have to code your way around it like this
private var myData:ArrayCollectionmy;
try
{
     myData = event.result.myData.myArticle;
} catch(error:Error) {
     var rcd:Object= new Object();
     rcd.myType = event.result.myData.myArticle.myType;
     rcd.myKey = event.result.myData.myArticle.myKey;
     myData = new ArrayCollection()
     myData.addItem(rcd)
}

What is this code doing?
Well the bit in the TRY{} tries to stuff the returned data into the Defined but uninstansiated ArrayCollection object called myData, if it succeeds (ie there was more than one record) everything is fine and the code will continue. If however there is only one record the CATCH{} code is run. I am not particularly interested in the error that is produced but it must be defined in the catch(error:Error) structure.

First I have to instansiate the ArrayCollection object with a new statement otherwise the object is null and you will get another error.

Then I create a new vanilla flex object called rcd

This object is populated with properties with names that match exactly the properties of the XML node

Once all the properties are set I add it into the ArrayCollection object and everything is fine

*** Note *** this code does not pick up on ZERO records.. this is because I NEVER return an empty data set. If the data set is empty i will construct a row that indicated to the user that no records where available. I suggest you do the same.

Thursday 22 October 2009

FLEX - Getting the URL when you are in a flex App

There are times when you want to get the URL either in it's entirity or just bits of it inside Flex. For example when you want to send a link to a document so that flex knows to go to that particular document and open it when the Flex app is initiated.

This is relatively simiple all you need to do is instansiate and access the BrowserManager object, from this object you can get all sorts of useful information about the URL that holds the FLEX object.

You will need to import the following classes.
import mx.utils.URLUtil;
import mx.managers.IBrowserManager;
import mx.managers.BrowserManager;
and the declare vars for the bits of the URL you want to get at
private var serverName:String;
private var portName:int;
private var protocolName:String;
Then in your application.CreationComplete event function lets call it initApp() you need this
private function initApp():void
(
browserManager = BrowserManager.getInstance();
browserManager.init("", "Browser Window Title");
var url:String = browserManager.url;
serverName = mx.utils.URLUtil.getServerName(url);
portName = mx.utils.URLUtil.getPort(url);
protocolName = mx.utils.URLUtil.getProtocol(url);
}

You then have your current server url all nicely in vars and you do not need to hard code your URLs in the rest of the code. (you will need to make the vars [Bindable] if you want to use them in other objects!)

There are loads of other methods associated with the BrowserManager Class which you can find here.

Tuesday 13 October 2009

But soft what light through yonder window breaks? (UKLUG 2009)

Ah gentle reader UKLUG tis over for another year, a fabulous production in 2 acts.
This year's production continued the march of excellence that is the Elsmore double act Warren and Kitty.

Foolishly they invited me to help in the organisation and I was able to watch at first hand as they pushed , cajoled and herded geeks (both speakers and attendees)and sponsors down the road to The SAS Radisson Hotel in Edinburgh assisted by the rest of the organising crew, now officially known as "Black Shirts" Paul Mooney, Eileen Fitzgerald, Julian Woodward, Matt White, Bill Buchan, Chris Coates, Gab and Tim Davis, Mike Smith, the "Token American" Rob Novak and lastly the token eejit ME :-)! Many many others selflessly lent a hand on the day and to them a large HUZZAH, multitudinous hugs and a great big thank you! They all played a part and I sort of hung around the edges and tried to be helpful.

Mind you it has to be said that all the brilliant organising in the world would have pointless if the cash had not been there to make it all possible, this came from the sponsors and 3 stout, loud happy grateful cheers wing their way to the bold companies that dug deep in to shrinking credit crunch budgets!

Also had not the speakers volunteered to stand up in front of a room of their peers and speak for an hour on something they feel so passionate about that they want to share it with others the conference would have been terribly boring, so lets toss our caps in the air and jump around like mad things shouting YO! for the speakers.

Brilliant organisation, brilliant sponsors, brilliant speakers do not the perfect conference make ... Imagine if the attendees had not turned up, we would all have been standing like eejits in an empty hotel with nothing to tweet about other than how nice the chips were with garlic mayo (they were!!). So WELL DONE all you attendees everyone involved above salute you with a virtual standing ovation!

Lastly the Venue, the Radisson on the Royal Mile in the Heart of Edinburgh. What can I say? They were the resin on the UKLUG bow and made the conference sing. Every member of staff responded with prompt efficiency and to any and all requests and most importantly did so with a smile. A+, Gold star, top of the class!

What I am saying in my usual overly wordy, gobshite way is UKLUG always has been and will continue to be more than the sum of it's parts. It is this synergy that throbs in this strange community of ours. It is a synergy that I have yet to find in any other organisation I have come across or participated in.

I am proud to have been a cog in the perfectly tuned performance conference that was UKLUG 2009, (I hope they invite me back to help next year). I am proud to be a member of the greater Notes community .. You guys rock! :-)

[PS Particularly the ones that came to Bill Buchan's and my session. You are very loud and very good at recognising squirrels (particularly Ben Poole). I hope we made sense occasionally between fighting with the projector. It seemed so much better when we sort of practised it]

[PPS. "The light through the window.." was from Rob Novak's suite as Paul Mooney pretended to be Kate Winslet on Titanic's Bow, 4 stories above the Royal Mile ... I have to add he was being stoutly held by Coatsie]

[PPSS. If you see Bill Malchisky play him some George Clinton Funk!)

[PPPSS. Don't let Julian Robichaux near Urinal Cakes!]

Saturday 3 October 2009

Disqus for Domi-No-Yes-Maybe