Wednesday 27 June 2007

Web Views Using AJAX part 7 (The Header)




Right a spot more work done.. the header is now returned and displayed by the agent and corresponding JS. The font details are returned by the agent but the general look of the header section is defined by a skin CSS file. Click on the image above to see it bigger...When you change the view in the designer the columns and font characteristics change when the web view is refreshed.
One small blip that took me a minute to work out was how to convert Point Size and Number of characters into Pixel width for the columns because notesview's column objects hold the width as number of characters. Happily a misspent youth writing PS routines was not in vain.A good approximation for proportional fonts is (PontSize*1.3333333)*Num of Characters this is not an exact pixel width but comes pretty close.

All a page needs now are :-
01. the 4 JS files in the JS HEADER
02. An IDed target HTML element to put the view in
03. A call to the load JS function. (in the example file) it is on the page load event
04. A CSS file to hold the skin info. This is dynamically added in the JS rather than embedded in the form/page

The call in 03 above is as follows
VR_getView((nsf),(view),(target),(skin),(rows),(debug))

If "*" is passed to the current NSF is used
If "*" is passed to the supplied VR_view.css is used.
If "*" is passed to 200 data rows are returned
If "Y" is passed to the view details are returned rather than the view itself
If "N" is passed to the view itself is displayed on the web page/form

The example file as it is now can be downloaded here

Sunday 24 June 2007

Just to prove we geeks are not just geeks here is a picture that I have just finished painting.

Art is good for the soul and throwing paint at a canvas is damn cathartic ! :)
Perhaps we should at the next ILUG or Lotusphere have a LU art gallery? Just a thought

Thanks Captian and Mr Schwartz

Ye gods away for a week and two comments!!! Thanks to both the Bold Captain (same surname as me but a much smarter chap) and Richard Schwartz and here was me thinking I was taking to myself :)

Back Again!

Well back again after another trip away, this time to install a Notes server were once there was an Exchange server. I know it shouldn't (cos I am a dedicated system professional) but there is a guilty little part of me that goes "up ya billy boy" in the general direction of redmond.... he he he he

Sunday 17 June 2007

Web Views Using AJAX Part 6 The Agent


Right, after a week off I was back at the code-mill and have managed to get some data back from my sever in some semblance of what I want. Effectively an agent is called that returns the JS that will build the JS notesView object infrastructure (headers style etc)

I have written JS Debug routine that displays the returned data ... see the piccie above (click it for a better view). This data comes from the successfully created JS notesView Object. The code of which was returned from the agent

The NSF so far can be downloaded here
Just download it , sign it, sign it again, pop it on a V6 or better server and goto
http:///viewr.nsf/page1.html

The Page has the YAHOO JS libraries embedded required to do an AJAX connection. I wont
go into the detail here as YAHOO provide excellent help text to the API. But it is easy and if you need some guidance let me know.

Expect an update tomorrow where the headers are actually built on the web page from the JS object that is returned from the VR_VIEW agent.

Tinariwen Listen to them now!

Disovered this Touareg group last year and have been waiting for the new CD for weeks.I was able to pick it up from those nice people @ virgin in Heathrow on the way to Munich.It was well worth the wait... I encourage you suspend any reservations you may have about World Music and have a listen on their myspace page

Not "usual" music but a truly amazing sound that just washes over you in waves leaving you wanting to live in the desert in a tent. :-)

Back in God's own wee sod

Ok I am back home after a week away in Germany and France bringing the new version V7.0.2 to my users. I know we can do this from the server however I had to go and do the .. "dont worry all the things you are used to are still there" speech to the assembled multitudes.

I must say I had two excellent taxi drivers ... both of home managed to navigate the chaos around both Munich and CDG in Paris and get me to the plane on time. 3 Cheers for professional taxi drivers!!!!

Saturday 9 June 2007

Web Views using AJAX Part 5 (JS Objects)


After due consideration I have plan for the JS object structure that will be returned by the agent when ViewR is invoked. click on the image above for the big picture..

Now here is a thing

3 (ironic) Cheers for the MLA minister for equality.. Mr I Paisley Jrn (yes son of BIG IAN) who with a ministerial portfolio for "equality" has said that homosexuals "repulse" him and that they "harm" society ... only in Ulster would we put up homophobe as a minister for equality and then wonder what the fuss is about when he effectively comes out and says that he doesn't like "poofs"!

Friday 8 June 2007

Favourite Heretical Quotes #1

"Faith is believing what you know ain't so." -Mark Twain

"Faith means not wanting to know what is true." -Nietzsche

