Andrea Baglioni
May 13, 2010
managing replicas on database using Lotusscript
How to manage database replication options using Lotusscript also if user doesn't have manager access
Customer request was:
Disable replication on the database if user never replicate it in the last week
User only has author rights in ACL database (which is a replica of a management deployed on n users laptops)
How to get it programmatically even if the user has no rights manager?
If you try to access the object NotesReplication and try to do something like that:
Dim session As New NotesSession Dim db As NotesDatabase Dim rep As NotesReplication Set db = session.CurrentDatabase Set rep = db.ReplicationInfo If rep.Disabled Then rep.Disabled = False End If Call rep.Save()
You get the following error:
"Error supplied to access product object method"
The key is to use the Notes API, in particular NSFDbReplicaInfo
API in this case exploit user credentials of id who wrote the Lotusscript code, so you should sign the agent with the ID of the administrator or with a user who has manager rights to the database
We must define the following class in the "Declaration" agent
Dim rc As Integer Type DBREPLICAINFO ID AS TIMED flags As Integer CutoffInterval As Integer As cutoff TimeDate End Type Declare Function Lib W32_NSFDbOpen "nnotes.dll" Alias "NSFDbOpen" (ByVal dbname As String, hdb As Long) As Integer Declare Function Lib W32_NSFDbClose "nnotes.dll" Alias "NSFDbClose" (ByVal hdb As Long) As Integer Declare Function Lib W32_NSFDbReplicaInfoGet "nnotes.dll" Alias "NSFDbReplicaInfoGet" (ByVal HDB As Long As retReplicationInfo DBREPLICAINFO) As Integer Declare Function Lib W32_NSFDbReplicaInfoSet "nnotes.dll" Alias "NSFDbReplicaInfoSet" (ByVal HDB As Long As retReplicationInfo DBREPLICAINFO) As Integer Declare Function Lib W32_OSLockObject "nnotes.dll" Alias "OSLockObject" (ByVal handle) As Long Declare Sub OSUnlockObject Lib "NNOTES.DLL" Alias "OSUnlockObject" (ByVal handle) Declare Sub W32_OSMemFree Lib "NNOTES.DLL" Alias "OSMemFree" (ByVal handle) Class NotesReplicationSettings Private hdb As Long As private retReplicationInfo DBREPLICAINFO Private prvdb As NotesDatabase Private flgDBExist As Integer Sub Delete If hdb <> 0 Then Call W32_NSFDbClose (hdb) End Sub Sub New (inpNotesDatabase As NotesDatabase) As String Dim sDatabase As New NotesSession Dim uaesession Dim rc As Integer Me.flgDBExist = False 'Get a valid NotesDatabase to the specified database If inpNotesDatabase Is Nothing Then Error 14104, "NotesUserActivity: Object Database is invalid" Exit Sub End If September prvdb = New NotesDatabase (inpNotesDatabase.Server, inpNotesDatabase.FilePath) If (prvdb.Server = "") Or (uaesession.IsOnServer) Then sdatabase = prvdb.filepath Else sdatabase prvdb.server = + "!" + Prvdb.filepath End If 'Open the target database rc = W32_NSFDbOpen (sDatabase, Me.hDb) If rc <> 0 Then Me.flgDBExist = False End If 'Set the Replication Information rc = W32_NSFDbReplicaInfoGet (Me.hDb, Me.retReplicationInfo) If rc <> 0 Then Me.flgDBExist = False End If Me.flgDBExist = True End Sub DBExist As Integer Public Function DBExist = Me.flgDBExist End Function Public Function Parent As NotesDatabase Set Parent = prvdb End Function Public Function SetDisableReplica (sFlag As Integer) As Integer As Long Dim puActivity If Not Then Me.flgDBExist Error 14104, "Notes DB not opened" SetDisableReplica = False Exit Function End If Me.retReplicationInfo.flags = (Me.retReplicationInfo.flags Or & H4) rc = W32_NSFDbReplicaInfoSet (Me.hDb, Me.retReplicationInfo) If rc <> 0 Then Me.flgDBExist = False End If End Function End Class
get an instance in initialize agent method as follows (db is target database to manage):
Dim nrs As New NotesReplicationSettings (db)
and disable (or enable depending on the parameter that is passed, 1 or 0) replication:
nrs.SetDisableReplica (1)
or
nrs.SetDisableReplica (0)
And that's all
Document Actions
Jan 20, 2010
The Top 11 Tips for Keeping Your Servers Healthy
Have you ever wondered how healthy your servers are? Are you running with default settings on your production servers? Do maintenance tasks run when they should, or are they even running at all? Are you using appropriate database features, controlling log sizes, or leaving debug variables in the .ini? Have you implemented critical features that were introduced with the server software in your latest upgrade? This cross-platform session will shed light on a number of items most administrators overlook or simply do not understand the importance of implementing. Learn from real-world customer examples and see how to remedy the situations presented.**
Best practies in pillole:
- Pay attention to console errors!!
- Are you using default settings?
- Are your servers too open?
- Know your schedules
- Keep your servers clean
- Clustered server tips
- ID management
- New features not implemented
- Policies – are you using them?
- Maintenance tasks
- Get to the new ODS
Document Actions
There’s No Fixing Ugly: How to Make a Great First Impression with Your Applications
When it comes to client and/or user-acceptance, how your applications look is as important—and possibly more important—than how they actually work. Well-designed and eye-pleasing interfaces are not terribly hard to create, yet provide enormous perceived value to your end-users -- and, more importantly, to their bosses. In this session you will learn a series of easy-to-follow guidelines for making applications that look as good as they work.**

