HAPPY NEW YEAR!
2008 is here and I am confident it will be a very good year. My first post this year is no breaking news. Still good to know.
When creating web sites it always comes up browser specific issues where Internet explorer and Firefox don't render the code equally. So annoying... However using css and/or conditional statements in the html code it is possible to launch different html blocks depending on if the browser is Internet explorer or not.
The HTML will run if the browser is Internet explorer:<!--[If IE]>
HTML
<![endif]-->
The HTML will run if the browser is NOT Internet explorer:<!--[if !IE]>-->
HTML
<!--<![endif]-->
W3schools has an excellent css reference and this blog post explains and shows examples on conditional statements.
Technorati tags:
css, html, browser, Conditional statement
January 01, 2008
Conditional statements in html code
Posted by
Niklas Waller
at
3:20 PM
23
comments
December 17, 2007
Second Life References
Soon, Ekakan will make it public on our new virtual land and office in Second Life. We will be there in person as a company with some cool features and functions as well. Stay tuned!
This blog post will function as a references page for Second Life which, like the other reference pages for Lotus Notes/Domino and Java, is constantly updated.
General:
Articles:
- A virtual office: IBM Lotus Sametime chatting and Second Life
- Scripting Second Life with Rational Application Developer
- LSL-script for a Second Life football
Other:
Technorati tags:
Second Life, lsl, references, resources
Posted by
Niklas Waller
at
3:30 PM
1 comments
December 12, 2007
When "Recompile All LotusScript" returns an error
Recompiling all lotussript for a database returned an error today:
"<form name>: LotusScript Error - Syntax Error"
Good thing it did, but it would have been helpful knowing what was wrong. I got no hint at all other than the form name. So I looked at the modification date and by who a change was last made and tried to find the most probable change request. Still its not easy if the form is big with a lot of scripts tied to it.
I opened query save, removed a bunch of code and tried to save and there it was. The other day I had copied over a small table with some fields from another form and forgot about two buttons which were making calls to functions in a script library. This script library was not declared in Options with Use "scriptlib", but no error was raised when saving until now that is. I decided to copy the functions into another script library that was used in this form, modified them slightly and everything worked and went back to normal.
While searching for this on developerWorks I found another probable cause which might be good to know about. When defining a public class in Lotusscript named 'Picture' it can be saved without errors, but when running "Recompile All Lotusscript" the same error occurs.
Technorati tags:
Recompile All LotusScript, Domino, Lotus Notes
Posted by
Niklas Waller
at
2:01 PM
2
comments
December 06, 2007
Book recommendation for SCJP 5.0
It's time for a new book recommendation from me. In May earlier this year I recommended the book "Head First JAVA". I finished the book two months ago or so. The book stayed being excellent through the end and it's time for the next step in my mission to be a Java God ;-)
To really understand and remember everything I have combined my theoretical knowledge with practical work in the Domino environment as well as outside in Eclipse since experience is invaluable in the learning cycle. Of course I have oceans of information and experience to learn and teach but we all have to start somewhere.
So this mission must include a certification and therefore the natural choice for me had to be a preparation book for the certification test. I want to be a certified programmer for Java 5 so what would be better than reading a book named "Sun Certified Programmer for Java 5" with the same authors (Kathy Sierra and Bert Bates) as the previously recommended book? The book is really thick and is good exercize for my muscles carrying it around to and from work. Oh, and it is good reading as well. I have completed a chapter now and I am impressed as before. It has excellent coverage of all parts for the certification exam with tips and tricks, exercises and so on in a very structured way. It not only learns what to study but also how.
So go ahead and get this one if you want what I want. Read more on Google book search.
An interesting topic post from 2004 - Does Java certification matter?
Technorati tags:
Java, Sun Certified Programmer for Java 5, SCJP, Learn Java, Book recommendation
Posted by
Niklas Waller
at
2:12 PM
1 comments
December 01, 2007
Slow database performance
A database with slow performance can be caused by a lot of reasons. My last two cases were probably due to readers fields and deletion stubs.
If you have a slow view with a lot of documents in it, check if the documents have readers fields, it's a common cause and there are several suggested actions to take. If the user accessing the view only has access to a small part of all the documents it will render very slowly. A page (memory unit) will be read into memory consisting of approximately 300 documents. When scrolling down the view it will be recalculated. If you have access to all documents it will render pretty much as usual.
The other day I was troubleshooting a database which was slow to open with slow views. It had a view that it took about 2 minutes to open. The database had 50.000 documents and 129 views and this and several other views used readers fields so I figured that would be the problem.
I copied the database with all documents and accessed it with the same user and they behaved very differently. The same view that took about 2 minutes to open in the original database was opened in about 5 seconds in the copy. The only difference was the size of the database. The original was about 990MB and the copy started at 108MB.
So I figured that would be due to view indexes. An it probabaly were to some point but together with the view index it turned out that deletion stubs were part of it.
Five days a week, on each day, approximately 40.000 documents was deleted an new ones were created from an excel file (this was an old solution to update them). The purge interval was set to 120 days. So this means that there were about 40.000 * 88 (only weekdays) = 3.520.000 deletion stubs in the database. Since a deletion stub is about 100 bytes (at least it was in version 6) it means that the they used approximately 352MB of the space and the database consisted of a minimum of 352MB of deletion stubs although the count is more impressive.
The number of deletion stubs probably together with a corrupt view index caused the database to perform very slow. Fixup and Updall took a very long time as well and had to be aborted.
A copy of the database solved the problem but a long-term solution is of course to recode the agent to update the documents instead of replacing them and to make the purge interval more frequent.
Technorati tags:
Readers fields,Deletion stubs,Slow database performance, Domino, Lotus Notes
Posted by
Niklas Waller
at
1:42 PM
2
comments
October 31, 2007
Problem printing rich text fields
If you have a rich text field that contains a fair amount of information it will print nicely, but when it exceeds a certain amount of information each text paragraph will be printed on a separate page which causes a printout that normally would be of two pages to turn up on 40-50 pages. Really annoying and a waste of trees!
The solution to this problem is to enclose the rich text field in a table which compresses the content in the rich text field and prints nicely.
While testing, look at the print preview which shows the same result as the actual printing.
Technorati tags:
Lotus Notes, Domino, Rich text, Richtext, Print
Posted by
Niklas Waller
at
8:10 AM
2
comments
October 23, 2007
Prevent pasting documents into a view
Short tip today!
If you want to prevent documents from being pasted into a view, click on section 'Querypaste' for the view and type Continue=False in the sub routine.
Technorati tags:
Lotus Notes, Domino, View, Paste documents
Posted by
Niklas Waller
at
3:41 PM
4
comments
October 18, 2007
Print selected documents and attachments from a view
I have been trying to figure out how to print a document and its attachments when marking it in a view. A colleague had an agent which did the works as long as the attachments only are word documents. But if you don't know if it is a word, pdf, rtf, jpg or any other attachment the code gets long, uggly and still you proabably haven't covered all possible cases. I have however found a solution thanx to Charles Robinson who shows how to shell a windows application to open the attachments.
I have used my existing code with this one and the result is an agent that can run on selected documents in a view, print the documents and each document's attachments. It is run through a view action.
The code is not ultimate at all and there are still some minor problems left like when no application gets associated with the attached file nothing is printed out and that acrobat reader doesn't close when done. Probably fixable, but I am satisfied for now.
As you can see below I have used a sleep command. This might have to be adjusted depending on many different things, but it is needed or else the documents and attachments competes who gets to the printer first and everything is unsorted.
Here's the code. Hope someone can enjoy it!
In Options add Uselsx "*lsxlc"
In Declarations add Charles Robinsons code:
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SEE_MASK_FLAG_NO_UI = &H400
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Declare Function ShellExecuteEx Lib "shell32.dll"_
Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long
Declare Function TerminateProcess Lib "kernel32"_
Alias "TerminateProcess" (Byval hProcess As Long, Byval uExitCode As Long) As Long
In Initialize add the following code:
On Error Goto ErrorHandler
Dim SEI As SHELLEXECUTEINFO
SEI.cbSize = Len(SEI)
SEI.fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_NO_UI
SEI.lpVerb = "print"
SEI.nShow = 1
SEI.hInstApp = 0
SEI.lpIDList = 0
Dim s As New NotesSession
Dim session As New LCSession
Dim db As NotesDatabase
Dim object As NotesEmbeddedObject
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim downloadfolder As String
Dim extrachar As String
Dim filecounter As Integer
Dim filecount As Integer
Dim filen As Variant
Dim antalfiler As Variant
Dim i As Integer, x As Integer, y As Integer
Dim sFile As String
Dim uidoc As NotesUIDocument
Dim ws As New NotesUIWorkspace
Dim success As Variant
' Create a folder for temporary storage of files
downloadfolder = Environ("tmp")
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
For i = 1 To dc.Count
Set doc = dc.GetNthDocument( i )
' Print document
Set uidoc = ws.EditDocument( False , doc , True , )
Call uidoc.Print(1)
' Get all attachments and print them
filen=Evaluate("@AttachmentNames",doc)
antalfiler=Evaluate("@Attachments", doc)
Call uidoc.Close
Delete uidoc
If antalfiler(0)>0 Then
For filecounter=0 To antalfiler(0)-1
x=x+1
Set Object = doc.GetAttachment( filen(filecounter) )
If ( object.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
If Dir(downloadfolder+"\"+ filen(filecounter))="" Then
extrachar=""
Else
' Extra character in case there are attachments with the same name
extrachar=Left(doc.universalid,4)+"___"
End If
Call object.ExtractFile (downloadfolder+"\"+extrachar+ filen(filecounter) )
End If
Next filecounter
End If
For y = 0 To filecounter-1
sFile = downloadfolder+"\"+extrachar+ filen(y)
SEI.lpFile = sFile
Call ShellExecuteEx(SEI)
Call session.Sleep(2000)
Next
' Delete all files
Call session.Sleep(5000)
For y = 0 To filecounter-1
sFile = downloadfolder+"\"+extrachar+ filen(y)
Kill sFile
Next
'Call TerminateProcess(SEI.hProcess, 0)
Next
Exit Sub
ErrorHandler:
msgbox Error$ & " on line " & Cstr(Erl) & " in " & Lsi_info(12)
Exit Sub
Technorati tags:
Lotus Notes, Domino, Shell, Print attachments
Posted by
Niklas Waller
at
6:11 PM
1 comments
October 13, 2007
Java references
I decided to create a Java references page as well (see Lotus N/D references for Lotus Notes/Domino and Sametime references) for my own use and possibly for someone else as well. Feel free to leave comments if you have suggestions to other reference pages and I will update this page.
Below is some of what I have come across so far.
Tutorials/References/APIs/Examples:
- Reference documentation
- Java2 Platform Standard Edition 5.0 API Specification
- The Java Tutorials
- The Java Developers Almanac 1.4
Tools/plug-ins for Java conventions:
- Checkstyle
- Checkstyle plug-in for eclipse
- Mobilefish Checkstyle configuration file
- Jalopy - Source code formatter
- SCJP FAQ
- SCJP Tiger Study Guide
- JavaBlackBelt - Java Certification Community
- JavaBeat - SCJP Mock exams
- eXamulator
- SCJP 5.0 preparation article
- nsf tools - Java Tips
- Using Lotus Notes with Eclipse to manage and run your Java programs
- Lotus Notes and Java
- Domino Javadoc Generator
Eclipse:
- Eclipse
- Eclipse Plugin Central
- Plugin: LotusScript Editor for Eclipse
- 10 Eclipse Navigation Shortcuts Every Java Programmer Should Know
Other:
Technorati tags:
Java, References, Code convention, Development, Certification, Notes and Java
Posted by
Niklas Waller
at
7:48 AM
0
comments
October 12, 2007
Conventions for Java code
I like the structure with Java. Although you can create structure with any language it somehow feels as it comes with Java, so it feels easier to accomplish and is kind of satisfying (in a really geeky way). So included in my personal project to be a kick-ass java developer (;-) I am also aiming towards writing nice, readable code that is based on predefined code conventions and guidelines both for the programming part but also for commenting.
You might have heard that really good written code doesn't need commenting. Maybe that's a bit exaggerated but in some sense true. If all variables, methods, classes and so on are named after specific conventions they will be more readable to you and other programmers that might inherit your code some day.
Take a look at the conventions for coding and commenting here:
- Code conventions for the Java Programming Language
- Java Programming Style Guidelines (another format of the above)
- How to write doc comments for the JavaDoc Tool
Technorati tags:
Java, Code convention, JavaDoc, naming, Programming Style Guidelines
Posted by
Niklas Waller
at
8:50 AM
4
comments
October 11, 2007
XHTML Character Entity Reference
For all of the web developers out there. Here's an Ajax-based structured reference tool for XHTML Character entities. It lists the allowed entities in HTML 4 and XHTML 1.0 as outlined by W3C.
Seems like it could be of good use at occasions!
Technorati tags:
Reference, Character entity, XHTML
Posted by
Niklas Waller
at
7:20 AM
0
comments
October 03, 2007
Get started with Dojo
Did you know that you could do this on any web page and fairly quickly? All you need to do is to access some javascript source files and add your own pictures. I might add the fisheye example to this blog later when I have more time.
With Dojo someone else has done the work for you to use for free and it works in any browser (or at least the most common ones).
I am currently looking into dojo and playing with it and I really like the way it's heading. An API (0.4.2) already exists much like Java's although they can't really be compared since the documentation certainly could be better with examples and references and it takes quite a lot of time to understand what to do with the objects if you're new to the toolkit. A really good thing is that you, as in Java, can choose what to include in your webpage. That is you don't have to import the entire library but only for example the widget functionality (dojo.widget.*).
Follow the link to dojo below to get started with several good tutorials and examples. But just to mention it, all you need to do is to download a zip-file and extract it to your file system. Then create a html-file, include dojo javascript source files and you're up and running.
Further on, and this is really interesting, there is a rumour that says that Dojo will be installed by default on the next version of Domino. Now if that's going to happen or not, I don't know, but it certainly gives me another reason to start looking at this.
If anyone knows any other good references or examples that you recommend please leave a comment.
- Dojo
- The Dojo Project's JotSpot wiki
- Alpha API (for Dojo 0.9)
- Dojomino: Info and tutorials for using Dojo with Domino
- The Dojo book, 0.9
- The Lotus Quickr templates contains a lot of dojo code I've been told.
Technorati tags:
dojo, JavaScript, Toolkit, Lotus Quickr
Posted by
Niklas Waller
at
11:50 AM
2
comments
September 27, 2007
4n0th3r gr8 g33k d8
Well, I had no doubt about if this was going to be a good one or not, but just to be clear, it was!
This tuesday we had our second g33k date and approximately 30 developers, both customers and partners and actually an IBM:er ;-) showed up to listen to Viktor Krantz and Troy Reimer from Snapps talking about Quickr, dojo, JSON and other stuff. They showed us demos and really good code examples as well.
I have been looking more into the dojo toolkit that Viktor brought up during their presentation and it really fascinates me. It is SO easy to do cool stuff (depending on what you want to do and your level of skills of course). I can't believe I have avoided it before (not intentially though). Viktor explained to us about the pros of dojo and that it most likely will be part of next release of Domino as well, which makes it even more interesting.
Troy seems to be the king of coding structure and commenting just to mention something. A closer look at a lotusscript agent he made was a beautiful sight and I have learned a lot from that too. Thank's a lot guys for a great evening!
Besides this excellent show, we all had the privilege to meet each other and discuss those geeky things we like so much. Can't wait for next time!
Just before and in the beginning of the meeting I got a chance to very shortly show Ekakan's office that I have built in Second Life. I explained a little about what second life is, the purpose, how to build stuff, scripting and business ideas and I hope I am not the only one seeing the opportunities that lies here.
If you are interested in more info about Viktor and Troy, I described that in a recent post that you can read more about here.
And as a last thing I recorded a little piece of video where Viktor talks about Dojo. It's of a horrible quality but you can at least probably here something.
Technorati tags:
G33k, Lotus Notes, Domino, Dojo, Quickr, Snapps, Second Life
Posted by
Niklas Waller
at
9:27 AM
0
comments
September 10, 2007
New ODS for Domino 8
The ODS (On Disk Structure) has changed for Domino from ODS 43 to ODS 48. It is not turned on by default though. Add this new notes.ini parameter to either the Domino server or the client and every new application you create will be with the new ODS version:
Create_R8_Databases=1
Upgrade existing databases to ODS 48 by using the notes.ini parameter and perform a copy-style compact (Load Compact -c).
Read more on this technote and on Chris Whisonant's blog who also writes about design compression.
Vince Schuurman writes about compression problems which is caused by the fact that encryption is enabled by default in Domino 8 (which can be read in the comments by Chris Whisonant).
Technorati tags:
ODS, Lotus Notes, Domino, Design Compression
Posted by
Niklas Waller
at
8:00 AM
0
comments
August 30, 2007
September G33K
* UPDATE *
Date for september g33k has been changed to the 25th of september
In may 24th earlier this year the first g33k date took off for which the expectations were set high and which also ended up very successfully. Another g33k meeting has been planned for september 25th and you wouldn't want to miss it!!!
This time Viktor Krantz and Troy Reimer from Snapps (US) are keynote speakers and will talk about the relatively new product Quickr and other things I'm sure. Snapps is the official IBM Design Partner for Quickplace (Quickr) and has produced high-quality, free Quickplace and Quickr templates. For the interested you can find templates for Quickplace 7 here and Lotus Quickr 8 templates at QuickrTemplates.com. Snapps are also co-producers of Collaboration University and let's not forget to mention Rob Novak's and Viktor Krantz's very popular session 'The great code giveaway' which is held every year at Lotusphere.
This is a great opportunity to meet other developers working with Lotus Notes/Domino, Java, web etc. and I assure you it will be both instructive, fun and beerish in a comfortable mixture that especially g33ks like us appreciate ;-)
The time for the meeting is set to 06:00 PM and will be held in the center of Stockholm, Sweden also this time at Ekakan's premises. Check here for more details and the latest information.
Sign up here in a comment or send a mail if you would like to join us!
Technorati tags:
g33k, Lotus Notes, Domino, Java, Snapps
Posted by
Niklas Waller
at
6:39 PM
0
comments
August 29, 2007
Notes/Domino 8 preparation test are out
IBM Lotus Notes/Domino 8 certification preparation tests from CertFX are out:
- 190-801 IBM Lotus Notes Domino 8 Application Development Update
- 190-802 IBM Lotus Notes Domino 8 System Administration Update
Technorati tags:
Lotus Notes, Domino, Certification, certFX
Posted by
Niklas Waller
at
11:10 AM
4
comments
August 27, 2007
Java 5 in Notes 8
Java 5 (Tiger) is included in Notes 8. N/D 8 is backwards compatible though and defaults to earlier API. To make use of the new Java API when writing source code directly in the Notes client some adjustments are needed.
Add the following line to Notes.ini and restart notes:
javaCompilerTarget=1.5
Got this tip from Mikkel Heisterberg on lekkimworld.com.
Technorati tags:
Tiger, Lotus Notes, Domino, Java
Posted by
Niklas Waller
at
1:21 PM
1 comments
August 20, 2007
August 16, 2007
Developing Java for Domino in Eclipse
I try to develop all agents and script libraries in Java rather than lotusscript nowadays. The notes java (from the lotus.domino library) covers many of the functions that lotusscript offers and besides that you have the whole Java library itself which many times makes it more powerful than lotusscript.
The notes client is not the best Java editor though. The type ahead functionality is not there as it is for lotusscript and the lack of color coding makes the code a bit difficult to read. Once you have tried to develop Java using Eclipse you get spoiled and it really is a great thing to be able to develop java applications (like agents and script libraries) for Domino in the Eclipse client.
Here's how to do it:
- Assuming you have a functional Eclipse client, create a new project (for example 'Notes Java') and open the properties for that project.
- Click on 'Java Build Path'
- Click on tab 'Libraries' and press button 'Add External JARs'
- Find 'Notes.jar' and click on open to add the special notes java classes to the build path, which makes it possible to use them in the Eclipse client. (I have the notes 7 client installed and the path was 'C:\Program\lotus\notes\jvm\lib\ext\Notes.jar')
- Create a package in the project and under the package create a class called for example 'JavaAgent'.
- Change 'Superclass' to 'lotus.domino.AgentBase'.
- Now start writing Java code in the Eclipse client as you normally would in the notes client. Copy and paste the skeleton code that always comes with a new java agent. Here's a test agent that uses a notes view to loop through all documents and prints a field value for each document.
package com.ekakan.NotesJava.agents;
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDatabase();
View view = db.getView("actions");
Document doc = view.getFirstDocument();
while (doc != null) {
if (doc.isValid()) {
System.out.println(doc.getItemValueString("action"));
}
doc = view.getNextDocument(doc);
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
- To run the code, first compile it in the Eclipse client to create a class-file, i.e. 'JavaAgent.class'.
- Import the class file to a new notes agent using the 'Imported Java' option.
- Save and use in what way you would like to. Whenever a change is made to the java file in the eclipse client the class file has to be imported into the notes client again of course.
- Another option instead of importing the class file is simply to copy and paste the code from eclipse to notes.
One thing that you might come across when trying to run the agent in the notes client is an unpleasant error message on the Java console saying something like this:
java.lang.UnsupportedClassVersionError: Unsupported major.minor version 49.0
This means that the JDK used to compile with is of a newer version than the version that the application is running against. Which in this case means that your Eclipse proabably uses version 5.0 or 6.0 while Notes uses 1.4. Check on the Domino console for the JVM version running using the command 'Show JVM'.
In Eclipse, open the properties for the project and click on 'Java Compiler'. In the JDK section, set the correct compiler compliance level, in this case 1.4.
Technorati tags:
Java, Domino, Lotus Notes, Eclipse
Posted by
Niklas Waller
at
9:36 PM
1 comments
August 14, 2007
Gmail Toolbox
Mashable has listed the Gmail toolbox with over 60 tools for your Gmail.
A must for Google lovers!
Technorati tags:
Gmail, Toolbox, Google
Posted by
Niklas Waller
at
11:59 AM
5
comments


