Change wpadminbar (top bar) color of wordpress admin panel

So here is how we can change the wordpress adminbar (top bar color).

We need to add the following to functions.php. I added them to the end of the file.

add_action('wp_head', 'change_bar_color');
add_action('admin_head', 'change_bar_color');
function change_bar_color() {
?>

Source : Link

Android emulator – switch to landscape mode

    ctrl+fn+F11 on Mac to change the landscape to portrait and vice versa.
    left-ctrl+F11on Windows 7.
    ctrl+F11on Linux.

For Mac users, you only need to use the fn key if the setting “Use all F1, F2 etc. keys as function keys” (under System Preferences -> Keyboard) is checked.

left-ctrl+F11on Windows 7 It works fine in Windows 7 for android emulator to change the landscape orientation to portrait and vice versa.

This just saved my day!

Source : Stackoverflow

Solution : Cordova Jquery Ajax calls not working @Android4.x

On Cordova 5.x , for the android platform a plain ajax call does not work

It does not give any detailed error

readystate: 0
status : 0
errortext : error

__________________________________________

Solution:

Things are changing.

After doing research on the issue and trying out different options, I came across this.

1. You need to install the cordova whitelist plugin (this is not available for ios currently though)

cordova plugin add cordova-plugin-whitelist

2. In config.xml

 

in place of the old, tag.

And bam, all the ajax calls are working properly.

Note: You will need to add the following to your html files in the section.

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>

else you will get the following error message while running the app.

“No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.”

Hope it helps somebody facing similar issues.

Diving into Angular JS – Installation Windows 8

So this time its Angular JS, something new I am trying to learn

The current instructions are for installing angularJS on Windows 8/8.1 platform (may also work on windows 7, however not tested)

Dependencies Installation :
I had some of the dependecies already installed like Git, Java, Node.JS.

We will be using Grunt as our build system. For installing Grunt :

npm install -g grunt-cli

We will be using Bower to manage client-side packages for the docs. For installing Bower :

npm install -g bower

 

Then I forked the github account at https://github.com/angular/angular.js

 

Building AngularJS

To build AngularJS, you clone the source code repository and use Grunt to generate the non-minified and minified AngularJS files:

Open command prompt with administrator privileges (right click, run as Administrator)(Note: This is because grunt package creates some symbolic links)

# Clone your Github repository:
git clone "git@github.com:<your-github-username./angular.js.git"

# Go to the AngularJS directory:
cd angular.js

# Add the main AngularJS repository as an upstream remote to your repository:
git remote add upstream "https://github.com/angular/angular.js.git"

# Install node.js dependencies:
npm install

# Install bower components:
bower install

# Build AngularJS:
grunt package

 

 

Link Php of XAMPP to system default (Ubuntu)

We use XAMPP, however the php installation location of XAMPP is separate from what is used when php is installed via command line.
After a full clean up of the installation,

We tried to link up Php in XAMPP to be used as system default, ie like the default php, from terminal php command will execute the xampp version of php.. and we don’t have to write the full path everytime we use php from command line!

The first command we executed was

sudo ln -s /opt/lamp/bin/php /usr/bin/php

However after this even, the changes were not reflected via terminal

Then we did some changes in the bash.

gedit ~/.bashrc

Appended the following to the last line

export PATH=/opt/lampp/bin:$PATH

and saved the file and exited.

Now when we do echo $PATH in the terminal, we see that /opt/lampp/bin has been included.

Now we do a php -v from command line. And woah PHP runs properly! The version currently in our xammp installation is 5.6.

Cheers!

Note: We are using Ubuntu 12.04 LTS

Delete PHP from Ubuntu Installation

Below are the commands that will delete the default php installation from your system. The commands worked well with Ubuntu 12.04 LTS

bash -c "sudo apt-get remove php*"

sudo apt-get remove --purge php-pear php5-cli php5-common php5-curl php5-fpm php5-gd php5-intl php5-mysql php5-pspell php5-readline php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

sudo aptitude remove ~iphp

Cheers!

Installing a specific version of Cordova

With the recent releases and compatibility issues with the plugins we have to switch to some particular version of Cordova/Phonegap which works stable for our exisiting projects. However I was having issue in finding the exact version no to which I need to re-install.

Using command line we can see the versions of cordova available by

npm view cordova versions

The output is like :

C:\Users\upasana>npm view cordova versions

[ '0.0.0-fake',
'0.0.1',
'0.0.2',
'0.0.3',
'0.0.4',
'0.0.5',
'0.0.6',
'0.0.7',
'0.0.8',
'0.0.9',
'0.1.0',
..............
..............
'4.0.0',
'4.0.1',
'4.1.0',
'4.1.1',
'4.1.2',
'4.1.3-nightly.2014.10.21',
'4.2.0',
'4.3.0',
'4.3.1',
'5.0.0',
'5.1.1' ]

 

Then to install a particular version we use the following command.

npm install -g cordova@4.2.0

Have a great day!

Removing mysql from ubuntu

Below are the steps to remove mysql from ubuntu (it also works when you do not have the mysql root password)

The commands worked fine with Ubuntu LTS 12.0.4 and and mysql 5.5

sudo service mysql stop  #or mysqld
sudo killall -9 mysql
sudo killall -9 mysqld
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo deluser mysql
sudo rm -rf /var/lib/mysql
sudo apt-get purge mysql-server-core-5.5
sudo apt-get purge mysql-client-core-5.5

Have a great day!

Ref: StackOverflow

Removing apache2 from ubuntu

Follow these steps to remove the apache2 service using Terminal (we were successfully able to uninstall Apache2 from Ubuntu 12.0.4 LTS):

  1. First stop the apache2 service if it is running with: sudo service apache2 stop
  2. Now remove and cleanup all the apache2 packages with:
    sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
    
  3. Finally, run sudo apt-get autoremove just in case any other cleanup in needed

You can do the following two tests to confirm apache has been removed:

  1. which apache2 – should return a blank line
  2. sudo service apache2 start – should return apache2: unrecognized service

Have a great day!

Source : AskUbuntu