Bowline is a framework for making cross platform desktop applications in Ruby, HTML and JavaScript.

If you’ve ever wished creating a desktop application was as simple as creating a Rails website, Bowline’s for you.

Bowline respects MVC, you can design your views in HTML5/CSS3 – then bind them to your Ruby models. There’s no request/response cycle – any changes in models automatically get reflected in the view.

See : http://bowlineapp.com/

Experiment on this framework:

Requirements:

* Mac OSX >=10.5 or Ubuntu —–> [I am on Ubuntu 9.04]
* Ruby 1.9 —————————–> [I use RVM to switch ruby between different version]
* Bowline gem ———————–> sudo gem install bowline

RVM

* Install RVM to manage Ruby easily, then you decide which version you will use.

OK, Now create an application in an easy way:
>> bowline-gen app helloworld
>> cd helloworld
>> bowline-bundle
>> ./script/run

Unluckily, On Ubuntu 9.0.4, There is an error about a needed lib when I run the application, see
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11′ not found (required by /home/andy/.bowline/bowline-desktop)

I searched around and found it’s something wrong with gcc version, or these is still a webkit lib involved issue under Ubuntu9.0.4, anyway, it’s interesting to me, I am now wondering if we can reference some bowline experience to create iphone/ipad application based on ruby on rails. not sure, I am researching in advance.

I’ve read RenRen development Doc and tried some simple feature for a while, its platform is interesting and exciting, but much of its document is out of date(I guess it’s not been maintained for a time). so there are pains to test most of its APIs, here I will roughly introduce what we can do based on RenRen open platform.

First of all, RenRen platform supports five types of APPLICATION, which are:
– RenRen Canvas. It means application/content is embedded in RenRen’s web container via XNML/IFrame/OpenSocial-Gadget etc.
– Mobile Wap application.
– RenRen Connect. It means an external website is connected to RenRen, the two sites can share many different infos according to the channel/bridge API.
– Desktop Application.
– Mobile Client Application.

Obviously, RenRen Connect is what developer need upon first step. So the question is how does it work? Follow me, I will go through the imagined application to show what feature developer can build according to RenRen connect API, now go:

1. Tom is a RenRen user, he just find an “application” which tells him he can improve his oral English, that’s interesting, he clicks it in order to add the application to his list.

2. Then he find EQenglish.com, he uses his RenRen account to login EQenglish, He find he can order an speaking evaluation for free on the website, and what’s more, he even can push this message and/or the study status to his RenRen friends.

3. Tom goes through EQenglish website to check EQ learning methods, He can easily share the web page to his RenRen friends.

4. Andy is an EQenglish user, he bundles his EQ account and RenRen account on EQenglish website, so he can push his study status to his RenRen friends.

5. Andy finally buy a course, then all EQ learners who have RenRen accounts can receive an email/notification, in which it broadcasts “Andy buy a course ***” something like that.

6. Once Andy discussed an EQ lesson, his comments is synced to his RenRen status, all of his Friends there can see his status.

7. Tom finds Andy’s EQ profile via the discussion thread, the surprise is Andy’s is his School mate, they have the same IELTS exam time. They connect with each other on RenRen.

8. What’s more, Tom finds a section in EQ website, He can pick up all his Friends list, and suggest them to use EQ service. Also aside the lesson discussion thread, there is a live stream box connecting to RenRen page. so He can easily comment with friend..

Etc..

Above is a rough introduction of RenRen connect feature developer can build(it is based on RenRen connect’s API, not just my imagination).Click here to review RenRen Conncet Production Description.

一直关注XDite的blog,他写的关于Rails的文章总是能让我从中受益。看见他写的Ruby on Rails的入门书单与练习作业,感觉非常的精炼,这个post很适合当作Rails新手的入门指导,鉴于此,我也把它推荐给Team,用来培训新入职的Rails developer. 在这里谢谢XDite老师 :)

以下为全文转载,原文链接请点击此处

==================================================

