Latest |Kites |Pictures |Programming |Life
Programming
Hacking code together. Is it art? Is it science? Can it be quantified? Are comments really essential? Who knows, I sure as hell don't.
1 and 1 1&1 1and1 adventures

1&1 shared hosting, .htaccess Zend Framework.

Here is my .htaccess file to get ZF up and running:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

#php_value magic_quotes_gpc off
#php_flag magic_quotes_gpc off

#SetEnv APPLICATION_ENV development

#
# check SUB-DOMAIN
#
SetEnvIf Host ^demo\. APPLICATION_ENV=demo

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^demo\.
RewriteRule robots.txt demo.robots.txt [NC,L]
#
RewriteRule robots.txt list.robots.txt [NC,L]
# if the file exists - serve it
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^.*$ - [NC,L]

RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
Options -MultiViews

Note that php_value and php_flag DO NOT WORK they give 500 server errors (no idea why) but you can set these flags via a php.ini file saved in the same directory as the .htaccess.

I have a subdomain (demo) that points at the same ZF project, but it passes in the demo flag to tell it not to worry about some things. It also passes a different robots.txt out for the demo site.

php_value php_flag 500 server error htaccess.

25th of January, 2011@11:44:19 PM
add a comment, permanent link to article
cloudnext VPS hosting review

Don't waste your money. I was with them from June 2010 to Jan 2011 at a cost of around £90 - £100. I couldn't even putty into the VPS. My website never worked, sometimes the PHP info page timed out.

I opened several tickets with them but eventually they just gave up trying to offer support. Utterly pathetic.

teethgrinder is hosted with 123-reg.co.uk and has 17,250,000 page views.

4th of January, 2011@11:47:01 PM
1 comments, permanent link to article
Seven Pillars of Pretty Code

First of all, here is the link: prettycode

I have to agree with everything they say. Amazing, that must be the first time I've read anything on the internet that I totally agree with, especially when it comes to coding style - hehe!

7th of June, 2010@10:37:07 AM
2 comments, permanent link to article
C# silverlight and all that shit

Joe Stevens is my geeky brother in law.

27th of July, 2009@10:50:41 PM
permanent link to article
PHP code style
NuSphere PHPeD firefox debug toolbar

Tags: NuSphere PHPeD firefox debug toolbar

There is an open source Firefox toolbar for NuSphere PHP IDE (NuSphere PHPeD firefox toolbar). It was written by a kind chap called Ian Flory.

Firefox 3.5 beta 99 Preview is out and I use it, but the toolbar is locked to Firefox versions 3.0.* and lower. The toolbar needed an update, so a little hacking later and here is the new version:

DBGbar: phpdebugger.xpi

Fixed:

Changed the min version to 3.5.*
Changed how the toolbar flexes and fills the space - it is now fixed width.
Updated the 'options' window text.

Comments:

This Firefox add-on build script was useful.
I drag and drop the toolbar up next to the 'File, Edit, View...' menus, so when it flexes to fill all the horizontal space it really annoys me. I also drag and drop some bookmarks up here and a few Facebook buttons.

If you find this useful leave a comment :)

Open source (LGPL), flash charts (pie, bar, line, scatter, etc): open flash chart 2. Tooltips, animation and JSON friendly.

 

11th of June, 2009@9:41:27 AM
8 comments, permanent link to article
zend framework jeditable

Tags: zend framework jquery.jeditable.js JSON

jeditable does not accept JSON in response to the AJAX call. So how can you get this to work with Zend Framework? Like this:

Your view will need the the .js files:

<?php
$this->headScript()->appendFile($this->baseUrl().'/js/jquery-1.2.1.pack.js');
$this->headScript()->appendFile($this->baseUrl().'/js/jquery.jeditable.js');
?>

In your controller you'll need to add a context swtich to return JSON, not HTML:

    public function init()
    {
        parent::init();
       
        //
        // NOTE you need **format** in the URL, http://url/url/format/json/
        //
        $this->_helper->contextSwitch
            ->addActionContext('my-editable-ajax', 'json')
            ->initContext();
            ...

You action will look like this:

    function myEditableAjaxAction()
    {
        //
        // This is a serious PITA. The editable expects a single value
        // is response, not a JSON object, so turn off AUTO json
        //
        $this->_helper->contextSwitch()->setAutoJsonSerialization(false);
        $value = $this->_getParam('value', '');
       
        echo 'got-'.$value;
    }

 

The URL you need to paste into the editable config will need the JSON context switch in it:

$(".edit_area").editable("<?= $this->url(array('action'=>'my-editable-ajax', 'format'=>'json')) ?>", {
  cancel    : 'Cancel',
  submit    : 'OK',
  indicator : "Saving...",
  tooltip   : 'Click to edit...',
  placeholder : '&nbsp;'
})

Hope that helps.

 

 

13th of May, 2009@9:37:15 AM
add a comment, permanent link to article
Viewing page 2 of 21.
Previous page, next page.
Server Grind [0.0456 seconds]