A Brief Introduction to Multi-Threading in PHP
- Foreword
- Execution
- Sharing
- Synchronization
- Pitfalls
<?php | |
namespace MFB\Behat\Subcontext; | |
use Behat\Gherkin\Node\PyStringNode; | |
use Behat\MinkExtension\Context\RawMinkContext; | |
use Symfony\Component\Console\Tester\CommandTester; | |
use Symfony\Component\EventDispatcher\EventDispatcher; | |
/** |
#!/usr/bin/env bash | |
# finds all sprint tags (like @sprint:42) and runs them in a reversed order (won't run not tagged scenarios) | |
PARALLEL_COMMAND='parallel --gnu' | |
#PARALLEL_COMMAND='xargs -I{}' | |
BEHAT_COMMAND='./bin/behat --ansi --tags={}' | |
grep '@sprint:' features/*.feature | sed -e 's/.*\(@sprint:[0-9]*\).*/\1/' | sort -ur | $PARALLEL_COMMAND $BEHAT_COMMAND |
#include <stdio.h> | |
int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; } | |
int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; } | |
int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; } | |
int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; } | |
int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; } | |
int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; } | |
int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; } | |
int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; } |
// ==UserScript== | |
// @name Adds Labels on Github Pull Request | |
// @namespace http://fabien.potencier.org | |
// @include https://github.com/*/*/pulls* | |
// @version 2 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// ==/UserScript== | |
$(function() { | |
$(".pulls-list .list-group-item h4").each(function() { | |
var pull_request = this; |
Uncle Bob 11 May 2014 Craftsmanship Frameworks are powerful tools. We'd be lost without them. But there's a cost to using them.
The relationship between a programmer and a framework is similar to the relationship between an executive and an administrative assistant. The framework takes care of all the necessary details, so that the executive can focus on high level decisions.
Think of Rails, or Spring, or JSF, or Hibernate. Think about what writing a web system would be like without these frameworks to help you. The idea is disheartening. There'd be so many little piddling details to deal with. It'd be like endeavoring to construct a mnemonic memory circuit using stone knives and bearskins[1].
And so we gleefully use those glittering frameworks. We joyously intermingle our code with the frameworks' in anticipation of all the benefits they promise. We make the mistake that so many executives have made before us. We marry our secretary.
use Symfony\CS\FixerInterface; | |
use Symfony\CS\Tokens; | |
class ShortArraySyntaxFixer implements FixerInterface | |
{ | |
public function fix(\SplFileInfo $file, $content) | |
{ | |
$tokens = Tokens::fromCode($content); | |
for ($index = 0, $c = $tokens->count(); $index < $c; $index++) { |
kubectl create -f test.yaml | |
#secret "postgres-files-secret" created | |
#statefulset "postgres-statefulset" created | |
kubectl exec -it postgres-statefulset-0 /bin/sh | |
ls -lah /var/lib/postgresql/ | |
# total 12 | |
# drwxr-xr-x 3 root root 4.0K May 19 16:02 . | |
# drwxr-xr-x 3 root root 4.0K May 19 16:02 .. |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |