Page 8 of Software Development Articles
I have an upcoming freelance project coming up that includes checking an IMAP email account as well as working with XML in PHP. Let’s talk about connecting to an IMAP account in PHP, don’t worry, I’ll discuss parsing XML next week ;) For the sake of example, we’re going to
[…]
A little late on the Mother’s Day part, but since today is Father’s Day, I figured it would be fun to discuss how to obtain the dates for these moving holidays. To do so, all we need to use is use strtotime and tell it when the holiday will occur
[…]
This post was supposed to be a discussion of my migration back to Android from iOS but direction changed yesterday morning. At 9:30 am I found myself in the middle of a DDoS attack that was affecting the rack my server lives on. My sites slowed to a crawl and
[…]
Have you ever run into a scenario where you have to loop through a set of data and perform database queries for each iteration? Obviously we shouldn’t run them one by one, so we end up using a TRANSACTION or even just building out one large query in the case
[…]
You are probably already familiar with $_GET, $_POST and $_REQUEST but what about $_PUT? Trick question, $_PUT (as well as as $_HEAD and $_DELETE) doesn’t exist in PHP at this time. Never fear! We can create a $_PUT array with the following code: if ($_SERVER['REQUEST_METHOD'] == 'PUT') { parse_str(file_get_contents("php://input"), $_PUT);
[…]
I’ve been taking a lot of programming tests / challenges recently as I was in the market for a new [and hopefully exciting] opportunity to spend my time on. Because of this, I am full of new blog post ideas based on the questions / challenges asked. This week I’m
[…]
I tend to shy away from these self gratifying posts about my own open source contributions, but I’m going to make the exception because this particularly library has been receiving quote a few downloads this month. I’m unsure for the increase, but my Google Places PHP Library has had over
[…]
If you know me then you know I fucking adore Redis. Over the last few years it’s slowly worked it’s way into the majority of the things I have built. Unfortunately, recently I ran into a problem that Redis could easily accomplish but would require more RAM than I have
[…]
Today I went on a mission to find a PHP function that I’ve never used before and knew nothing about. The mission was such a success that I have two functions to discuss and honestly, I’m pretty sure I’ll never use them. That being said, if the need ever arises
[…]
I’ve discussed the use of preg_replace_callback in the past in regard to passing variables to anonymous functions but never touched on how to use preg_replace_callback or the fact that the /e modifier has been deprecated in PHP 5.5+. Even though /e still works in PHP 5.5 in the near future
[…]
PHP Data Objects (PDO) is arguably the best database abstraction layer available in PHP. It provides a consistent interface across multiple datasources (MySQL, PostgreSQL, et cetera) and helps boost your site’s security by way of prepared statements. It even supports transactions which we’ll be taking a look at here. Database
[…]
Hi, my name is Josh and I am a Vim addict. I have been for quite a while now, nearly 15 years by my estimates. I love everything about it but in all honesty, I have only really started to get “good” with it in the last couple of years.
[…]
Zero filling (or zero padding) is when you pad a value on the left side to a specific length. This is something you will commonly see in database schemas for integer columns. But what if we’re not working with data that’s already zero filled by a database? All we have
[…]
One of PHP’s most powerful features are arrays and the multitude of functions available to interact with and manipulate them. Arrays can be indexed by integers as well as string, known as an associative array. Instead of looping through the array with foreach and assigning the key to another array,
[…]
The other day I ran into a situation (first time, it seems) where I needed to access a variable inside of an anonymous function inside of preg_replace_callback(). My first thought, even though it went against my better judgement was to simply define the variables as global inside of the function.
[…]
I liked Chris Coyier’s post Opt-Out Responsive Design? but really didn’t like the idea of having to qualify all of my selectors with a parent class to indicate that we should be using the responsive version of the site. I do favor serving the user a single stylesheet instead of
[…]
Continuing my showcasing of all of the awesomeness in PHP 5.5 that I am discovering since my upgrade from 5.3, let’s discuss using the the list() function inside of a foreach() block. Have you ever had a situation where you are looping through a multi-dimensional array and the array is
[…]
I ran into an issue a few days ago after pushing some hand rolled “infinite scroll” logic to my sites. One of my users reported getting the “Failed to open page” error on her Windows Phone 8 using UC Browser, some aftermarket browser I had never heard of. The rest
[…]
Support for generators (via the yield keyword) has been added to PHP 5.5 and allows you to create simple iterators without the use of the Iterator interface. What’s this all mean? It boils down to overhead, generators use less memory than an implementation of the Iterator interface or simply creating
[…]
String dereferencing allows you direct access to individual characters. The dereferencing syntax is just like accessing an array element by it’s index: $string = 'This is my awesome string!'; echo 'First Character: ' . $string[0] . "\n"; echo 'Tenth Character: ' . $string[9] . "\n"; echo 'Last Character: ' .
[…]
As of late I’ve been very adamant about DRY CSS principles. Not so much the descriptive ID and class selectors that some folks wrap their other selectors in, but the focus on not repeating the properties and grouping like selectors. I’ve even taken it a step further and have been
[…]
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
[…]
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
[…]
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
[…]
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
[…]