How to reload/restart Plesk Configuration

March 29th, 2013 No comments

Just a note for myself here, I always forget this one. If you’ve made a change to an apache configuration file for a plesk website, you need to run this command to tell Plesk about it.

/usr/local/psa/admin/bin/websrvmng -a
Categories: Linux Tags:

How to extract domain from a URL in Excel

May 1st, 2012 No comments

This is just a quick tip. Let’s say that you’ve got “http://www.google.com/search?q=1234″ in cell B1 in Excel, but you want to display “google.com”. You can use this formula:

=SUBSTITUTE(MID(B1, FIND(“//”, B1)+2, FIND(“/”, B1, FIND(“//”, B1)+2)-8), “www.”, “”)

This isn’t perfect as it assumes you always use “http://”,  but it works pretty well for a quick, easy fix.

Categories: Excel Tags:

Fastest way to alter a large MySQL table

April 2nd, 2012 1 comment

In general, you should always be forward thinking when creating your database schema, but it’s impossible to foresee every business need for every aspect of every project. In some cases, you’ll have to alter your table structure – maybe add, drop, or alter a column. Read more…

Categories: MySQL Tags:

PHP: Fastest way to check if an array is empty

March 9th, 2012 No comments

I just posted benchmarks for checking for an empty string that I ran when looking to improve the efficiency of an application. Another simple benchmark I ran was for ways to check if an array is empty.

Like strings, there are a ton of ways to check if am array is empty. These here are not exhaustive, but a few that I chose to test:

  1. !$array
  2. $array == false
  3. empty($array)
  4. count($array) == 0
  5. $array == array()
Categories: PHP Tags:

PHP: Fastest way to check if a string is blank

March 9th, 2012 No comments

I run an application that requires a very high level of efficiency due to very high volume. I recently did an evaluation of efficiency for this application and performed a benchmark on a number of important aspects of the code. My findings were very interesting.

As you may know, there are a ton of ways to check if a string is empty. These here are not exhaustive, but a few that I chose to test:

  1. !$string
  2. $string == false
  3. empty($string)
  4. strlen($string) == 0
  5. $string == ” Read more…
Categories: PHP Tags: