Confluence Profile Photo Uploader

wommSmall disclaimer: this works great on my setup. I have not tested it outside of my setup. It should work just fine as I am using the standard API’s that come with Confluence, but it is an open source project and I’m not getting paid for it, so I haven’t done extensive testing in all scenarios.

At the Vancouver Clinic we use a wiki product called Confluence. It is a fantastic product that is super customizable via add-ons, extensions, custom html/js/css, and SOAP and REST APIs.

Unfortunately, Confluence does not have a way for administrators to bulk upload user profile photos into it. For corporate organizations that want to make sure that user photos are uniform and professional this is somewhat cumbersome. As a result Confluence may have user profiles with Mickey Mouse, Wolverine, or worse as the photo … don’t get me wrong Wolverine is pretty cool, just not professional.

cppuBecause of this I decided to write a utility that allows an administrator to sweep in photos in a specified folder with a file mask of “%username%.%extension%” into Confluence. The utility will accept .jpg, .jpeg, .tif, .tiff, .png, and .bmp files. Optionally, you can specify a folder to archive the swept-in photos to after they have been uploaded. Confluence profile photos are 48×48 pixels and since most photos are not square the utility will attempt to do face detection and crop the photo to the largest face in the photo. If the photo is already square you can opt to have the utility not perform the face detection. I am personally not smart enough to write face detection algorithms, so I am using EMGU/OpenCV to do the face detection (which is why the compiled version is so freakin big). Hey, I got no problem standing on the shoulders of giants.

For automation purposes there is a command line switch /headless that will do the upload without any GUI using the configured settings. This works great with Windows Task Scheduler.

This is working awesomely for the clinic and fortunately my manager has allowed me to open source the code. So, I have uploaded it to Bitbucket for anyone to use, or make fun of my code. : ) Seriously, have at it if it will help your organization. And by all means let me know if there you run into any bugs along the way.

https://bitbucket.org/fredclown/confluence-profile-photo-uploader/

Confluence Speakeasy Favorite Menu Extension

So, lately I’ve been doing a lot of customization at work on a product we use called Confluence. It is quite possibly the slickest wiki I have ever used. It has an awesome plugin model and pretty huge market for community developed plugins. One plugin that Atlassian has created allows for creating modular client based extensions to the wiki. It is called Speakeasy.

menuI happen to have a few favorite pages in the wiki that I refer to all the time and I have been wanting a favorite menu that shows up on every page. Alas, I couldn’t find one that existed, so I decided to make my own.

Feel free to download the extension and modify it to your needs.

Update:
I have released this on the Atlassian Marketplace for free.

Leap Motion – A Review

So, I want the Leap Motion to be this awesome thing that makes my computer word kinda like Minority Report. I really want it to be a totally new way of using my machine that doesn’t just replace the keyboard and mouse but can enhance it much the same way that touch interaction has these day. Unfortunately, I just can’t say that right now.

So far it has been kind of a let down … especially the apps that are geared toward native computer interaction. So far the app that Leap has put forward is just way too hard to use. It is super difficult to figure out in 3D space where to put you hand so that you get a cursor on your monitor, and once you have done that actually pointing at something and “clicking” it is super painful. I have to go so slow that it makes it worthless to use. I was hoping that they would give you the ability to calibrate the Leap to the position of your monitor and they in essence allow you to use your monitor as a touch screen … thus making it much more easy to accurately “click” on things and interact with the native OS. Similar to this Youtube video. Alas, they went for the 3D air clicking approach which just doesn’t work.

Granted this is a new device and hopefully it will continue to get better. I do hope that someone decides to create an app that lets you turn ordinary monitors into touch screens … maybe I’ll work on it. :)

Kid Browser

Desmond always amazes me as to how much he can grasp. Kids are such sponges and they can do way more that we think they can do. For example we let him go to a few websites that we have deemed safe for him to look at. I am amazed that he picks up how the games work without Melissa or I telling him how to do them. He has gotten really good at using the mouse.

wommAnyway, occasionally we would let him look at these sites and then later we would find that he minimized the browser and Quicken or something else that we didn’t want him messing with was up on the computer. So, I decided to make a web browser specifically tailored to his age so that he can only go to the sites that we say are ok and he cannot click out of them into anything else. Also, I didn’t want him to easily be able to minimize the browser or close it. Thus, KidBrowser was born.

I don’t claim that it is any great work of programming, and it could probably be more visually appealing, but I am no graphic designer. Anyway, if you have kids and you want to use it yourself feel free to grab a copy and set it up on your machine. I don’t claim that it will work perfectly on your machine. I have only tested it on my box, which is a Windows 7 machine. However, if you have issues let me know and I will try and fix it.

I have created a bitbucket project for this browser, so feel free to download the source and make fun of my coding abilities if you want to.  Links and screenshots are below.

Bitbucket Project
https://bitbucket.org/fredclown/kidbrowser/wiki/Home

Latest Compiled Version
http://bit.ly/sfdF4P

This is what the browser looks like. The left navigation is the web pages that we have deemed are ok for him to look at. You can add as many as you like.  If you add more than will appear in the column you will see scroll arrows appear so that you can scroll the nav.

KidBrowers

This is the config module.  You can use this to add sites to the navigation menu. Currently, I suggest using the Gecko browser option as IE seems to have an issue with at least one site I that I know of, Disney Junior.  The configuration module isn’t pretty and I will probably work on it a bit more, but I wanted to get something made so that the browser could be easily configured. I think most everything is pretty self explanatory. There are a couple things that I will explain below.

Config

Resolves To:
This is mainly used in conjunction with the “Allow Sub-links” checkbox. Sometimes if you put in a web address it will redirect you to another page. For instance if you put in http://www.disney.com it might redirect you to http://go.disney.com. If you have allow Sub-links checked and your “Site URL” is set to http://www.disney.com then you would be able to visit any links that start with http://www.disney.com, unless specifically blocked in the block section.  However, if the site automatically redirects the home page to something else such as http://go.disney.com then in order to get all of the pages under http://www.disney.com and the home page http://go.disney.com you would need two different entries. That is why implemented the “Resolves To” so that the browser will consider the redirected first page to be apart of the rest of the site.

Allow Sub-links:
This will allow any pages that start with the “Site URL” to be viewed.  Thus is the “Site URL” is http://www.disney.com, then http://www.disney.com/junior would be available as well.

Blocked Sites:
Blocked sites take precedent over the Allowed Sites.  By default everything is blocked except what is specifically allowed.  However, if you allow sub links for a certain site there may still be a couple undesirable pages. You can block these pages specifically. Additionally you can block sub pages or any pages that start with a certain URL. Thus, if http://www.disney.com/junior was allowed with sub-links, you could block the Winnie the Pooh video page by putting in http://www.disney.com/junior/winniethepooh/video for a blocked url. If you clicked “Block Sub-links” then anything under http://www.disney.com/junior/winniethepooh/video would also be blocked … such as http://www.disney.com/junior/winniethepooh/video/theblusteryday.

Finding the Character Set For a SQL Field

The other day I was working on a project and I needed to know all of the different types of characters contained in a SQL field so that I could make a regular expression pattern that would not fail. Thus, I decided to write a stored procedure that would loop through a range of characters and test if that character is contained in a specified field in any records. From there I can get a list of all of the used characters and then more intelligently write my regular expression pattern.

This could also be handy if you are trying to cast a field and you keep getting errors because of a character that won’t cast correctly. An example would be trying to cast a varchar or char field into an int and for some reason or another one of the records has a letter in the field. Your cast will fail and it can be tricky to track down where the issue is. With this stored procedure you can quickly see what the offending character is and then query up all the records containing that character.

Example usage:

Feel free to use this if you find is useful, and leave a comment letting me know if it worked well for you.

 

Convert CSV data into a SQL table

Recently I have been working with some report data that is stored statically in a database in CSV format. I had a need to have that CSV data displayed in a tabular format. I searched around and couldn’t find anything written to do this in SQL, so I decided to write a stored procedure to do this very thing. It will take a CSV and parse it out into a SQL table. For instance if I have report data that looks like this…

It would be transformed into this …

FIRSTNAME LASTNAME DOB CHILDREN
John Smith 1/5/1980 Bob,Sally,Joe,Chris
Jane Smith 2/25/1982 Bob,Sally,Joe,Chris
Bruce Wayne 5/13/1975
Peter Parker 5/23/1970

Note that in the last column the commas are preserved because they are within the quotation mark text qualifiers. Below is the stored procedure that does this. Feel free to use it, and leave a comment if you found it useful.

 

IE6, IE7, & IE8 On My Box … At the Same Time!

IE6IE7IE8I just installed Windows 7 on my desktop machine. Today I set up XP mode … cause I can. And the first thing I did was to create two virtual machine … one running IE6 and one running IE7. So there you have it. I can now run IE6, IE7, and IE8 on one box. The image is a screenshot of my box with the proof. This will make website debugging so much easier. Although for the most part I’ve kinda let IE6 go, but at least I can know how bad it will look.

Pivoting SQL Data

So, the other day I was trying to pivot some SQL data that was basically in this format…

RECNUMBER COLNUMBER FIELDNAME FIELDVALUE
1 1 FirstName Davin
1 2 LastName Studer
2 1 FirstName Melissa
2 2 LastName Studer

I wanted to see it like this …

RECNUMBER FIRSTNAME LASTNAME
1 Davin Studer
2 Melissa Studer

It took me a while to figure out the syntax for this, but here it is. It uses the SQL pivot keyword.

This first portion dynamically creates the column names to be used in the pivot.

This next part creates a query within a string that we will run with the SQL exec command.

All that is left to do is to execute the query that was created. I ended up putting this into a stored procedure.

 

Google being evil … slightly?

So, I was looking at Google’s homepage in IE8 today and I noticed something funny. I was curious, so I decided to open up Google in the other major browsers to see if the funniness followed. Nope! Only in IE. Below are screenshots of the major browsers (save Google Chrome of course). See if you can spot the difference. I realize that Google can do whatever it wants with its one home page(even though Microsoft can’t do what it wants with its OS, but don’t get me started) and granted IE has its faults, but this seems a bit mean to me … especially since I was using IE8, which is the most standards compliant IE to date(meaning the features that they have implemented conform to industry standards). What do you think, is it “evil” to single out one competing browser in this way?
Firefox:
FF

Opera:
Opera

Safari:
Safari

IE8:
IE8

Clearing a float

I found out a cool way to clear a floated element the other day without having to use a clearing div/break or whatever your favorite method of clearing is. In fact you don’t have to add any extraneous html to achieve the clear. Give it a shot yourself. Here is the key …

The HTML