"To believe is to know that one believes, and to know that one believes is no longer to believe." -Sartre

"If Stavrogin believes, he does not think he believes. If he does not believe, he does not think he does not believe." -Dostoevsky

"If your faith is opposed to experience, to human learning and investigation, it is not worth the breath used in giving it expression." -Edgar Watson Howe


"For while I am opposed to all orthodox creeds, I have a creed myself, and my creed is this. Happiness is the only good. The time to be happy is now. The place to be happy is here. The way to be happy is to make others so. This creed is somewhat short, but is long enough for this life; long enough for this world. If there is another world, when we get there we can make another creed. But this creed certainly will do for this life." Robert Ingersoll

"Sunday School: A prison where children do penance for the evil conscience of their parents." HL Mencken

"I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -Umberto Eco

and my personal favourite ...
"God is a comedian playing to an audience too afraid to laugh." -Voltaire


Conundrum #1

If a hole and a doughnut had a conversation about the difference between nothingness and emptiness what would they conclude?

More Heresy from the Evangelical Agnostic

Ho Hum, the weekend again so it is time for another EA rant.
The Title of this one is...
"dearly beloved god gave you a mind use it or your CHURCH will do your thinking for you".
oops no thats a sermon for another day.... when I am really neurked by the God-Botherers and Tooth Fairy-ites.

This rant was inspired by the fact that Pope "Bendydick" cannonised our first Irish Saint for a long long time. Blessed Charles of Mount Argus has been hanging around in the saints green room since he popped his saintly clogs (he was born Dutch) in 1893. He got his "Blessed" in 1988 by JPII and now he is the full monty, a REAL saint who can become in the fullness of time a "Patron"

I wonder what he will be the patron saint of .... carburettors perhaps or those strange "splorks" you get at BBQs... you know the thing half spoon half fork.. yes the patron saint of splork-use has a certain cachet. I wouldn't mind being the Patron Saint of Splork-Use.. or perhaps the Patron of non-offensive body odour ? Hmmmm

havent we enuff saints? No-one seems to know how many.. some say 10,000 others 3,000 but HEY you can never be too thin, too rich or have too many saints!

Web Views Using AJAX Part 4 (Getting Data)

OK... I have a plan for the look and feel of my ViewR application now all I need is a way to get data into it. I have had a look at the XML returned from &readdesign and &readviewentries I know XML is a wonderful thing and we should all LOVE it to bits. However I am unimpressed by the speed at which the XML is parsed both by the server and in the client. I had a brief look at the JSON return that you can get in V7 using &outputformat=JSON and while better it still does not bring in all the data I would like (also the format may be changing in V8*)

So I think I am going to write and agent that will allow me to get the data back as formatted JS object assignment strings and then run the eval() function to load it into memory. I don't know if this will be any faster I hope so. This will not be in "proper" JSON format but one of my own devising.

A read at the help shows that if I use a NotesViewNavigator i should get the data in the format I need. Mind you I am concerned about the way record positioning between server GETs will be handled. Say the last served nav entry is at the 3rd document of a category Position 2.1.3.
There are another 2 entries in this category (2.1.4 and 2.1.5). I think that the GET that will handle the next page should do one of the following
  • Indicate that not all the records for this category are being displayed
  • Skip back to the last cat start to keep the docs in the context of the view's cats
The second of these options is fine for small datasets but what of large datasets with potentially large (100+) documents in each discrete category. Hmmmmmmmmmmmmmmmm.....

Thursday 7 June 2007

Best laid Plans

Ho hum... a spot of googling and the nice chaps at EXTjs seem to have got there before me with an excellent lib of js that has been used to develop Domino/Ajax apps.

Have a look at the extjs.com website (link below) or visit Jack Radcliff's blog and have a read at what they are doing with an Ext.nd and Notes/Domino, very interesting stuff, but still no categorised views!

Web Views using AJAX part 3 (curvy corners)

I wanted to make my headers more exciting with curvy corners. Now this has always been a pain in the arse, getting all graphics-y with pictures for the corners. I don't want my corners to be that precise and I need to be able to "skin" them to different foreground and background colours without having to Adobe the *****ing pictures every time.

So I have come up with a JS applied style solution that will with a call to a function put curvy corners onto an IDed HTML element. The first past result looks like this.

I use any BLOCK type element to create this effect... in my case an
make it 1px high with a fontsize of 0.01em and a step down/up ammount of left and right border in the background colour.

to achieve this effect call the function SJ_curveCorner with the following parameters..
  1. The Target Element ID
  2. The foreground colour you need
  3. The background colour you need
  4. The Style you want ... A = all corners , T= Top corners only , B = Bottom corners only
The functions are quite small infact here they are .. feel free to use them in your own code

function SJ_curveCorner(oTarget,fColor,bColor,style)
{
var oElement = document.getElementById(oTarget);

innerHTML = oElement.innerHTML;
if (style=='A' || style=="T")
{
oElement.innerHTML =""
oElement.appendChild(SJ_buildLine(bColor,fColor,5));
oElement.appendChild(SJ_buildLine(bColor,fColor,3));
oElement.appendChild(SJ_buildLine(bColor,fColor,1));
oElement.appendChild(SJ_buildLine(bColor,fColor,1));
oElement.innerHTML = oElement.innerHTML+innerHTML;
}
if (style=="A" || style=="B")
{
oElement.appendChild(SJ_buildLine(bColor,fColor,1));
oElement.appendChild(SJ_buildLine(bColor,fColor,1));
oElement.appendChild(SJ_buildLine(bColor,fColor,3));
oElement.appendChild(SJ_buildLine(bColor,fColor,5));
}

}

and

function SJ_buildLine(fColor,bColor,nLen)
{
var aLine1= document.createElement("h")
aLine1.style.display='block';
aLine1.style.height = "1px";
aLine1.style.fontSize= "0.001em";
aLine1.style.borderLeft =nLen+"px solid "+fColor;
aLine1.style.borderRight=nLen+"px solid "+fColor;
aLine1.style.backgroundColor = bColor;
return aLine1;
}

Web Views using Ajax part 2 (CSS)

CSS
I realised early on that I would have some CSS content to load, however I did want to reduce the amount of things a developer would have to do add to a form or page to get this to work. So the CSS would have to be loaded by the javascript, but how to do this?

Simple, create the CSS Link statement as a DOM object

var lnk = document.createElement('link');
lnk.setAttribute('rel', 'stylesheet');
lnk.setAttribute('type', 'text/css');
lnk.setAttribute('href', 'mycss1.css');

and then use

document.getElementsByTagName('head')[0].appendChild(lnk)

to add the CSS file into the header section of the current document.

I had a fiddle with this method and it works!!!
I can programatically load a CSS file to style my views and have it change the view to the
correct style as needed.

More Later

Evangelical Agnostisism

Yes I am an agnostic and I am here to spread the good news of "not knowing"!

Basically I think of it like this, if you are a member of a "faith" based religion then you don't believe in 99.99999999999999% of the other available gods, goddesses and assorted tooth-fairies. Since I as an Evangelical Agnostic don't know whether any of them exist and I am willing to give them all the benefit of the doubt.Then you, if you are a member of a faith based religion, are considerably more of an atheist that I am.

I can go to bed happy.

Steve

Wednesday 6 June 2007

Web Views using AJAX Part 1

Several of the sessions @ ILUG 2007 were on the use of AJAX with Domino. I have been playing with AJAX for a couple of months and I was getting a bit lost up my own jaxie. However it all seems slightly clearer now so I have started experimenting and this is a record of the experiment!

Out of all the frameworks available DoJo, Prototype etc I choose the Yahoo UI for no other reason other than it seemed to have the best online help, (that and I liked the name).

For my example I worked out that i needed the Connection.js, Event.js and Yahoo.js script libraries. So these were pulled into my example NSF as Javascript Script Libraries.

I then created some test data ... (a form that stores information about books in my library) and a couple of views both categorised and flat. The the fun began...

I created a page that would hold my AJAX view(s) and then I started to plan ... my code would have to have :
  • minimal impact when adding web views to a page or form.
  • both FLAT and CATEGORISED view capabilities.
  • the strength to cope with large views (1000+ docs).
  • the capability to display multiple views on the same page or form.
  • the ability to "skin" each view with it's own style.
  • be able to read and interpret the notes design of the view for uniformity of experience.
I don't like long lists and this one was starting to scare me so I stopped there for a bit more
of a think

More from the code-mill later....
Steve

Blog - entry #1 !

OK here we go... 2 weeks post ILUG 2007 and I have been inspired by the other geeks who have Blogs so I thought I would have a go too.

I realize that this this not running on a Domino server AND it is not using one of the fine Blogging tools that are available, but that may take a wee while to get organized and to get this enterprise going Blogspot seemed the "best of the rest".

Hmmm how do I get Firefox to stop correcting my spelling in American...?

So given that I am new to this please bear with me, it will improve, like fine wine, with time.

Steve

Disqus for Domi-No-Yes-Maybe