Alaska & Canadian Rockies 2017

The trip has just been absolutely amazing and here’s a summary clip to remember it all! Enjoy =)

Highlights from Alaska & Canadian Rockies 2017 from Esther Goh on Vimeo.

Advertisements

Spotfire Ironpython – Date type manipulation

minusDocument property date to string

Document.Properties[“date”].ToString(‘MMM yyyy’);

This will change a date type to a string. For example 01/04/2017 -> Apr 2017.

Changing the date object

For example, to minus a month from the date object:

d = datetime.datetime(Document.Properties[“CurrentMonth”]);
d_prev = d.replace(
year=d.year if d.month > 1 else d.year – 1,
month=d.month – 1 if d.month > 1 else 12,
day=1
).strftime(“%b %Y”);

Document.Properties[“PrevMonthSTR”] = d_prev;

This replaces the value in “PrevMonthSTR” with MMM yyyy format where “PrevMonthSTR” is one month before “CurrentMonth”.

Spotfire Ironpython – Property Controls

Property control in Spotfire allows users to make their dashboard more interactive and intuitive.

For example, we may wish to generate a table on the fly depending on a selection from a drop-down list. This drop down list could comprise of custom values, column names or unique values from a column.

Typically I like to generate a property control and tie it to a document property (think global variables). As such, the document property will take on the selected value(s) from the property control. In turn, we can attach a script to the document property and this script executes every time the document property changes in value.

Create a property control with and generate some fixed values:

PropertyControl

Add a script to print out the value of the selected item:

import clr
clr.AddReference(“System.Windows.Forms”)
from System.Windows.Forms import MessageBox
MessageBox.Show(Document.Properties[“PrintAMsg”]) ;

Change the value selection in the drop down box and see the pop out message box displaying the message!

PropertyControl.JPG

Of course the value in printing this message itself isn’t that great, but using this property, you could try doing filtering, generating tables based on certain values, changing axis, data dimensions or even generate an entire page of charts relative to the selected value.

Your creativity’s the limit!

Tibco Spotfire Iron Python

This may still be a little secret from some folks, but there is a whole customization world out there in Tibco Spotfire if you are willing to invest in coding Iron Python.

With Iron Python, you can do certain things like generating your custom data tables, automating certain actions such as filters, navigation etc.

Here are some sites for you to start with!

 

Enjoy!

Tibco Spotfire 7.5 Javascript API 101

Introduction

Tibco has just released Spotfire version 7.5 and here are the major changes I see thus far:

  1. Have a conversation with colleagues by adding comments to visualizations
  2. Add text annotations to visualizations
  3. Create a spotfire visualization in a popup generated from a third-party webpage
  4. Revamp of the architecture / administrator interface for Spotfire server including handling of webplayer and automation services within a single node manager

For more details on what’s new in 7.5, click here!

So one of the cool things you can do is make use of the JavaScript API to embed the webplayer dashboard into your webpage. This allows for more flexibility and interactions for your users.

Prerequisites

  1. Install Oracle / Microsoft SQL database server
  2. Set up the Spotfire database
  3. Install Spotfire server
  4. If using Oracle, install Oracle database driver
  5. Apply latest hotfix to Spotfire server if any
  6. Configure Spotfire server
  7. Deploy client packages to Spotfire server
  8. Install Node Manager (this node now supports Spotfire Web Player & Spotfire Automation Services)
  9. Install Web Player service
  10. * Ensure that Spotfire.Dxp.Worker.Web.config file has <javaScriptApi enabled=”true” domain=”” />
  11. Create a new analysis on webplayer
  12. Log into http://<server>/spotfire/wp/ and ensure that you can view the analysis you created

*Note that the config file above can be set by using commands on config.bat in C:\tibco\tss\7.5.0\tomcat\bin (with default installation location) In this example, I have the Spotfire server and the webpage hosted on the same domain and hence the domain property is left empty.

webplayerlibrary
Web Player library browser

Click on your analysis file, if it displays successfully, then you are good to go!

 

Embedding Web Player into your webpage

index.html
*Please remove the *remove* text (2 times) below. This is because wordpress auto renders HTML onto the post bleah. So much for being so automated :p Also note that you call your javascript from your webplayer url. 