學習 Ruby on Rails 最快的途徑無非是直接使用 Rails 撰寫產品。而這個過程中若有 mentor 指導以及 code review,學習進度也會加速不少。

但現實生活中並非如此理想,

第一,並不是每個人都有每天必須要以 Rails 撰寫產品的壓力(not a Rails Developer)。

第二,沒有循序漸進的入門途徑以及沒有 mentor。(Framework 進展太快,導致現有書籍版本跟不上進度,另外具有經驗的 mentor 太少,有的話也沒興趣回答過於初階的問題)

最近幾個月都在訓練 Rails Developer,零碎的東西講了不少遍。懶得一次次重講基礎的東西和開訓練菜單,乾脆整理成文字,以後新人就直接看這篇…

新人需要具備的「一般」基礎技能:

  1. 對 Git 的觀念與技巧掌握。
  2. 對 VIM / Textmate 的基本開發技巧掌握。
  3. 熟悉 Linux Command Line 的操作。

* Git

書單

Peepcode 的 GitPro Git

練習

上 Github 開啟一個專案,練習 git commit , git push , git pull, git branch , git checkout , git merge

* Editor

書單

c9s 的 VIM Hacks 與 Oreilly 的 精通 vi 與 vim 與 Pragmatic 的 TextMate: Power Editing for the Mac

練習

vgod 的 給程式設計師的Vim入門圖解說明 全部練習一遍

* Linux CLI

書單與練習:

Peepcode 的 Meet the Command LineAdvanced Command Line 全部練過一遍

=====

新人需要具備的 Rails 基礎技能:

  1. 可手刻 CRUD ( Create / Read / Update / Delete ) 並且理解 CRUD 中的 params 傳遞方法
  2. route 中 resources 觀念配合 model 裡 has_many 的設計,理解並熟悉 RESTful 觀念。
  3. route 的優先順序與 routes 中 resource / namespace 的實作。
  4. named_scope 、 counter_cache、before_filter
  5. plugin 的使用:restful-authenticationwill_paginatepaperclip
  6. rake 原理以及撰寫 task
  7. ruby on rails 的 production setup 與撰寫 capistrano recipes

書單:(案頭必備)

Ruby Programming — 向 Ruby 之父學程式設計
Ruby for Rails – Rails 開發者必備的 Ruby 學習手冊 (英文新版: The Well-Grounded Rubyist )
碼上就會:Rails敏捷開發網站 (英文新版: Agile Web Development with Rails, Third Edition )
The Rails Way
Ruby Pocket Reference
Rails Recipes
Advanced Rails Recipes: 84 New Ways to Build Stunning Rails Apps

線上工具:(必加書籤)

Ruby API : StringArrayHash
APIDock : Ruby on Rails

練習作業:

(1)開發一個簡易論壇系統。系統要有 Forum 與 Post 兩個 model,寫出 CRUD 介面,並且文章網址是使用 http://example.org/forum/1/post/2 這種表示。

吸收觀念:

* CRUD & migration
* has_many 與 belongs_to
* resources 與雙層 resources
* before_filter : find_event

參考資料:

* 深入淺出 RoR (4-3) – RESTful 與 CRUD action
* ihower training : Ruby on Rails 入門

( 2)使用者必須能夠 註冊 / 登入,登入後才可以發表 Post,不然只能瀏覽。只有自己的 Post 才能進行修改與刪除。

吸收觀念:

* routes 優先權與 route alias
* plugin 安裝與使用
* before_filter : login_required
* session : current_user
* attr_accessible / attr_protected

參考資料:

* restful-authentication

( 3)論壇的文章要能夠分頁,每一頁 20 筆,每一個論壇要秀出現在論壇裡有多少 post 數量。可用 params 配合 named_scope 在文章列表排序。

吸收觀念:

* pagination
* counter_cache
* named_scope :recent

參考資料:

* will_paginate
* Railscast : Counter Cache Column
* Railscast : named_scope

