Posts Tagged ‘leopard’

iPhone上跑Ruby

May 5, 2008 Tags: , , ,

Ruby可以在iPhone上跑吗?答案当然是肯定的。最多只要五分钟,就可以搞定(其实对于大部分破解的iPhone来说前三步应该已经操作过):

  • 安装Installer.app
  • 添加Community Sources
  • 安装BSD Subsystem (System 分类下)
  • 安装Term-vt100 (System 分类下)
  • 安装Ruby (Development 分类下)

安装完Ruby,接到提示:

Please add /opt/iphone/bin to your $PATH

那就乖乖听话,把它加进去吧。运行Terminal(即上面安装的Term-vt100),敲入:

cd ~
echo "PATH=$PATH:/opt/iphone/bin" >> .profile

为了使它生效,需要重启一下Ternimal:

killall Terminal

再运行Terminal,显示$PATH看加入了没有。如果有了,运行一个简单的命令测试一下:

echo $PATH
ruby -e "puts 'hello iphone'"

结果如下:

Ruby on Iphone

BTW,执行ruby -v看了一下,结果为:

ruby 1.8.6 (2007-03-13 patchlevel 0) [arm-darwin]

而我的Leopard 10.5.2下为:

ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]

好玩!

Leopard上试玩mod_rails

April 26, 2008 Tags: , , , ,

Setup mod_rails Passenger Mac OS X Leopardmod_rails官方网站上的Passenger users guide中推荐的在OS X上安装mod_rails的教程文章。文章描述的很详细,安装过程主要花在编译安装apache上(Leopard自带的apache支持passenger-install-apache2-module有问题)。我照着步骤操作后,以development模式放了一个测试站点,运行后站点跑了起来,但样式和图片无法显示。显然是权限有问题。

解决方法:在站点的配置中加入对所在目录的访问权限。比方说虚拟站点的apache设置为:

<VirtualHost *>
  ServerName test.ashchan.com
  DocumentRoot /Users/james/codex/ashchan.com/public
  RailsEnv development
</VirtualHost>

则加入以下配置即可:

<Directory "/Users/james/codex/ashchan.com/public">
   Options FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

站点起来时(第一次访问)感觉速度比较慢,不知道production模式下会快多少。相比mongrel cluster等每次需要重启的麻烦,mod_rails直接上传部署并自动扩展的方式非常吸引人,相信不用多久便会非常流行。

Leopard: Calling Dictionary Right from Browser

December 23, 2007 Tags: ,

Learned from Usingmac.com today a way to launch Dictionary from the browser:

However, if you’re not thinking of using your mouse, you can move your cursor to your browser url bar (L) and then type dict://apple, which apple is the search term. For your surprise, your Dictionary will be triggered.

Leopard: Calling Dictionary Right from Browser

Also tried Firefox and found works too. Great trick!

rails 升级至 2.0.2

December 18, 2007 Tags: , , ,

Rails 2.0.2版本已经放出。最主要的变化有:

  • 默认使用SQLite3数据库。作出这一调整的一个原因是SQLite3比MySql来得简单,另一个原因是Leopard的开发环境默认安装的是SQLite3。参考这里了解修改Leopard随带的Rails 1.2.3默认数据库的方法;或者在创建rails应用的时候用rails -d mysql myapp来指定使用MySql数据库。

  • 在production环境下运行时,不再监测视图模板的变化。好处是减少了IO活动,坏处是,呃,修改站点外观也要重启(应用)服务器。可以通过修改production.rb中的config.action_view.cache_template_loading来更改这一行为。

另外修改了不少bug。可以通过gem install rails来升级至2.0.2版本。建议升级前先用gem update –system将gem升级至0.9.5版本。

Leopard - 如何将多个图片合并为一个pdf文档

December 16, 2007 Tags: , ,

在Leopard下,可以不借助任何外部工具将多个图片文件合并为一个PDF文档。方法如下:

Continue reading»

Leopard & Ubuntu: Terminal下如何获取硬件信息

December 11, 2007 Tags: , , , ,

Ubuntu Server下使用该命令

lshw

lshw命令显示详细硬件信息。如果要用概要方式显示,可以加上short参数:

lshw -short

要显示指定硬件信息,加上class(或C)参数:

lshw -class memory

ubuntu lshw使用截屏

Continue reading»

设置Leopard下Rails默认使用MySql

November 27, 2007 Tags: , ,

Leopard系统附带安装的rails 1.2.3版本,使用SQLite作为默认数据库。要修改为MySql,修改这个文件:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/rails_generator/generators/applications/app_generator.rb

将第9行和第104行中的sqlite3修改为mysql即可。

来源:http://www.ruby-forum.com/topic/130417

 

Leopard 第二天: KeePassX

October 29, 2007 Tags: , , ,

KeePassX在Leopard下不能用的问题,有了更好的解决方案,Lifehacker提供一种通过安装QT新版本并修改KeePassX app包内容的方式来去除崩溃问题:

Mac OS X Leopard only: If you tried installing our favorite password manager for Mac, KeePassX, on Leopard, you already know it doesn’t work. (When you launch it, it crashes immediately.) Someone who knows more about KeePassX than we do figured out it’s a problem with the out-of-date Qt development package installed with KeePassX. Luckily you can fix the problem with a Qt installation and a single command in the Terminal. Here’s how to get KeePassX working on Leopard.

Download and install the open source edition of Qt.

Once that’s done, in the Terminal, run this command:

rm -rf /Applications/KeePassX.app/Contents/Frameworks
When you launch KeePassX, all will work as you expected. You run into any other Leopard incompatibilities? Tell us about it in the comments.
已测试成功,不错:)