Web tools link dump from last night

Yesterday, at Forskningsavdelningen (geeking every Tuesday night!) we had a blazingly fast run-through of web tools. This link-dump will probably be amended.

I had time to set up a Redis, and do a test run with Rediska – a PHP interface to Redis. It worked, and it’s in PHP. I was more impressed with the redis-cli experience. There are many atomic commands in Redis, and the datatypes are quite helpful.

We spent some time walking through a BDD tool for async web framework Node.js: VowsJS. When that was done, we looked at kyuri, the library that can transform a Cucumber feature spec into a skeleton VowsJS “vow”. kyuri was used for prenup, a web tool to create Cucumber specs for Node.js projects. prenup was quite alpha, but we sympathized with the concept.

Joel pointed to PHP-based web frameworks “like Sinatra“, and found a few that he rejected. The last man standing was named GluePHP. He can list his gripes with all the others. We looked at Troels’ Konstrukt, as well, and it got good reactions. It’s good, but it’s nothing like Sinatra.

Flask is a web microframework which was used at Forskningsavdelningen last night. “I don’t know how to use this, so let’s begin.” And we begun, and had a website up and running pretty soon. A roadblock in the form of “convert a regular font file to a PIL-font format” appeared, and a hell-of-Portfiles ensued. I should start using Homebrew

Oskar had referenced Windows hacker Scott Hanselman, and we praised his article on changing default web browser in Visual Studio for it’s complete hacker attitude. Here is a link to his PowerShell category on his blog.

Oh, Hanselman lists Windows tools he uses.

Other stuff, that should be mentioned, so as not to forget:

Whiskey Disk is embarrasingly fast deployments – their videos, presentations, etc, are very convincing, and “keep it easy.” Someone who takes Capistrano down a notch for “not being simple enough” should be listened to. The system seems quite capable.

Inspiration: This morning I saw that some Drupal folks were using a Phing task to automate fetching and building a customized version of Drupal, for their deployment. They included two useful tasks: help and explain, where help informed about the available options, and explain printed all the variables that would be used when running a phing build. Also, they informed the user of how to change those variables right on the commandline, and gave the tip that they should run the explain task with changed command-line settings. This would verify that Phing had understood the user’s invocation correctly.

Usage of Phing explain

Posted in General | View Comments

I’m Porticus! I’m Porticus!

I have yet to start using the popular package management system Homebrew (brew install postgres), so I was happy to find the simple, graphical Porticus package browser, written by a Richard Laing.

Porticus is a Cocoa GUI for the MacPorts package manager

Porticus screenshot

A longer Linux Journal article has details. Oh, like journalism.

I can’t find Mr Laing’s web presence anywhere. A helpful soul, who hides. Wonderful. A moment later, I found a long list of Dicks (Laing, that is). Great, now there’s a haystack of Laingses.

Problem compunded. Done.

Posted in Technology | View Comments

Reminds me, I don’t watch TV




IMG_8811

Originally uploaded by David Tolnem

But, as a wise woman often says: “…it’s not television, it’s HBO.”

Posted in General | View Comments

Weaving at home




Weaving at home

Originally uploaded by olleolleolle

This picture is now a part of a huge collection of images of looms. I just love the Internet for that.

Posted in General | View Comments

Using find

When not using ack, my favorite search tool, you can still exclude SVN folders. Here is an example of me looking for a file:

$ find . -not \( -name .svn -prune \) -name 'EosController*'
./web/models/controllers/EosController.php
./web/models/controllers/EosControllerTest.php

This mode of expression might be better for your scripting needs.

Posted in Technology | Tagged | View Comments

Contribute: Low-hanging fruit in PEAR

Here is a list of very simple bugs to fix, to make PEAR better: Deprecation bugs for PEAR code.

I fixed two. The list was a wee bit shorter when I reloaded its tab.

How many of these bugs remain?

Posted in PHP | Tagged | View Comments

Workstyle: Add vendor tests before using new library code

Hello again. Here is a snag-resolving article about a maintenance problem. There should be a thick volume called “Web Maintenance Pearls”, which everyone should be forced to read.

Here’s the situation: You want to throw out a dependency. It’s an older JavaScript library, and you have a replacement lined up. Some plugin for a popular framework that you already depend on.

Add a couple of jsTestDriver “VendorTests” test cases: proof that the new library works as advertised, defined without the noise of your application’s behavior. This test will run faster than manually testing your web GUI.

Write the vendor behavior test:


/** Tests of used vendor framework functions. */
var VendorTests = TestCase("VendorTests", {

    /**
     * MochiKit & the jQuery BBQ plugin should have the same URL querystring-
     * parsing functionality.
     */
    testMochiKitAndJqueryBBQWorkTheSame : function(){
        var qs = 'elvis=1977&reagan=2004&lee=1973',
            ob = {elvis:1977, reagan:2004, lee:1973},
            mObj = MochiKit.Base.parseQueryString(qs),
            jObj = jQuery.deparam(qs),
            mQs = '',
            jQs = '';

        //jstestdriver.console.log("JsTestDriver", "Elvis died in 1977:"+jObj.elvis);
        assertEquals(1977, jObj.elvis);
        assertEquals(2004, mObj.reagan);
        assertEquals(mObj, jObj);

        mQs = MochiKit.Base.queryString(ob);
        jQs = jQuery.param(ob);
        assertEquals(mQs, jQs);
    }
});

If you want to learn much more about hard maintenance problems, and how to crawl out from under them, read Michael Feathers.

That was the gist of it.

Snag expansion: Perhaps the jsTestDriver functions get overwritten, by code you import

As you include your target dependency – MochiKit – in your list of imported JavaScript files, all your tests still pass. A good sign. You add an empty test-case, with a fail("Good. If this is NOT seen, it means is trouble!");, just to see if the testing tool picks it up. All tests, including the new one, pass. A bad sign. Good thing you were suspicious. Paranoid, almost.

What just happened, and how to fix it:

  • MochiKit exported all its functions to the global namespace, by default. This includes name-clashing functions that thrash jsTestDriver’s same-name functions. Thanks to brasetvik for noting!
  • You can turn off that default behavior. Add this single line of code to a file, say initMochiKitWithoutGlobals.js: MochiKit = {__export__: false};
  • Include the new JS file in the jsTestDriver.conf “load” section, just before MochiKit:

server: http://localhost:9876

load:
  - web/scripts/jquery.js
  - web/scripts/tk/mochikit/initMochiKitWithoutGlobals.js
  - web/scripts/tk/mochikit/packed/MochiKit/MochiKit.js
  - web/scripts/jquery.ba-bbq.js
  - web/scripts/your_web_application.js
  - tests/js/your_web_application/*.js

Update: Currently, my way of making MochiKit.js be non-export configured, is to add the MochiKit = {__export__: false}; line instead of the initial MochiKit = {}; in the MochiKit.js file itself. (Since I’m moving away from that library, I figured it’s a cost I can take. It’s not like I’ll upgrade it, anyway.) Researching why that variable does not seem to get persisted, perhaps it’s a load order snag of some kind. window.MochiKit did not work. Hm. I’ll let you know when I nail it.

So, now your testing library runs correctly again. Cursed be global namespace pollution.

Posted in Javascript | Tagged , , , | View Comments

Thank you, MacPorts: How to add OpenSSL support to your PHP

Many interesting web APIs require SSL, for instance Google’s GData API. This adds OpenSSL support to your MacPorts-installed PHP, so that you can use the “ssl” transport layer:

sudo port install php5-openssl

Done.

Thanks, jmr_mp in the MacPorts IRC channel, for telling me about the existence of this short and neat patch-applying port, so that I could spare you, dear reader, from an introductory tutorial on how to edit Portfiles that don’t add the bells and whistles that you want. I had one written, but the above is saner. There’s always another hood underneath the hood. You don’t have to fix everything. Some things should just be fixed by the package system.

Here’s that Portfile:

$ port cat php5-openssl
# $Id: Portfile 69619 2010-07-11 03:00:23Z ryandesign@macports.org $

PortSystem              1.0
PortGroup               php5extension 1.0

php5extension.setup     openssl 5.3.2 bundled
revision                1
categories-append       devel security
platforms               darwin
maintainers             ryandesign

description             a PHP interface to OpenSSL signature-generation \
                        and -verification and data-encryption and \
                        -decryption functions

long_description        ${description}

checksums               md5     46f500816125202c48a458d0133254a4 \
                        sha1    79ea4ee3da3a7542d1e348ac963a5b38bcbb4b6b \
                        rmd160  60a8aac0d51511ecaf8dcad9d31bdf072c0c99cf

depends_lib-append      port:openssl

post-extract {
    move ${build.dir}/config0.m4 ${build.dir}/config.m4
}

configure.args-append   --with-openssl=${prefix}

platform macosx {
    configure.args-append --with-kerberos=/usr
}

use_parallel_build      yes
Posted in PHP | Tagged , | View Comments

Discourse

How to be immortal: become a word. Maes-Garreau Law.

Via article about AI.

Posted in General | Tagged | View Comments

Random ruleset: Guidelines for my bank’s credit card image customization

I’m a sucker for customization. Here’s a random thing. My bank’s rules for VISA card image settings:

Riktlinjer och regler för användning av egen bild:

  • Bilden får inte kränka annans upphovsrätt, rätt till varumärke eller annan liknande rättighet och ska följa god sed. Detta innebär att bl a följande regler måste följas för att en bild ska kunna godkännas.
  • Bilden får inte innehålla företagsnamn, föreningsnamn eller kännetecken för företag eller föreningar, eller varumärken, logotyper eller mönsterskyddade produkter.
  • Bilden får inte innehålla reklam eller syfta på någon med bankens tjänster konkurrerande produkt.
  • Bilden får inte föreställa offentliga personer, som t ex politiker, musiker eller idrottsmän.
  • Bilden får inte föreställa någon identifierbar person utan dennes medgivande.
  • Bilden får inte innehålla motiv eller värderingar av samhällsfientligt, olagligt, rasistiskt, politiskt eller religiöst slag.
  • Bilden får inte visa personer involverade i olagliga eller rasistiska aktiviteter.
  • Bilden får inte innehålla svenska eller utländska texter, siffror och symboler, ej heller personliga data eller webbadresser.
  • Bilden får inte innehålla inslag av vapen och militära fordon eller av alkohol, tobak eller andra droger.
  • Bilden får inte ha provokativa, sexuella eller stötande inslag.
  • Bilden får inte innehålla nakna eller halvnakna vuxna eller barn.
  • Bilden får inte kunna uppfattas som våldsam eller obscen.
  • Bilden får inte skapa säkerhetsmässiga eller andra problem vid användning av kortet, t ex får inte sedlar och mynt visas.
  • Bilden får inte utformas så att kortet uppfattas som vitt eller guld- eller silverfärgat.
Posted in General | View Comments