This is helpful to have the single login for multiple level domains. Edit your environment configuration and add something like this; (E.g in environment.rb or production.rb) config.action_controller.session = {:domain => “.arthurneil.com”, :key => ‘_arthurs_session_id’, :secret => ’4gfsdf234jmfv35ksdf23m44m4m4neserf345′} Likewise, to target the cookies based on particular domain, try; (E.g) cookies[:my_test_cookie] = {:value => “test”, :expires => [...]
Posts Tagged ‘programming’
Domain based sessions and cookies [Ruby on Rails 2.2+]
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails on July 14, 2009 | Leave a Comment »
Static and Dynamic Libraries
Posted in Java, tagged lessons, programming on January 17, 2009 | Leave a Comment »
Static Libraries Historically, libraries could only be static. A static library, also known as an archive, consists of a set of routines which are copied into a target application by the compiler, linker, or binder, producing object files and a stand-alone executable file. This process, and the stand-alone executable file, are known as a static [...]
Compiler and Interpreter
Posted in Java, tagged lessons, programming on January 17, 2009 | Leave a Comment »
Compiler A compiler is a computer program (or set of programs) that transforms source code written in a computer language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program. [...]
Rails Migration symbols – Data Types
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails on December 4, 2008 | Leave a Comment »
Migration column type… Converts to MySQL field type… Available options :binary TINYBLOB, BLOB, MEDIUMBLOB, or LONGBLOB2 :limit => 1 to 4294967296 (default = 65536)2 :boolean TINYINT(1) – :date DATE – :datetime DATETIME – :decimal DECIMAL :precision => 1 to 63 (default = 10) :scale => 0 to 30 (default = 0)3 :float FLOAT – :integer [...]
Better Exception handling
Posted in Ruby on Rails, tagged programming, Ruby on Rails, tips on November 20, 2008 | Leave a Comment »
The first thing is, we can have something like inline exception handlers. rescue_from ActiveRecord::RecordNotFound do render :file => ‘/bad_record’, :status => 404 end Block can even take have an argument for exception object. rescue_from ActiveRecord::RecordInvalid do |exception| render :action => (exception.record.new_record? ? ‘new’ : ‘edit’) end The above method will be helpful if we use [...]
Running Rails code through cron job
Posted in Ruby on Rails, tagged lessons, programming, Ruby on Rails, tips on November 20, 2008 | Leave a Comment »
Rails comes with a script/runner script that can be used to run the code in your Rails app. There’re many ways to organize your code to let this runner script execute it, but one obvious way is to write the code as a model’s action. Here are quick steps for doing this: 1. Insert the [...]
Why Rails?
Posted in Ruby on Rails, tagged funs, lessons, programming, Ruby on Rails, tips on October 24, 2008 | Leave a Comment »
Inspect Javascript Object
Posted in Javascript, tagged javascripts, lessons, programming, tips on October 21, 2008 | Leave a Comment »
function inspect_object( obj ) { var str = ”; for( var memb in obj ) str += memb + ‘ = ‘ + obj[memb] + ‘n’; alert(str); return str; }