Apr2nd

Make Behat comments visible in Mac OS X Terminal

When running behat tests on Mac OS X, the default colours for the comments is too dark to see if you use a dark background colour for your terminal. To fix this I added the following line to my .bashrc:

export BEHAT_PARAMS="formatter[parameters][output_styles][comment][]=blue”

Now the comments easily. Happy testing.

Nov9th

The quest to create a Drupal 7 Installation profile

dialog code Read on

I’ve picked-up Drupal again, after a long while of doing things with Perl. It’s only because my $work want to use it to power their intranet which is ok with me.

The problem I have is that I have everything setup the way I want in a development machine and I can even re-install the same thing when I deploy it but I need a way to enable/disable the same modules that I have in the dev environment.

I have found installation profiles but what I would like is a way to create an installation profile from my current setup.

more to come on this when I find something…

Jul31st

Force Emacs to use tabs

So, I’m not wasn’t really a fan of using tabs to indent code. I like spaces. It means that the code always look the same no matter what editor or OS you’re viewing it in but since using tabs (as is the codestyle at $work), I have come to [kinda] like it and I can see the reasoning behind it.

When editing code, I like using one of two editor - emacs or vim. I can use vim to a pretty good standard but I still love emacs as I don’t like the modal editing you get with vim (having to enter edit mode to type). I like just opening the document and code away. So to cut a long story short, to make emacs always use tabs (instead of spaces) to indent code, I added these settings to my ~/.emacs file:

;; Turn on tabs
(setq indent-tabs-mode t)
(setq-default indent-tabs-mode t)

;; Bind the TAB key
(global-set-key (kbd "TAB") 'self-insert-command)

;; Set the tab width
(setq default-tab-width 4)
(setq tab-width 4)
(setq c-basic-indent 4)
Feb15th

The Revolution (Romans 12:2)

I heard that the revolution will not be televised
Let’s try the revolution will not be compromised
It’s a common trend to see laws so twisted they can’t be recognised
The media’s got us tripping, while the less informed run around galvanised
Surprised! I think not!
We’re supposed to take control, but we did not
But like Lot we keep looking back to what’s lost
While we let the future rot
To the ways of Babylon we cannot, conform
But we must enable our minds to be transformed
Daily fed by the bread, that’s not of the norm
Provided by The God, the only triformed

Apr14th

Holy Hustle

The Easter holiday is now over and I’m back at work but I’m still high from the worship we had on [Resurrection] Sunday.

At church we had a special service in the evening which involved various things like skits, poetry, songs and some good ol’ smash-your-tambourine worship. I was part of the Mass Choir and also did lead vocals on one if the numbers but that’s not where I got the high from…

I guess it was something that had been building-up from earlier in the evening. After a few skits and poetry the songs started pouring out of our mouths. It was like the songs (or even the deeper meaning behind them) was pouring out of our hearts (Matthew 12:34b).

Well, I’m not one to ramble-on so I’ll get to the point. You see, after the last song of the night and the Pastor came up to speak, he called the various people to contributed in the evening up to show appreciation for we all did that night and this kicked-off another session of praise and worship. By this time I can say that we were all drunk in the Spirit and there wasn’t no stopping us now. It was LIVE!!! By we time we came off the stage we were all smashed from the worship and you would have thought that we’d all vacate the premises promptly destined the spend the rest of the night on that lovely couch at home!?

That wasn’t the case. The band started jamming. They were playing Fred Hammond’s Blessed. You know what happened!? It’s like this: most, if not all, of us know that song very well, so a chant started. “blessed! blessed! blessed!” And the worship started all over again with everyone singing the song. Then Pastor started the hustle and well, everyone joined in. By the time we left church that night, we were all too high ;-)

Let me put it this way: if you weren’t blessed yet, you surely would be by the time we finished! Now that’s what I call worship!

Feb18th

jQuery 1.3 Live

Incidentally, I was hacking on some javascript and also upgrading to jQuery 1.3 as I had enough tuits. I had a small problem where I was adding click event handlers to some elements.

To add click events to elements; for instance, a link, I would do:

function activateLinks() {
    $('.my-links').click(function() {
        alert('a link was clicked');
        return false;
    });
}
 
$(document).ready(function() {
    // attach event to linkswith className my-links
    activateLinks();
});

The problem I had was that, when I created new elements (dynamically) that needed the same event, they would not get events attached to them automagically, as I would have to re-call the activateLinks(); function to re-initialize/attach the event to the new elements. I did not really like doing this as it seemed a bit repetitive so I decided to consult the jQuery docs and while clicking around my eyes caught something! “What is this live() thingy doing here!?” I never saw that before and noticed the Added in jQuery 1.3 tag. As it turns out; this (jQuery Live Events) was exactly what I needed. What it does is allow you attach the behaviours to elements even if they are not in the DOM yet. So now my code looks like this:

function activateLinks() {
    $('.my-links').live('click', function() {
        alert('a link was clicked');
        return false;
    });
}
 
$(document).ready(function() {
    // attach event to linkswith className my-links
    activateLinks();
});

OK. It’s a small change, but when I add new elements I don’t have to call the activateLinks() function any more as this only need to be called once on document.ready() and it will listen for future elements. In fact I could refactor the code further by getting rid of the extra function but I like putting things in their own container and leaving the document.ready() bit only for initializing. OCD? Maybe? ;)

I’m liking jQuery even more now. :)

Feb16th

CLI Params

dialog code Read on

I have a perl script that I use to get stats from a database. The params that normally need to change are the start_date, end_date and the site_id. The ugly thing about my script was that every time I had to generate stats, I had to edit it and update these params.

I wanted to update script so that I can pass the params via the cli but I wanted to do it quickly. I use[d] CGI.pm. This was very easy tweak to my script and I didn’t have to go through the configuration dance of vars passed around if I had used my first choices (Getopts::Long or Getopts::Std).

Here’s the small tweak I did:

    use CGI;
    my $q = new CGI;
    my @errors;
 
    foreach ( qw( start_date end_date site_id ) ) {
        push @errors, "MISSING PARAM: $_" unless $q->param($_);
    }
    die join "$/", @errors if scalar @errors > 0;
 
    # my ( $date_start, $date_end, $site_id ) = ( '2008-10-01', '2009-01-08', 24 ); # OLD
    my ( $date_start, $date_end, $site_id ) = ( $q->param('start_date'), $q->param('end_date'), $q->param('site_id') );

A very quick, but effective hack ;-)

Jan28th

A star in Susa

dialog upward Read on

I recently finished Reading the Tommy Tenney book “Hadassah: One night with the king” and I must say that I really enjoyed it.

I know that the book is published as a fictional piece but it is also based on true events, particularly those of Esther Queen of king Xerxes I and of Persia.

I found so much truth in the text that reflects how God wants us to come to Him. The attitude of our heart, our intentions, and even our expectations.

Most of us only remember God when we need something from Him and therefore only see His role as The Provider. Well, He is so much more! In the book Esther spent a year preparing for one night with the king. This one nigth would decide if she would be the future queen of Persia. She soon came to see that her fate had been orchestrated by God and started preparing to be the top candidate for queen. She learned of the things that the king liked; his favorite perfume, attire etc. While the other candidates saw their coming meeting with the king as a time to show off and gain the king’s power, she saw it as a time to bring a gift to the king and please him in any and every way.

When they finally came to meet, they were both infatuated with one another. In fact their first meeting was one of soul mates having a chat. There was no sex! In the same way God wants to continuously talk and commune with us.

I won’t give too much away. All I can say is, when you read the book you’ll begin to realize the heart of God and how He longs for us to be a people after His own heart - like David.

Jul23rd

Javascript Debugging in IE

I’ve been trying for a while to find the best way to debug javascript in IE and failed. I recently had to do this again and found:

Firebug Lite - javascript files - which you include into the header of your page(s) and use as normal. This option is good as you can also use it for other browsers like Safari. But I haven’t yet figured out how to get it to notify me of javascript errors like it does in Firefox.

The other option I found for javascript debugging is debugbar. I have only just found this and at least it gives me the right line number where errors occur and I guess that’s good enough for now. I’ll write more as I get used to using it.

Jun24th

Schmap London Guide

Update: Due to the huge way the widget slows down this page I have removed it and you can get it from their site at http://www.schmap.com

Well I never!?…

Sometime ago I took my wife and kids out to the Tate and took a photo (the one with the lovers kissing) Can’t remember what it’s called. Shortly afterward I was contacted by Schmap if they could use the photo in their London Guide. I said yes and there you have it!

And it seems they’re also on the Web2.0 bus and have provided a widget for site owners to put on their site (see below). Maybe when I get time I’ll put it on my sidebar or something?! ;-)

Schmap widget

Calendar

  • December 2014
    M T W T F S S
    « Apr    
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

About

I’m a creative developer living and working in London, UK with my lovely wife and three wonderful boys (they keep me on my toes). I have a background in graphic design but got into web development/programming cause I was one of those kids who would take toys apart just because we want to know how it works…