Archive for the ‘Uncategorized’ Category

h1

Doctrine 2 and Symfony 2 – ORA-01861: literal does not match format string

June 26, 2014

I am using Doctrine 2 and Symfony2 in a PHP application which queries an Oracle database.

Operations which filter on DateTime columns caused the following Exception to be thrown

 [Doctrine\DBAL\DBALException]
An exception occurred while executing 'SELECT ... with params ["1970-01-01 01:00:01", "2014-06-26 15:43:18"]:
ORA-01861: literal does not match format string

This error is Oracle telling you that the datetime parameter is in an unexpected format.

The fix is to put the following code into your app/config/config.yml file

services:
    oracle.listener:
        class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
        tags:
            - { name: doctrine.event_listener, event: postConnect }

This appears to tell Doctrine to use the OracleSessionInit class when connecting.

ref: http://www.doctrine-project.org/jira/browse/DDC-2731

h1

Useful freenode IRC commands

May 30, 2014

Just collecting together some useful IRC commands which were difficult to find how to do…

Asking ChanServ for help

    /msg ChanServ help op

Regaining OP after leaving your channel

    /msg ChanServ OP #channel username

Setting a channel password

    /msg ChanServ set #channel mlock +k mypassword

 

h1

IE6 ignores z-index on select elements – bgiframe plugin for jquery

July 8, 2012

IE6 ignores z-index on selects and puts it above everything else. This is annoying when you have a drop down mega menu that needs to cover a form and you need to support IE6.

There is this jquery plugin magically fixes this with some magic involving an iframe:
http://docs.jquery.com/Plugins/bgiframe

Include the jquery plugin and then target the floating div in the menu that needs to float over the select. e.g. jQuery(‘div.sub’).bgiframe();

h1

PHP shell scripts stop working if PHP executable is symlinked

March 9, 2012

I do web development for PHP on a MAC. Recently I installed the Acquia Dev desktop which is quite handy. It installed its own version of PHP to /Applications/acquia-drupal/php/bin/php

I needed to use this PHP from the command line so put a symnlink from /usr/bin/php -> /Applications/acquia-drupal/php/bin/php

Now, I also had phpcs installed, but moving PHP from an executable to a symmlink really upset it and it stopped working. Indeed, no shell script with the following shebang starting line would work anymore.

#!/usr/bin/php

The solution is to instead use the following line at the top of those shell scripts instead:

#!/usr/bin/env php

So to make phpcs work again I had to edit /usr/bin/phpcs

Ref:
http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html

h1

Get old scanners working on Mac OSX (Lion)

March 3, 2012

My old scanner (Canon N67OU) stopped working on the update to Lion. After a bit of web searching I found the following brilliant project which magically works with old scanners from the command line:

http://www.ellert.se/twain-sane/

Install the lib-usb package first followed by the SANE backends then TWAIN SANE Interface.

I found I could then scan from the command line with the following:

scanimage –format=tiff -x 215 -y 297 –depth 8 –resolution 100 > scan.tiff

For more help try,
scanimage –help

Or the FAQ online here:
http://www.ellert.se/twain-sane/faq.html

h1

2011 in review

January 4, 2012

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 3,300 times in 2011. If it were a cable car, it would take about 55 trips to carry that many people.

Click here to see the complete report.

h1

Web scale resource idetifiers

March 21, 2011

Excellent blog post on Web Scale reosurce identifiers, Linked Data and REST: http://www.bbc.co.uk/blogs/radiolabs/2008/06/the_simple_joys_of_webscale_id.shtml

Good discussion afterwards as well.