Custom Search

Thursday, February 28, 2013

How To Install mysql query browser in ubuntu

How To Install mysql query browser in ubuntu 12.10

Download
http://mysql.ntu.edu.tw/Downloads/MySQLGUITools/mysql-gui-tools-5.0r12-linux-x86_64.tar.gz

#tar -xzf mysql-gui-tools-5.0r12-linux-x86_64.tar.gz

#cd mysql-gui-tools-5.0





#./mysql-query-browser --update-paths .

#./mysql-query-browser

How To Install mysql workbench on ubuntu

How To Install mysql workbench on ubuntu 12.10

#sudo add-apt-repository ppa:olivier-berten/misc

#sudo apt-get update
sudo apt-get update
sudo apt-get update
sudo apt-get update

#sudo apt-get install mysql-workbench

#mysql-workbench &

mysql-workbench &

Wednesday, February 27, 2013

How To Python Sorting List of Dictionaries

ldict = [{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]

newlist = sorted(list_to_be_sorted, key=lambda k: k['name'])

import operator
newlist = sorted(list_to_be_sorted, key=operator.itemgetter('name'))

import operator
ldict.sort(key=operator.itemgetter('name'))

How To Python Sorting Objects with attributes

class Student:
        def __init__(self, name, grade, age):
                self.name = name
                self.grade = grade
                self.age = age
        def __repr__(self):
                return repr((self.name, self.grade, self.age))



student_objects = [
        Student('john', 'A', 15),
        Student('jane', 'B', 12),
        Student('dave', 'B', 10),
    ]

sorted(student_objects, key=lambda student: student.age) ###sort by age
* "key" parameter to specify a function to be called on each list element prior to making comparisons.

sorted(student_objects, key=lambda student: student.age, reverse=True)

import operator
sorted(student_objects, key=operator.attrgetter('age'))

How To Python Sorting Tuple of Tuples

import operator

tup=(("a",2),("b",2),("a",1))

sorted(tup, key=operator.itemgetter(1, 0))

sorted(tup, key=operator.itemgetter(1, 0), reverse=True)

How To Python Sorting List of Tuples

student_tuples = [
        ('john', 'A', 15),
        ('jane', 'B', 12),
        ('dave', 'B', 10),
    ]

sorted(student_tuples, key=lambda student: student[2]) ### sort by age
* "key" parameter to specify a function to be called on each list element prior to making comparisons.

sorted(student_tuples, key=lambda student: student[2], reverse=True)

import operator
sorted(student_tuples, key=operator.itemgetter(2))

How To Python String Sorting

my_str = "This is a test string from Andrew"

sorted(my_str.split(), key=str.lower)
* "key" parameter to specify a function to be called on each list element prior to making comparisons.

sorted(my_str.split(), key=str.lower, reverse=True)

How To Python List Sorting

lst = [5, 2, 3, 1, 4]

sorted(lst)

sorted(lst, reverse=True)

lst.sort()

lst.sort(reverse=True)

lst.sort(key=len, reverse=True)
 * "key" parameter to specify a function to be called on each list element prior to making comparisons.

Examples
=======

>>> lst = [5,2,3,1,4]
>>>
>>>
>>> lst
[5, 2, 3, 1, 4]
>>>
>>>
>>> sorted(lst)
[1, 2, 3, 4, 5]
>>>
>>>
>>> res = sorted(lst)
>>>
>>>
>>> res
[1, 2, 3, 4, 5]
>>>
>>>
>>> id(lst)
139698366459848
>>> id(res)
139698366152576
>>>
>>>
>>>
>>> res_rev = sorted(lst, reverse=True)
>>>
>>>
>>> res_rev
[5, 4, 3, 2, 1]
>>>
>>>
>>>
>>> res_rev = sorted(lst, reverse=False)
>>>
>>>
>>> res_rev
[1, 2, 3, 4, 5]
>>>
>>>
>>>
>>> lst
[5, 2, 3, 1, 4]
>>>
>>>
>>>
>>> lst.sort()
>>>
>>>
>>> lst
[1, 2, 3, 4, 5]
>>>
>>>
>>> lst = [5,2,3,1,4]
>>>
>>>
>>> lst
[5, 2, 3, 1, 4]
>>>
>>>
>>> lst.sort(reverse=True)
>>>
>>> lst
[5, 4, 3, 2, 1]
>>>
>>> lst = [5,2,3,1,4]
>>>
>>> lst.sort(reverse=False)
>>>
>>>
>>> lst
[1, 2, 3, 4, 5]
>>>
>>>
>>>
>>>
>>>
>>> lst
[1, 2, 3, 4, 5]
>>>
>>>
>>>
>>> lst = [5,2,3,1,4]
>>>
>>>
>>>
>>> lst
[5, 2, 3, 1, 4]
>>>
>>>
>>>
>>>
>>> lst.sort(key=len)
Traceback (most recent call last):
  File "", line 1, in
TypeError: object of type 'int' has no len()
>>>
>>>
>>>
>>>
>>>
>>> lst = [ [5], [2,3], [1,4,6] ]
>>>
>>>
>>> lst
[[5], [2, 3], [1, 4, 6]]
>>>
>>>
>>>
>>> lst.sort(key=len)
>>>
>>>
>>> lst
[[5], [2, 3], [1, 4, 6]]
>>>
>>>
>>>
>>> lst.sort(key=len, reverse=True)
>>>
>>>
>>> lst
[[1, 4, 6], [2, 3], [5]]
>>>
>>>
>>> lst.sort(key=len, reverse=False)
>>>
>>>
>>>
>>> lst
[[5], [2, 3], [1, 4, 6]]
>>>
>>>
>>>
>>>
>>>
>>> lst
[[5], [2, 3], [1, 4, 6]]
>>>
>>>
>>>
>>>
>>> sorted(lst)
[[1, 4, 6], [2, 3], [5]]
>>>
>>>
>>>
>>> sorted(lst, reverse=False)
[[1, 4, 6], [2, 3], [5]]
>>>
>>>
>>> sorted(lst, reverse=True)
[[5], [2, 3], [1, 4, 6]]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> lst = ["fk", "af", "zs"]
>>>
>>>
>>> sorted(lst)
['af', 'fk', 'zs']
>>>
>>>
>>>
>>> sorted(lst, reverse=True)
['zs', 'fk', 'af']
>>>
>>>
>>>
>>> sorted(lst)
['af', 'fk', 'zs']
>>>
>>>
>>>
>>> lst = ["fky", "af", "zsxw"]
>>>
>>>
>>> sorted(lst)
['af', 'fky', 'zsxw']
>>>
>>>
>>>
>>> lst = ["fky", "afxe", "z"]
>>>
>>>
>>>
>>> sorted(lst)
['afxe', 'fky', 'z']
>>>
>>>
>>> sorted(lst, key=len)
['z', 'fky', 'afxe']
>>>
>>>
>>>
>>>
>>> sorted(lst, key=len, reverse=True)
['afxe', 'fky', 'z']
>>>
 

Monday, February 25, 2013

Python different ways to remove element from List

Python different ways to remove element from List



Python different ways to remove element from Dictionary

Python different ways to remove element from Dictionary



Python different ways to Add or Remove element from Tuple

Python different ways to Add or Remove element from Tuple


Friday, February 22, 2013

KVM How to Install Configure and Create Virtual Machine on Ubuntu

1)
Check whether CPU has hardware virtualization support.


KVM only works if your CPU has hardware virtualization support –
either Intel VT-x or AMD-V. To determine whether your CPU includes these features,
run the following command:

#sudo grep -c "svm\|vmx" /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization,
while a 1 or more indicates that it does.


2)
Install KVM and supporting packages.


Virt-Manager is a graphical application for managing your virtual machines —
you can use the kvm command directly, but libvirt and Virt-Manager simplify the process.

#sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager


3)
Create User.


Only the root user and users in the libvirtd group have permission to use KVM virtual machines.
Run the following command to add your user account to the libvirtd group:

#sudo adduser saju 
#sudo adduser saju libvirtd

After running this command, log out and log back in as saju

4)
Check whether everything is working correctly.


Run following command after logging back in as saju and you should see an empty list of virtual machines.
This indicates that everything is working correctly.

#virsh -c qemu:///system list

5)
Open Virtual Machine Manager application and Create Virtual Machine


#virt-manager

http://virt-tools.org/
http://virt-manager.org/

Wednesday, February 20, 2013

Fedora How to Install Free and Non Free Repository

Fedora 18 How to Install Free and Non Free Repository

Goto http://rpmfusion.org/Configuration/

To enable access to both the free and the nonfree repository use the following command:


For Fedora 18:
------------------
#su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-18.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-18.noarch.rpm'

How to Install Skype on Fedora 18

How to Install Skype on Fedora 18

https://support.skype.com/en/faq/FA12120/getting-started-with-skype-for-linux

https://support.skype.com/en/faq/FA12120/getting-started-with-skype-for-linux#2.3

http://download.skype.com/linux/skype-4.1.0.20-fedora.i586.rpm

1) change directory to where the file "skype-4.1.0.20-fedora.i586.rpm" downloaded.
#cd Downloads


2) Install Skype
#yum install skype-4.1.0.20-fedora.i586.rpm






Sunday, February 17, 2013

How To Setup and Configure iSCSI In FreeNAS

How To Setup and Configure iSCSI In FreeNAS 8.3

Wednesday, February 13, 2013

How to Install Teamviewer 8 in CentOS 6

How to Install Teamviewer 8 in CentOS 6

1)
Goto http://www.teamviewer.com/hi/download/linux.aspx

http://www.teamviewer.com/download/version_8x/teamviewer_redhat.rpm



2)
Change directory to where rpm file "teamviewer_redhat.rpm" is downloaded (Important step).
Otherwise will get following error when running command "yum install teamviewer_redhat.rpm".

Loaded plugins: langpacks, presto, refresh-packagekit
No package teamviewer_redhat.rpm available.
Error: Nothing to do

3)
Run following command to install Teamviewer 8.
#yum install teamviewer_redhat.rpm

How to use vmware-vmrc

How to use vmware-vmrc

1)
How to connect to ESXi host using vmware-vmrc


#vmware-vmrc -h 192.168.1.88
OR
#vmware-vmrc -h 192.168.1.88 -u root -p vmware123

-h 192.168.1.88 ===> IP of ESXi Host
-u root -p vmware123 ===> Username and Password of ESXi Host 192.168.1.88



2)
How to directly connect to a Virtual Machine using vmware-vmrc


#vmware-vmrc -h 192.168.1.88 -u root -p vmware123 -M 84

-h 192.168.1.88 ===> IP of ESXi Host
-u root -p vmware123 ===> Username and Password of ESXi Host 192.168.1.88
-M 84 ===> moid of VM

How to Install Fedora 18 Gnome

How to Install Fedora 18 Gnome


How to Install Teamviewer 8 in Fedora 18

How to Install Teamviewer 8 in Fedora 18

1)
Goto http://www.teamviewer.com/hi/download/linux.aspx

http://www.teamviewer.com/download/version_8x/teamviewer_redhat.rpm



2)
Change directory to where rpm file "teamviewer_redhat.rpm" is downloaded (Important step).
Otherwise will get following error when running command "yum install teamviewer_redhat.rpm".

Loaded plugins: langpacks, presto, refresh-packagekit
No package teamviewer_redhat.rpm available.
Error: Nothing to do

3)
Run following command to install Teamviewer 8.
#yum install teamviewer_redhat.rpm

How to Install Teamviewer 7 in Fedora 18

How to Install Teamviewer 7 in Fedora 18

1)

Goto http://www.teamviewer.com/hi/download/linux.aspx

Download http://www.teamviewer.com/download/teamviewer_linux.rpm



2)
Change directory to where rpm file "teamviewer_linux.rpm" is downloaded (Important step).
Otherwise will get following error when running command "yum install teamviewer_linux.rpm".

Loaded plugins: langpacks, presto, refresh-packagekit
No package teamviewer_linux.rpm available.
Error: Nothing to do

3)

Run following command to install Teamviewer 7
#yum install teamviewer_linux.rpm

Sunday, February 10, 2013

How to Install VMware Player 5.0.1 in Ubuntu

1) Download
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0

2) Install
# sudo sh VMware-Player-5.0.1-894247.x86_64.bundle

VMware ESXi 5 How to Browse datastores

VMware ESXi 5 How to Browse datastores


How to install scp in CentOS Server

How to install scp in CentOS Server


How to enable debugging log in squid3 proxy server

How to enable debugging log in squid3 proxy server


How to install teamviewer8 in ubuntu 12.10 64bit

How to install teamviewer8 in ubuntu 12.10 64bit


Saturday, February 9, 2013

ClearOS how to Install app via Terminal

1) Login to ClearOS 6.3 SSH console.
Example: ssh root@192.168.1.7

2) Install App via command
#yum --enablerepo=* install app-mysql

ClearOS how to Uninstall or Disable app

1) Login to ClearOS SSH console.
Example: ssh root@192.168.1.7

2) List App
# yum --enablerepo=* list app-mysql

3) Remove App
# yum --enablerepo=* remove app-mysql

* Check Web console and confirm that App is removed.


ClearOS how to Install new app

1) Login to ClearOS Web console. (https://192.168.1.7:81/)

2) Goto "App Details".  (https://192.168.1.7:81/app/marketplace/view/dashboard)

3) Search App.
* Example : Search for Mysql

4) Select an App and click "Install/Upgrade Selected App".

Friday, February 8, 2013

ClearOS 6.3 How to Install and Configure

1) Download ClearOS
http://www.clearfoundation.com/Software/downloads.html
Download ISO Image or VirtualBox vmdk file

2) Install ClearOS

3) Open web console.
Example: https://192.168.1.7:81

4) Configure ClearOS

5) Install Apps


Thursday, February 7, 2013

How To Use UUID To Mount Partitions under linux

1)
#sudo blkid

2)
#sudo vim /etc/fstab

3)
#sudo mount-a

Tuesday, February 5, 2013

VMware ESXi SSH CLI basic commands


vim-cmd vmsvc/getallvms
Lists all vm's running on hypervisor and provides vmid

vim-cmd vmsvc/power.off vmid
Powers off vmid referenced from getallvms command

vim-cmd vmsvc/power.on vmid
Powers off vmid referenced from getallvms command



vim-cmd vmsvc/power.reboot vmid
Reboots vmid referenced from getallvms command

vim-cmd vmsvc/destroy vmid
Deletes the vmdk and vmx files from disk

vim-cmd hostsvc/maintenance_mode_enter
Puts hypervisor into maintenance mode

vim-cmd hostsvc/maintenance_mode_exit
Takes hypervisor out of maintenance mode

vim-cmd solo/registervm /vmfs/vol/datastore/dir/vm.vmx
Registers vm in hypervisor inventory

vim-cmd vmsvc/unregister vmid
Unregisters vm with hypervisor

vim-cmd vmsvc/tools.install vmid
Starts vmware tools installation for VM

vim-cmd hostsvc/net/info
Provides information about hypervisor networking

chkconfig -l
Shows daemons running on hypervisor. Can also be used for configuration.

esxtop
Same as linux top for vmware

vmkerrcode -l
List of vmkernel errors

esxcfg-info
Lists a LOT of information about the esx host

esxcfg-nics -l
Lists information about NIC's. Can also be used for configuration.

esxcfg-vswitch -l
Lists information about virtual switching. Can also be used for configuration.

dcui
Provides console screen to ssh session

vsish
Vmware interactive shell

Inspired by article
http://robertbchase.blogspot.in/2008/12/vmware-esxi-ssh-cli-commands.html