Tuesday, March 31, 2009

April Fools' pranks and jokes from Sametime bot

For the April Fools' Day I updated our Joke Bot with new funny jokes and pranks.
I like the one in which victims are tricked into calling the zoo to ask for Mr. Lyon :)

Open April Fools' Sametime Bot
Type "april" to bot to see more joke suggestions.


Other Sametime bots:

* The original jokes bot

* Halloween jokes

* Wisdom quotes from famous people

* Translation bot

* Currency exchange rates

* Lotusphere RSS posts on Technorati

* Example of Bot processing regular expressions (regex)

* Morse code

* Random bible quote

* Get city names by zip codes (Sweden)



Here is the HTML code needed to include Joke Bot on your own web page. Access to bot is implemented with help of STWidget web client for Sametime - the first web based Sametime client.


<iframe src="http://www.stwidget.com/ggljoke/stwidget.html" scrolling="no" frameborder="0" style="width:170; height:280;"></iframe>


Example of a bot emdedded using the code above:




Tags:

Tuesday, March 17, 2009

Testing blogging from iPhone

Testing how it works to create a blog post using iBlogger app on iPhone. Sitting right now in a community train on the way home.

Today Apple releases news about iPhone version 3 update. I hope they will include MMS functionality, SMS forwarding and video recording. Possibility to run applications in background would also be nice, then I would consider porting STWidget Sametime web chat to a native iPhone app. The problem with current apps in iPhone is that they are automatically aborted as soon as phone goes into sleep mode. That saves of course battery life and frees up memory, but there should be a way to override this behaviour by asking user to allow to run in background. Windows PDA allow this, but I couldn't use them for more than 1.5 hours of continuous typing, iPhone lasts about 3 hours. I mean lasted 3 hours, but after version 2.2 update last month, battery life jumps up and down without obvious reason.

Friday, December 26, 2008

Lotusphere and USA travel authorization

I am finally ready with all my Lotusphere bookings. But as it is right now, I'll have to stay in 3 hotels. First 1 night in "Dolphin", then 4 nights in "Port Orleans Riverside" and then 1 night in "Swan". I am on the waiting list for "Port Orleans Riverside", hope that I'll get at least 1 hotel switch less.

When booking the flight ticket, I noticed a warning that from 12 January travelers must electronically register at least 72 hours prior to travel. See below for more info.

Link:
http://www.cbp.gov/linkhandler/cgov/travel/id_visa/esta/about_esta/esta_intro/esta_english.ctt/esta_english.pdf
Extract:
Effective January 12, 2009, all VWP travelers will be required to obtain an electronic travel authorization prior to boarding a carrier to travel by air or sea to the U.S. under the VWP.

VWP=Visa Waiver Program

Tag:

Monday, December 01, 2008

Strange behavior of DXL import

While working with DXL123 freeware Domino app(beta released soon), I found a strange behavior of DXL importer in LotusScript: swedish letters (åäö) in imported stream are changed to garbled characters. But simple stream.ReadText before importing the stream fixes the problem.
I guess it has to do with wrong encoding, maybe with utf-16 being used instead of utf-8, but I don't see how I would change that or why it begins working after stream.ReadText <?xml version="1.0" encoding="utf-16"?>



Dim tmpstream As NotesStream
Dim importer As NotesDXLImporter
Dim fixencoding As String

Set tmpstream = session.CreateStream
Call domParser.setOutput(tmpstream)
Call domParser.Serialize

fixencoding=tmpstream.ReadText 'This makes the result OK

Set importer = session.CreateDXLImporter(tmpstream, sourcedoc.ParentDatabase)
importer.ReplaceDBProperties = False
importer.ReplicaRequiredForReplaceOrUpdate = False
importer.DocumentImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
Call importer.Process '.Import gives same result


DXL123 is a set of LotusScript API to easily perform different operations on inline images and on attachments without knowing anything about DXL.

Function available in DXL123:
Copy attachments between documents (without detaching to disk)
Convert inline image to attachment (without detaching to disk)
Change name of an attachment (without detaching to disk)
Remove inline images
Import disk file as an inline image
Place inline image in text after specified word/phrase
Place inline image inside a table
Replace inline picture to another picture
Replace attachment in richtext to URL link
Replace inline image to HTML image reference

Example:
attachment_name=CopyInlineImageToDocAttachment(sourcedoc, targetdoc, "Body", 2, False, True)' make the second image in Body field to become an attachment and delete the original image


Tag:

Friday, October 31, 2008

Halloween bot

On this dark October evening, amuse yourself with Halloween Sametime Bot, which knows a lot of Halloween jokes about vampires, ghosts and other scary creatures:

Halloween Sametime bot

To see more scary jokes, type "scary" or "joke" to the bot.




Tags:

Thursday, August 21, 2008

Sametime bot shows currency exchange rates

Based on Translation Bot, I created another multi-step function for our Sametime bot. It shows current exchange rates between different currencies (from Yahoo Finance).
You can try it here:
Currency Exchange Sametime bot

Instructions:
1) Type 1 and click "Say" button (or press Enter key).
2) Type 2 to set Euro as source currency and press Enter key.
3) Type 7 to set Swedish crown as target currency and press Enter key.
The result is the current exchange rate according to Yahoo finance.

    




Tags:

Sunday, August 17, 2008

Another Javascript feature

Javascript uses pointers when assigning objects. This can lead to unexpected results for those who are used to work with LotusScript and Visual Basic, where data is copied to the new object and is no longer connected to the original object.

In the example below note that date2 object was not deliberately changed after it was initially set, but still at the end of the script it gets a new value which is the same as the changed date1 object.

<script>
var date1=new Date();
var date2=date1;

alert(date2); //shows Sun Aug 17 11:46:50 UTC+0200 2008

date1.setMonth(5);
date1.setDate(9);


alert(date2); //shows Mon Jun 9 11:46:50 UTC+0200 2008
</script>

run example

It also works in the opposite direction: if you change date2, the date1 will also be changed.

Monday, August 04, 2008

Why javascript doesn't like August and September in date validation

Do you like August and September months? Well, then bad news, because JavaScript doesn't like them. Using parseInt function without base parameter to convert from text to number when validating month number 08 gives 0.
This is true only for August(month "08") and September(month "09"), so it can take a while until the error is discovered. Why is that happening? Well, probably because genious developers of Javascript API thought that people use octal (base8) as default. Numbers until 08(August, put as "08" in dates) are converted correctly because they are same in octal as in base10, and numbers after 09 are recognized correctly because they(almost never) have a non-zero leading number. In between we have our poor "08" and "09".
Fortunately, there is a parameter you can add to parseInt function which specifies the base, e.g. parseInt("09", 10). But was it really so smart to use base8 as default for numbers beginning with 0 instead of always using base10 and requiring user to explicitely enter parameter for other (less used) bases?



Alternatives for parseInt are parseFloat and Number functions:

Doesn't work correctly:
javascript:alert(parseInt("09"))

Works correctly:
javascript:alert(parseInt("09", 10))
javascript:alert(Number("09"))
javascript:alert(parseFloat("09"))



Monday, July 28, 2008

Sametime bot for text translations

As I wrote in my previous blog post "LotusScript to translate text between languages", I have created a function in Sametime bot to translate text between languages using Google Translate. Now this bot functionality is available for everyone to test through STWidget-Sametime AJAX web client.

Link to live demo: Sametime translation bot

Quick instructions:
1) type 1 (to choose "Translate between languages" option) and then press Enter or click "Say" button.
2) type 1 (to choose English language) and then press Enter.
3) then type 2 (to choose German language) and Enter.
4) then type text you want to get translated, e.g. "I love programming" and Enter.

To fetch the translation result, Bot makes a web call to Google Translate service, using MSXML2 object in a slightly modified LotusScript code as in the old post. Here is an animated picture of the translation process:

Sametime translation bot animation

Click picture to see animation




