Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Archive for Lipiec, 2013

Community News: Packagist Latest Releases for 07.27.2013

Community News: Packagist Latest Releases for 07.27.2013Recent releases from the Packagist:

Source: http://www.phpdeveloper.org/news/19907

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Kevin Boyd: Retrofitted Login Throttling

Kevin Boyd: Retrofitted Login Throttling

In this new post to his site Kevin Boyd introduces a tool that you can use to scan your logs for login abuse, Fail2ban, and how to use it with your application’s login attempts to ban IPs as needed.

Fail2Ban is a Python-based utility that hooks directly into the system’s firewall to ban malicious IP addresses, and I’m going to show a few easy steps to make your site safer by blacklisting brute-force attackers. If you maintain a web application that doesn’t have built-in authentication throttling, this might be the how-to you’re looking for – alternatively, this would work as an additional way to punish pesky rogue connections.

His example uses the Fail2Ban ability to read files on the local system, as written by PHP and containing the failure message and an IP address, and adds IP blocks accordingly. He includes some sample code for the format you’ll need to follow and a bit about setup and configuration of the Fail2ban tool.

Link: http://whateverthing.com/blog/2013/07/24/fail2ban-login-throttling
Source: http://www.phpdeveloper.org/news/19906

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Allan MacGregor: An Introduction to HHVM

Allan MacGregor: An Introduction to HHVM

Allan MacGregor has posted a (high level) introduction to the HipHop Virtual Machine (HHVM) that was created by Facebook to address some of their PHP-related needs inside their platform. It sacrifices some things in the name of speed and less resource consumption.

In early 2008 Facebook began working on HipHop(now HPHP), a PHP execution engine; its original motivation was to convert Facebook massive PHP code base into C++ in order to save resources and increase the application performance. [...] At it’s peak, HipHop PHP code showed up to 6x times better performance than its ZEND counterpart. However, there where several drawbacks to this first iteration of HipHop. [...] At the same time Facebook started the development of the modern version of HipHop, known as HHVM (HipHop Virtual Machine), HHVM improves the strengths of HPHPc and corrects many of the critical problems.

He talks some about Facebook’s efforts to open source the platform and what the HipHop VM does to make your PHP code execute that much faster. It’s all about bytecode, machine code and a JIT (just in time) compiler where the bytecode is parsed during execution instead of before.

Currently HHVM supports PHP 5.4 almost on its entirety, however there are still numerous bugs that prevent some applications from running, for that reason Facebook has set as goal to have the top 20 open source PHP applications running on HHVM. The first popular application to achieve this was Wordpress.

Link: http://coderoncode.com/2013/07/24/introduction-hhvm.html
Source: http://www.phpdeveloper.org/news/19905

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Chris Jones: Using PHP and Oracle Database 12c Implicit Result Sets

Chris Jones: Using PHP and Oracle Database 12c Implicit Result Sets

Chris Jones has a new post to his site showing you how to use Oracle 12c’s implicit result sets in your code. Note: this functionality is still in development, so the naming/exact functionality might change.

The new Oracle Database 12c “Implicit Result Sets” (IRS) feature allows query results to be returned from a stored PL/SQL procedure (or a PL/SQL anonymous block) without requiring special PHP code. Support for IRS is available in PHP OCI8 2.0.0-devel extension when it is compiled and used with Oracle Database 12c. (OCI8 2.0 can be compiled and used with other versions of Oracle Database but the available feature set is reduced).

He shows a normal fetch loop that calls the oci_* functions and grabs each row with a oci_fetch_row call. He updates this to use an anonymous PL/SQL block (a string) instead that allows for more flexibility. He includes examples that fetch from one table, multiple tables and returns multiple result sets (that can be fetched one at a time) from the same single call.

Link: https://blogs.oracle.com/opal/entry/using_php_oci8_2_0
Source: http://www.phpdeveloper.org/news/19904

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Community News: Packagist Latest Releases for 07.26.2013

Community News: Packagist Latest Releases for 07.26.2013Recent releases from the Packagist:

Source: http://www.phpdeveloper.org/news/19903

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Site News: Popular Posts for the Week of 07.26.2013

Site News: Popular Posts for the Week of 07.26.2013Popular posts from PHPDeveloper.org for the past week:

Source: http://www.phpdeveloper.org/news/19902

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Inviqa techPortal: PHP Test Doubles Patterns with Prophecy

Inviqa techPortal: PHP Test Doubles Patterns with Prophecy

The Inviqa techPortal has a new post today from Marcello Duarte about using Prophecy in unit testing to work with mocks and doubles.

Test doubles are a way of replacing all classes in our tests other than the one we are testing. They give us control on direct and indirect outputs that would have been generated by those classes. Understanding the role of the test double helps us to write better tests, and thus better code. [...] When writing unit tests we are focusing on describing one unit of behaviour at a time, and how objects communicate in order to achieve that behaviour. We instantiate the object under test, call a method of the object and observe if the outcome is as expected.

In his examples he uses Prophecy to mock out different kinds of objects – a dummy object, a “fake” (with listeners for other object calls), a stub that mocks other internal method calls and a more familiar mock object. He also talks about two guidelines to follow when thinking about writing tests and code complexity – the Law of Demeter and “Don’t Mock What You Don’t Own.” He gives an example of working around this last one by using the Adapter design pattern.

Link: http://techportal.inviqa.com/2013/07/23/php-test-doubles-patterns-with-prophecy
Source: http://www.phpdeveloper.org/news/19888

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Inviqa techPortal: PHP Test Doubles Patterns with Prophecy

Inviqa techPortal: PHP Test Doubles Patterns with Prophecy

The Inviqa techPortal has a new post today from Marcello Duarte about using Prophecy in unit testing to work with mocks and doubles.

Test doubles are a way of replacing all classes in our tests other than the one we are testing. They give us control on direct and indirect outputs that would have been generated by those classes. Understanding the role of the test double helps us to write better tests, and thus better code. [...] When writing unit tests we are focusing on describing one unit of behaviour at a time, and how objects communicate in order to achieve that behaviour. We instantiate the object under test, call a method of the object and observe if the outcome is as expected.

In his examples he uses Prophecy to mock out different kinds of objects – a dummy object, a “fake” (with listeners for other object calls), a stub that mocks other internal method calls and a more familiar mock object. He also talks about two guidelines to follow when thinking about writing tests and code complexity – the Law of Demeter and “Don’t Mock What You Don’t Own.” He gives an example of working around this last one by using the Adapter design pattern.

Link: http://techportal.inviqa.com/2013/07/23/php-test-doubles-patterns-with-prophecy
Source: http://www.phpdeveloper.org/news/19888

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

PHPMaster.com: Data Structures for PHP Devs: Heaps

PHPMaster.com: Data Structures for PHP Devs: Heaps

PHPMaster.com has posted the third part of their “Data Structures for PHP Devs” series today, this time focusing on heaps. Heaps are a method for organizing a parent/child relationship that makes it easier to work with.

In past couple articles I’ve introduced you to three basic data structures: stack, queue, and tree. In this article I’ll introduce you to another abstract data type that is closely related: heap. Heaps are specialized tree-like data structures which satisfy the heap property – the node value (key) of any parent is always ordered with respect to its child node values across the entire tree.

He starts off by explaining what the different types of heaps are – maxheap, minheap and (a special instance) a Priority Queue. He talks about the operations available to heaps and starts off with a binary maxheap implementation using arrays. He also mentions some of the functionality that the SPL already provides for this sort of thing – SplMaxHeap, SplMinHeap and the SplPriorityQueue.

Link: http://phpmaster.com/data-structures-3
Source: http://www.phpdeveloper.org/news/19887

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

PHPMaster.com: Data Structures for PHP Devs: Heaps

PHPMaster.com: Data Structures for PHP Devs: Heaps

PHPMaster.com has posted the third part of their “Data Structures for PHP Devs” series today, this time focusing on heaps. Heaps are a method for organizing a parent/child relationship that makes it easier to work with.

In past couple articles I’ve introduced you to three basic data structures: stack, queue, and tree. In this article I’ll introduce you to another abstract data type that is closely related: heap. Heaps are specialized tree-like data structures which satisfy the heap property – the node value (key) of any parent is always ordered with respect to its child node values across the entire tree.

He starts off by explaining what the different types of heaps are – maxheap, minheap and (a special instance) a Priority Queue. He talks about the operations available to heaps and starts off with a binary maxheap implementation using arrays. He also mentions some of the functionality that the SPL already provides for this sort of thing – SplMaxHeap, SplMinHeap and the SplPriorityQueue.

Link: http://phpmaster.com/data-structures-3
Source: http://www.phpdeveloper.org/news/19887

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>