Sunday, December 11, 2016

Git Bash Commands Overview

Version Control Systems are software's tools that help a software team to manage changes to their source code. It keeps track of every modification to the code. If a mistake is made, developers can compare earlier versions of the code and/or revert back the changes to help fix the mistakes without disrupting the other team members.

As of now, the most widely used modern version control systems in the world are Git, TFS, SourceSafe and SVN.

Git is a mature, actively maintained open source project originally developed by Linus Torvalds, the famous creator of the Linux operating system kernel, in the year 2005.

Having a distributed architecture, Git is an example of "Distributed Version Control System" (DVCS). Rather than having only one single place for the full version history, every developer's working copy of the code can be treated as a repository in Git. In addition to being distributed, Git has been designed with performance, security and flexibility in mind.

Here is a list of some common terms used in Git:

Blobs
Blob stands for Binary Large Object. Each version of a file is represented by blob, which holds the file data but doesn’t contain any metadata. It is a binary file and in Git database, it is named as SHA1 hash of that file.

Trees
Tree is an object as binary file, which represents a directory. It also holds blobs as well as other sub-directories. It stores references to blobs and trees which are also named as SHA1 hash of the tree object.

HEAD
HEAD is a pointer, which always points to the latest commit in the branch. Whenever you make a commit, HEAD is updated with the latest commit. The heads of the branches are stored in ".git/refs/heads/" directory.

Clone
Clone operation creates the local instance of the repository. It acts as mirroring of the complete remote repository. Users can perform any operations with this local repository. The only time networking gets involved is when the repository instances are being synchronized.

Branches
Branches are used to create another line of development from the repository's master branch to work on a new feature. Once the feature is completed, it is merged back with the master branch and we delete the branch. Every branch is referenced by HEAD, which points to the latest commit in the branch. Whenever you make a commit, HEAD is updated with the latest commit.

Pull
Pull operation copies the changes from a remote repository instance to the local repository. The pull operation is used for synchronization between two repository instances.
 
Push
Push operation copies changes from a local repository instance to the remote repository. This is used to store the changes permanently into the Git repository.
 
Commits
Commit operation holds the current state of the repository. A commit is also named by SHA1 hash code. Every commit object has a pointer to the parent commit object.
 
Tags
Tag assigns a meaningful name with a specific version in the repository. Tags are very similar to branches, but the difference is that tags are immutable. Once a tag is created for a particular commit, even if you create a new commit, it will not be updated. Usually, developers create tags for product releases.

Thursday, December 08, 2016

How to Copy Files in Command Prompt using xCopy

The Windows Command Prompt can be very powerful once you understand some of the commands. You can get a lot more control with the Command Prompt than you would by copying and pasting in Windows Explorer. Knowing how to make the most out of the copy commands is essential if you're remotely operating a Windows server. It's also great if you want to be more efficient with your own system.

There are different ways to copy files using the Windows Command Prompt. All the commands can copy files from one place to another, but there are several cases where you may want to choose one command over the others.

  • XCOPY - The xcopy command allows you to copy files and directory trees. This makes it much more suitable for copying folders. xcopy also has many modifiers which gives advanced users more control over the copying process. xcopy has been deprecated in favor of robocopy, but still works.

Example: C:\>xcopy c:\webshare\AppData\runtime\bin\admin\*.* c:\_backup\backup_20161208\admin /e /i

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A           Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M           Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P           Prompts you before creating each destination file.
  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V           Verifies the size of each new file.
  /W           Prompts you to press a key before copying.
  /C           Continues copying even if errors occur.
  /I           If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
  /Q           Does not display file names while copying.
  /F           Displays full source and destination file names while copying.
  /L           Displays files that would be copied.
  /G           Allows the copying of encrypted files to destination that does
               not support encryption.
  /H           Copies hidden and system files also.
  /R           Overwrites read-only files.
  /T           Creates directory structure, but does not copy files. Does not
               include empty directories or subdirectories. /T /E includes
               empty directories and subdirectories.
  /U           Copies only files that already exist in destination.
  /K           Copies attributes. Normal Xcopy will reset read-only attributes.
  /N           Copies using the generated short names.
  /O           Copies file ownership and ACL information.
  /X           Copies file audit settings (implies /O).
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.
  /B           Copies the Symbolic Link itself versus the target of the link.
  /J           Copies using unbuffered I/O. Recommended for very large files.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

Sunday, November 27, 2016

WhatsApp Will No Longer Work On These Phones

It might be bad news for few WhatsApp users! The company is ending support to a number of devices which will no longer be able to run WhatsApp from December 31. That means if you are right now using older smartphones then you need to replace it right before the year 2016 ends.

The devices that will no longer get support from WhatsApp are:
  1. BlackBerry OS and BlackBerry 10
  2. Nokia S40
  3. Nokia Symbian S60
  4. Android 2.1 and Android 2.2
  5. Windows Phone 7.1
  6. iPhone 3GS/iOS 6

So, those who are using older phones need to upgrade to a newer Android, iPhone or Windows Phone to continue using WhatsApp after December 31, 2016.

EXCEPT and INTERSECT in T-SQL

The UNION, EXCEPT and INTERSECT operators of SQL enable you to combine more than one SELECT statement to form a single result set. The UNION operator returns all rows.

EXCEPT
Returns any distinct values from the query to the left of the EXCEPT operator that are not also returned from the right query.
INTERSECT
Returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operator.

The INTERSECT operator returns all rows that are in both result sets. The EXCEPT operator returns the rows that are only in the first result set but not in the second

EXCEPT operator is another most important feature in SQL Server which is used to returns distinct rows by comparing the results of two input queries. Both SQL queries within the EXCEPT query, the number and the order of the columns must be the same in the result sets within similar data types.  EXCEPT operator is a very quick and easy way to find differences, especially when needing to get all differences including null.

When using INTERSECT operator the number and the order of the columns must be the same in all queries as well data type must be compatible.

For more Information check MSDN site

Monday, November 21, 2016

Targeting .NET Platforms

You can build apps for many platforms and services by downloading .NET Framework targeting packs and SDKs and using them with Visual Studio.

Check this link for relevant platforms