Jan
26
Posted on 26-01-2006
Filed Under (Site updates, Wordpress) by Johan Känngård

I’ve been using the Google Analytics plugin, created by Matt Labrum, a while, but it registers also every page view by me. That will give the wrong statistics, and I don’t want that. So, I modified the 0.3 version of the plugin into my own. This is the modified version, which can be set up to hide the Google Analytics code for user levels above a certain threshold. I also added Analytics for outgoing comment author URLs.
Rename the file below and put in your Wordpress 2.0 plugin directory:

(0) Comments    Read More   
Jan
24
Posted on 24-01-2006
Filed Under (Site updates) by Johan Känngård

No problems encountered so far when upgrading from Wordpress 1.5 to 2.0. I love the new admin theme! It makes better use of the screen in “Write Post”! The WYSIWYG editor is quite nice when creating simple posts. It seems like all installed plugins works too!

(4) Comments    Read More   
Jan
24
Posted on 24-01-2006
Filed Under (Java) by Johan Känngård

Goodies like explode, leftback, rightback, switchcase, implode, middle, trim, unique etc. can be found in this utility class.

The Commons Lang project at Apache Jakarta also has some really great stuff.

Chad Schelfhout gave me a correction for the implode(Object[], String):String method and the new method word(String, String, int):String.

(2) Comments    Read More   
Jan
21
Posted on 21-01-2006
Filed Under (Open Source, Tools, Windows) by Johan Känngård

Mozilla Firefox 1.5.0.1 About Dialog

I got it via the automatic update system, but it doesn’t mention it on the official website. I found a release candidate of 1.5.0.1 on the FTP site though. Strange…

Not so strange after all, it’s all explained in the “What the heck is with this 1.5.0.1 update?” article at developer.mozilla.org.

(1) Comment    Read More   
Jan
19
Posted on 19-01-2006
Filed Under (Domino/Notes) by Johan Känngård

When reading through the Troubleshooting Lotus Domino hangs and crashes, i found some new (for me) interesting commands:

  • show memory dump - dumps memory info to disk
  • tell http debug thread on - writes extensive debug information to disk on every request
(0) Comments    Read More   
Jan
17
Posted on 17-01-2006
Filed Under (LotusScript, XML) by Johan Känngård

I am not Microsoft’s biggest fan, since I was a Macintosh fanatic in the old days, but had to convert into the Wintel platform for about 10 years ago. :-) But I have to admit though, when comparing Microsoft’s XML parser with the ones that are built into Notes/Domino, that their products sometimes are great!
When comparing Microsoft’s XML parser with the other two, I created an agent that parsed a big (over 700 KB) and complex XML document and read an element’s value. I did this 25 times per parser, and came up with this interesting result (average execution time per parser) when executed in the Notes client:

  1. Microsoft XML Parser: 0.2 seconds
  2. NotesSAXParser: 2.2 seconds
  3. NotesDOMParser: 2.5 seconds

When executed on a Domino server, the result was a bit different, since the server is a bit old:

  1. Microsoft XML Parser: 1.0 seconds
  2. NotesSAXParser: 5.0 seconds
  3. NotesDOMParser: 7.7 seconds
(5) Comments    Read More   
Jan
17
Posted on 17-01-2006
Filed Under (Site updates) by Johan Känngård

You might have noticed that none of the kanngard.net sites is working. That is because I have moved the server from my earlier “ISP” - thanks Ove for your bandwidth and power :-) - but the primary DNS entry has not yet been updated. In the meantime, if you wish to access those site, you have to alter your windows\system32\drivers\etc\hosts file and add for instance the following entries to access my sites:


85.11.47.181    johan.kanngard.net
85.11.47.181    dev.kanngard.net

Keep in mind that the workaround above doesn’t work with all proxies.

You could also use Internet Archive to see snapshots:

Note: all mails are transferred correctly, since I have the new IP in the DNS as ns1.kanngard.net…

(0) Comments    Read More   
Jan
11
Posted on 11-01-2006
Filed Under (LotusScript, XML) by Johan Känngård

In my earlier post today, I described a problem I have, where I wanted to get the XML string of a DOM tree. I’ve started writing my own routine, this is what I have right now. It’s far from complete, since it can not handle namespaces, CDATA etc. yet:
This is a new version that handles siblings better, and not getting out of stack space :-)


Public Sub serializeNode(node As NotesDOMNode_
, outStream As NotesStream)
  On Error Goto catch
  
  If node.IsNull Then Exit Sub
  
  Dim currentNode As NotesDOMNode
  Set currentNode = node
  
  Do Until currentNode.isNull
    Select Case currentNode.nodeType
    Case DOMNODETYPE_DOCUMENT_NODE
    Case DOMNODETYPE_XMLDECL_NODE
      Dim xmlDecl As NotesDOMXMLDeclNode
      Set xmlDecl = currentNode
      Call outStream.WriteText("< ?xml version=""" _
+ xmlDecl.version + """ encoding=""" + xmldecl.encoding + """?>")
    Case DOMNODETYPE_ELEMENT_NODE
      Call outStream.writeText("< " + currentNode.nodeName + "")
      Dim nodeMap As NotesDOMNamedNodeMap
      Set nodeMap = currentNode.attributes
      Dim attribute As NotesDOMNode
      Dim i As Integer
      
      For i = 1 To nodeMap.numberOfEntries
        Set attribute = nodeMap.getItem(i)
        Call outStream.WriteText(" " + attribute.nodeName + "=")
        Call outStream.WriteText("""" + attribute.NodeValue + """")
      Next i
      Call outStream.writeText(">")
    Case DOMNODETYPE_TEXT_NODE
      Call outStream.writeText(currentNode.NodeValue)
    Case DOMNODETYPE_COMMENT_NODE
      Call outStream.writeText("<!--" _
+ currentNode.NodeValue + "-->")
    Case Else
      Error 2000, "Unhandled node type [" _
& currentNode.nodeType & "]"
    End Select
    
    Dim endWritten As Boolean
    
    If currentNode.hasChildNodes Then
      Call serializenode(currentNode.firstChild, outStream)
    End If
    
    If currentNode.NodeType = DOMNODETYPE_ELEMENT_NODE Then
      Call outStream.writeText("")
      endWritten = True
    End If
    
    Set currentNode = currentNode.nextSibling
  Loop
  
  If node.NodeType = DOMNODETYPE_ELEMENT_NODE _
And Not endWritten Then
    Call outStream.writeText("")
  End If
  Exit Sub
catch:
  Error Err, Err & Lsi_Info(2) & ":" & Erl & "|" & Error
End Sub

(2) Comments    Read More   
Jan
11
Posted on 11-01-2006
Filed Under (LotusScript, XML) by Johan Känngård

I have a problem, that nor I nor any of my colleagues can’t solve easily. I have several classes that are passing objects/variables between them. On of them is handling Web Service request, and parsing the responses to a NotesDOMDocumentNode via the NotesDOMParser. The NotesDOMDocumentNode is passed returned, and are used in several places to extract information. But, I need to cache the response, so concurrent request with the same parameters are sped up.
To cache the response, I need to serialize the NotesDOMDocumentNode. At first, I thought this was easy, since there is a Serialize method on the NotesDOMParser. But no… You have to keep the original NotesDOMParser that parsed the raw XML data. The only solutions I can figure out are:

  • pass both the NotesDOMDocumentNode AND the original NotesDOMParser at all times
  • write my own Serialize method
  • pass the XML string only, and do the parsing at each method. I think this would be really slow…

To further illustrate what I want, here is an example:


Public Sub testDOMParser()
  Dim parser As NotesDOMParser
  Dim inStream As NotesStream
  Dim node As NotesDOMDocumentNode
  Set inStream = session.createStream()
  Call inStream.open("c:\temp\test.xml")
  Set parser = session.createDOMParser(inStream)
  Call parser.process()
  Set node = parser.document
  Call serializeDocument(node)
End Sub
Public Sub serializeDocument(node As NotesDOMDocumentNode)
  ' Here, I want to do something like this:
  Dim outStream As NotesStream
  Dim parser As NotesDOMParser
  Set outStream = session.createStream()
  Set parser = session.createDOMParser(node, outStream)
  parser.exitOnFirstFatalError = True
  Call parser.serialize()
  Print "Serialized tree: " + outStream.readText()
End Sub

Anyone who have had any experience with this and are willing to share their thoughts? We are talking R6 here…

(5) Comments    Read More   
Jan
11
Posted on 11-01-2006
Filed Under (PC Modding) by Johan Känngård

Inside my home PC

A shot of my home PC with comments after I modified it.

(2) Comments    Read More