2016年2月29日 星期一

Tesseract-ocr gem install on mac os x

https://github.com/meh/ruby-tesseract-ocr



http://stackoverflow.com/questions/32179402/tesseract-ocr-gem-issue-on-mac-os-x

Tesseract developers changed quite some stuff in version 3.0.4 and tesseract-ocr gem lost compatibility with it. The best solution I see is to downgrade for now. You may have previous versions of Tesseract installed on your mac, use brew info tesseract to find that out. If so, just use brew switch. I did brew cleanup recently, so I had to uninstall tesseract and install it from the old formula, like so:
$ brew uninstall tesseract
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew/8ba134eda537d2cee7daa7ebdd9f728389d9c53e/Library/Formula/tesseract.rb
This will install Tesseract 3.02.02_3d that seems to be working. You can find more info and track this issue at tesseract-ocr repo.




http://alangunning.ie/2013/01/13/how-to-install-tesseract-ocr-on-a-amazon-ec2-free-tier-linux-machine-for-optical-character-recognition/

install Tesseract OCR on a Amazon EC2 (Free Tier) Linux Machine for Optical Character Recognition

2015年7月23日 星期四

2015年6月27日 星期六

growth hack

Landing Page的要點有:精簡形容服務、使用幾大好處、使用示意、使用者見證、引誘註冊/購買和免費註冊/退款

保證


index > post (w/o login ) > landing page










A/B testing是在這裏第一次聽到的名詞,用來比較哪一種UI/作法/model效益更大,有了好的測量工具可以讓我們快

樂的使用效益最大的那一種。



Q&A


Acquisition, Activation, Retention, Referral, Revenue
  • Acquisition : 從多個管道曝光
大多數人對於增進 Acquisition 的想法是下廣告,或者 SEO。這叫 Acquisition。
增強 Acquisition 的手法不外乎是經營粉絲團,下 FB 廣告,寫很好的 FB 廣告或一般廣告流量,改善 open graph 上的標題與資訊,搜尋引擎上的文案。
  • Activation : 註冊帳號使用第一次
  1. 消費者不知道你提供什麼服務,不願意註冊
  2. 消費者不懂 How it works,不願意註冊
  3. 消費者有一些疑問,不知道怎麼樣繼續詢問下去,就不願意註冊
  4. 消費者不知道你的來歷,註冊了帳號卻不願意把信用卡資料填上去。
這就是設計一個 Landing Page 的重要性。Landing Page 是「使用者著陸的第一個頁面」。它可以是首頁,或者是 Referral 頁面,或者是搜尋引擎給到的第一個頁面。
  • Retention : 留住客戶繼續用很多次
有時候你註冊外國網站 SaaS,幾天後 Founder 有時候會親自寫信給你。(或者機器偽裝 Founder 寫信給你)。
目的是要查看使用者為什麼卡住了,為什麼不繼續用。或者有什麼疑慮我們可以協助排除。
付錢的 Retention,則是比如說提供 Daily new deal promo,或者是 Loyalty program....etc.作一些互惠的活動,來保持使用者繼續回訪。
  • Referral : 介紹朋友也一起用這個 Service
Referral Program 當然不只有設計 Referral Code 這麼膚淺。好的 Referral 如 Airbnb 與 Dropbox 都有相當好的循環獎勵設計。這也是位什麼他們的 user base 瘋狂成長。
比如說 Airbnb 在 Referral Landing, 獎勵, 與介紹就做的相當好。Dropbox 則是擅長辦競賽以及 online quest。
  • Revenue : 從客戶上賺到錢。

2015年6月18日 星期四

Errbit


http://morizyun.github.io/blog/errbit-heroku-rails-error-ruby/

https://github.com/errbit/errbit/blob/master/docs/deployment/heroku.md

Download the source of Errbit locally.


One
git clone http://github.com/errbit/errbit.git

Run Bundle install Following.


One
bundle install

db / seeds.rb Fixed login settings.


1 
2
admin_email  =  "ie: xxx@example.com" 
Admin_pass   =  'password'
One
heroku create xxxx

Then do the Enabling and various settings of the add-on.


1 
2 
3 
4 
5 
6 
7 
8
 heroku addons: create Mongolab: sandbox
 heroku addons: create Sendgrid: Starter
 heroku config: create heroku = truebundle EXEC rake secret heroku config: create SECRET_TOKEN = "$ (bundle EXEC rake secret)" 
replaced with the host name that has been created by the # heroku create
 heroku config: set ERRBIT_HOST = Xxxx.herokuapp.com
 # error mail From (Recommended is given to the distribution and easy addy)
 heroku config: set ERRBIT_EMAIL_FROM = example@example.com

When you have finished setting screen, then push to heroku.


1 
2
git add. -A && git commit -m 'first commit'
 git push heroku Master

In addition, it allows you to load the seed file (initial setting data of the DB).


One
heroku run bundle exec rake db:seed RAILS_ENV=production

Add the index to mongo DB.


One
heroku run bundle exec rake db:mongoid:create_indexes RAILS_ENV=production

after that when you run the following command, you will see the page of errbit in your browser.


One
heroku open


http://blog.8thcolor.com/en/2014/02/get-notified-of-your-rails-app-exceptions-with-errbit/

IN RAILS APP

gem 'airbrake'

create file config / initializers / errbit.Rb


copy paste the the info you got in Errbit > Apps

something likes

Airbrake.configure do |config|
 config.api_key = ENV['ERRBIT_API_KEY']
 config.host    = ENV['ERRBIT_HOST']
 config.port    = 80
 config.secure  = config.port == 443
 config.environment_name = Rails.env.production? ? `hostname` : Rails.env
end



run bundle install after setting down above.

then,
rake airbrake:test

adding
ERRBIT_API_KEY ERRBIT_HOST to heroku



heroku config:set ERRBIT_HOST= 
heroku config:set ERRBIT_API_KEY=


heroku run bundle exec rake airbrake:test





















2015年6月17日 星期三

google maps Google Geocoding API error: over query limit.

6/18 
set timout :5 sec in config/initializers/geocoder.rb



next stwp set sleep
heroku  rake geocode:all CLASS=YourModel SLEEP=0.25 BATCH=100




next next step 

I create pull request based on this answer and now you can use batch in geocoder:
rake geocode:all CLASS=YourModel SLEEP=0.25 BATCH=100
I would use this solution for large database, i take it from geocoder gem rake task: You can refine this for your needs. Some example create rake task:
namespace :geocode_my_data do
  desc "Geocode all objects in my databse."
  task all: :environment do
  klass = User
    klass.where(geocoded: false).find_each(limit: 100) do |obj|
      obj.geocode; obj.save
    end
  end
end

$> rake geocode_my_data:all




Used below code and put it into my lib/tasks folder as geocode_my_data.rake To run:
rake geocode:all CLASS=YourModel
Works great!
namespace :geocode_my_data do
  desc "Geocode all objects without coordinates."
  task :all => :environment do
    class_name = ENV['CLASS'] || ENV['class']
    sleep_timer = ENV['SLEEP'] || ENV['sleep']
    raise "Please specify a CLASS (model)" unless class_name
    klass = class_from_string(class_name)

klass.not_geocoded.find_each(batch_size: 100) do |obj|
      obj.geocode; obj.save
      sleep(sleep_timer.to_f) unless sleep_timer.nil?
    end
  end
end

##
# Get a class object from the string given in the shell environment.
# Similar to ActiveSupport's +constantize+ method.
#
def class_from_string(class_name)
  parts = class_name.split("::")
  constant = Object
  parts.each do |part|
    constant = constant.const_get(part)
  end
  constant
end