<?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>犊犊的小棚棚</title>
	<atom:link href="http://www.jlao.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jlao.net</link>
	<description>La vie de bokeh… ambigue mais jolie</description>
	<lastBuildDate>Thu, 03 May 2012 18:58:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Sudoku Solution &#8211; Project Euler #96</title>
		<link>http://www.jlao.net/technology/612</link>
		<comments>http://www.jlao.net/technology/612#comments</comments>
		<pubDate>Thu, 03 May 2012 17:16:23 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[技术相关]]></category>
		<category><![CDATA[Project Euler]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sudoku]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=612</guid>
		<description><![CDATA[This is a Python solution for Project Euler #96, to find the solution for sudokus. The speed is modest (0.750s with pypy on Windows 7 @ i5 2.60GHz), but the code is relatively short and hopefully the idea is clear. Enjoy. 1. Find candidates for all items. If only one exists for a blank, fill [...]]]></description>
			<content:encoded><![CDATA[<p>This is a Python solution for <a href="http://projecteuler.net/problem=96" title="Project Euler #96" target="_blank">Project Euler #96</a>, to find the solution for sudokus.</p>
<p>The speed is modest (0.750s with pypy on Windows 7 @ i5 2.60GHz), but the code is relatively short and hopefully the idea is clear. Enjoy.<br />
1. Find candidates for all items. If only one exists for a blank, fill it in.<br />
2. Note down the blank with least but more than one candidates.<br />
3. Copy the matrix and trial the candidates recursively until all blanks are filled.<br />
<span id="more-612"></span></p>
<pre class="brush: python; collapse: false; title: ; wrap-lines: true; notranslate">
def solve(mat):
    tcan = [] # list of candidates
    i = 0
    mmin = immin = jmmin = 10  # item with least &gt; 1 candidates
    while (i &lt; 9):
        j = 0
        while (j &lt; 9):
            if mat[i][j] == 0:
                t = list(set(range(1,10))- set(mat[i/3*3][j/3*3:j/3*3+3] + mat[i/3*3+1][j/3*3:j/3*3+3] + mat[i/3*3+2][j/3*3:j/3*3+3] + mat[i] + [mat[a][j] for a in range(9)]))
                if t == []: # can't find a candidate
                    return False
                if len(t) == 1:
                    if immin == i and jmmin == j: # replacing current least
                        mmin = immin = jmmin = 10
                    mat[i][j] = t[0]
                    i = -1
                    break
                if len(t) &lt; mmin: # saving shortest candidate list
                    tcan, mmin, immin, jmmin = t, len(t), i, j
            j += 1
        i += 1
    if mmin == 10:
        return mat
    else:
        for test in tcan:
            mtest=[r[:] for r in mat] # copy without reference
            mtest[immin][jmmin] = test
            mtry = solve(mtest)
            if not mtry == False:
                return mtry
    return False

a = file('96.txt','r').readlines()
mt = []
count = 0
for x in a:
    if x[0] == 'G':
        mt = []
        print x
    else:
        mt.append (map(int, list(x)[0:9]))
        if len(mt)==9:
            m = solve(mt)
            for r in m:
                print r
            i = int(''.join(map(str,m[0][0:3])))
            count += i
print count
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/technology/612/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>宫怨</title>
		<link>http://www.jlao.net/misc/610</link>
		<comments>http://www.jlao.net/misc/610#comments</comments>
		<pubDate>Sat, 03 Mar 2012 04:19:33 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[杂然赋流形]]></category>
		<category><![CDATA[诗]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=610</guid>
		<description><![CDATA[常居深里负春光 灯冷窗明夜未央 滴漏声枯催人老 何年再斗画眉长]]></description>
			<content:encoded><![CDATA[<p>常居深里负春光<br />
灯冷窗明夜未央<br />
滴漏声枯催人老<br />
何年再斗画眉长</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/misc/610/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>早春一首</title>
		<link>http://www.jlao.net/misc/603</link>
		<comments>http://www.jlao.net/misc/603#comments</comments>
		<pubDate>Wed, 29 Feb 2012 03:46:01 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[杂然赋流形]]></category>
		<category><![CDATA[早春 诗]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=603</guid>
		<description><![CDATA[应水源古典诗词板早春诗会活动 长天漠漠冬已深 雪尽冰留雨又频 幼草依稀时现影 轻风料峭总撩人 前年去雁应归里 旧日蛰虫或醒身 待到山花齐放处 谁谈曾历苦寒辛]]></description>
			<content:encoded><![CDATA[<p>应水源古典诗词板早春诗会活动</p>
<p>长天漠漠冬已深<br />
雪尽冰留雨又频<br />
幼草依稀时现影<br />
轻风料峭总撩人<br />
前年去雁应归里<br />
旧日蛰虫或醒身<br />
待到山花齐放处<br />
谁谈曾历苦寒辛</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/misc/603/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>迎</title>
		<link>http://www.jlao.net/piggy/598</link>
		<comments>http://www.jlao.net/piggy/598#comments</comments>
		<pubDate>Sun, 05 Feb 2012 05:04:57 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[犊犊画猪猪]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=598</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jlao.net/wp-content/uploads/2012/02/Newborn.png"><img src="http://www.jlao.net/wp-content/uploads/2012/02/Newborn.png" alt="" title="Newborn" width="600" height="424" class="alignnone size-full wp-image-599" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/piggy/598/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Christmas Eve</title>
		<link>http://www.jlao.net/piggy/589</link>
		<comments>http://www.jlao.net/piggy/589#comments</comments>
		<pubDate>Sun, 25 Dec 2011 05:19:56 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[犊犊画猪猪]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=589</guid>
		<description><![CDATA[时间真是飞快，又是一年圣诞夜 大家圣诞快乐～]]></description>
			<content:encoded><![CDATA[<p>时间真是飞快，又是一年圣诞夜<br />
大家圣诞快乐～<br />
<a href="http://www.jlao.net/wp-content/uploads/2011/12/XmasEve.png"><img src="http://www.jlao.net/wp-content/uploads/2011/12/XmasEve.png" alt="" title="XmasEve" width="600" height="523" class="alignnone size-full wp-image-590" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/piggy/589/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>zz学习数学要是碰到不明白的怎么办</title>
		<link>http://www.jlao.net/misc/577</link>
		<comments>http://www.jlao.net/misc/577#comments</comments>
		<pubDate>Thu, 26 May 2011 03:59:42 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[杂然赋流形]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=577</guid>
		<description><![CDATA[发信人: quantumboy (学术孤儿), 信区: Mathematics 标 题: Re: 大家学习数学是碰到不明白的怎么办？ 发信站: 水木社区 (Wed May 25 14:57:49 2011), 站内 while（弄不明白）{ if（中文书&#124;&#124;中文paper） 撕掉或者烧掉 else if（法国人写的尤其是布尔巴基写的） 包好压入箱底 else if（英美人写的） 换一本日本或俄国，德国写的 else if（日，俄，德写的） goto wikipedia.com else if（不想放弃） 自己写一本能明白的 else 学个编程语言去挣钱吧，别耽误工夫了 } 【 在 automorphic (阿姆鲁索) 的大作中提到: 】 : 无人可问。查书还是自己推？大家说说经验。]]></description>
			<content:encoded><![CDATA[<p>发信人: quantumboy (学术孤儿), 信区: Mathematics<br />
标  题: Re: 大家学习数学是碰到不明白的怎么办？<br />
发信站: 水木社区 (Wed May 25 14:57:49 2011), 站内</p>
<pre>
while（弄不明白）{
   if（中文书||中文paper）
      撕掉或者烧掉
   else if（法国人写的尤其是布尔巴基写的）
      包好压入箱底
   else if（英美人写的）
      换一本日本或俄国，德国写的
   else if（日，俄，德写的）
      goto wikipedia.com
   else if（不想放弃）
      自己写一本能明白的
   else
      学个编程语言去挣钱吧，别耽误工夫了
}
</pre>
<p>【 在 automorphic (阿姆鲁索) 的大作中提到: 】<br />
: 无人可问。查书还是自己推？大家说说经验。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/misc/577/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wrong type argument error in pst-node style of AUCTeX</title>
		<link>http://www.jlao.net/technology/570</link>
		<comments>http://www.jlao.net/technology/570#comments</comments>
		<pubDate>Sun, 22 May 2011 04:41:40 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[技术相关]]></category>
		<category><![CDATA[AUCTeX]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[psmatrix]]></category>
		<category><![CDATA[pst-node]]></category>
		<category><![CDATA[pstricks]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=570</guid>
		<description><![CDATA[Using AUCTeX 11.86 under Emacs 24.0.50.1. Activated pst-node style. Pressed C-c C-e to insert a psmatrix environment, entered nothing on “Options” and encountered the error: let: Wrong type argument: char-or-string-p, (“”) The “Options” can auto-complete with psmatrix options such as rowsep, colsep&#8230; Still didn&#8217;t work even if I entered something. Checked the pst-node.el under /emacs/site-lisp/auctex/style/: [...]]]></description>
			<content:encoded><![CDATA[<p>Using AUCTeX 11.86 under Emacs 24.0.50.1. Activated pst-node style. Pressed C-c C-e to insert a psmatrix environment, entered nothing on “Options” and encountered the error:<br />
<i>let: Wrong type argument: char-or-string-p, (“”)</i></p>
<p>The “Options” can auto-complete with psmatrix options such as <code>rowsep</code>, <code>colsep</code>&#8230; Still didn&#8217;t work even if I entered something. Checked the pst-node.el under /emacs/site-lisp/auctex/style/:</p>
<pre class="brush: plain; title: ; notranslate">
;;; Environments
(defun LaTeX-pstnode-env-psmatrix (env)
  &quot;Return psmatrix environment with arguments.&quot;
  (let ((opt (completing-read-multiple &quot;Options: &quot;
                                       LaTeX-pstnode-psmatrix-list)))
    (LaTeX-insert-environment env opt)))
</pre>
<p><code>completing-read-multiple</code> comes from crm.el, which enables the multiple auto completion. The return value is a list instead of a string, so <code>LaTeX-insert-environment</code> won&#8217;t accept it. Fixed the code as follows to loop over the list and insert the option items with comma and square brackets. It doesn&#8217;t look neat but it works anyway.</p>
<pre class="brush: plain; title: ; notranslate">
;;; Environments
;;; Changed by James Lao
(defun LaTeX-pstnode-env-psmatrix (env)
  &quot;Return psmatrix environment with arguments.&quot;
  (let ((opt (completing-read-multiple &quot;Options: &quot;
                                       LaTeX-pstnode-psmatrix-list)))
    (setq opto &quot;&quot;)
    (while opt
      (if (string= opto &quot;&quot;)
	  (setq opto (car opt))
      (setq opto (concat opto &quot;, &quot; (car opt))))
      (setq opt (cdr opt)))
    (LaTeX-insert-environment env (concat &quot;[&quot; opto &quot;]&quot;))))
</pre>
<p>I&#8217;ve never used the mailing list and would appreciate if someone could help me check with the development team&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/technology/570/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>preview-latex在GS9.00下报错</title>
		<link>http://www.jlao.net/technology/566</link>
		<comments>http://www.jlao.net/technology/566#comments</comments>
		<pubDate>Sat, 14 May 2011 07:24:02 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[技术相关]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=566</guid>
		<description><![CDATA[在emacs下其实很久不用preview-latex了，一直觉得没有必要——但是忽然用一下的时候发现不能用还是很郁闷的。基本上报错是这样的： "GSWIN32C.EXE" "-dOutputFile=(_region_.prv/tmp5723kvc/pr1-1.png)" "-q""-dSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4""-dGraphicsAlphaBits=4" "-sDEVICE=png16m" "-r70.4906x70.6156" GS>{DELAYSAFER{.setsafe}if}stopped pop/.preview-BPcurrentpagedevice/BeginPage get dup null eq{pop{pop}bind}ifdefsetpagedevice/preview-do{[count 3 roll save]3 1 roll dup length 0 eq{pop}{setpagedevice}{ifelse .runandhide}stopped{handleerror quit}if aload pop restore}bind def[(_region_.prv/tmp3712kvc/preview.dsc)(r)file]aload exch dup 0 setfileposition 520()/SubFileDecode filter cvx .runandhide aload pop dup dup 623 setfileposition 50()/SubFileDecode filter cvxpreview-do Error: /invalidfileaccess in --file-- 查了一通后来发现有人遇到这个问题之后把GS降级到8.71以下就好了。说明GS在近来做了一些改动。左看右看看到了-dSAFER这个参数——这个参数本意是要加强权限检查防止gs自动打开系统文件权限——但和权限相关的也只有它了。试着在命令行下重新跑着两个命令（用gswin32会容易些，否则后面这个长命令贴都贴不进去），居然跑通了。又大致查了查，貌似可能是一个BUG，不过我升级到了最新的9.02也没有解决这个问题。 既然如此，到site-lisp/auctex/preview.elc（最好还是用.el重新编译一下） 下面找到 [...]]]></description>
			<content:encoded><![CDATA[<p>在emacs下其实很久不用preview-latex了，一直觉得没有必要——但是忽然用一下的时候发现不能用还是很郁闷的。基本上报错是这样的：</p>
<p><code>"GSWIN32C.EXE" "-dOutputFile=(_region_.prv/tmp5723kvc/pr1-1.png)" "-q""-dSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4""-dGraphicsAlphaBits=4" "-sDEVICE=png16m" "-r70.4906x70.6156"<br />
GS>{DELAYSAFER{.setsafe}if}stopped pop/.preview-BPcurrentpagedevice/BeginPage get dup null eq{pop{pop}bind}ifdef<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1get 1 ne or{.preview-BP }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{[count 3 roll save]3 1 roll dup length 0 eq{pop}{setpagedevice}{ifelse .runandhide}stopped{handleerror quit}if aload pop restore}bind def[(_region_.prv/tmp3712kvc/preview.dsc)(r)file]aload exch dup 0 setfileposition 520()/SubFileDecode filter cvx .runandhide aload pop dup dup 623 setfileposition 50()/SubFileDecode filter cvx<<>>preview-do<br />
Error: /invalidfileaccess in --file--</code></p>
<p>查了一通后来发现有人遇到这个问题之后把GS降级到8.71以下就好了。说明GS在近来做了一些改动。左看右看看到了-dSAFER这个参数——这个参数本意是要加强权限检查防止gs自动打开系统文件权限——但和权限相关的也只有它了。试着在命令行下重新跑着两个命令（用gswin32会容易些，否则后面这个长命令贴都贴不进去），居然跑通了。又大致查了查，貌似可能是一个<a href="http://www.mail-archive.com/debian-printing@lists.debian.org/msg00928.html">BUG</a>，不过我升级到了最新的9.02也没有解决这个问题。</p>
<p>既然如此，到site-lisp/auctex/preview.elc（最好还是用.el重新编译一下） 下面找到<br />
<code>(defcustom preview-gs-options '("-q" "-dSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4")</code><br />
把dSAFER一项干掉就是了。虽然这似乎是一个“漏洞”，不过就自己跑跑preview来看，应该没太大风险。</p>
<p>一个更为稳妥的办法是在.emacs里面加上   &#8216;(preview-gs-options (quote (“-q” “-dNOPAUSE” “-DNOPLATFONTS” “-dPrinted” “-dTextAlphaBits=4&#8243; “-dGraphicsAlphaBits=4&#8243;)))，就好了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/technology/566/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>At the library</title>
		<link>http://www.jlao.net/piggy/553</link>
		<comments>http://www.jlao.net/piggy/553#comments</comments>
		<pubDate>Tue, 05 Apr 2011 01:17:11 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[犊犊画猪猪]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=553</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jlao.net/wp-content/uploads/2011/04/library1.jpg"><img src="http://www.jlao.net/wp-content/uploads/2011/04/library1.jpg" alt="" title="library" width="600" height="424" class="alignnone size-full wp-image-558" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/piggy/553/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>拉马丁小清新</title>
		<link>http://www.jlao.net/translation/541</link>
		<comments>http://www.jlao.net/translation/541#comments</comments>
		<pubDate>Tue, 22 Mar 2011 05:33:06 +0000</pubDate>
		<dc:creator>犊犊</dc:creator>
				<category><![CDATA[译事余笔]]></category>

		<guid isPermaLink="false">http://www.jlao.net/?p=541</guid>
		<description><![CDATA[拉马丁同学似乎写了很多以VERS SUR UN ALBUM之类题目的小诗，不得不佩服人家真能写，出口成章，逮哪儿写哪儿，然后就送人了——也许还自己抄个备份，否则我们现在没准就看不到了。其中有一首是这么写的 VERS SUR UN ALBUM Sur cette page blanche où mes vers vont éclore, Qu&#8217;un regard quelquefois ramène votre coeur ! De votre vie aussi la page est blanche encore; Que ne puis-je y graver un seul mot : Le bonheur ! 诗集上的题诗 此页白纸上 / 将绽放我诗篇 愿偶然一瞥 / 能唤回你心田 你的生活也 / 还是白纸一笺 [...]]]></description>
			<content:encoded><![CDATA[<p>拉马丁同学似乎写了很多以VERS SUR UN ALBUM之类题目的小诗，不得不佩服人家真能写，出口成章，逮哪儿写哪儿，然后就送人了——也许还自己抄个备份，否则我们现在没准就看不到了。其中有一首是这么写的</p>
<blockquote><p>VERS SUR UN ALBUM<br />
Sur cette page blanche où mes vers vont éclore,<br />
Qu&#8217;un regard quelquefois ramène votre coeur !<br />
De votre vie aussi la page est blanche encore;<br />
Que ne puis-je y graver un seul mot : Le bonheur !</p></blockquote>
<p><span id="more-541"></span></p>
<blockquote><p>诗集上的题诗<br />
此页白纸上 / 将绽放我诗篇<br />
愿偶然一瞥 / 能唤回你心田<br />
你的生活也 / 还是白纸一笺<br />
恨不能只印 / 幸福二字其间</p></blockquote>
<p>那个&#8230; 这种小清新笔法简直让我回到了看汪国真的中学时代&#8230; 装一回嫩吧，如果有同学看完了有不适感觉请自行处理本人概不负责&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jlao.net/translation/541/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

