For Dummies Stress Test Using JMeter in Rails 4 + Ruby 2.2

jmeter generated by ruby-jemer

Read on →
Comments

HowTo Performance Test in Rails 4

Inspired by

  1. PERFORMANCE TESTING RAILS AGAINST REAL DATA

  2. Performance Testing

  3. http://railscasts.com/episodes/368-miniprofiler

Read on →
Comments

Sign Up by Devise and Crop User Avatar Then Upload by Carrierwave Using Ruby on Rails

ref:

  1. http://railscasts.com/episodes/182-cropping-images-revised
  2. http://stackoverflow.com/questions/12762728/how-to-crop-image-on-upload-with-rails-carrierwave-and-minimagick
  3. https://coderwall.com/p/e9d_ja/using-carrierwave-uploader-for-tableless-model-in-rails
  4. http://stackoverflow.com/questions/24262388/carrierwave-processing-only-after-the-model-has-been-saved-model-id-is-nil

What I done in this article

1. Click Upload Image

Step 1. click_upload_image

2. Choose Image And Preview

Step 2. choose image and preview

3. Edit Avatar And Preview Image Synchronously

Step 3. Edit Avatar And Preview Image Synchronously

4. Upload to AWS S3

Step 4. Upload to AWS S3

5. Image Cropped And Uploaded

Step 5. Image Cropped And Uploaded

Read on →
Comments

String Handling Between JavaScript and Ruby

javascript 在做 escape 時,編碼出來的字,和Ruby的 CGI.escapeURI.escape 是不同的!

舉例來說:

browser console下

escape("台中市")
> "%u53F0%u4E2D%u5E02"

但是在rails c

CGI.escape("台中市")
> "%E5%8F%B0%E4%B8%AD%E5%B8%82"

Why?

Read on →
Comments

機器監控不求人 - 猴子都會用的 Monit(Monitoring Your Ubuntu Machine for Dummies)

你是個前端工程師,但是,老闆賦予你MIS的神聖任務

還是,你是個後端工程師,無時無刻,要去看一下mysql是否還活著,apache2是否快掛了

還有,你是個全端工程師,雖然你已經強的跟神一樣,但是你就是不想要寫的script自動去重啟的service

這時候,你需要的是Monit

他可以幫你監控你的daemon processes、檔案系統、Network、Space

如果想要看完整的設定文件請點 Monit Documentation

整理一下,我的使用的感覺

  1. 使用DSL,所以用起來很直覺
  2. 使用 # 當作註解
  3. 不同的監控,可以有不同的動作(ex: alert, restart, stop, UNMONITOR)
  4. 彈性設定時間來監控
  5. 彈性設定幾次重啟後,就不要再重啟了
  6. 可以用if, else …等來做動作判斷!
  7. 提供網頁GUI,讓你很好的操作或是看伺服器狀態!
  8. 簡單來說,超多客製化應用!網路上也滿多資源可以參考!

但是,如果你跟我一樣是個懶人,這時候,你就需要看這篇文章

Read on →
MIS
Comments

[Ruby on Rails] Send Limited Mail on Staging Environment

For simulating production environment, we will build up a stage machine.

Plus, we usually use the copy of production database in stage server.

In some applications, we will send email to users for some purposes such as confirmation mail after user

register, reset password mail…etc.

And, in staging environment, we have to avoid our operators accidentally send email to real users.

Therefore, we have to implement some codes for filtering.

Let’s go

Read on →
Comments
Google Analytics Alternative