News Feed
Jobs Feed
Sections




News Archive
feed this:

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

Mikko Koppanen:
Working on images asynchronously
December 16, 2013 @ 10:45:35

Mikko Koppanen has a new post to his site today about working with images asynchronously - the "offline" processing of things like user uploaded images using a queuing system.

To get my quota on buzzwords for the day we are going to look at using ZeroMQ and Imagick to create a simple asynchronous image processing system. Why asynchronous? First of all, separating the image handling from a interactive PHP scripts allows us to scale the image processing separately from the web heads. [...] Secondly, separating the image processing from a web script can provide more responsive experience to the user. This doesn't necessarily mean faster, but let's say in a multiple image upload scenario this method allows the user to do something else on the site while we process the images in the background.

He also includes a "barebones" example of how the system would work. The first Worker script makes the connection to the queue system and sends the data off for handling. The second script does most of the actual work, pulling in the image and using Imagick to create a thumbnail image. Finally he includes an example of the use of the workers in combination to send the image data for processing.

0 comments voice your opinion now!
image asynchronous processing zeromq thumbnail imagick

Link: http://valokuva.org/working-on-images-asynchronously/

NetTuts.com:
Adding Bitcoin Payment Processing to Your Website
August 19, 2013 @ 12:38:53

On NetTuts.com there's a new tutorial that shows you how to integrate an up and coming payment method into your site's flow - Bitcoin. The tutorial uses a combination of Javascript and a PHP backend and BIPS as the payment processor.

Bitcoin has definitely started to become more mainstream, and with its global reach and minimal fees, it is a payment method worth considering. In this article, we will take a look at what Bitcoin is, as well as how to start accepting them in your applications. [...] I'm not going to get into the specifics, but essentially each time a transfer of currency takes place, the money is signed with the two parties keys and then hashed, and these transactions are appended to the global log. This allows coins to be publicly traced back, and to see if the money really belongs to someone or not.

He starts off explaining what the whole bitcoin system is based on and some of the common advantages and disadvantages around it. He then gets into the actual application, creating a simple structure using the Slim microframework and a bit of HTML to make a simple payment site. The BIPS processor is used to handle the payment and the Mandrill service to send the confirmation emails. Curl requests are used to call the services, so you'll need it installed as a PHP extension to make their examples work.

0 comments voice your opinion now!
bitcoin processing payment mandrill bips tutorial

Link: http://net.tutsplus.com/tutorials/javascript-ajax/adding-bitcoin-payment-processing-to-your-website

Chris Jones:
Offline Processing in PHP with Advanced Queuing
May 17, 2013 @ 09:49:26

Chris Jones has a new post today showing you how to use Oracle and PHP together to process data offline via the Oracle Streams Advanced Queuing feature.

Offloading slow batch tasks to an external process is a common method of improving website responsiveness. One great way to initiate such background tasks in PHP is to use Oracle Streams Advanced Queuing in a producer-consumer message passing fashion. [...] The following example simulates an application user registration system where the PHP application queues each new user's street address. An external system monitoring the queue can then fetch and process that address. In real life the external system might initiate a snail-mail welcome letter, or do further, slower automated validation on the address.

He includes the SQL needed to create the database and configure the queue system as well as start it up and get it ready for requests. He shows how to push an address into the queue for processing and how to get the results once it has completed in both the SQL and from the oci_* functions in PHP.

0 comments voice your opinion now!
oracle tutorial advanced queue offline processing

Link: https://blogs.oracle.com/opal/entry/offline_processing_in_php_with

PHPMaster.com:
Practical Code Refactoring, Part 4 - Efficiency
November 01, 2012 @ 11:37:54

PHPMaster.com has posted the latest in their "Practical Code Refactoring" series , this time with a focus on efficiency and how you can refactor your code to help it perform better both in processing power and in resource use.

In part three of this series we dealt with refactoring code for extensibility and discussed logical extensibility, modular design, decoupling, and encapsulation. In this final part of the series, we discuss what the main concerns of efficiency are for your web application and how to refactor for better efficiency.

They talk about some of the things you can do about network bandwidth usage, memory inefficiencies and processing issues (over you doing more work than you need to?). These aren't code examples - every application is different when it comes to this stuff, but it gives you some good questions to ask to fill in the blanks.

0 comments voice your opinion now!
efficiency code refactor series processing resource usage


NetTuts.com:
So You Want to Accept Credit Cards Online?
June 14, 2012 @ 09:30:25

On NetTuts.com they're posted a new tutorial about using the Stripe service to accept credit cards on your site. Thanks to some handy libraries they provide, integration is a relatively simple process.

Until recently, accepting credit cards on a website was expensive and complicated. But that was before Stripe: a radically different and insanely awesome credit card processing company. Today, I'll show you how to start accepting cards in 30 minutes or less - without spending a dime.

