Saturday, March 2, 2013

Using dojo.query with IDs containing colon symbol

While working on my XSnippet to move between pages in a pager control using arrow keys I required to get elements based on pager ID. So I went with dojo.query. But selectors in dojo.query cannot contain characters like colon which XPage extensively uses for generating IDs.

So the code dojo.query("view:_id1:viewPanel1:pager1") will not work. To make it work you need to escape the : with \: or even better with \3A, for backward compatibility with IE.

I wrote a simple helper function escape colon characters from ID.

Thursday, February 14, 2013

Writing to log.nsf via Formula, LotusScript or Java

While debugging @Formula code I was using a lot of @StatusBar command to output values in status bar to debug. But the status bar in Lotus Notes shows only around 20-30 last entries. I was looking for a way to write that information to my local log.nsf where I could see the entire trace and analyse it. That's when I ran into this post on Notes/Domino 8.5 forum. It says that by adding LogStatusBar=1 to your notes.ini all the messages that get printed to status bar will be written to log.nsf. And problem solved!

As this method writes every message printed in status bar to log, it works for any language running on client.

Saturday, February 2, 2013

Functions and properties of the XSP object

Stephan Wissel has blogged about some useful functions of XSP obeject. But the list is not complete. So I decided to put the XSP object through my helper JavaScript function listPropsAndFunctions. Below is the list of whatever I could find. I would be updating this list with explanation of whatever properties and functions I am able to find from time to time.

_allowDirtySubmit

_dirty

_dirtyFormId

_eventNameHtmlToWidget

_listeningForDojo

_listeningForDojoOnload

_onLoadListeners

_submitValue

_submitValueSet

Wednesday, January 16, 2013

Getting properties and functions of JavaScript objects

I was looking for a way to get all the properties and functions for a particular JavaScript object. Looking around the web I found this discussion of StackOverflow which gave me my answer. I created a small helper function to which you pass your object and it spit out all its properties and function in the console. This is how it looks like:


You may argue that content assist in IDEs already give you this information. But there are slight differences in implementation of JavaScript of each browser. Looking into the document object on Chrome I found a property webkitIsFullScreen, but on Firefox there is not corresponding property with name mozIsFullScreen (I am looking at Firefox 16).

Thursday, December 20, 2012

Using indexOf method on array in server side JavaScript

Sometime back I was trying to use indexOf method on an Array object in server-side JavaScript (SSJS) code. But it was giving me error that indexOf method is not defined. I also couldn't find this method in help documentation. It was then it struck me that the implementation indexOf method in client side JavaScript itself is a bit fuzzy with Internet Explorer not supporting it. It can be defined using prototype property.

I found a simple solution here which implements the method. Just add the below code snippet to your SSJS code and then you would be able to use indexOf method.


Remember that this would be required for SSJS. For client side JavaScript I would recommend using dojo.indexOf.

Wednesday, December 19, 2012

Charging pattern on HTC One X

My HTC One X has a pattern in which it charges itself.


In the above screenshot of my battery usage you can see that from 10% battery level to 60% battery level my phone charges at a constant rate. But from 60% up till around 75% this rate dramatically drops and it takes much longer to charge. Then picks up again until around 90% and afterwards it charges very quickly. I don't know why does this happen and what is its significance. I contacted HTC support but there response was not satisfactory either.

So if you notice the same pattern while charging or a different one do post it in the comments.

Sunday, December 9, 2012

New features in HTC One X after Jelly Bean update

Some time back I updated my HTC One X to Jelly Bean (JB) using OTA update. The update takes your Android version to 4.1.1 and Sense to 4+.


Its been almost a 2 weeks with this update and the most noticeable improvement I can see is of battery usage. My phone lasts 1-2 hours more than it used to before. Well done HTC! There also some additions (and deletions) which I am going to describe here. Now I not an Android expert so I don't know all the new features in JB itself, so you may find a feature new in JB listed here. Also you won't find Google Now and Google Play Music here as I know they are new to JB and not HTC One X.