Posts under ‘Ruby on Rails’

Client HTTP Caching in Rails

HTTP Cache is a browser Cache. HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches. This kind of cache used for reduce request times and bandwidth. more info. Let’s talk about its principle. The Browser start a request. When request reach Web Server. the web [...]

Dynamic add class method in (class << self; self; end)

1  @person = Person.new As you know, @person is a instance object of Person, in the other words @personal.class is Person. but do you know who is Person.class? sure, it’s Class, so we can say Person is a Class’s “instance object”. Next, we add some class methods to Person by difference ways. 1234567891011121314151617181920212223242526class Person   [...]

Deploy dozens of rails applications into one domain

We eventually have more than 30 rails applications running. Back to the days when we had only 3, we deploy each to a separate domains: 123    app1.example.com     app2.example.com     app3.example.com They are beautiful. But, the 3 apps actually working together to do one big task. It would looks better to be [...]

Handle Exception

In our system, we handle exception by default way, it always return 500.html or 404.html page when some errors occurred, but we can custom it. 12345678910111213class ApplicationController < ActionController::Base       private       def local_request?      false   end           def rescue_action(exception)         if [...]

A Survey Solution Based On Ruby on Rails

I’ve been always looking for a powerful and flexible survey solution for a while, now I find it : Surveyor. What’s a Survey? Here is a brief look at the similarities and differences between forms, surveys, questionnaires and quizzes. Forms are a series of fields to be filled out by a user. Some forms are highly [...]

Story Garden Meetup

时间:2010年7月24日晚上,18: 30入场,19:00开始 地点:奇遇花园咖啡馆(问路电话010-88320741) 地址:西直门北展北街9号华远企业号(华远地产)D座一层(地图) 演讲题目: Ruby On Rails : How To Disassemble One Monster App Into An Ecosystem Of 30 [点击下载演讲文档PDF] 内容简介: 1. Why to split single applications into many? 2. How to keep consistent user experience? 3. How do applications share data? 4. Best practices for higher productivity. 5. How to split and measure [...]

bowline

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 [...]

Learn from Renren API

Been working on Renren Connect application for a while, when talking about its API, I think every coin has two sides, so let’s see its sides: A(davantage) side : 1. Configure cross domain file to resolve JS cross-domain issue between application domain and renren domain. Not sure if a similar solution can solve our ajax [...]

JS tips

TIPS: * Select all checkbox. 123456789101112131415<script type="text/javascript">// <![CDATA[   function SetAllCheckBoxes(FormName, FieldName, CheckValue)   {     if(!document.forms[FormName])       return;     var objCheckBoxes = document.forms[FormName].elements[FieldName];     if(!objCheckBoxes)       return;     var countCheckBoxes = objCheckBoxes.length;     if(!countCheckBoxes)       objCheckBoxes.checked = CheckValue;     else     [...]

Ruby Design Patten — Command patten

Share a design patten: Command patten. Migration in Ruby On Rails is a good example of Command patten. Bellow is code about how to create a Command patten in Ruby. The code bellow defined CreateFile and CopyFile two classes, use Command patten and Composite patten log requests, and support undoable operations. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374class Command   attr_reader [...]