Sunday, April 30, 2017

Using whenever gem with Rails

To list what crons are installed:
crontab -e

whenever gem is integrated with Capistrano.

gem 'whenever', require: false

wheneverize .

bundle exec wheneverize .

config/schedule.rb

Add:

every 1.day, at: '4:30 am' do
  rake 'clear_cache'
end

task clear_cache: :environment do
  Rails.cache.clear
end

bundle exec whenever

Backup prod db
Populate download geo co-ordinates once every day

When payment fails, send email using ActionMailer

For Capistrano integration, in config/deploy.rb:
require 'whenever/capistrano'

Monday, April 24, 2017

jQuery Turbolinks Stripe Subscription Problem

https://github.com/kossnocorp/jquery.turbolinks is a possible fix, the problem is that it is not compatible with newer versions of Turbolinks.

The workaround is to either not use different application layout files (one with stripe.js and one without stripe.js), so you have only one layout that has stripe.js or you can have two layouts but still include stripe.js on both. Eventhough only your payment pages need the stripe.js and results in a little duplication and might affect the performance in a very negligible amount, this will prevent the Turbolinks problem.

If you had used Rails cache to cache the pages, you must invalidate the cache by running in production:


 Rails.cache.clear

This will force the page to pickup the changes made to the layout files, otherwise you will see the latest file in the production but the browser will not see the updated file.

Tuesday, April 18, 2017

Bootstrap 4 Material Design Links

1. Bootstrap Material Design Components
2. Demo

Upgrading Passenger from 5.0 to 5.1 using Moonshine

Change passenger version in passenger.rb:

  BLESSED_VERSION = '5.1.2'

Checkin the file and cap deploy. This version of passenger turns on XSS security header:


X-XSS-Protection: 1; mode=block

Thursday, April 13, 2017

Making the Transition from Blogger to an Author

How did I make the transition from writing blog posts to a book author? Initially I was writing only 'How-To' articles that focused on helping the reader get a specific result. Over time, as I wrote more I gained more confidence and I was able to write more articles in less time. However, writing a book is more involved than writing blog posts. I am not a native English speaker. It pushed me beyond my writing abilities. Since I did not have any training in writing, I searched for resources on how to write technical books. I had to learn some techniques that helped me write the book during the time I worked on the TDD in Ruby book. Today, I am going to share with you one of the techniques that I learned during the time I wrote the book. I had the main bullet points and I used Semantic Maps to expand the main points to a paragraph.

Semantic maps are webs of words. The purpose of creating a map is to visually display the meaning-based connections between a word or phrase and a set of related words or concepts.

I would take the main point, research the topic and draw the semantic map that connects all the concepts. I would then eliminate the concepts that are not relevant to the analogy that I need to explain the main idea. I revised the diagram over the course of few days. Then I write a paragraph by referring the semantic map. I revise the paragraph several times. I keep all the paragraphs next to each other so that I can compare and finally pick the one that I am satisfied with.

The following diagram shows the semantic map for the music analogy that I used in the book. The music-semantic-map-1 shows how the music is related to other concepts. The concepts are connected by arrows and the relationship is written next to the arrows. The music-semantic-map-2 is the continuation of the map that connects the Performer to musical instruments.

I also drew semantic maps for programming as shown in program-semantic-map-0 and program-semantic-map. I compare the semantic maps that captures the essence of creating music with creating computer programs, I look for things that are similar to make the analogy clear.


Comparison of semantic maps helps us to find missing concepts in the paragraph that expands the main idea. I found semantic maps very helpful because I don't need to worry about grammar when I am drawing them. The main focus is in finding the essential relationships between the concepts. Once I nailed the relationships between the concepts then I worry about the grammar and the sequence of the sentences to form a paragraph. The TDD in Ruby book is written to be practical introduction TDD for Ruby developers. I hope you enjoy this book as much as I enjoyed writing it.

Friday, April 07, 2017

Ruby on rails Developer - Palo Alto

Rate can be over $100 for the right candidate. If interested, email me at bparanj at gmail dot com.

Job Details:
Position: Sr.
Software Engineer (Ruby on rails Developer)
Location: Palo Alto, CA
Duration: 3+ Months contract with possibility of Extension

Job Description:
Responsibilities:
· Create progressive solutions to solve complex test automation challenges.
· Collaborate with the QA team to architect, develop, and maintain an innovative test automation system for the organization, with respect to functionality, performance, scalability and other quality goals.
· Apply Development and QA Best Practices and actively look for process improvement opportunities.
· Develop and maintain automated test systems.
· Mentor and assist QA Engineers in the use of automation tools.
· Maintain test environments and test automation systems (install/update software on remote and/or virtual systems).
· Provide feedback to internal teams on application flexibility, consistency, and user-friendliness, and provide information to help business stakeholders make the best decisions possible.
· Provide the team with risk assessment and risk mitigation strategies.
· Research, analyse, report, and track defects through completion.
Skills & Requirements

Education:
· Bachelor's degree in Computer Science / Information Systems or an equivalent combination of education and work experience.
Qualifications:

Skills:
· 5+ years of development / test automation experience, preferably with complex web applications using Ruby or other OO languages.
· 3+ years of experience working specifically in or with QA teams.
· 3+ years of experience with SQL (MySQL preferred).
· Knowledge of Windows / Linux / OS X operating systems is a plus.
· Familiarity with Agile development principles is a plus.
· Desire to learn from and mentor other team members, including paired programming practices.
· Demonstrated ability to become a subject matter expert.
· Knowledge and experience with Continuous Integration, Continuous Build and Continuous Deployment practices, tools and trends.
· Experience with virtualization technologies such as VMWare, Hyper-V, OpenStack, etc. preferred.
· Understanding of SaaS infrastructure and components (RDBMS, Web and Application Servers, Queues, Caching, etc.).
· Experience with Ruby is preferred.
· Working knowledge of Ruby on Rails and ability to read and interpret intent in a large application is a huge plus.
· Experience with source code revision control systems such as GIT or SVN.
· Highly detail oriented and well organized.
· Strong analysis and problem-solving skills.
· Ability to identify small inconsistencies throughout a complex system.
· Excellent interpersonal skills, ability to work as part of a team.
· Must be self-motivated and take initiative in performing tasks and growing skills and knowledge.
· Ability to effectively communicate information, both verbally and written, to team members and management.

Sunday, April 02, 2017

How to move contacts from Android

Open Contacts, click on ... and click on Move device contacts to, you can select Google and your contacts will be moved to your Google account.

Saturday, March 25, 2017

Developing a Web Application from Requirements.

 Given you are the owner of a veterinary practice, create a basic Rails application that satisfies the following user stories:

1. As the owner of the veterinary practice, I have two additional veterinary doctors Bob and Susan. I should be able to track the following information about myself and my fellow veterinary doctors.

Name - must be no longer than 35 characters; value is required
Address
City
State
Zip - should be at most 5 digits
School Received Degree From
Years in Practice - must be value between 1-100

2. As the receptionist of the veterinary practice, I should be able to schedule an appointment for a customer's pet with a specific veterinary doctor. The appointment should contain the following information.

Date of Visit - date cannot be in the past; value is required
Pet - required
Customer -required
Requires Reminder of Appointment
Reason for Visit – required

3. As one of the practicing veterinary doctors, I should be able to record the following information about a customer's pet.

Name of Pet - required, no more than 35 characters
Type of Pet - must be a dog, cat, or bird
Breed - required, no more than 35 characters
Age - required
Weight - required
Date of Last Visit – required

4. As a customer, I should be able to see when my pet is scheduled for their next appointment

Pet's Name
Date of Next Appointment
Reason for Visit


Saturday, March 18, 2017

How to split videos in command line

The command:

ffmpeg -i source-file.foo -ss 0 -t 600 first-10-min.m4v

will work but is slow. Solution:

ffmpeg -ss 00 -t 00:01:0.0 -i source.mp4 -vcodec copy -acodec copy result.mp4

Will split the source.mp4 from the beginning to the first 60 seconds and save it in result.mp4.

Friday, March 17, 2017

How to Concatenate Video Files

I needed to stitch intro and outro to my screencast video. I installed ffmpeg on my mac, created a text file, stitch.txt:

file './intro.mp4'
file './semantics3.mp4'

file './outro.mp4'

To stitch videos:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

Install ffmpeg on Mac

To concatenate intro and outro to my screencasts, I use ffmpeg to stitch the videos from the command line. It is faster and easier than using the ScreenFlow.

brew options ffmpeg

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools


Sunday, March 12, 2017

How to Setup Textmate to use RVM

Go to Textmate preferences, click on Variables and create a TM_RUBY variable the value should be set to the output of the which rvm-auto-ruby command run in the terminal. The changes will take effect without requiring any restart of textmate.

Sunday, March 05, 2017

configure: error: clang version 3.0 or later is required

~ $gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
~ $clang -v
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0

Thread model: posix

Monday, February 27, 2017

Mac OS 10.10.5

Type gcc in a terminal, install GCC by clicking the popup window.

Install Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install gnupg gnupg2

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3


\curl -sSL https://get.rvm.io | bash

Rails 5.1 and Webpack Tutorial

https://medium.com/@gauravtiwari/hey-bp-strange-is-webpack-dev-server-installed-5c1ec83517e8#.fci5ohl22
 
brew update
brew install yarn 
yarn add webpack-dev-server
 
 

Friday, February 24, 2017

Learning to be awesome at anything you do, including being a leader | Tasha Eurich

Step 1 is to know thyself.
Then on the right hand side for each skill, on a scale of 1 to 10,
I want you to imagine that you only got better at that,
and then rate how much more awesome you would be.
Start with the highest number and work your way down.
So, you know yourself, you've got your one thing.
What makes someone exceptional is that they earn it through daily practice.
Everyday on his way to work he'd think about what he was trying to improve,
and he'd make a plan to practice it.
Then on the way home, he would think about how he did,
and maybe some ideas for what he would the next day.
In sum total, Steve probably spent less than 30 minutes a week doing this,
and he saw massive returns.
So, everyday, I want you to jump out of bed and say,
"Today is the day I'll get better at my one thing!"
But every day you'll learn, and every day you'll get better.
Know thyself. Pick one thing. Practice daily.