( 4)每篇文章可以上傳附件

吸收觀念:

* form_for multipart

參考資料:

* paperclip

( 5)Admin 可以刪改所有文章,建立一個後台做這件事。網址是 http://example.org/admin/。只有身分是 admin 的人可以進後台。admin 的判別方是 column 裡加一個 boolean,判斷是否 admin。這個 attribute 必須用 attr_accessible / attr_protected 保護。

吸收觀念:

* route : namespace
* before_filter : require_is_admin

參考資料:

* Namespaces added to routes

( 6)用 Rake 撰寫自動化步驟,生假資料。寫一個 rake 可以達成以下步驟:「砍 db => 建 db => 跑 migration => 生種子資料」,另一個 rake 是生假文章與假論壇。

吸收觀念:

* rake -T
* rake db:drop ; rake db:create ; rake db:migrate ; rake db:seed
* rake dev:fake ( 自己寫 namespace : dev, 裡面放一個 task 叫做 fake,fake 資料用 Populator 生)

參考資料:

* Ruby on Rails Rake Tutorial (aka. How rake turned me into an alcoholic)
* What’s New in Edge Rails: Database Seeding

( 7)在租來的 VPS 上面建置 Ruby on Rails production 環境,使用 Ruby Enterprise 與 mod_rails。使用 capistrano 佈署 application。

吸收觀念:

* cap deploy:setup , cap deploy , cap deploy:rollback , cap deploy:restart

參考資料:

* rails-nginx-passenger-ubuntu
* AWDR3 的 deploy 章節 , Ruby Pocket Reference 的 capistrano 章節

===

PS. 實際測試的結果是,完全不懂 Ruby on Rails 的新人,從頭帶過大概兩週可以練完這一份作業。

Note: This introduction post to jRails is copied(mirrored) form this link, so that I can bakeup this for advanced learning.

Intro

jRails is a drop-in jQuery replacement for Prototype/script.aculo.us on Rails. Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.

News

jRails 0.4 : jQuery 1.5!

jQuery-UI has just gotten a major update to version 1.5 which stabilizes most of the controls and incorporates the Enchant effects library. jRails follows suit with a single js file for jquery-ui that includes both the modules and effects. The default jRails installation includes a compressed jquery-ui js file that includes the basic modules and effects supported by Prototype/Scriptaculous. There are no modifications to this file, so if you’d like to generate your own with additional modules or effects, just pop on over to the jQuery UI site and customize your own.

This release of jRails also adds support for jQuery.noConflict(). Just uncomment the line in the init.rb file and set it to whatever you like. Now you can use jRails with other libraries without causing problems.

Features

jRails provides drop-in functionality for these existing Rails methods.

    • Prototype
    • form_remote_for
    • form_remote_tag
    • link_to_remote
    • observe_field
    • observe_form
    • periodically_call_remote
    • remote_form_for
    • submit_to_remote
    • Scriptaculous
    • draggable_element
    • drop_receiving_element
    • sortable_element
    • visual_effect
    • RJS
    • hide
    • insert_html
    • remove
    • replace
    • replace_html
    • show
    • toggle

Visual Effects

These are the current effects that are included by default in jRails.

Appear

Fade

Puff

BlindDown

BlindUp

BlindRight

BlindLeft

SwitchOff

SwitchOn

SlideDown

SlideUp

DropIn

DropOut

Shake

Pulsate

Squish

Fold

FoldOut

Grow

Shrink

Highlight

How to use

Just install and go! Once installed, the previous Prototype/script.aculo.us helpers will be replaced by jQuery ones. In order for them to function correctly, just include the appropriate javascript files in the head of your page.

<script src="/javascripts/jquery.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui.js" type="text/javascript"></script>
<script src="/javascripts/jrails.js" type="text/javascript"></script>

You can also use the Rails javascript_include_tag helper with :default to load them automagically.

<%= javascript_include_tag :defaults %>

Install

To install the jRails plugin:

./script/plugin install git://github.com/aaronchi/jrails.git

Then copy the javascript files in the plugin folder to your javascripts directory.

Changelog

  • : Initial Release
  • : Major Effects Updates
  • : jQuery Enchant
  • : jQuery-ui 1.5 and jQuery.noConflict support

Contact

You can post to the jRails group forum and I’ll get back to you as soon as I can

Comments, bug reports and feedback are welcomed. I’m also considering developing a similar library for MooTools so if you are interested, please let me know.

Last few days, I worked for a mission to add more flexible control to our website landing pages. What I did is to add a “a/b” test feature for new landing pages, that means, if people have two designs and want to compare the results, they only release two versions of landing page, and then only get one url for the two versions of pages, after that the url will automatically redirect to different versions evenly, so that through Google analytics marketing people can easily decide which landing page is much better.

Landing pages A/B test solution:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class LandingsController < ApplicationController
  layout "layouts/blank"
  caches_page "ielts","ab_test"

  def ielts
    @landing_page = Landing.find_by_url_slug(params[:url_slug]) || Landing.valid_landings.first
    if @landing_page.ab_test?
      if not params[:channel].blank?
        redirect_to landing_ab_test_with_channel_path(["a","b"].rand,params[:url_slug],params[:channel])
      else
        redirect_to landing_ab_test_path(["a","b"].rand,params[:url_slug])
      end
    else
      render :layout => "layouts/landing_page"
    end
  end

  def ab_test
    @landing_page = Landing.find_by_url_slug(params[:type].to_s + "/" + params[:url_slug].to_s)
    (@landing_page = Landing.find_by_url_slug(params[:url_slug]) || Landing.valid_landings.first) if @landing_page.nil?
    render :layout => "layouts/landing_page"
  end
end

Routing:

1
2
3
4
   map.landing_trunk "ielts/:url_slug", :controller => "landings", :action => "ielts"
   map.landing_trunk_with_channel "ielts/:url_slug/:channel", :controller => "landings", :action => "ielts"
   map.landing_ab_test "ielts/sub/:type/:url_slug/", :controller => "landings", :action => "ab_test"
   map.landing_ab_test_with_channel "ielts/sub/:type/:url_slug/:channel", :controller => "landings", :action => "ab_test"

A/B test Sample:
Suppose:
We release a type of landing page called : university
And we have two kinds of different designs : called “a/university” and “b/university”
Then we may release the landing page to many universities, such as “beida”, “renda”, “qinghua” etc.. they are different channels.

Then we can:
Only release the url as “http://www.eqenglish.com/ielts/university” to any universities by following “/beida”, “/renda”, “/qinghua” etc…
It should be like this “http://www.eqenglish.com/ielts/university/beida”, “http://www.eqenglish.com/ielts/university/renda”… etc.. (For client use)
But in google analytics, you will see : “http://www.eqenglish.com/ielts/sub/a/university/beida”
and : “http://www.eqenglish.com/ielts/sub/b/university/beida” (For our analysis)

It means, different landing page and different channel and (“a” or “b”) will be in a unique URL for certain purpose. but for our client, they don’t need to care about “a/b” test, system will redirect pages automatically.

Any involving comments are welcomed.

Actually,
I don’t know how fantastic Formtastic is before this afternoon, I used it to refactor my form and it’s pretty cool for me to wrap up all the massive code which I hate as always. Now every form is becoming nice.

Some relevant and useful additions about Formtastic:

SASS-stylesheets – for even more pretty styled forms in all browsers (mixins for different form layouts, etc.)
http://github.com/activestylus/formtastic-sass

TextMate-bundle for Formtastic:
http://github.com/grimen/formtastic_tmbundle

In-place editor for Formtastic:
http://github.com/rubymood/jintastic

Client-side validations that is compatible with Formtastic markup:
http://github.com/grimen/validatious-on-rails

© 2011 Refactoring Thoughts Suffusion theme by Sayontan Sinha
普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress