懂点安全,对互联网还心存幻想的程序员…
6 Mar
上次装完后发现rails命令没法使用,一直不晓得原因,就卸载了,今天又装了一次,然后运行下rails,看到
eoe:~ IceskYsl$ rails -v
/Library/Ruby/Site/1.8/rubygems.rb:334:in `bin_path’: can’t find executable rails for rails-3.0.0.beta (Gem::Exception)
from /usr/bin/rails:19
看来还是有问题,看看都装了啥gems,如下
eoe:~ IceskYsl$ gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
actionpack (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activemodel (3.0.0.beta)
activerecord (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
activeresource (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2)
activesupport (3.0.0.beta, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
奇怪,没看到railties,看来这个没装上,我再装一次。
eoe:~ IceskYsl$ sudo gem install railties –pre
Successfully installed railties-3.0.0.beta
1 gem installed
Installing ri documentation for railties-3.0.0.beta…
Installing RDoc documentation for railties-3.0.0.beta…
eoe:~ IceskYsl$ rails -v
Rails 3.0.0.beta
ok,可以了!
参考资料:
http://oscardelben.com/articles/2009/12/06/how-to-test-rails-3.html
http://adamfortuna.com/2010/02/06/getting-rails-3-beta-setup/
http://d.hatena.ne.jp/h-nakao/20100210/1265775935
6 Mar
有很多插件可以做这个事情,例如use_db ,magic_multi_connections等等,但是也有更简单得方法,如下,2步就好了
1. 设置database的config
extradb_production:
adapter: mysql
host: localhost
username: root
password: blabla
database: extradb_prod
2. 在相关得 Model 利用 estabilish_connection 去做连接即可
class lala < ActiveRecord::Base
establish_connection :extradb_production
end
5 Mar
W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example:
Mozilla/Firefox and Safari 3 users should see a nicely rounded box, with a nicely rounded border.
The code for this example above is actually quite simple:
These different corners can also each be handled on their own, Mozilla has other names for the feature than the spec says it should have though, as it has f.i. -moz-border-radius-topright as opposed to -webkit-border-top-right-radius:
Mozilla/Firefox and Safari 3 users should see a box with a rounded left upper corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded right upper corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded left lower corner.
Mozilla/Firefox and Safari 3 users should see a box with a rounded right lower corner.
These are handled by / should be handled by:
-moz-border-radius-topleft / -webkit-border-top-left-radius
-moz-border-radius-topright / -webkit-border-top-right-radius
-moz-border-radius-bottomleft / -webkit-border-bottom-left-radius
-moz-border-radius-bottomright / -webkit-border-bottom-right-radius
4 Mar
前段时间用上了Passenger ,尔后就看到很多的人推荐使用Ruby Enterprise Edition(REE),今天得闲,试了一把。
Step 1: Download
Source code: version 1.8.7-2010.01
Step 2: Install
Extract it:
tar xzvf ruby-enterprise-X.X.X.tar.gz
Run the installer (completely safe, none of your system files will be touched!):
./ruby-enterprise-X.X.X/installer
Welcome to the Ruby Enterprise Edition installerThis installer will help you install Ruby Enterprise Edition 1.8.7-2010.01.Don’t worry, none of your system files will be touched if you don’t want themto, so there is no risk that things will screw up.
You can expect this from the installation process:
1. Ruby Enterprise Edition will be compiled and optimized for speed for this system.2. Ruby on Rails will be installed for Ruby Enterprise Edition.
3. You will learn how to tell Phusion Passenger to use Ruby Enterprise Edition instead of regular Ruby.
Press Enter to continue, or Ctrl-C to abort.
Step 3: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
Follow the instructions that the Ruby Enterprise Edition installer gave you.
24 Feb
Rails启动后报错,ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/temp/mysql.sock’ (2)
1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
另外看看是不是权限问题.
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
3、试试:service mysqld start
4、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql
[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[root@localhost ~]# mysql -uroot -p
22 Feb
由于经常要讨论产品,包括web和手机(Aandroid,Iphone)的产品原型设计,尝试过很多的原型设计工具,例如Axure等,后来换了mac book,就一直找不到合适的原型设计工具,就一直在Google Doc中直接draw,其做了很多无用功。
比较偶然的机会看到Balsamiq Mockups这个软件,和Pixelmator一样,是个人开发者(意大利人Peldi)开发的产品,其地址为http://www.balsamiq.com/ ,在其提供的demo页面上试了下http://www.balsamiq.com/demos/mockups/Mockups.html,效果很好,符合我的预期。
虽然是由个人设计的,但功能却一点不弱于其他大牌的原型设计工具:
操作方面,拖拽,控件分组,甚至元素之间的对齐都做得很贴心;
预制了很多界面元素,从简单的输入框,下拉框,浏览器主要元素,到经常用得到的导航条,日历,表格,到复杂的Tag Cloud,Cover Flow, 地图,WYSWYG的格式工具栏等,有了这些不用从头画起,往往比用白板都快;
界面元素的修改很简单,比如导航条的几个标签页的label,就是用逗号分隔的文字,下拉框的选项就是分行的文字;
使用xml语言来记录和保存界面元素和布局,
这使得每个设计都能被很好得放进SVN,Git,和CVS等工具中进行管理和跟踪;
可以设计复杂的界面元素,保存后,以后可以重复使用(包括修改);
可以将设计导出成PNG格式的图片;
可以用命令行进行导出操作,这样就能让我写个脚本,从svn里checkout某个目录下的所有设计文件后,导出图片,打包后用邮件发到项目经理,工程师甚至客户那;
跨平台,Balsamiq Mokups是用Flex和Air实现的,所以在Mac OS, Linux和Windows下都能使用;
不仅仅有桌面版本,还有能集成在Confluence,JIRA,和XWiki中的版本,使得异地在线协作更方便有效。
以下是关于Balsamiq Mockups的一些特点:
易操作:从 Balsamiq Mockups 自带的元素里可以很方便地拖拽,效果图轻易形成;元素对齐很贴心;
可偷懒:根据 Balsamiq Mockups 提供的 Wiki 风格的代码规则,画图时可以「偷懒」,输入文本符号则能生成图标。因此相比其它繁琐的软件操作,Balsamiq Mockups 也能更快地完成画图任务。
控件足:Balsamiq Mockups 软件包括 50 多个控件, 70 多个图标。基本自带了所有常用的小控件,并在导航处进行分类;图标设计赏心悦目。要是 Balsamiq Mockups 允许用户导入自定义的控件就更好了,当然现有的也足够了 -
新风格:让人眼前一亮的涂鸦风格,很能还原手绘效果;
可中文:在菜单栏 View 里将 Use System Fonts 勾上,就能完美支持中文输入(注:非 Balsamiq Mockups 中文版);
其它点:Balsamiq Mockups 使用 xml 记录,方便移植、二次利用;可导出为 png 格式图片。
另外还有跨平台与多版本两个优点:
跨平台:Balsamiq Mockups 基于 Air ,因此能同时在 Windows、Mac OS 及 Linux 下使用;
多版本:包括桌面版本,以及集成于 Confluence、JIRA、XWiki、FogBugz 中的版本
软件可以从其网站上下载,其中桌面版本售价是$79。但作者非常厚道,提供了几种免费使用的方式:http://www.balsamiq.com/products/mockups/desktop
You can download Mockups for Desktop for free. Some of the features of the app, like saving and loading multiple mockups or linking mockups together can only get unlocked using a license key.

5 Feb
我已经记不清距离上次大版本更新时什么时间了,好像很久很久了,自从去年(具体时间忘记了)Merb和Rails宣布合并推出Rails3后,N多人就在期待其发布的一天,终于,来了!
这次升级需要新装很多的gem,如下:
gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rails –pre
期间遇到一个错误:
Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
然后这边有N多关于Rails3的资料供参考:
5 Feb
前段时间写了一篇《实例优化mysql配置文件my.cnf》,这几天看到效果非常明显,别的不说,单mysql cache_hits就很不错(之前竟然没注意到这个参数)
# Increase query_cache_size from 0 to 128M
query_cache_size=128M
# Increase query cache limit from 1048576 to 2M
query_cache_limit=2M
5 Feb
如果你和我一样经常使用终端程序,这个小程序一定可以帮到你。他能将终端窗口变成类似雷神或CS那样的下拉窗口,非常酷。
可以从这里下载 http://visor.binaryage.com/
这个软件需要SIMBL ,如果你没有安装,要先安装这个。
http://www.culater.net/software/SIMBL/SIMBL.php
SIMBL (SIMple Bundle Loader) – pronounced like “symbol” or “cymbal” – enables hacks and plugins. For instance, SIMBL enables PithHelmet to enhance Safari.
之后将下载下来的文件解压,将解压后的文件拷贝至/Library/Application Support/SIMBL/Plugins,之后再重新启动你的终端你就可以看到效果了。 默认的快捷启动键是Ctrl+`
visor: http://visor.binaryage.com/
Installation
Install SIMBL and make sure you have latest SIMBL 0.9.x
Place Visor.bundle into ~/Library/Application Support/SIMBL/Plugins (create this directory if it does not exist)
Relaunch Terminal.app – You should now see the Visor Status Menu Item
Configure your keyboard trigger by selecting the Visor Status Menu Item -> Visor Preferences … and edit your keyboard hot-key
You can now trigger Visor with your hot-key from any application to get an instant terminal session.To hide Visor, you can either:
re-trigger with your key-combo
optionally you can click off of the Visor window
5 Feb
TextMate中已经集成了SVN的Bundle,使用起来非常方便,要用Git的话也可以装Bundle,方法如下:
Installation
mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/jcf/git-tmbundle Git.tmbundle
restart teatmate and it’s done!
In the TextMate preferences, advanced tab, shell variables, set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git)
Many shortcuts are available from the Git-shortcut (Ctrl-Shift-G). Subversion commands are Command-Option-g. Less frequent commands are accessed via the menu.
Update your bundle by running the “Update Git Bundle” command.
Comments::最新评论