see also http://www.zeromq.org/bindings:php
wget http://www.zeromq.org/local--files/area:download/zeromq-2.0.9.tar.gz
tar zxf zeromq-2.0.9.tar.gz
cd zeromq-2.0.9
./configure
make && make install
cd ..
<?php | |
/* | |
mysqliでコネクションを確認しつつ接続しなおすサンプル | |
*/ | |
$mysqli = mysqli_init(); | |
$mysqli->options(MYSQLI_INIT_COMMAND,"set names utf8"); | |
$host = "localhost"; | |
$user = "user"; | |
$pass = ""; | |
$db_name = "moe"; |
<?php | |
/** | |
* Text_PatternMatch | |
* ================= | |
* テキストを適当にマッチング。 | |
* | |
* Licence: MIT License | |
* Author : chobie ( http://twitter.com/chobi_e ) | |
* Created_at: 2010-05-18 | |
* |
<?php | |
declare(encoding='utf8'); | |
namespace Tsunami; | |
$app = new Application(array( | |
"/"=>function($request){ | |
echo "Hello World"; | |
} | |
) | |
); |
see also http://www.zeromq.org/bindings:php
wget http://www.zeromq.org/local--files/area:download/zeromq-2.0.9.tar.gz
tar zxf zeromq-2.0.9.tar.gz
cd zeromq-2.0.9
./configure
make && make install
cd ..
<?php | |
//simple http proxy connection sample | |
$proxy = "proxy.example.com"; | |
$port = 8080; | |
$url = "https://example.com/"; | |
$host = parse_url($url); | |
$fp = fsockopen("tcp://" . $proxy, $port); | |
$request = "GET $url HTTP/1.1\r\n"; | |
$request .= "Host: {$host['host']}\r\n"; | |
$request .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"; |
app.config | |
templating: | |
path: | |
- "%kernel.root_dir%/../views/%%bundle%%/%%controller%%/%%name%%%%format%%.%%renderer%%" | |
- "%kernel.root_dir%/../src/Symfony/Bundle/%%bundle%%/Resources/views/%%controller%%/%%name%%%%format%%.%%renderer%%" |
//for dyndns manage page | |
javascript:(function(){var s=document.createElement('script');s.charset='UTF-8';s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';document.body.appendChild(s);})(); | |
javascript:(function(){ | |
cell = $("table[width=100%] td"); | |
result = ""; | |
for(var i in cell){ | |
td = $(cell[i]); | |
if(td.children("input[type=text]").length){ |
101015 15:23:10 104 Connect root@localhost on moemoe | |
104 Query CREATE TABLE addresses (id INT AUTO_INCREMENT NOT NULL, street VARCHAR(255) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB | |
104 Query CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, address_id INT DEFAULT NULL, name VARCHAR(50) NOT NULL, UNIQUE INDEX users_address_id_uniq (address_id), PRIMARY KEY(id)) ENGINE = InnoDB | |
104 Query ALTER TABLE users ADD FOREIGN KEY (address_id) REFERENCES addresses(id) | |
104 Quit | |
101015 15:23:12 105 Connect root@localhost on moemoe | |
105 Query START TRANSACTION | |
105 Query INSERT INTO users (name, address_id) VALUES ('Guilherme', NULL) | |
105 Query INSERT INTO users (name, address_id) VALUES ('Guilherme', NULL) | |
105 Query INSERT INTO users (name, address_id) VALUES ('Guilherme', NULL) |
<?php | |
// 本番環境ではやらないでね! | |
$mysqli = mysqli_init(); | |
$mysqli->real_connect("localhost","user_name","password","db_name"); | |
if($error = mysqli_connect_error()){ | |
throw new RuntimeException($error); | |
} | |
$mysqli->set_charset("utf8"); |
//今見ているページのURLを含んだツイートがあれば表示する | |
//from http://blog.asial.co.jp/659 | |
function myfunc(json) { | |
var box = $('body'); | |
$(json.results).each(function(i, v) { | |
v.jp_created_at = dateJp(v.created_at); | |
var html = template('<div class="twit">\ | |
<blockquote class="commentOne">\ | |
<p class="commentText">#{text}</p><p class="twitDate">#{jp_created_at}<\/p>\ | |
<span class="arrow" \/>\ |