Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Finding Differences in Images with PHP
May 26, 2016 @ 15:56:33

The SitePoint PHP blog has posted a new tutorial from author Christopher Pitt on an interesting topic that could come in very handy in the right situations: finding differences in images with PHP.

I recently stumbled across a fascinating question: how could I tell whether an image had changed significantly? As PHP developers, the most troublesome image problem we have to deal with is how to resize an upload with an acceptable loss of quality. In the end I discovered what many before me have – that this problem becomes relatively simple given the application of some fundamental mathematical principles.

He starts off by talking about images as "bitmaps", basically a collection of pixels composed in a grid. He also mentions images as sets of vectors, but in PHP the bitmap approach is simpler and more understandable. He includes some code showing the breakdown of an image into its RBG colors values and what the data represents. He then moves into measuring the distance "in three dimensions" with a bit of geometry and applies them to a simple State class. This class breaks down the image given into RBG details then, eventually, compares the other image based on the euclidean distance between the points on the original and the ones from the new image. He filters some of these results through a standard deviation view to weed out problems with almost identical images.

tagged: image difference evaluation tutorial gd similar euclideandistance standarddeviation

Link: https://www.sitepoint.com/finding-differences-in-images-with-php/

Anna Filina:
Reduce number of queries
Oct 29, 2014 @ 15:53:10

In her most recent post Anna FIlina makes a recommendation to those looking to increase the performance of an application, especially one that's already in place: simply reduce the number of queries. It sounds simple enough, but can sometimes prove to be difficult depending on the application.

Customers often call me because their site is slow. One of the most common problems I found was a high number of queries that get executed for every single page hit. When I say a lot, I mean sometimes more than 1000 queries for a single page. This is often the case with a CMS which has been customized for the client’s specific needs.

In this article, aimed at beginner to intermediate developers, I will explain how to figure out whether the number of queries might be a problem, how to count them, how to find spots to optimize and how to eliminate most of these queries. I will focus specifically on number of queries, otherwise I could write a whole tome. I’ll provide code examples in PHP, but the advice applies to every language.

She suggests starting from "the top", looking at the browser's own information on which pieces of data are taking the longest to return back to the client (the latency). This gives a starting direction and tells you where to look for the worst offenders. She talks about a technique to locate and count the queries being made and some common issues found in multiple kinds of software (hint: loops). Then she gets down to the optimization - combining similar queries and better queries through joins.

tagged: query database performance join similar tips

Link: http://afilina.com/reduce-number-of-queries/

Hartmut Holzgraefe's Blog:
PHPReboot Braindump
Oct 11, 2011 @ 15:22:51

In this new post to his blog Hartmut Holzgraefe looks at a new effort that wants to be "the next PHP" while still being PHP. Confused? Take a look at PHPReboot.

PHP.reboot is a reboot of PHP, each Hollywood movie has its own reboot, why not doing the same for one of the most popular programming language. The aim is to keep the philosophy of PHP but adapt it to be more in sync with the Web of 2010.

Hartmut's post is a "braindump" of some of his thoughts about the project including responses to some of its main claims:

  • less $, less ';' like in javascript
  • secure by default: no eval, no magic quotes/string interpolation
  • full unicode support
  • a SQL compatible syntax
  • URI/file literal

In his opinion, the language doesn't look much like PHP anymore and would not only be incompatible with current PHP but also wouldn't benefit from the C libraries PHP has access to.

...so why should it have the letters PHP in its name at all?
tagged: phpreboot project language reboot similar opinion

Link:

Chris Shiflett's Blog:
Technical Vocabulary and Grammar
Jan 20, 2006 @ 12:50:51

It's not strictly PHP related, but Chris Shiflett has posted this new item on his blog today with a look at some technical vocabulary and grammar.

I sometimes wonder why people feel so compelled to use technical terms when talking about computers, even when they don't know what the terms mean. In my experience, those who know the least about a particular topic use the most complicated vocabulary when discussing it. I considered compiling a list of the popular ones, but since I'm lazy and have a blog, I decided to blog about it instead. Feel free to add to the list.

He mentions the incorrect use of the term "computer" when referring to hardware (overgeneralization), the confusion over very similar technical words (i.e. Orientated and Oriented, Depreciated and Deprecated), the pluralization of company names, and various other issues. Be sure to check out the comments for even more...

tagged: technical vocabulary grammar pluralizing similar words overgeneralization technical vocabulary grammar pluralizing similar words overgeneralization

Link:

Chris Shiflett's Blog:
Technical Vocabulary and Grammar
Jan 20, 2006 @ 12:50:51

It's not strictly PHP related, but Chris Shiflett has posted this new item on his blog today with a look at some technical vocabulary and grammar.

I sometimes wonder why people feel so compelled to use technical terms when talking about computers, even when they don't know what the terms mean. In my experience, those who know the least about a particular topic use the most complicated vocabulary when discussing it. I considered compiling a list of the popular ones, but since I'm lazy and have a blog, I decided to blog about it instead. Feel free to add to the list.

He mentions the incorrect use of the term "computer" when referring to hardware (overgeneralization), the confusion over very similar technical words (i.e. Orientated and Oriented, Depreciated and Deprecated), the pluralization of company names, and various other issues. Be sure to check out the comments for even more...

tagged: technical vocabulary grammar pluralizing similar words overgeneralization technical vocabulary grammar pluralizing similar words overgeneralization

Link:


Trending Topics: