Feb
24
Posted on 24-02-2006
Filed Under (Domino/Notes) by Johan Känngård

Den 8 mars kommer Lotusphere till Sverige! Närmare bestämt till IBMOddegatan i Kista. Ed Brill kommer att medverka som talare. Själv har jag redan anmält mig, det kan du också göra!

(3) Comments    Read More   
Feb
15
Posted on 15-02-2006
Filed Under (JavaScript) by Johan Känngård

When developing web applications, select-boxes are usually involved in the UI. I’ve put together a custom JavaScript class to handle things like removing, adding and selecting elements. By the way, Matt Kruse has a bunch of nice JavaScript libraries!

Example:


var e=new DynamicSelect('MySelect');
e.removeAll();
e.append('Entry 1','');
e.append('Entry 2','');
e.selectAll();
e.unselectAll();
e.select('Entry 2');
e.toggleAll();
if(e.contains('Entry 1')){
  alert('We got Entry 1!');
}
if(e.indexOf('Entry 2'!=-1)){
  alert('We got Entry 2!');
}
e.insert('Entry 0','',0);
e.select('Entry 2');
e.removeSelected();
e.remove(0);
alert('Original HTML element name: '+e.parent().name);

The methods are documented in the source file, if you want to know more about them.

[tags]JavaScript[/tags]

(0) Comments    Read More   
Feb
15
Posted on 15-02-2006
Filed Under (Domino/Notes, JavaScript) by Johan Känngård

This has been done before. Here is my contribution:


/**
 * Replaces \\\"No Documents Found\\\" with a custom text.
 *
 * @author Johan Känngård, http://johankanngard.net
 * @param message the text to replace with
 *
 */
function replaceNoDocumentsFound(message){
  var h2=document.getElementsByTagName(\\\'h2\\\');
  if(h2!=\\\'undefined\\\'&&h2.length>0&&h2[0]!=\\\'undefined\\\') {
    var oldTextNode=h2[0].firstChild;
    var newTextNode=document.createTextNode(message);
    h2[0].replaceChild(newTextNode,oldTextNode);
  }
}

Put the function in the HTML Head (or in an imported JS-file) and call the function at the bottom at the page like this:


<script type=\"text/javascript\">
replaceNoDocumentsFound(\'Sorry, I could not find anything\');
</script>

The easiest way to hide the text is via a stylesheet like this:

<style type=\\\"text/css\\\">
H2 {display:none;}
</style>

…but you already knew that, huh?
[tags]JavaScript, DOM, Lotus Domino, CSS[/tags]

(0) Comments    Read More   
Feb
13
Posted on 13-02-2006
Filed Under (Life, Movie) by Johan Känngård


I’ve had my KiSS DP-558 for some time now, and haven’t used my VHS-recorder since! Recently, I began to get strange behaviours from it. Sometimes, the disk seemed to be full, though I had not anything recorded! Another problem was that every recording was put into subfolders with the same name as the recorded file.
After some searching on MPC Club, I found a firmware that enables http and telnet access to the player! It’s called Stage 2, was created by martinb and can be downloaded in the download section. You have to be a member to access it though.

After the upgrade, I ran the fsck command, and the problems I was having is now gone! Since the player has a Linux dialiect on it, it’s not a user friendly task to do the above, so make sure you read the HOWTO’s for more information.
[tags]DVD, CD, Video[/tags]

(1) Comment    Read More   
Feb
13
Posted on 13-02-2006
Filed Under (Domino/Notes, Java, XML) by Johan Känngård

Here is an example how to use the XMLEchoer class, that I have refurbished from Sun’s tutorial Echoing an XML File with the SAX Parser. It is of limited use, but can be a good start learning SAX.


import java.io.PrintWriter;
import lotus.domino.AgentBase;
import net.kanngard.xml.XMLEchoer;

public class JavaAgent extends AgentBase {

    public void NotesMain() {

        try {
            String xml = "<test>Hello World</test>";
            PrintWriter writer = getAgentOutput();
            writer.println("Content-type: text/xml");
            XMLEchoer echoer = new XMLEchoer(writer);
            echoer.start(xml);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

To get it working, you need a SAX implementation, like Apache Xerces 2. Just drop the JAR files from Xerces 2 into the jvm/lib/ext directory in your Notes or Domino installation. Restart the http task if you are testing with Domino.

[tags]Java, XML, SAX[/tags]

(0) Comments    Read More   
Feb
12
Posted on 12-02-2006
Filed Under (Life, Photographing) by Johan Känngård

Sun behind clouds

-5 degrees celsius and the sun shining, yesterday was a perfect day for a long walk! This time, we were at Norrviken for the first time. Following the western shore, we looked at the skaters and a “motor kit” that made the otherwise calm area a bit noisy. I took some pictures as usual.

(0) Comments    Read More   
Feb
09
Posted on 09-02-2006
Filed Under (Java) by Johan Känngård

Arguments in many methods in the Java APIs are of the type InputStream. This is how to get an InputStream from a String, where argument to getBytes, UTF-8, is the encoding to use:


InputStream is = new ByteArrayInputStream(myString.getBytes(\"UTF-8\"));

[tags]Java[/tags]

(9) Comments    Read More   
Feb
09
Posted on 09-02-2006
Filed Under (Domino/Notes, Java) by Johan Känngård
1.0 to 3.x:
N/A
4.5 to 4.6.7a:
JRE/JDK 1.1
5.0 to 5.0.13a:
JRE/JDK 1.1.8
6.0 to 6.5.6:
JRE/JDK 1.3.1
7.0 to 7.0.3:
JRE/JDK 1.4.2
8.0 to 8.0.1:
JRE/JDK 1.5.0

IBM also has a list of supported JDKs and JREs.

Old JDK/SDK/JRE versions can be downloaded at java.sun.com.
[tags]Java, Lotus Domino, Lotus Notes[/tags]

(5) Comments    Read More   
Feb
06
Posted on 06-02-2006
Filed Under (Tools) by Johan Känngård

If you want to know what your public IP address is, it’s here:
38.103.63.17
There are several reasons why you would like to know this, but one reason might be that you are using a ISP that has DHCP enabled, and your IP-address changes once in a while. Another might be if you are on a private network behind a firewall and/or proxy.
The IP address above is fetched via the REMOTE_ADDR value in the $_SERVER variable with the Exec-PHP 2.0 Wordpress plugin.

(2) Comments    Read More   
Feb
06
Posted on 06-02-2006
Filed Under (Tools) by Johan Känngård

After I upgraded to 1.5.0.1, I could not access certain sites. One of them said that my browser was too old, and I had to upgrade to at least Firefox 1.0 or Internet Explorer 6.0.
If I only had Opera installed, I could fool the site by switching the User-Agent that is sent with every request. This switch is built-in into Opera, and was quite a cool feature! Firefox doesn’t have this feature out of the box, but halleluja, there is a plugin that solves this!

Check out “User Agent Switcher” by Chris Pederick.
[tags]Mozilla, Firefox, Plugin[/tags]

(0) Comments    Read More