Thursday, April 25, 2013

Nice, simple and effective bookmarkets


I went looking for an easy way to share web pages and ended up finding some browser plugins when what I really wanted were these bookmarklets. Lightweight, easy to understand and use and non-invasive. What are some of your favorite bookmarklets?
Feel free to check these out and even drag these buttons to your bookmarks bar if you feel comfortable.
Email a link to the web page you are currently looking at.
Share a link on Facebook to the web page you are currently looking at.
Tweet a link to the web page you are currently looking at.
Generate a PDF of the web page you are currently looking at. So sad that JollyPrint is gone :(
Here's another PDF generator, but it requires your email address every time so it can email a link to the pdf. Not nearly as convenient!
http://www.pdfdownload.org/pdf_bookmarklet.html
P.S.,... creating those buttons to drag bookmarklets to the browser's bookmarks bar is pretty easy too:
// credits to: https://dev.twitter.com/docs/share-bookmarklet

<div class="bookmarklet">
<a href="javascript:void(/* bookmarklet js code */)">Bookmarklet this
</div>

Dropzone: can it be used to create a full-fledged image manager?

The client would like to have a friendly image manager to upload, delete and select image files. Dropzone seems to have a product that has a small footprint and fits the bill.

Tiles may be customized by the client by filling in a title, summary and associate an appropriate icon. In this case, we probably don't want the users to add their own images, but there are other areas where it would be desirable.

The user starts of editing a tile with the options of clicking on the tile itself to pull down a dialog where the title and summary may be edited. By clicking on the 'Select Icon' button (or eventually by clicking on the existing icon), they should be presented an image manager.

Right now, that consists of a target where files may be dragged and dropped to upload files. Additional code should be used or implemented to view the client's images that have already been uploaded or that are available for the current widget.

Like you would expect, simply select your files and drop them on the target.

After the files are dropped, the images will be queued up and uploaded to the server, providing a progress bar at the bottom and a status symbol in the top right-hand corner (green check == success, red 'X' == failed).

Again, this is a great starting spot to work on a more complete image manager. The functions with this library may already account for such a tool, making this an easier task. Sure, there are other image managers out there, but in the attempt to promise the moon, they can get a little burdensome to manage/integrate and they often come packaged with a huge wysiwyg solution that you don't necessarily want to pack into your web application.

We'll see how things proceed and if we can easily use this tool to create a simple and clean image manager.

Wednesday, April 24, 2013

Savon for webservices; easy enough to add OpenSSL::X509::Store support

I have been looking around for a library to handle interacting with webservices for testing purposes.  I used to use soap4r.  I saw soap4r-ruby1.9, but I also saw Savon.  I like trying new things out, so I gave it a shot.  The server I'm hitting requires 2-way authentication, but it doesn't use a CA authority.  The server and the client authenticate with each other based on their trust stores which contain the others public certificate.  Unfortunately, Savon didn't support this method of authentication as it doesn't expose a way to add trusted certificates to the configured request. 

Perhaps this is because Savon strives to provide a common interface for multiple adapters.  Perhaps a little short-sighted, I plowed on ahead to add the means of configuring a trust store instead of using a CA certificate for authentication.  The implementation strives to keep consistent with the other related SSL calls with Net::Http in mind; I really don't know what the other adapters will do with those extra features.  Some testing is still in order; the question of whether this change is feasible for the other adapters can more appropriately be answered when unit tests have been added.

In the mean time, I can go ahead with my webservice testing.  I have put the following together to carry out that testing:

Incorporates use of trusted key stores for certificate authentication (with peer).
git clone git@github.com:dcvezzani/savon.git
git clone git@github.com:dcvezzani/httpi.git
Examples using Net::Http, Httpi and Savon (you will need to configure your own web server, but there is a script to generate both service and client certificates).
git clone git@github.com:dcvezzani/freezing-sansa.git

And here's what it looks like. Just provide an array of filenames representing the trusted files that should be in the store and authentication will take place using your store instead of a CA certificate and chain.