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]
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:
The easiest way to hide the text is via a stylesheet like this:
…but you already knew that, huh?
[tags]JavaScript, DOM, Lotus Domino, CSS[/tags]

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]
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 = "
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]
-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.
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]
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]
If you want to know what your public IP address is, it’s here:
38.107.179.227
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.
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]