D3R http://blog.d3r.com Where we spam things posterous.com Thu, 02 Jun 2011 04:22:10 -0700 regex for php http://blog.d3r.com/regex-for-php http://blog.d3r.com/regex-for-php A convenient #regex tester that uses #PHP's preg rather than #javascript's implementation, thus allowing lookbehinds http://j.mp/9cePbN

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Tue, 08 Mar 2011 07:48:00 -0800 Magic __callStatic catches parent::foo() calls before __call. This makes me angry http://blog.d3r.com/magic-callstatic-catches-parentfoo-calls-befo http://blog.d3r.com/magic-callstatic-catches-parentfoo-calls-befo

Rather than try to explain this in words, here is a code example.

class A
{
    public static function __callStatic($method, $args)
    {
        echo "Called a static method\n";
    }

    public function __call($method, $args)
    {
        echo "Called an instance method\n";
    }
}

class B extends A
{
    public function foo()
    {
        // extends the functionality of foo.
        echo "Called new foo\n";
        // and runs its parent's version too
        parent::foo();
    }
}

$b = new B();
$b->foo();

The issue I have is that really I want the parent::foo() method to be caught by the __call() and not the __callStatic(). It always struck me as a bit odd that you call a parent method using static looking syntax (and that any instance method can in fact be called like this) and now it seems it's more than just ugly but actually stopping me from getting at my __call().

Does anyone know of a solution for this? Obviously, in my example, I could explicitly define foo in the parent class but my actual use case is far more complicated and this is not practical. It seems that really we need a way to distinguish between calling static and instance methods on the parent.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Tue, 01 Mar 2011 08:34:12 -0800 Good design http://blog.d3r.com/good-design http://blog.d3r.com/good-design
Photo

The intro splash screen on the Pulse iPhone app is a really sweet little intro to the app. The comic book type paired with the hand-drawn arrows makes this intro screen feel fun rather than invasive. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/983321/surprise_from_mostly_forbidden_zone.jpg http://posterous.com/users/he614VeP95HT4 Jonathan Rogers Jon Jonathan Rogers
Tue, 08 Feb 2011 10:30:00 -0800 Cufon causing VideoJS to load a minuscule player in Internet Explorer http://blog.d3r.com/cufon-causing-videojs-to-load-a-minuscule-pla http://blog.d3r.com/cufon-causing-videojs-to-load-a-minuscule-pla

I've just battled for some time to resolve an issue I was seeing on one of our sites where, in Internet Explorer 6 through 8, Flash fallback videos (using Flowplayer) were loading up only about 3 pixels high and 4 pixels across, a tad smaller than intended.

The first thing to note is that both Cufon and VideoJs are quite particular about being loaded in the head of the page. For Cufon, this is to allow replacement of the text before it's displayed and for VideoJs this is to allow it to do something analogous to Remy Sharp's html5 shiv (but only for the video tag).

The VideoJs embed code looks something like this:

<!-- Begin VideoJS -->
 <div class="video-js-box">
   <!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
   <video class="video-js" width="640" height="264" controls preload poster="http://video-js.zencoder.com/oceans-clip.png">
     <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
     <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
     <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
     <!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
        SNIP - object tag
   </video>
   <!-- Download links provided for devices that can't play video in the browser. -->
   <p class="vjs-no-video"><strong>Download Video:</strong>
     MP4,
     WebM,
     Ogg<br>
     <!-- Support VideoJS by keeping this link. -->
     HTML5 Video Player by VideoJS
   </p>
 </div>
 <!-- End VideoJS -->

Edit: It seems that a browser somehow manages to embed an object even if it is converted to entities and sat inside pre tags. Not sure if it's posterous' fault or mine.

Edit again: It is posterous' fault. It is doing naughty things with entities within pre tags.

Note that the <object> we wish to fallback to is inside the <video> tag, something IE doesn't ordinarily recognise.

Strangely, if I put a delay on the "VideoJS.setupAllWhenReady();" call that actually runs through all the items on the page, everything is fine. Similarly, if I just remove the video tag and let the object embed itself, all is well. This excluded Flowplayer as the culprit.

