nick halsteadThe technical reason Twitter cannot reorder Timeline (7.2.2016, 09:42 UTC)

I woke up to the news that Jack has denied that Twitter had plans to have a re-ordered timeline.

I was highly sceptical of that ever happening and it is for a purely technical reason. Now anything is of course ‘possible’ but Twitter has a particularly difficult problem when trying to do what Facebook does and it is the very reason Facebook sticks to 5000 friends.

Twitter has always allowed you to follow any number of people and over the years this has fundamentally been the core of most of it’s downtime, it is a very complex problem to deal with the idea that for every Tweet generated it must be distributed to potentially millions of users.

I don’t know the final solution Twitter used but I know it has taken many many years to evolve and develop bespoke software that can route Tweets between users who can have follow any number of other users, or be followed by any number of users.

And that is the problem, Facebook always kept a low limit because it’s fundamental design was that each time you refresh your timeline it basically does a complete re-render, I suspect that they rely upon the fact that they can first work out first a chronological list of updates from everyone you follow, and then they use the magic formula they use to re-order based upon your likes/priorities etc.

Twitter cannot do this – they allow you to follow an arbitrary number of other users – that means if you’re following 50,000 other accounts that means you need to do these calculations for every single update from those 50,000 accounts. If we assume every single account has Tweeted at least once (in last 24 hours) – that is 50,000 Tweets. I now must examine each Tweet, and rank it based upon it’s relevance to the user viewing – lets just look at what that ‘could’ involve.

  • Examine Tweet for subject matter (this could be pre-calculated)
  • Is the subject of interest to the user viewing (could be done by pre-caching subject relevance values)
  • Is the Tweet written by someone of importance? (remember Klout?)
  • Is the Tweet written by someone I interact with regularly (calculated either by number of @ mentions / or ‘retweets’ etc)
  • Does the Tweet contain a link that is important (based upon trending data – this is also likely cached)

Imagine the above 50,000 times for every time you want to view the timeline. Of course all things technical can be achieved – but Twitter has had 5+ years of making the current (very difficult) solution work, and how it currently works and how a re-ordered timeline needs to be calculated are not compatible in any shape or form.




Michelangelo van DamPHP Arrays - The php array functions (6.2.2016, 16:13 UTC)
Source: Xavier33300 on
In my previous article about arrays (the basicssimple operations and associative arrays or hash maps) I have shown what arrays are and what you can do with it. Now I want to dive into real fun and explain PHP's array functions with real-world examples and how you can apply them in your day-to-day work.

Collection to select form key-values

Many of the website registration forms uses a country select element or an autocomplete input field using data from a database.

If this was a single PHP with HTML combined page, there was no problem as you could easily reuse the query made to collect the data. But when using an MVC approach where your controller needs to push the data it fetches from the backend to the form before the form can be passed to the view you're in for a treat. We're addressing the issues for an MVC approach here.

Let's look at our country table first to get an impression how data is being stored in the database.

| Field     | Type        | Null | Key | Default | Extra          |
| id        | int(11)     | NO   | PRI | NULL    | auto_increment |
| iso       | char(2)     | NO   |     | NULL    |                |
| name      | varchar(80) | NO   |     | NULL    |                |
| nicename  | varchar(80) | NO   |     | NULL    |                |
| iso3      | char(3)     | YES  |     | NULL    |                |
| numcode   | smallint(6) | YES  |     | NULL    |                |
| phonecode | int(5)      | NO   |     | NULL    |                |

Truncated by Planet PHP, read more at the original (another 31402 bytes)

SitePoint PHP3 More Joins You Should Be Familiar With (5.2.2016, 17:00 UTC)

There are many ways to JOIN data from two database tables and filter the information you require. Craig Buckler wrote a popular piece on understanding JOINs; namely INNER, LEFT, RIGHT, and FULL OUTER. This article is an extension of that one.

Let’s recap these real quick. Picture two tables, one for customers and one for books to establish a book loan database.

customers table

id firstname lastname book_id
1 Joe Blow 1
2 Jane Doe 2
3 Harry Crow 2
4 Jeffrey Snow 0

books table

id Title
1 Star Wars
2 Jurassic Park
3 Little Women
4 Tom Sawyer

The books table has one row for every book.

The customers table has one row for each customer who can only have one book on loan at a time. If they have no book on loan, the book_id would be 0 or an empty string.

This is a very simple example to make the JOINs as clear as possible to understand!

A LEFT JOIN here would be in the case you want to ask a question such as “show me all customers including any books on loan.

Left Join Venn Diagram

You can see in the image that ALL data in the left circle, or table, is included in the result set. Only data that overlaps from the books table is included from the right table. This means that with a LEFT JOIN, some data in the right table may be excluded.

A RIGHT JOIN would be like asking “show me all the books in my library, along with any customers that have borrowed them.

Continue reading %3 More Joins You Should Be Familiar With%

Thijs FerynMaking the PHPBenelux Conference happen (5.2.2016, 16:41 UTC)

The PHPBenelux Conference edition 2016 took place last week in Antwerpen (Belgium). As an organizer, I’m really happy with the

The post Making the PHPBenelux Conference happen appeared first on Thijs Feryn's blog.

thePHP.ccQuestioning PHPUnit Best Practices (4.2.2016, 22:36 UTC)
SitePoint PHPQuick Tip: How to Permanently Change SQL Mode in MySQL (4.2.2016, 17:00 UTC)

I was working on a legacy project recently and needed to import some data from MySQL 5.5. All the queries in the code worked perfectly in MySQL 5.5, so I assumed an upgrade to 5.7 would be seamless. Not so.

MySQL logo

First I got errors due to DateTime columns being populated with zeros during import, then when running this query:

select * from ebay_order_items where z_shipmentno is null and ExternalTransactionID is not null and orderstatus = 'Completed' and timestamp > '2015-02-25' group by ExternalTransactionID order by timestamp desc

I got this:

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '1066export.ebay_order_items.TransactionID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Continue reading %Quick Tip: How to Permanently Change SQL Mode in MySQL%

PHP Scripts – Web Development BlogParse html with preg_match and preg_match_all (4.2.2016, 06:40 UTC)
For the most of the web developer which are using the function preg_match, is the function preg_match_all a smaller advantage, but for all others it’s maybe hard to understand. The biggest difference between preg_match_all and the regular preg_match is that all matched values are stored inside a multi-dimensional array to store an unlimited number of matches. […]
PHP: Hypertext PreprocessorPHP 5.5.32 is available (4.2.2016, 00:00 UTC)
The PHP development team announces the immediate availability of PHP 5.5.32. This is a security release. Several security bugs were fixed in this release. All PHP 5.5 users are encouraged to upgrade to this version. For source downloads of PHP 5.5.32 please visit our downloads page, Windows binaries can be found on The list of changes is recorded in the ChangeLog.
PHP: Hypertext PreprocessorPHP 5.6.18 is available (4.2.2016, 00:00 UTC)
The PHP development team announces the immediate availability of PHP 5.6.18. This is a security release. Several security bugs were fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version. For source downloads of PHP 5.6.18 please visit our downloads page, Windows binaries can be found on The list of changes is recorded in the ChangeLog.
SitePoint PHP9 Development Workflow Upgrades You Should Know About (3.2.2016, 17:00 UTC)

Every once in a while I run into a tool or plugin so useful I can’t not add it to my arsenal. I usually shout out tweets and try to spread the word that way, but this time I believe I’ve got such a neat (and somewhat random) collection of productivity boosting entries, they deserve a collective article.

Tips and Tricks intro image

Here are 9 new upgrades to your development workflow:

1. git-fresh

git-freshkeeps your repo fresh”. It offers a super handy set of shortcuts for some very useful git commands and combinations - it’ll prune remote branches, rebase, do merges or resets of your workspace, even stash changes effectively so you can easily push or switch branches without committing the latest changes.

It only supports Linux and OS X but since we’re big on Homestead Improved anyway, it’s all Linux for us. In fact, we’re thinking about adding this to the default Homestead Improved installation, so it’s available out of the box. Thoughts?

2. git-extras

git-extras, owned by the mythical TJ Holowaychuk, similarly extends Git’s functionality with incredibly useful additional commands. It’s a pretty old addon, but I’ve only just discovered it and I’m sure there are more of you who might find it rather handy. Examples of new commands include:

  • git setup: initializes a repo and does the first commit of present files for you. A more “bootstrappy” start of a repo, in essence.
  • git ignore: a command line “ignore” so you can add files to .gitignore without leaving the terminal or entering a text editor
  • git summary: provides a neat summary of the repo, including its age, its most active contributors, and more
  • git undo: this one is a real lifesaver - it undoes the last commit, but still keeps the changes as uncommitted so you can safely call git reset --hard to discard them once you inspect the condition of the repo with git status
  • git changelog: automatically creates and populates a changelog file with a MarkDown list of all the commit messages since the last tag was created in the repo.
  • git release x.y.z: a shortcut for creating a release. This invokes a pre-release hook (for builds/tests), creates a release tag of the given version, pushes the tags and the repo to the remote, and everything else you might do on release day
  • git fork: command line forking!
  • git squash: easier squashing of commits!

See full list here.

Continue reading %9 Development Workflow Upgrades You Should Know About%

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP