Johnno's Workbench - Page 2 of 23 - Tips, Tutorials, Domino, XPages, Java, Mobile, Appcelerator, etc

14 May 2015
5

Java XSnippet Published: Translate an ArrayList to a Vector

Here is a Java XSnippet I published the other day on how to manually convert an ArrayList Object to a Vector Object.

UPDATE

Thanks to “Martin Rolph” and “Jesse Gallagher” for providing a much simpler method of getting the same result without having to use my XSnippet. I’ve decided to keep my XSnippet published as I do feel it will add value as a reference point.

ORIGINAL POST

Click here to view XSnippet

When binding Scoped Variables to a List Control in XPages, the values returned are defined as an ArrayList. You might want to convert these values into a Vector for whatever reason.

Quick Example of how to use XSnippet:

doc.replaceItemValue("MultiValueField", TranslateArrayListToVector(viewScope.get("Values"));

Martin’s and Jesse’s much better alternative:

doc.replaceItemValue("MultiValueField", new Vector(viewScope.get("Values")));
31 Mar 2015
1

Appcelerator workaround for ACS Publish “Request is not recognised” error

This is a workaround when getting a ‘Request is not recognised” Error when trying to publish a Node.ACS App to the Appcelerator Cloud.

The problem seems to be with the latest version of Node.ACS (In my case version 1.0.23) not compatible with the public Appcelerator Cloud platform. As per this post, it’s recommended to downgrade to version 1.0.21. This worked for me.

To downgrade your version of Node.ACS, do the following:

  1. Open Terminal
  2. Enter the following command: “sudo npm install -g acs@1.0.21
  3. Provide administrator password if requested
  4. Restart Titanium Studio (Just in case)
  5. Once Titanium Studio is restarted, select Node.ACS app and Deploy.

That’s it. Hope this helps.

John

9 Mar 2015
13

XPages Best Practice: Don’t add ids to controls if they are not required

This is a quick best practice tip and what will most likely become an involved discussion around ids for XPages controls.

I had to think carefully before posting this, but decided to do so as I know it would prove beneficial to the online community either way.

One of the recent items I’ve added to my “best practices” list, is to not use ids for XPages controls that do not require it. A great example of this are label controls. 99.9% of the time, I require no programmatic handle on any of my label controls. What most should know by now is that if you assign an id of “label1” to the label control, this id gets converted to something along the lines of “view:_id1:_id2:_id11:label1” when the HTML page gets rendered to the user. I’m hoping by now you start understanding my concern?

Let’s say you had about 20 controls that make up your XPage that don’t require ids….that’s at least about 500 bytes of data the user has to download just for these id names. NOTE: This is before compression has taken place. (This could be 100 bytes after compression is applied)

See below example XPage. All it contains (other than the defaults that Domino provides) is 20 label controls with an id name of “label1“. The size of the HTML page is 633 bytes (post compression).

Screen Shot 2015-03-09 at 12.07.12 PM

See below 2nd example of the same XPage, except there are no ids assigned to these 20 labels. The size of the HTML page is 567 bytes (post compression).

Screen Shot 2015-03-09 at 12.05.16 PM

For most of you (i’m guessing), the difference in size is probably too small to action, but for me, it forms part of a drive to deliver the best online, mobile and browser experience possible to my clients and users.

Ok people, bring on the discussions….I’m ready!! :)

11 Feb 2015
0

IBM Domino Designer Tip: Change measurement for notes-based designs

This is a quick tip for those who want to change the unit of measure in IBM Domino Designer from inches to centimeters.

Inches are a default for IBM Domino Designer when setting up table designs and the like in Notes, but I prefer to use centimeters. To modify the measurement, do the following:

  1. Open Domino Designer
  2. Click on “File\Preferences”
  3. Select “Regional Settings”
  4. Select which Unit of Measurement you want to use
  5. Click on “Ok”
  6. Restart Domino Designer

 

 

9 Oct 2014
0

Webstorm Tip: Use Key Promoter to help you find Keyboard shortcuts

For me, there are too many keyboard shortcuts to memorise in Webstorm IDE? Thanks to a nifty plugin, these shortcuts can be learnt on the fly.

Overview

What Key Promoter does is monitor your mouse clicks on Menus and Toolbars inside Webstorm. If a shortcut exists for where you mouse-clicked, Key Promoter will show you the Keyboard Shortcut command that you can use for that same action.

Firstly, where to find references to Keyboard Shortcuts

Note: The below instructions are for Mac, but Windows will be very similar.

  • Top Menu > Help > Default Keymap Reference
  • Top Menu > Preferences > Keymap
  • Keyboard: CMD + SHIFT + A (For Mac)
  • Keyboartd: CTRL + SHIFT + A (For Windows)

To install Key Promoter

Note: The below instructions are for Mac, but Windows will be very similar.

  • Go to the Webstorm Preferences: Top Menu > Preferences
  • Search for “Plugins”
  • Click on “Browse Repositories”
  • Search for “Key Promoter”
  • Click on Install Plugin
  • Restart Webstorm

Webstorm

Test Key Promoter

After restarting Webstorm, you can test Key Promoter by performing the following mouse actions below:

  • Clicking on the Changes Tab at the bottom of the Webstorm IDE

Webstorm2

  • Clicking on the Git Update Project icon on the top right of the Webstorm IDE

Webstorm3

Closing

I trust this tip will help you be more productive when developing? Stay tuned for more.

Cheers for now
John