Start Services Using a Batch File

If you use your person computer as a testing server you probably have several services running in the background (a web server, database, caching service, etc). Individually these services tend to have a small footprint. If you’re running enough of them however, they can start to impact your machine’s performance. If you have them set to auto start they can also increase your startup time. Ideally you would want to start them when you need them and stop them when you’re done with them, but that can be a hassle for multiple services. A simple solution is to create a batch file to start all of your services, and another one to stop them.

Follow these steps to create your batch file:
Continue reading

Blast From the Past

Back when WordPress was only 2.7 versions old I published a plugin called WP SimpleMail. It was a rudimentary email client built into the WordPress admin interface. It had a lot of shortcomings – no support for mailboxes other than the inbox, no address book, the interface didn’t degrade well as WordPress was updated, etc – and unfortunately around the time of its initial release I did not have the time to properly address all of them. Today, roughly two years after the last update to the plugin, there is now a new version available, called SimpleMail 2.

Some of the new features include…

  • Support for multiple mailboxes
  • An address book
  • Support for multiple users
  • Improved compatibility with email services including Gmail
  • Updated interface
  • and a lot more to come

There are still some kinks to be worked out so for the time being the plugin will be available for 25% off during the beta period (which if all goes well will be over fairly soon).

Sometime in the near future, the free, WordPress.org, plugin will receive an update which will give it the updated SM2 interface as well as the improved connectivity. All other features will most likely remain exclusive to SimpleMail 2.

Weekly Function: gethostbyaddr

This function can be used to retrieve the host name for a particular IP address. For example, if you give it the IP address 74.207.242.169 it will output tinsology.net.

Just off of the top of my head, one potential use for this function might be to check IP logs for content scrapers. Say for example I’m running a bot on my server that is visiting your site, retrieving your content, and then publishing it on my site. If you wrote a script that looked up the host name for each IP address in your access log you would find my domain in the list. From there you can block the IP address.
Continue reading

Don’t Buy Civilization V

…unless you want to waste countless potentially productive hours. I should have known from playing Civ II and III that it’s not a game, it’s an addiction.

For anyone not aware, Civilization is the monopoly of computer games. Starting a game always seems like a good idea at the time, but seven hours later you’re wondering why you’re still playing.

Weekly Function: ctype_digit

I had actually never heard of this function before my random function grabber spit it out, or for that matter any of the ctype functions. What this function does is takes a value and determines if it consists entirely of digits. At first this sounds a lot like is_int, but there are a couple of differences worth noting:

  • ctype_digit expects its input to a string. It will return false if given a non-string. is_int expects its input to be an int. Anything else, including numeric strings, and it will return false. This makes ctype_digit a little more convenient for form validation since form data is always a string.
  • is_int will return true for hexadecimal values (ex 0x1F), ctype_digit will not.
  • ctype_digit will return false for negative values (basically any character that isn’t a 0-9 will cause the function to return false)

Continue reading

Weekly PHP Function

Starting this week I’m going to be writing a post about a particular PHP function. Each week a function will be chosen at random from php.net’s Function List and I’ll write about (including but not limited to) basic usage, interest ways to use the function, portability issues and alternatives, and caveats.

I’ve written a script that will grab a function and I’m going to try my best to write about the function it spits out, however there are going to be some exceptions to this. For one, if the function is very straight forward or just plain boring I’m going to grab another function. For instance, no one wants to read a post about the ceil function. It rounds up. End of post.
Continue reading

PHP Donts

The following is a non-comprehensive list (in no particular order) of things I often see people doing while using PHP that they probably shouldn’t. The purpose of this list is to inform; hopefully it will shed some light on what some people may be doing wrong and what they can do better. I doubt there is a PHP programmer out there that hasn’t been guilty of some of these things at some point, so if you find that you are doing several or even all of these things it is nothing to be ashamed of.

Continue reading

Amazon Should Step Up

In the aftermath of Amazon’s decision to drop California residents from their affiliate program I found some interesting discussion on the Associates board. Basically the poster is asking if anyone knows of any charities that California residents can swap their associate tags with while they either explore an alternative or wait to see how things play out. I am personally interested in finding such a charity, but I think Amazon should take it upon themselves to take this idea a step further. Amazon should donate the commission that would have been given to California residents to a charitable organization.

The thousands of affiliate links created by California residents are not going to go away over night. Many of them won’t even go away in the near future for various reasons. If Amazon isn’t going to pay California residents for the sales they generate they should at least give us a say in what happens to that money.

Edit
Just to clarify, I personally don’t think it is reasonable to place the blame for this situation entirely on either the California law or Amazon. However, I would feel a lot better about the role Amazon played if I knew they weren’t pocketing the money earned by California associates. Moreover, if Amazon were to implement this idea it might compel some former associates to leave their links up and continue to generate sales for Amazon.