Hi, I'm Andrew.

I'm a graduate of the School of Business at Florida International University in Miami. I'm a huge sports fan and I love watching The Office. But more importantly, I'm fascinated by economics, strategy, management, politics, web technologies, and design. This is my homepage.

Read more »

 

Latest Journal Entires

Thanks for visiting my homepage! Below are the latest posts from my journal. From the "navigation" menu on the right, you can browse the archives by category or date. Questions? Comments? Drop me a line!

The Zen of… PHP?

July 20, 2013 by: 0 Comments

In 2004, pythoneer Tim Peters published his famous article The Zen of Python in which he briefly outlined “the guiding principles for Python’s design”. While Peters is actually writing about the core philosophies that drove the development of the Python language, I believe many of the ideas he outlines can be applied to writing awesome code across many different languages.

Let’s take a look at three of my favorite pillars of the “Zen” and see how we can use them as simple references for writing beautiful, efficient code in a different environment (PHP):

“Beautiful is better than ugly.”

If all things are equal, better looking code is usually better code. For instance, there are several ways you can display the numbers 1 through 10 in PHP using a for() loop:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example 1
for ($i = 1; $i < = 10; $i++){
  echo $i;
}
 
// Example 2
for ($i = 1; ; $i++){
  if ($i > 10){
    break; 
  }
    echo $i;
}
 
// Example 3
$i = 1;
for (; ; ){
  if ($i > 10){
    break;
  }
  i++;
}

Beautiful code does more with less. The above examples all produce the same output but Example 1 is much cleaner. It’s only three lines long which is great… because the less code you write, the less code you have to read. The result is faster development and code that communicates ideas more efficiently.

Read more »

read full post
Tags: , ,

Creating Profile Pictures with CodeIgniter and Tank Auth

March 21, 2012 by: 0 Comments

Profile pictures are a simple way to give your application’s users a sense of identity. By adding a face to users, profile pictures humanize your app’s experience and strengthen the community “vibe” of your site. And with the growth of the social web, they’re everywhere. Facebook profile pictures define who we are, Twitter has it’s famous square avatars, and Vince Lombardi’s image presides over my fantasy football team.

But if you’re using PHP to develop your application, the code can get clunky—especially when you begin adding features like validation, encryption, and thumbnails. Luckily, with the CodeIgniter framework and the Tank Auth authentication library, implementing user profiles with customizable user avatars is a breeze.

Below are some code excerpts from a recent project I worked on that used profile pictures for users. We’ll upload the picture, generate a thumbnail image, store the location of both the original and resized images in the database entry for that user, display the image, and add some simple UI effects. The code I’m sharing isn’t too comprehensive, but hopefully it’ll help you get started.

Getting Started

This all assumes you have some basic understanding of CodeIgniter. If you’ve never used it, I highly recommend checking it out and reading the user guide. It’s quick to install, easy to learn, and very functional. What can be better than that?

Things you’ll need to get going:

Once you’re set up you can jump right into it. Read more »

read full post
Tags: , , , ,

A Brief Intro to the Prisoner’s Dilemma

February 16, 2012 by: 0 Comments

The Prisoner’s Dilemma is one of the most well-known problems in game theory, partially because it demonstrates why individuals might not cooperate with each other even when cooperation appears to be in their best interest. The analysis of this problem and its variants has important applications in economics, psychology, political science, and many other competitive systems where individual outcomes are affected by the actions of other participants in the system.

In coming posts, I’ll explore how the prisoner’s dilemma helps model many aspects of the rational economy including pricing, marketing, consumer behavior, and the competitive environment itself (cartels). But to start with, let’s examine the problem in its most basic structure: the generalized form.

The Problem (“Generalized Form”)

There are many variations to the problem, but here’s a popular version:

Two suspected criminals are arrested. The police believe they robbed a store but only have enough evidence to prove they were trespassing. Thus, to charge them with the more serious crime (robbery), the police need one of the criminals to “rat out” the other. How do they do this? It’s simple. Following the separation of the two men, the police offer each suspect a deal:

  • If one testifies against his partner (defects), and the other remains silent (remains loyal), the betrayer goes free and the loyal prisoner receives the full ten-year sentence for robbery.
  • If both remain silent, both are sentenced to only one year in jail for the trespassing charge.
  • If both prisoners testify against the other, each receives a five-year sentence for robbery.

Each prisoner must choose either to betray their partner or remain silent. The two prisoners cannot communicate with each other and the decision of each is confidential. The prisoners cannot actively coordinate their decisions or threaten retaliation, and they only have one chance to make their decision. What should they do?

Assuming each prisoner is only concerned with lessening their jail time, what strategy should they follow? In other words, how can each prisoner maximize their own expected value? Let’s break it down. Read more »

read full post
Tags: ,

The Netflix Effect: Media CEOs Anticipate Strategic Changes

February 10, 2012 by: 0 Comments

According to a new report released Thursday from the business advisory firm PwC, media and entertainment company CEOs are scrambling to adapt to changing consumer habits. Here are some of the figures that stood out to me:

  • Some 74% of those surveyed said they were either “somewhat” or “extremely” concerned about such changes, compared to just 50% across all business sectors.
  • 78% of media CEOs said they intend to change their company’s strategy over the next 12 months, with about one in five saying those changes will be “fundamental.”
  • PwC also found that 43% of those top executives said they anticipate “a major change” to their technology investments over the next year.

This isn’t too surprising. With digital technology advancing faster than ever, the strategic landscape can shift overnight. You don’t have to look farther than the Blockbuster case to know that failing to adapt to such advances—much less seize first-mover advantage—can cripple a firm. Read more »

read full post
Tags: , , , , , ,

Welcome!

February 08, 2012 by: 0 Comments

I’ve wanted to put together a personal webpage for a few years now, and I’ve finally gotten around to it!

I’ll use the journal to share my thoughts on business and technology, as well as demonstrate some very cool things you can do with CSS, XHTML, PHP, CodeIgniter, and the Adobe Creative Suite through tutorials.

First “true” post will come shortly, stay tuned! :)

read full post
Tags: