Is it a bubble or something else?

It has all happened before, and will happen again…

Back in the late 90’s, we experienced an economic bubble of immense proportions. The internet (read: The World Wide Web) was just starting to gain mainstream acceptance, which is when the gold rush began. Companies with no real business plan, and no way of making profits were securing millions of dollars in funding. Beyond funding, some of these companies were getting bought for BILLIONS of dollars. For instance, The Learning Company was purchased by Mattel for over $3 billion in 1999, but was sold for only $27 million in 2000. While the company clearly had some value, it was overvalued beyond any reasonable price. This is the epitome of the of “Dot-Com” bubble.

Over the past few months, there has been a lot of discussion on Hacker News about the possibility of another “Dot-Com” bubble happening right now. A lot of people think that we are winding up to another bubble, but there is also a fairly large amount of people who think that this time is different. I fall in the the latter group, and here’s why.

Starting with YCombinator, a new philosophy on web startups emerged: lean startups. In a nutshell, your startup is given a small amount of money (enough to live frugally on for a few months) and mentorship. The most important part of programs like YCombinator is the mentorship. You get access to seasoned investors, business people, and founders that help you realize your idea’s potential. The upside to bringing a company to fruition this way is that your startup costs are low, and you will know very quickly if you can become profitable. During the 1st bubble, anybody with an idea and a web page could get millions in funding. No market validation required, just an idea. This time around, you actually need to have a plan. You need to have traction. You need to be profitable. Sure, some companies are getting over valued (*cough* Facebook *cough*), but that happens whether we’re in a bubble or not.

The important thing to take away from this is to look at what companies are getting serious funding (>$500k) and what companies are making nice (fat) exits. Are they good companies? Would you use their product? Would someone you know use their product? Are they profitable? Do they have a user base? If you can answer “yes” to most of these questions, we probably aren’t in a bubble. We’re in something else. A new economy? An information economy? Well, we already have an information economy, so what now? We’re transforming the way we do business and interact with each other. Instead of doing things yourself, why not let somebody else do it for you? (hosting: Heroku). Keeping in contact with people is hard, why not let Facebook do it for you?

I’m not sure where all this is leading, but I’m fairly positive it’s not a bubble. It’s something different. It’s a transformation of our economy. To what, I don’t know. But it is changing, and it’s going to touch every single one of our lives sooner or later.

PHP Programming Wordpress Development

WordPress Development as a Team

At my day job I’m really the only person that knows how to write WordPress plugins, so when I write one it’s usually sand-boxed on my machine where nobody can touch it. However, in a side endeavor I’m part of we have a team of 3 people developing on one plugin. As I’m the most experienced plugin developer amongst our team, I was tasked with coming up with a development style and plugin architecture that would work for us.

Development Style

Everyone will be running a local copy of WordPress and making their changes to the plugin locally. The plugin itself will be under version control using Git, and developers will push/pull changes from either a self-hosted Git server or Git Hub. Database schema will be tracked in a file called schema.sql. When someone makes a change to the schema, it goes into that file at the bottom with a comment about why the schema changed. We’ll being jQuery as our Javascript framework of choice, and we’ll be writing all of our Javascript in CoffeeScript (see my previous entries).

Plugin Architecture

The more difficult aspect of developing this plugin as a team is the sheer size of the plugin. Realistically this could probably be split into about 6 different plugins by functionality, but we want to keep everything together in one tidy package. To illustrate the architecture, I made a quick drawing.

The first layer of the plugin is essentially a wrapper. It initializes the ORM that we are using to access the database (we are using a separate database for this plugin’s data), and includes the wrapper class. The wrapper class is where developers drop their sub-plugin include file and instantiate it’s main object. For instance, for each sub plugin there will probably be two classes instantiated in the wrapper. One being admin related functionality, and the other being for front-end display functionality. My thinking with this architecture was that we could all work on separate sub-plugins without crossing paths too frequently. This also allows us to separate the different functionality areas of the plugin in a logical manner. The other benefit to architecting the plugin like this is that it will be very easy to port to a different architecture in the future. I’m well aware that WordPress probably isn’t the best tool for the job, but it is the best tool for the team with the deadline that we have.


While thinking about WordPress Plugin Architecture, I cruised the source code of a lot of plugins and it seems that everyone goes about it in a different way. If you’ve ever developed a large-scale plugin with a team, how did you go about doing it? Did you run in to any problems that you didn’t foresee at the beginning of the process?

PHP Programming

Getting Web Scale with Memcached

The web is huge, and there are a lot of people on it. Day and night, millions upon millions of people are on the web surfing, commenting, and contributing. Normally your blog gets a few hundred visitors a day ( a few thousand on a good day ), but what happens when that number increases? Can your database server handle all that load? Will Apache come screeching to a halt due to all of the requests? The answer is probably yes, unless you implement some form of caching. Many years ago this wasn’t a huge problem, but as the web and it’s user base has grown, so has the problem of “web scale”.


Memcached is a pretty simple concept. Just as the name implies, it’s a caching system that stores stuff in memory. That’s really all you need to know to get started. If you’re interested in learning more, check out the Memcached home page.

PHP Memcache

As this is mostly a PHP blog, I’m going to show you how to use Memcached with the PHP Memcache module. While this tutorial is language specific, the concepts here can be applied to any language to increase the speed of your web pages. That being said, the first step is to get Memcached installed on your machine. There are a ton of tutorials out there on the web for this, so I’m going to leave that as an exercise for you. Once that’s installed, you should check out my guide for getting the PHP Memcache module installed on XAMPP, that way you can run this tutorial locally.

Step 1: Make the connection

This step is pretty straight forward. If you can’t connect to your caching server, you can’t cache. If the connection is successful, continue trying to cache. Otherwise, just query your database as normal.

$memcache = new Memcache;
$memcache->connect("my.memcached.server", 11211);

Step 2: Cache something

For this step, the only potential “gotch-ya” is that the your identifier must be unique, and time to expire is in seconds.

$myValue = "hello world!";
$memcache->set("Hello World", $myValue, false, 60*60*24);

Step 3: Retrieve an item from the cache

$myValue = $memcache->get("Hello World");
echo $myValue;

Step 4: Putting it all together

So how does all this work in conjunction with your web app? The basic workflow for using caching is the following:

  1. Does my item exist in cache> (This satisfies determining if a connection to the cache has been made as well.)
  2. If so, get the item and store in a variable.
  3. If not, get the item from the database.
  4. Store the item for later use.
$memcache = new Memcache;
$memcache->connect("my.memcached.server", 11211);
$arrayVals = $memcache->get("My Identifier");
if(!$arrayVals) {
        //Note: This assumes that the data in the table doesn't change
       // and that it is fairly small in size.
	$query = "SELECT * FROM myTable";
	$result = mysql_query($query);
	while($row = mysql_fetch_array($result)){
		$arrayVals[] = $row;
	$memcache->set("My Identifier", $arrayVals, false, 60*60*24);
foreach($arrayVals as $val) {

If you’re following carefully, you can see that the first time through the data will get pulled out of the database. However, for the next 24 hours the data will be coming from the Memcached server. It’s little tricks like this that can help your site survive being featured on Reddit. Moral of the story: If your site is slow because of volume, try caching almost everything and you should have noticeable improvements.


Switching from Google to Duck Duck Go

For the longest time I’ve been hearing the praises of a little search engine called Duck Duck Go amongst the Hacker News crowd. Yesterday, I finally decided to take the plunge and set it as Chrome’s default search engine. After a day of solid use, here are some of my observations:

  • The search results are good: While Google has been taking time to improve their results lately, it’s refreshing to see original content get ranked higher than web scrapers. In fact, the web scrapers have a tendency to not show up at all on DDG.
  • Lots of documented goodies: I’m still getting my feet wet with DDG, but the ridiculous amount of goodies is going to make things a lot more enjoyable.
  • I like not having page previews by default: I’m not sure if DDH even supports this, but I absolutely HATE having preview panes pop up in Google by default. Can it be turned off? Yes. Am I too lazy to do it? Yes.
  • Directly search other sites: You can search other sites directly, which is a nice feature. Try “!amazon Founders at work”.
  • They don’t track you: You know that feeling you get when you think someone is following you down a dark alley at night? That’s the feeling you should get using Google. They track everything. I don’t like being tracked, so DDG is probably going to become my permanent search engine. Read
  • Instant Answers: Sometimes you don’t need to click-through to a page. For instance, search “jquery” and you get a handy little box that tells you what jQuery is, and where you can get more info about it. For someone new to jQuery, that little bit of information could help them make a more informed click to learn more.
  • I miss instant search: I would really like to see an option for instant searching on DDG. Being able to refine your search results letter by letter was really handy.
  • I miss other Google service integration: Searching for “coffee near 49503” would show a map with coffee houses on it in Google. In DDG, my results aren’t nearly as useful. I hope that some sort of map integration is in there future, because it would stop me from switching back to Google to use their map service.

What do you like about DDG? What features do you wish it had?

PHP Programming

Installing Memcache on MAMP

For the better part of 2 hours I tried and failed to get the Memcache extension installed on MAMP.  I tried following several guides, but everything fell flat on it’s face about 75% of the way through.  I eventually figured it out, and I wanted to share it so that other people don’t have to go through the pain and suffering that I did.  It turns out to be surprisingly easy, but YMMV.

Step 1: Install XCode

Step 2: Make the MAMP PHP binary files executable

sudo chmod +xrw /Applications/MAMP/bin/php5.3/bin/p*

Step 3: Get the Memcache extension source

cd ~
tar -zxvf memcache-2.2.5.tgz
cd memcache-2.2.5

Step 4: PHPize the Memcache extension files


Step 5: Compile the Memcache extension


Step 6: Add the extension to the PHP.ini file

Add the following to the end of your PHP 5.3 ini file via the MAMP file menu.

Step 7: Copy the memcache extension to the PHP extension folder

cp modules/ /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-[yourtimestamp]/

The “[yourtimestamp]” varies per installation, but you should just be able to tab complete that part.