Thursday, May 26, 2016

Replace CSS Properties

Sunday, May 22, 2016

Git: How to remove file from index without deleting files from any repository

We can use below command
git rm -r --cached [folder name]
this will remove folder also contained file from git but not remove from physical drive.

Best (and safest) way to merge a git branch into master

How I would do this
git checkout master
git pull origin master
git merge test
git push origin master
If I have a local branch from a remote one, I don't feel comfortable with merging other branches than this one with the remote. Also I would not push my changes, until I'm happy with what I want to push and also I wouldn't push things at all, that are only for me and my local repository. In your description it seems, that test is only for you? So no reason to publish it.
git always tries to respect yours and others changes, and so will --rebase. I don't think I can explain it appropriately, so have a look at the Git book - Rebasing or git-reade: Intro into rebasingfor a little description. It's a quite cool feature

Sunday, May 15, 2016

How to connect wifi using ubuntu console

Wifi network name : Farhan
Password is : ASDF1234

command: nmcli d wifi connect Farhan password ASDF1234 iface wlan0

Friday, May 13, 2016

How to create vertical navigation with css

Create custom vertical navigation for your application

Remove encoded character from string (HTML Decode)

Remove encoded character from string (HTML Decode)

Fixed header after scroll using javascript

how to install google chrome on ubuntu

To install Google Chrome, run the following:
sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb

For 32-bit systems user can use this code:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
sudo dpkg -i google-chrome*.deb

Thursday, May 12, 2016

How to Encode and Decode Strings with Base64 in JavaScript

Internet Explorer 10 and above

// Define the string
var string = 'Hello World!';

// Encode the String
var encodedString = btoa(string);
console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh"

// Decode the String
var decodedString = atob(encodedString);
console.log(decodedString); // Outputs: "Hello World!"

Cross-Browser Method (compressed)

// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}

// Define the string
var string = 'Hello World!';

// Encode the String
var encodedString = Base64.encode(string);
console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh"

// Decode the String
var decodedString = Base64.decode(encodedString);
console.log(decodedString); // Outputs: "Hello World!"

Tuesday, May 10, 2016

How to convert comma-separated String to ArrayList?

Here is another one for converting CSV to ArrayList:
List<PageData> pages = new ArrayList<PageData>();
                
if (data.getPageName() != null) {
   String pageNames=data.getPageName();
   String pageIds=data.getPageId();
   List nameList= new ArrayList(Arrays.asList(pageNames.split(",")));
   List idList= new ArrayList(Arrays.asList(pageIds.split(",")));
                    
   for(int i=0;i<nameList.size();i++){
                        
      long layoutId = Long.valueOf(idList.get(i).toString());
      PageData pD = new PageData();
                        
      pD.setName(nameList.get(i).toString());
      pD.setLayoutId(layoutId);

      pages.add(pD);
   }
}

git replace local version with remote version

This is the safest solution:
git stash
Now you can do whatever you want without fear of conflicts.
For instance:
git checkout origin/master
If you want to include the remote changes in the master branch you can do:
git reset --hard origin/master
This will make you branch "master" to point to "origin/master".