<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>{{ skargor.blog }}</title>
	<atom:link href="http://skargor.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://skargor.com</link>
	<description></description>
	<lastBuildDate>Wed, 26 May 2010 12:17:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Plan Next Again</title>
		<link>http://skargor.com/2010/05/plan-next-again/</link>
		<comments>http://skargor.com/2010/05/plan-next-again/#comments</comments>
		<pubDate>Wed, 26 May 2010 12:17:00 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/null]]></category>

		<guid isPermaLink="false">http://skargor.com/?p=41</guid>
		<description><![CDATA[1. NT on Google App Engine 2. Project with someone 3. Django + mongodb/mysql 4. so on]]></description>
			<content:encoded><![CDATA[<p>1. NT on Google App Engine<br />
2. Project with someone<br />
3. Django + mongodb/mysql<br />
4. so on</p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/05/plan-next-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python, Django, MongoDB</title>
		<link>http://skargor.com/2010/03/python-django-mongodb/</link>
		<comments>http://skargor.com/2010/03/python-django-mongodb/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 15:32:53 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://skargor.com/?p=37</guid>
		<description><![CDATA[最近在看 Python + Django , 因为想取代现在 NTRpg 的结构, 并且容易以后继续开发. 目前大多数的框架都支持 SQL 数据库, 但是在和 zeg 讨论之后, 他说他正在给 NGA 寻找 NoSQL 的数据库来方便索引搜索等. 首先我们定位到了日本 mixi 在使用的 Tokyo 系列, 不过 zeg 测试下来后, 似乎速度不错, 但是索引不行. 于是又找到了 MongoDB. 随后谈到用什么语言来架构, 因为 NGA 用的是 PHP, 并且 zeg 比较熟悉, 所以他建议使用 PHP 来开发. 可惜的是, 我是一个热血冲动,喜欢新鲜刺激玩意儿的人, 最近在比较了 PHP, Django, RoR 之后, 觉得 Django 就是我想要的那个东西(我也不知道是什么东西, 就是看到之后热血澎湃)! 于是乎, [...]]]></description>
			<content:encoded><![CDATA[<p>最近在看 Python + Django , 因为想取代现在 <a href="http://www.ntrpg.org">NTRpg</a> 的结构, 并且容易以后继续开发. 目前大多数的框架都支持 SQL 数据库, 但是在和 zeg 讨论之后, 他说他正在给 <a href="http://www.ngacn.cc">NGA</a> 寻找 NoSQL 的数据库来方便索引搜索等. </p>
<p>首先我们定位到了日本 <a href="http://mixi.jp">mixi</a> 在使用的 <a href="http://1978th.net/">Tokyo 系列</a>, 不过 zeg 测试下来后, 似乎速度不错, 但是索引不行. 于是又找到了 <a href="http://www.mongodb.org">MongoDB</a>.</p>
<p>随后谈到用什么语言来架构, 因为 NGA 用的是 PHP, 并且 zeg 比较熟悉, 所以他建议使用 PHP 来开发. 可惜的是, 我是一个热血冲动,喜欢新鲜刺激玩意儿的人, 最近在比较了 PHP, Django, RoR 之后, 觉得 Django 就是我想要的那个东西(我也不知道是什么东西, 就是看到之后热血澎湃)! 于是乎, 目前还没决定用什么来开发.</p>
<p>在做这个决定的过程中, 我找到了 <a href="http://github.com/hmarr/mongoengine">mongoengine</a> , 可以在 Django 中连接  MongoDB 并且有一套自己的 API . 作者用 mongoengine 开发了一个 Blog &#8211; <a href="http://github.com/hmarr/django-mumblr">Mumblr</a> , 并且提供了下载, 个人觉得挺不错. </p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/03/python-django-mongodb/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Simple Notes</title>
		<link>http://skargor.com/2010/03/ruby-on-rails-simple-notes/</link>
		<comments>http://skargor.com/2010/03/ruby-on-rails-simple-notes/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 04:35:25 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=33</guid>
		<description><![CDATA[to increment a string like &#8217;14T0001&#8242; or even simple string &#8217;2&#8242;, fast way is &#8216;succ&#8217;! irb(main):001:0&#62; u = '14T0001' =&#62; &#34;14T0001&#34; irb(main):002:0&#62; u.succ! =&#62; &#34;14T0002&#34; irb(main):003:0&#62; puts u 14T0002 =&#62; nil irb(main):04:0&#62; puts u 14T0002 =&#62; nil]]></description>
			<content:encoded><![CDATA[<p>to increment a string like &#8217;14T0001&#8242; or even simple string &#8217;2&#8242;, fast way is &#8216;succ&#8217;!</p>
<pre class="brush: ruby;">irb(main):001:0&gt; u = '14T0001'
=&gt; &quot;14T0001&quot;
irb(main):002:0&gt; u.succ!
=&gt; &quot;14T0002&quot;
irb(main):003:0&gt; puts u
14T0002
=&gt; nil
irb(main):04:0&gt; puts u
14T0002
=&gt; nil</pre>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/03/ruby-on-rails-simple-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first Redmine Plugin &#8211; Clients</title>
		<link>http://skargor.com/2010/03/first-redmine-plugin-staffs/</link>
		<comments>http://skargor.com/2010/03/first-redmine-plugin-staffs/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 07:01:22 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=27</guid>
		<description><![CDATA[For each project, they can have some clients who are not members. And reporter can select one of them as client (issue requester/issue contact/others) in each issue. Made this for my company internal usage. We have lots of customers who belongs to different suburbs/projects. Supporter will get lots of issues everyday, they need know as [...]]]></description>
			<content:encoded><![CDATA[<p>For each project, they can have some clients who are not members. And reporter can select one of them as client (issue requester/issue contact/others) in each issue.</p>
<p>Made this for my company internal usage. We have lots of customers who belongs to different suburbs/projects. Supporter will get lots of issues everyday, they need know as soon as issue is solved, who they should contact for.</p>
<p>You can download from <a href="http://github.com/skargor/redmine-clients-plugin">Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/03/first-redmine-plugin-staffs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim snipMate set two snippets for one file type</title>
		<link>http://skargor.com/2010/03/vim-snipmate-set-two-snippets/</link>
		<comments>http://skargor.com/2010/03/vim-snipmate-set-two-snippets/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 13:05:58 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[snipMate]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=25</guid>
		<description><![CDATA[找了一个 django 的 snippet, 发现每次打开 .py 文件只加载 python.snippets, 而不会加载 django.snippets, 需要在 ~/.vimrc 内设置下 filetype indent plugin on &#34; auto load django/python snip autocmd FileType python set ft=python.django autocmd FileType html set ft=html.django_template]]></description>
			<content:encoded><![CDATA[<p>找了一个 django 的 <a href="http://github.com/robhudson/snipmate_for_django">snippet</a>, 发现每次打开 .py 文件只加载 python.snippets, 而不会加载 django.snippets, 需要在 ~/.vimrc 内设置下</p>
<pre class="brush: plain;">filetype indent plugin on

&quot; auto load django/python snip
autocmd FileType python set ft=python.django
autocmd FileType html set ft=html.django_template</pre>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/03/vim-snipmate-set-two-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Reset Notes</title>
		<link>http://skargor.com/2010/02/css-reset-notes/</link>
		<comments>http://skargor.com/2010/02/css-reset-notes/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 13:27:22 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=22</guid>
		<description><![CDATA[備份下 html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, [...]]]></description>
			<content:encoded><![CDATA[<p>備份下</p>
<pre class="brush: css;">html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing=&quot;0&quot;' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}</pre>
<p>via <a href="http://meyerweb.com/eric/tools/css/reset/index.html">http://meyerweb.com/eric/tools/css/reset/index.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/02/css-reset-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails &#8211; update records without timestamping</title>
		<link>http://skargor.com/2010/02/ror-update-records-without-timestamping/</link>
		<comments>http://skargor.com/2010/02/ror-update-records-without-timestamping/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 12:00:06 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Timestamp]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=19</guid>
		<description><![CDATA[Ruby 裡每次更新一條 record 都會自動更新 updated_at 時間戳, 但是有時候比如只是更新點擊的時候, 并不想更新 updated_at, 就需要用到 User.record_timestamps=false 這個方法了. 但是問題是,如果用了這個方法的同時, 有人更新了 User 表內的其他一條 record, 那麼那條 record 也不會更新 updated_at. 需要單獨創建一個 instance 來使用. 把以下代碼粘貼進 environment.rb module ActiveRecord class Base def update_record_without_timestamping class &#60;&#60; self def record_timestamps; false; end end save! class &#60;&#60; self def record_timestamps; super ; end end end end end 另外一個比較好的方法是使用 remove_method [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby 裡每次更新一條 record 都會自動更新 updated_at 時間戳, 但是有時候比如只是更新點擊的時候, 并不想更新 updated_at, 就需要用到</p>
<pre class="brush: ruby;">User.record_timestamps=false</pre>
<p>這個方法了.</p>
<p>但是問題是,如果用了這個方法的同時, 有人更新了 User 表內的其他一條 record, 那麼那條 record 也不會更新 updated_at. 需要單獨創建一個 instance 來使用.<br />
把以下代碼粘貼進 environment.rb</p>
<pre class="brush: ruby;">module ActiveRecord
  class Base

    def update_record_without_timestamping
      class &lt;&lt; self
        def record_timestamps; false; end
      end

      save!

      class &lt;&lt; self
        def record_timestamps; super ; end
      end
    end

  end
end</pre>
<p>另外一個比較好的方法是使用 remove_method 方法</p>
<pre class="brush: ruby;">module ActiveRecord
  class Base

    def update_record_without_timestamping
      class &lt;&lt; self
        def record_timestamps; false; end
      end

      save!

      class &lt;&lt; self
        remove_method :record_timestamps
      end
    end

  end
end</pre>
<p>這樣, 使用 update_record_without_timestamping 更新 record 的時候就不會更新 updated_at 了.<br />
via <a href="http://neeraj.name/blog/articles/800-override-automatic-timestamp-in-activerecrod-rails">nerraj</a></p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/02/ror-update-records-without-timestamping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Simple Digital Captcha</title>
		<link>http://skargor.com/2010/02/php-simple-digital-captcha/</link>
		<comments>http://skargor.com/2010/02/php-simple-digital-captcha/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 22:41:36 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[Captcha]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=17</guid>
		<description><![CDATA[Captcha.php文件: &#60;?php session_start(); Header(&#34;Content-type: image/PNG&#34;); $im = imagecreate(44,18); //captcha size $back = ImageColorAllocate($im, 245,245,245); imagefill($im,0,0,$back); //background color srand((double)microtime()*1000000); //genereate 4 digital numbers for($i=0;$i&#60;4;$i++){ $font = ImageColorAllocate($im, rand(100,255),rand(0,100),rand(100,255)); $authnum=rand(1,9); $vcodes.=$authnum; imagestring($im, 5, 2+$i*10, 1, $authnum, $font); } for($i=0;$i&#60;100;$i++) { //make it hard to read $randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255)); imagesetpixel($im, rand()%70, rand()%30, $randcolor); } ImagePNG($im); ImageDestroy($im); $_SESSION['vcode'] = [...]]]></description>
			<content:encoded><![CDATA[<p>Captcha.php文件:</p>
<pre class="brush: php;">&lt;?php
session_start();
Header(&quot;Content-type: image/PNG&quot;);
$im = imagecreate(44,18); //captcha size
$back = ImageColorAllocate($im, 245,245,245);
imagefill($im,0,0,$back); //background color

srand((double)microtime()*1000000);
//genereate 4 digital numbers
for($i=0;$i&lt;4;$i++){
	$font = ImageColorAllocate($im, rand(100,255),rand(0,100),rand(100,255));
	$authnum=rand(1,9);
	$vcodes.=$authnum;
	imagestring($im, 5, 2+$i*10, 1, $authnum, $font);
}

for($i=0;$i&lt;100;$i++) { //make it hard to read
	$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
	imagesetpixel($im, rand()%70, rand()%30, $randcolor);
}

ImagePNG($im);
ImageDestroy($im);
$_SESSION['vcode'] = $vcodes;
?&gt;</pre>
<p>調用</p>
<pre class="brush: xml;">&lt;img src=&quot;captcha.php&quot; align=&quot;absmiddle&quot;/&gt;&lt;input type=&quot;text&quot; name=&quot;f_Code&quot; maxlength=&quot;4&quot; style=&quot;width:40px;margin-left:5px;&quot;&gt;</pre>
<p>驗證</p>
<pre class="brush: php;">$_SESSION['vcode'] == $_POST['f_Code']</pre>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/02/php-simple-digital-captcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac 下 NTFS 的讀取</title>
		<link>http://skargor.com/2010/01/mac-read-write-ntfs-filesystem/</link>
		<comments>http://skargor.com/2010/01/mac-read-write-ntfs-filesystem/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 11:21:08 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/app]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[NTFS]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=15</guid>
		<description><![CDATA[NTFS-3G 安裝完成,重啟之後變能支持 NTFS 的寫操作了]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.macupdate.com/info.php/id/24481/ntfs-3g">NTFS-3G</a></p>
<p>安裝完成,重啟之後變能支持 NTFS 的寫操作了</p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/01/mac-read-write-ntfs-filesystem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Query on Special Order</title>
		<link>http://skargor.com/2010/01/sql-query-on-special-order/</link>
		<comments>http://skargor.com/2010/01/sql-query-on-special-order/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 08:26:41 +0000</pubDate>
		<dc:creator>Skargor</dc:creator>
				<category><![CDATA[/nerd/code]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://nerdma.com/?p=13</guid>
		<description><![CDATA[SELECT suburb_id, suburb_name FROM suburbs ORDER BY (case suburb_name when 'Sydney' then 0 when 'Melbourne' then 1 else 2 end), suburb_name This will put the Sydney as the first result, Melbourne as the second result, and all others suburbs ordered by suburb_name, from A-Z]]></description>
			<content:encoded><![CDATA[<pre class="brush: sql;">SELECT suburb_id, suburb_name
FROM suburbs
ORDER BY
(case suburb_name
when 'Sydney' then 0
when 'Melbourne' then 1
else 2
end), suburb_name</pre>
<p>This will put the Sydney as the first result, Melbourne as the second result, and all others suburbs ordered by suburb_name, from A-Z</p>
]]></content:encoded>
			<wfw:commentRss>http://skargor.com/2010/01/sql-query-on-special-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
