Blog

  • ToLower-ToUpper and the CurrentCulture.CultureInfo

    I have recently being working on my largest multi-lingual site ever – over 30 languages – in ASP.NET.  While implementing it, there have been a lot of bumps and bruises along the way.  One of the most recent one was noticing that the ToUpper and ToLower functions in ASP.NET take the CurrentCulture.CultureInfo into consideration.

    As you may guess, this is both a blessing and a curse.

    When I’m working with text that is to be translated, but should appear upper or lower case this makes perfect sense that the CurrentCulture.CultureInfo should be taking into account.  However, be sure you remember this later when you are doing text transformations and text comparisons on words that should NOT be translated (like when using convert date with C#).

    At the end of the day, if you don’t want the CurrentCulture.CultureInfo to be used, both functions can be easily overloaded as follows:

    String.ToUpper(new CultureInfo(“en”))
    String.ToLower(new CultureInfo(“en”))

    I spent a fair bit of time tracking down why existing code was working perfectly, when suddenly as the team implemented the 8th language, something suddenly started failing.  Thank goodness for unit testing to quickly point out that there was a problem – then it was just a matter of understanding it!

  • Officially published my CakePHP Book

    Finally!  It has been a long time in the making, but my book is finally finished and published!  About two years ago, I began the undertaking of writing a book.  At the time it was merely a hobby while I was working on my blog.  Seeing if I could turn the success of my blog articles into a book.

    As you may recall a few months ago, I released an e-book.  This e-book was basically my original works written for CakePHP 1.2.  I saw some success with the e-book, so that made me believe that I should seek publishing on my book.  Unfortunately, there isn’t much hope for mainstream success with a big publisher like O’Reilly because CakePHP is too small of a niche for them to focus on.

    During this time, I focused on upgrading the book to be relevant to CakePHP 1.3.  I even added a special bonus chapter about upgrading from CakePHP 1.2 to 1.3, which I must say was extremely painless; especially if you stick with the standards.

    Anyways, I hope you take the opportunity to view my CakePHP book.

    Enjoy!

  • CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

    When I first started using CakePHP a few years ago, we had a lot of complaints about speed.  If you do some Google searches comparing CakePHP to other frameworks, it seems to be near the bottom of the pack.  I previously wrote a few articles on optimizing CakePHP here:

    Implementing the following tips certainly helped; however, if there are issues with the core framework response time, no amount of optimization will truley help.  So after reading up on CakePHP 2.0 and it’s recent speed improvements, I wanted to do some straight CakePHP comparisons.  Below are 10 load times for CakePHP 1.2, 1.3, and the new 2.0.  These load times are of a brand new install simply loading the default home view, no database connection or any model loading. (more…)

  • CakePHP 2-0 Ajax Pagination WITHOUT The Pages

    As I promised in Creating AJAX Pagination WITHOUT The Pages, I have created a full CakePHP example of performing AJAX pagination without the pages.  The goal of this article is to display news articles to a user.  As the user scrolls down, we will dynamically load in additional content so they can continue to scroll and read. This example focuses on PHP but if you’re looking for Node.js tutorial I’ve also implemented this exact feature with Node.js as the server-side code.

    One of our challenges is to not load too much or too little content.  For more details on this, please review the Creating AJAX Pagination WITHOUT The Pages.  Let’s begin. (more…)

  • CakePHP CSS Enhancements From 1.2 To 1.3

    This article does seem a bit late since CakePHP 2.0 is on it’s way.  However, I felt it prudent to point out a few things that I’m really happy to see in the new default CSS provided by CakePHP.

    On CakePHP’s website, you will find an excellent migration guide from 1.2 to 1.3 here:
    http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3

    It describes in great detail the various changes throughout the entire application and there are a lot of them.  But I think it left out some of the most important stuff, the default CSS provided for people who use the bakery to create their websites!

    One of the things that irked me in 1.2 was I had to manually update the paginator helper to display what field is currently being sorted on.  Many times I had to ensure my peers were also doing the same thing and a lot of time was wasted checking this and ensuring it was done correctly. (more…)