Saturday, October 1, 2011

Wt Configuration and Experimentation - Continued...

This is a continuation of the previous post titled Wt Configuration and Experimentation.

PackRapt.com is a cloud resources search, bundler and mailer. It allows for search and distribution of disparate cloud documents. One stop search and send. In an effort to maximize efficiency while minimizing footprint and resources exploitation I'm moving PackRapt.com to the Wt framework and customizing the search and curation features. These posts document the adventure.


Wt Configuration and Experimentation - Continued...

We left off taking a look at the Wt samples that are applicable to PackRapt.com

Hangman

The Hangman example included in the Wt library offers a look at simple authentication. I've tried to roll my own authentication before. I thought it was easy. That was, until i had a Ruby guy punch so many holes my attempt it resembled the Titanic. We will, however, use the example as a foundation to creating our own. Easy? No. Fun? Yes.

An important part of the Hangman examples lies in the Wt ORM.  We will be getting into the Wt::dbo soon enough. Patience, for goodness sake! I know you're dying to dive into Wt's ORM but show some restraint!

So, here's the scoop. This is an extremely simple example of how the authentication for PackRapt.com will be implemented. 


Easy, huh? Yeah. As you can see from the login function it simply asks if the user exists. If not, it creates a new user and password in the database. Naturally, we must add an abstraction to the data via Salt/crypt. This example, however, shows one point I'd like to highlight. PackRapt.com will offer an either/or authentication. That is, a user's registration will simply exist or be created. Secure? I guess I'll find out.

I'm heading out to a charity event in Bellevue. Being a little short on time we'll keep this brief. As a review, however, I'll say that we've covered a framework for the authentication and uploads. We've still got a ways to go!

Thank you,

Aaron

Wt Configuration and Experimentation

This is a continuation of the previous post titled PackRapt.com - Outline.


PackRapt.com is a cloud resources search, bundler and mailer. It allows for search and distribution of disparate cloud documents. One stop search and send. In an effort to maximize efficiency while minimizing footprint and resources exploitation I'm moving PackRapt.com to the Wt framework and customizing the search and curation features. These posts document the adventure.


Wt Configuration and Experimentation


I hope you all got a chance to mess around with the Wt examples. Most require a bare-bones install of dependencies. For the others the "optional" dependencies include:
  • GraphicsMagick -> sudo port install GraphicsMagick 
  • FCGI Library -> sudo port install fcgi (libfcgi++ inlcuded in FCGI Library)
  • OpenSSL is -> sudo port install openssl
  • Haruhi Free PDF Library -> sudo port install libharu
  • Fastcgi -> sudo port install mode_ fcgid (Apache2 module) 
  • Asciidoc -> sudo port install asciidoc (Not included with Mac OS X Lion)
I should note that while experimenting with the Wt examples I invoked the built-in web server (wthttpd) with minor limitations. As the development progresses, however, it's likely we'll need a web server that can handle multi-threaded requests. I'll cover the multi-threaded stuff in a future post. Frankly, I'm stuck on the mod_fcgid configuration and need a little time for preparation.


We haven't gotten to the cool stuff yet. I could spend all day on configuration, as you know. As such, I'll break it up a bit and get right to the applicable examples.


For our (my) purposes we'll look into the following Wt examples:
  • Widget Gallery - FormWidgets - The FormWidgets examples shows a file upload
  • Hangman - The Hangman example offers a decent authentication example.
  • JavaScript - Wt's JavaScript example shows a very basic use of JavaScript.
  • TreeView-DragDrop - The TreeView-DragDrop example from Wt shows drag/drop and sorting.
Next we'll examine how the above examples are applicable to PackRapt.com. I'll also go over how Wt implements the parts of the examples I'll be using for PackRapt.com and touch on how we'll use them.


Widget Gallery - FormWidgets


FormWidget offers a simple look at uploads. Naturally, the PackRapt application allows for uploads. What good would a cloud document app be without uploads? Wt has a widget called Wt::WFIleUpload that offers a number of members that will be useful to PackRapt.


Members of the Wt::WFileUpload applicable to PackRapt:
  • void setMultiple () - Allows for multiple uploads
  • WString contentDescription () const - Returns the description of the file
  • WProgressBar* progressBar () - Progress bar fot the upload
  • void setProgressBar (WProgressBar *progressBar)
  • void upload () - You guessed it!
  • bool canUpload () const - Checks whether another upload can be uploaded
  • etc.
The FormWidget example from Wt does this in the following way:




You can see here that the WFileUpload object (fu) is created and set to a new WProgressBar. They both belong to the WContainerWidget object (result). The EventDisplayer object (ed_) is called for any of the three options of changing the upload, finishing the upload, and if the file is too large. This is a very simple look at the initialization of the upload and the results. Fantastic, eh?


You'll notice from the example that the upload is attached and then invokes the progress bar for the fu object. Once the file is uploaded the ed_ object calls the showSignal which displays the applicable message. Very simple. This, however offers a general look at our file upload feature.


Next post we will continue with the Hangman example. We look at rolling our own authentication.


Thank you,


Aaron