Improving website accessibility for screen readers (part 1)

About 300 million people experience some sort of visual impairment. Unfortunately this is often overlooked by developers and product owners. The good news news is that it is easy to get started on improving your website. Making your website accessible means your website potentially reaching a wider audience and more easily retain traffic from people these impairments.

An accessible web page will typically also rank better in search engines such as Google. More on that later.

In this tutorial series I will explain why you should make your website accessible. I will also go through the basics of implementing ARIA as well as provide some basic accessibility tips.


php-fpm on macports: An another FPM instance seems to already listen

I’ve had this issue with php-fpm from Macports which would fill up my log files rapidly and cause other mischief. The error message in question is:

ERROR: An another FPM instance seems to already listen on /opt/local/var/run/php56/php56-fpm.sock

I finally managed to fix it by simply forcing php-fpm to not run as a daemon by adding the --nodaemonize switch to /Library/LaunchDaemons/org.macports.php56-fpm.plist.

Most likely this means that daemondo keeps on spawning php-fpm instances although one already exists for some reason.

I think the default behavior for php-fpm is to listen on a TCP socket which might explain the issue, as I have changed it to listen on a Unix-socket instead.


Automatically archiving old email

If you like me host your own email server for privacy reasons you will surely notice that your mailbox will grow quite large after some time. Luckily there’s a very convenient program - archivemail - that easily solves this problem for us. Email messages are compressed very well considering it is all text. There is some precious disk space to save (about 70-80 percent reduction in size for text files).

It is easy to setup in Debian, or any other distribution:

sudo apt-get install archivemail

After installing the program you invoke it with the mailbox locations as the arguments. To compress and archive emails in the Archive and Sent folders in a standard mailbox structure:

archivemail $HOME/mail/Archive $HOME/mail/Sent

This will archive any emails older than 180 days and compress them using gzip.

The number of days (default 180) can be changed by passing the parameter -d according to the man page:

-d NUM, --days=NUM
           Archive messages older than NUM days. The default is 180\. This option is incompatible with the --date option below.

To automatically archive old email messages you simply add it to your crontab (make sure you pipe any output to /dev/null unless you want to get bombarded with messages):

0 2 * * sun archivemail $HOME/mail/Archive $HOME/mail/Sent &> /dev/null

Reddit Dailyprogrammer Challenge #249

I have not previously posted my solutions to the Reddit Daily Programmer (For learning, refreshing, or just for fun!). I figure it is a good idea to practice my writing skills as well as my programming skills. Great excuse to use programming languages you are less proficient in.

This challenge, Challenge #249 [Easy] Playing the Stock Market, I solved in C++11 (using lamdas). The goal is to figure out when to buy stock and when to sell them to gain the most profit, given a string of space separated floating-point numbers. I tried solving it using more STL than I am used to and I am pleased with the result. This was also the first time I had used any of the string stream functions - which was interesting to learn about.

./playing-the-stock-market

Enter a list of space separated decimal floats:

9.20 8.03 10.02 8.08 8.14 8.10 8.31 8.28 8.35 8.34 8.39 8.45 8.38 8.38 8.32 8.36 8.28 8.28 8.38 8.48 8.49 8.54 8.73 8.72 8.76 8.74 8.87 8.82 8.81 8.82 8.85 8.85 8.86 8.63 8.70 8.68 8.72 8.77 8.69 8.65 8.70 8.98 8.98 8.87 8.71 9.17 9.34 9.28 8.98 9.02 9.16 9.15 9.07 9.14 9.13 9.10 9.16 9.06 9.10 9.15 9.11 8.72 8.86 8.83 8.70 8.69 8.73 8.73 8.67 8.70 8.69 8.81 8.82 8.83 8.91 8.80 8.97 8.86 8.81 8.87 8.82 8.78 8.82 8.77 8.54 8.32 8.33 8.32 8.51 8.53 8.52 8.41 8.55 8.31 8.38 8.34 8.34 8.19 8.17 8.16

Outputs the following expected response from the challenge.

buy at 8.03 - sell at 9.34

The source code is a bit too long to post here but is available here.