They step you through the whole process you'll need to get the full flow set up:

  • Install an SSL Certificate (on your server)
  • Create an Account
  • Create Your Payment Form
  • Collect The Form Values
  • Request a Token
  • Create a Server-Side Script

Screenshots of the Stripe interface, HTML, Javascript and PHP code are all included - everything you need to make the simple card handling work. One of the keys to how Stripe deals with credit cards is that you provide it the card info, it gives you a token. Your app uses this to work with the card instead of storing the card information in your database (also making it more secure).

0 comments voice your opinion now!
creditcard stripe tutorial processing javascript html php library


PHPMaster.com:
Server-Side HTML Handling Using phpQuery
June 12, 2012 @ 10:58:26

PHPMaster.com has a new tutorial today showing how you can use phpQuery to work with HTML in your application. phpQuery is a server-side CSS-selector-driven based on jQuery's API.

Think about how you can change and manipulate the generated HTML using server-side PHP code. phpQuery is the ultimate solution that will come to your mind. If you haven't heard about phpQuery, you may be interested in this article since I am going to give you a brief introduction to phpQuery and explain how you can use it in real-world projects.

The tutorial shows you how to generate a simple table with alternating row colors (zebra) and column headers from an array of product information. They also talk a bit about why using something server-side like this is important (over something client-side like jQuery) - how it can make things easier by keeping the "business logic" all in one place, leaving your frontend to do what it does best.

0 comments voice your opinion now!
tutorial phpquery backend html processing


James Cohen's Blog:
Poor Man's Parallelization for Batch Processing Jobs
May 18, 2011 @ 11:56:31

James Cohen has a quick post about what he calls a "poor man's parallelization" for working with batch jobs. It takes in parameters that tell it which set of jobs to run through when looping.

One common problem that I've seen time and time again with batch processing jobs (generally cronjobs) is that when they're written they run quickly. Over time their workload grows until eventually it's unacceptably slow. [...] To create a simple of way of separating the jobs in a consistent way we can use the modulus operator. It just calculates the remainder of two numbers. It's a common arithmetic operator in almost all languages so this technique is pretty portable.

His proof-of-concept script takes in two parameters, the starting job number and the number to increment. His example is user IDs, but this type of script could be used for anything with an ID number. The script is then run from the command line with the parameters of your choosing.

0 comments voice your opinion now!
batch processing separation modulus


David Müller's Blog:
Parallel processing in PHP
March 31, 2011 @ 13:41:37

In a recent post to his blog David Müller has taken a look at parallel processing in PHP using a few different methods - system calls, fork, and curl.

Since PHP does not offer native threads, we have to get creative to do parallel processing. I will introduce 3 fundamentally different concepts to emulate multithreading as good as possible.

For each of the technologies mentioned above, he provides a simple bit of sample code that does simple tasks like echoing out strings and writing to files. He also includes some benchmarks (take them with a grain of salt) of the three different methods showing how many iterations they could run through in ten seconds. He includes the benchmarking script if you'd like to try it out yourself.

0 comments voice your opinion now!
parallel processing tutorial system fork curl benchmark


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 6 & 7
September 15, 2010 @ 08:16:53

Kevin Schroeder has posted excerpts from the sixth and seventh chapters from his "You Want To Do WHAT With PHP?" book.

Chapter 6 focuses on asynchronous processing and the excerpt talks about doing it with a little big of encryption on the side.

In the excerpt from Chapter 7 he looks at a more structured way to access files rather than just the random fopen or file_get_contents. There's a code example in this one showing how to get the header information off of a file for things like file type, last modified time, a header checksum and the file's permissions.

0 comments voice your opinion now!
book excerpt asynchronous processing file access


IBM developerWorks:
Efficient mathematical processing using Scilab through PHP
March 22, 2010 @ 11:55:56

New on the IBM developerWorks, there's an article looking at using the Scilab software integrated into PHP to perform some more complicated mathematical processing.

Scripting languages like Ruby, Python, and PHP power modern-day server-side Web development. These languages are great because you can easily and rapidly build Web sites. However, their downfall is their inefficiency with complicated algorithms, such as those found in mathematics and the sciences. [...] In this article, we'll investigate one particular way to merge the power of a particular bit of scientific software - Scilab - with the ease of development and Web-friendliness of a server-side language: PHP.

Your script uses the Scilab tool from the command line, called via something like exec, and parsing the output to spit the results back out to the viewer. They show how to create two pages with form elements for allowing the user to interact with the script and one that helps you generate a graph based on some results.

0 comments voice your opinion now!
scilab mathematical processing tutorial



Community Events











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


security install language composer hhvm code symfony2 opinion release podcast package application component unittest hack facebook example framework overview introduction

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