| Latest |Kites |Pictures |Programming |Life |
![]() [filed under life]Tesco VX1 Party Phone review ![]() OK phone, cheap and cheerful. Just calls and text msgs. Which is fine for me :) When texting PRESS # to turn off predictive text! For more hints and tips see the VX-1 MINI MOBILE PHONE FAQ ![]() [filed under Programming]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! ![]() [filed under Programming]C# silverlight and all that shit ![]() [filed under life]Blair ![]() [filed under Programming]PHP code style ![]() ![]() [filed under Programming]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.* Comments: This Firefox add-on build script was useful. 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.
![]() [filed under Programming]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 In your controller you'll need to add a context swtich to return JSON, not HTML: public function init() You action will look like this: function myEditableAjaxAction()
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')) ?>", { Hope that helps.
![]() [filed under Programming]zend framework sql error reporting adapter ![]() This post is about Zend Framework, sql error reporting. Problem: Lets fix it so it shows the whole query. I found this neat class that reports the SQL, it work by extending the Zend_Db_Adapter_Pdo_Mysql class. I use MySQLi, so I adapted it so it works for me: class MyCompany_Db_Mysqli extends Zend_Db_Adapter_Mysqli
{ public function query($sql, $bind = array()) { try { return parent::query($sql, $bind); } catch (Exception $e) { if( $this->getProfiler()->getEnabled() ) { echo '<span style="color: red; font-size: 20px;">MyCompany_Db_Mysqli adapter Error</span>';
echo '<div style="font-family: monospace; padding: 10px; margin: 10px; border: 2px solid pink;">'; echo nl2br($sql); echo '<hr>'; echo '<pre>'; echo var_dump($bind); echo '<pre>'; echo '</div>'; } else { // no profiler throw $e; } } } } The whole thing is a little bit quick and dirty. I wanted to see if it worked and post a blog entry about if it did. You need to save the file into your library code (replace MyCompany with your library directory name) in the Db directory. To use it you want to find where you load your database adapter, I do this in my controller init() function. My init() looks like this: class ProjectsController extends Zend_Controller_Action
{ // // this is called from __construct // public function init() { parent::init(); $config = new Zend_Config_Ini('/var/www/ZF-apps/config.ini', 'general'); //$db = Zend_Db::factory($config->projects->db); $db = new Guava_1_Db_Mysqli($config->projects->db->params); $db->getProfiler()->setEnabled(true); Zend_Db_Table::setDefaultAdapter($db); ... ... Note how I have commented out how I used to get my adapter. Also see how the params are loaded from an .ini file and used slightly differently. How to use it: You'll want to add your own logic into the adapter so it emails off the error report (or pasts it into an RSS feed or something)
![]() [filed under Programming]XUL Firefox add on sidebar open close events ![]() Tags: Firefox 3.x add-on sidebar. What this post is about I am coding a FIrefox add-on. It is fun. I am making a sidebar that you can drag and drop stuff onto. I need to know when the user has opened it or closed it (so I can persist the data) so after a lot of googling I figured it out. The code This is how you can watch the open and close events of a sidebar. In your sidebar javascript file put this in: var skratch = { Hope that helps someone. Use this with 'save to file' to persist data in your add-on - happy days. Happy fuckin days, man. Here is some save to file goodness (note: the code is GPL): ![]() [filed under Programming]MySQL compare sub query null ![]() Hey, this is cool. I had a query like so: SELECT stuff And the sub query was returning NULL sometimes. So I wanted the rows from table where col is null. But the syntax to do that would be: SELECT stuff Now this query isn't going to work when the sub query returns a number. The answer is to use this funky operator thatsolves this problem SELECT stuff Smooth :-) |
| Server Grind [0.0404 seconds] |