- Rails 3.1 is significantly different both from rails2 and from rails3.0, so that you should read it if you want to catch up latest rails.
- In this book, all samples are written with Ruby 1.9 - there is no exaggeration that Pragmatic Programmers recommend using Ruby 1.9.
- In this book, MinGW is introduced as Windows Environment - there is no exaggeration that Pragmatic Programmers recommend using MinGW .
Tuesday, November 29, 2011
I've finished reading "Agile Web Development with Rails 4th edition"
I've finished reading Agile Web Development with Rails 4th edition.
Saturday, November 26, 2011
Tips for MongoDB cache store and assets on Rails 3.1
(continued from phosphorescence: How to use MongoDB as model, session store and cache store on Rails3)
So we should configure to cache page caches, action caches and fragment caches, and not to cache assets at all. Referring these two sites(1 2), we can do it by editing config/environments/production.rb like below:
MongoDB cache store does not accept binary cache
Rails3.1's cache feature caches all – page caches, action caches, fragment caches and caches for files called assets(JavaScripts, stylesheets and images). All these are cached in default. But MondoDB cache store we have chosen in previous article is only supporting to cache text files. In other words, MongoDB cache store accepts JavaScripts and stylesheets, but does not accept images.So we should configure to cache page caches, action caches and fragment caches, and not to cache assets at all. Referring these two sites(1 2), we can do it by editing config/environments/production.rb like below:
require 'rack/cache'
........
# Prevent caching assets
config.middleware.insert_before Rack::Cache, ::ActionDispatch::Static, 'public', config.static_cache_control
........
Thursday, November 24, 2011
How to use MongoDB as model, session store and cache store on Rails3
When we use rails3 as out-of-the-box, we implicitly choose ActiveRecord for model, Cookie for session store and on-memory for cache store. But we can choose MongoDB for all of them. I start to explain these ways one by one.
Monday, November 21, 2011
Mono Project is looking for answers to the questionnaire
Labels:
Mono
On download page of Mono project, they are looking for answers to the questionnaire. In current status, Mono project faces to mobile products, and less facing to existing products and features. So, if you want to run ASP.NET MVC, F# and so forth on Mono Framework in the future as same as current, please visit the site and appear with answering the questionnaire.
On download page of Mono project
On download page of Mono project
Friday, November 18, 2011
openSUSE 12.1 has been released - for new UXs
Labels:
openSUSE
2 days ago, openSUSE 12.1 has been released (see this post). This is not only the release for latest packages but also the release for new UXs.
New Installation Experience
If you want install from openSUSE 11.3 or former one, or want to clean-install, download and use install media as you done before. But if you want to install from openSUSE 11.4, you can update with this approach. Of course, it's easy.New Cloud Experience
openSUSE 12.1 supports cloud solution - named "OwnCloud". You can seemlessly use Dropbox, Ubuntu One, Facebook and so forth via OwnCloud.New Backup Experience
openSUSE 12.1 also supports "Snapper" - the backup system with using snapshot feature of btrfs. If you want to use this feature, you should use btrfs file system.Comparison with OS X Lion
IMO, these UXs are corresponding to OS X Lion's ones.openSUSE 12.1 | OS X Lion | |
---|---|---|
Update Experience | easy to upgrade from openSUSE 11.4 | easy to upgrade from OS X SnowLeopard |
Cloud Experience | OwnCloud | iCloud |
Backup Experience | Snapper | Time Machine |
Tuesday, November 15, 2011
Sample for uploading file in Rails3 way on AWDwR 4th chapter21
At page 348 on Agile Web Development with Rails 4th edition chapter21 (ActionView), there are samples for uploading file. But, these are totally in Rails2 way. So I re-write in rails3 way.
migration file : same as on the book
Model
> rails g model Picture comment:string name:string content_type:string data:binary
migration file : same as on the book
Saturday, November 12, 2011
Rails3's form helpers are ready to HTML5 input types
On Agile Web Development with Rails 4th edition chapter21 (ActionView), I learn the fact that Rails3's form helpers are ready to HTML5.
There are no form helpers corresponding neither input types related with date or time, nor input type related with color ( type="color" ). I could understand date time ones will be integrated in helper methods like date_select in the future, but could not understand where is color form helper.
IMO, Opera browser is the most advanced browser implementing HTML5 input tag, so that you should check those form helpers on Opera browser.
Form helper of Rails3 | Corresponding HTML5 input type |
---|---|
search_field | search |
telephone_field | tel |
url_field | url |
email_field | |
number_field | number |
range_field | range |
There are no form helpers corresponding neither input types related with date or time, nor input type related with color ( type="color" ). I could understand date time ones will be integrated in helper methods like date_select in the future, but could not understand where is color form helper.
IMO, Opera browser is the most advanced browser implementing HTML5 input tag, so that you should check those form helpers on Opera browser.
Thursday, November 10, 2011
mini_magick - A better RMagick alternative
Labels:
ImageMagick,
Ruby
Unfortunately, RMagick has been a vaporware despite new developer had been inherited from former one. There are less activities. So that we should seek its alternative. The better one is mini_magick.
For example for POSIX:
(Since the end of 2011, we can write the same codes both for POSIX and for Windows. Please check this article.)
For example for Windows:
Because of the bug both in mini_magick and in subexec, the developer using Ruby 1.9.x on Windows should write the mantra MiniMagick.timeout = milliseconds
installation
> gem list mini_magick Successfully installed subexec-0.1.0 Successfully installed mini_magick-3.3
Usage
In short, check readme.For example for POSIX:
require 'mini_magick'
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"
(Since the end of 2011, we can write the same codes both for POSIX and for Windows. Please check this article.)
require 'mini_magick'
MiniMagick.timeout = 42
image = MiniMagick::Image.open("http://www.google.com/images/logos/logo.png")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"
Because of the bug both in mini_magick and in subexec, the developer using Ruby 1.9.x on Windows should write the mantra MiniMagick.timeout = milliseconds
Next version of mini_magick and subexec
As you see the sources on github, next version of mini_magick and subexec fix bugs for running on Windows. So you can write the same codes both for POSIX and for Windows.Monday, November 7, 2011
Install Ruby goodies for ruby 1.9.3 on Windows
If you install Ruby 1.9.3 on Windows from source, there are two lacked features - readline and debugger. This article introduces using these features in Ruby 1.9.3 on Windows.
readline
If you are a specialist of cygwin or mingw, you may also build readline from source. But, there are an easier way - installing rb-readline.> gem install rb-readlineAnd you should check rb-readline is active like below:
> irb --readline -r irb/completion
debugger
In short: check this post. In more detail, let's do three installation like below:- Download linecache19 (0.5.13 or above) from here, then
> gem install linecache19-0.5.13.gem
at last check that c:/ruby-1.9.3/include/ruby-1.9.1/ruby-1.9.3-p0 is created. - Download ruby-debug-base19 (0.11.26 or above) from here, then
> gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=c:/ruby-1.9.3/include/ruby-1.9.1/ruby-1.9.3-p0
> gem install ruby-debug19
If you want to manage these features in Rails3
Edit for your Gemfile on your app like below:group :development do
gem 'rb-readline'
gem 'ruby-debug19', require: 'ruby-debug'
end
Friday, November 4, 2011
Ruby 1.9.3 p0 has been released
Labels:
Ruby
A few days ago, finally, Ruby 1.9.3 p0 has been released.
If you are a Windows user, you can download installer from here.
If you are a Windows user and if you want to build from source by yourself, let's refer to the instructions written in phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS (Of course, ready for Windows 8 preview).
If you are a Windows user, you can download installer from here.
If you are a Windows user and if you want to build from source by yourself, let's refer to the instructions written in phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS (Of course, ready for Windows 8 preview).
Subscribe to:
Posts (Atom)