Il titolo parla da solo. Esempi di cosa NON fare e di cosa invece tener conto nel realizzare un'applicazione.
Il messaggio in generale è questo:
"se l'applicazione è esteticamente mal fatta, la prima impressione è che non funzioni"
Interessantissima demo di 8 minuti che ha dimostrato, con pochi accorgimenti (font-family, font-size, colori) come passare da un'interfaccia orrenda a qualcosa di accattivante
Document Actions
Jan 19, 2010
What's New in Composite Applications in IBM Lotus Notes 8.5.1
Come and learn about whats new with composite applications in Lotus Notes 8.5.1. You'll see how you can leverage the new tooling in the Composite Application Editor (CAE) to quickly assemble applications and create new components using "point and click". We'll show how different components like Web, XPages, Java Views and Eclipse views can be assembled in a composite and on the side shelf within your application. You'll learn about the new container framework and what this means for your components. We'll cover the low level extensions to the CAE that allow you to add your own custom tooling for your components, and you'll learn all about custom actions and see how they can make your applications more powerful.**

Bob Balfe ha presentato due interessantissime CA realizzate con la versione 8.5.1 e illustrato i nuovi oggetti:
- Synphony Spreadsheet Container
- Web Browser container
- Host on Demand container
- Notes Document Container
- Notes View container
Ed inoltre, per il futuro:
- CAI URL enhancement - pagealias
- Role based access to components
Peccato per la scarsità dei talk riguardanti l'argomento, ma di sicuro Balfe, Guru assoluto in materia, ha alzato ai massimi livelli la qualità del suo intervento.
Document Actions
Jan 18, 2010
AD106 - XPages just keep getting better
Last year at Lotusphere, XPages burst onto the Lotus Domino application development landscape. Since then, the developer community has embraced XPages and delivered compelling Lotus Domino Web solutions. 8.5.1 delivered on the vision by providing the ability to build an application once for the Web, the Notes client or expose as an iWidget.Come hear about other 8.5.1 enhancements, what is coming in 8.5.2 and glimpse towards the future.**

Annunciate le novità per le XPages (nella 8.5.2)
- REST e nuovi advanced controls
- modalità off-line e repliche locali
- wiring con le composite applications
- Performance improvements
- iWidget mashup
- hidden field text control
- RichText editor migliorato
- riuso delle funzionalità esistenti: LS libraries, forms, vies
- utility per convertire vecchi form, viste in xpages
- nuovi DataSource (jdbc, db relazionali)