新灵空间

I will go wherever god leads me to!

Random notes on coding

1. 关于在css中使用control flow.

 #container{
            <% IF need_sample %>
            width: 800px;
            <% ELSE %>
            width: 500px;
            <% END %>
 }

2.  对于Perl里的DBI模块, 有以下的routine:

$dbh - DBI->connect();
die("Failed to connect to the DB\n") unless $dbh;
$query = "select ....";
$sth = $dbh->prepare($query);
$sth->execute();
while (my ($mid) = $sth->fetchrow_array()) {
  $cl{$mid}++;
}
$sth->finish();

 

vim 中移动到特定的tab

gt            go to next tab
gT            go to previous tab
{i}gt         go to tab in position i

MongoDB & Python

看Perl代码严重上自尊了。为了抚慰下受伤的心灵, 就来学习下Python & MongoDB. 

1. MongoDB does not support joins.

2. MongoDB does not support transactions. It does have some support for atomicoperations, however.

3. MongoDB schemas are flexible. Not all documents in a collection must adhere to the same schema.

4.  MongoDB is a document-oriented database.

5. The comparison between mongodb and the usual sql.

暂时先写到这里,现在回去继续看Perl还有Dancer。

启动emacs时框口最大化

在emacs的配置文件中加入以下的代码, 可以让emacs在打开的时候最大化:

(custom-set-variables
 '(initial-frame-alist (quote ((fullscreen . maximized)))))