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

That Podcast:
Episode 12 The one where we find the time to discuss not finding the time
December 12, 2014 @ 10:33:35

That Podcast, with PHP community member hosts Beau Simensen and Dave Marshall, has released their latest episode today: Episode #12, The one where we find the time to discuss not finding the time.

Beau and Dave take time out of there busy schedules to discuss what they've been up to recently and get in to the how they do or don't find the time for side projects and open source, in and around work and family.

There's lots of different topics touched on in this episode including:

You can listen to this latest episode either through the in page player or by downloading the mp3 for listening offline. If you enjoy the episode be sure to subscribe to their feed too!

0 comments voice your opinion now!
thatpodcast ep12 time discussion beausimensen davemarshall

Link: http://thatpodcast.io/episodes/episode-12-the-one-where-we-find-the-time-to-discuss-not-finding-the-time/

Anthony Ferrara:
It's All About Time
December 01, 2014 @ 10:46:15

In his latest post Anthony Ferrara talks about a tricky subject in PHP - timing attacks. A timing attack has to do with vulnerabilities that can come up because of the differences in time it takes to perform cryptographic operations (like hashing or encrypting).
An interesting pull request has been opened against PHP to make bin2hex() constant time. This has lead to some interesting discussion on the mailing list (which even got me to reply :-X). There has been pretty good coverage over remote timing attacks in PHP, but they talk about string comparison. I'd like to talk about other types of timing attacks.

He starts with a definition of what a remote timing attack is and provides an example of a simple script showing the delay that's key to the attack. His script deals with string location but it gives you an idea of how the attack works and where the danger lies. He points out that even remotely attackers could determine the times to perform operations (down to the nanosecond) and use this to their advantage. He points out that both == and === are vulnerable to this type of attack because of how the comparison happens. He gives two options (one an internal function) to help protect your application and briefly covers a few other types of timing attacks: index lookup, cache-timing and branch-based timing attacks.

0 comments voice your opinion now!
timing attack comparison time example tutorial introduction prevent

Link: http://blog.ircmaxell.com/2014/11/its-all-about-time.html

Sameer Borate:
Period Time range API for php
November 05, 2014 @ 10:55:28

In his latest post Sameer Borate looks at a library he's recently found that's helpful for working with dates and times, even easier than the DateTime handling built into PHP. The Periodlibrary, part of The League of Extraordinary Packages, aims to "resolve many recurrent issues around time range selection and usage."

Date/time programming is one of the tricky aspects of software development. Although inherently not complex in itself, coding date/time algorithms can be a subtle source of bugs. Especially in web development a feature such as payment subscription processing that ranges from days to weeks to months can get complex quickly. Also such kind of scenarios require additional features like auto renewal, scheduled email alerts to subscribers etc. Such kind of features require good date/time handling algorithms and libraries that handle such chores are always welcome. One such library I encountered recently is Period.

He walks you through the basics first - getting the library installed and creating a new instance of the class to work with. He goes through each of the methods available including the constructor, getting the duration between times and getting the start/end values back as DateTime objects. He also looks at the methods that allow you to create the ranges from various time frames (quarters, weeks, etc), compare ranges and modify time ranges that already exist.

0 comments voice your opinion now!
time range library period leagueofextraordinarypackages datetime

Link: http://www.codediesel.com/algorithms/period-time-range-api-for-php/

Mathias Verraes:
Named Constructors in PHP
June 13, 2014 @ 09:42:15

Mathias Verras has a new post to his site about an idea he calls "named constructors". This method uses static factory methods to simulate the idea of a constructor and initialize the object.

PHP allows only a single constructor per class. That's rather annoying. We'll probably never have proper constructor overloading in PHP, but we can at least enjoy some of the benefits. Let's take a simple Time value object. Which is the best way of instantiating it? The only correct answer is "it depends".

His example shows the typical constructor creation with variable arguments, but points out that this can get messy quickly. His other method, the factory methods as "constructors", can make for a cleaner interface and makes the class more flexible. They make the object able to be initialized with different types of values and even satisfies the Single Responsibility Principle. He goes through a few examples using his "Time" class, showing how different "constructor" methods can be used to handle inputs ranging from a normal hour/minute format out to a "from minutes since midnight" value.

0 comments voice your opinion now!
named constructor factory method static tutorial time

Link: http://verraes.net/2014/06/named-constructors-in-php/

LeaseWebLabs.com:
How to use the "yield" keyword in PHP 5.5 and up
May 23, 2014 @ 12:09:47

In a recent post to the LeaseWebLabs blog Maurits van der Schee looks at the use of the "yield" keyword in PHP 5.5 to work with generators. A generator is very similar to a function that returns an array, in that a generator has parameters, can be called, and generates a sequence of values but it yields values one at a time.

The concept of generators is not new. The "yield" keyword exists in other programming languages as well. As far as I know C#, Ruby, Python, and JavaScript have this keyword. The first usage that comes to mind for me is when I want to read a big text file line-by-line (for instance a log file). Instead of reading the whole text file into RAM you can use an iterator and still have a simple program flow containing a "foreach" loop that iterates over all the lines.

He includes a few code examples showing a class that can read in data from a file in chunks and output the lines as they're extracted (versus using something like file). He also talks about a small performance comparison in working with the file pointer, fread over fgets. He even makes a simple benchmark script to compare the overall time and memory consumption of the fetching of different byte "chunks" from the file.

0 comments voice your opinion now!
yield generator file read fread fgets memory time benchmark

Link: http://www.leaseweblabs.com/2014/05/how-to-use-yield-keyword-php

Lorna Mitchell:
PHP 5.6 Benchmarks
May 19, 2014 @ 09:32:18

Lorna Mitchell has put together a set of benchmarks for PHP 5.6 comparing them to the three previous minor versions, PHP 5.5, 5.4 and 5.3 based around the same setup as her previous benchmarks of PHP 5.4.

A while ago I did some benchmarks on how different versions of PHP perform in comparison to one another. This isn't a performance measure in absolute terms, this was just benchmarking them all on the same laptop while it wasn't doing anything else, and averaging the time it took to run the benchmark script. Recently I ran it again for versions PHP 5.3 through PHP 5.6 and I thought I'd share my results.

There's a steady drop in execution time over the series of versions, with PHP 5.6 coming in the shortest. She also includes the actual numbers of the results in case you'd like to chart them out yourself.

0 comments voice your opinion now!
php56 benchmark previous version execution time

Link: http://www.lornajane.net/posts/2014/php-5-6-benchmarks

SitePoint PHP Blog:
Time Complexity of Algorithms
May 14, 2014 @ 12:25:37

The SitePoint PHP blog has a recent post looking at time complexity in the algorithms you develop in your PHP applications and how that relates to "Big O notation". Big O notation is simply a way of expressing complexity and performance of a method in a less subjective way than "it's faster than.."

If you are a web developer or a programmer in general, you have most likely written algorithms for various tasks. [...] One specification of an algorithm is its correctness. You will probably assume that your algorithm works after testing it out a few times. However, if you can mathematically prove that your algorithm will work as expected for every input value possible, this is a huge bonus. I will not go further in to that subject in this writing. Another specification is its efficiency: how does the computing time relate to the amount of input? Is it a linear relation? Does computing time rise exponentially for the doubling of input? That's what this article will be about.

He starts by talking about the concept of "time complexity" and how it relates to the overall efficiency of the algorithm. He then gets into the definition and examples of Big O notation, including code showing O(n) and O(n2) methods. He talks some about inefficient and efficient algorithms and follows with a refactoring example of moving from one to the other.

0 comments voice your opinion now!
complexity algorithm bigo notation mathematics time tutorial

Link: http://www.sitepoint.com/time-complexity-algorithms/

Ben Ramsey:
Dates Are Hard
February 24, 2014 @ 09:03:24

In a new post to his site Ben Ramsey talks about why dates are hard and can be frustrating to work with sometimes. It revolves around an issue he recently found with calculating a time for a UUID and days of the week.

No, I'm not talking about a meeting with a lover or potential lover. While those can be stressful, the calendar math used to determine the precise date and time on which such a meeting might occur is infinitely more difficult to perform. To software programmers, this isn't news, but I recently encountered an issue when calculating the time for an RFC 4122 UUID that had me questioning the accuracy of our modern, accepted calendars, especially with regard to the days of the week on which our dates fall.

In his work on his UUID library, he came across a the bug because of some failing unit tests. It was only happening in certain versions of PHP and upon further investigation found the issue to be a wrong day of the week from a date in 1582 (the correct value being Sunday). As it turned out, the date in question was actually a Saturday and his local environment was reporting bad results. The problem was with a revision made to the Gregorian calendar, removing 10 days causing a difference between the Gregorian and Great Britain versions of 1582.

0 comments voice your opinion now!
date time calendar gregorian unittest greatbriain year

Link: http://benramsey.com/blog/2014/02/dates-are-hard/

NetTuts.com:
Dates and Time - The OOP Way
October 24, 2013 @ 11:49:23

On NetTuts.com today there's a new tutorial they've posted showing how to use PHP's DateTime functionality in a more OOP kind of way. The DateTime extension lets you work both ways - procedural and OOP, with only slightly different syntax changes between them.

The Date/Time PHP extension is a set of classes that allow you to work with almost all of the date and time related tasks. It's been available since the release of PHP 5.2 and the extension introduced several new classes.

The tutorial first shows you some of the differences between just working with something like date and DateTime. From there they get into a bit more complicated things like:

  • Modifying dates/times
  • Working with multiple dates
  • Working with timezones
  • Using DatePeriods
  • Extending the current functionality

There's also two more "real world" usage scenarios included - defaulting to using UTC times and using the DateInterval to handle subscription payment logic.

0 comments voice your opinion now!
datetime tutorial oop introduction date time

Link: http://net.tutsplus.com/tutorials/php/dates-and-time-the-oop-way/

Erika Heidi Reinaldo:
Productivity and The Pomodoro Technique
October 09, 2013 @ 09:26:24

While not specifically relating to PHP, Erika Heidi's latest post talks about a technique that could help you be more productive in the coding work you do - focusing in on your "time problems" and possibly using the Pomodoro technique to help correct them.

This is a quite famous quotation that is being repeated through the years. "Time is money" is a very contrived way to say that if you lose time, you might be losing money. I personally don't like this quote; lets refactor it to something that better reflects reality: "Productivity is Money" sounds way more realistic. [...] What we really need is to figure out a way to better use the time we have. How do we maximize our productivity?

She breaks it up into four things that can help identify these "time problems":

  • Diagnosing your time problems
  • Managing your Focus
  • Self-sabotage by the scumbag brain
  • The Pomodoro Technique

In this last section she introduces the technique (and tool - the tomato timer) and how it works. She points out the places where the process is flexible and how, especially if you're deep in code, getting to the point of taking a timed break (and sticking with it) can help give perspective.

0 comments voice your opinion now!
pomodoro development time management practice

Link: http://www.erikaheidi.com/2013/10/08/productivity-pomodoro-technique/


Community Events





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


laravel interview list community composer introduction podcast language series symfony voicesoftheelephpant tool framework version library conference opinion release security artisanfiles

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