Skip to content

Instantly share code, notes, and snippets.

View igorgolovanov's full-sized avatar

Igor Golovanov igorgolovanov

View GitHub Profile

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@igorgolovanov
igorgolovanov / introrx.md
Created January 2, 2017 15:04 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

Quick install PHP 7.0 (phpng):

1. Install depends PHP 7.0 (phpng)
$ brew install autoconf automake bison27 gd freetype t1lib mariadb gettext zlib mcrypt
Add support for Bison 3.x

curl -L https://github.com/php/php-src/pull/685.diff | patch -p1

@igorgolovanov
igorgolovanov / README.md
Last active August 29, 2015 14:12 — forked from denji/readme-php7.md
Quick install PHP 7.0 (phpng) - OS X

Quick install PHP 7.0 (phpng):

1. Install depends PHP 7.0 (phpng)
$ brew install autoconf automake bison27 gd freetype t1lib mariadb gettext zlib mcrypt
Add support for Bison 3.x

curl -L https://github.com/php/php-src/pull/685.diff | patch -p1

#!/bin/bash
# This should be a path that the user executing the script can read and write
PHP_PATH=/opt/php-ts
# This should be a sensible version of PHP
PHP_VERSION=5.4.11
# This should be a sensible mirror for your location
PHP_MIRROR=uk1.php.net
# This should be a released version of pthreads
PHP_PTHREADS=0.0.42
# This should be set to 0 if you do not want to remove build directories

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls

Easy pthreads Pools

The final solution !!

Since the first version of pthreads, PHP has had the ability to initialize Worker threads for users. Onto those Worker threads are stacked objects of class Stackable for execution concurrently.

The objects stacked onto workers do not have their reference counts changed, pthreads forces the user to maintain the reference counts in userland, for the extremely good reason that this enables the programmer to keep control of memory usage; and so, execute indefinitely.

This is the cause of much heartache for newcomers to pthreads; if you do not maintain references properly you will, definitely, experience segmentation faults.

Installation

This procedure is tested on Mac OS X 10.8 with Developpers tools installed (xCode).

PHP 5.4 installed with Homebrew.

Update: I wrote a blog post about this.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):