A Brief Introduction to Multi-Threading in PHP
- Foreword
- Execution
- Sharing
- Synchronization
- Pitfalls
| package main | |
| import ( | |
| "runtime/pprof" | |
| "fmt" | |
| "net/http" | |
| "os" | |
| "time" | |
| ) |
| git fetch --all | |
| git reset --hard origin/master | |
| git pull origin master |
| /** | |
| * Get an polygon postgis object casted to a string and transform to an instance of | |
| * google.maps.polygon | |
| * @author Pedro Tanaka <pedro.stanaka@gmail.com> | |
| * @param {String} polygonStr String from the PostGis function TS_geometryToText(...) | |
| * @returns {Array} An array with the LatLng's to be put in the polygon | |
| */ | |
| function postgisPolygonToJsonArray(polygonStr){ | |
| polygonStr = polygonStr.replace('POLYGON((', ''); |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| var p1 = { | |
| x: 20, | |
| y: 20 | |
| }; | |
| var p2 = { | |
| x: 40, | |
| y: 40 | |
| }; |
| var http = require('http'), | |
| fileSystem = require('fs'), | |
| path = require('path') | |
| util = require('util'); | |
| http.createServer(function(request, response) { | |
| var filePath = 'path_to_file.mp3'; | |
| var stat = fileSystem.statSync(filePath); | |
| response.writeHead(200, { |