Today I am trying to use CarrierWave to convert image’s format, from png to jpg, then I MiniMagick::Invalid error. When I use command line tool to detect the format, it shows “identify: no decode delegate for this image format `xxx.png’ @ error/constitute.c/ReadImage/544.” After I googled a litte while, I found “convert -list configure” command could show all image processing delegate, like “DELEGATES bzlib jpeg jp2 lcms tiff xml zlib”, then it miss PNG, so after I use “brew tap homebrew/versions/libpng12”, it works then.
31 Jul 2012
Today I suddenly got an error on website, it said there is one gem doesn’t been installed somehow. but when I ssh to server, use
bundle install, found both server was installed all gems that application needs.
Finally I got the reason, the passenger doesn’t loading the gems correctly from bundler, so you have to run bundle install like this way
bundle install --deployment. This installation will move all gems to “vendor/bundle”, which will freeze all version of gems into the project.
For capistrano, add below lines into deploy.rb file:
set :bundle_roles, [:app] require 'bundler/capistrano'
19 Jul 2012
Haven’t been working on latest version of Xcode so far, today I tried to use it found many things are different.
You have to add Files to “Compile Sources” List in Build Phases.
You have to add “-fno-objc-arc” for files which no need support ARC.
You have to add the “xib” or “nib” to the “Compile Sources” also.
You should not drag .h files into “Compile Sources”.
Font or some images you have to add them into “Copy Bundle Resources”.
18 Jul 2012
Today I got a very strange problem when I using carrierwave, When I upload some pictures and the form validator told me some fields need to be filled, then I fill them and submit the form again, the uploaded file supposed to be cached, but it randomly told me some file supposed to be cached are missing.
After investigate a little bit I found I have 2 servers, and the cache file only stored on one of the server, so when request goes to another server which doesn’t has cache file, it will report no file uploaded.
For solving this, I just mount one directly to another server, make the cache directly the same.
On NFS server side:
sudo apt-get install nfs-server portmap nfs-common
On NFS client side:
sudo apt-get install nfs-client nfs-common
Add below line to
Mount the directory on another server:
sudo mount -o soft,intr,rsize=16384,wsize=16384 server_ip:/path_to_tmp_folder/tmp /local_path_to_empty_tmp_folder/tmp
Add below line to /etc/fstab, this is for auto mount when server reboot:
server_ip:/path_to_tmp/tmp /local_empty_folder/tmp nfs rsize=16384,wsize=16384,rw,auto,nolock
12 Jul 2012