25 Apr 2009 @ 7:32 AM 

If you haven’t noticed already, at times CakePHP can be a little slow loading!  The reason for this is quite simple.  Rapid Application Development.  To allow for RAD, sometimes we must give up something, in this scenario it’s a bit of speed when loading.  Don’t worry, CakePHP offers some excellent utilities to help with this.

The one I will focus on today is caching our CakePHP query results.  The key to this is, we are caching the results, not the queries themselves.  If you know databases well, you may be thinking, “why do I want to cache queries, doesn’t my database server do this already?”  The answer to the question is, yes it does.  However, CakePHP still needs to call the database query and parse your results.  What I’m proposing, will avoid both of those steps and allow you to just retrieve the results.

This process not only avoids excess load on the database, it also reduces PHP’s processing time that CakePHP has to do to provide you with such useful arrays. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 24 Apr 2009 @ 08:35 PM

EmailPermalinkComments (7)
Tags
Tags: ,
Categories: CakePHP, Optimization
 18 Apr 2009 @ 7:49 AM 

Yesterday, at work, it occurred to me, not for the first time, that something that comes so easily to me, does not to others.  I had tasked someone with, what seemed a simple task, to retrieve a list of users who have reached minimum payout.

The payouts were stored in a separate table from the users and users could have multiple payment records prior to reaching payout, thus we would need to use a SUM() on the amount.  Because we also required other data, we need to use a group by to properly sum the amounts a user has.

The task was handed back to me several hours later to review, it was quite evident that the main concept was “grasped”, but the understanding of group bys was not. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 18 Apr 2009 @ 07:49 AM

EmailPermalinkComments (0)
Tags
Tags: , , ,
Categories: SQL
 15 Apr 2009 @ 1:39 PM 

Because you can never be sure how long it will take to retrieve content from a web page and have it displayed on the iPod/iPhone, it’s quite nice to provide the user with an indication that the content is being retrieved.

The following article provides a nice and easy way to start and stop and animation indicator when the content is being retrieved and has been loaded. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 15 Apr 2009 @ 01:39 PM

EmailPermalinkComments (3)
Tags
 13 Apr 2009 @ 9:23 AM 

My pet peeve list seems to grow on a regular basis.  One of them is poorly optimized code.  Not only is the code I’m going to discuss poorly optimized, it’s from the documentation of CakePHP!

If you search for creating custom pagination in CakePHP, you will find quite a few results, potentially this one.  The one that I would assume the best would be the one from CakePHP itself, but it’s not and let me show you why. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 13 Apr 2009 @ 09:23 AM

EmailPermalinkComments (9)
Tags
 10 Apr 2009 @ 11:37 AM 

Good Friday to all.  Over the past several weeks I have been working a lot with the AuthComponent in CakePHP and have learned a couple of lessons that I wanted to share with you all.

The title calls them “flaws”, but I suppose this isn’t completely accurate, it depends how you look at it.  To me they are flaws because I assumed the AuthComponent worked one way, only to find out different. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 10 Apr 2009 @ 11:37 AM

EmailPermalinkComments (7)
Tags
Tags:
Categories: CakePHP
 08 Apr 2009 @ 3:35 PM 

I am starting to really dislike the PHP function isset().  Today, I was working on a registration system in CakePHP and my password validation was not working.  If I left the password field blank and clicked submit, it would come back with other errors, but then the password would come back populated with a long string – a hashed version of an empty string!

After some investigation, I discovered that the AuthComponent in CakePHP was doing an isset() check on the username and password fields.  If isset() returned true for both, it would hash the password. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 08 Apr 2009 @ 03:35 PM

EmailPermalinkComments (12)
Tags
Tags: ,
Categories: CakePHP, php
 06 Apr 2009 @ 4:20 PM 

The following is a neat little trick to reset your navigation controller when it is integrated with UITabBarController.

The following code will pop the navigation controller up when the user clicks on your tab bar item.  I’ll begin by showing a bit of code that needs to take place.  It’s going to be a quick overview of this to focus on the main function to reset the navigation controller. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 06 Apr 2009 @ 04:20 PM

EmailPermalinkComments (0)
Tags
 04 Apr 2009 @ 10:19 AM 

I struggled with this one for quite a while.  I kept searching and searching, all I could find was forums and no one seemed to have an answer!

Well, if you’re here, don’t worry, I have the answer you have been looking.  Let me show you how to make a UIWebView scrollable for your iPhone application. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 04 Apr 2009 @ 07:34 AM

EmailPermalinkComments (9)
Tags
Tags: ,
Categories: iPhone
 02 Apr 2009 @ 2:11 PM 

The other day I was working on my iPhone application.  In the application I have a view.  This view creates a UIWebView.  I then proceed to load content from a webpage into the web view.

This works great.  I was then tasked with adding a bit of style to the view.

I started by creating all of the style in the webpage, but I quickly realized that this was causing the load to be a lot slower.  Instead I had to integrate the design into the view and simply display the content from the webpage in the design.

This was going pretty well until the webpage sat like a big white blob on top of my nice image.  I couldn’t let this be and had to find a solution, luckily it wasn’t to complicated. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 02 Apr 2009 @ 10:21 AM

EmailPermalinkComments (0)
Tags
Tags: , ,
Categories: iPhone
 01 Apr 2009 @ 4:30 PM 

Quite often at work, I find myself reminding my team members to be sure to ALWAYS utilize the framework to it’s fullest.  Just because you are unsure how to do something or have never done it before in the framework, does NOT mean that it cannot be done!

I use to have this thinking as well.  I would curse and curse, I’ve done this a 100 times, why is it so difficult to do with this framework!

Once I calmed down, I would Google it or look around the documentation and pretty quickly discover how to accomplish it using the framework.  9 times out of 10, I found that it was actually extremely easy to implement.  Not only that, 7 or 8 times out of 10, it would actually save me time!  If it didn’t the first time, it certainly always saved me a lot more the next time. More »

  • Share/Bookmark
Posted By: Jamie
Last Edit: 01 Apr 2009 @ 04:31 PM

EmailPermalinkComments (0)
Tags
Tags: ,
Categories: Theory

 Last 50 Posts
 Back
Change Theme...
  • Users » 14
  • Posts/Pages » 75
  • Comments » 236
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight