Renaming a local and remote branch in git

If you have named a branch incorrectly AND pushed this to the remote repository follow these steps to name them properly

1. Rename your local branch.
If you are on the branch you want to rename:

1
git branch -m new-name

If you are on a different branch:

2
git branch -m old-name new-name

2. Delete the old-name remote branch and push the new-name local branch.

3
git push origin :old-name new-name

3. Reset the upstream branch for the new-name local branch.
Switch to the branch and then:

4
git push origin -u new-name

 

Cheers!

Src: Link

[Ubuntu] How to disable laptop’s internal keyboard

You can use xinput to float the input device under X.

  1. Execute the command xinput list to list your input devices.
  2. Locate AT Translated Set 2 keyboard and take note of its id number; this will be used to disable the keyboard. Also, take note of the number at the end, [slave keyboard (#)]; this is the id number of the master, which will be used to re-enable your keyboard.
  3. To disable the keyboard, execute the command xinput float <id#>, where <id#> is your keyboard’s id number. For example, if the id was 10, then the command would be xinput float 10.
  4. To re-enable the keyboard, execute the command xinput reattach <id#> <master#>, where master is that second number we noted down. So if the number was 3, you would do xinput reattach 10 3.

Eg

$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
$ xinput float 10
$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
∼ AT Translated Set 2 keyboard              id=10   [floating slave]
$ xinput reattach 10 3
$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=11   [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse           id=12   [slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4004   id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Acer CrystalEye webcam                    id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]

Ref : askubuntu 

[Ubuntu] Stuck on blue screen after login

While using Ubuntu 16.04 there was a unique issue we faced. The blue screen of death. Yes that is common in windows system, but here in Linux too we had similar issue

So here is how it looks like

 

 

Well, the issue is not some hardware issue. It seems some packages are broken

We fixed this by rebooting. After login once we get the blue screen, I switched to a terminal ctrl+alt+f1 and then running

sudo apt-get upgrade

This worked out for us. We simply rebooted and things were working properly as before.

In some cases, the above might not run, then the following command is suggested to be used to fix it.

sudo dpkg --configure -a

Ref:  askubuntu

Find the Ubuntu Version installed from terminal

From terminal type

lsb_release -a

It shows up information like

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

If  you type

lsb_release -cs 

The sub-command prints specifically name of your Ubuntu version, like xenial or trusty.

Smooth!

Windows CDC drivers issue

Apparently I was trying to connect my Samsung Galaxy S2 I9100 to my Windows 7 system

  1. Kies installed  – nothing happened
  2. Drivers from Samsung installed – nothing happened

It kept showing that drivers for CDC were not installed

Finally got the fix from XDA developers forum

We need to switch teh UART and USB settings:

Enter UART mode with *#9090# and select "Log via UART"

then

enter *#7284# and select "UART MODEM" and select "USB PDA"

Now Windows ask normal Samsung drivers!

Cheers!

 

 

Getting Error “‘Microsoft.VisualStudio.Editor.Implementation.EditorPackage’ package did not load correctly”

Recently I cam across 2 errors one after another while launching Visual Studio 2015

It has been quite some time I used VS, and now I am getting used to the fact that whatever was running a month before, wont work as expected the next time I open it!

The first error looked something like this

Microsoft.VisualStudio.ProjectSystem.VS.Implementation.SharedProjectFilesPackage, Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package. XXXXXXX package did not load correctly.

Second error:

‘Microsoft.VisualStudio.Editor.Implementation.EditorPackage’ package did not load correctly

 

 

Well, I tried many things. However some times, the simple tricks get us what is needed!

Steps:

  1. Close any instances of Visual Studio running on your computer.
  2. open the application data folder from the Run command . You can use %appdata% to get quick access.
  3. Go to C:\Users\<username>\AppData\Roaming\Microsoft\VisualStudio\14.0 – take backup of all the folders inside and then delete them.
  4. Go to C:\Users\<username>\AppData\Local\Microsoft\VisualStudio\14.0  – take backup of all the folders inside and then delete them.
  5. Run Visual Studio as Administrator (this allows all the deleted run-time items to be created without any error).
  6. Try to open the project giving errors above from this Visual Studio instance
  7. TADA!

Update Node.js on Mac OS

Well for quite sometime I was using Node v 0.12x on my system, whereas nodejs has been updated to 7.x till date
I thought I used the right commands but the updates were never reflected

Gladly, I found this article on web.

I am writing down the steps that worked for me (it seems XAMPP on mac adds on some steps to the installation procedure) :

A simple way to upgrade Node.js from the Terminal is to use the n version manager:

1 npm install -g n
2 npm cache clean -f

Now, if you have XAMPP installed on your Mac, you need to do an extra step before upgrading Node.js:

1 cd /Applications/XAMPP/xamppfiles/bin
2 sudo mv HEAD _HEAD

At this point upgrading Node.js is as simple as:

1 sudo n stable
2 npm update -g

For XAMPP users only, rename _HEAD back to the original HEAD:

1 cd /Applications/XAMPP/xamppfiles/bin
2 sudo mv _HEAD HEAD

You can check which versions of npm and Node.js you have on your system with:

1 node -v
2 npm -v

Cheers!