In desperation, I tried removing a whole load of other javascript from my pages, and getting rid of Cufon brought things under control. After a lot of messing around I spotted in IE8's developer tools that the video tag was getting a size of 0x0. This in turn seemed to be making the object inside it extremely small. Remembering that the shiv was there specifically to stop this, it occurred to me that this could be where the conflict was. After all, the shiv is the only part of videojs that needs to be in the head with Cufon.

Pushing videojs down to the end of the body i.e. bypassing the shiv entirely, miraculously fixed the issue. I guess because IE now decides to render it as an inline element and it therefore no longer has an effect over the size of the object tag within it.

For once, ignoring the advice of the person who developed the software in the first place would have worked out after all.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Tue, 24 Aug 2010 07:09:00 -0700 Resize EXT3 partition on AWS EBS volume http://blog.d3r.com/resize-ext3-partition-on-aws-ebs-volume http://blog.d3r.com/resize-ext3-partition-on-aws-ebs-volume

umount <mount point> 

# Create new snapshot from volume

fdisk <block device>

# Type 'd' to delete the primary partition 
# Type 'n' for new partition 
# Type 'p' for primary 
# Type '1' for 1st 
# Type Enter for 1st cylinder 
# Type Enter for last cylinder (full disk) 
# Partition is not bootable, so 'a' not necessary 
# Type 'w' to finish 

fsck -f <block device>
resize2fs -p <block device>
fsck -Cfy <block device>
mount -t ext3 <block device> <mount point>

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1103991/428bfcaa99d14a380562736235723951.jpeg http://posterous.com/users/4afJKKLwbZAJ Ronan Chilvers Ronan Ronan Chilvers
Tue, 09 Mar 2010 08:44:10 -0800 build php5.3 extension deb packages http://blog.d3r.com/build-php53-extension-deb-packages http://blog.d3r.com/build-php53-extension-deb-packages http://www.dotdeb.org/2008/09/25/how-to-package-php-extensions-by-yourself/

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1103991/428bfcaa99d14a380562736235723951.jpeg http://posterous.com/users/4afJKKLwbZAJ Ronan Chilvers Ronan Ronan Chilvers
Thu, 19 Nov 2009 00:54:08 -0800 DPKG locale problems on Debian Lenny http://blog.d3r.com/dpkg-locale-problems-on-debian-lenny http://blog.d3r.com/dpkg-locale-problems-on-debian-lenny For the techs. If you find that dpkg is churning out the following (or similar) on Debian Lenny:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

You can fix by:

aptitude install locales
dpkg-reconfigure locales

and make sure that at least one locale is selected and generated.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1103991/428bfcaa99d14a380562736235723951.jpeg http://posterous.com/users/4afJKKLwbZAJ Ronan Chilvers Ronan Ronan Chilvers
Mon, 05 Oct 2009 09:34:00 -0700 Cloning an image for VirtualBox http://blog.d3r.com/cloning-an-image-for-virtualbox http://blog.d3r.com/cloning-an-image-for-virtualbox

Just duplicate the virtualbox image file and run this command on the copy:

VBoxManage internalcommands sethduuid <filename>

It'll get rid of the duplicate uuid messages and allow you to be all mac like with your dragging and dropping again.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Fri, 25 Sep 2009 02:20:11 -0700 37 signals $10billion valuation http://blog.d3r.com/37-signals-10billion-valuation http://blog.d3r.com/37-signals-10billion-valuation http://37signals.com/svn/posts/1941-press-release-37signals-valuation-tops-10...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Thu, 24 Sep 2009 07:09:18 -0700 TextMate autocompleteness http://blog.d3r.com/textmate-autocompleteness http://blog.d3r.com/textmate-autocompleteness http://mondaybynoon.com/2009/08/17/the-art-of-zen-coding-bringing-snippets-to...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Thu, 24 Sep 2009 06:03:10 -0700 Content aware image resizing http://blog.d3r.com/content-aware-image-resizing-1 http://blog.d3r.com/content-aware-image-resizing-1 Is a cool thing.

These people have done it with a canvas.

http://labs.pimsworld.org/wp-content/uploads/2009/04/demo-content-aware-image...

