PHP ::
SnTT: Keystroke Counting in the Notes Client (Thursday, Dec 28)
One more Show 'N Tell Thursday post for you, before the year's out. This is a little code I was playing with a few nights ago that allows you to monitor what someone is typing in a field on a form in the Lotus Notes client, as they're typing. You don't have to wait until they exit the field for validation, it happens while they're pressing the keys.
Here's what it looks like:
It works by using JavaScript -- that's right, JavaScript in a Notes client form by golly -- to start a SetTimeout loop when you enter the field, and then it keeps checking every half-second or so as you type. On the web, you'd normally do this with something like the onKeyUp field event, but that's not available on the Notes client so I SetTimeouted instead.
Rather than showing you all the code here (there's really not much, but it takes a little explanation), I'll just let you download the sample database and play with it yourself:
As I mention in the "About" page in the database, you could also use this technique to do things like:
- Check for invalid characters/words in a free-text field
- Time how long a user has been in a field, and do something if they're taking too long
- Change other fields on the form based on the value entered in the current field in real time (instead of after the field is exited)
Have fun with it. Happy New Year!
technorati tag: Show-n-tell thursday, SnTT
[ permalink ] [ e-mail me ] [ read/add comments ]
Permalink Comments off
How and why to change replica IDs during a Notes/Domino upgrade
Permalink Comments off
where is the UDDI located?
Permalink Comments off
Watch Aaron Russo’s Freedom to Fascism Online for Free
Permalink Comments off
Emulating Top Ranking Anomalies
Permalink Comments off
Re: Newbie: towards ’single sourcing’, feasibility of Word-DocBook
Re: Newbie: towards ’single sourcing’, feasibility of Word-DocBook
Re: switching from Robohelp to Xmetal
Re: Newbie: towards ’single sourcing’, feasibility of Word-DocBook
Re: Newbie: towards ’single sourcing’, feasibility of Word-DocBook
Re: Newbie: towards ’single sourcing’, feasibility of Word-DocBook
Re: switching from Robohelp to Xmetal
Re: switching from Robohelp to Xmetal
Kitchen by Francesco Ravo
One of the more newer trends in modern living is that the kitchen is the central place where everything comes together. I’ve read that it even goes as far as placing the kitchen in the center of the living room. The kitchen is becoming a sort of a lounge to chill. One concept that would perfectly fit that is a design called “Cocina” by Francesco Ravo for Obumex.
Kitchen, a central piece
The whole purpose of this kitchen is to become a central piece of the living area. It's made of materials that allow an elegant mix. Wood plays a prominent role, Zebrano to be precise for a smooth slick finishing. Zebrano is an African wood that is very stable and is primary used in design furniture. The ellipse and circle are the returning elements here. The mix of materials consists out of chrome, super-gloss varnish and wood.
Colors and shape
This design confirm that the post-war colors are back. The curvaceous shapes flow over into one coherent whole. The central piece is shaped by a bottom green varnished glassy table with adjusted varnish borders. The kitchen appliances are built in harmoniously. For me personally this design is too modern looking but I love the idea of playing with colors to set a different mood. I saw the Cocina kitchen in real live on the expo "Interieur 06" here in Belgium, Kortrijk and I must say you get a 'wow' feeling. One negative side is it's price. The kitchen as shown on picture 1 goes for (shudder) 32.065 Euro. So not my cup of tea as I am very satisfied with my Ikea kitchen. Of course if you compare the price to other design brands it's within the expected price range.
Permalink Comments off
switching from Robohelp to Xmetal
A little code audit on Xerces 2.9
PDO versus MDB2
I was just putting together a small test program and I thought I would try using PDO. I really haven't done anything serious with PDO, just try it a couple times. After recompiling PHP to include the mysql driver for PDO, I coded up the first version of my test program:
? $db = new PDO('mysql:host=localhost;dbname=example', 'example', 'secret'); ? $tags = $db->prepare(" SELECT * FROM bookmark_tags, tags WHERE bookmark_tags.bookmark_id = ? AND tags.id = bookmark_tags.tag_id ORDER BY tags.name"); ? $bookmarks = $db->prepare("SELECT * FROM bookmarks ORDER BY Title"); $bookmarks->execute(); while ($bookmark = $bookmarks->fetchObject()) { echo "{$bookmark->title} " ; $tags->execute(array($bookmark->id)); while ($tag = $tags->fetchObject()) { echo $tag->name, " "; } ? echo "n"; } echo "n"; ?
Unfortunately, this didn't work and it took me a few minutes to figure out why. Actually, I still don't know exactly why it doesn't work, but I did find a way to make it work: by using two separate connections, one for each prepared statement. It doesn't seem like you can have two active statements at the same time on the same connection. I find this hard to believe, so I'm probably doing something wrong.
The other thing I didn't care for with this PDO code is the non-standard method of iteration with the while loop. Well, the while loop is perfectly standard if you are coming from the PHP 4 style functional DB APIs. However, it doesn't seem to fit in with the PHP 5 Iterator and foreach integration. PDO doesn't seem to provide a distinct result set object, or a method of iterating over a result set using the standard PHP Iterator interface.
Now, I can understand why this may be the case. The PDO interface seems to be designed to bind to php variables. Thats not going to work with the Iterator interface. However, I am not using that mode and don't want to use that mode. It would be nice to be able to acquire an iterator for an example of use such as the one above without having to use fetchAll and ArrayIterator.
Using the Iterator style makes it easier for me to decouple my code from the data source and makes it easier to write test cases for that code.
I was a little bit disappointed. So I moved on to MDB2 with the same code ...
? require_once 'MDB2.php'; require_once 'MDB2/iterator.php'; ? $db = MDB2::connect("mysql://example:secret@localhost/example"); ? $tagLookup = $db->prepare(" SELECT * FROM bookmark_tags, tags WHERE bookmark_tags.bookmark_id = ? AND tags.id = bookmark_tags.tag_id ORDER BY tags.name"); ? $bookmarkFinder = $db->prepare("SELECT * FROM bookmarks ORDER BY Title"); $bookmarks = new MDB2_Iterator($bookmarkFinder->execute(), MDB2_FETCHMODE_OBJECT); echo "n"
; foreach($bookmarks as $bookmark) { echo "{$bookmark->title} " ; ? $tags = new MDB2_Iterator($tagLookup->execute($bookmark->id), MDB2_FETCHMODE_OBJECT); foreach($tags as $tag) { echo $tag->name, " "; } ? echo "n"; } echo "n"; ?
I have about the same level of non-experience with MDB2 as with PDO, but my code worked perfectly on the first try and allowed me to use Iterator, which will be helpful to the next stage of my test.
I was a bit impressed. I'll see how well it handles the next stage of what I want to do.
(And yes, I know there is no error checking in the above code.)
Permalink Comments off








