December 1st, 2009 / No Comments » / by natebean
Very nice plugin for cakePHP for uploading files with great documentation. Got it running with minimal effort. Would recommend.
An all around general purpose file uploader for CakePHP. Packaged as a stand alone plugin with file validation, file scanning and support for a wide range of basic mime types.
Class Features:
* Automatically sets all ini settings required for file uploading
* Support for a wide range of mime types: text, images, archives, audio, video, application
* Logs all internal errors that can be retrieved and displayed
* Saves a log for all uploads happening during the current request
* Automatically validates against the default mime types and internal errors
* Can scan the uploaded files for viruses using the ClamAV module
* Files can be uploaded anywhere within the webroot folder
* Convenience methods for deleting a file, moving/renaming a file and getting the file extension or dimensions
* Built in methods for resizing images and generating thumbnails
* Custom Behavior to add validation rules to your Models validation set
* Custom Behavior that allows models to attach files to automatically upload the file and save its information to a database
via Miles Johnson // Script: Uploader (Plugin).
Posted in: cakePHP
November 26th, 2009 / No Comments » / by natebean
A nice blog post from dsi.vozibrale.com on how to create a CakePHP behavior. This helps build on some of the missing points in the CakePHP manual. This post include also includes good references.
Simple hitcount behavior for CakePHP
Posted in CakePHP on 07.04.2008.
While developing Neutrino, I’ve decided to implement a simple hitcount behavior. So here it is.
For those few who don’t know, behaviors are “extensions” for models. In other words, they are reusable model logic. They help you keep your code DRY, easily maintainable and portable. In this case, we’re creating a hit counter behavior, hitcount for short.
via Simple hitcount behavior for CakePHP - lecterror.
Posted in: cakePHP
November 24th, 2009 / No Comments » / by natebean
Nice entry on how to get HABTM tests to work in CakePHP 1.2.
Test Fixtures for CakePHP Has-and-Belongs-to-Many Relationships
CakePHP, a popular MVC framework in/for PHP, offers a pretty easy-to-use object-relational mapper, as well as fairly straightforward fixture class for test data. Consequently, it’s fairly easy to get into test-driven development with CakePHP, though this can take some acclimation if you’re coming from Rails or Django or some such; the need to go through a web interface to navigate to and execute your test cases feels, to me, a little unnatural. Nevertheless, you can get writing tests pretty quickly, and the openness of the testing framework means that it won’t get in your way. Indeed, compared to the overwhelming plethora of testing options one gets in the Ruby space — and the accompanying sense that the choice of testing framework is akin to one’s choice of religion, political party, or top 10 desert island album list — CakePHP’s straightforward testing feels a little liberating.
Which is why it was a little surprising to me that getting a test fixture going for the join table on a has-and-belongs-to-many (HABTM) association is — at least in my experience — not the clearest thing in the world.
via Test Fixtures for CakePHP Has-and-Belongs-to-Many Relationships | End Point Blog.
Posted in: cakePHP
April 25th, 2009 / No Comments » / by natebean

Helpful and concise tutorial on using GIMP to design rounded buttons.
For last few day had been doing some designing. Had to make some buttons, so here is a tutorial for making a rounded cornered shiny button. And of course using GIMP
via Nothing To Lose | Little Shiny Blue Button.
Posted in: Gimp
April 25th, 2009 / No Comments » / by natebean
Create a web 2.0 badge in The Gimp
In this tutorial I will show you how to design a web 2.0 badge in the Gimp. These type of badges have made their place in the web 2.0 design as a great graphic to have on your website for all sorts of options such as subscribing to an RSS feed. Some techniques in this tutorial are based on the Photoshop tutorial written by Photoshop star which can be found here.
via Create a web 2.0 badge in The Gimp « Help Developer - Graphic and Web Design Blog with Collections, Freebies, Tutorials and Forums.
Helpful.
Posted in: Gimp
April 15th, 2009 / No Comments » / by natebean
Random Rows in MySQL
I have to admit that I had quite some trouble figuring out how I could get MySQL to return some random rows in a query. It was something I had to figure out for myself when I wanted to get a list of random websites off GIDTopsites™ to place on these pages here.
As usual, everything fell nicely into place and it was SO simple…
RAND()
Using rand(), I just had to add it to my SQL query
like this:
php:
// random row mysql query example
$sql = “SELECT * FROM tablename
WHERE somefield=’something’
ORDER BY RAND() LIMIT 5″;
// or, something like this
$sql = “SELECT * FROM tablename
ORDER BY RAND()”;
?>
via Learning Journal - Random Rows in MySQL.
Short and helpful.
Posted in: MySQL
April 13th, 2009 / No Comments » / by natebean
foreach
PHP 4 introduced a foreach construct, much like Perl and some other languages. This simply gives an easy way to iterate over arrays. foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes; the second is a minor but useful extension of the first:
foreach (array_expression as $value)
statement
foreach (array_expression as $key => $value)
statement
via PHP: foreach - Manual.
One of the downsides to jumping between Python and PHP, can’t always remember the syntax.
Posted in: PHP
Tags: syntax
April 11th, 2009 / No Comments » / by natebean
WordPress › WordPress Themes.
A good list of WordPress Themes. Not sure if these are useful if you are on wordpress.com.
Installing wordpress on your hosted server is quite easy with this handy guide.
Posted in: PHP
Tags: WordPress