Monday, May 14, 2007

Allow selections not in list (for the web)

One of the neat options with drop down selections in Notes, is the ability to let people type an option that is not in the list. This helps build dynamic lists.

Here is some javascript to use to get this working on the web:


function changed(el, cmp, pmt){
if(el.options[el.selectedIndex].value==cmp) {addoption(el, pmt);}
}
function addoption(el, pmt){
var txt=prompt(pmt,'');
if(txt==null) {return;}
var o=new Option( txt, txt, false, true);
el.options[el.options.length]=o;
}


You can either put this in an included javascript file or wrap it directly inline.

Then you can call it using the onchange event for your selection field:

onchange="changed(this, 'New Group', 'Please enter new group:')"

Where "New Group" is the text you want to trigger the prompt for the text and "Please enter new group" is the prompt you want to display.

Monday, April 23, 2007

A week into Linked In

A customer recently sent me an email to join linked in, a social networking "business" site. It seems myspace is more for music fans, facebook for college or recent graduates where linked in is more for professionals.
The differences are certainly there in the UI. For instance, in facebook, you can say if a linked friend "hooked up" with you whereas there is no option for this in linked in. I guess it still goes on, but it is not something you would publish as it has little business benefit and does not make you look very professional.
I was surprised how many IBM'ers were already on the network and thank those who have linked to me. The purpose is to find connections, so I thought I would give it a little test.
The test worked. I have managed to find one lost friend through our xhtml developer. I worked with David Wyss for a while around the QuickPlace redbook and he had seemingly vanished. I had asked a few common contacts (IBM) what happened to him but they didn't know. When I searched through linked in, it found a connection through Australia (where I was looking in Switzerland) and it came through a non-IBM source (where I looked through IBM'ers). So, it seems we were not very far from each other after all - there was always 2 degrees of separation all this time and we just didn't know.

Sunday, April 08, 2007

Change custom field names in QuickPlace

If you have a custom form in quickplace and then change a field name, it will not go through and update all the pages that have been created by this form.
So, for instance, if you create a form that has a field called "categories" and want to change it to "category", here is an agent that will loop through all the documents in this room and all its inner rooms using recursion.

'category correction:

Option Public
Option Declare

Dim server As String
Dim placename As String
Dim s As notessession
Sub fixcategory(roompath)
Dim roomdb As NotesDatabase
Dim roomview As notesview

Set roomdb = s.GetDatabase(server, roompath)
If roomdb.IsOpen = False Then
Call roomdb.Open(server, roompath)
End If


Dim roomindex As notesview
Set roomindex = roomdb.GetView("System\Index")
Dim page As notesdocument

Set page = roomindex.GetFirstDocument

While Not(page Is Nothing)
'Work through all documents
page.c_category = page.GetItemValue("c_categories")

Call page.Save(True,False)
Set page = roomindex.GetNextDocument(page)
Wend

Set roomview = roomdb.GetView("System\Subrooms")
Dim doc As NotesDocument
Set doc = roomview.GetFirstDocument
While Not (doc Is Nothing)
Dim iroomtitle As String
Dim iroomfile As String

iroomtitle = doc.GetItemValue("h_Name")(0)
iroomfile = doc.GetItemValue("h_LocDbName")(0)

Print "Working on: " + iroomfile
Call fixcategory("quickplace/"+placename+"/" + iroomfile)

Set doc = roomview.GetNextDocument(doc)
Wend
End Sub
Sub Initialize
Set s = New notessession
placename = "test_place" 'Your place name
server = "www/projectlounge" 'Your server name

Print "Starting in a room"
'you can change this to main.nsf if you need
Call fixcategory("quickplace/"+placename+"/PageLibrary85257279005D300B.nsf")
End Sub


Tuesday, April 03, 2007

Rediscovering an ibm.com treasure

While digging up an old email from 2004 for someone, I found that my signature once contained a link to the IBM culture clash web site.
It does have some good information and for those that have traveled to some of these countries, it certainly can bring back some memories.

Monday, March 26, 2007

AJAX state_select

After downloading the state_select plugin for rails.
I put in a little extra work to make the state select AJAX updated.
The address form looks like:

<%= state_select 'address', 'state', country='US' %>

...
<%= country_select 'address', 'country' %>
<%= observe_field :address_country, :frequency=>0.5,
:update=>"state_select",
:url=> {:action=>'state_select', :only_path=>false},
with=>"'country=' + encodeURIComponent(value)" %>

Where the AJAX calls into a partial form:

<% if params[:country] == "United States" %>
<%= state_select 'address', 'state', country='US' %>
<% elsif params[:country] == "India" %>
<%= state_select 'address', 'state', country='INDIA' %>
<% elsif params[:country] == "Canada" %>
<%= state_select 'address', 'state', country='CANADA' %>
<% elsif params[:country] == "Australia" %>
<%= state_select 'address', 'state', country='AUSTRALIA' %>
<% elsif params[:country] == "Spain" %>
<%= state_select 'address', 'state', country='SPAIN' %>
<% elsif params[:country] == "Uganda" %>
<%= state_select 'address', 'state', country='UGANDA' %>
<% elsif params[:country] == "France" %>
<%= state_select 'address', 'state', country='FRANCE' %>
<% elsif params[:country] == "Germany" %>
<%= state_select 'address', 'state', country='GERMAN' %>
<% else %>
<%= text_field 'address', 'state', :class=>"text" %>
<% end %>

I have posted to their blog to see if the state_select could be updated so there was no translation needed between the "country" from select_country and the "country" parameter passed into the state_select. It would be also nice to return a text field if there is no state list for the given country.
This would mean the partial code would just be:

<%= state_select 'address', 'state', params[:country].uppercase %>

Thursday, March 22, 2007

Importing zip codes

This entry will show you how to quickly import zip codes into your database. From there, they can be used with AJAX lookups or verification.

Step 1: Download the zips.txt into your RoR (rails) db directory or some other place.
http://www.census.gov/tiger/tms/gazetteer/zips.txt

Step 2: Generate the table in MySQL

CREATE TABLE zip_codes (
id INTEGER NOT NULL AUTO_INCREMENT
, zip CHAR(5)
, state CHAR(2)
, town VARCHAR(50)
, population INTEGER
, PRIMARY KEY (id)
);


Step 3: Generate the model

ruby script\generator scaffold zip_code


Step 4: Run this import code

require 'csv'
CSV.open("#{RAILS_ROOT}/db/zips.txt", "r") do |row|
zip = ZipCode.new
zip.zip = row[1]
zip.state = row[2]
zip.town = row[3]
zip.population = row[6]
zip.save!
end


You can then monitor the table size and wait for it to grow to 29k+.

Tuesday, February 13, 2007

4th Grade Math Problem

A friend's 4Th grade child was given this problem a few days ago as homework. I found it really hard - not sure how it could be solved without a computer (but maybe someone knows the answer).

Where the letters are numbers from 0 to 9 excluding 3. Find the values for each letter that would make this true:
show + tight = coach

I have an answer and my working in the comments and welcome other solutions people might have.
So, if you want a tease, don't click on the comments until you have a go. I don't want to taint your thinking with my brute force attack.

Saturday, February 10, 2007

I just watched the secret

I just watched the secret today. It is a motivational movie that talks about positive thinking. I was really into motivational tapes/books and talks when I was in high school and early university. After that, I focused more on technology and computers than my personal mental state.
I like the idea that positive thinking can bring you anything you want but I tend to be more pessimistic these days. Having said that, I do believe that you can achieve more with positive thinking than you can with negative thinking - so I am happy that I watched the movie and I am going to be a little more positive in my day to day life.
So in that light, I wanted to list some of the items I am grateful for:
* my loving wife;
* good health;
* close friends and family;
* successful internet business;
* experience and friends at IBM/IRIS;
* ability to travel;
* cognitive skills; and
* the Irish (what's not to love about the Irish)

This list is far from inclusive - but it certainly covers the major topics.
Part of the positive thinking aspect is to also be grateful for what is going to happen in the future and believe it will happen. For me this would include:
* the above list 100 times over;
* brilliant solution to global warming
* peace through humanity towards others
* faster than light speed engines to travel to other worlds
* teleportation
* dramatic improvements in medicines that allows anyone to live as long as they like (this is a good one for all the agnostics)

Enjoy! .. and now back to the technology and computers :)

Thursday, February 08, 2007

QuickPlace 8/Quickr Screenshots

Satwik has posted a blog entry with a link to the Quickr screenshots. These were shown at LotusSphere 2007 and should be available mid year as part of the product. It looks really nice and will allow people to do a lot more within a Quickr.
PDF link with screenshots

Friday, January 26, 2007

Very positive LotusSphere 2007

I am traveling back from LotusSphere 2007 and am very excited about Notes 8, Quickr (QuickPlace 8), and Lotus Connections (Ventura/Activities). I have been to a few LotusSpheres over the years and this was my first that I was not there from IBM or Iris. The positive energy around Notes 8, Quickr and Portal Express reminded me of when I did my first QuickPlace talk. The Notes developers and my old team were getting beaten up in the meet the developers lab about all the bugs and feature requests - where I was in the QuickPlace lab soaking up all the positive energy and excitement from the business partners and guests. This year, the positive energy was there for the Notes 8 client developers to enjoy.
The Ask the Developers section at the end was the most telling for me. Although there was a fair share of difficult questions, it was so positive to hear everyone preface their questions with admiration for the work and effort the development teams had put into Notes 8, Quickr and Connections.
The proof will be when the code is shipped and people start to adopt the composite application model for delivering applications. It will give IBM customers and partners a really powerful way to extend and deliver value.

Wednesday, January 10, 2007

Running Domino on an Amazon Elastic Cloud

I was recently accepted into the Amazon EC2 limited beta and was able to create my first instance following the getting started tutorial.
As they currently have no support operating systems for Domino, I asked Daniel Nashed which he thought was most like the supported system. He suggested the CentOS as he has run 4.3 but not 4.4.
I then loaded up that instance using the Amazon tools. It is a very raw image without a web server but came up very quickly. After that I downloaded and installed Domino for Linux to the machine.
I had to authorize the domino port and remote setup port for my machines:

ec2-authorize default -p 1352
ec2-authorize default -p 8585

Then, I created the notes user:

useradd notes

Uploaded the latest rc_domino script and then ran the server in listen mode:

server -listen

The server complained about a missing library (/opt/ibm/lotus/notes/latest/linux/tunekrnl: error while loading shared libraries : libstdc++.so.5: cannot open shared object file: No such file or directory), so I had to install this via yum:

yum install compat-libstdc++-33

This resolved the startup problem, and the Domino setup ran as normal.
I have the server up at:
http://domu-12-31-33-00-03-6c.usma1.compute.amazonaws.com/
(I will probably take the server down after LS2007).
It seems to run as you would expect from 1.7GHz with 1.75Gb RAM. When I pull the statistics through the admin client, it looks perfectly healthy and I can create databases as you would normally.
For the money, it works out at about $73/month (10c/hour) for a small server plus bandwidth and storage. It is in a totally different league to AIX LPARs (you scale by adding more instances rather than making your current instance larger) but for a small business is it a really good alternative to running your own domino server. Looking after a rack in a colocation facility is a lot of work and Amazon gives the technical users a cheap alternative here.

Monday, January 01, 2007

QuickPlace Clustering over a Wide Area

I have started to experiment with wide area clustering of QuickPlace 7.0. In QuickPlace 8, it will use more Web 2.0 technologies and libraries such as Dojo. The impact of this will mean the QuickPlaces will become more chatty (more smaller and lighter requests). As a result, any latency issues might become more noticeable. To make the most of this, having your QuickPlace server as close as possible, will make the place much faster.
Once I can sort out any clustering issues, the next stage is to use directional dns from Neustar. This will direct the user to the closest server to the users location. For Australian users, this will be Sydney (latency of 20ms instead of the current 300ms), West Coast USA will be San Francisco (10ms instead of 80ms) and East Coast will keep hitting our main servers in Somerville, MA (10ms or less from New York). So far the Australian server is keeping up with the load and the West Coast should be online soon. I hope to have the world wide cluster working before LotusSphere 2007.

Friday, November 17, 2006

How to compile NotesAPI programs without buying visual studio on Windows XP

Download and install:
1. Microsoft Visual C++ Express (GUI not needed to compile)
http://msdn.microsoft.com/vstudio/express/visualc/
2. Run Windows Update if needed

3. Microsoft Platform SDK for Windows Server 2003
http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb&DisplayLang=en#filelist

4. Download and extract the Lotus C API Toolkit
http://www-128.ibm.com/developerworks/lotus/downloads/toolkits.html

5. Download the nmake program and copy this to your c++ bin directory
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084
(may already come with c++ express)

6. Create batch files that simplify your build (put these in a directory in your path)

FILE: mk.bat
CONTENTS:
nmake /f mswin32.mak /a

FILE: setenv.bat
CONTENTS:
"D:\Program Files\Microsoft Visual Studio 8\VC\vcvars32.bat"
"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.bat"
set LIB=d:\notesapi\lib\mswin32;%LIB%
set INCLUDE=d:\notesapi\include;%INCLUDE%
set PATH=d:\lotus\domino;%PATH%

FILE: w32.bat
CONTENTS:
"D:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" /RETAIL

7. To use the compiler
1. Start a Visual Studio 2005 Command Prompt
2. Run the commands:
a) setenv
b) w32
3. Change to the d:\notesapi\samples\basic\intro
4. run the batch file "mk"

...and you should then be able to compile NotesAPI programs.

Saturday, November 11, 2006

Paris in November

We arrived in Paris after 7 weeks in Geneva. It was memorial day here and we had a perfect view of the ceremony from the hotel. The TGV was the perfect way to travel and we missed the strikes that seem to happen each November. Here are some photos we posted...

Sunday, October 29, 2006

Leukerbad for the weekend

We just spent the weekend in the spa town of Leukerbad. It was a totally relaxing time and very easy by train/bus from Geneva. Here are the photos from our walk around the lake up at Gemmi.

Wednesday, October 25, 2006

Making the AIX shell more friendly

To make the standard korn shell more friendly, you can edit your .profile with the following settings:

set -o emacs

stty erase ^?

alias __A='^P"
alias __B='^N"
alias __C='^F"
alias __D='^B"


Note, to get control in vi ctrl-v (keep this down when typing the next character).

This will now give you the use of the up and down arror keys as well as the backspace key for editing commands. This much easier than using ctrl-h and all the standard keystrokes.

Tuesday, October 24, 2006

Changing a database replica id on AIX

There has been a utility floating around to change a Lotus Notes database's replica id for some time. I recently migrated a company to AIX 5.3 from another platform to run Domino 7.0.2. Here is a simple HOWTO get up and running to compile with the Notes API on AIX 5.3.

Upload the NotesApi tool kit from the Lotus Developer Domain (under toolkits).

Uncompress and extract the tar file to /yourmount/notesapi

Make sure the notes user owns these files and any links
chown –r notes:notes /yourmount/notesapi

Create a link under /opt/ibm/lotus

cd /opt/ibm/lotus
ln -s /yourmount/notesapi notesapi
chown notes:notes notesapi

Change to the notes user with their profile
su - notes

Create a script to set all the environment variables

server:/home/notes$ cat setenv
#!/usr/bin/ksh

LOTUS=/opt/ibm/lotus; export LOTUS
NOTES_DATA_DIR=/yourmount/domino/data; export NOTES_DATA_DIR
Notes_ExecDirectory=$LOTUS/notes/latest/ibmpow; export Notes_ExecDirectory
PATH=$PATH:$NOTES_DATA_DIR:$Notes_ExecDirectory; export PATH

Source the file before running any compilations

server:/home/notes$ . setenv

compile the intro sample as a test
cd /yourmount/notesapi/sample/basic/intro
make -f aix.mak

You can now compile any notesapi program.

The chrepid.c example is available for download here:
chrepid.c
chrepid make
chrepid compiled program

Thursday, September 07, 2006

Parked way too close


Almost hit the metal staircase with the front of the car.

Monday, September 04, 2006

First Surf Lesson



Although I was born in Hawaii, today was my first ever surf lesson and I really enjoyed it. Thanks to Learn to Surf Noosa.

Sunday, September 03, 2006

Fathers day 2006


Tack is wondering how much more seafood Anne will eat.