Wednesday, December 30, 2015

Travel tales: Austria

This is crazy! I didn't intend to account my travel stories, but here I am in bed at 5 am & my brain is itching with titles & adjectives for anecdotes from my trips. It has been days since the last trip, but talking to a friend about the places I visited, has ignited the desire to pen down everything I recollect from it. Though my last visit wasn't to Austria, my head is bursting with its memories, so I will just delve into that.
I love travelling & I have to admit that it was my ulterior motive in choosing Europe for Masters. After exploring very little of Europe with my family 2 years back, I fought tooth & nail to get into a good university in Germany & hop on the next train/bus/flight to a new destination & turn that 'little' into 'lot'. And here I am! Though sadly I haven't covered as much of Europe by now as I wanted to, all my trips have been memorable & unique.
So, a few months back, we went to Austria (obviously!). 12-hour bus ride, a change at Munich & you are in Innsbruck. Very wrong weather to visit Austria if you want to see some of its wonders, but very good weather for the scenic mountains. So, win-win or lose-lose. Doesn't matter! It was winter, but the sun still shone through the white mountains. White & bright Innsbruck. And freaking expensive too. One of the reasons why we chose cheaper accommodation far from the city centre & travelled 1 hour each way for next two days to get 'home' after the day of exploring. But I don't mind that because the huge & luxurious apartment amidst the mountains was worth it. The bus arriving once every hour with the final destination's name very similar to other end points, was our only way to get to the house. Innsbruck started out with buying groceries & daily tickets & waiting for that bus. Chasing snow covered mountains & roller coaster lookalike roads, we reached the accommodation. It was at much higher altitude than the main city, hence more beautiful, closer view of the mountains, colder & lacking in public transportation. Discovering that the entire top floor of the house was at our expense, complete with kitchen & a bathtub, was like finding a newer, richer independence. Anyway, we freshened up & headed for the city. Innsbruck, like any other European city has a similar architecture, but also has its own beauties unique from others. That day was dedicated to city tour by foot. So, all the tourist attractions in 7 km radius were on the agenda. We covered a rather disappointing Anatomische Museum after a lot of walking and getting lost. But we got to see the Triumphforte or Triumph Arch, beautiful historic buildings & while walking towards the Goldenes Dachl (Golden roof), came across a splendid sight by the river Inn. Yes, Innsbruck is named after this river, literally translated to 'bridge over the Inn'. The other side of bridge was lined with colorful houses in possibly every primary color. With the sun close to setting, the orange & purple of the sky mellowed the bright hues of the houses & this symphony was made complete by the blue of the river. It was breath-taking! After marvelling the view for hours till the sun set, we moved on towards the Golden roof. It was indeed all gold, sparkling on its own with no help from any other illumination. Walking ahead, it led to Maria Theresien street. This street started out with a church and blended into clothing stores. While everyone was looking ahead and walking, I was looking sideways instead, peeking into the store windows lined with fabulous gowns. The night ended with rounds of rum at the apartment while talking about music and books (yes, we are the nerd kinds)! The next day was equally great. We explored tons of museums, Swarovski diamonds, the castles and zoo. We climbed up and down tiny hills, took a tourist bus ride introducing the sights as they pass by and stopping at spectacular panoramic points and ate pastries. Apparently, Austria is known for its chocolate cake! And it was splendid. A meal of Schnitzel ending with famous chocolate cake. The adventure of the day however, was the ride back. We got off at the wrong stop because we took the wrong bus and were dying of hunger. When I said before that all the roads in the village which housed the apartment, looked same, well it was more evident now. We kept walking uphill through the snow covered mountain roads and after walking for hours, finally saw the house. That night, my legs just said goodbye! With only 5 hours of sleep left before we travel for Halstatt, I bid farewell to second day in Austria. I will write more in next post as this has gone on long enough. See you in Austria part-2.

Tuesday, December 15, 2015

Git - magical version control


I know this is a very late post as compared to the time Git has been rocking the world of distributed code management, but I was introduced to it 18 months ago and I am still too ecstatic to just let this post go. So, for those who are unaware of git (though I highly doubt it), it's a way to do version control for code which you know is going to be messed up one way or another by your teammates before it's pearly white and ready to deploy. So, to avoid tiny heart attacks, every time you get back to your code and see a minute change giving null pointer exception, git is the solution. The people behind designing this masterpiece have taken into account every scenario and have devised simple and efficient ways to handle them. Some of its 'magical' features that make my life easy breezy are branching, pull, safe boundary between commit and push and so on so forth. Branching will let you create your own working space branched from the current version of the base code. You may start with cloning (or copying) the base code to your local drive and creating a branch after that. When you switch to this branch and make your changes, those are reflected in your section only and can be worked on in your local drive. When you switch to another branch, the same location in your drive gets altered. No other folder or copy is created to increase confusion, but the same root gets altered. Don't panic! It will just reflect the stuff from the branch you are in. This property amazed me the first time and I still find it quite smart. Next would be 'pull'. If you want to update your branch or create a new one with changes from another branch, you can do so with just one command..pull. It is easy as the name. It will merge the remote master branch into the current master branch leaving your changes alone, so basically an incremental update. Another feature I like is that the commit states are saved. You can always rollback or simply check the status of the branch at a certain point of time. It allows you rollback for all the past commits, not only a few recent ones. Now, separation between commit and push. Say you want to make sure that your current progress is saved but you don't really want to change all the files because you are not quite sure. Well, you can commit your code. It will save the state of your code at that instant without making explicit changes to your codebase. When you really want to update, 'push' your code and you have it in your branch. Merge is another great and maybe the last thing to do in git. This will combine your solo branch to the mother ship (or any other branch). This should be done at the final stage as you are submitting your finished code to its origin. And git has so many flavors, the commands and rules are same everywhere and you can prefer whichever you like. There's github, gitlab, bitbucket and maybe more. There are some thumb rules that you can follow if you are new to git and rest you can learn along the way.

They are*:
1. Always leave a commit message. Make it precise, preferably short but not vague. And do not repeat them; it's confusing and makes no point.
2. Clone:
git clone [--template=<template_directory>]
 [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
 [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
 [--dissociate] [--separate-git-dir <git dir>]
 [--depth <depth>] [--[no-]single-branch]
 [--recursive | --recurse-submodules] [--] <repository>
 [<directory>]
3. Branch:
git branch [--color[=<when>] | --no-color] [-r | -a]
 [--list] [-v [--abbrev=<length> | --no-abbrev]]
 [--column[=<options>] | --no-column]
 [(--merged | --no-merged | --contains) [<commit>]] [<pattern>…​]
git branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]
git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
git branch --unset-upstream [<branchname>]
git branch (-m | -M) [<oldbranch>] <newbranch>
git branch (-d | -D) [-r] <branchname>…​
git branch --edit-description [<branchname>]
4. Commit
git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]
    [--dry-run] [(-c | -C | --fixup | --squash) <commit>]
    [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
    [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
    [--date=<date>] [--cleanup=<mode>] [--[no-]status]
    [-i | -o] [-S[<keyid>]] [--] [<file>…​]
5. Check status
git status [<options>…​] [--] [<pathspec>…​]
6. Push
git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
    [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose]
    [-u | --set-upstream]
    [--[no-]signed|--sign=(true|false|if-asked)]
    [--force-with-lease[=<refname>[:<expect>]]]
    [--no-verify] [<repository> [<refspec>…​]]
7. Merge
git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
 [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
 [--[no-]rerere-autoupdate] [-m <msg>] [<commit>…​]
git merge <msg> HEAD <commit>…​
git merge --abort
8. Pull
git pull [options] [<repository> [<refspec>…​]] 
9. Tools to make life easier - if using command prompt is not your thing, then there are tools and extensions available to allow fetch, pull, commit etc. only a click away. You can use git gui, git extensions and many more tools to visualize what you're doing.

It could get a little confusing seeing all the splendid things git can do, but the documentation from these guys is extremely easy and quick to grasp. Also, when you are writing a tutorial or blog about a project, you don't have to store your code on some third party cloud service, instead you can give the git link to it. Git kinda acts as a CV of your projects. I would much rather prefer giving the git link instead of writing about my project without a proof. And if someone checks out my git repository, that's even better as I don't need to list my code-based projects on paper any more! So, hack your heart out and leave the rest to git.