SearchDomino.com July 30, 2001 Developer Tip ================================================= ------------------------------------------------- Sponsored By: ONLINE CORPORATE SOFTWARE ------------------------------------------------- *********** WIN AN IBM THINKPAD T21 ************* Online Corporate Software is giving away a brand new IBM Thinkpad T21. To enter the draw just visit our website and complete the trivia quiz. With over 35 open source code Lotus Notes applications and free online Notes technical support OCS is fast tracking Domino development. http://www.onlinecorporatesoftware.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ================================================= Feature Tip ================================================= Title: Fix a corrupt BUSITIME.NSF automatically This tip was submitted by Ulrich Krause, an independent consultant in Mettmann, Germany, and a searchDomino.com Dog Pounder. Option Public %REM Sometimes the busytime.nsf gets corrupt and you don't realize it before it's too late. It especially happens with R5 servers. This agent kills the corrupt database. A new busytime.nsf will be created when the scheduler task restarts. The code uses a few Notes API calls to send console commands to the server. Run as a scheduled agent %END REM '=============================================================== ' DECLARATION SECTION '=============================================================== Declare Function NSFRemoteConsole Lib "NNotes.dll" Alias "NSFRemoteConsole" (Byval Server As_ String, Byval cmd As String, ret As Long) As Long Declare Function OSLockObject Lib "NNotes.dll" Alias "OSLockObject" (Byval Handle) As String Declare Sub OSUnlockObject Lib "NNotes.dll" Alias "OSUnlockObject" (Byval Handle) Declare Sub OSMemFree Lib "NNotes.dll" Alias "OSMemFree" (Byval Handle) Const QUIT_SCHEDULER = "tell sched q" Const LOAD_SCHEDULER = "load sched" Const UNLOAD_CACHE = "dbcache flush" 'Replace the location of the busytime.nsf Const KILL_BUSYTIME_NSF = "c:notesnotesdatbusytime.nsf" 'Replace the value with your server's name Const SERVER = "YOUR_SERVER" Class remoteConsole Private IsError As Variant Private rc As Integer Private hBuffer As Long Private Server As String Private Command As String Private Result As String Sub New(inpServer As String) Dim server As New NotesSession If inpServer = "" Then Me.IsError = True Else Me.server=inpServer Me.IsError = False End If End Sub Function Execute(inpCommand As String) As String If Me.Server = "" Then Exit Function End If If inpCommand = "" Then Me.execute="You must specify a command" Me.iserror = True Exit Function Else Me.command = inpCommand End If Me.rc = NSFRemoteConsole(Me.server, Me.command, hBuffer) If Me.rc <> 0 Then Me.iserror = True Me.result= "ERROR" Else Me.result = OSLockObject(hBuffer) Call OSUnlockObject(hBuffer) Call OSMemFree(hBuffer) Me.Iserror = False End If Me.execute = Me.result End Function End Class '=============================================================== ' SUB INITIALIZE '=============================================================== Sub Initialize On Error Resume Next Dim exec As String Dim dummy As Variant Dim remConsole As New RemoteConsole ( SERVER ) dummy = remConsole.Execute ( QUIT_SCHEDULER ) dummy = remConsole.Execute ( UNLOAD_CACHE ) Sleep ( 10 ) Kill KILL_BUSYTIME_NSF dummy = remConsole.Execute ( LOAD_SCHEDULER ) End Sub http://searchdomino.techtarget.com/tip/1,289483,sid4_gci749687,00.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ================================================= Do you have a comment on this tip? Jump into our Developer Discussion forums and toss your ideas around with your peers: http://searchdomino.discussions.techtarget.com/WebX?50@@.ee7740b OR SEND US YOUR FEEDBACK TO BE POSTED ON THIS TIP TO: [EMAIL PROTECTED] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ================================================= NEWLY POSTED DEVELOPER TIPS: ================================================= We posted 11 new tips last week. Thanks for all your tips and keep them coming! Agent Category: http://searchdomino.techtarget.com/tipsIndex/0,289482,sid4_tax283834_alpD_idx0,00.html [1] Send a fax Domino Category: http://searchdomino.techtarget.com/tipsIndex/0,289482,sid4_tax283837_alpD_idx0,00.html [1] How to hide text when printing from the Web [2] Desktop.dsk display workspace pages and icons [3] Deletion of attachments only by admin group JavaScript Category: http://searchdomino.techtarget.com/tipsIndex/0,289482,sid4_tax283840_alpD_idx0,00.html [1] One-liner TRIM function [2] @Command({ViewRefreshFields}) functionality in Javascript Other Category: http://searchdomino.techtarget.com/tipsIndex/0,289482,sid4_tax283842_alpD_idx0,00.html [1] Send your self an ACL for any user on a given server [2] Forward as link [3] Execute code when a radio button or checkbox is selected Script Category: http://searchdomino.techtarget.com/tipsIndex/0,289482,sid4_tax283841_alpD_idx0,00.html [1] Forward mail including mail headers [2] IsUIDocSaved function [3] Script to verify employee's Notes version ================================================= FEATURED BOOK: ================================================= Notes and Domino R5 Developer's Guide to Building Applications By Matt Riggsby Notes and Domino provide the technology to solve pressing business problems. But you have to provide the know-how, and this book gives you just that--the hands-on knowledge you need to put the powerful features of R5 to work in effective, fine-tuned solutions that improve the way your organization shares information. http://www.digitalguru.com/dgstore/product.asp?sku=0782128246&dept%5Fid=288&ac%5Fid=60&accountnumber=&couponnumber= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ================================================= Disclaimer: These tips are submitted by your Domino peers. Our tips services and online tips exchange are a way for you to learn from other IT professionals and share technical advice and expertise with your peers. Techtarget.com provides the infrastructure to facilitate this sharing of information. However, we can't guarantee the accuracy and validity of the material submitted. You agree that your use of the searchDomino.com tips services and your reliance on any questions, answers, information or other materials received through searchDomino.com will be at your own risk. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ================================================= NOTIFY US WITH FEEDBACK ================================================= Send us your tips feedback! Cast your vote and send us your tips comments. If you have vital code information or other comments you'd like to add to one of our online tips, send your comments to [EMAIL PROTECTED], and we'll add your User Feedback to the online tip! ================================================= If you would like to sponsor this or any TechTarget newsletter, please contact Gabrielle DeRussy at [EMAIL PROTECTED] ================================================= If you no longer wish to receive this newsletter simply reply to this message with "REMOVE" in the subject line. Or, visit http://searchDomino.techtarget.com/register and adjust your subscriptions accordingly. If you choose to unsubscribe using our automated processing, you must send the "REMOVE" request from the email account to which this newsletter was delivered. Please allow 24 hours for your "REMOVE" request to be processed.
