Categories

Tags

Page 18 of All Articles

Visibility in PHP

Visibility of functions and properties is very important when you are attempting to lock down certain aspects of an object. In PHP there are three levels of visibility, public, private and protected. Let’s take a look at what each one means. Public Public is the easy one. It’s the default […]

The definition of “done”

For me, “done” means that something I have been working on is to the point that I no longer have to work on it, indefinitely. Depending on the nature of the task it could also mean that it’s been shipped to production and again, no longer requires my efforts. I […]

Simple PHP i18n internationalization and localization class

As sites and system grow and scale, the need for internationalization and localization (i18n and L10n respectively) of content becomes a necessary task. There’s not much to it on the surface, you need to be able to serve up the same content in different languages. This includes abstracting out words […]

Stop making it so hard for us to share your content

Hey you! Yes, you. You with that blog over there. The one without any sharing widgets whatsoever. Do you really think your content is so fucking special that people are going to go out of their way to copy and paste the link to share it? You expect us to […]

Debugging Invalid XML in PHP

SimpleXML with all of it’s faults is still a great way to interact with XML. Most of it’s shortcomings are related to debugging and how it handles invalid XML is no exception. Let’s take a look at what happens when we load an invalid XML string: $xml = " <?xml […]

Writing unit tests for legacy code

I think one of my biggest gripes with adopting that TDD life is that I feel I’m in the minority with my friends even though the concept appears to be quite mainstream these days. One of the common pushbacks I receive is that it’s hard to write unit tests for […]

Upgrade from PHP 5.3 to PHP 5.6 on Ubuntu 12.04 LTS

Last week I posted a call to action to help sway Ondřej Surý into continuing to support Ubuntu 12.04 LTS with his amazing PPA for the latest and greatest PHP versions. Ondřej was kind enough to take the time to backport the PPA and without ado, here’s how to get […]

My top 10 tips for new bloggers

I’ve been blogging every single week for over a year and a half and have been constantly egging my peers into jumping on the wagon. Within the last month both my friend Justin Davis and Francis Suarez started up blogs. I’m full of advise on the matter and have been […]

Call to Action: PHP 5.6 on Ubuntu 12.04 LTS

I’m going to take a break from posting code snippets and how-tos to draw attention to the fact that PHP 5.6 may not be coming to Ubuntu 12.04 LTS by way of Ondřej Surý’s amazing PPA. Yes, you can still compile PHP from source, but as you may already know, […]

Upgrade to PHP 5.6 on Ubuntu 14.04 LTS

PHP 5.6 is finally here and if you’re on Ubuntu 14.04 LTS you’re stuck with an older version of PHP. If you want to take advantage of the new awesomeness, you can do so very easily thanks to a PPA. If you’ve never added a PPA before, you will want […]

jQuery plugin to calculate read time

I love hosting my blog on GitHub by way of Jekyll but the Liquid templating system is far from a robust scripting language in my opinion. With the rise of Medium, I’ve been seeing the read time on more and more articles and figured it was time to add the […]

Fizz Buzz in PHP

Fizz buzz is a fairly common screening question to help sniff out non-programmers during the interview process. The task is to print out numbers 1 through 100 but for multiples of 3 print out “Fizz” instead of the number and for multiples of 5 print “Buzz” instead. If the number […]

Are GAWMiners Hashlets worth it?

I’ve only been the owner of a Hashlet from GAWMiners / ZenCloud for less than a week and I’m liking what I’m seeing thus far. My initial investment was a mere 15.99 USD for a 1MH/s Hashlet and honestly, the purchase itself was the most rocky situation. Seems with the […]

How to execute an HTTP POST using PHP cURL

I’ve been doing a lot of API integration recently and cURL ends up being exceptionally handy when you are POSTing to an endpoint. Fortunately using cURL in PHP is really easy: // Sets our destination URL $endpoint_url = 'https://somesite.com/path/to/endpoint'; // Creates our data array that we want to post to […]

10 office pranks you should try at your own office

Before I start talking about office pranks, I want to give a shout-out to Noah Kagan for his post We Analyzed Nearly 1 Million Headlines. Here’s What We Learned post. The truth is, this post is just a list of some of the notable office pranks I’ve either orchestrated, witnessed […]

Why work so hard to stay at the bottom?

Not a day goes by that I see a headline about the need for a minimum wage increase. I read about staged sit-ins, protests and boycotts. I see people investing a ton of time and energy to remain the lowest paid workers in the country. I generally keep my political […]

Looping through a date range with PHP

Looping through a date range isn’t as simple as looping through an array with foreach but it doesn’t take much additional code to get the job done. To loop through a date range you will need to use a loop (I prefer a while loop) and increment the date by […]

Tabs vs. Spaces: I'm switching sides

It’s not very often that I make a drastic change to my coding style but after using tabs for my entire life, I am making the switch to spaces. My go to defense for using tabs was that they are more flexible because they allow developers to choose their own […]

Difference between break; and continue; in PHP

The topic of break and continue came up the other day and I thought it would make for a good blog post. You’re probably familiar with break moreso than continue because it is part of a switch statement’s syntax. Both break and continue can also be used inside of looping […]

Review: Sprint WeGo

A few months back when I picked up a Nexus 5 for myself, I decided to go ahead and get our 7-year-old daughter the Sprint WeGo phone. For those that are not familiar with the device, it’s a very basic telephone that comes standard with some great parental features. These […]

PHP without fancy braces

PHP is a C-style language and thus uses fancy braces to wrap or hug control structures. PHP is also a language that is extremely flexible so you can also get by without using fancy braces. You will never get away from them entirely as functions and classes / class methods […]

Tools of the Trade - 2014

It was February 18th, 2011, a week before my 30th birthday that my answers to AppSumo’s Tools of the Trade questionnaire were posted. A metric shit ton has changed since then - new jobs, new hardware, new software. At the same time, some things never change. This post is the […]

Debugging SimpleXML Objects with PHP

SimpleXML is pretty much the de facto standard for dealing with XML in PHP. The biggest problem with SimpleXML is that it is a pseudo-object that you can’t print_r() or var_dump() to see what’s going on. I recently ran into a situation where it would have been super nice to […]

Self-employed cabin fever

I was somewhat skeptical that it would happen to me, be after over a year of working for myself and by myself, it finally started to take it’s toll. I had an office so that I would have a place to go during the day to feel like I was […]

Parsing SOAP responses with PHP's SimpleXML

We recently discussed parsing XML with SimpleXML and since that writing I ran into a situation where I needed to parse a SOAP response. As it turns out, SOAP responses are a totally different beast when it comes to parsing them with SimpleXML. SOAP responses contain namespaces on some if […]