blog | Ram Laxman Yadav

blog

How to upload large file to S3 using multipart upload and rubygem 'aws-sdk'

Hello Guys, After a long time I am back with the solution of large file uploads hassle on s3. Many times we face problem in uploading large files to S3. When we try to upload large file to S3, it become more difficult than usual.

How to create sidekiq worker with custom queue

Hello Friends, I am back with new real programming problem. In general practice when we are working with sidekiq and delayed jobs. The problem occurs when we want custom queue with custom sidekiq workers.

How to Wrap hash into nested hash without any root element

Hello Friends, Generally we request a root element in request params, from a rest api. Suppose if you have a REST api for create user with name then you have to give data in format like: {"user": {"name": "somename"}}.

How to solve error: Unquoted fields do not allow or from csv file

Hello Friends, We often use csv upload feature in our rails applications. If you have converted a xls or xlsx file to csv, it might be possible that csv file contains \r\n in it.

How to solve error: file '/grub/i386-pc/normal.mod' not found ubuntu

Hello Friends, We often need to upgrade our ubuntu OS, to get updated and use latest Ubuntu. We might be facing a common problem that the system will be unable to boot normally after install.

Is it possible to have multiple store attributes in a single model

Yes. We can have multiple store attributes in a single table. Here is an example: Create a model: Run rails g model user Change migration as follow: class CreateUsers < ActiveRecord::Migration[5.

How to update an attribute of record without updating updated_at attribute

Hello There, We often need to update the records without make any changes in updated_at column. There are many ways to update a record my rails. You can use any of them.

How to write A base64 encoded image with mimetype in Rails

Hello There, We often need to convert a base64 encoded image to actual image file. It generally happens When we work with apis. Here is an example how can we make a image from base64 encoded string with the actual MIMETYPE.

How to pass parameters in rails callback

Hello There, Today I will discuss how to pass parameters in active record callback methods: Models In models write callback method in following style like class Book < ApplicationRecord #==== Callbacks ========================================================== after_commit :do_something, on: :create after_commit -> { do_something('I am parameterize call') }, on: :destroy private def do_something(params = nil) puts "params" end end # here you can see there is a method named do_something is called with parameters.

Fix/Install graphics drivers in ubuntu 16.10

After upgrading to ubuntu 16.10, I face a problem with graphics drivers. When I connect extended display to the system it start flickering. It’s due to the graphics drivers not proper for ubuntu 16.