tag:blogger.com,1999:blog-1788159129867337222024-02-18T22:50:38.671-08:00Fedora已死(理想主义的光辉瞬间湮灭)-To be continuedFedora笔记, BIOS笔记, 还有一些牢骚Unknownnoreply@blogger.comBlogger163125tag:blogger.com,1999:blog-178815912986733722.post-62543001919460294662011-02-22T02:52:00.000-08:002011-02-22T02:55:28.982-08:00An article about Named function expressionsIn English: <a href="http://kangax.github.com/nfe/">http://kangax.github.com/nfe/</a><br />In Chinese: <a href="http://www.cn-cuckoo.com/main/wp-content/uploads/2009/12/named-function-expressions-demystified.html#introduction">http://www.cn-cuckoo.com/main/wp-content/uploads/2009/12/named-function-expressions-demystified.html#introduction</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-31128287356269241512010-12-13T19:45:00.000-08:002010-12-13T21:48:09.676-08:00main.c:99: error: ‘LangParser_decl_return’ undeclared (first use in this function)Page in ANTLR3C API : http://antlr.org/api/C/index.html<br /><br />Something must be changed to fit your project:<br /><br />1. All variables containing /.*Lang.*/, change "Lang" to "JavaScript" or your language which your grammar described. (I wrote a JavaScript.g file to describe JavaScript Language Grammar.)<br /><br />2. Change "LangParser_decl_return" to "JavaScriptParser_program_return", where "JavaScript" is what I said ablow, and where "program" is the first token you define below the "option" token, in Grammar file (JavaScript.g).<br />ps: You may want to change all "decl" to "program", because "decl" only in file "ANTLR_Examples.zip/C/treeparser/Lang.g"Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-9397621012378512522010-10-14T04:38:00.001-07:002010-10-14T04:38:05.636-07:00Bash: checking if a variable is a number<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>[code]</div><div># v=1</div># [ $v -eq $v ]<div># echo $?</div><div>0</div></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div> # v=a</div># [ $v -eq $v ]<div># echo $?</div><div>2</div></div><div>[/code]</div><div><br></div><div>Note: "-eq" compares number, but not string.</div><div><br></div><div>Ref:<a href="http://snippets.dzone.com/posts/show/3143">http://snippets.dzone.com/posts/show/3143</a></div> <meta http-equiv="content-type" content="text/html; charset=utf-8"> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-65262662019705802372010-10-01T08:09:00.001-07:002010-10-01T08:09:09.704-07:00Your Linux distribution isn't supported yet. Currently only Gnome and KDE based distributions are supported.Using Chromium to 翻墙(Scale Great Firewall) with Switchy is realy realy realy a bad expirencing.<div>Switch to Autoproxy2pac: <a href="https://autoproxy2pac.appspot.com/">https://autoproxy2pac.appspot.com/</a></div><div>Only give a argument "--proxy-pac-url=<a href="http://autoproxy2pac.appspot.com/pac/ssh-d">http://autoproxy2pac.appspot.com/pac/ssh-d</a>" when running Chromium.</div> <div><br></div><div>Ref: <a href="https://autoproxy2pac.appspot.com/">https://autoproxy2pac.appspot.com/</a></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-10225906019529346422010-09-29T19:04:00.001-07:002010-09-29T19:04:54.047-07:00ossim agent loses file handle on log files after rotationbug<br> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-56768634851936902272010-09-16T00:45:00.001-07:002010-09-16T00:45:41.244-07:00Windows 7下IE8即使导入了https证书仍然显示“证书错误”<b>现象:</b><br>Windows XP系统下,使用IE6/IE7/IE8,登录Web管理系统的时候提示证书错误,然后导入证书(自动选择证书存储区),重启IE(或者重启OS),再次登录Web管理系统,则没有提示证书错误。<br>Windows 7系统下,使用IE8,登录Web管理系统的时候提示证书不被信任,然后导入证书,重启IE(自动选择证书存储区),再次登录Web管理系统,地址栏里面仍然显示"证书错误"。<br>在证书管理器中比较这两个OS下的https证书存储区发现是不同的。<br> <br><b>解决:</b><br>Windows 7系统下,使用IE8导入证书的时候请选择存储区为"受信任的根证书办法机构",否则自动选择的存储区。 Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-61185361809314598202010-09-12T19:17:00.001-07:002010-09-12T19:17:40.592-07:00IE gives warning when redirect from HTTPS to HTTPIf you use header() method provided by PHP, to redirect from HTTPS to HTTP,<br>IE will give out a warning, but if you use the code below above othe PHP code, no warning will show.<br>// =========================================================<br> <span style="font-family: courier new,monospace;"><?php </span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">if($_SERVER['HTTPS'] == "on") {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> $redirect = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> echo "<meta http-equiv=\"refresh\" content=\"0; url=$redirect\">";</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> exit();</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">?></span><br>// ==========================================================<br clear="all"> The tag "<meta>" will refresh the web page and jump/redirect to another web page.<br><br>-- <br>from my gmail<br> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-83943839465323430222010-09-12T18:58:00.001-07:002010-09-12T18:58:14.790-07:00Redirect from HTTP to HTTPS in Apache with ".htaccess"1. Redirect all files in a directory<br>Add these contents into the ".htaccess" file under your directory.<br>##################<br><span style="font-family: courier new,monospace;">RewriteEngine On</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;">RewriteCond %{HTTPS} !on</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}</span><br> ##################<br>Then:<br>"<b>http</b>://domain/dir/a.php" will redirect into "<b>https</b>://domain/dir/a.php",<br> "<b>http</b>://domain/dir/b.php" will redirect into "<b>https</b>://domain/dir/b.php",<br> "<b>http</b>://domain/dir/c.php" will redirect into "<b>https</b>://domain/dir/c.php".<br><br>2. Redirect a single file in a directory<br>Add these contents into the ".htaccess" file under the directory containing your file.<br> ##################<br><span style="font-family: courier new,monospace;"><FilesMatch "^login\.php$"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> RewriteEngine On</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"> RewriteCond %{HTTPS} !on</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}</span><br style="font-family: courier new,monospace;"> <span style="font-family: courier new,monospace;"></FilesMatch></span><br>##################<br>Then:<br>"<b>http</b>://domain/dir/login.php" will redirect into "<b>https</b>://domain/dir/login.php"<br> "<b>http</b>://domain/dir/other_files.php" will not redirect.<br> <br>--<br>from my gmail<br> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-50405834665589085972010-09-09T09:56:00.001-07:002010-09-09T09:56:30.322-07:00[test] Write blog with html email<font size="6">This</font> <u style="background-color: rgb(255, 255, 51);">is</u> <i>a</i> <b style="color: rgb(255, 0, 0);">HTML</b> <span style="font-family: courier new,monospace;">Email</span>.<br>[IMG src="defined"]<img title="xin_128.png" alt="xin_128.png" src="cid:ii_12af7681f943c21e">[/IMG]<br> [IMG src="gmail_smile"]<img goomoji="360" style="margin: 0pt 0.2ex; vertical-align: middle;" src="cid:360@goomoji.gmail">[/IMG]<br><ol><li>abc</li><li>abc</li><li>abc</li></ol><ul><li>abc</li><li>abc</li><li>abc</li> </ul>Indent off<br><div style="margin-left: 40px;">Indent on<br></div>Indent off<br>abc normal<br> <div style="text-align: center;">abc center<br></div> abc normal<br> <div style="text-align: right;">abc right<br></div> abc normal<br> abc <a href="http://www.google.com">link</a><br> <br> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-5603612290224206502010-04-22T23:19:00.000-07:002010-04-22T23:31:51.211-07:00Change from opensvn.csie.org to code.google.com1. Create a new project in google code.<br />2. Reset the Subversion repository to revision 0.<br />Find the "Reset Subversion Repository" link at the bottom of the "Source" tab.<br />3. Sync between two svn host. Init first, then sync.<br /><code class="prettyprint">$ svnsync init https://xiaomao101.googlecode.com/svn/ https://opensvn.csie.org/xiaomao101/ --username ant101tna<br />Authentication realm: <https: 443=""> Google Code Subversion Repository<br />Password for 'ant101tna':<br />Copied properties for revision 0.<br />$ svnsync sync https://xiaomao101.googlecode.com/svn/ --username ant101tna<br />Transmitting file data .<br />Committed revision 1.<br />Copied properties for revision 1.<br />Committed revision 2.<br />Copied properties for revision 2.<br />Transmitting file data ...</https:></code><br /><br />Ref:<br />(1) Importing Subversion Repositories to Google Code<br />http://therightstuff.de/CommentView,guid,b984a8e7-e94d-4eed-a705-5dc479f959e8.aspx<br />(2) 將 Subversion Repository 搬進 Google Code 裡面<br />http://fourdollars.blogspot.com/2009/08/subversion-repository-google-code.htmlUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-14180837261930322412010-04-22T21:00:00.000-07:002010-04-22T22:25:15.109-07:00How to dump svn from Free SVN Host1. Download rsvndump<br /><code class="prettyprint">$ wget [from sourceforge.net]</code><br />2. Install rsvndump<br /><code class="prettyprint">$ ./configure<br />(If getting error, install the missing package, some times like libsvn-dev or libapr1-dev, just some dev package)<br />$ make<br />$ make install</code><br />3. Dump the web to local dump file.<br /><code class="prettyprint">$ rsvndump https://opensvn.csie.org/xiaomao101/ > csie_xiaomao101.dumpfile</code><br />4. Create a new repository and load the dump file to it.<br /><code class="prettyprint">$ svnadmin create new_repo_dir<br />$ svnadmin load new_repo_dir <>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-57067666542510911762010-04-21T23:09:00.000-07:002010-04-21T23:20:31.419-07:00Install Eclipse with Android Development Tools (ADT) plugin in Ubuntu1. Install Eclipse main program<br /><pre>$ sudo apt-get install eclipse</pre><br /><br />2. Setup plugin source of Eclipse<br />Note: Ubuntu default Eclipse installation with no source in [Menu->Help->Install New Software]<br />(1) Add Eclipse source:<br /><pre>Name: Eclipse - galileo<br />Location: http://download.eclipse.org/releases/galileo</pre><br />(2) Add Android source:<br /><pre>Name: Android Development Tools (ADT)<br />Location: https://dl-ssl.google.com/android/eclipse/</pre><br /><br />3. Install ADT<br />...<br /><br />Ref:<br />(1) 3. Install the ADT Plugin for Eclipse<br />http://developer.android.com/sdk/index.html<br />(2) requires 'org.eclipse.gef 0.0.0' but it could not be found<br />https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/482244Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-11420156824996336512010-04-20T09:09:00.001-07:002010-04-21T20:23:17.178-07:00No man page for libc function 'fprintf'# sudo apt-get install manpages-dev<br /><br />ref:https://lists.ubuntu.com/archives/ubuntu-users/2009-May/182747.htmlUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-79028728721733959972010-04-08T10:34:00.001-07:002010-04-08T10:34:26.566-07:00testtest<br> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-89755898988455084622010-04-08T02:17:00.000-07:002010-04-08T02:29:34.768-07:00中国大陆快递EMS查询中“未妥投”是什么意思<div>例子:</div><div>小明快递单号EF877417418CS</div><div>在EMS官网查询快递情况如下:</div><div>[quote]</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>您的邮件于 2010-04-08 16:00:00(沈阳市)未投递成功</div><div>未妥投原因:其它,收件人不在,今日再投 <span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>处 理 时 间 <span class="Apple-tab-span" style="white-space:pre"> </span>处 理 地 点 <span class="Apple-tab-span" style="white-space:pre"> </span>邮 件 状 态</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-07 12:43:00 <span class="Apple-tab-span" style="white-space:pre"> </span>北京市大运村邮电所 <span class="Apple-tab-span" style="white-space:pre"> </span>收寄</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-07 13:12:00 <span class="Apple-tab-span" style="white-space:pre"> </span>北京市大运村邮电所 <span class="Apple-tab-span" style="white-space:pre"> </span>离开收寄局</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-07 17:45:00 <span class="Apple-tab-span" style="white-space:pre"> </span>北京市 <span class="Apple-tab-span" style="white-space:pre"> </span>到达处理中心,来自北京市大运村邮电所</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-07 18:11:00 <span class="Apple-tab-span" style="white-space:pre"> </span>北京市 <span class="Apple-tab-span" style="white-space:pre"> </span>离开处理中心,发往沈阳市</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-08 14:27:31 <span class="Apple-tab-span" style="white-space:pre"> </span>沈阳市 <span class="Apple-tab-span" style="white-space:pre"> </span>到达处理中心,来自北京市</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-08 14:48:40 <span class="Apple-tab-span" style="white-space:pre"> </span>沈阳市 <span class="Apple-tab-span" style="white-space:pre"> </span>安排投递</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>2010-04-08 16:00:00 <span class="Apple-tab-span" style="white-space:pre"> </span>沈阳市 <span class="Apple-tab-span" style="white-space:pre"> </span>未妥投</div><div>[/quote]</div><div>最近的数据表明“未妥投”,那么到底包裹送到了没有呢?</div><div>情形1:收件人不在,改日再投。</div><div>情形2:收件人在,可是投递员发现已近下班时间,可以改日再投,故将状态改为“未妥投”。</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-15879575917149492842010-04-05T21:29:00.001-07:002010-04-05T21:29:33.430-07:00How to change UUID of vdi file (VirtualBox)$ VBoxManage internalcommands setvdiuuid ubuntu.vdi <br />VirtualBox Command Line Management Interface Version 3.0.8_OSE<br />(C) 2005-2009 Sun Microsystems, Inc.<br />All rights reserved.<br /><br />UUID changed to: 3c390a56-56b4-4d55-9771-2f7f625f1797Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-32206884441253295982010-03-28T19:41:00.001-07:002010-03-28T19:41:28.248-07:00Relocatable RPM .spec question> But I have a %post containing "%{_bindir}/foo" that isn't getting <br />> relocated properly.<br />> Its still looking for /usr/bin/foo instead of /home/ellson/usr/bin/foo.<br />> <br />> I tried "%{prefix}/bin/foo" but it still resolves to /usr/bin/foo<br /><br />All %{...} macros are evaluated at RPM build time, so this won't work.<br /><br />> Is there a variable set by the --prefix option that I can use in %post ?<br /><br />Yes, environment variables. Using $RPM_INSTALL_PREFIX0 for the (first)<br />prefix should work.<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-53950732772481472752010-03-24T02:16:00.001-07:002010-03-24T02:16:46.984-07:00Title of Sidewiki<div xmlns='http://www.w3.org/1999/xhtml'><p>Content of Sidewiki<br/>post in my blog.</p>in reference to: <a href='http://www.rpm.org/max-rpm/s1-rpm-reloc-prefix-tag.html'>The prefix tag: Relocation Central</a> (<a href='http://www.google.com/sidewiki/entry/109092603170422464464/id/FQpGu35Q5X8bOPGO5K0-wVuaP8s'>view on Google Sidewiki</a>)</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-60029438120252839772010-03-15T23:00:00.001-07:002010-03-15T23:00:29.352-07:00How to quick switch between console and vim# touch test.txt<br /># vim test.txt<br />// Input some words in the VIM editor.<br />// Ctrl+Z to bring the VIM Editor to backround.<br />// And now you come to the console again.<br /># ls<br />> test.txt<br />// Now, you finish your work in console.<br />// "fg" command brings your VIM Editor to the front again.<br /># fg<br />// At last, you are in VIM Editor.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-23499497936246588602010-03-07T20:23:00.001-08:002010-04-21T23:34:17.733-07:00Change Ubuntu Window Manager from Metacity to Enlightment (E)All the information about this transition are here:<br />http://packages.enlightenment.org/<br /><br />Problem may be met:<br />1. Network manager<br />In Gnome, default network manager's package is "nm-applet". But under E, it is not be started by default.<br />So you can start it in terminal by hand, or you can change to a E network manager called "emodual-exalt" (short for "exalt").<br />Just "apt-get install" it.<br /><br />Enjoy E.<br /><br />Ref:<br />http://packages.enlightenment.org/<br />http://e17-stuff.org/content/show.php/Exalt?content=62069<br />http://forum.enlightenment.org/comments.php?DiscussionID=44Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-17617267649148193922010-03-05T01:27:00.001-08:002010-03-05T01:27:20.029-08:00[PHP] Failed in setlocale()===========<br />setlocale(LC_ALL, "zh_CN");<br />===========<br />But failed and return FALSE.<br /><br />Try to list the locales contained in the locale archive file.<br />===============<br /># localedef --list-archive<br />===============<br /><br />If "zh_CN" is not in the list, try to add it.<br />===============<br /># localedef -f GBK -i zh_CN zh_CN<br />===============<br /><br />Ref:<br />http://bbs.php.cn/php/ref.gettext.html#43165<br />http://docs.php.net/manual/en/function.setlocale.php<br /># man localedefUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-87300892143956213522010-03-04T23:06:00.001-08:002010-03-04T23:06:49.096-08:00Set DNS server in UbuntuDNS server IP is set in "/etc/resolv.conf", but if DHCP is used, the DNS server IP recieved from DHCP server will cover the config in "/etc/resolv.conf".<br /><br />Caution: Dont define DNS server IP in "/etc/network/interfaces" like this:<br />===============<br /> # dns-* options are implemented by the resolvconf package, if installed<br /> dns-nameservers 192.168.1.1<br /> dns-search 192.168.1.1<br />===============<br />This will make you cant connect to the website using domain name, but only using IP address will connect to the website.<br /><br />Ref:<br />http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/<br />https://help.ubuntu.com/8.04/serverguide/C/network-configuration.htmlUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-38680109426340446682010-03-03T22:20:00.001-08:002010-04-21T23:26:19.468-07:00Limit download speed in apt-get# sudo vim /etc/apt/apt.conf.d/76download<br />Add lines below:<br />================<br /><br />Acquire<br />{<br />Queue-mode "access";<br />http<br />{<br />Dl-Limit "25";<br />};<br />};<br />================<br /><br />These codes will limit speed to 25KB/s, when you are in command mode or using Synaptic Package Managemer (GUI).<br /><br />Ref: http://www.associatedcontent.com/article/2717695/ubuntu_limiting_download_speed_in_synaptic.htmlUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-470420109799153012010-03-01T00:42:00.001-08:002010-04-21T23:27:51.048-07:00create a file that root cant write it.[1] If you change the permission of a file, not allow everyone to write.<br />But you will find that root can also write it, see below:<br />===============================================================================<br /># echo 1 > test<br /># chmod 444 test<br /># ls -l<br />-r--r--r-- 1 root root 2 2010-03-01 15:49 test<br /># echo 2 > test<br /># cat 2<br />2<br /><br /><br />[2] But you can use "chattr" to change the attrib of a file, not allow root to.<br />===============================================================================<br /># echo 1>1<br /># chattr +i 1<br /># echo 2>1<br />-bash: 1: Permission denied<br /># ls -l<br />total 4<br />-rw-r--r-- 1 root root 1 2010-03-01 16:12 1<br /># lsattr<br />----i------------- ./1<br /><br /><br />[3] We also find some directories of system are also set by "chattr".<br />===============================================================================<br /># lsattr /usr/ <br />------------------ /usr/X11R6<br />--------------I--- /usr/bin<br />------------------ /usr/share<br />------------------ /usr/games<br />--------------I--- /usr/lib<br />------------------ /usr/src<br />------------------ /usr/sbin<br />------------------ /usr/include<br />------------------ /usr/local<br /><br />[4] Reference:<br />===============================================================================<br /># man chattr<br />http://en.wikipedia.org/wiki/ChattrUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-178815912986733722.post-30668859340394173672010-01-27T21:06:00.001-08:002010-01-27T21:06:23.709-08:00How to get ICP image containing ICP numberHow to get a ICP (Internet Content Provider) image / logos which contains a ICP number?<br /><br />Use google image search , seaching for "icp imagesize:166x48" or "beian imagesize:166x48"Unknownnoreply@blogger.com1