MainelyDesign.com Blog

Tutorial Tagged Blog Posts

Turning Off Xdebug on a local web server

Posted on 08/28/2013 at 01:24 pm | Viewed 11,026 times | 0 comments

The settings listed below is what you are going to be adding to your php.ini file.  The xdebug.profiler_output_dir setting, you want to make sure that this goes to the right tmp directory on your server and xdebug.default_enable = 0 is shutting off the xdebug locally.

[xdebug]
xdebug.remote_enable = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
xdebug.var_display_max_depth = 15
xdebug.var_display_max_data = 4096
xdebug.max_nesting_level = 200
xdebug.remote_autostart= 0
xdebug.default_enable = 0

jQuery UI 1.10 Tabs - Using Aria-Controls to Set the URL of a Tab

Posted on 03/18/2013 at 01:00 pm | Viewed 79,966 times | 0 comments

I continue to find things that I overlooked on my upgrade to using jQuery UI 1.10.  This time it was the tabs API changes that got me. 

No more show(); Now use activate();

The first change that really did me in ("why aren't any of my tabs executing my show callback function???") was the elimination of the show() callback.  This callback used to be fired-off each time a panel was displayed.  The change is easy, just rename your callback to activate:

Free iPod to iTunes Music Transfer on Windows - iBackuper

Posted on 02/23/2013 at 11:47 am | Viewed 38,445 times | 0 comments

iBackuper is an iPod Access and Transfer Tool for Windows

My review of iBackuper: Excellent, Simple and easy to use.  You can't go wrong when there are only 3 buttons.

I can restore my iTunes Library onto a new Computer using my iPod. Sure thing.

My Windows music library computer finally crashed.  With its demise, all of my music files were safe.  Don't worry I said.  All my music is safely backed up to my iPod.  Common sense, right? Well, to actually import your iPod into iTunes and make your iPod be the actual starting point for the new music library (on the PC), you can't do it in iTunes!  You need software!  Well, most of us need software- if all of your music is in iCloud then you wouldn't be reading this article, anyway.  Right?

Avoiding Errors with Zend Lucene Search Results

Posted on 01/14/2013 at 02:34 pm | Viewed 16,173 times | 0 comments

A common, recurring headache and complaint among Zend Lucene search processing is handling the data fields in search results.

We all like to be flexible and robust in handling the results, we may want our search to return news articles, blogs or webpage content.  

Invariably,  we run into problems, usually in the form of an exception

Smooth Gradients in Photoshop

Posted on 10/24/2012 at 10:16 am | Viewed 14,738 times | 0 comments

Every now and then, when I look really close at a design in Photoshop, I see that one of my color gradient layers looks really bad.  I didn't know what this was called, until I searched around for how to get smooth gradients in Photoshop. 

Best Way To Get Transparent PNGs Without Any Hacks

Posted on 10/21/2012 at 10:27 am | Viewed 13,943 times | 0 comments

I avoided PNG images for quite a while, mainly because I could accomplish almost every task with transparent GIFs (if not, I could change the design ever so slightly).  Fast forward a few years and web designs are far too complex and textured to only use transparent GIFs, plus it's so much cooler to say "ping" than "gif".  Another reason I avoided using transparent PNGs was due to the ability to make IE (Internet Explorer) crash (suprise!).  Finally, I avoided using PNG images on my website because their filesize was ridiculous (what I could do in 10kb using a Gif, would take 71kb as a PNG).

Calling an Element from a Helper

Posted on 02/24/2012 at 02:07 pm | Viewed 12,653 times | 0 comments

This one caused me more than a little headache,  turned out it was easily solvable.

renderElement() can be used in a helper function.

The following example worked nicely for me.

In this case I am calling and element "order_form.ctp"

 

$theView = ClassRegistry::getObject('view');

Changing CakePHP's Model useTable on the Fly

Posted on 11/02/2010 at 05:12 pm | Viewed 18,558 times | 0 comments

I finally found an answer to/solution to something I've never been able to get around in CakePHP before: dynamically changing/setting the useTable value in a model.  You can't just say $this->CakePHPModel->useTable = 'cakephp_table_name';  Instead you have to use the following function:

Setting CakePHP Model useTable Dynamically

Using KDiff3 as Git GUI Merge Tool on Windows XP and Windows 7

Posted on 09/23/2010 at 01:39 pm | Viewed 51,266 times | 0 comments

I've been looking for the silver bullet solution to using KDiff3 as my git mergetool on Windows (using Git GUI).  I've finally got a solution that works in every Windows environment I've tried:

  1. Add the KDiff3 directory to your Windows System Path (e.g. C:\Program Files\KDiff3\)
  2. Add kdiff3 as your Git mergetool (From Git Bash, run git config --global merge.tool kdiff3)
  3. Add kdiff3 complete path to Git Config (From Git Bash, run git config --global meregtool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe")
  4. Go into Git GUI settings and set the mergetool to kdiff3 (if Git GUI doesn't pick up this setting from git config, which it should)

Getting All ACL Permissions in One Lookup (CakePHP 1.3)

Posted on 09/19/2010 at 11:36 am | Viewed 21,124 times | 1 comment

The biggest hurdle I've had to overcome migrating my CakePHP application from 1.2 to the much improved 1.3 branch involves Plugins and the ACL component.  A while back I noticed that my backend was kind of sluggish due to all of the ACL lookups (that happen with each request) so I optimized my ACL database tables.  At that same time, I also discovered an incredible mysql query that would lookup all of the ACL permissions for a particular ARO.  This setup worked great... until I started upgrading to CakePHP 1.3. 

Global Mysql Find and Replace with CakePHP

Posted on 08/31/2010 at 09:03 am | Viewed 14,711 times | 0 comments

I'm moving my Content Management System over to CakePHP 1.3.  I'll post an article about my experiences later.  Today I will focus on one and only one issue with the migration from Cake 1.2 to 1.3: the change of webroot/theme/ to webroot/theme/ to serve static content.  At first I was a little disapointed/scared at the prospects of making this change, but have since come to see the absolute brilliance in this approach.

Controlling CakePHP Error Handling When Debug = 0

Posted on 04/19/2010 at 04:27 pm | Viewed 27,932 times | 1 comment

I finally had a client request a piece of functionality that required me to program CakePHP so I could better control the default error handling when the site is in production mode (i.e. debug is set to 0).  By default, CakePHP will throw a 404 page not found header whenever ANY errors occur on a production site with debug equal to zero.  This works great, most of the time.  But what about when you are having database connectivity issues?  Say when there are too many mysql connections to that overloaded shared hosting box?  Modifed CakePHP error handling to the rescue.

Setting Envelope-From in CakePHP's Email Component

Posted on 03/22/2010 at 05:56 pm | Viewed 17,812 times | 1 comment

I've setup a form that allows customers to sign up for an email newsletter and receive a coupon. I wanted to be able to track the bounced messages in case a legitimate customer's coupon was bounced for whatever reason. As I've learned, setting up the "return-path" for an email message isn't as simple as setting $this->Email->return = 'email@domain.com';  You have to use an as yet undocumented feature... $this->Email->additionalParams;

2 Neat Little PHP Tricks

Posted on 03/16/2010 at 04:15 pm | Viewed 12,481 times | 0 comments

In writing a function to validate bank routing numbers, I came across two simple techniques, that I know I will need to use again:

PHP Trick 1: Remove All Characters Except Numbers from a String

A simple little regex does the trick:

$routingNumber = preg_replace('[\D]', '', $routingNumber);

Create a Checklist Group or Related Checkboxes in CakePHP

Posted on 03/05/2010 at 12:38 pm | Viewed 43,620 times | 1 comment

This is an interesting one.  I needed to create a group of checkboxes.  In my mind, it's just like a radio button group, except with checkboxes.  The only difference should be that with radio buttons you can only select one, while with a checkbox group you should be able to select as many as you want.  To achieve a checklist group in CakePHP is a little convoluted.

Export to PDF from Microsoft Publisher

Posted on 03/05/2010 at 10:54 am | Viewed 12,234 times | 0 comments

I have a client that sends me newsletters in Microsoft Publisher format.  I wanted to output the newsletter as a PDF, but wanted to keep the text for SEO and so users can copy and paste the text if needed.  Microsoft Publisher doesn't have an export to PDF function, so usually I would just do a File > Print and select Adobe PDF as the printer.  However, this would just be an "image" of the document, not the actual document with selectable text.  This is how you can get a PDF with rendered text out of Microsoft Publisher...

Which Submit Button was Clicked in CakePHP? Use Name.

Posted on 03/04/2010 at 12:01 pm | Viewed 26,069 times | 2 comments

If you want to have multiple submit buttons that make a form do different things there's a simple way to do this.  The name of the submit button that was clicked by the user will be sent (via POST) with all the other POSTed data.  This is very handy if you want to have a cancel button and continue button. In CakePHP the name of the button won't be in $this->data, but it's easy enough to get...

PHP Break Out of All Foreach or While Loops

Posted on 02/25/2010 at 02:44 pm | Viewed 23,308 times | 0 comments

Let's have some fun with PHP's break command... I didn't think it was possible.  I just learned (I've been programming PHP for like 7 years) that you can instruct break how many levels of nesting to break out of!  I'm not surprised that break in PHP allows you to specify the number of loops (or switch statements) to break out of, but I am surprised it took me this long to use it!

Changing the Order Sequence of CakePHP Behaviors

Posted on 02/25/2010 at 07:20 am | Viewed 13,179 times | 0 comments

For reasons too long to explain in this post, I have two behaviors that are run on the same pieces of data (a translate behavior and a settings import/export behavior).  One behavior is attached to the model using var $actsAs, while the other behavior is attached dynamically, during runtime using $this->attachBehavior();.  I needed the "hardcoded" behavior to run after the dynamically attached behavior.  Here's what I did:

Getting a List of Database Tables in CakePHP

Posted on 02/23/2010 at 12:22 pm | Viewed 18,420 times | 1 comment

I ran into an interesting problem today.  What I wanted to do was know if a table didn't exist in my CakePHP application.  What happens- a cakeError is thrown everytime a database table doesn't exist.  This is really annoying...I think it would be beneficial to be able to tell Controller::loadModel() to return false instead of an error message.  That's not the case.  Here's how I got around it (with thanks to Miles Johnson):

Best CSS Method for Using Image as Submit Button

Posted on 02/03/2010 at 12:17 pm | Viewed 21,476 times | 2 comments

I came across an interesting issue with web forms and CSS.  Surprisingly, the end result is much better than I expected.  I knew that using an image instead of a traditional form submit button (<input type="submit">; instead of <input type="image"> or <input type="button">) would be a little challenging.  I like a challenge, plus I wanted to use the submit button because it's the standard approach to forms and I remember reading somewhere that input's of type image or button do not submit when you press enter...a usability faux paus in my opionion.

Using Git and Plink for SSH on Windows

Posted on 01/25/2010 at 11:11 am | Viewed 38,791 times | 0 comments

Well, I finally had an opportunity to install Git on Windows yet again.  It had been quite a while since my last time installing Git on Windows, so I was a little rusty and couldn't figure out how to get Git to use Plink for SSH.  It's actually quite simple and dependent on a Windows system variable.

Getting Git to use Plink for SSH on Windows

Using Jquery for target="_blank" and strict xHTML

Posted on 12/28/2009 at 03:27 pm | Viewed 15,253 times | 0 comments

If you like to see the little green check mark that HTML Validator shows when your HTML is 100% valid, you'll love this little trick. Thanks to badlydrawntoy.com

12 Essential Photoshop Keyboard Shortcuts

Posted on 12/21/2009 at 05:05 pm | Viewed 12,437 times | 0 comments

I remember about 7 years ago watching my friend use Adobe Illustrator.  He was a communications design major and used his keyboard more than his mouse.  I was blown away when I realized how much time you could save by learning keyboard shortcuts for Adobe's products.  This is my list of the best Adobe Photoshop keyboard shortcuts for web designers.

Full Tag List

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design