End Your If

Helping you solve those tough coding problems!

Learn some great development 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 | ajax | sql | php-development | jquery-development | css

Search:
Follow @endyourif rss Facebook LinkedIn
My Books

Setting up SSL with nginx including redirects from non HTTPS traffic Setting up SSL with nginx including redirects from non HTTPS traffic

Published on Feb 6, 2019 by Jamie Munro

In an attempt to improve security and privacy on the Internet, Google is encouraging websites to secure their site with an SSL certificate, aka https:// instead of http://
As you may have noticed, I just officially updated my domain to be under SSL. As I described in my It's LEMP not LAMP post that I use nginx for my web server. I thought I would share how easily I was able to convert my website to use SSL with nginx.
Before you begin, be sure you have already created your SSL certificate and have your certificate and private key files ready and uploaded to your server (I got my SSL cert free with my domain registration at Porkbun).

Read more >

Tags: SEO (Search Engine Optimization) | Optimization | nginx | ssl

C# OutputCache with subdomains C# OutputCache with subdomains

Published on May 4, 2018 by Jamie Munro

The other day I was working on a project that was leveraging OutputCache. This little attribute is a fantastic way to implement caching in an MVC project. It was being used as follows but it was not working when we had multiple subdomains sharing the same controllers and actions:



[OutputCache(CacheProfile="CacheProfile")]

public ActionResult Index()

{

return View();

}

Read more >

Tags: Optimization | ASP.NET

MySQL: OR versus UNION – which is faster? MySQL: OR versus UNION – which is faster?

Published on Mar 24, 2014 by Jamie Munro

I must say, this came as a shock to me, until I looked at the results and thought about it for a minute.  Before jumping in, let me explain how and where I encountered this.  I was recently working on a project called Deja Scene – The actor to actor movie database.  The purpose of this site is to find two actors who have starred in multiple movies together.

Because the nature of the algorithm an actor can be either on the left side of the connection or the right side.

Let’s look at an example, if I search for George Clooney, I will find that he has 372 Deja Scene connections.  Here was the original query I used to retrieve the list of his connections:



SELECT *

FROM  `actor2_actors`

WHERE actor1_id =1

OR actor2_id =1



Seems pretty straight forward; however, I was seeing really slow performance and I couldn’t figure out why.  I created an index on both the actor1_id and the actor2_id, so I assumed Mysql was properly indexing this.  Boy was I wrong.  Look at the results when I use the EXPLAIN function:

Read more >

Tags: SQL | Optimization | performance | mysql

Three-month work-life retrospective Three-month work-life retrospective

Published on Sep 11, 2013 by Jamie Munro

Just over three months ago, I posted a few memorable blogs (for me) in regards to a career change.  The career change has been made and I thought I would share my retrospective on how it has affected me.

Following the format of the retrospectives I have been over the past 3 months, I’ll start with a check in word:

Rejuvenated

Making the move from an 85% managerial role to a 100% development role has completely rejuvenated me.  In the past three months I have gained an incredible amount of knowledge and furthered myself as a person and a developer.

Moving along to the next items:

  • What do I want to stop doing?

  • What do I want to start doing?

  • What do I want to continue doing?


Read more >

Tags: Optimization | stress | Theory | Rants | agile | scrum | retrospective

I’m hooked on test-driven development (TDD) I’m hooked on test-driven development (TDD)

Published on Aug 6, 2013 by Jamie Munro

I’ve only been doing TDD for a few weeks, but I’m completely sold.  I don’t want to go back!  I’ll be honest though, it hasn’t been easy.  I’ve made mistakes, I’ve wasted time, but I’m really starting to reap the benefits.

I’ve always thought I was a good developer.  I write decent code and it works mostly as expected.  It took me many years into my career before I wrote my first unit test.  It always fell into the category of too time consuming or expensive.  Oh the irony!

As I started learning how to write to unit tests, I always found myself rewriting things I already did just to get them to be unit tested; how frustrating!  A unit test that should have only took a few minutes, ended up taking a really long time because the code had to be refactored just to be tested.  No better way to turn you off from unit testing.

Enter test-driven development…

Read more >

Tags: Optimization | ASP.NET | Theory | fizzbuzz | tdd | test-driven development

If You Don't Start You Won't Finish If You Don't Start You Won't Finish

Published on Jun 13, 2013 by Jamie Munro

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

Developers are Authors Developers are Authors

Published on Jun 6, 2013 by Jamie Munro

Automapper Performance Testing Automapper Performance Testing

Published on May 27, 2013 by Jamie Munro

Simplifying the buzz word “Responsive Design” Simplifying the buzz word “Responsive Design”

Published on Feb 4, 2013 by Jamie Munro

Node.js Versus Nginx: Bare Bones Test Node.js Versus Nginx: Bare Bones Test

Published on Dec 4, 2012 by Jamie Munro

Node.js Versus Apache2: Bare Bones Test Node.js Versus Apache2: Bare Bones Test

Published on Dec 3, 2012 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

Load Testing Mysql with mysqlslap Load Testing Mysql with mysqlslap

Published on Sep 17, 2012 by Jamie Munro

Update: It Actually Should Be LEPP Not LEMP or LAMP! Update: It Actually Should Be LEPP Not LEMP or LAMP!

Published on Sep 14, 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

A Simple But Effective Speed Comparison A Simple But Effective Speed Comparison

Published on Sep 4, 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

Highlights from Webistrate: HTML5, MVC 3, and CSS3 Highlights from Webistrate: HTML5, MVC 3, and CSS3

Published on Sep 21, 2011 by Jamie Munro

Improving the speed of AJAX request and response times Improving the speed of AJAX request and response times

Published on Sep 1, 2011 by Jamie Munro

CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

Published on Mar 7, 2011 by Jamie Munro

CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

Published on Mar 7, 2011 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

Speeding up client/server response times Speeding up client/server response times

Published on Jan 10, 2011 by Jamie Munro

Speeding up client/server response times Speeding up client/server response times

Published on Jan 10, 2011 by Jamie Munro

Optimizing CakePHP Websites Optimizing CakePHP Websites

Published on Jan 20, 2010 by Jamie Munro

Optimizing CakePHP Websites Optimizing CakePHP Websites

Published on Jan 20, 2010 by Jamie Munro

Caching Queries in CakePHP Caching Queries in CakePHP

Published on Apr 25, 2009 by Jamie Munro

Optimize your CSS and JS with CakePHP in minutes Optimize your CSS and JS with CakePHP in minutes

Published on Mar 21, 2009 by Jamie Munro

When to use element() and when to requestAction() When to use element() and when to requestAction()

Published on Mar 16, 2009 by Jamie Munro

CakePHP Containable Statement Pitfalls CakePHP Containable Statement Pitfalls

Published on Mar 15, 2009 by Jamie Munro

CakePHP Containable Statement Pitfalls CakePHP Containable Statement Pitfalls

Published on Mar 15, 2009 by Jamie Munro

The Importance of Database Indexing The Importance of Database Indexing

Published on Feb 27, 2009 by Jamie Munro

Dynamic COUNT() Versus Static COUNT() Dynamic COUNT() Versus Static COUNT()

Published on Feb 24, 2009 by Jamie Munro

Dynamic COUNT() Versus Static COUNT() Dynamic COUNT() Versus Static COUNT()

Published on Feb 24, 2009 by Jamie Munro

Why You Should Avoid ORDER BY RAND() OR NEWID() Why You Should Avoid ORDER BY RAND() OR NEWID()

Published on Feb 23, 2009 by Jamie Munro

Why You Should Avoid ORDER BY RAND() OR NEWID() Why You Should Avoid ORDER BY RAND() OR NEWID()

Published on Feb 23, 2009 by Jamie Munro

Fixing slow drag and drop with scriptaculous Fixing slow drag and drop with scriptaculous

Published on Feb 18, 2009 by Jamie Munro

SQL Tips - Why LEFT JOINS are bad SQL Tips - Why LEFT JOINS are bad

Published on Feb 13, 2009 by Jamie Munro

SQL Tips - Why LEFT JOINS are bad SQL Tips - Why LEFT JOINS are bad

Published on Feb 13, 2009 by Jamie Munro

How to get indexed by Google in ONE hour How to get indexed by Google in ONE hour

Published on Feb 12, 2009 by Jamie Munro

YSlow - Helping slow web pages load faster YSlow - Helping slow web pages load faster

Published on Feb 11, 2009 by Jamie Munro