Watson’s New Bluemix Services – Text and Speech

I, and other members on my team, have been using IBM Bluemix to build out services, samples and demonstrations.  You might have seen those features in the Opening General Session at IBM ConnectEd and at Miguel Estrada’s presentation – AD202: Build Your Own Apps in Minutes Leveraging IBM Bluemix and IBM Connections.

As a developer, it’s super easy to add services to an existing application.  There are a few new services that came to my attention (I follow the Bluemix Blog) – the new Watson Services.  Two services in particular seemed like a good playground – Text-to-Speech and Speech-to-Text.

I see many possibilities when you start connecting user generated content (Activity Streams) with these services.  I can’t wait to start playing around with it.

FYI, the documentation is exemplary

IBM ConnectED 2015 – Day Three Questions

Day 3 in Orlando started early – pre first cup of coffee for some of my team.  I joined <a href=”https://twitter.com/russodesigns”>Joe Russo</a>, <a href=”https://twitter.com/miguelestrada”>Miguel Estrada</a>, <a href=”https://twitter.com/tx_kg”>Kirti Gani</a> and <a href=”https://twitter.com/vijfrancis”>Vijay Francis</a> at the IBM Connections Developers ChalkTalk.

The ChalkTalk was very well attended for 7:00 AM on the last day of the conference – partners, customers and developers came with questions, comments and thoughts.

The ChalkTalk had a wide range of questions ranging from User Interface, to tapping IBM Developers, to chats, to OSGI plugins and to our website – <a href=”https://developer.ibm.com/social”>IBM Connections Developers</a>.

After the ChalkTalk, I demoed to a customer the <a href=”https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/Explorer.xsp#”>API Explorer</a> and she had a simple request for a quick curl command to easily see an operational command.  It’s a fair point, and we are considering it for the <a href=”https://github.com/OpenNTF/SocialSDK”>Social SDK</a>.

In Between the ChalkTalk and <a href=”http://www-01.ibm.com/software/collaboration/events/connected/techlabs.html”>Meet the Developers</a>, I answered a few question.

Question:
I have an SBTSDK question.  How do I get the data out of a JsonJavaArray, how do I use it?
Answer:
You can always browse github and search for the java source you’re interested in and find the code.
JsonJavaArray is java lang iteratable.
JsonJavaArray jja = …
for(JsonJavaObject jsonObject : jja){
… process the object …
}

Question:
I ran into an issue with Maven/Liberty and the photosharing app. What can I do to fix?
Answer:
If the user starts the web app on Liberty, and receives the following error in the Liberty Console. SBTFilter class not found.

Then the user should switch to the Error Log in the Eclipse J2EE perspective

Expand the folloing error, click on class path

Click Ctrl + 1 (Quick Fix)

Question:
I have a wiki that I am using via API.  How do I tell if the user has edit capability?
Answer:
The docs describe this well.  The doc uses an enclosure link that rel = edit if the users has the ability to comment or post.

I also helped a partner debug an OAuth Provider issue.  If I get a lesson learned, I’ll post a blog for you all.

I attended the Ask the Developers and the Product Managers. I sat in the front row waiting for an AppDev question that needed my expertise (after looking at the people on the stage that need was near zero).  Did you expect anything less from that session?  I did not.  It was also cool to see <a href=”https://twitter.com/johnpag”>Pags</a> called up to the stage to answer cool domino questions.

From “Ask The”  I went with Miguel to Social File Sharing presentation and copresented with Miguel on our experimental Bluemix service.  More information to come on the developer.ibm.com/social site.

IBM ConnectED 2015 – Day Two Questions

IBM ConnectEd Day 2 was even busier than the first day. I had deep discussion on SAML, OAuth, DB2, SSL, and I’ve incorporated many of them here.

Question 1:
I heard about Profiles Administration. How do I use it IBM Connections Cloud?
Answer:
Before I answer, I think the confusion arises from our documentation which has a Profiles Administration API topic in the reference literature.

There is an alterative API in the IBM Connections Cloud, it’s called the Business Support Systems API (BSS). With the BSS APIs, you (the administrator of the organization) can request a UserID of a User, and choose to update the user’s profile.

We have a fully documented API, and some sample code.
Get the UserId for BSS
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Get_customer_list_by_email_address_or_organization_name_bss&content=apicontent

Update the UserId’s Profile
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Update_customer_profile_bss&content=apicontent

Here are some examples in Java
https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaSnippets.xsp#snippet=BusinessSupport_CustomerManagement_Update_Customer_Profile

https://github.com/OpenNTF/SocialSDK/blob/664db7538cef7e7da02091c865d10bc1c3c9f237/samples/java/sbt.bss.app/src/com/ibm/sbt/bss/app/CustomerManagement.java

Question 2:
Yes, why isn’t there a release of the social business toolkit since August?
Answer:
Actually, there is. it’s posted on github releases. https://github.com/OpenNTF/SocialSDK/releases
Please continue to reference the site and find the latest release information there.

Question 3:
I had a chat with Sedar about the fixes the team added to support Turkish and the IBM Social Business Toolkit. He mentioned that he had a few fixes he’d like to add and a new OAuth Handler. What could/should he do? (granted it wasn’t a question, more of a discussion)
Answer:
It’s opensource. You can fork the github project and do what you’d like to do. You can make a lightweight package, and change the oauthhandler to work the way you need.

Question 4:
I have a great deal of investment in my libraries and core java code. How can I use the Social Business Toolkit?
Answer:
If you’ve made the investment like this partner, the best answer is to look at the XPath Expressions and reuse the enums from the social business toolkit to limit the amount of mastery needed for ATOM/XML processing.

Question 5:
IBM Connections is making an AJAX Proxy request to a backend service. I continue to have problems with SSL. How can we figure this out?
Answer:
A very helpful post from StackOverflow has helped debug an issue and retrieve all the right client certificates. http://stackoverflow.com/questions/17203562/openssl-s-client-cert-proving-a-client-certificate-was-sent-to-the-server

Thanks to a post on StackOverflow all you have to do is:
openssl s_client -connect : -showcerts

Copy the generated certificates into CRT files and add to the CellDefaultTrustStore.

Question 6:
SSL is causing me heartburn. How can I debug SSL issues to see that the CA is accepted?
Answer:
Here are the 8.5.5 directions http://www-01.ibm.com/support/docview.wss?uid=swg21162961#show-hide
Specify the javax.net.debug system property:

In the Administrative Console, select the following: Servers > Server Types > WebSphere Application Servers > server_name > Expand Java and Process Management (under Server Infrastructure) – >Process Definition > Java Virtual Machine > Custom Properties > New.

To trace the Deployment Manager, select the following: System Administration > Deployment Manager > Expand Java and Process Management (under Server Infrastructure) >Process Definition > Java Virtual Machine > Custom Properties > New.

Type the following:

Name: javax.net.debug
Value: true
See NOTE at the end of this document for very busy production servers.
Click Apply, and Save.

Save your changes to the master configuration.

Expand TroubleShooting > Logs and Trace > server_name.

Select Diagnostic Trace Service. Increase the Maximum Number of Historical Files from 1 to 10.

Click Apply, then select Change Log Detail Levels.

Clear the trace string in the box and replace it with the following trace string:
SSL=all

Click Apply, and Save.

Save your changes to the master configuration.

Stop the server and clear/backup the logs.

Start the server and recreate the problem.

Note: The output will be in the file specified in Servers > Server Types > WebSphere Application Servers > server_name > Logging and Tracing > JVM Logs. The default is set to the SystemOut.log file and trace.log

Question 7:
How can I tell the vitality of the Social SDK project?
Answer:
IBM doesn’t disclose any private data on customer use of a project without using the proper channels and approvals. However you can look at project statistics to tell specific details. https://github.com/OpenNTF/SocialSDK/graphs/contributors and https://github.com/OpenNTF/SocialSDK/network

You can also see the latest releases on the releases page – https://github.com/OpenNTF/SocialSDK/releases and you can also pull the code from Maven.

Question 8:
We have an application that reads blogs, how do we know if a user has the right to write to a Public blog?
Answer:
Look for the link node and if they have access to the rel=edit, they have access. Thanks to Vijay Francis for the tip

Question 9:
I have developed some custom OAuth Code to refresh bearer tokens. The system doesn’t make subsequent requests properly after the calls. What do I have to do?

CachedDBToken 3 com.ibm.ws.security.oauth20.web.OAuth20EndpointServlet.TokenRequest result is bad
com.ibm.oauth.core.api.error.oauth20.OAuth20InvalidTokenException: The token with key: lKItvXpeGtZiDb9RvV9Xw6IDJIcZIdIpIEKjhy3QlhetPUl4F9 type: authorization_grant subType: refresh_token was not found in the token cache.
at com.ibm.oauth.core.internal.oauth20.OAuth20ComponentImpl.getOAuth20Token(OAuth20ComponentImpl.java:846)

Answer:
Enable tracing on OAuth and the JDBC Requests
http://www-10.lotus.com/ldd/lcwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.0+documentation#action=openDocument&res_title=Installing_and_enabling_OAuth_TAI_ic40&content=pdcontent

