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]

Thursday, April 21, 2011

IntelliJ IDEA在Linux下很卡的问题解决

idea.vmoptions 文件加入
[cc lang="text"]-Dsun.java2d.pmoffscreen=false[/cc]

Wednesday, April 20, 2011

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]