using rvm @global gemset

It’s cool to have different gemset for each project. However, the problem is that you have to install gems, e.g. thin, bundler, etc, that shared among them again and again.
Of course, there is already good way to deal with this:

RVM provides (>= 0.1.8) a @global gemset per interpreter.

Gems that are installed to the per-interpreter @global gemset are available to all other gemsets for that interpreter.

This is a good way to allow all of your projects to share the same installed gem for a specific ruby interpreter installation.

see http://beginrescueend.com/gemsets/global/ for more details

Below shows an example about installing bundler into @global gemset:

$ rvm 1.9.2@global

$ gem install bundler —no-ri —no-rdoc
$ rvm use 1.9.2@other_gemset
$ gem list

You should see bundler in other_gemset too. But not that if you switch to other ruby version, e.g. 1.8.7, you have to do it again for 1.8.7@global.

Posted by Shaokun 23 May 2011 at 04:36AM


installing rvm on older systems (RHEL4)

I recently had trouble installing the excellent Ruby Version Manager (rvm) onto an older production server. While bash scripting isn't my strong suite, i managed to track down the issue to this line in scripts/manage.sh:
__rvm_run "extract" "bunzip2 < '${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension' | tar xf - -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
Turned out that for whatever reason, this line simply didn't work in RHEL4. Luckily, it didn't take much to fix it. The first thing I did was split it into 2 lines, so I could better see where it was failing. Turns out, performing this action in 2 lines was all that needed to happen, and this worked fine.
__rvm_run "extract" "bunzip2 '${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension'"
__rvm_run "extract" "tar xf ${rvm_archives_path}/$rvm_ruby_package_file.tar -C ${rvm_tmp_path:-/tmp}/rvm_src_$$" "$rvm_ruby_string - #extracting $rvm_ruby_package_file to ${rvm_src_path}/$rvm_ruby_string"
So, if rvm is failing to install ruby1.9.2 on older linux distros, this may help. I've already created a github pull request, hopefully this will get rolled into a later version of rvm. Many thanks to Wayne for this amazing package!

Posted by adevadeh 19 May 2011 at 08:09AM


GZTechJobs - Job Board for GZ Geeks

Remember the board which is stuck by a lots of want ad near the canteen of campus? Here what is GZTechJobs, we support a board, you can post your want ad on it, no sign up, no confirmation, just one click and post your want ad!
还记得校园饭堂门口白板上面的那些招聘小广告么? GZTechJobs就是为你提供的那块白板, 你可以在上面随意粘贴你的招聘信息, 不需要注册, 不需要我们确认, 只需要写上你的招聘信息, 然后粘贴上去!

GZTechJobs is focus on Guangzhou IT position information, let's go and see the screenshot of GZTechJobs and post your want here!
GZTechJobs 主要针对广州IT职位的招聘信息, 让我们来看看它是如何方便简单地发布你的招聘信息吧!

  • In homepage, you can see the sharp button "Post a Job", right, click it!
    在主页上, 你可以看到一个显眼的"发布职位"的按钮, 对, 就是它, 点一下吧! null
  • Then in posting page, fill with your want information, click "Submit"
    然后填上你的招聘要求, 好了, 提交吧! Click Here!
  • Now, you can see your post and geeks will find the job here and hope they will email you!
    现在, 你就可以在主页上面找到你刚刚发布的招聘信息了, 程序猿们可以在这里找到他们合适的职位, 希望他们给你发邮件吧! YourPost

If you have any question about GZTechJobs, just feel free to email us at jobboard@kudelabs.com
如果有任何关于GZTechJobs的疑问, 欢迎随时给我发邮件jobboard@kudelabs.com

Posted by 潘小园 11 May 2011 at 04:43AM


Rails on Campus: 华工版 - Session 1

The first Rails on Campus session went very well last saturday, with around 50 budding rubyists in attendance. We went over the history and purpose of Ruby and then Rails, and then did a live demo of: Build your own miniblog in 20 min.

Rails on Campus 上周六的活动开展得非常顺利,大约50名对Ruby感兴趣的同学参加了此次活动。我们对Ruby 和Rails 的历史以及意义都作了简单的阐述,并且现场做了一个迷你演示:怎么样在20分钟内建一个属于你微博。 :)

Since we didn't have wifi at the venue, it was hard to show all the links and make sure students could write them all down, so here's a list of important links:

由于我们现场没有wifi设备,很难向大家展示所有的链接,同时也考虑到可能一些同学也来不及记下来。 大家不妨看看以下关键的链接,可以更好地理解我们分享的内容:

Thanks to everyone involved, and to all the attendees. We all look forward to working together again next week!

非常感谢到场的每位同学以及工作人员,让我们一起期待下一次的活动!

Posted by adevadeh 09 May 2011 at 11:05AM


three steps to upgrade redmine from 0.9.x stable to 1.1 stable

Redmine makes it pretty easy and smooth for us to upgrade itself. Here is a link for general upgrade from Redmine: RedmineUpgrade.

In 1.1 stable version, there are some good new features that 0.9.3 doesn't have, i,e: the Gantt chart , the Calendar, and the new concept of Subtasks/Parent tasks and so on. For more detailed features of newest redmine, you may visit: Features.

If you have redmine running at an old version like 0.9.x, and feel strongly like upgrading redmine to the latest stable version, you may try this simplest solution:

Step 1: Backup files/ and database, very important!
Step 2: svn switch http://redmine.rubyforge.org/svn/branches/1.1-stable 
Step 3: rake db:migrate RAILS_ENV=production

Note that Steps 2 and 3 must be done in your existing redmine root.

After you have completed the above three steps, just restart your application and you will see the new exciting Redmine, hooray!

Just in case of you are not familiar with linux, let me explain more:
1. How to backup files?

cp -r your_redmine_root/files your_backup_destination/files 
2. How to backup database?
mysqldump -u username -p password redmine_db_name >  your_backup_destination/redmine_db_backup.sql

Posted by Mysen 09 Feb 2011 at 09:15AM


Setting up rubygems without root access

Recently we had to install our rails app on a box, but we didn't have root access. The machine had ruby 1.8.6 and rubygems 0.9.6 (ouch). We can live with Ruby 1.8.6; but to run modern rails, we needed modern rubygems.

The rubygems install page has a helpful section on how to install locally without root access. Note: be sure to add export GEM_HOME=~/rubygems/gems to your .bashrc or your .bash_profile or else the next time you log in, your system gets confused again.

$ mkdir rubygems
$ cd rubygems-a.b.c
$ export GEM_HOME=~/rubygems/gems
$ ruby setup.rb --prefix=~/rubygems

Unfortunately, this didn't go as smoothly as I hoped. The result:

" `gem_original_require': no such file to load -- rubygems/exceptions"

and many other similar error messages.

The issue was that since the server installation already had an old version of rubygems installed, my local gem script was calling up the old rubygems files, but using my new GEM_HOME. A big mess.

What needs to happen is that your new gem executable needs to load your new rubygems files, and work with your new GEM_HOME. There may be a better way to do this, but I have found a workable solution for my case. It involves messing with the executable files that rubygems installs.

If you take a look at your gem executable, you'll see it is just a text file, a ruby program that executes itself.

$ cat  ~/rubygems/bin/gem

#!/usr/local/bin/ruby
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'

...

If you are familiar with shell scripts, you'll know that the first line (the shebang) specifies the binary to use to process the file. In this case, its #!/usr/local/bin/ruby. In general this is great. Ruby loads up the file and runs the script and magic happens. But what if the require 'rubygems' line is loading up the wrong rubygems?

We need to tell ruby where to find our custom rubygems libraries. Luckily, ruby has an option for this, -I path/to/lib. So, all we need to do is open up our gem executable and modify the shebang line to include this option.

$ vim  ~/rubygems/bin/gem

#!/usr/local/bin/ruby -I ~/rubygems/lib
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'

This tells the ruby interpreter to start the process with our custom path in the include path. If we have a newer version of the rubygems library there, they get required instead of the old versions. I can now install gems locally into my GEM_HOME without needing root access like so:

$ gem install mongrel

But that's not all. mongrel also installs its own executable, and when you try to run it, it will require rubygems. And yes, you guessed it, it will find the old version of rubygems and get completely confused. So again, we need to go into the executable file ~/rubygems/gems/bin/mongrel_rails and modify the shebang line.

As far as I can tell, you would need to do this for each and every gem that installs its own executable.

Update: after further consideration, using the $LOAD_PATH environment variable would probably be more robust, but my app is already installed. Perhaps you will let me know how it goes with $LOAD_PATH

Posted by adevadeh 20 Jul 2010 at 03:52AM


Web Wednesday GZ is back in June!

    Web Wednesday GZ is back in June!

    Phillip Wu, CEO of inforThinker, will bring us a speech about the hottest consumer electronics product: iPad!

    iPad defines a new type of mobile computing devices, which has differentiate itself from smartphones, netbooks and Tablet PCs. Apple also set a very high standard in UI design for the whole industry. What kind of efforts Apple has been made to bring the computers much closer to our daily lives? The speaker has prepared the slides based on what he has learned from WWDC 2010 Session 103, and will tell the UI design principles behind the brilliance of iPad.

    For more information, please visit http://www.kudelabs.com/wwgz/wwgz1006.html

    And for more, we will donate 5 promo codes of a Beauty Clock iPhone app: MMClock! We draw a lottery after the speech. Remember to join us on 30th, June!



亲爱的WWGZ会员们,

    Web Wednesday GZ 在六月份又再卷土重来了!

    吴晓丹,广州顺科软件服务有限公司首席执行官,会 为我们做一个时下最火热的电子产品:iPad的演讲!

    苹果公司的iPad为平板电脑人机交互设计树立标杆,继而开创了 一种区别于智能手机、上网本和Tablet PC的新型便携式计算设备。苹果到底做了哪些努力,使计算设备更融入我们的生活?本次演 讲以2010年苹果全球开发者大会第103节研讨会的讲稿为蓝本,为大家介绍iPad的闪亮之处,以及苹果带来的人机交互设计思想。

    欢迎光临以下网址获取活动更详细的信息:http://www.kudelabs.com/wwgz/wwgz1006.html

    演讲之后,我们更加会捐出iPhone的美女时钟软件:MMClock的5个优惠码。演讲之后,我们会抽出5位幸运儿!记得6月 30日来参加我们的活动啦!

Posted by Billy 24 Jun 2010 at 04:10AM


Automated testing tools:Selenium & Watir

When should use automation?

What is advantageous for automated testing? When should one decide to automate test cases?

For the short term project,manual testing may be more effective. If an application has a very tight deadline, there is currently no test automation available,then manual testing is the best solution.

However, automation has specific advantages for improving the long-term efficiency of a software team’s testing processes.As we can save the time special for the regression test.What is more,it is trivial for the tester if repeat the same test case.

Selenium

  • Start from Selenium IDE:
  • Selenium IDE is a plug-in for FireFox,and isn't available for other browser.

    It provides an easy-to-use interface for developing and running individual test cases or entire test suites.

    Selenium-IDE has a recording feature,then can export the code in several kinds of language.

    Right now,give a example for how to use it.

    Suppose we want to login Gmail:

    Open the FireFox browser,click the "Tools" tab,then you can see the "Selenium IDE" is in the list,click it and will pop up a window as following:

    Selenium IDE 1.0.7

    Then back to the FireFox browser,open google home page and click the "Gmail" link,then fill info and press "Sign in" button.

    Turn to the Selenium IDE again,all the actions are recorded,see the following screenshot:

    Record_login_gmail

    Click the red round button in the upper right corner to stop the record.The browser will execute the action what you did just now when hit the green triangle button.

  • Selenium RC:
  • Selenium IDE can only run the test in FireFox.Obviously,this is not enough.So we must mention Selenium RC.

    We can export the code and apply the test in others browser through Selenium RC.

    It is simple to export the code in Selenium IDE,view the picture:

    export_code

    Usually,the exported code isn't perfect.Luckily,Selenium-RC allows the test automation developer to use a programming language for maximum flexibility and extensibility in developing test logic.

    It provides an API and library for each of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC with a high-level programming language to develop test cases also allows the automated testing to be integrated with a project’s automated build environment.

  • Selenium Commands:
  • Contain three parts:Command,Target and Value

    Just give the simple explanation here

    Command:What you want to do for the browser.Such as,"click" a link,"fill" the textarea and so on.

    Target:Tell the browser which element you want to execute the command.

    Value:The value that you want to fill or expect.Sometimes it is blank.It depends what kind of command is used.

    Watir:

  • Introdution
  • Watir is an open-source library for automating web browsers.

    It is a family of Ruby libraries but it supports your app no matter what technology it is developed in.

    It drives browsers the same way people do. Watir also checks results, such as whether expected text appears on the page.

    Watir supports multiple browsers on different platforms.

    Windows 2000/2003/XP/Vista/7 : IE6,IE7,IE8 and FireFox

    Mac:FireFox and Safari

    Ubuntu:FireFox

  • Install Watir
  • Install watir on different system is not the same.I just describe how to install it on Mac for Safari.

    You have to install Ruby first,we recommend using Ruby 1.8.6 on all platforms.

    The type the following commands in Terminal:

    $ sudo gem update --system
    
    $ sudo gem install rb-appscript
    
    $ sudo gem install safariwatir
    

    A moment later,the following info appears and indicates the Safariwatir is installed successfully.

    $ sudo gem install safariwatir
    Successfully installed safariwatir-0.3.7
    1 gem installed
    Installing ri documentation for safariwatir-0.3.7...
    Installing RDoc documentation for safariwatir-0.3.7...
    
  • Use Safariwatir step by step:
  • We also choose the Login Gmail as example so that it is easy to compare what is different between Watir and Selenium.

    Open your Terminal and start irb.

    $ irb
    

    Before going to the Google,you have to let Ruby know you want to use SafariWatir,so please type:

    irb(main):001:0> require "rubygems"
    => true
    irb(main):002:0> require "safariwatir"
    => true
    

    Then start the browser

    irb(main):003:0> safari=Watir::Sfari.new
    => #, @app=app("/Applications/Safari.app"), @document=app("/Applications/Safari.app").documents[1]>>
    

    Go to Google:

    irb(main):004:0> safari.goto "http://www.google.com"
    => nil
    

    Click the "Gmail" link in the upper left corner:

    irb(main):005:0> safari.link(:text,"Gmail").click
    => nil
    

    After flowing to the login page,you can fill personal info and hit "Sign in" button to login.

    To do this, we have to find out some attribute of text field, like id or name, so Safariwatir can find it on the page. We will use Firebug for the first time.

    irb(main):006:0> safari.text_field(:id,"Email").set("ruby@gmail.com")
    => :missing_value
    irb(main):007:0> safari.text_field(:id,"Passwd").set("ruby")
    => :missing_value
    irb(main):008:0> safari.button(:value,"Sign in").click
    => nil
    

    If the username and password are correct,you should login successfully.

    Compare

  • Convenience
  • Selenium IED can record the acitons and export the code,so can save lots of time for the script developer.Watir doesn't have this tools,all the codes have to be typed by hand.

  • On different system
  • Mac OS X:

    Developers still need to strive for Safariwatir and Firewatir,as lots of commands that works fine in Windows cannot apply in Mac.What is more,performance isn’t stable.

    However,Selenium can resolve all the issue that watir is unable to deal with.

    So watir is not good as Selenium on Mac.

    Windows:

    Use selenium to test IE is not the same as FireFox in Mac.Especially for the locator,running the script will be very slow if the locator isn't suitable.

    Originally developed watir is to apply on IE.Until now,it is perfect.

    Posted by 钟宇平 10 Jun 2010 at 09:29AM


    Start a new project and push to remote git repo

    Like many folks out there, we have been making the switch to git from svn. Although we struggled with git early on, after using both for some time I have come to appreciate the benefits of git. So here is our way of starting new projects with git.

    Using gitosis on our server, we create an empty remote repo first. Then, one guy gets the project going and pushes the code into the empty repo. Here are the commands to get that going.

    $ cd path/to/new/project
    $ git init
    $ git add .
    $ git commit -m 'initial commit'
    $ git remote add origin git@devserver.com:newproject.git
    $ git push origin master
    

    Posted by adevadeh 25 May 2010 at 08:09AM


    Office Assistant Wanted

     

    Kudelabs is hiring!

    We are currently accepting applications for an entry level position in our Admin department. If you are looking for an exciting job in a fun environment, apply now! Send us your resume; we will contact your for an interview if we want to meet you. Please do refer to our submission guidelinesGood Luck!

    Posted by adevadeh 12 May 2010 at 06:43AM