读赵烔博士的 Linux 0.11 内核完全注释, 受益良多,总想在 Linux 0.11 搭建一个开发环境,这样可以按自己的想法修改内核代码并编译了。抱着这个想法,今天在 VMWare 上实践了一回。现将操作过程记录于下,一来做个备忘,二来若对有此想法的人稍有帮助,则甚欣慰矣! 1. 获取 gcclib-1.40.taz 2. 通过 VMWare 创建一个软盘映像文件 fd.flp 3. 在 VMWare Ubuntu 的虚拟机上添加一个软驱设备,并指定此映像文件 fd.flp 4. 启动 Ubuntu (注意启动之前要设置其 BIOS 从硬盘启动优先), 用如下命令低格此映像文件: 5. 格式化,建立 ms-dos 文件系统 6. 挂接软盘到 /mnt/floppy 7. 将 gcclib-1.40.taz 存入软盘映像文件 8. 执行实际的写入操作 9. 在 VMWare linux0.11 的虚拟机上添加一个软驱设备,并指定刚创建的 fd.flp 为映像文件 10.启动 linux0.11, 将软盘映像里的文件拷贝到 /usr/root 下 11.解压 gcclib-1.40.taz, 并拷贝到合适位置 12.测试你的 gcc
fdformat /dev/fd0
mkfs.msdos /dev/fd0
mount -t vfat /dev/fd0 /mnt/floppy
cp gcclib-1.40.taz /mnt/floppy
umount /mnt/floppy
mcopy B:\* /usr/root
tar xzvf gcclib-1.40.taz
cd /usr/root/gcclib-1.40
cp -r /usr/root/gcclib-1.40/include /usr
cd /usr/root/gcclib-1.40/local
cp -r * /usr/local
gcc -o hello hello.c
./hello
2008年3月25日 星期二
在 VMWare linux 0.11 上搭建 gcc 1.4 开发环境
2008年3月24日 星期一
AJAX in Rails with Authenticity Token
这是一篇很重要的转载文章。
如何从Rails框架中全部去掉Authenticity Token 功能:
注释掉Application Controller中的protect_from_forgery语句。
When you use active_record_store instead of the cookie-based default, you need to uncomment the line in controllers/application.rb that says protect_from_forgery :secret => ‘blah’. This makes sure all your HTML and JavaScript requests are coming from your web application. It essentially protects you from something called “Cross-site request forgery” by embedding a token into your web forms.
As a side note, it’s really not giving you much security at all, but that might be better left for another blog post.
I was banging my head against the wall yesterday trying to figure out why a custom Ajax.Updater wasn’t working and I kept getting an ActionController::InvalidAuthenticityToken exception. I decided to dig into the request_forgery_protection.rb file in actionpack-*/lib/action_controller and found that for custom requests, you need to include the authenticity_token yourself by taking advantage of the form_authenticity_token helper. When building the updater’s request url I just added “&authenticity_token=<%= form_authenticity_token %>” to the end and everything was fine.
Another way would be to not use the forgery protection at all for that action by including this in your controller: protect_from_forgery :except => :updater
You can also completely remove forgery protection from a controller by doing skip_before_filter :verify_authenticity_token
Back to the vulnerability of your web forms: I imagine this does protect your web application from someone hosting a form on their site that posts to your site. However, if someone really wants to spam some stuff they’ll scrape your page with cookies enabled on their scraping software, scrape your form’s fields (which include the authenticity_token hidden field) and POST to their heart’s desire.
2008年1月25日 星期五
IE和Firefox处理透明效果的CSS
td.pop_topleft {
background-image: url('../img/pop_dialog_top_left.png')!important;
background-image: none;
filter: none!important;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://static.xiaonei.com/img/pop_dialog_top_left.png', sizingMethod='crop');
}
td.pop_topright {
background-image: url('../img/pop_dialog_top_right.png')!important;
background-image: none;
filter: none!important;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://static.xiaonei.com/img/pop_dialog_top_right.png', sizingMethod='crop');
}
2007年12月2日 星期日
Discuz!稳定性
有个很哲理的话:复杂的系统,稳定性必然下降。Discuz!的插件制作人员参差不齐。很容易导致Web服务死掉。
而且通常毛病出在频繁的读取数据库,导致连接数过大。
最近woodk总是访问不上,也不是特别清楚具体的原因。
从昨天装上Google Analytics开始分析数据量,并且查看系统错误日志。
大体定位在RSS在升级的时候出现错误,还有就是PLUGIN的问题。
刚才关了论坛的RSS功能。先看看是不是不会无缘无故死了。
另外,发现APM-Server这个东西太复杂了。可能APM-Express的稳定性更加高,再挂就换APM-Express了。坚信简单即稳定。
2007年11月28日 星期三
How to write a Copyright?
关于版权声明的写法
格式应该是:Copyright [dates] by [author/owner]© 通常可以代替Copyright, 但是不可以用(c)。 All Rights Reserved 在某些国家曾经是必须的,
参见下面几个正确的格式:
©1995-2004 Macromedia, Inc. All rights reserved.
©2004 Microsoft Corporation. All rights reserved.
Copyright © 2004 Adobe Systems Incorporated. All rights reserved.
©1995-2004 Eric A. and Kathryn S. Meyer. All Rights Reserved.
InfoQ.com 及其所有内容,版权所有© 2006-2007 C4Media Inc. InfoQ.com 服务器由 Contegix 提供,我们最信赖的 ISP 合作伙伴。 隐私政策
现在流行some rights reserved:creativecommons.org some rights reserved 和copyright 本身并不矛盾,但是其中的界限更多是一个道德问题,真正的保留一部分权力,是指给浏览者fair use 的权利,fair use的界定也决不是随便乱用,或者抄袭。 甚至说,除了copyright, 还有copyleft,它的定义是为了程序员开发能够共享源代码的一个方式,英文里free, 并不仅仅是免费。 而且这种的源码公开免费使用,和版权也一点都不冲突。请大家不要误解。 对于从网上下载素材,如音乐,图片等版权问题, 有朋友问这个问题,答案很简单,所有的这些都有版权问题。和这些作品的大小格式没有关系。 这也是为什么经典论坛不讨论下载的原因,包含字体,同时经典网站也希望其他的网站能尊重本站作者的版权。 版权是互相的,因为每个人都在随时的拥有着你所刚刚创造的作品的版权,哪怕你的涂鸦之作已经被丢进垃圾桶,供TsIVA络.08严格意义上,那也不可以被人抄袭的。不然公司就不需要碎纸机了。 只有彼此的尊重,互相的尊重才能有真正意义上的共享,简单的拿来主义,或者因为我是经典的用户,所以别人就必须要尊重经典的版权,而我不必尊重别人的版权,是不会形成好的版权保护意识的 版权其实并不意味着付费,和商业化也没有直接的关联。很多时候,你如果真想使用版权保护的内容,只要发封邮件,询问一下许可就可以, 大多数的情形下,个人用户是很喜欢甚至欣赏这样的礼貌和尊重的。