Categories

Tags

Page 21 of All Articles

Catching multiple PHP exceptions

I had previously discussed using try / catch / finally and a fine reader pointed out that I didn’t mention catching multiple exceptions. He’s right, I dropped the ball and decided to dedicate today’s post to catching multiple exceptions. To catch multiple exceptions you will need to be using code […]

Co-founder Application

This is partially for LOLz and partially for serious. I’m a guy in Tampa looking for people that want to kick ass with me. I know some very talented individuals in the area but nothing’s really gotten off the ground with them. Most of that is because they have day […]

How to write files to disk with PHP

Saving files to disk is a pretty simple task in PHP with file_put_contents(). Here’s how to write a string to a file: $string = 'I AM STRING!!'; file_put_contents('/path/to/destination', $string); It is generally good practice to only do with when you are dealing with smaller strings as you can run into […]

Command line all the things!

The start of 2014 has been an exercise in going back to basics for me. I’ve been re-evaluating my workflows when hacking and attempting to streamline as much as humanly possible. This has resulted in a ton of new aliases in an attempt to get my common CLI commands down […]

How to use try/catch statements in PHP. Oh, and finally too!

I do a lot of coding in Python and one thing that I really love is the mindset of asking for forgiveness instead of permission. What’s this mean? It means that instead of sanity checking every little thing, just handling the exceptions that are thrown instead. In PHP this can […]

Gravatar as an identicon generation service

If you’re not already aware, Gravatar is a free service that allows you to couple an image to your email address which can then be carried around the Internet with you. It’s great for site owners because then you don’t have to build out image uploading and storage and it’s […]

Your stack is outdated

I’ve been noticing a pattern with most of my peers (yes I said most), they expect their users to be running the latest and greatest version of their favorite “modern” browser and all the while their server stack is collecting dust. Ubuntu doesn’t help matters with their Long Term Service […]

How to use switch/case statements in PHP

switch/case statements are one of my favorite anti-patterns not because I prefer to write spaghetti code but because they can make if/elseif blocks look a ton cleaner. Why would it be considered an anti-pattern? Because it could easily be abused to the point that you are munging up your control […]

Improve performance by reusing PHP objects

I’ve been doing a ton of optimizations on one of my main sites and one thing that I’ve been doing more and more is trying to reuse objects whenever possible. What’s this entail? All it takes is creating a static function to return an instance of the object instead of […]

How I saw the test-driven light

Aside from dealing with financial transactions, I’ve generally avoided test-driven development as part of my day to day workflow. Why? The usual reasons, but mostly because I didn’t want to incur the overhead of additional development. As a single founder / developer you’re always looking for ways to lighten the […]

PHP 5.5 syntax highlighting for Vim

Now that I’m using PHP 5.5 I’m finding that my Vim syntax highlighting is a bit off. After some digging around I found a syntax file that was updated to PHP 5.5 RC1 but hasn’t been updated since. In true hacker fashion I went ahead and forked the project and […]

Upgrade from PHP 5.3 to PHP 5.5 on Ubuntu 12.04 LTS

Recently I made the decision to stop living in the past and start living in the present by using the latest stable release of PHP, version 5.5.8. Unfortunately on Ubuntu 12.04 LTS (I always run LTS releases on my servers) the latest version of PHP available is from the 5.3 […]

Domains are worthless without traffic

If you know anything about my growth strategy for my social network, it’s that I’m expanding my platform horizontally across multiple domains and allowing each site to grow organically. This has led me down the road of being one of those guys that owns a ton of domains but has […]

PHP segmentation faulting from logging too much

At least I think that’s what was happening. Today I made the somewhat calculated risk of upgrading my production server from PHP 5.3.10 to PHP 5.5.7. Scary stuff, jumping 2 point revisions like that but I was feeling cocky after jumping 3 point revisions to bring nginx up to the […]

Lessons learned from sending thank you cards to my users

I wanted to do something nice this holiday season and decided to identify some of my power users on SceneKids.com and mail them Christmas cards and some SK stickers. The users I had selected were a mix of users that have been on the site since it launched in 2011 […]

Getting PHP's version from the command-line

As you may already know, obtaining the version number of PHP is a simple php --version away. This is great if you just want to see the version number, but what if you wanted just the version number? First option would be to use write out some shell script to […]

That time I got ripped off on Flippa

In my defense, I’m a grown ass man and I knew exactly what I was doing. I was really intrigued by all of the “automated websites” that Flippa is overrun with and figured I’d set myself a very modest budget of 250$ and see what trouble I could get myself […]

How to error when setting undefined class properties in PHP

Perhaps you have a class and you absolutely don’t want anyone tacking new properties onto it once it’s been instantiated. To do so, you can use PHP’s overloading to catch the setting of a variable and raise an error accordingly. Here is the default behavior where an object can have […]

Bake your fees in, don’t line item them

As a business owner, I understand that there are fees associated with running a business. There’s always a cost to doing business and those costs can generally be written off at the end of the year. Those costs are yours and in my opinion don’t always need to be revealed […]

What transferring a domain to a new registrar entails

With my recent trials and tribulations with DirectNIC and my now exodus to NameSilo I’ve been asked a couple of times of how difficult a domain transfer is and what it entails. Before I discuss the steps to transfer a domain, I’d like to note that I will be posting […]

How to set up a LAMP server on Ubuntu 13.10

Been a while since I’ve covered setting up a brand new LAMP server. This time, I’m going to be using Ubuntu 13.10 and once you are logged into your server you will want to update and upgrade it to the latest software versions: sudo apt-get update && apt-get upgrade Once […]

Ground up rewrites should be a last resort not the status quo

And even then, everything has to be so fucking abysmal that there’s no way to avoid it. The only time I’d ever condone a full rewrite is when you are completely abandoning an existing user base else you’re probably going to disappoint at least a good chunk of your users […]

Nintendo Wii U First Impressions

tl;dr - I like the Wii U but do have some pain points. Also affiliate links, so many affiliate links. I grew up in the 1980s. I got to experience the 8-bit console wars first hand. The Wizard taught me that the Power Glove was “so bad” (and how to […]

Holiday API free and ready to fork!

Last week’s post on calculating what date Thanksgiving will fall on got me thinking, wouldn’t it be cool is there was an API that you can call to return holidays for a specific date, month or even the entire year? I did some digging and there were some premium API’s […]

What I am thankful for

Surrounded by Facebook statuses about how miserable and broke everyone seems to be and with it being the week of Thanksgiving it felt appropriate to drop a quick list of things I’m thankful for: My wife who has the tolerance of a saint for putting up with my shit day […]