Sunday, 12 February 2017

jQuery: When to use $(document).ready() and when $(window).load()

Summary

jQuery offers two methods to execute code and attach event handlers: $(document).ready and $(window).load.

$(document).ready()

The document ready event fired when the HTML document is loaded and the DOM is ready, even if all the graphics haven’t loaded yet. If you want to hook up your events for certain elements before the window loads, then $(document).ready is the right place.
Code:
$(document).ready(function() {
    // document is loaded and DOM is ready
    alert("document is ready");
});

$(window).load()

The window load event fired a bit later, when the complete page is fully loaded, including all frames, objects and images. Therefore functions which concern images or other page contents should be placed in the load event for the window or the content tag itself.
Code:
$(window).load(function() {
    // page is fully loaded, including all frames, objects and images
    alert("window is loaded");
});

Basic git commands

http://gitref.org/basic/ 
 
Get an existing from the server for the first time
git clone git@example.com:repositoryname
See what's changed
git status
Check in locally
git commit -m "good description"
Push local commits to the server
git push
Get and merge updates from the server
git pull
Stage a file for the next local commit
git add file
Stage all files for the next local commit
git add .
Create a new local branch
git checkout - b branchname
Switch to a local branch
git checkout branchname
Overview of local branches
git branch
Delete a local branch
git branch -d branchname
Insert changes on the server before your local changes
git pull --rebase
Temporarily discard local changes
git stash
Re-apply stashed away changes
git stash apply
Re-apply stashed away changes an delete them from stack
git stash pop
Find out who wrote something
git blame filename
Restore a deleted file (notice the space before and after the dash)
git checkout - filename
https://makandracards.com/makandra/517-basic-git-commands



How to merge a specific commit in git

Scenario
You were working on a certain branch of a git repository, and you committed some changes to it. Then you realize, this particular commit should also go to another branch of the repository BUT you are not ready for a complete merge. Maybe this commit was meant for the other branch?
You want to merge this particular commit from the current branch to the other branch of your requirement.
Resolution
Merging a specific commit from one branch to another is pretty easy: use the git cherry-pickcommand. The syntax is: git cherry-pick <commit hash>.
First make a note of the commit hash using the git reflog or git log command.
Then, switch to the branch where you'd like to merge the commit and run git cherry-pick with the commit hash, as shown in the example below.
$ git cherry-pick d4d8e7c
Now you will have merged the specific commit from one branch to the other.

Monday, 6 February 2017

A Beginner’s Guide To Managing Software Development with Kanban and Trello

https://www.toptal.com/agile/guide-managing-development-kanban-trello


Everyone is a project manager. Whether you’re managing the development of a new application and growing your startup, working on a new billion-dollar enterprise project, or just trying to liven up your yard with some DIY landscaping, you’re always managing a project.
The success of your project depends on many factors, but one of the most common reasons projects fail is a lack of management or outright bad project management. No matter how small your team is, or how clearly your requirements are documented, if you do not manage your team properly, your project is bound to fail.
Every minute you spend managing your project is time well spent. It will bring you closer to the successful completion of your project.
Agile project management is a widely accepted method of approaching modern software development projects. But what does Agile really mean?
Agile projects accept the frequent change of scope and requirements as an integral part of the process.
For a deeper dive into Agile principles, I suggest reading our Ultimate Guide to Agile Project Management.
In this post, we will explain the basics of agile project management with Kanban.
Even if you are an experienced project manager that understands agile principles in and out, you should refresh your memory and remind yourself on core concepts. Innovation cycles in software development are constantly speeding up, making project management more complex with each iteration. Going back to fundamental principles and solidifying core principles of Agile is always important. After all, repetition is the mother of all knowledge.
Kanban is one of the easiest methods of managing any Agile software development project. You can easily handle a local development team that works from the same office or distributed team, spread out through several time zones.
Kanban is not a process. It’s a way to manage any process with minimal changes to the team’s established operational activities.
In order to apply Kanban principles to your work, you must apply two simple rules:
  1. Visualize your process.
  2. Limit work in progress.

Visualize Your Process

Data visualization is a quick, easy way to convey information in a universal and easy to understand manner. When looking at pictures, the human brain can process several pieces of information simultaneously. Some researches say that this can be up to 60,000 times faster than reading a text.
Brain neurons for our visual perception account for 30 percent of the brain’s gray matter.
The most popular way of visualizing a process is a Kanban Board. A Kanban Board is a board vertically divided into several columns, with each column representing one state in your process.
Let’s take a look at how a simple software development board would look. First, we need to define states for our development features:
  1. To-Do - feature is waiting for development
  2. Development - feature is assigned to a developer and he/she is working on it
  3. Quality Assurance - feature is in review
  4. Deployed - feature is accepted and included in application release
Based on this, your board should have the following layout:
Visualizing individual tasks is as easy as creating a simple card (much like a Post-it) that represents work that needs to be done. You can name the task, add the name of the assigned developer, due date, and any other relevant information to this card.
When you add that card to a column on the Kanban Board, you have visualized that, for example, a specific developer is working on a particular task that is due at a certain date and is currently in development.

Limit Work In Progress (WIP)