The partner also needed to change the refresh token step so the token was slightly modified.

Question 10:
How do I get started with the Social SDK?
Answer:
You can download the latest social business toolkit
https://github.com/OpenNTF/SocialSDK/releases
You download and expand the zip file.

The getting started page is https://github.com/OpenNTF/SocialSDK/wiki/Building-my-first-Social-Application

You can also reference https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaScriptSnippets.xsp to play around with the code, and see what cool things you can do.

If you have any questions you can post to StackOverflow or email me directly.
http://stackoverflow.com/questions/tagged/ibm-connections

Question 10:
We have developed Editor enhancements for other products, how do we do this in Connections?
Answer:
Check out Rob Novak’s Blog
http://ibmrockstar.com/2013/05/tutorial-extending-the-ibm-connections-rich-text-editor/

Question 11:
It was a pain to find the connections provider urls for OAuth?
Answer:
The URLs are formatted liked the following:
https://lcauto1.swg.usma.ibm.com/oauth2/endpoint/connectionsProvider/authorize
https://lcauto1.swg.usma.ibm.com/oauth2/endpoint/connectionsProvider/token

IBM ConnectED 2015 – Day One Questions

Question: Setting up the WidgetContainer for Profiles Administration page
you can follow this link, it goes into setting up a ficticious company called Acme Airlines’s application. you can ignore that part and focus on the nice steps and pictures which show you how to configure and setup an administrator with the profiles Administration page.

http://www-10.lotus.com/ldd/appdevwiki.nsf/dx/Setting_up_Acme_Airlines_SDK1.0?OpenDocument&sa=true

Question:
you can test all your OpenSocial gadgets using the BootStrap homepage.
an example URL is
https://sdkdemo.swg.usma.ibm.com:444/connections/resources/web/com.ibm.lconn.gadget/test/bootstrap.html?render=test&oneui=3

You are most likely going to get back a warning saying, Featured Disabled

In just a few steps you can enable it on your system.

On your deployment manager profile, open config/cells//LotusConnections-config/opensocial-config.xml
eg
/local/st/opt/IBM/WebSphere/AppServer/profiles/STPDMgrProfile/config/cells/quickstartmasterProxyCell/LotusConnections-config/opensocial-config.xml
Edit the File
and look for


make sure enabled is true, allowSSOFeature is true, and allowIntranetProxyAccess is true.
Also set allServers=true

Sync the Nodes so the config goes down to Your AppServer, and then Restart the AppServer.

That should help get you started building and quickly testing the opensocial gadgets.

Also with regards to dynamic heights javascript. We can certainly talk about the limitations in IBM Connections (I think we limit a Gadget to a width of 375px) I don’t think we have any limitations on the height. do the required parameters for dynamic-height should be honored.

MAS202 Customizing IBM Connections

Here is my latest Presentation

I uploaded my latest edition of my presentation on Jan 26

I also recommended Terri Warren’s session BP206 to go into auth and directory specifics. It’s on Monday at 1 pm.

Questions asked of me were :
Question: Setting up the WidgetContainer for Profiles Administration page
you can follow this link, it goes into setting up a ficticious company called Acme Airlines’s application. you can ignore that part and focus on the nice steps and pictures which show you how to configure and setup an administrator with the profiles Administration page.

http://www-10.lotus.com/ldd/appdevwiki.nsf/dx/Setting_up_Acme_Airlines_SDK1.0?OpenDocument&sa=true

Question: enabling tests with gadgets
you can test all your OpenSocial gadgets using the BootStrap homepage.
an example URL is
https://sdkdemo.swg.usma.ibm.com:444/connections/resources/web/com.ibm.lconn.gadget/test/bootstrap.html?render=test&oneui=3

You are most likely going to get back a warning saying, Featured Disabled

In just a few steps you can enable it on your system.

On your deployment manager profile, open config/cells//LotusConnections-config/opensocial-config.xml
eg
/local/st/opt/IBM/WebSphere/AppServer/profiles/STPDMgrProfile/config/cells/quickstartmasterProxyCell/LotusConnections-config/opensocial-config.xml
Edit the File
and look for




make sure enabled is true, allowSSOFeature is true, and allowIntranetProxyAccess is true.
Also set allServers=true

Sync the Nodes so the config goes down to Your AppServer, and then Restart the AppServer.

That should help get you started building and quickly testing the opensocial gadgets.

Also with regards to dynamic heights javascript. We can certainly talk about the limitations in IBM Connections (I think we limit a Gadget to a width of 375px) I don’t think we have any limitations on the height. do the required parameters for dynamic-height should be honored.

I am also including my demonstration notes.

Debug JavaScript
1 – Navigate to https://connections.imaginnado.com
2 – Open Firebug Debug Console
3 – Go to the Homepage https://connections.imaginnado.com/homepage/web/gettingStarted/
4 – add https://connections.imaginnado.com/homepage/web/gettingStarted/?debug=true
* notice how the page loads every module individually
5 – Expand the JavaScript and look at the Console

Business Cards
1 – Navigate to https://localhost:9443/customization.demo/person.html?debug=true
2 – Two different Views, and you can do this via simple html
3 – Switch to Eclipse

4 – Navigate to https://localhost:9443/customization.demo/community.html?debug=true
5 – Leave the Firebug Console Open
6 – Switch to Eclipse

OpenSocial and iWidget Demo
1 – navigate to Homepage
2 – Click Administration
3 – Add Gadget
4 – Enter the URL http://connections.imaginnado.com/helloworld.xml
select updates page and my page
* note I disabled whitelisting for this demo
5 – Click Save
6 – Click Enable
7 – Go to the Updates Page

File is from…
https://api.github.com/repos/OpenNTF/SocialSDK/contents/samples/j2ee/snippets/com.ibm.sbt.sample.web/src/main/webapp/samples/gadgets

Homepage
1 – Navigate to http://connections.imaginnado.com/homepage/web/updates/#myStream/imFollowing/all
2 – Click Administration (only available to Frank Adams)
3 – Find the Events Widget
4 – Click Disable Widget
5 – Login to see that the Events Widget is not available to LSuarez
6 – You can see that the Events Widget is removed for LSuarez
7 – We could have added a Gadget to everyone’s page by clicking “Open by Default”

Org Extensions
1 – Navigate to http://connections.imaginnado.com/cloudBanner.html
* notice no menu, then we need to login
2 – Login to https://apps.collabservnext.com/homepage/web/updates/#myStream/imFollowing/all
3 – Switch back to cloudBanner.html (Refresh the page)
4 – Show the New Menu Bar + Chosen Theme

My Introduction to Liberty and WebSockets

Recently, I’ve been turned on to IBM WebSphere Libertysuper fast and highly configurable Application Server Runtime.  The runtime requires Java 7.0 to get access to the latest features to build web applications, OSGi applications and EJBs.

Two features caught my eye were Java Servlet 3.1 and Java API for WebSocket 1.0.  The WebSocket component (JSR356) in combination with the Servlet 3.1 component offer a super foundation for realtime web applications.  The WebSocket is superbly interesting as it’s “full duplex, long-lived” (per the blog).   Make that 3 features, I forgot the JSON-P feature

I just had to play around and investigate the websockets component. I setup the Eclipse environment with the WebSphere Liberty Profile. I then setup a Maven Project for Liberty.

Click File > New Maven Project
Select Use Default Workspace Location
Click Next
Select the http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository Catalog
Select the com.ibm.tools.archetype webapp-jee7-liberty
Click Next

Maven Achetype
Maven Achetype

Enter a Group Id: com.ibm.ess.appdev.liberty
Enter a Artifact Id: demo
Enter Package: com.ibm.ess.appdev.liberty
Click Finish

Archetype Parameters
Archetype Parameters

If you find an error after creating the project, such as:

ArtifactDescriptorException: Failed to read artifact descriptor for com.ibm.tools.target:was-liberty:pom:LATEST: VersionResolutionException: Failed to resolve version for com.ibm.tools.target:was-liberty:pom:LATEST: Could not find metadata com.ibm.tools.target:was-liberty/maven-metadata.xml in local (/Users/paulbastide/.m2/repository)
pom.xml error
pom.xml error

Open the pom.xml
Copy the following snippet to the pom.xml
Click Save

 <repositories>
 <repository>
 <id>maven online</id>
 <name>maven repository</name>
 <url>https://repo1.maven.org/maven2/</url>
 </repository>
 <repository>
 <id>liberty maven online</id>
 <name>liberty maven repository</name>
 <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
 </repository>
 </repositories>

Right Click on the demo project, and go to Run As -> Run on Server

Select Manually define a new server
Expand IBM
Select WebSphere Application Server Liberty Profile
18015657

Click Next
Select Install from an archive or a repository
Leave the default JRE selected
Click Next

Runtime Environment
Runtime Environment

Enter a Destination Path, such as /Users/paulbastide/Desktop/liberty
Select Download and Install a New Runtime Environment from Liberty Repository
Select Liberty Profile Beta Runtime
Click Next