(use firefox)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Thu, 24 Sep 2009 02:21:00 -0700 Escaping the hideous flash of uncontained style http://blog.d3r.com/escaping-the-hideous-flash-of-uncontained-sty http://blog.d3r.com/escaping-the-hideous-flash-of-uncontained-sty

This is as close as I can get to removing a horrible attack of unhidden elements up in your face when trying to be a good person and building a site to gracefully degrade:

<script type="text/javascript">document.getElementsByTagName('html')[0].className = 'js';</script>

The idea is just to get a class onto the html element as early as possible. Get this right up in the head before everything for maximum goodness. No need for jQuery etc.

You then use nice ".js blah" selectors to hide everything in your stylesheet and no-one will ever know.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Mon, 14 Sep 2009 23:24:02 -0700 Google Earth + augmented reality = wow http://blog.d3r.com/google-earth-augmented-reality-wow http://blog.d3r.com/google-earth-augmented-reality-wow http://www.revolutionmagazine.com/news/rss/938024/Google-Earth-+-augmented-re...

  
Sent from my iPhone

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1091938/The_Gruffalo-1-200-186-85-nocrop.jpg http://posterous.com/users/hdKYWVWVOLSrw Lynton Lynton Lynton
Mon, 14 Sep 2009 23:14:07 -0700 SystemTap – DTrace for Linux ? http://blog.d3r.com/systemtap-dtrace-for-linux http://blog.d3r.com/systemtap-dtrace-for-linux http://www.mysqlperformanceblog.com/2009/09/14/systemtap-dtrace-for-linux/

  
Sent from my iPhone

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1091938/The_Gruffalo-1-200-186-85-nocrop.jpg http://posterous.com/users/hdKYWVWVOLSrw Lynton Lynton Lynton
Mon, 14 Sep 2009 17:16:29 -0700 Open Source Business Intelligence - Jaspersoft http://blog.d3r.com/open-source-business-intelligence-jaspersoft http://blog.d3r.com/open-source-business-intelligence-jaspersoft http://jaspersoft.com/

  
Sent from my iPhone

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1091938/The_Gruffalo-1-200-186-85-nocrop.jpg http://posterous.com/users/hdKYWVWVOLSrw Lynton Lynton Lynton
Mon, 14 Sep 2009 17:13:24 -0700 dbShards Cloud Edition http://blog.d3r.com/dbshards-cloud-edition http://blog.d3r.com/dbshards-cloud-edition http://www.codefutures.com/dbshards-cloud/

  
Sent from my iPhone

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1091938/The_Gruffalo-1-200-186-85-nocrop.jpg http://posterous.com/users/hdKYWVWVOLSrw Lynton Lynton Lynton
Wed, 09 Sep 2009 10:21:52 -0700 Simple but effective http://blog.d3r.com/simple-but-effective-0 http://blog.d3r.com/simple-but-effective-0 http://kempfolds.blogspot.com/

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Tue, 08 Sep 2009 02:37:04 -0700 Pubkey Authentication http://blog.d3r.com/pubkey-authentication http://blog.d3r.com/pubkey-authentication
  • "PubkeyAuthentication": RSA key for SSH-2
$ ssh-keygen -t rsa $ cat .ssh/id_rsa.pub | ssh user1@remote "cat - >>.ssh/authorized_keys"
http://www.debian.org/doc/manuals/debian-reference/ch06.en.html#_the_remote_access_server_and_utility_ssh

Permalink | Leave a comment  »

]]>
Tue, 08 Sep 2009 02:00:29 -0700 Sheep http://blog.d3r.com/sheep-47 http://blog.d3r.com/sheep-47

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom
Thu, 16 Apr 2009 08:43:42 -0700 Wireframe Showcase http://blog.d3r.com/2009/04/wireframe-showcase http://blog.d3r.com/2009/04/wireframe-showcase Vana Jurcic has put together a blog with examples of interface sketches, wireframes and prototypes and presentations, articles and talks about the subject. Take a look at http://wireframes.tumblr.com/

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/517035/Dafydd_Morgan.jpg http://posterous.com/users/4afJKKUTwtYR Dom fuzzyd Dom