test

/***********************************
 ** Multiline block comments
 **********************************/

$stringWithUrl = "http://alexgorbatchev.com";
$stringWithUrl = 'hello world';
 
ob_start("parseOutputBuffer");  // Start Code Buffering
session_start();
 
function parseOutputBuffer($buf) {
 global $portal_small_code, $portal_gzcompress;
 global $PHP_SELF, $HTTP_ACCEPT_ENCODING;

 // cleaning out the code.
 if($portal_small_code && !$portal_gzcompress) {
  $buf = str_replace(" ", "", $buf);
  $buf = str_replace("\n", "", $buf);
  $buf = str_replace(chr(13), "", $buf);
 }
}

可恶的GFW

可恶的GFW!!!这段时间老是把blogspot开了又关的弄得我的blog访问总不正常,没办法只好自己建站了。好在现在的WordPress 2.1比起以前容易用多了,我才用了半天不到就架好还找到了个漂亮的苹果界面主题。只可惜了我原来在blogspot的文章啊:-( 我的新网站是fsmartin.3322.org,欢迎大家到我的网站看看

TextMate的中文字符显示

TextMate是苹果下非常有名的程序编程软件,可惜它对“CJK”支持十分不好中文字会重叠在一齐。 好在网上有牛人有了解决方法,把中文字体从两字宽改为要字宽。虽然字体窄了点但是不失为一个好的解决方案。 字体制作方法:http://otherside.mimijidi.com/entries/cjk-in-textmate/ 下载连接:TextMate中文字体 http://wuhongsheng.com/tmp/TextMate.ttf.tar.bz2 下载后解压,打开,然后安装字体。之后在TextMate里面选择这个新装的字体即可。

OSX 急救

启动的时候按F8进入高级启动选项,输入"-s"进入文字模式. 这时候文件系统是只读的,要写的话就输入: /sbin/mount -uw / 然后就可以修复系统了

NTFS-3G on OSX

感谢MacFUSE计划和NTFS-3G,Mac机现在终于可以支持NTFS读写啦! 闲话少说,现在动手干: 1.下载MacFuse Core: MacFuse Core 0.2.2.dmg 2.下载MacFUSE Tools: MacFUSE Tools 0.2.2.dmg 3.下载NTFS-3G: NTFS-3G 1.0.dmg 或者直接下载二和一包吧:(NTFS-3G and MacFUSE Tools): NTFS-3G 1.0 (Full).dmg 完成后就可以读写NTFS分区啦. 不过安装NTFS-3G后磁盘的图标变成了网络图标,名称也变成disk0s8。感觉怪怪的不过道不影响使用,名称也可以自己改回来。 要支持简体中文还需要做一步,就是在NTFS分区的根目录建立一个叫“.ntfs-locale”的文件,文件内容是“zh_CN”. 还可以建个文件叫“.ntfs-readonly”的应该是把分区设为只读吧,我没试过。不过要只读的话还要 NTFS-3G来干什么啊?^_^ 建完文件把分区推出后再在“应用软件 -> 实用程序 -> 磁盘工具”把分区装上就OK啦!

ThinkPad X60的OSX 10.4.8声卡安装

我在本本上划分了25G的逻辑分区,并用分区工具把分区的ID设为0xAF后安装成功了. 启动是用的tboot文件,改了下XP的boot.ini文件. 1.声卡补丁 X60的AD1981 HD Audio在OSX中无法发声,要通过修改AppleAzaliaAudio来实现。 AppleAzaliaAudio在OSX的安装盘上有,也可以在insanelymac网站下载。 首先要删除原有的HDA声卡 sudo rm -rf /System/Library/Extensions/AppleHDA.kext sudo rm -rf /System/Library/Extensions.mkext sudo rm -rf /System/Library/Extensions.* 安装AppleAzaliaAudio驱动,修改:

sudo pico /System/Library/Extensions/AppleAzaliaAudio.kext/Contents/Info.plist
用ctrl+w找到IOHDAudioCodecVendorID 将其键值改为0x11d41986 存盘并退出
sudo pico /System/Library/Extensions/AppleAzaliaAudio.kext/Contents/PlugIns/AppleAzaliaController.kext/Contents/Info.plist
ctrl+w找到IOPCIPrimaryMatch,将键值改为0x27d88086 如果是在nsanelymac网站下载的AzaliaAudio文件就可以偷懒省掉这一步啦^_^ 清理,修复权限 sudo diskutil repairpermissions / cd /System/Library/Extensions sudo chown -R root:wheel AppleAzaliaAudio.kext sudo chmod -R 755 AppleAzaliaAudio.kext sudo rm /System/Library/Extensions.* sudo kextload AppleAzaliaAudio.kext sudo kextcache -k /System/Library/Extensions/

ROR on OSX

OSX 1.4版自带了ruby语言,这本是件好事可惜apple把它的配置文件搞错了。结果在OSX上安装rails on ruby变成了件无比复杂的事情。 我是参照ROR网站上的方法装的。安装记录如下: 准备工具

  1. Mac OS X 10.4 (也许 10.3)
  2. Xcode 2.4 或更新(this compiles the apps for us)
  3. Willingness to type commands into the Terminal application exactly as they appear here (cut-n-paste works too)
  4. A tasty beverage to enjoy while things compile
Xcode默认是不随OSX安装的,需要在Apple’s Developer Connection下载.文件约800M,安装空间要1.4G以上,默认安装2.4G. Path文件 用TextMate创建login文件。
mate ~/.bash_login
在文件最后添加命令行:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
执行文件:
sh ~/.bash_login
建立安装所需的临时目录:
sudo mkdir -p /usr/local/src sudo chgrp admin /usr/local/src sudo chmod -R 775 /usr/local/src cd /usr/local/src
ruby安装 安装readline:
curl -O ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz tar xzvf readline-5.1.tar.gz cd readline-5.1 ./configure --prefix=/usr/local make sudo make install
ruby安装
curl -O ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5-p12.tar.gz tar xzvf ruby-1.8.5-p12.tar.gz cd ruby-1.8.5-p12 ./configure --prefix=/usr/local --enable-pthread --with-readline-dir=/usr/local make sudo make install sudo make install-doc cd ..
安装完后输入:ruby -v 应该可以看到:ruby 1.8.5 (2006-12-04 patchlevel 2) [blah] RubyGems安装
curl -O http://rubyforge.rubyuser.de/rubygems/rubygems-0.9.0.tgz tar xzvf rubygems-0.9.0.tgz cd rubygems-0.9.0 sudo /usr/local/bin/ruby setup.rb cd ..
Ruby on Rails安装 sudo gem install rails --include-dependencies Mongrel安装 sudo gem install mongrel --include-dependencies Capistrano sudo gem install capistrano --include-dependencies sudo gem install termios --include-dependencies MySQL
  1. Download the MySQL 5.0 package for OS X PPC or the MySQL 5.0 package for OS X Intel
  2. Double-click the drive image to mount it
  3. Locate the MySQL installer (a file named something like mysql-standard-5.0.27-osx10.4-i686.pkg) and run it, authenticating as needed
  4. Double-click MySQLStartupItem.pkg, authenticate, and let it install
  5. Double-click MySQL.prefPane and install it, deciding whether to make it available to just the current user, or for all system users
MySql本地二进制Gem
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
出现选项:
Select which gem to install for your platform 1. mysql 2.7.3 (mswin32) 2. mysql 2.7.1 (mswin32) 3. mysql 2.7 (ruby) 4. mysql 2.6 (ruby) 5. Skip this gem 6. Cancel installation
选3. 然后会见到些错误:
mysql.c: In function 'Init_mysql': mysql.c:2015: error: 'ulong' undeclared (first use in this function) mysql.c:2015: error: (Each undeclared identifier is reported only once mysql.c:2015: error: for each function it appears in.) mysql.c:2015: error: parse error before numeric constant mysql.c:2018: error: parse error before numeric constant make: *** [mysql.o] Error 1
安装未完成,需要下载个补丁文件:
mkdir -p /usr/local/src/mac-mysql-gem cd /usr/local/src/mac-mysql-gem curl -O http://hivelogic.com/downloads/mac-mysql-gem.patch cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 sudo ruby extconf.rb install mysql -- --with-mysql-dir=/usr/local/mysql sudo cp mysql.c mysql.c.dist sudo patch mysql.c /usr/local/src/mac-mysql-gem/mac-mysql-gem.patch sudo make sudo make install cd /usr/local/src
安装完成
rails testapp cd testapp script/server
如果正常的话应该会看到:
=> Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel available at 0.0.0.0:3000 ** Use CTRL-C to stop.
这时可以打开http://localhost:3000/看看