socket

A Scala REST “get content” client function using Apache HttpClient

As quick post here today, if you need a Scala REST client function, the following source code should be able to work for you, or at least be a good starting point. I’ve been using it in several applications today, and the only thing I think it needs is the ability to set a connection timeout and socket timeout, and I share the code for that down below.

'Why is my Mac slow?' - How to debug Mac (some) networking problems

A lot of times when I'm asked to debug a Unix, Linux, or Mac OS X system, I'll hear a complaint like "The network seems slow", or just "It seems slow", followed by the usual "What is it doing?"

I actually think that last question is a wonderful one: What is this computer doing?

You can see a lot of information about Unix processes using the ps command or the top utility, but it seems like many system administrators don't know how to find networking information, at least not without a network sniffer.

PHP ping script examples

While working on a shared hosting server, I found that the company I'm working with has disabled my access to the Unix/Linux ping command. Not to be deterred, I found several different ways to run a ping command with a PHP script.

Use the Net_Ping module

The first thing you can try to do is use the PHP PEAR Net_Ping module to get around this problem. In short, you install it like this:

pear install Net_Ping

Then use it like this:

The PHP PDOException SQLSTATE MySQL can't connect socket error

PHP PDOException MySQL socket error FAQ: What is the PHP PDOException SQLSTATE MySQL socket error, and how do I fix the problem?

Every time I work with a new web hosting company, I keep running into one variation or another of this PHP MySQL socket error. It's pretty darned annoying, but at least I know how to fix it now.

In short, if you try to access a MySQL database using the PHP PDO library, such as with Drupal 7, which is what I just did, you may get an ugly MySQL socket error that looks like this:

The PHP MySQL mysql_connect() can't connect to local MySQL server through socket error

PHP MySQL socket error FAQ: I'm getting a MySQL error like "Warning: mysql_connect(): Can't connect to local MySQL server through socket '/home/lib/mysql/mysql.sock'" when trying to connect to my MySQL database from a PHP application, what can I do to fix this?

I just ran into this problem on a new server I'm using with A2 Hosting, where the exact error I got in my PHP MySQL program is this:

cake bake MAMP MySQL socket connection refused error

CakePHP MAMP MySQL FAQ: I'm using the "cake bake" command in a CakePHP application I'm developing using MAMP, and I get a MySQL socket connection error, specifically:

A collection of Java test projects and examples

Sigh, so many broken links, so little time ... when I switched this website to Drupal, I didn't (couldn't) take the time to move all of my static content in the Drupal CMS, so a lot of great content is just sitting out there in static files. To help fix that problem a little bit, here's a link to a collection of Java test project (example projects) that demonstrate all sorts of cool and fun things with Java, including:

A PayPal PHP IPN example

If you're looking for a PayPal IPN example written in PHP, I believe the following code works okay. It's based on the PayPal PHP IPN example (from the PayPal developer site), but I fixed some bugs from their example, added an alternate PHP socket example so you don't have to use SSL to connect to PayPal, and added more variables to the script.