- 整体
- 这些依赖是必须的,以RHEL/CentOS举例
yum install automake libtool flex bison pkgconfig gcc-c++ libevent-devel
<?php | |
error_reporting(E_ALL); | |
$m = new Mongo("mongodb://127.0.0.1:27017"); | |
$db = $m->selectDB("test"); | |
$coll = $db->selectCollection("foo"); |
<?php | |
function cropImage ($image, $width, $height, $x, $y) { | |
list($w, $h) = getimagesize($image); | |
$nw = (($width + $x) >= $w) ? $w - $x : $width; | |
$nh = (($height + $y) >= $h) ? $h - $y : $height; | |
// var_dump($nw); | |
// var_dump($nh); |
var a = function (i) { | |
console.log(i) | |
setTimeout(a(++i), 1000); // wrong, the 1st parameters should be a function but passed a function calling by mistaken. | |
} |
var a = function (i) { | |
console.log(i) | |
setTimeout(function () { | |
a(++i); | |
}, 1000); // now correct | |
} |
import errno | |
import functools | |
import socket | |
from tornado import ioloop, iostream | |
def connection_ready(sock, fd, events): | |
while True: | |
try: | |
connection, address = sock.accept() | |
except socket.error, e: |
--- /usr/src/linux/drivers/scsi/lpfc/lpfc_scsi.c 2012-05-21 06:29:13.000000000 +0800 | |
+++ lpfc_scsi.c 2012-08-31 21:12:33.619966584 +0800 | |
@@ -1897,7 +1897,6 @@ | |
dma_addr_t physaddr; | |
int i = 0, num_bde = 0, status; | |
int datadir = sc->sc_data_direction; | |
- uint32_t rc; | |
uint32_t checking = 1; | |
uint32_t reftag; | |
unsigned blksize; |
#!/bin/bash | |
DIR="${HOME}/images/screenshots" | |
DATE="$(date +%Y%m%d-%H%M%S)" | |
NAME="${DIR}/screenshot-${DATE}.png" | |
LOG="${DIR}/screenshots.log" | |
# Check if the dir to store the screenshots exists, else create it: | |
if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}"; fi |
<?php | |
error_reporting(E_ALL); | |
$root_path = dirname(__FILE__); | |
$lib_path = $root_path . "/lib/"; | |
include_once($lib_path . 'PelJpeg.php'); | |
include_once($lib_path . 'PelTag.php'); | |
include_once($lib_path . 'PelIfd.php'); |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib | |
import urllib2 | |
data = urllib2.urlencode({'foo': 'bar'}) | |
r = urllib2.Request('https://www.google.com', # url | |
data, # post data |