Author: <span>kenio.carvalho</span>

Command line tools are always welcome.  Today i need to setup my MAC to work with IBM Cloudant

Install curl on your MAC if you haven’t done it yet.

1 – You need to setup the Cloudant DB using your IBM Cloud account.

2 – Go to service credentials and get your username, password and hostname

Sample:
"username": "xxxx-xxx-xxx-bluemix",
"password": "12345678901234567890",
"host": "xxxx-xxx-xxx-bluemix.cloudant.com"

3 – Test the connection

curl –v –u xxxx-xxx-xxx-bluemix 'https://xxxx-xxx-xxx-bluemix.cloudant.com'

The command will prompt for the password: 12345678901234567890

You will see a lot off lines but pay attention on the line Authorization: Basic. This will be used to setup acurl (authorized curl) to avoid type the password every time you use curl.

* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Server auth using Basic with user ‘xxxx-xxx-xxx-bluemix’
* Using Stream ID: 1 (easy handle 0x7fabd0805800)
> GET / HTTP/2
> Host: xxxx-xxx-xxx-bluemix.cloudant.com
> Authorization: Basic asddadasdDASDdaDadaDSERQERQRQERQEDSGSFDGSFDG==

4 – Edit the .bash_profile or .bashrc file in any text editor. For example, from the command line, issue the following command:
open –e .bash_profile

5 – Add the following line to the file, then save the file.
alias acurl="curl -s --proto '=https' -g -H 'Authorization: Basic asddadasdDASDdaDadaDSERQERQRQERQEDSGSFDGSFDG=='"

6 – On the terminal run : source .bash_profile

7 – Issue a command using the new alias. For example, issue a command to view your account information.
acurl -X GET 'https://xxxx-xxx-xxx-bluemix.cloudant.com'

TIP: The hostname is not friendly you can edit your hosts file and create an alias:

On MAC terminal type: sudo vi /etc/hosts

ping your hostname to get the ip address

add a line like this one bellow:

<ip address>  xxxx-xxx-xxx -bluemix.cloudant.com  keniodb.cloudant.com

Save the hosts file

test the connection

acurl -X GET 'https://keniodb.cloudant.com

 

Linux MAC

I meet several people when i was in Las Vegas. No one know about my city until i talk about 2014 Soccer World Cup and tell about Germany 7 x 1 Brazil game.

The video bellow,  show another face of the city.

Uncategorized web

For professionals who bill on an hourly basis—lawyers, accountants, and so on—time tracking is a critical part of the billing process.

A time-tracking tool that allows them to easily enter work hours and obtain summary reports at the end of the week or month is of critical importance.

In this tutorial, you will see the process of building a simple time-tracking tool and deploying it on IBM Cloud.

 

Comunidade

Today i got the following error when i install watson python sdk on my MAC:

I use the command :  sudo pip install watson-developer-cloud

The exception was:
Traceback (most recent call last):
File “/Library/Python/2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/Library/Python/2.7/site-packages/pip/commands/install.py”, line 342, in run
prefix=options.prefix_path,
File “/Library/Python/2.7/site-packages/pip/req/req_set.py”, line 778, in install
requirement.uninstall(auto_confirm=True)
File “/Library/Python/2.7/site-packages/pip/req/req_install.py”, line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File “/Library/Python/2.7/site-packages/pip/req/req_uninstall.py”, line 115, in remove
renames(path, new_path)
File “/Library/Python/2.7/site-packages/pip/utils/__init__.py”, line 267, in renames
shutil.move(old, new)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 299, in move
copytree(src, real_dst, symlinks=True)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 208, in copytree

Solving the problem:

sudo -H pip install –ignore-installed six watson-developer-cloud

After a few seconds:

Successfully built watson-developer-cloud Twisted zope.interface pycparser
Installing collected packages: six, certifi, chardet, idna, urllib3, requests, python-dateutil, txaio, autobahn, setuptools, zope.interface, constantly, incremental, attrs, Automat, hyperlink, Twisted, pycparser, cffi, enum34, asn1crypto, ipaddress, cryptography, pyOpenSSL, pyasn1, pyasn1-modules, service-identity, watson-developer-cloud

watson