Install the Runtime
Install the Runtime

Click Next

Select I accept the terms of all the license agreements

Click Next

Leave the defaults
Click Next

You should see demo under configured
Click Finish (It could take a few minutes to download the entire profile)

Once complete you’ll see the notice that it was installed successfully.

Success
Success

Let’s setup the server part.

Click on the Servers tab
Expand WebSphere Application Server Liberty Profile at localhost
Double Click on Server Configuration

Configuration
Configuration

Click Source
Add Children to the Feature Manager
<feature>servlet-3.1</feature>
<feature>websocket-1.0</feature>

Feature Manager
Feature Manager

Click File > Save

The server is setup to host our WebSockets.

Expand Java Resources > src/main/java > com.ibm.ess.appdev.liberty
Right Click the Package
Create a new Java Class (extending java.lang.object) – DemoEndpoint.java

Add the Framework for the Annotations

 @ServerEndpoint sets the path at which the websocket is hosted, and can contain a macro/text replacement like common JAX-RS code
 @OnOpen - start of the session
 @OnMessage - when there is a message in the session
 @OnClose - when the session is closed
 @OnError - when there is an error related to the ongoing session
 @ServerEndpoint(value = "/DemoEndpoint/{channel}")
 public class DemoEndpoint {
@OnOpen
 public void open(Session session, @PathParam("channel") String channel) {
}
@OnMessage
 public String message(String message, Session session, @PathParam("channel") String channel) {
 String result = "";
return result;
 }
@OnClose
 public void close(Session session, CloseReason reason) {
}
@OnError
 public void error(Throwable t) {
 t.printStackTrace();
 }
 }

I’m not going to extend open/error or close, and just going to focus on the message part.

Let’s do a simple channel based echoing.

Replace the method – message with the following java

 String result = "" + channel + " " + message;
 System.out.println("Message: " + message);
 return result;

Expand src > webapp
Right Click on webapp
Create a new HTML Page – demo.html

Replace the HTML page with the following Content

 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="UTF-8">
 <title>Insert title here</title>
 <script type="text/javascript">
 var socket = new WebSocket("ws://localhost:9080/demo/DemoEndpoint/vampire");
function sendMessage(){
 socket.send("example data");
 }
socket.onmessage = function (event) {
 document.getElementById('content').innerHTML = document.getElementById('content').innerHTML
 + "<br/>"
 + event.data;
 }
</script>
 </head>
 <body>
 <button onClick="javascript:sendMessage()">Send Sample Content to Channel
 </button>
 <div id="content">
 </div>
 </body>
 </html>

Navigate to http://localhost:9080/demo/demo.html
Click Send Sample Content to Channel

Demo
Demo

I plan on playing around with the code more, and see what I can really do with WebSockets, they offer a lot of potential (specifically with Handlers).

I am going to have to play around with error handling and sending messages across multiple sessions/users/authentication.

Some good reference articles are:

WebSphere Liberty – WebSockets Maven and WebSphere WebSocket Sample
WASDev Planning Poker WebSockets Sample WebSockets Overview WebSockets Overview From Mozilla
StackOverflow Maven Repositories Question Derby WebSockets Java Code
Configure Liberty Profile WebSockets and Liberty Overview WebSocket Cookbook

Mastering Firebug NetListener

In more recent versions of Firebug, the developers pulled out the integrated Firebug trace function.  If you want the functionality, you should install the FBTrace Extension; it’s almost required if you want to develop a Firebug Extension. The FBTrace Extension is at https://getfirebug.com/wiki/index.php/FBTrace 

I built an extension following the following tutorials and code:

http://www.softwareishard.com/blog/firebug-tutorial/extending-firebug-hello-world-part-i/
http://www.softwareishard.com/blog/firebug-tutorial/extending-firebug-net-panel-listener-part-viii/
https://code.google.com/p/fbug/source/browse/examples/firebug1.4/netlistener/chrome/content/netlistener/netListener.js
https://github.com/firebug/firebug/blob/4ced8f9cbf05ddd901aeb99895c9270abbf5d29a/extension/content/firebug/net/netUtils.js

The extension logged out the details of API requests to specific applications and filtered on those requests so I could debug an issue when loading multiple of them on the same page.

A couple tips for developers using the NetListeners are:

The url and parameters are in file.href
The method is file.method
The headers are an array which can be retrieved from file.requestHeaders property.  Each object is a name – value pair. header.name / header.value.
The requestBody is really file.postText
The responseBody is best returned using netUtils.js context.sourceCache.loadText(file.href, file.method, file)