A Brief Introduction to Multi-Threading in PHP
- Foreword
- Execution
- Sharing
- Synchronization
- Pitfalls
CREATE TABLE adressen.land | |
( | |
isocode_2 character(2) not null, -- ISO 3166 ALPHA-2 | |
isocode_3 character(3) not null, -- ISO 3166 ALPHA-3 | |
name character varying not null, -- deutscher Name des Landes (international besser via ISO-Code ankoppeln!) // German name of the country | |
vorwahl integer default null, -- internationale Vorwahl // international phone code | |
null_bei_vorwahl boolean default FALSE, -- muss man die Null der Ortsvorwahl auch nach der internationalen Vorwahl wählen? // must one dial zero between international and local phone code? | |
vorwahl_lokal boolean default FALSE, -- muss man vor Ort die Vorwahl wählen? // must one dial the local phone code also locally? | |
tld character varying default NULL, -- Top Level Domain | |
kfz character varying default NULL, -- KFZ-Kennzeichen // car code |
<?php | |
/** | |
* Convert a comma separated file into an associated array. | |
* The first row should contain the array keys. | |
* | |
* Example: | |
* | |
* @param string $filename Path to the CSV file | |
* @param string $delimiter The separator used in the file | |
* @return array |
using System; | |
namespace Epoch | |
{ | |
public class Epoch | |
{ | |
static readonly DateTime epochStart = new DateTime(1970, 1, 1, 0, 0, 0); | |
static readonly DateTimeOffset epochDateTimeOffset = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; |
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
<?php | |
namespace Vondra; | |
class GitBranchPanel implements \Nette\Diagnostics\IBarPanel | |
{ | |
public function getPanel() | |
{ | |
return ''; |
<?php | |
namespace ApiModule; | |
use Api\Authenticator, | |
Model\Rest, | |
Model\Action, | |
Mishak\Application\Response\JsonResponse, | |
Nette, | |
Nette\Application\UI\Presenter, |
On GitHub I provide example or Cooperative Multitasking components on a single site served by Nette Framework. These components need to process several network requests to render themselves, which is normally slow.
This example takes advantage of yield operator (available since PHP 5.5) to switch between tasks, Flow as scheduler and Rect as parallel http client.
This post introduces the Flow framework and cooperative multitasking in general.