[cc lang="javascript"]
$('td[class^="input_"]').removeClass(function (index, class) {
var matches = class.match (/spf_c\d+/g) || [];
return (matches.join (' '));
});
[/cc]
Tuesday, May 3, 2011
Tuesday, April 26, 2011
Yii CJSON
[cc lang="php"] $this->layout=false;
header('Content-type: application/json');
echo CJSON::encode(array('id'=>$project->id, 'content'=>$project->content, 'pass_way'=>$project->pass_way, 'total'=>$count, 'bs'=>$project->multiple
));
Yii::app()->end(); [/cc]
header('Content-type: application/json');
echo CJSON::encode(array('id'=>$project->id, 'content'=>$project->content, 'pass_way'=>$project->pass_way, 'total'=>$count, 'bs'=>$project->multiple
));
Yii::app()->end(); [/cc]
Thursday, April 21, 2011
IntelliJ IDEA在Linux下很卡的问题解决
idea.vmoptions 文件加入
[cc lang="text"]-Dsun.java2d.pmoffscreen=false[/cc]
[cc lang="text"]-Dsun.java2d.pmoffscreen=false[/cc]
Wednesday, April 20, 2011
console-kit-daemon 删除
[cc lang="text"]apt-get purge consolekit[/cc]
Sunday, April 3, 2011
Socket.io with XMPP
[cc lang="javascript"]var server = require("http").createServer();
var socket = require("socket.io").listen(server);
var xmpp = require("node-xmpp");
socket.on("connection", function(connection) {
var client = new xmpp.Client({jid: "charlvn@jabber.co.za", password: ""});
client.on("online", function() {
client.send(new xmpp.Element("presence", {type: "chat"}));
connection.on("message", function(message) {
client.send(new xmpp.Element("message", {to: "charlvn@charlvn.com", type: "chat"}).c("body").t(message));
});
connection.on("disconnect", function() {
client.end();
});
});
client.on("stanza", function(stanza) {
if (stanza.is("message")) {
var b = stanza.getChildren("body");
if (b[0]) connection.send(b[0].getText());
}
});
});
server.listen(8080);[/cc]
[cc lang="html"]
XMPP
[/cc]
var socket = require("socket.io").listen(server);
var xmpp = require("node-xmpp");
socket.on("connection", function(connection) {
var client = new xmpp.Client({jid: "charlvn@jabber.co.za", password: ""});
client.on("online", function() {
client.send(new xmpp.Element("presence", {type: "chat"}));
connection.on("message", function(message) {
client.send(new xmpp.Element("message", {to: "charlvn@charlvn.com", type: "chat"}).c("body").t(message));
});
connection.on("disconnect", function() {
client.end();
});
});
client.on("stanza", function(stanza) {
if (stanza.is("message")) {
var b = stanza.getChildren("body");
if (b[0]) connection.send(b[0].getText());
}
});
});
server.listen(8080);[/cc]
[cc lang="html"]
[/cc]
Thursday, March 31, 2011
PHP pcntl_fork
[cc lang="php"]
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
echo "download files ...\n";
$cmd = "/usr/bin/wget --user-agent=\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;)\" \\
--header=\"Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\" \\
--header=\"Accept-Language: en-us,en;q=0.5\" \\
--header=\"Accept-Encoding: gzip,deflate\" \\
--header=\"Accept-Charset: GBK,utf-8;q=0.7,*;q=0.7\" \\
--header=\"Keep-Alive: 300\" -O /dev/null -i list.txt -o wget.log";
exec($cmd);
echo "done\n";
declare(ticks = 1);
pcntl_signal(SIGUSR1, function ($signal) {
echo 'HANDLE SIGNAL ' . $signal . PHP_EOL;
});
posix_kill(posix_getpid(), SIGUSR1);
die();
}
[/cc]
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
echo "download files ...\n";
$cmd = "/usr/bin/wget --user-agent=\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;)\" \\
--header=\"Accept:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\" \\
--header=\"Accept-Language: en-us,en;q=0.5\" \\
--header=\"Accept-Encoding: gzip,deflate\" \\
--header=\"Accept-Charset: GBK,utf-8;q=0.7,*;q=0.7\" \\
--header=\"Keep-Alive: 300\" -O /dev/null -i list.txt -o wget.log";
exec($cmd);
echo "done\n";
declare(ticks = 1);
pcntl_signal(SIGUSR1, function ($signal) {
echo 'HANDLE SIGNAL ' . $signal . PHP_EOL;
});
posix_kill(posix_getpid(), SIGUSR1);
die();
}
[/cc]
Monday, March 14, 2011
编译V8遇到libstdc++问题解决方法
sudo ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so
Subscribe to:
Posts (Atom)