Some other funny functions available through the same bot are "joke", "wisdom", "morse" and "random bible quote". The main difference between these small functions and Translation function is that Translation works in multi-step mode, prompting user with available choices, thus eliminating the need for user to remember the syntax of the commands. Another multi-step function is "Company info" where user can get virtually any corporate info through Sametime bot.

All of the example functions above are handled by the same bot instance, so users do not need to add a separate bot to their buddy list for each new function added by developer/admin to bot.

In one of my next posts I will show a screencapture video how to develop a "whois username" function using @Formula language and how to create multi-step "Translation" function.


Tags:

Wednesday, July 23, 2008

Automated login to Domino by HTTP POST request

In a comment to Joachim Dagerot's blog post "Login in with just url-arguments" I mentioned that it's possible to login without exposing login credentials in the URL. It is done by making a POST request to Domino web server, instead of GET request. User still can see login credentials if he views page's HTML source, but they are at least not shown directly in the URL. Showing login details in URL makes it possible for bypassers to see your password, it's saved in the browser's URL history and it's also logged in the Domino log database, which is not so good as anyone with access to the log database can see them. Such URL might even get indexed by Google and show up in the search results.

To additionally secure automated login, an extra redirect can be used, so the page itself does not contain the password. Or even better and without any password exposure is a page/form which calls an agent which makes login in background and then passes the session cookie back to the initial page. But that's a topic for another blog post. Here i will show the simplest solution.


<form action="/names.nsf?Login" method="POST" name="LogonForm">
<input type="hidden" name="Username" value="myname">
<input type="hidden" name="Password" value="mypassword">
<input type="hidden" name="RedirectTo" value="/anotherdb.nsf/view?OpenView">
</form>

<script>
document.forms[0].submit();
</script>




When user opens this page, the first form gets automatically submitted to "/names.nsf?Login". User gets logged in to Domino with username and password specified in the form's fields and then redirected to another database according to the value in RedirectTo field.

Tags:

Sunday, June 01, 2008

LotusScript's List bug strikes again

Last week i was working with a LotusScript agent which uses List data type for storing text values. The agent was not working properly as it could not find matching values in the second list(which was populated with the same listtags as the first list). I suspected it was something wrong with processing of List, but couldn't find what part of the code was wrong, as I got no error messages. The List was more than 1000 elements and in the debugger I could only see about 200 first elements, which was not very helpful. I have earlier experienced similar problem with IsNull(mylist("listtag")) function, but in this agent there were no such IsNull checks (use IsElement instead of IsNull). After 2 hours of commenting parts of the code out, I finally found what was wrong. The fact of calling tst procedure with nonexistant list value mylist("b") as parameter, creates "b" list element with value ""! It does not generate "List item does not exist" error message as one would expect!

I have hard to think that it works "as designed", as a programmer clearly doesn't want to create a new list element by simply passing it to a procedure.
Using IsElement(mylist("b")) before calling the procedure/function helps to avoid the problem, but that shouldn't be necessary, as the programmer expects an error if the List element does not exist.

Sub Initialize
Dim mylist List As String
mylist("a")="a"
' Msgbox mylist("b") 'properly results in error "List item does not exist"

Call tst(mylist("b")) 'erroneously creates "b" list element

' Msgbox Isnull(mylist("b")) 'erroneously creates "b" list element

Msgbox mylist("b") 'shows "" as list value for "b" instead of an error

End Sub

Sub tst(tmp)

End Sub



Tags:

Sunday, March 02, 2008

Short tip: connect to remote Windows desktop console session

Just a short tip which I discovered today.

When connecting to a remote Windows server using the standard "Remote Desktop" client program, you are connected to a user session and can not see what happens on the server's main console (the one which you get when you login physically on the server). You can not, for example, see the Domino server console.

But there is a special parameter which can be used with Remote Desktop client to login into Windows console session instead of user session.
In Start/Run menu type:
mstsc /console
use your regular username and password, and you will be logged in directly to Windows console. I guess that you must have some kind of admin privilegies to do that.