<html>
<head>

<title>Web Player</title>

http://localhost/spotfire/wp/GetJavaScriptApi.ashx?Version=7.5
http://JavaScriptAPITest.js

</head>
<body>

<*remove* div id = “header”>
<h1>Embedded iFrame Spotfire Webplayer 7.5</h1>
</div>

<*remove* div id = “webPlayerFrame”></div>

</body>
</html>

JavaScriptAPITest.js

var c_serverUrl = “http://localhost/spotfire/wp/ “; //your webplayer url. remove the spacing between last / and “
var c_analysisPath = “/TestFolder/SampleData”; //path to your analysis after /Library/

var c_parameters = “”;
var customization = new spotfire.webPlayer.Customization();

var app;
var wp_doc;
var c_reloadAnalysisInstance = false;

window.onload=function()
{
app = new spotfire.webPlayer.Application(c_serverUrl, customization, c_analysisPath, c_parameters, c_reloadAnalysisInstance);

//create the customisation variable for the web player
customization.showDodPanel = false;
customization.showStatusBar = false;
customization.showToolBar = true;
customization.showPageNavigation = false;
customization.showClose = false;
customization.showAnalysisInfo = true;
customization.showExportFile = true;
customization.showExportVisualization = true;
customization.showUndoRedo = true;
customization.showFilterPanel = true;

var onOpened = function(analysisDocument)
{
console.log(“Analysis has opened”);
};

var onError = function(errorCode, description)
{
alert(errorCode + “: ” + description);
};

app.onOpened(onOpened);
app.onError(onError);
wp_doc = app.openDocument(“webPlayerFrame”, “FirstPage”, c_parameters, customization);

//app.openDocument(arg1, arg2, arg3, arg4) arguments
//arg1: This refers to the div component to embed the web player
//arg2: This is optional. Analysis page name as default page to display

}

 

Testing your application

For testing, you could host your page on IIS (Internet Information Services).

  1. Install IIS. Here are some simple instructions on how to do so on Vista / Windows 7.
  2. Host your page on IIS. Please ensure that you change your default port number here to be one that is unused (e.g 90). The default port number is 80 in IIS which is also the default port number for Spotfire server.
  3. Type http://<server>:[port_number]/<application_name> and see that Web Player is embedded into your html page.

Tip: I had some issues running the application due to some permissions issue. In the end, it was resolved by giving access to the folder (where your html page resides) to IIS_IUSRS group.

webplayerlibrary
Web Player is embedded into the <div> component you specified in your html file

You will note that you are able to interact with the filters, markings, editing of analysis etc in your webpage as well.

 

That’s it for today, have fun! ^^

Life is strange review

 

Its been a while since I played video games. I just completed episode 1 of Life is Strange and it has been quite fun so far!

It reminds me of the likes of walking dead / heavy rain if you know them. This one is more chillax as compared to those though. In walking dead /heavy rain, your choices have much bigger consequences such as having main characters die or leave the story line entirely. However, there are still 4 episodes to go, so I may be wrong about this for Life is Strange.

The main difference in Life is Strange is the ability to reverse time. So you kind of can get a glimpse of the near future and reverse your decision on certain actions. However, some have consequences much later in game which by then you cannot revert to change your decisions. I think a nice concept they try to illustrate is about how people in reality moan about the lack of knowledge of the future in order to make better decision, but the fact is, by knowing, it may over burden you instead. As they say, ignorance is bliss.

 

Putting aside the crazy ability to reverse time, it revolves around the life of a high school student and how she encounters the normality of high school life. You make decisions in her everyday encounters while pondering about how certain actions can affect everybody else in your life. I also really like the atmosphere and the soundtracks in this game. It makes you feel part of an artistic film almost.

Can’t wait to play the rest of the game, and perhaps after this, I’ll find a way to get my hands on Beyond: 2 Souls by Quantic Dream. Why can’t they re-produce their games for the PC! I don’t mind Xbox360 either, since I have one :p But before that, I should dedicate some time to complete Walking Dead season 2. Season 1 had me in tears at the end. And don’t judge, because even the most manly male gamers celebrities cried at the end in their video reviews! I swear!