All Things Techie With Huge, Unstructured, Intuitive Leaps

Getting SSO to work

We recently decided to use for our help desk, knowledge base etc.  Since we want our knowledge base to be private for clients only, Freshdesk requires a login.  We don't want to make our clients log in twice, so Freshdesk has this SSO or Single Sign On token system.

We use Java, and there was a java servlet showing how to sign on with a token.  However the online java in a repository didn't quite work.

Here is a working Java servlet for the Freshdesk SSO token system:

import java.math.BigInteger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.application.User; (replace with your own user bean)

public class FreshDeskSSOServlet extends HttpServlet {

private static final long serialVersionUID = 7027717204177362374L;
private final String BASE_URL = "baseUrl including trailing slash" + "login/sso";
private final String sharedSecret = "put in shared secret";


public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

try {
String url = this.getSSOURL();
} catch (Exception e) {

private static String getHash(String text) throws Exception {
    MessageDigest m=MessageDigest.getInstance("MD5");
    return ""+new BigInteger(1,m.digest()).toString(16);

private String getSSOURL() {

String hash = null;
String url = null;
User user; //Get the user details using your current authentication system
String name = "First & Last Name";// Full name of the user
String email = "";// Email of the user
try {
hash = getHash(name + email + sharedSecret);
} catch (Exception e1) {

try {
name = URLEncoder.encode(name);
email = URLEncoder.encode(email);
url = BASE_URL + "?name="+name+"&email="+email+"&hash=" + hash; 

}catch (Exception e) {
//Handle appropriate code
System.out.println("There is an exception while constructing the URL");

return url;


Hope this helps.

Javascript Evaluation Errors in Eclipse

I have a big huge app developed in Eclipse Juno.  The app has a lot of stuff including some jQuery and other javascript frameworks.  Every time that I do a build, I get errors in the Problems tab.  When I look at them, they are all errors that Eclipse says that I have in the Javascript libraries, yet they work fine.  So what to do?

The obvious thing is to turn off the javascript evaluation in Eclipse.  This is how you do it:

  1. Right click your project
  2. Select Properties -> JavaScript -> Include Path
  3. Select Source tab. ( It's identical to Java Build Path Source tab )
  4. Expand JavaScript source folder
  5. Highlight Excluded pattern
  6. Click Edit button
  7. Click Add button next to Exclusion patterns box. (You can either use Ant-style wildcard patterns or click Browse button to mention the JavaScript file by name).
Hope this helps someone.


I take a lot of pictures.  A camera is never very far away from me.  I lead an eclectic life and I travel a lot.  I have lived in a lot of neat places.  I have a huge amount of pictures.  Some are good.  I decided that I might as well monetize my pics. I would sell them as stock photos.  Shutterstock seemed the place to do it.  They seem to charge the most for stock photos to consumers.

The first step is signing up.  No problem.  Took seconds to do. Then they want 10 of your best shots to evaluate.  I figure that most of my work is very good, so I picked 10 at random from a day's worth of shooting.  Here are my ten photos:

These are all high res, so you can click on any of them to get a larger version.

I figured that these ten photos were good enough to get me accepted as a photographer on the site.  Some of them may not be very marketable as stock photos, but they do demonstrate artistic and technical quality.

OK, so I had my portfolio.  The next step was the deal killer for me.  They wanted me to upload a piece of official government identification.  Not on your frigging life.

Every since LinkedIn was hacked and I found my password on the hacked site, do I trust anyone with my identity.  To upload a document like that is anathema to me. I am a crusader for data privacy.  I simply do not trust them with my info.

And when I saw the royalties (you can google them), I decided that was not for me.  The deal killer was them wanting identity information in the form of government documentation.  No thanks.  Live Free or Die.

By the way, all images are copyrighted by me.

Typepad Major Outage this Weekend

This weekend, I went to read one of my favorite blogs, and I got a 404 not found error.  Since this blog is slightly political, and somewhat critical of the government in a banana republic, I was concerned because the owner is also a friend of mine.  This is the government that arrested a prosecuted an activist who posted the picture of a person who died while suffering injuries in police custody.  Yes, the Bahamas is that country, and corruption and political interference in basic freedoms (speech, sexual orientation, equality of women) is a fact of life there.

As it turns out, Typepad was down with a major outage for the weekend.  They did have Twitter reports as to their status.  I feel better about my software bugs when major sites screw up.

I had to laugh at Typepad though.  They had this disclaimer:

This page ( is currently offline. However, because the site uses CloudFlare's Always Online™ technology you can continue to surf a snapshot of the site. We will keep checking in the background and, as soon as the site comes back, you will automatically be served the live version. Always Online™ is powered by CloudFlare | Hide this Alert

The CloudFlare thing didn't work. So much for CloudFlare. Here is a worse one for you though.  Since I was worried about my friend who is the author of the blog, I went to a website to check if TypePad was up or down.  The website is  I queried it about TypePad.  They said that TypePad was up -- possibly because the server was able to deliver a 404 HTTP error.  That was useless.

Calling A MySQL Stored Procedure From The Command Line With Output Parameters

I had a junior programmer ask me how to do stored procedure calls from the MySQL command line that had output parameters.  It had stumped him, and he had no other choice but to use the command line instead of a GUI tool, because he was working remotely on a Linux server.

Here is how to do it.  Suppose that the stored procedure has two input parameters and two output parameters.  Here is the syntax:

call doStoredProcedure('param1', 'param2', @t, @s);
select @t, @s;

The second line retrieves the output of the stored procedure.

Hope this helps someone.

Very Cool Gear and iOS app -Tile

OK, I gotta admit that this is very cool.  It works on bluetooth and networking.  Unfortunately it doesn't work with my beloved Android.  More information is here: