jQValidate – jQuery Form Validation Plugin

jQValidate is a plugin for jQuery and jQuery UI which validates form inputs based on a set of rules. It differs a bit from most other validation plugins as it uses jQuery selectors to target form elements instead of the HTML id or form element name. This allows you to easily validate multiple form elements using the same rules by including them in the selector.

You can find jQValidate on GitHub at http://github.com/JakeWharton/jQValidate. Documentation is essentially non-existent right now (much like all my projects) but you can get a good idea of how the plugin works by looking at test/index.html. In the forthcoming weeks full documentation will be created.

While jQValidate was written from scratch, huge inspiration and convention was obtained from Felix Nagel’s jQuery-Accessible-RIA plugin. jQValidate was born due to unique needs from a validation plugin and an inability to modify jQuery-Accessible-RIA to fit them without a major rewrite. If you enjoy this plugin please also look at jQuery-Accessible-RIA which is also available on GitHub at http://github.com/fnagel/jQuery-Accessible-RIA.

Update: Live demo of the test file which is included in the repository can be found at http://sandbox.jakewharton.com/jqvalidate.html.

Continue reading » · Rating: · Written on: 01-15-10 · No Comments »

Automatic GitHub Hook Puller for Easy Deployment

In developing websites I would often find myself committing to its git repository, pushing to GitHub, and then SSH-ing to the web host and manually triggering a pull. While being very tedious it sufficed to get the job done. For months I had vowed to employ GitHub’s post-receive hooks to automatically pull in changes on the deployment location. Well, I finally got around to it: http://gist.github.com/228427

Deploying this is as easy as putting this in hookpuller.py, updating the branches dictionary, running chmod 770 hookpuller.py, and protecting it with simple authentication credentials.

Then in your GitHub project go to the “Service Hooks” sub-page under the “Admin” section and enter the URL to the script.
post-receive-hook

Now whenever you push to GitHub your changes will be instantly pulled onto your deployment server.

Continue reading » · Rating: · Written on: 11-06-09 · No Comments »

pyy + C# = pyysharp?

Advances in C#’s syntax almost allow for a rudimentary implementation of pyy to be created. Comparatively, it is much uglier, less useful, and more of a pain to program than its Python counterpart which is why I doubt a functional C# version will ever become a reality.

Are there any advantages to using something like pyy when ASP.NET is available? Writing simple (X)HTML elements becomes a battle with the syntax and the code readability is greatly ruined. Creating a simple header link turns into an abomination that resembles Objective-C except with curly braces and parenthesis:

new h1(new {id="header"}, new a(new {href="/home/"}, "Link Title"))

The property-initializer syntax was also considered but the tag attributes seem too disjointed from the actual object:

new h1(new a("Link Title") {href="/home/"}) {id="header"}

The pyy equivalent for both of these examples is:

h1(a("Link Title", href="/home/"), id="header")

Unless some niche is made evident for a full pyy port don’t expect any of this code to see the light of day beyond the simple HtmlTag base class via this Gist.

Continue reading » · Rating: · Written on: 07-25-09 · No Comments »

DXVA/Awesome Compliant Checker

Checking an encode for DXVA compliance or the much more strict Awesome compliance has involved checking the MediaInfo output for up to 16 different settings. While most encoders understand these settings, a lot of end-users and potential uploaders do not. It is for this reason that I have created a pyy-based web application which automatically parses MediaInfo outputs and checks all these rules.

You can find the working version of it running at http://awesome.jakewharton.com/. Simply paste the text output from MediaInfo of any media file which you wish to check against DXVA or Awesome rules and submit. It will show you a green box if it is compliant and a red box if it is not. It will also list all the settings which violate the rules at the bottom.

As with most of my projects, the source is available on GitHub here and any contribution is welcome.

Update: JSON and XML requests can now be served via http://awesome.jakewharton.com/json/ and http://awesome.jakewharton.com/xml/, respectively. The MediaInfo text should be POSTed in ‘mediainfo’ and include ‘is_animation’ to denote the encode is animated. You can view example responses here.

Continue reading » · Rating: · Written on: 07-11-09 · No Comments »

Python Import Trickery

The use of 3rd party packages (i.e. through git submodules) you might run into an instance where a package requires a library that is not installed. If you use a 3rd party hosting solution and cannot modify your main installation there is an easy trick to aid in making these missing libraries importable.
Continue reading…

Continue reading » · Rating: · Written on: 07-07-09 · 1 Comment »