Friday, January 14, 2011

How To Prohibit View Access

Suppose you have a bizarre requirement where you want to hide all views from users and yet allow them access documents. Such as in a situation where you need to open up a document in the UI based on what keywords a user enters in an entry form, yet you do not want people to see any view in the database. Since you do not know which document to restrict to whom, Readers field will not serve the purpose here. So, what do you do? Ha! I see your eyes light up and scream, “Duh! Just create hidden views.” Intelligent! And, my dear reader, what do you do about the people smart enough to do a ‘Shift + Go To’ in the View menu, that will present them with a list of all hidden views to select from? Yay, Gotcha!

Don’t let this trouble you for too long – the solution is amazingly simple. We’ll just employ a reserved keyword in Notes to befuddle the smart user. Create a frameset with two frames. Name the right frame ‘NotesView’ (yes! That’s the trick!) and make the frame width 0 percent and set ‘Allow Resizing’ to No.

In database properties, set Launch Option as ‘Open designated Frameset’ and set that to the Frameset you just created. And we are done! Whichever way you try to open any view now, including ‘View > Go To’, it will open in the ‘NotesView’ frame, and since you have set the frame size to zero, you just won’t be able to see the view.  Nor will the smart user. How cool is that!

Tuesday, January 11, 2011

The Curious Case of Vanishing Data - Notes Document Locking Fail!

Today I checked my Facebook updates, and there were some 78 Farmville requests! With the prices of vegetables soaring as these are, farming’s got to be the next big thing. Onion prices have driven people crazy. Rumor has it that many housewives have pledged to their husbands an hour of silence every day for a month if they can get them onions. No kidding!

OK, enough of crying over cut onions and back to business. Here I am going to share with you a curious case where users reported that data went missing after they entered those in a particular Notes database. To make things worse, such cases were sporadic (making it difficult to pin-point any psycho serial killer) and the data were extremely important. So, enter the brave detective – Me, Moi, Myself!

Let me explain the scenario. (The actual names have been changed due to a very perceivable security threat and resemblance to any application or server in service or decommissioned is purely coincidental. Not that I give a heck, anyway.) Say, there is a Notes database called Matrix on a server named Reloaded, and its replica resides on its cluster server - Revolutions. There is a form Neo, with which the users create documents and continually add data to the existing documents. However, at times, and without any comprehensible reason, the data simply vanished from the documents! A considerable gloom and panic had settled among the users of Matrix. What was the reason, the motive? Was this a conspiracy? Were the aliens behind the data hijack?

My first suspect was simultaneous multiple edition. However, the form had a QueryModeChange event, which allowed only one person to edit the document at any time. So data getting lost due to multiple editions at same instant was not the answer. Sabotage was ruled out too. Only a few users had Editor right in the Matrix, and they knew better than to delete such important data. The needle of suspicion started moving towards Revolutions - the replica in the cluster sure had something to do with this? I tried recreating the crime scene - the error, without success. The replica in the cluster theory somehow just did not add up. What do I do now?

I did what any great and famous investigator would do to nail the guilty – I sat back, closed my eyes and thought long and hard about how to get through this month with my empty wallet the issue. And suddenly a spark! Yes, that’s it! Bull’s eye! A classic case of back-end and front-end not tying their loose ends and failing to make their ends meet!

Here is what was happening. Consider two users of Matrix – Tom and Harry (of Tom, Dick and Harry fame). One fine day, both decide to edit one particular Neo document. So both open that document on their respective screens (or UI’s, as you may like to call it). Tom, always the first to get anywhere, does a Ctrl+E immediately. Since nobody else is editing that document, QueryModeChange allows Tom to go into edit mode. And he furiously types in all the data that he so laboriously collected. But as Harry tried to edit the document, QueryModeChange tells him “Sorry dude, you’re a bit late!”

“What the heck!” says Harry and he leaves to grab a mug of coffee. However, he had kept the document open in his screen. By the time he returns, Tom is done with his work in that document, has closed the document and is whistling softly to a tune. Harry does a Ctrl+E in his already open document and voila! He is able to edit it now. But here lies the catch. The snap shot of the document that Harry has open in his screen does not have the changes done by Tom. So when he edits and saves the document, all the changes that Tom had made are gone - vanished into thin air!

With this theory, the error could be re-created as many times as one would like to. To solve this, the time the document was last modified was captured in QueryOpen of the form (Date1). This would give the last modified time of the document when Harry opens the document in the screen. In QueryModeChange, the last modified time of the document was looked up from the back-end using the document UNID (Date2). If Tom has modified the document since the time Harry opened it, Date1 will not be equal to Date2. With this simple check, Harry is advised that he needs to close the document and then open in again in order to edit it.

Hallelujah! Mystery solved. Guilty convicted and put behind bars. I flung my coat over my shoulders, grabbed my hat and walked out amidst thunderous applause and blinding camera flashes. Ha! Dark Comedy! Nothing happened. Life went back to normal. Nobody cared. It was BAU - Business As Usual. Sob! Sob!

Moral of the story – Just any Tom, Dick or Harry can mess up the Matrix big time, and it needs someone really smart and clever to put things back in order. And that however smart a person is, one cannot give full attention to work when the pockets are empty.

Sunday, January 9, 2011

That Guy In Yellow Notes...

Lotus Notes. It always comes across as an enigma to me. Some would die for it, and yet many would die to murder it. (Ha! Death, either way!) I have struggled to answer questions like “Dude, what exactly is this Lotus Notes?” and “What do you do in Lotus Notes”, and to hit the final nail in the coffin, “Um, er…does it pay well?” To the first two questions, I have devised an ingenious answer – “Lotus Notes is a database management system which can couple up as a collaboration tool for enterprise solutions, and I design those collaboration systems using the Notes Designer!” Thunder! Lightening! Blackout! There you go, all you Java and SAP and Mainframe experts, go scratch your, um, head! For the last question, I stick to my million USD mysterious smile.

However, between you and me, I am yet to fully discern the answers myself. Notes and I are together more by chance than by choice. Fresh out of college and ignorant about the IT world, with all the bragging about AI programming, Genetic Algorithms and Data Structures in my CV, I was flung into this technology. Go figure! And with little training to speak of (I mean, I didn’t even know what workspace meant), I was assigned to a project. Baptism by fire, I say!

I figured I had to learn it on my own. Wasn’t easy, I tell you. I relied heavily (and I still do!) on the help files, various forums and Google. Newer challenges meant newer revelations, newer learning. Oftentimes I have wondered whether I ought to move to something considered cool. But Notes kind of stuck with me. And gradually, as I explored more and more, I realized that it isn’t a fraction as bad as it is often projected to be.

And in this regard, I feel that IBM has failed its own product. Notes, whether by design or by chance, has the potential to conveniently outrival other groupware solutions. Security is essential to any IT solution, and Notes has a security infrastructure to die for. It has the power to design the coolest applications. And yet, it is losing out in market. Mostly because IBM has failed to market it well enough as something beyond just email and sametime. And partly because we, and by we I mean you and I, the gentle, uncared-for, politely-pushed-aside-to-the-sidelines Lotus Notes programmers, have seldom had the opportunity of getting good trainings, have always lacked organized learning materials and thus have not been able to realize the full potential of Notes.

How many times have we heard the same old convenient excuse for poor performance of a Notes application, “because it is Notes!” But perhaps, we, the programmers, have overlooked the important aspect of fine tuning the applications that we design. Perhaps we are not aware of some fine but obscure nuances of Notes, or have not come across some ingenious workarounds to certain limitations. How many times have we been asked to teach someone Notes in two days, because “there is nothing much in Notes, and you don’t need more than that to learn this stuff!” And, as you would have continually experienced, this two-day learning and poor performance are often inter-related.

So, here I come, sent by the Almighty to save you all (computer error), I have come up with this blog space which I hope can be the meeting ground for the Lotus Notes programmers, where you and I can share our experiences, trivialities, ideas, successes, frustrations and just about anything without having to care about being formal and professional, and let’s just have some fun with it. I shall try to share the interesting challenges that I face as I work in my small and crowded cube. And invite you all to share your own, as knowledge increases when shared. Perhaps, as we help each other to learn and explore, we may end up a united voice to demand our fair share of respect in the software world, lest we be pushed to ignominy.