Human multitasking is a delusion. Instead of paying attention to one or two things simultaneously, our brains are switching between them very rapidly.
This is more visible in software development than anywhere else. Developers can work only on one piece of code at one time, and switching to another feature will cause delays and affect their concentration and performance.
This does not mean that you must limit the number of assignments to just one at the time. Development is complex and creative work, some tasks take more and other take less time to complete, and there is always a delay while a developer is waiting for something or someone. The important thing is to limit assigned tasks to a reasonable number that will not produce chaos (this is usually three to five assignments at a time).
Assuming that your development team is comprised of two developers and a QA engineer, your board might have the following WIP limits:
To-Do - Unlimited Development - Six-card limit (Two developers each limited to a maximum of three tasks) Quality Assurance - Three-card limit (1 QA engineer limited to a maximum of three cards) Deployed - Unlimited
Do not expect developers to be wise, and limit their WIP on their own. If you throw everything from the To-Do list to developers, it will be like giving too many toys to a child. Instead of playing with one toy they will just throw them around, creating chaos in your neat home, and still, they will not be happy and you can expect tantrums.
It is your job, as a project manager, to assure that the To-Do list is prioritized properly, and tasks are assigned to developers no sooner than needed.
A properly managed Kanban Board will give you a clear picture of your project status at a glance. You can see that your developers have enough work, that you have prepared new tasks they can take over once their assignments are done, and that your QA engineer is waiting for new tasks to review.

Use Trello to Manage Your Kanban Board

Trello is a web-based Kanban project management application. It enables easy, real-time collaboration between team members and even multiple teams and projects.
To create a board in Trello click the “Create new board …” menu item, and set a title for your board.
You will start with an empty board. Use the “Add list …” box to create columns for your Kanban cards.
By clicking “Add a card…” at the bottom of any of the lists, you can easily create a task. Each card you create should represent a task that will be executed by a team member.
Cards in Trello can be customized in many ways:
  • Assign team members responsible for executing a task
  • Color code them depending on specific groupings you would like to add
  • Set due dates
  • Add attachments
  • Add custom fields such as a checklist where you can track the progress of smaller elements that comprise a task
  • Team members can comment on a card, and everyone will be notified of any change that is made.
Visualization is everything in Kanban, so here is how a card looks on the board:
Just by looking at the card, without opening the detailed view you can see that:
  1. Task to setup GitHub Code Repository is waiting to be executed in To-Do list.
  2. Task is due by January 27.
  3. Task has a description.
  4. There is one comment on the task.
  5. There is a checklist of two items, and none of these items are currently completed.
  6. Task is assigned to user DS, who will pick it up next.
  7. Task belongs to a group of green color cards, which means that it is required before the project is started.

Estimate Time And Complexity of Development Work

Planning and managing a project is impossible without understanding the effort and time needed to complete a certain task. However, one of the hardest things to do in software development is to determine how long it will take to deliver a new software product or feature.
Scrum, one of the most popular Agile principles, relies heavily on estimations, whether they are based on time or “complexity points.”
The team should spend significant time scoping out the task.
This is because Scrum is based on time-boxed intervals, when a certain group of tasks is expected to be completed. In order to plan delivery you need to have a full understanding of all the work planned for that time-box.
Kanban does not rely on time-boxed deliveries, and you can plan daily delivery if you want to. It relies on optimizing the flow, which means that the team’s focus is to complete and empty the WIP column as soon as possible.
The team doesn’t spend time estimating work much in advance. A developer will pick up the next item from To-Do; complete it as soon as possible; and pick up another task.
This doesn’t mean that a team should not estimate the volume of their workload.
You can use your weekly or daily calls to update, and verify due dates.
However, for a small team, it’s more important to assure that developers are working on the highest priority task at any given moment and that there are no bottlenecks, forcing a developer to pause their work.
Eventually, your project will grow and you will need to start estimating the amount of development work in more detail. When you reach to this situation, spend some time reading our guide for Software Costs Estimation In Agile Project Management.

Thursday, 2 February 2017

Deploy Project on project by ssh or No need of password for taking pull all time

1) Login to production serve
2) check ssh public key exist or not check at .ssh file
3) If not then generate it
4) copy the key by command cat keyfilename,  full key get displayed in terminal
5) Add this key in repository
6) take git clone from ssh link on git or bit buket

https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html

Tuesday, 31 January 2017

Set up rails enviorment

export RAILS_ENV=production
https://www.digitalocean.com/community/questions/how-to-set-rails-environment


check your .bach file and add RAILS_ENV='staging' OR RAILS_ENV='production' whatever you want to set your enviorment


OR

Open bashrc file by

Command:  sudo  vi ~/.bashrc

add below code at the end of the file 


if [[ $- != *i* ]] ; then
    # Shell is non-interactive.  Be done now!
    return
fi

export RAILS_ENV=staging
 

Designing css get particular font css or get working font how to

1) Search font by name : google search Courgette font for download and download font extract that file

2) Search transfonter or go to https://transfonter.org/

3) Upload you font on that and convert that font and download converted font

4) Extract downloaded font  and copy : .eot and .ttf and .woff file into font folder

5) Open style.css file copy that font css and change url to font folder 

S3 amazon buket transfer to another one s3 buket server copy to other sever

1) install amazon cli tool at local on cmd prompt
Command: sudo apt-get install awscli

2) add configuration details off existing s3 bucket [details needed: api-key,api-secret-key,region,response:json  ]
Command: aws configur

Ex:
aws configure
AWS Access Key ID [None]: gdsgdugdhasbfdsh3HSLQ
AWS Secret Access Key [None]: hdbfdbsfbdsjkfjkdn/c1bhjdvfadbshfbdsjhfb
Default region name [None]: us-east-1
Default output format [None]: json

3)Create new s3 buket in amazon and in PRoperty>Permission section add_user for Everyone all access


4)

aws s3 sync s3://current-buket s3://new-bucket 

 

5) How to access new bucket 

   -Login to amazon > mouse hover on Service  and go to Security, Identity & Compliance > IAM section

-  Create New user with S3 bucket access permission 

- Time of creating you get Api-key , secret-key and url save this credential 

or save csv file of credential 

 

 rails of S3 bucket by  CarrierWave :

File : config>initializers>carrierwave.rb



: