Thursday, June 4, 2020

Java To C# mapping





   Java          C#

   Map      Dictionary
   Set      HashSet
   Pair      KeyValuePair 
   .map              .Select       
   .collect          .ToList()
   .stream           .AsEnumerable 
   LinkedHashSet     <Need custom impl >
   flatMap()         SelectMany
   format()      String.format()
   zip( .Zip(
   joining() String.Join(
   InstStream(1,100)  Enumerable.Range(1, 100)
   Function    Func 
   .apply(           .Invoke(
   .isEmpty()   .Any()
   .size()   .Count
   .filter(           .Where(
   BiFunction    Func
   

Wednesday, August 9, 2017

using Linq methods with caution - E.g FirstorDefault()


Don't use FirstorDefault() unless you are sure its valid/ verified in the business scenario. else you are going to introduce bugs in the code.


Saturday, April 15, 2017

Git tips


Set up Git

Removing non-repository files with git?

--------------------------------------------------------------------------------------------------------------

How do I discard unstaged changes in Git?

Ans: 
a)For a specific file use:
git checkout path/to/file/to/revert
b)For all unstaged files use:
git checkout -- .
Make sure to include the period at the end.
c)To check out specific files
git checkout -- cats.html index.html
---------------------------------------------------------------------------------------------------------------------
git branch -a                                     -- lists all branches
git push origin :branchnamehere     -- to delete the remote branch(note semicolin before                                                                                    branchname)

git remote show origin                     -- checks for stale branches tracking origin
git remote prune origin                     -- to clean up deleted remote branches

git tag                                                           -- list all tags
git tag -a v0.1.2.3 -m "versioncomments"   -- add a new tag
git push --tags                                              -- to push new tags


---------------------------------------------------------------------------------------------------------------------
git fetch      -- pulls down the history but does not merge

rebase vs Merge
Rule of thumb:
1. When pulling changes from origin/develop onto your local develop use rebase.
          git pull --rebase

2. When finishing a feature branch merge the changes back to develop.

---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------


---------------------------------------------------------------------------------------------------------------------



---------------------------------------------------------------------------------------------------------------------



Getting up to speed with StructureMap

Developer Basics




https://jeremydmiller.com/2014/11/07/strong_typed_configuration/



--------------------------------------------------------------------------------------

TDD rules : - 
  1. Isolate the Ugly Stuff
  2. Push, Don’t Pull (this post)
  3. Test small before testing big
  4. Avoid a long tail
  5. Favor composition over inheritance
  6. Go declarative whenever possible
  7. Don’t treat testing code like a second class citizen
  8. Isolate your unit tests, or suffer the consequences!
  9. The unit tests will break someday
  10. Unit tests shall be easy to setup
And the overriding “Zeroeth Law” is “If code is hard to test, change it.”
ref:  http://codebetter.com/jeremymiller/2006/03/09/jeremys-second-law-of-tdd-push-dont-pull/ 

--------------------------------------------------------------------------------------

Devops links

  Build Versioning in Azure DevOps Pipelines