IBM Watson Assistant is named as a Leader in conversational computing. It has become increasingly important for businesses to build engaging interactions that deliver value to their customers, and IBM is proud to offer technologies that help developers and enterprises enhance those experiences.

The report evaluated the most significant conversational computing platforms, diving into each vendor’s current offering and strategy and including customer feedback.

I always work with IBM Watson Assistant to create Virtual Assistants, since the name was “dialog”.  This service is my first option to create conversational applications.

More information on this link

Uncategorized

Today i need to rename lots of files from .txt to .json.   I type the following on the terminal window:

for f in *.txt; do
mv "$f" "$(basename "$f" .txt).json"
done


MAC

You can enable Cross Origin Resource Sharing (CORS) for your web applications on a Liberty server.

Enabling CORS will allow JavaScript clients to make requests against your application on the Liberty server even if the client and the server are on two different domains. Web browsers prevent these requests due to same-origin policy.

I create the following configuration on my local machine  on server.xml file:

<cors domain="/ApplicationContext" <-- application context. It will work only for this app.
   allowedOrigins="http://localhost:8080"  <-- this is my local Node.js Server.
   allowedMethods="GET, HEAD, POST, PUT"
   allowedHeaders="Referer, Cache-Control, Pragma, Accept, Accept-Language, Accept-Encoding, Accept-Charset, Content-Type, Content-Length, User-Agent, Authorization, passwd, X-Update-Nonce, X-Shindig-ST, X-IC-CRE-Request-Origin, X-IC-CRE-User, X-LConn-Auth, Accept*, Content*, Access-Control-Allow-Origin*"
exposeHeaders="Content-Type, Last-Modified, etag"
allowCredentials="true" maxAge="3600" />

web WebSphere

A week ago I participated in the Global Legal Hackathon as a mentor to several startups.

The Global Legal Hackathon engages law schools, law firms and in-house departments, legal technology companies, governments, and service providers to the legal industry – across the globe.

It  bring together the best thinkers, doers and practitioners in law in support of a unified vision: rapid development of solutions to improve the legal industry, world-wide.

My city, Belo Horizonte was one of the hosts in Brazil.  Two startups i mentored, to use IBM Watson, was classified in second an third place.

Next week will be the second round to select ideas to the final event in New York.

 

Uncategorized

I received an e-mail from HCL Support  (IBM) about a problem with the interin fix.

The e-mail and later a call from the support told me to download the fix again and if in case i was installed the fix how to remove and install the good one.

The problem was with the fix files from last week. The files was updated with the ones above.

“I would like to notify you because  we found a problem with this Interim Fix. The problem discovered and that the fix can’t be uninstalled properly, which can cause problems later when a new hotfix or interim fix is applied on him.”

1- Download the new IF1 files
W64        901FP10HF66_W64.exe        http://www.ibm.com/support/fixcentral/quickorder?product=ibm%2FLotus%2FLotus+Domino&fixids=DominoServer_901FP10IF1_W64&source=SAR
W32        901FP10HF68_W32.exe        http://www.ibm.com/support/fixcentral/quickorder?product=ibm%2FLotus%2FLotus+Domino&fixids=DominoServer_901FP10IF1_W32&source=SAR

2- Shutdown the Domino server

3 – Copy nstrings.dll to your domino Server

4 – Install the new interin fix.

Uncategorized

I start a new java project on eclipse using the SDK for Watson.
When i try to connect on any watson service i got the error:

CWPKI0022E: SSL HANDSHAKE FAILURE: A signer with SubjectDN CN=*.watsonplatform.net, O=International Business Machines Corporation,
L=Armonk, ST=New York, C=US was sent from the target host

This error means, that the local Liberty trust store does not have the correct signer certificate from the remote WATSON website where you tries to connect to.
It’s a certificate error. To solve the problem on my MAC i just do the following:

1 – Download the cetificate. The easy way i found was:

openssl s_client -host https://gateway.watsonplatform.net -port 443 -prexit -showcerts

2 – Create a text file with the first certificate

3 – Import the certificate on the truststore

keytool -import -alias watsonsigner -file cert1.pem -keystore /Users/[pathto key.jks]/key.jks -storepass password -storetype jks

watson