Tuesday 18 June 2013

Rails update



Cup.update_all({:broken_handle => true}, {:broken_handle => false})



The first argument are the attributes to update and the second is the filter conditions for the query.


Batches in Rails



a.  find_each
b. find_in_batches

 1.  It's use is intended for batch processing of large amounts of records that wouldn't fit in memory all at once.

2. If we just want to loop over less than 1000 records(which is default batch size), it's good to use the find methods.

3. We can control the starting point for the batch processing by supplying the :start option. This is useful if we want multiple workers dealing with the same processing queue. Say for example if we want worker_1 to handle records b/w 0 to 5000 and worker_2 from 5000 to 10000 by setting :start option on that worker.



Thursday 13 June 2013

Write whatever you feel like

I came across this blog today(13 June 2013) and had the similar kind of writings which I generally think and got my answers to most of it.

http://excid3.com/blog/3-rules-for-becoming-a-better-developer-in-2013/#.UboE-IoW3Zg

Saturday 1 June 2013

Browser

1. When  and what kind of data should be stored in browser.
1. How to store data on browser.