RubyGem update on Leopard

Posted by Jay on November 27, 2008

I have a RubyGem version 1.2.0 installed on Leopard. If you would like to update RubyGems to a newer version, the RubyGem user guide suggests for modern versions( >0.8.5 ) can use the following command:

gem update --system

But, console told me the 1.2.0 is the latest version - Nothing to update! The work around is to use install rubygem-update:

gem install rubygems-update
update_rubygems

Check installed version:

MBP:~ Jay$ gem --version
1.3.1

So now, I’m able to pull the latest rSpec plugin into my Rails project.

VirtualHost browser cache

Posted by Jay on August 10, 2008

Setting up a virtual host on PC, Mac or Linux isn’t difficult, but the browser cache problem drives me crazy. Apart from editing the /etc/hosts mappings and httpd.conf, you need to restart both Apache and browser. Refreshing the browser(Firefox) doesn’t clean the cache, so the result will be always add /xampp/index.php at the end of the virtual host name.

Leopard system environment PATH setting

Posted by Jay on August 09, 2008

Leopard PATH setting is quite different from Tiger. Configuring PATH on Tiger, we used to either modify the /etc/path or user path configuration. With Leopard, system-wide path configuration is managed by /etc/profile. The file loads a path_helper script. So what the script does?

The path_helper constructs the system environment PATH in this order:

  1. Reads the local user configuration first, under ~/.bash_login
  2. Appends default system paths /usr/bin:/bin:/usr/sbin:/sbin
  3. Reads the paths line by line in /etc/paths
  4. Retrieves all the files in /etc/paths.d/ that contains other packages configurations. For example, I created a file /etc/paths.d/system and stuff in some user paths settings. They are appended after step 3.

In my case, I wanted my XAMPP packages overrides the default Leopard MySQL, PHP and Apache paths ( so I don’t have to type in /Application/xampp/xamppfile/bin to use the command every time, also the package is easier to manage ). So just put the paths in the ~/.bash_login, that will override the system default.

Close the Terminal and open it again, to check your path settings, type:

 echo $PATH

There we go, it’s updated.

Code Collector Pro帮助整理代码 3

Posted by Jay on August 06, 2008

Code Collector Pro代码整理问题一直是我的难题,不想用大的IDE整理自己的代码,特别是一些很小的部分。今天看到Code Collector Pro这个在MacOSX上面简单的程序能够帮助整理日常用的代码碎片。

确实,如果你是一个经常写代码的工作人员或者学生,总是有一些有用的代码需要记住又一时不能记下来,一般的办法,就是创建一个空的文本档暂时粘贴到里面;再有就好好整理到一个自己的记事本上;或者再源文件里加上注释;要么在什么网站上找到的就当作书签。时间长了,代码就都很凌乱,这样总不是个办法。

Screen Shot

CCP支持很多整理功能:

  • 将代码分组
  • 语言种类的标实
  • 搜索
  • Drag & Drop代码的片断
  • 增加标签
  • 输入,导出文本
  • 到CodeCollector.net上下载或者上传代码的碎片
  • 设置这片代码的版权
  • 自动更新版本,等等

CCP有两个版本,一个免费的Lite版本,支持少部分的功能,但是足够可以完成整理的工作;收费版本支持更多的功能,价钱也很合理,大约20欧元。

如果大家知道Windows和Linux下面有什么整理代码的好工具,可以留言和我分享一下。

15 Years Later, It’s Time for Wine?

Posted by Jay on June 19, 2008

Wine LogoAfter 15 years’ development of Wine, we’ve been through many test and beta versions. Finally, a stable Wine is available to all the users.

Wine is an open source implementation of the Windows application programming interface (API) on top of X, OpenGL and Unix that allows Windows applications to run on other operating systems, including Linux and Mac OS, without the need to run Windows as well.

Of course, open source is free for any users. So they can be build and compiled on your operating system. I used previous Wine beta build on a Linux(Ubuntu 6.*), I had a few troubles:

  • Fonts was an issue, MS holds the license for all the Windows fonts. If we want to display the same font as windows shows, we have to copy them from a windows pc to the font folder in Wine file structure.
  • Performance. If you run a basic application should encounter no problem, the one trouble is playing games that requires better graphics. You would expect the performance of the graphic card was reduced. (I played Need for Speed, it was pretty slow while on Windows I can set to higher resolution).
  • Security. Wine seems to use some crucial .dll(s) in its file structure, you might get some virus that lives on windows, but this should not affect your linux or mac operating system.

My experience was that commercial version(Crossover, developed by CodeWeavers) was decent, however it still had font issue.  I was able to run lower versions MS Offic* (i.e. 97, 2000). I encountered a few software crash problem, but the office recover feature worked. (Be careful when you use wine for important tasks, the suggestion is to save your work frequently.) They offered easy setup, however, it lacks of flexibilities comparing to wine.

Well, don’t like Wine? but still want to run windows apps on linux or mac? You may try virtual machines. the most well knwon distributor is Vmware as they ship several versions of Vmwares on varies type of operating system. If you are linux users, they ship the Vmware for free( suppose what we call it open source culture). Vmware Fusion provides free 30 trials. It’s better than Parallel Desktop, a virtual machine solution for Mac, because the new version offers DirectX 9.0(or higher) support.

If you have time and tried things out, I would like to hear about your experience.. :)

预计Apple 08年6月公布新MB, MBPro

Posted by Jay on April 30, 2008

Rumoured MacBook Pro最近在考虑收下一台Macbook Pro, 所以在MacRumour上游荡很多. 有小道消息说Apple很有可能在第三季6月份或者8月份公开销售重新设计的Macbook, Macbook Pro。

AppleInsider分析说到, 当我们再次审视苹果产品的时候,很明显的发现只有MB, MacMini被忽略了很久, 他们已经很多年没有更新过外观设计了. 很有可能Steve继续追求eco-free的目标, 重新设计MB和MBP, 加上有现代感的金属镁外观和iMac涉及靠近.

不是没有可能, 毕竟从iBook已经快4年没有改过外观设计, MacBook Pro自从Powerbook G3五年来没有更新过外观设计. 加上Intel的Roadmap预计6月份发布处理器Montevina,苹果随后也照常在San Francisco开年度开发会展, 苹果一向对Intel的产品更新反映更新很迅速。

在网络上可能找到很多人预计的最新设计样图, 大家各自说各自的感受和需求. 个人以意见, 如果急需要用MB/MBP的话, 尽快买吧, 即使是新设计, 运算功率在快都只是数据, 人本身也许感觉不到性能的提升; 如果购物者可以再等几个月, 那这次更新还是值得等待的. 就好像最新的Macbook Air应该很就不会更新外观设计.

Disable iPhone EDGE

Posted by Jay on March 12, 2008

前一阵子试着用SFTP通过Wireless network连接到iPhone上, 研究file system的结构. 发现和MaxOS的却别不大, 而且相当的相近. 由于英国这边O2和Apple合作, 1.1.2版本后的Firmwire会不现实EDGE的设置, 如果不是签合共来的 - Jailbreak/Unlock, 那EDGE的开销可不是个小数目. 7.5英镑每兆。

那些说用第二张 Sim Card把EDGE设定界面弄出来再换成O2卡的方法基本上是没有用的. 另外一个就是用Mac的Property list editor 直接修改O2_UK.plist. 加一个 ‘AllowEDGEEditing’ key 和 value ‘true’ 到你的property list中, 然后保存, 上传这个文件到同样的位置并且覆盖原来的文件. 现在到General-> Network 就能看到EDGE的按钮再次出现. 最后随便输入一个用户名和密码就可以了, 目的是不让手机找到EDGE的网络.

以前用BossPrefs 虽然避免了数据的交换, 但是账户还是登陆了EDGE网络, 所以上面修改EDGE Login是最安全的方法.