एंब्युलंसला किंवा पेशंटला हॉस्पीटलला न्यायला वेळ लागत असेल आणि पेशंटचीऑक्सिजनची पातळी कमी होत असेल तर अशावेळी करण्याचे प्रथमोपचार
I have an eclectic (or eccentric) mix of hobbies and interest. Starting from software development, astrology to origami and mindmaping. This blog will be mostly about Software Development but I may talk about other things also.
Announcement
Showing posts with label Tips amp; Tricks. Show all posts
Showing posts with label Tips amp; Tricks. Show all posts
Monday, January 24, 2022
Saturday, December 15, 2018
Sane Branch Management of Version Control Systems for Teams
[NOTE : This is still a 'draft', please point out mistakes and suggest changes/improvements]
Some time back Nagaraj Mali asked a question about 'best practices for repository branch management' on one of our whatsapp groups. This is commom query. 'bad branching strategy' or 'no strategy about branching' are very common mistakes in project teams. These mistakes can seriously impact the teams productivity and quality. Unfortunately very few manager/scrum masters or tech leads really understand devastating impact of 'bad version control practices'. In this blog, I am attempting to explain my views and logic behind various practices that I recommend.
Some time back Nagaraj Mali asked a question about 'best practices for repository branch management' on one of our whatsapp groups. This is commom query. 'bad branching strategy' or 'no strategy about branching' are very common mistakes in project teams. These mistakes can seriously impact the teams productivity and quality. Unfortunately very few manager/scrum masters or tech leads really understand devastating impact of 'bad version control practices'. In this blog, I am attempting to explain my views and logic behind various practices that I recommend.
Mistake : Too many branches
A developer need to understand the difference between a 'branch' and a 'tag'. Many times teams use 'branch' where tag is sufficient. 'branch' is an 'active line' of development. Common practice is product teams is to support 3 previous versions (i.e major releases) for bug fixes and one new release'. For example your current release is Ver10 and you may supporting major Versions9, 8 and 7. Essentially you have 4 'lines of development'. Then you need 4 branches. Ideally you should checkout 'only' the branch that you are working on. There is no need to checkout all branches. Since 'branches' represent 'live lines of development', once you stop supporting a particular major release, you should 'delete' the branch for that release. Typically you will have 4 to 6 branches and many/many tags.
Mistake : Creating new branch for every minor release
Assume a major release is 'version 9'. Then 'version 9.1' is developed on 'version 9' branch ONLY. Remember 'Version 9' is the supported major release and 'live development line'. Version 9.1 is usually a 'NOT live development line'. Any code changes/bug fixes for Version 9.1 should be developed in 'Version 9' branch'
Common complaint : We spend long time in merging.
This is another symptom of bad branching and bad practices followed by team. Consider following branch scenarios.- Release branches for past releases
Lets assume that new releases are developed in 'master' and team is supporting 2 previous release 'Version1' and 'version2'. Now team have done a bug fix in 'Version1'. Obviously customers will expect that same bug fix is available on 'patch release on Version2' and also available when new Version3 becomes available. So every day branches must be merged 'upstream'. i.e. merge Version 1 commits to Verson 2. And merge version 2 commits to 'master'. If you get any merge failure fix them. Daily changes are typically small and can be easily merged. This simple practice ensure that time required to do merges are drastically reduced and bug introduced because of merge problems are almost entirely eliminated.
- Feature branches
Many teams create 'feature' branches for every new feature or bug fix. However, they don't delete the feature branch one the feature development is over. At end of 'feature' development feature branch must be merged into 'master' and then delete the feature branch. It is best to use 'git flow' plugin/workflow for working on feature branches.
Typical feature branch flow will be- create feature branch from 'master' (so 'parent branch' will be 'master')
- keep making changes and commiting in feature branch. Its ok to push feature branch.
- every day merge 'parent branch' to 'feature' branch. This way any changes to 'parent' branch done by other developers are available to you and any conflicting changes are detected early.
- once the feature is done, merge the 'feature branch' to 'parent branch' (usually 'master'). Since you are regularly merging the 'master' to 'feature', you will not see any conflicts when you merge 'feature' to master. Now delete the feature branch
In both scenarios 'key' is the regular (preferably every day) merge from 'release branch' to master' or 'master to feature' branch.
Remember It is OK to delete a branch
Remember in version control there is nothing like 'permanent delete'. When a branch is deleted, you will not see it 'branches list'. But that does not mean all the history of such branch is also deleted. Recommended practices is to create a 'tag' from branch and then delete the branch. This will keep the history intact. It will also allow to restore a branch from the tag, if you need to do some critical bug fix in an older (now unsupported) release
Bottomline
Remember 'version control' is 'productivity tool' for the development team and NOT just a backup tool. Learn how to take advantage of the version control system and you will see signficant increase in productivity of your team. Start by defining policy for 'branch creation/branch deletion and daily merge'.
Saturday, September 01, 2018
Things you should do after joining your first job
This blog post is for my friends who recently graduated and now joined their first job.
You have now joined a company and started working. Your responsibilities have now changed. You are now an earning member of your family. The habits that you develop in this first year will determine your future (in your career, in your earnings, etc). So what are the first things you need to do ??
Given below is a partial list of things that you need to do immediately or start doing regularly.
- Buy a medical insurance.
You will already be covered in your company's medical insurance or you may be covered in your parent's medical insurance. If you are covered in parents medical insurance, that cover may now be over. Also it is unlikely that you will stay in the same job. If you change that job, start freelancing, may be between the jobs then you may NOT have medical insurance cover during that period. As you become older, it will be more difficult to get medical insurance. So Buy a Medical Insurance on your own. See if you can get 'family insurance' plan. Add your parents to this insurance. - Start Investing and building your Financial Portfolio
Don't spend all your salary on parties and malls. Learn the basics of investing in Mutual Funds, Shares and other financial 'instruments'. Few years later when you want to buy a house, get married, go to honeymoon, do it with your own money. Don't depend on your parents. - At bare minimum start creating Fixed or Recurring Deposits in your bank account.
- All investment companies like ICICI Direct has short courses that introduce you to basics of investing. Attend those courses.
- Register for SIPs (Systematic Investment Plans) for Mutual Funds/Shares. SIPs will allow you to start investing in small amounts but regularly.
- Start Investing and Building your Knowledge PortfolioBuilding your knowledge portfolio as more important than building your financial portfolio.Sometimes your company will reimburse some of these expenses. Remember The money you spend on books, courses etc are NOT expenses. They are investments. Invest in learning. These investments pay off many times over.
- Buy Books. Don't depend on company or other libraries. You must create your own library of favourite books and books critical for your work. For example, if you are in a programmer you must have your copy of 'Code Complete2'
- Join online courses like Coursera, EdX, Udacity. Pay for those certificates
- Attend conferences.
- Join Professional Associations like ACM, Computer Society of India, Stepin Forum and meet-ups
- Start Investing in your Communication Skills and Business Etiquette
Good communication skills are critical for your career advancement. One of my mentors gave me a critical advice at the start of my career. He said"Nitin, what you know is important. But who knows what you know is EQUALLY important"
"Who knows what you know" gives you opportunities. For that to happen you must be able to clearly articulate your thoughts and ideas.
- Practice to write good professional emails and documents. Don't write 'bcos, yo, etc' (i.e.typical sms/whatsapp slang) in your official mails, mails to your boss or colleagues.
- Practice to speak fluently in your mother tongue and in English. Consciously avoid saying 'You know' or 'ya' in every sentence.
- Join organization like Toast Masters where you are practice your presentation skills
- Learn to deal with A**holes
You will find some a**holes in every organization. You have to learn to deal with these on your own. Your parents, brothers/sisters etc are not going to help you now. You will encounter 'passive aggressive bosses', 'vining co-workers', people trying to emotionally blackmail you for various reasons/agendas. - Read books of Prof. Bob Sutton (No Asshole Rule, The Asshole Survival Guide: How to Deal with People Who Treat You Like Dirt )
- Learn some meditation. You can do it on your own. You don't have to attend some fancy/expensive class. Checkout Quiet Kit
- Develop your own support system - Your friends, colleagues with whom you can talk and share your problems, who can help you with suggestions and intelligence.
- Find a Mentor
Your first team/Manager has a HUGE and disproportionate impact on your career. The habits you develop in your first project/team/job, stay with for life long. Make sure you develop 'Good habits'. Make sure to work in a team/manager who will help you learn and develop the good habits.
Check this comment from Prashant Kale. I fully agree with this advice
Do you feel you can reach to the expertise level of your manager/current mentor in 3-4 years? THEN you have 'bad role model'. Find out someone where you must feel "To reach to level him/her, it will take me 10 years'. When you find such person, stick with him/her. Stay continuously in touch with him. Meet him/her regularly. Get his/her advice. Discuss your problems/career choices/aspirations openly with them.
It is really really difficult to find such Gems. When you find one, make sure you don't ignore or lose them. (NOTE : I was fortunate that I found many such Gems in my initial years in Telco and In Geometric Ltd. It shaped my career. I still keep in touch with my mentors.)
If you feel your current mentor/team is not adding value to you, change the team (may be even the company).
[Update] I posted this article on LinkedIn. There are many thoughtful comments and advice posted on this article. Check the replies and suggestions on LinkedIn
Sunday, December 11, 2016
Managing all your passwords from one place
In April this year, my friend Parimal Nagarnaik died after 2 year battle with cancer. At that time I realized how many things we do online now a days. All these websites have a username and password. Usually these usernames and passwords are stored in memory or in browser (e.g firefox/chrome) or some word document. It creates a mess for the family.
Last few days I am searching for a way to manage all the passwords at one place from multiple devices. Also a way to share the passwords with family in case any mishaps. I have found following somewhat practical way.
Gmail has 'inactive account manager' feature. "Inactive account manager" sends a message to google email accounts that you specific and give them access to your gmail. You can specify the message to be sent to these account. Include your 'keepass' master password in this message.
Keepass apps are ported to iOS/iPhone as well. Search for MyKeePass or SyncPass on iPhone appstore.
Keepass plugins are available for Firefox, Chrome, IE for managing all your internet password/logins directly from browser. You can get the links for various plugins from http://keepass.info/plugins.html
Last few days I am searching for a way to manage all the passwords at one place from multiple devices. Also a way to share the passwords with family in case any mishaps. I have found following somewhat practical way.
Keepass : Opensource application for securely storing passwords
First download http://keepass.info/download.html . Keepass is an open source application for managing your passwords. All the passwords are stored in keypass database in an encrypted format. Keepass uses AES/Twofish (two well known cryptographic algorithms with 256 bit key). The main database is encrypted with a key derived from a master password. You have to give the master password to decrypt the database of all other passwords.
How to share Keepass database across devices ?
Now enter all the passwords in Keeepass and save the password database in Google Drive. All your windows devices can share same keepass database. Any changes in one device will be propagated to another device by Google Drive.
Now install KeepassDroid from Android playstore.
Install Google drive app on your phone from app store. Make the keypass database 'available offline'. And then open it directly from Google drive. Google drive will ask 'which app' to be used for opening the file. Select "Keepass Droid" app. Now same google drive keepass database is available to you on your android phone. Any changes/edits you do on phone will be synced to your desktop apps as well.
Now install KeepassDroid from Android playstore.
Install Google drive app on your phone from app store. Make the keypass database 'available offline'. And then open it directly from Google drive. Google drive will ask 'which app' to be used for opening the file. Select "Keepass Droid" app. Now same google drive keepass database is available to you on your android phone. Any changes/edits you do on phone will be synced to your desktop apps as well.
How to share the Keepass database with family members in case of mishap?
You can share the keepass file with your family using the google drive 'share' feature. This way family will have access to your passwords if required.Gmail has 'inactive account manager' feature. "Inactive account manager" sends a message to google email accounts that you specific and give them access to your gmail. You can specify the message to be sent to these account. Include your 'keepass' master password in this message.
Keepass apps are ported to iOS/iPhone as well. Search for MyKeePass or SyncPass on iPhone appstore.
Keepass plugins are available for Firefox, Chrome, IE for managing all your internet password/logins directly from browser. You can get the links for various plugins from http://keepass.info/plugins.html
Tuesday, April 29, 2014
My code review checklist
I am not a fan of checklists (especially for code reviews). Code review checklists start small and then slowly become really large and unwieldy. After sometime checklist becomes a bottleneck and instead of improving effectiveness of your process, these lengthy checklists start reducing the effectiveness.
However, there are situations where I used checklists and they worked very well. For example, a Customer Release checklist. There are many small small things that you need to do before sending the new release to customer. Its easy to miss few critical steps. A release checklist has always worked very well.
I was not sure why in typical organization sometimes checklists did not work well (for example, in cases like code review) while sometimes it really worked. What exactly is the difference ?
Sometime back I read Atul Gawande's book 'Checklist Manifesto'. It triggered my interest in Checklists again. As first step I extracted a Code Review checklist from my code review training content. I have used this 'mental' checklist for a many-many years. It has worked well for me even with different programming languages (C/C++, Java, Python, C#, Javascript) and technologies.
Sometime back I read Atul Gawande's book 'Checklist Manifesto'. It triggered my interest in Checklists again. As first step I extracted a Code Review checklist from my code review training content. I have used this 'mental' checklist for a many-many years. It has worked well for me even with different programming languages (C/C++, Java, Python, C#, Javascript) and technologies.
PS : Based on my experiences, information from Atul Gawande's book and from information internet, I have now prepared a 4 hour hands-on session on creating and improving the checklists. Contact me if you are interested.
Saturday, September 07, 2013
Recovering from corrupted Subversion repository
As a habit I store all my personal data (training ppts, various experimental, etc) in version control. Since I am doing this for a many years, I am using Subversion to store all this data. Recently I upgraded to Subversion 1.8. I tried to do a fresh checkout and realized that repository is corrupted. 'svnadmin verify' returned error and could not fix it. I could not do a fresh 'svn checkout' and I could not use TortoiseHg as client to Subversion. I was stuck. The error I was getting was 'E200002 : serialized hash missing terminator' error.
My first step was to Google for error message and see if I get any solution. The search results suggested running 'svnadmin verify'. It confirmed the error at revision 1266. Many others suggested taking backed-up repository dump and restored from the dump. I took backup of the repository and did not take a repository dump at the time of backup. The backup of the repository was also corrupt at the same revision. So this solution was not very useful for me.
My second step was to send a mail to Subversion users email list 'users@subversion.apache.org'. You can see the mail here. Stefan Sperling suggested 'fsfsverify' script. I tried it but it did not work for me.I also tried 'fsfsfixer' script. That also did not work.
The best clue I got from 'Philip Martin'. I was not sure what the error 'serialized hash missing terminator' means. I tried to read the documentation for FSFS format. Based on the checked the data from 'revision' files. It seemed to be corrected.
Philip explained the error as
"It means one of the repository files is corrupt. It could be a revision files in db/revs or it could be a revprop file in db/revprops. A serialized hash is a series of K/V pairs followed by END:"
The key was "it could be a revrop file db/revprops". So far I missed on checking the 'revprop' files. I checked the revprops file for revision 1266 and found that it is made of just Zeros. There was no content.
Now the problem was clear. The revprop files are corrupt, I did not have the backup of 'uncorrupted' revprop files. Hence only was to somehow recover the revprops. Typical revision prop file looks like this
K 10
svn:author
V 2
pm
K 8
svn:date
V 27
2013-09-05T18:00:22.881511Z
K 7
svn:log
V 1
m END
Typically it contains information about 'author', 'date' and svn commit message. It may also contains merge information. In my case, mergeinfo was not there. Since it was a personal repository only person committing code was me. Hence svn:author will always be me. Now its question of creating message and date. So decided to do take a simpler approach for date use the 1 minute after previous valid revisions date. And message as 'this revision is recovered from corruption' kind of message.
I wrote a python script, which takes repository path and revision number and does the following
- Runs the 'svnadmin verify -r
' and checks 'serialized hash missing terminator error'. - If the error is reported, the script reads the revision properties of revision just before that (i.e. revno-1) and add One minute to the time stamp of this revision.The log message is changed 'recovered from corruption' message.
- Now original corrupted revision property file is copied to a backup location and corrected revision property is written in its place.
- The process repeats till get it 'valid revision'. At this point it stops.
After this I ran the 'svnadmin verify' on entire repository and confirmed that all revisions can be read. Then dumped the repository contents to dump file and reloaded the content into a new empty repository.
I checked the log and diff of the revision 1266 and few subsequent revisions. Things seem to be on track.
PS> The python script I wrote is very specific to my needs. However, if you need it, send me a mail.
Subscribe to:
Comments (Atom)