Full Feed http://www.addedbytes.com/feeds/full/ en Web Development in Brighton - Added Bytes 2006 120 Chess - Algebraic Notation Cheat Sheet http://www.addedbytes.com/cheat-sheets/chess-algebraic-notation-cheat-sheet/ Overview

Chess - Algebraic Notation Cheat Sheet The Chess - Algebraic Notation cheat sheet is a one-page reference sheet for chess beginners, including the basics of chess notation and annotation.


This cheat sheet is available for free at Cheatography!

Tue, 18 Mar 2014 08:01:29 +0000 http://www.addedbytes.com/cheat-sheets/chess-algebraic-notation-cheat-sheet/ Dave Child
PHP Coding Standards Cheat Sheet http://www.addedbytes.com/cheat-sheets/php-coding-standards-cheat-sheet/ Overview

PHP Coding Standards Cheat Sheet The PHP Coding Standards Cheat Sheet is a reference for the current batch of PSR standards from the PHP-FIG standards group. At the time of writing, that includes PSR-0, PSR-1, PSR-2 and PSR-3.


The PHP Coding Standards Cheat Sheet is available for free at Cheatography!

Fri, 21 Feb 2014 12:29:39 +0000 http://www.addedbytes.com/cheat-sheets/php-coding-standards-cheat-sheet/ Dave Child
Cheatography Cheat Sheet http://www.addedbytes.com/cheat-sheets/cheatography-cheat-sheet/ Overview

Cheatography Cheat Sheet The Cheatography Cheat Sheet is a one-page reference sheet for Cheatography itself, showing the various types of blocks you can use in a cheat sheet, along with a few helpful tips and tricks.


The Cheatography Cheat Sheet is available for free at Cheatography!

Fri, 21 Feb 2014 09:37:11 +0000 http://www.addedbytes.com/cheat-sheets/cheatography-cheat-sheet/ Dave Child
Readability-Score.com Gets Some Love http://www.addedbytes.com/blog/readability-score.com-gets-some-love/ Way, way back in 2004, I wrote a piece of code to analyze the readability of text using the various algorithms that had been developed for the task. It grew in usage, and became an Open Source project and got its own website over the next few years. And then, it sat around, being useful but quiet.

Every so often I would take a look at the stats, modify a little piece of code, or actually use the tool myself. But more often than not, it didn't really venture into my thoughts, except briefly when some kind soul made a donation because the site was useful to them.

But that's no way to run a website, even if it is a small, single-purpose site. So, it's had some attention. Dinner and a movie, a quick fumble behind the bike sheds - usual sort of thing.

What's New?

One of the first changes that you might spot on the new site is addition of a great big "Premium" tab. Premium supporters pay a small amount every year (as much as they like) to help pay for the site. (They also get access to the new bulk processing feature - more info below.)

Next, Readability-Score.com now supports URLs. Instead of copying and pasting text from another site, you can just drop in the URL, and it will go off, fetch the page, process the text and give you a score for the readability of the page. You can specify a single portion of the page, if you want and if you're familiar with IDs in HTML, and it will just score that part of the page - good for helping prevent navigation and footer elements from skewing your text scores.

The site is also now served over HTTPS. Because why not.

There's now a quick and convenient bookmarklet, for sending the URL of the page you're browsing to Readability-Score.com.

Next, there is now a handy bulk processing feature, for people with lots of text or URLs to score. It takes a CSV, processes the text or URLs within it, and emails the results back to you. Bulk processing is only available to premium supporters at the moment.

It's had a small set of changes made to the codebase, thanks in part to fellow text statistics enthusiasts on GitHub. So it's now a little faster and a tiny bit more accurate. Though it still can't tell how many syllables there are in moped, and doesn't handle numbers particularly well.

Finally, everyone who has donated to Readability-Score in the last couple of years has been made a premium supporter and should have received an email with their login details; if you donated and haven't received your login, please let me know.

Tue, 11 Feb 2014 14:15:28 +0000 http://www.addedbytes.com/blog/readability-score.com-gets-some-love/ Dave Child
How to Correct Magento's Paypal Rounding Error http://www.addedbytes.com/blog/how-to-correct-magentos-paypal-rounding-error/ The Problem

Magento prices can be defined as inclusive of tax (which in the UK is 20% at the moment). If you want to calculate the price of a product, without that tax, sometimes the result is not a nice round number.

For example, if you are selling a product at £9.99, then the exact price without tax is £8.325.

Paypal, unfortunately, won't allow prices set to three decimal places. This, on the face of it, makes sense - you can't charge people fractions of pennies, after all.

Here's where the problem is, though - what price do you send to Paypal? If you round down, and send Paypal a price of £8.32, then when tax is added the customer is charged £9.98. If you round up to £8.33, Paypal adds tax and the customer is charged £10.00. Whatever you send, you can't get Paypal to charge the customer £9.99 including tax.

Whichever price you send, Paypal adds up the line items, sees that the total doesn't match the order total (which you send through separately), and rejects the order with a message saying "Transaction refused because of an invalid argument", "Item total is invalid" or "The totals of the cart item amounts do not match order amounts".

The Solution

There are a few approaches to this problem which revolve around changing how Magento sends its orders to Paypal. Many people choose to send all prices inclusive of VAT, to avoid the error entirely. Sometimes, though, that's just not possible.

My preferred solution is to modify the Paypal handler for Magento, tracking the missing pennies and adjusting the first order line item price to compensate for the offset.

The first step is to copy the Abstract.php file from app/code/core/Mage/Paypal/Model/Api/ to app/code/local/Mage/Paypal/Model/Api/. You can make these changes directly to the core file if you really have to, but it's not recommended. Find the _exportLineItems function (line 390 in my version) - this is what we're going to change.

Before the foreach ($items as $item) { (around line 412) add this:

$running_total = 0;

Before the $request[sprintf($privateFormat, $i)] = $value; (around line 423) add this:

if ($publicKey == 'amount') {
    $running_total += $value;

Before the return $result; (around line 427) add this:

// Check ITEMAMT. If different to running total, offset prices
if ((isset($request['ITEMAMT'])) && ($request['ITEMAMT'] > 0)) {
    if ($running_total <> (float) $request['ITEMAMT']) {
        $difference = ($running_total - (float) $request['ITEMAMT']);
        // Apply difference to first product.
        $request['L_AMT0'] = (string) ((float) $request['L_AMT0'] - $difference);

And that's it - Magento will now play nicely with rounding of tax when payments go through Paypal.

Sun, 25 Nov 2012 00:00:00 +0000 http://www.addedbytes.com/blog/how-to-correct-magentos-paypal-rounding-error/ Dave Child
The Key to Being Acquired By Yahoo http://www.addedbytes.com/blog/the-key-to-being-acquired-by-yahoo/ Many industry commentators have struggled to detect the rhyme or reason behind Yahoo's acquisition strategy. To some it appears more like Yahoo is picking up hot young startups, taking them back to it's bachelor pad, doing the wicked thing and then discarding them like yesterday's paper.

It's not unfair to say that Yahoo has not done brilliantly with some of its purchases. Exciting projects like Flickr, Delicious and GeoCities were all bought at their peak and then stagnated for years under the Yahoo umbrella.

I can at last reveal that I've discovered Yahoo's new method for deciding which startup to buy next: Scrabble scores.

That's right, Yahoo's recent purchases show a clear relationship between a company name's scrabble score and the likelihood that they are bought by Yahoo.

Not convinced? Let's review the evidence!

Bought By Yahoo

  • Qwiki: 21 points
  • Xobni: 14 points
  • Zimbra: 19 points
  • Kelkoo: 14 points
  • Flickr: 15 points
  • Tumblr: 10 points
  • GeoCities: 12 points
  • Delicious: 12 points

Not Bought By Yahoo

  • Meebo: 9 points
  • Taleo: 5 points
  • Siri: 4 points
  • Urchin: 8 points
  • Sendit: 7 points
  • Neolane: 7 points

Yahoo clearly have a cut-off - the company name must be worth 10 points or more. Tumblr only just scraped in (maybe it was sitting on a double word score?). So, when picking your new company name, make sure you add a couple of high value letters if you want to be certain of interest from Yahoo.

Thu, 04 Jul 2013 11:21:54 +0100 http://www.addedbytes.com/blog/the-key-to-being-acquired-by-yahoo/ Dave Child
Congratulations to Languagenut: Top 20 EdTech Company http://www.addedbytes.com/blog/congratulations-to-languagenut-top-20-edtech-company/ I have been lucky enough to work regularly for the last few months with a great educational outfit, LanguageNut.

I have been lucky enough to work regularly for the last few months with a great educational outfit, LanguageNut. They have great drive, plenty of ambition and are growing fast, and that's been rewarded this week!

EdTech top 20 finalist

LanguageNut have been named as one of Europe's 20 Fastest Growing and Most Innovative E-learning Companies. The top three companies will be announced at EdTech Europe on the 14th June. Good luck!

Wed, 05 Jun 2013 09:04:51 +0100 http://www.addedbytes.com/blog/congratulations-to-languagenut-top-20-edtech-company/ Dave Child
Going Freelance - Cash Flow http://www.addedbytes.com/blog/going-freelance-cash-flow/ A comment from Michael on my Going Freelance: First Impressions post raised a great (and common) question, and one that I reckon most freelancers ask themselves when starting out: what if somebody doesn't pay, or pays late?

What is Cash Flow?

Your business, like any other (and even if you are a freelancer without an official limited company) takes money in in return for work, and spends money out in expenses, wages and so on. The money that comes in is based on the work you have completed, but more often than not there is a delay between finishing the work and being paid for it.

If the money isn't in the business to pay expenses and wages, you may find yourself out of business - even if you have taken on as much work as you could handle. You can be profitable on paper, but out of cash and out of business, just because cash wasn't coming in quickly enough. Having enough cash to pay your bills is referred to as being "liquid".

Woohoo! You Got a Gig!

Well done! Convincing somebody that you are the right person to take on a paid job is the first step on the road to successful freelancing. Now, what does that mean in terms of cash flow?

Most people will look at a project, and will base their forecasts on something like this. We'll assume this job is estimated to take one month - a good sized job, and starts on January 1st. The job finishes on time on February 1st, and the invoice is sent immediately. The client pays in good time, and the money is received on March 1st. Based on this, a freelancer just starting out will only need to cope for two months with no income - achievable with minimal savings.

This would be lovely, but it's often not how things work in practice. Let's look at how cash flow can go wrong. To begin with, we'll assume this project runs long for some reason - although the bulk of the work was complete in one month, the client finishes their copy after two months, and once the copy is in they request a few changes. The job is eventually signed off in mid-March. With 30 day terms, the invoice is due in mid-April. And the client pays late - initially because they didn't receive the invoice, and then because they were just slow to pay. After a few weeks of chasing, money arrives in late May.

Four, nearly five, months, from the project being agreed to money being received. That means, assuming this was your first gig, and you had two months of income saved up at the start, you'd be looking at surviving over two extra months with no income. For most people, surviving with no income isn't an option. So you're left with two choices - take out a loan, or give up and take a salary at a company. Neither is a great start to your freelancing career!

How Many People Pay Late

I've been asked several times how many invoices are paid late, or how many clients pay late. Unfortunately, there's no right answer. Some people go for years with no late payments. Some have a particularly bad period where everybody pays late.

In my experience so far, around:

  • 25% of clients pay invoices a week or more early (deposits especially)
  • 50% pay in the few days before the invoice due date
  • 20% pay within a couple of weeks after the due date
  • 5% pay later than a couple of weeks after the due date

My latest payment was three months overdue when paid. The fastest payment was under an hour.

How to Keep Your Cash Flowing

There are three ways (other than reducing your business expenses) to keeping your cash flow from being a problem:

  1. Make It Easy to Pay On Time
  2. Chase Late Payments
  3. Reducing the Impact of Late or Non Payers

Make It Easy to Pay On Time

Paying other people money is not something people look forward to. There is a financial incentive to delaying payment as long as possible (interest earned), and it might be sensible to keep money within your company as long as possible, in case a more important bill suddenly needs paying. With that in mind, it makes sense to make it as easy as possible for people to pay on time.

Bill in stages for large projects so you're not left with a single large payment outstanding at the end. Billing at the end of each month for work completed during the month is a good way to manage long projects. And it gives smaller invoices for your client to cope with. Paying a set of small invoices over time is easier on their cash flow than paying one large invoice.

Once an invoice is sent, chase it up within a few days to make sure it has been received. It is not unknown for unscrupulous people to claim to have never received an invoice to avoid paying for another few weeks. Confirming receipt of the invoice gives one less excuse for a payment to be late.

Many people incentivise or reward quick payment. Some people give a percentage discount if payment is received within a set number of days, for example. People's experiences with this are varied, but this post by Astrid, a freelance translator matches what I have heard from other freelancers - it may work for you and your clients, but there are risks.

Make sure you accept as many payment options as is practical. If your client finds it easiest to pay by cheque, that's fine. It might not be your preferred method, but if it means they pay on time, then let them do it. By the same token, if someone offers to pay early, always accept. There's nothing stopping you charging more later if needed, or refunding money if the project is under budget, but always opt to take the money when it's offered.

Chase Late Payments

This video, from Mike Monteiro and San Francisco Creative Mornings, offers one (NSFW, language) perspective:

Chasing overdue payments can be time-consuming and stressful, but it is inevitable. Everybody handles it differently, and there is a lot to consider.

First, establish whether this is a client you want to do business with in future. Some businesses have cash flow problems themselves, but that doesn't mean they can't be a valuable client later. On the other hand, if the project has not been great for either party, you might not want to work with them again.

Some people advocate contact every day once a payment is late, ideally by phone. I tend to adopt a slightly less aggressive approach - I send a chasing email once a payment goes late, and then chase regularly every few days from there by email and phone. If I don't hear back, I will continue to keep contacting until I do. If I do hear back, then the next stages are dependent upon the client response. If not, and it's been a few weeks, I'll send recorded delivery post, and if necessary begin the paperwork for small claims court.

If the client is in contact, that's a good sign. You need to start worrying when they're avoiding you - the fact they're speaking to you indicates that they are likely to be willing to pay. Try to work out why the payment is late, if possible. If the client is having cash flow problems, you are probably not the only person chasing them, and you may find that offering a payment schedule is the best way to get the bill resolved. This kind of friendly approach may win you loyalty from your customer, and you might find that, once they are over this particular tough patch, they are a great client.

Some companies will tell you they have "45 day payment terms" or "60 day payment terms". You should have your payment terms clearly outlined in your proposals, your contracts and your invoices - and the terms they would like to pay on are irrelevant - the terms agreed in proposals and invoices are what matters. If they pay late, by the terms agreed, you can chase payment and, if appropriate, invoke penalty charges or clauses. If you didn't agree payment terms before starting, you're pretty much stuck with their standard policy.

If the client is refusing to pay, and you have delivered what was agreed, your position is tougher. At this point, you first need to establish whether it is worth chasing payment at all. There is no sense wasting days of time if there is only a small amount owed.

If you have tried to resolve the issue and got nowhere, look at your legal options. In the UK, for amounts under £10k, you can use the small claims court, which is a great, cheap option (no lawyer required) (there's a great guide to using the small claims court here). As long as you can demonstrate you have delivered what was agreed, and that you have tried to resolve the issue without resorting to court, you will likely find the court siding with you.

Unfortunately, that isn't the end of the story. The judge may not award you the full amount you have asked for. The client may still be unable to pay. And the client may still refuse to pay, at which point you will need to obtain a warrant of execution to recover goods to the value of the money owed. Between this, the initial court fees, and the time involved in chasing, you can easily end up out of pocket even if you win.

Reducing the Impact of Late or Non Payers

Some people won't pay. Some people will pay late. Some will delay for months over trivial amounts of money. Some will attempt to find excuses not to pay. These are unavoidable, but there is plenty you can do to ensure that any damage caused by late payments is kept to a minimum.

Consider getting a credit report on clients before starting work. Many people do this as standard, and pay a flat fee for the ability to do so. It's not something I've done so far, but I would do it for a client where a failed payment meant the end of my business.

Make sure you have enough cash reserves to cope with a few months of waiting. Expect people to pay late and prepare for it. If you only have enough cash reserves to cope with one payment being a week or two late, you don't have enough cash reserves. Make it a priority to build up enough of a cushion to cope with as much as you are comfortable with. Enough money to cope with at least three months with no income would be sensible.

Always ask for a deposit before starting work. I usually ask for 30%-50% in advance, except for small projects or overseas projects, where I ask for full payment in advance. This weeds out the time-wasters pretty quickly. You will find that sometimes there is a lot of pressure to start a job before the deposit is paid, and it is up to you to decide whether to do so. I have done, for time-sensitive projects, but try not to unless unavoidable. If the deposit invoice goes overdue, you may have a serious problem - I won't continue a project until that deposit is paid, and would happily insist on a further deposit also being paid in that situation. And if the client ultimately doesn't pay their final invoice on time, or at all, then you are not left having earned nothing for the work.

Add a provision for penalty charges for late payments to your estimates, contracts and invoices. Even if you never actually charge it, it is a good bargaining tool once a payment is late. The penalty charge should include a percentage fee charged on a regular basis, so that the longer the money is owed, the more the penalty. Charging a single, fixed-price penalty is only of limited use, as once it is applied there is nothing to stop the payment being delayed even further.

Finally, and perhaps most importantly, you can spread your risk by taking smaller jobs with more clients. If you have just one client, you're at much greater risk if they have trouble. If you have several, you should be able to cope better with one or two paying late (or not at all).

My approach to this last point is to differentiate between projects (work which is more than 2 days) from small jobs and maintenance work. I book in project work based on a three day week (so a 15 day project is delivered over 5 weeks). The other two days I can spend on the smaller pieces of work or my own projects. This means that even with a larger project I am still billing smaller jobs frequently. As a result of this I can also cope better with projects taking longer than expected, as I can have two projects on the go at the same time - something I couldn't do if I based projects on a five day week.

Back to Michael

Michael's comment was pretty typical of the fears most freelancers have about getting started. The beginning is stressful, and with no guarantees of rewards. But with some decent planning, a bit of hard work and some careful money management, it's all quite manageable. And while I can't speak for everyone, for me it's been worth it in every meaningful way - six months in I am happier, financially better off, working with interesting clients on interesting projects, and able to spend more time with my family, all at the same time.

Fri, 03 May 2013 10:43:46 +0100 http://www.addedbytes.com/blog/going-freelance-cash-flow/ Dave Child
Poker Cheat Sheet http://www.addedbytes.com/cheat-sheets/poker-cheat-sheet/ Overview

The Poker cheat sheet is a one-page reference sheet for beginner poker players, including how to play the three most common variants, hand ranks, and basic positional play.


This cheat sheet is available for free at Cheatography!

Tue, 02 Apr 2013 16:23:00 +0100 http://www.addedbytes.com/cheat-sheets/poker-cheat-sheet/ Dave Child
Dave's Second Law of Development http://www.addedbytes.com/blog/daves-second-law-of-development/ If you ever utter the words "It's definitely not that.", it's 100% certainly, without a shadow of doubt, exactly that.

Fri, 29 Mar 2013 16:24:00 +0000 http://www.addedbytes.com/blog/daves-second-law-of-development/ Dave Child