Select Page

Author: Darren Cato

Setting up a new ruby application

I’ve recently started doing most of my server side web development work in Ruby as opposed to PHP. This has little to do with preference. I accepted a new software developer position and it just so happens they the product is built with Ruby. I happen to really like working with PHP and I have no plans of abandoning the PHP community. So no flame wars please. Having said that I am a ruby noob, and in order to ramp up quickly I’ve decided to build my next personal project using Ruby and the Rails framework. It turns out...

Read More

Setting an older Ruby project with RVM

I’ve decided to take the plunge into the world of Ruby. Because I’ve dabbled before I have some some other project on my Ubuntu machine that depended on a little Ruby. To get up and running I’m using the highly recommended book Agile Web Development with Rails (Pragmatic Programmers). The only problem is I am using the Third Edition where all the examples use Ruby 1.8.7 and Rails 2.2.2 One of the biggest gripes I had years ago when I was first presented with Ruby project to tweak was its complete lack of backward compatibility. A little utility call...

Read More

Use Zend acl with Codeigniter

So i’m still using CodeIgniter on my latest project and while I would prefer to use Zend Framework, CodeIgniter is getting the job done. There are some required things however that CodeIgniter does not do well out of the box. Things like Authentication, ACL and Unit Testing. The first of these issues, i needed to tackle was the ACL (Access Control List). Turns out Zend has a really good ACL library, which i’ve used before. Their¬†documentation¬†is also pretty decent. Since i wanted to gently introduce my team to Zend framework I jumped at the opportunity to integrate the Zend...

Read More

Append file type thumbnails to dom using javascript (jquery) after upload

There are several javascript utilities available to provide you user with a pleasant way to upload files from the front end of your web application. My utility of choice today is wonderful jquery plugin called plupload. You can read more about plupload on their website. What file upload utility you choose to use is up to you, my goal today is to present you with a little javascript code that will allow you to show an appropriate icon next to your freshly uploaded file. For example, pdf’s will show a pdf icon, and all images will show an image icon. // use some regular expression goodness to match the appropriate file extension var pattern=/\.[0-9a-z]+$/i; // extract file extension var ext = (file.name).match(pattern); ext = ext[0].toLowerCase(); // set default icon var icon = 'http://'+window.location.hostname+'/js/plupload/img/attachment.png'; // check for pdf's if( '.pdf' == ext){ icon = 'http://'+window.location.hostname+'/js/plupload/img/pdf_file.png'; }// check for images else if( '.jpg' == ext || '.gif' == ext || '.png' == ext || '.jpeg' == ext){ icon = 'http://'+window.location.hostname+'/uploads/'+file.target_name; } // at this point you can check for other likely extensions, such as word doc, or excel files. // display the icon var thumb = '<div class="plupload_thumb"><a href="" title="" rel=""><img src="'+icon+'"></a></div>'; Like this:Like...

Read More

Remove truncated var_dump on xdebug

Xdebug has been called the swiss army knife for php developers and for good reason. It’s a must have tools with helps with everything from debugging to code coverage. Once of the many cool features of xdebug is that it formats and and syntax highlights the output from var_dump. However a negative side effect is that it truncates this output. To fix this simple enter the information below in you php.ini file and restart apache. -1 sets the value to unlimited xdebug.var_display_max_data=-1 xdebug.var_display_max_children=-1 xdebug.var_display_max_depth=-1 See the five part series on Zend Developer Zone for a complete tutorial on using xdebug Like this:Like...

Read More
%d bloggers like this: