News Feed
Sections




News Archive
feed this:

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

SitePoint PHP Blog:
Responsive Images Using Picturefill and PHP
October 10, 2013 @ 10:08:11

On the SitePoint PHP blog there's a new post from Lukas White showing you how to use the Picturefill plugin (Javascript) along with PHP to make responsive images.

One of the key challenges with responsive web design, and a subject of much discussion in recent years, is how to deal with images. Setting a max-width on image elements enables designers to allow their size to adapt to the page dimensions, but in itself that approach can lead to far bigger images being downloaded than are required. [...] You can use a similar approach [to "source sets" of images] straight away and in a cross-browser compatible manner by using Javascript; one such method is the Picturefill plugin. In essence, Picturefill allows you to specify different src attributes for an image, each image file corresponding to a different media query. Thus

The tutorial helps you create an application, powered by the Slim framework and the ImageMagick extension, for the basic structure. He then grabs the Picturefill library and drops them into place. Some sample code is also included showing how to create the HTML structure for the images and the Javascript to handle the switching.

0 comments voice your opinion now!
responsive image picturefill tutorial resolution source set

Link: http://www.sitepoint.com/responsive-images-using-picturefill-php/

Refulz.com:
Traits - Method Precedence and Conflict resolution
May 31, 2012 @ 10:07:25

On the Refulz.com site today they've posted a new tutorial looking at the use of traits and how to resolve conflicts and work with method precedence.

In our previous post about the multiple and nested traits, we read how nested and multiple traits can be used in a class. In such cases, there is a possibility of the same method name existing in the trait, and the class using the trait. Furthermore, the same method name might also be present in the parent class of the class using traits. It is important to understand how the precedence order works for such cases.

First they look at the precedence between classes and traits with the class always winning...unless the method is inherited from a parent class. They also mention the order when it comes to using the "insteadof" and "as" operators as a way to get around conflicts between traits.

0 comments voice your opinion now!
traits conflict resolution inheritance precedence insteadof as tutorial


Toomas Romer's Blog:
Case study Is PHP embarrassingly slower than Java?
August 04, 2008 @ 12:02:05

In a case study posted to his blog, Toomas Romer wonders if a PHP script is embarrassingly slower than than its Java counterpart.

The problem. The PHP implementation [of the IP2C library] is a lot slower. Embarrassingly slower. Without any caching the Java version is able to do ~6000 queries per second. The PHP counterpart can push through ~850 queries. The implementations are the same. The stats provided by the author of the library are 8000 vs 1200. So about the same as my measurements.

He details the script, showing what parts the script is taking up the most time on. A large part of the execution is tied up in IO and the fseek/fread and readShort/readInt functions take up a good chunk.

He even tries removing the functions and making things a bit more streamlined. This helps, but still lags behind its Java brother. Check out the post for more statistics comparing the two.

0 comments voice your opinion now!
casestudy slower ip2c ip country resolution java compare benchmark


Inside Open Source:
Viewing Large Record Sets in PHPMyAdmin
January 15, 2007 @ 09:47:00

From the Inside Open Source blog (from APress) there comes a helpful tip for those working with Firefox and PHPMyAdmin on a lower resolution screen:

I'm currently working on an e-commerce project involving a relatively small number of database tables. However the clients table consists of 19 fields, making for difficult data review and debugging within PHPMyAdmin, even at 1280-768 resolution.

The answer is simple, at least if you're using Firefox. Firefox offers three hotkeys for changing the text size, and resultingly, the amount of text you can see on one screen.

The keys for this easy little fix use the Control key and plus (larger), minus (smaller), and zero (return to default size).

0 comments voice your opinion now!
phpmyadmin firefox text size record set resolution phpmyadmin firefox text size record set resolution



Community Events





Don't see your event here?
Let us know!


community introduction podcast laravel series developer language opinion interview framework symfony2 unittest testing code refactor install list threedevsandamaybe configure release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework