I loathe Theoretical Web Designers

Skills: Theoretical Advanced Knowledge of HTML and CSS. I'm going to let that phrase sink in for a while. *deep breath, okay continue*

I've seen that on a resume for a Web Designer before. Unbelievable right?It is actually refreshingly honest as most Web Designers only work as theorists.

I've worked with a lot of web designers over the years. Most of them work in Photoshop and pass off their PSD's to front-end developers for the implementation. Usually, a lot of back and forth commences between the two as the front-end guy has to deal with forgotten items such as roll-overs, UX, error states, etc. Maybe the front-end guy doesn't get the PSD's until after the client has approved the designs. Good luck buddy.

This back and forth costs business a lot of money. Every project, every page comp, every client, every time. It adds up quickly. I'm putting Web Designers on notice, if you can't build your design in HTML and CSS, you're a Theoretical Web Designer (TWD).

TWDs can and will do anything. Their world is a blank canvas. Who cares if the whole site is two columns, on this new section, I want four. Who cares if this page is 1024 px wide but the whole site is 960 px, the client has already approved it!

Besides time wasted, TWDs hurt in other ways. They foster code bloat, excess templates, poor user experience and bad practices, which go on to affect SEO, high availability and front-end performance.

I'm tired of TWDs and an industry that supports them. I want a real Web Designer, who gets their hands dirty with HTML, CSS, and jQuery. Maybe a person who doesn't even use Photoshop! Maybe, if it isn't too much to ask, a person who knows a framework like Drupal or Wordpress and be competent at working with them.

I'm sure you real Web Designers are all employed and well paid because you're hard to find. Really hard to find.

In the end, we ended up passing on this resume, we didn't want to waste our time with a TWD.

TWDs all is not lost. Quit your copy of Adobe Muse, you've got some learning to do so get to it.


Drop all tables in a MySQL database

mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]

Edit: On second thought, reading MySQL docs it says that...

When a database is dropped, user privileges on the database are not automatically dropped.

I should probably test this but it sounds as though a DROP [DATABASE] && CREATE [DATABASE] will do the trick for you.


Code Snippet: Revert all overridden views

$views = views_get_all_views();
foreach ($views as $view) {
  if ($view->disabled) continue;
  if ($view->type == t('Overridden')) {
    views_object_cache_clear('view', $view->name);

Installing XHProf in MAMP for Drupal 6

XHProf is a hierarchical profiler for PHP. It reports function-level call counts and inclusive and exclusive metrics such as wall (elapsed) time, CPU time and memory usage. A function's profile can be broken down by callers or callees. The raw data collection component is implemented in C as a PHP Zend extension called xhprof. XHProf has a simple HTML based user interface (written in PHP). The browser based UI for viewing profiler results makes it easy to view results or to share results with peers. A callgraph image view is also supported.

So you're sold, but getting it installed in MAMP is kind of a pain.

A little about my setup system first. I'm running Mac OS X 10.6.4 with MAMP 1.9.2 with php 5.2.13 and you'll need Xcode.

First step is downloading the MAMP Server components and libraries. Heads up though, this is a 125.5 MB download. You could also download php-5.2.13 from php.net, it's only 12 MB.

$ cd /Applications/MAMP/bin/php5.2
$ mkdir includes
$ cd !$
$ wget http://us.php.net/get/php-5.2.13.tar.gz/from/this/mirror
$ tar zxvf php-5.2.13.tar.gz
$ mv php-5.2.13 php
$ MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
$ ./configure CFLAGS="-arch i386" --with-config-file-path=/Applications/MAMP/bin/php5.2/bin/php-config

Great, you're halfway there.

Next step is downloading XHProf 0.9.2 from PECL.

$ cd ~/Desktop
$ wget http://pecl.php.net/get/xhprof-0.9.2.tgz
$ tar zxvf xhprof-0.9.2.tgz
$ cd xhprof-0.9.2/extensions
$ /Applications/MAMP/bin/php5/bin/phpize
$ ./configure CFLAGS="-arch i386" --with-php-config="/Applications/MAMP/bin/php5.2/bin/php-config"
$ make
$ make install

Now, assuming everything has gone alright, you should have a xhprof.so file in ~/Desktop/xhprof-0.9.2/extensions/modules.

$ cd modules
$ mv xhprof.so /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/

Next, open up MAMP PRO. Hit Command-3 and add in information for the xhprof extension.


Restart MAMP and visit http://localhost/MAMP/phpinfo.php and see if xhprof is there.

We're not quite done yet. We'll need to copy ~/Desktop/xhprof-0.9.2/{xhprof_lib,xhprof_html} to some vhost in MAMP. It's really up to you. Mine are in my Drupal doc root, so if you move it the code below will need to be changed.

FINALLY, open up Drupal's index.php and make it look like below.

if (extension_loaded('xhprof')) {
    include_once dirname(__FILE__) . '/xhprof_lib/utils/xhprof_lib.php';
    include_once dirname(__FILE__) . '/xhprof_lib/utils/xhprof_runs.php';
// $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $
if (extension_loaded('xhprof')) {
    $profiler_namespace = 'd6';  // namespace for your application
    $xhprof_data = xhprof_disable();
    $xhprof_runs = new XHProfRuns_Default();
    $run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
    // url to the XHProf UI libraries (change the host name and path)
    $profiler_url = sprintf('http://localhost/xhprof_html/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
    print '<a href="'. $profiler_url .'" target="_blank">Profiler output</a>';

Now just visit your Drupal and you should see a link for Profiler output on the bottom of the page and you're done!


if you're interested in getting in touch with me, head on over to the contact page.