Are you still using RadRails 0.7.2?

October 15th, 2007

the title, copied directly from http://radrails.org/.

to those aren’t using mac os, you have an alternative to develop rails projects conveniently and comfortably. please go to aptana, download aptana IDE for a trial and see what you feel. it’s based on eclipse, derived from older version radrails, with the same look and feel but some specific enhancement for rails projects developing. i would say, it’s really worth a try, given you’re not using mac (textmate is certainly only choice on mac!).

aptana ide has a number of useful functionalities while developing rails. unfortunately its rhtml editor seems not very good yet, but it still provides a easy way to organize your projects. i’d recommend you use subclipse or subversive to do team development.

i’m now using aptana other than e text editor which i used in last two weeks. i think there won’t be any problem for ones already familiar with eclipse.

wish everyone a pleasant journey on ruby and rails.

aptana ide

javascript, ajax and rails

October 11th, 2007

what will we really benefit from ajax techniques? the common explanation is to reduce page respond time. but in my points of view, the most fascinating part is presenting some visual effects, and to make stationary web pages more friendly.

due to my recent work, i have to deal with bundle of javascript snippets. i always feel confusing when trying to integrate with rails framework. some significant libraries conflict each other, like mootools and prototypes, and some don’t work in IE or Safari. but what i have to admit i become loving javascript much more than ever and, IE is the most stupid browser i’ve seen ever. if possible, please resort to firefox or safari. you won’t get disappointed.

some libraries worth keeping an eye on:
http://jquery.com/
http://mootools.net/
http://script.aculo.us/

wish me a good luck on js and rails way.

中秋节

September 26th, 2007

年年岁岁花相似
岁岁年年人也同

又是一年中秋节 祝所有人快乐

无趣的生活

September 18th, 2007

无聊的丹麦

enhancements for my rails project

September 17th, 2007

i’ve been playing with rails all last night, managing to add some useful and common functions to it. now everyone can register and upload own photo file. besides, i used fastcgi to boost rails performance quitely.

http://rails.chenxee.com/england

i won’t be able to do much more development during forthcoming few weeks thanks to a number of schoolworks. welcome any comment or blame :)

an experimental rails project

September 16th, 2007

i resumed my learning RoR progress last week. -____- a 3-month pause makes me totally at a loss when picking up RoR again.

http://rails.chenxee.com/england

welcome to my first trial rails project. it’s not even an alpha version and under development still. it’s a bulletin system but provided that only admin user can post message whereas other users only can post comments.

to-dos: registering new user, uploading photo.. you’re able to use this application after i finish registering function, sorry

i don’t know why my rails application performance is poor. my server is located in the United States but i can access to my blog very fast. any hints?

anti-spam plugin activated

September 16th, 2007

sorry for that, but i kept receiving spam comments in last few weeks.. one of my friends has been being bothered by thousands of spam messages at his blog.. incredible, so i’m thinking of that i was lucky to some extent.

thanks for your cooperation to my blog viewers (although there’re few). all i want to say is, any comment is welcome here except spams.

to those who’re suffering the same experience and using wordpress, i would recommend this plug-in: Version 2.9.2: Peter’s Custom Anti-Spam Image Plugin for WordPress

looking forward to seeing your response.

my second birthday in demark

September 5th, 2007

no classes today. nothing to say.

6月25日回国!

June 10th, 2007

机票终于确定了, 北京时间6月26号中午时分(如果一切顺利的话)到北京

ruby successfully talked with mysql

June 8th, 2007

really a little bit tough this morning! but finally got it working. now able to use radrails to write database-related snippets and test anytime.

at begining i was failed to include mysql module.

require "mysql"

doesn’t work. quite easy to figure it out, just gem install mysql from command line window, or download MySQL/Ruby module and install.

after that, another exception appears: The specified module could not be found. needless to say, google solutions. download a mysql client library DLL (the one from 5.0.41 doesn’t work but 5.0.27 works!) and place it in any ruby searchable path. you can use puts $: to see which paths are ruby “classpath”. in my case, i put it into C:\ruby\bin.

all right, all prequisites are done, then make some sense. (i forgot to add my computer ip into my mysql allowable hosts list at begining. that wastes me 2 minutes more since i kept receiving error: xxx.xxx.xxx.xxx is not allowed to connect to mysql server)


require "mysql"
begin
dbhost="db.chenxee.com"
dbuser="chenxee"
dbpass="******"
dbname="rubytest"

dbh = Mysql.connect(dbhost, dbuser, dbpass, dbname)
puts "Server version: " + dbh.get_server_info
res = dbh.query("SELECT id,value FROM test_table")
while row = res.fetch_row do
printf "%s\t%s\n", row[0], row[1]
end

rescue Mysql::Error => e
puts "Error code: #{e.errno}"
puts "Error message: #{e.error}"
puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
ensure
dbh.close if dbh
end

a very simple test snippet. yeah, it works like below.

test mysql/ruby in radrails

using ide to develop and test is always comfortable. of course i can edit script and ftp it to my server side and open a ssh window to run it from command line. i must at least open 2 more windows simultaneously, quite boring. but now i can enjoy “one-stop-service” from radrails, how convenient it is. but the biggest advantage of the latter way is that i needn’t to set up any environment, what i must have are only a text editor and ssh client.

test mysql/ruby from server side

there’s no doubt, not only simple select operation but can insert, delete and update tasks be done easily. last, i’d like to recommend Using the Ruby MySQL Module by Paul DuBois. it provides a very good tutorial for using ruby mysql module.

learning ruby programming language

June 8th, 2007

maybe this should be the first step of learning ror.. :S it’s quite a bit funny that i found i don’t know this language at all after i managed to setup ide for ror development.

yes, it’s like python, suitable for rapid development and easy to pick up. but anyway, learning a complete new technique is more or less bittering i think. like how i picked up python, firstly needless to say, having a number of good tutorials is at least. here i recommend documentation below:

ruby in a nutshell (you can find it from the zip file i posted in my first post)
learning ruby
of course plus standard api reference

it’s always impossible that you become an expert or good at it BEFORE you really use this technique to do some jobs, especially on programming. it’s inevitable that you have to touch and learn new issues as development continues. i used to get to know such aspects when learning a new language from scratch:

language basics, like variables conventions, built-in functions, data types..
control structure, if, while, loop..
object oriented issues including exceptions handling
some key libraries that i have to use frequently when developing such as file IO, datetime, string, array and containers..

fortunately documentation i found accommodate my needs very well. moreover, taking advantage of some online shorter but elegant tutorials and samples i have an overall picture of ruby now. till now i found it’s very interesting in ruby:

iterators
no raw data types, all things are objects
code block and yield, like proc {|p| puts p}
classes and objects

being familiar with C and java, i sometimes feel ruby syntax and grammar are obscure. many people think ruby is more simple and readable, but i don’t think so. yes, code line numbers is reduced when accomplish same tasks compared with c or java. but i think i will use c style still.

after all, i now manage to understand basically what a ruby script full of “ruby way” features wants to do. it’s time to shift my focus to that how to do more useful jobs like database operations or network application.

manipulating mysql database must not be a complicated task in such an elegant language. for example, Using the Ruby DBI Module illustrates how to. i don’t want to make a post too long so that i will new another post later to test my knowledge to use ruby dbi or mysql module to interact with database.

ruby on rails, development environment

June 8th, 2007

the second day of learning ruby on rails. got up at 6pm.. -____- i said that i’m extremely lazy.

after searched plenty of documents and tutorials, i select radrails as my ide for ror development. being afraid of my short memory, i write down simple steps that setup this environment:

1. install jre and jdk http://java.sun.com/javase/downloads/index.jsp
2. install ruby http://www.ruby-lang.org/en/downloads/
3. install rails (run “gem install rails” from cmd)
4. download and start to use radrails http://sourceforge.net/projects/radrails/

all right, what you’re seeing is just my notes other than a complete manual or tutorial, so those want to know in detail please just google “ruby on rails ide”. plenty of articles could help you.

upon setup the environment, i find a ridiculous thing that i don’t know ruby programming language at all. what a shame. but fortunately, having a glance at this language, i feel it’s like python very much. now that started to search any useful documentation. besides ones i mentioned in my last blog post, i think i’d better put the following urls into my favourites:

http://www.ruby-doc.org/core/
http://www.ruby-doc.org/stdlib/

in the future i will surely edit this post to add more useful resource. but no matter which language you’re picking up, i think it’s always a good idea that refer to its official api reference. most questions can be answered provided that you can make couple of minutes to have a look at it!

last, put an image here that witnesses my first step on the march of learning ror :)
my first ruby application

hello, ruby on rails

June 7th, 2007

from now on i’m going to pick up ruby on rails.

at my blog i will post some learning notes and experience. it’s a good idea that anybody manages to come to this blog shares his/her valuable experience and knowledge among us.. you’ll never walk alone, no matter if you’re a Liverpool football club fans it applies anyway, doesn’t it.

all right, i found a collection of documents quite good for newcomers. some are written in english and some in chinese. here it is, ruby.zip the most important, don’t forget to let us know if you have any other valuable resource.

荷比卢 即将出发

March 30th, 2007

再过10多个小时 就要登上去汉堡的大巴 然后开车冲向向往的荷比卢

保佑我们旅程一切顺利 阿弥陀佛

今天要回家了!

December 29th, 2006

晚上9点多的飞机 激动啊 能吃上饺子 烤鸭 火锅。。。了

Culture night, 文化节

October 18th, 2006

第一次在丹麦吃米饭

September 16th, 2006

今天首次在这里做米饭吃,蒸的不错,就是菜做的太烂了。。 再接再厉,加油。

我觉得水和米的比例在1.9:1的情况下,米饭蒸的最好。

Pictures in Denmark, 一些图片

September 7th, 2006

Denmark

 

Sep 5, 2006 - 38 Photos

这是我的google相册。 有些国内的朋友说点击看不到,也许我真该换flickr的?搞不懂。

第一次在丹麦踢球

September 6th, 2006

今天第一次在丹麦踢球!在我们学校的足球场。真草皮,但是刚下了点雨,泥比较多,跑了一会鞋就发沉了。踢的还算可以,由于和队友都很陌生,没有多少默契,没有发挥出最好水平。丹麦人对待国际友人比较友好,和我撞了后还不忘说对不起。以后随时都可以去踢球啦,爽啊!

初到丹麦

September 5th, 2006

从机场出来后,对丹麦第一个比较强烈的印象是汽车都开着近光灯。为什么?我也不知道,好像是政府规定的,保障安全。他们在那么窄的道上都开到110-130公里时速,真是牛啊。

第二个深刻的印象是,所有自来水都可以直接喝。是纯净水还是矿泉水,不知道,不过味道还不错。