Helping you solve those tough coding problems!
Learn some great web development and web design tips and techniques through recipes that clearly define the problem being solved with a working solution.
Popular Tags: cakephp | theory | optimization | javascript-development | asp-net | css | jquery-development | sql | ajax | c

Search:
Follow @endyourif rss Facebook LinkedIn

Using CakePHP with the jQuery Sortable Plugin Using CakePHP with the jQuery Sortable Plugin

Published on Mar 4, 2019 by Jamie Munro

It's time to permanently remove all "manual" sorting from the Internet. You know the one I mean where it has the up and down arrows – or even worse, the text box that accepts a numerical order input. By implementing the jQuery Sortable Plugin, you will be able to provide a simple, but effective drag-and-drop ordering solution for just about any type of data!

In a recent article, I described the required HTML and Javascript code need to implement the jQuery Sortable Plugin on a gallery of images. If you haven't already done so, please begin by reading this article because this one will gloss over those features and focus on how to implement this with CakePHP.

Read more >

Tags: CakePHP | jquery | PHP | JavaScript | jQuery | CakePHP

Cannot find module (SNMPv2-TC) Cannot find module (SNMPv2-TC)

Published on Feb 18, 2019 by Jamie Munro

When I run PHP via the command line (aka php cli), I often would be spammed with the following error messages:
Cannot find module (SNMPv2-TC)
Cannot find module (SNMPv2-SMI)

Messages like this would repeat for 30 or 40 lines. These errors would not stop my command from executing; however, it was extremely noisy when trying to see the output.

Read more >

Tags: CakePHP | PHP

Setting Up CakePHP with IIS Setting Up CakePHP with IIS

Published on Jun 11, 2013 by Jamie Munro

I’ve found myself doing this several times over the past little while as I had to switch computers.  Each time I would struggle with a few of the steps, so I thought I would document them this time and share for future me (or you if you like).

Read more >

Tags: CakePHP | php | PHP | mysql | iis | CakePHP

What Do You Care Most About When Reviewing Someone Else’s Code? What Do You Care Most About When Reviewing Someone Else’s Code?

Published on Jun 10, 2013 by Jamie Munro

I wrote an article a few months ago called Compelling Interview Questions where buried deep in the middle under several open-ended technical questions I asked the question “What Do You Care Most About When Reviewing Someone Else’s Code?”

The funny part about this when you read a few lines below I follow it up with I’m not looking for anything in particular; just some generic catch-phrases that most people throw out there.  E.g. properly indented code, no large comment blocks, documentation to explain a complex block of code, etc…

Ask me today what I expect from this question and my answer is totally different!  Today being as I write this article – ask me in the present and let’s see if my answer changes…

Read more >

Tags: Optimization | php | socket server | PHP | interview | Rants | clean code

Implementing the Repository Pattern with CakePHP Implementing the Repository Pattern with CakePHP

Published on Jun 3, 2013 by Jamie Munro

I must admit, my recent articles are becoming a bit obsessed around the repository pattern.  What can I say, I like it, it’s useful, and it’s not restrictive based on a language or a framework.

I’ve long professed how I dislike convoluted controllers.  CakePHP’s find method almost immediately causes this when used inside a controller.  More importantly, the code inside the find method is extremely unreadable.  This is almost more important than a large controller function!

This is where the repository pattern comes in.  At its most basic example (which some will consider overkill – you know who you are), I still think the repository pattern is clearer.

Here is an example using the regular find approach:


$user = $this->User->find('first', array('conditions' => array('id' => $id)));


Compared to a repository example:


$user = $this->UserRepository->GetById($id);


The code is almost identically; however, in the second example, it’s clear that if I were to “read” the code I am retrieving a user by id opposed to I’m finding the first user with the conditions of id being equal to the variable $id.

So if you are sold, let’s continue with a full suite example…

Read more >

Tags: CakePHP | PHP | repository | CakePHP

Recent Guest Posts on PHPMaster.com Recent Guest Posts on PHPMaster.com

Published on Jan 7, 2013 by Jamie Munro

PHP: Single Quotes versus Double Quotes PHP: Single Quotes versus Double Quotes

Published on Oct 9, 2012 by Jamie Munro

Upgrading my Blog - The Final Saga! Upgrading my Blog - The Final Saga!

Published on Sep 24, 2012 by Jamie Munro

The Best Way to Prevent SQL Injection The Best Way to Prevent SQL Injection

Published on Sep 19, 2012 by Jamie Munro

CakePHP 2.x Login System CakePHP 2.x Login System

Published on Sep 18, 2012 by Jamie Munro

A Short Rant About Coding Conventions A Short Rant About Coding Conventions

Published on Sep 13, 2012 by Jamie Munro

Comparing a while loop against a foreach loop of an array Comparing a while loop against a foreach loop of an array

Published on Sep 12, 2012 by Jamie Munro

What I Learned This Summer What I Learned This Summer

Published on Sep 7, 2012 by Jamie Munro

It's LEMP not LAMP! It's LEMP not LAMP!

Published on Sep 6, 2012 by Jamie Munro

PHP: Require/Include vs Autoloader PHP: Require/Include vs Autoloader

Published on Aug 29, 2012 by Jamie Munro

CakePHP Version Comparison with PHP Version Comparison CakePHP Version Comparison with PHP Version Comparison

Published on Jun 25, 2012 by Jamie Munro

Building A Scalable Queueing System With PHP Building A Scalable Queueing System With PHP

Published on Feb 14, 2011 by Jamie Munro

Maintaining a session in a session-less environment Maintaining a session in a session-less environment

Published on Jan 17, 2011 by Jamie Munro

The flaws of using isset() The flaws of using isset()

Published on Apr 8, 2009 by Jamie Munro

Re-map key/value array data in PHP Re-map key/value array data in PHP

Published on Mar 19, 2009 by Jamie Munro

How to create a socket server in PHP How to create a socket server in PHP

Published on Mar 2, 2009 by Jamie Munro

StringExtractComponent for CakePHP StringExtractComponent for CakePHP

Published on Feb 28, 2009 by Jamie Munro

Facebook Development and $_SERVER['HTTP_REFERER'] Facebook Development and $_SERVER['HTTP_REFERER']

Published on Feb 15, 2009 by Jamie Munro