Wednesday, 28 November 2012

Solution: After Exception Catch in Python What will happen?

Exception Handling : After Exception Catch Python will execute remaining code, See below Example  #!/usr/bin/python3 # reading sitemap xml file # a=5 def diverror(a):     a = a/0     print(a) try: diverror(a) except: print("Division Error") a = a+10 print(a) Output: Division Error 15 ...
Read More

Break out of the function in Python

In Python if Any function return any thing or return none means the function is completed ie Break out of the function  Example: def test(a,b):       return "HI Closed"       a = b+10       print(a) test(10,11) output: HI Close...
Read More

Catch all exception in Python3

to catch all exceptions in python3 simple do like bellow try:     code except:     print("Unknown Exception found"...
Read More

Sunday, 25 November 2012

Python current timestamp

To get current time with date in python from datetime import datetime curtime = str(datetime.now()) output : '2012-11-25 14:58:30.465213' ...
Read More

Friday, 23 November 2012

Solution: Extract tar.bz2 files in Linux

To Extract tar.bz2 files in linux use below command root@system1~# tar -xjvf filename.tar.b...
Read More

Wednesday, 21 November 2012

Delete duplicate rows in mysql table

It is Possible to DELETE duplicate rows in MYSQL table based on Particular Field (Coloumn) the SQL Query is ALTER IGNORE TABLE table_name ADD UNIQUE INDEX(coloumn_name);&nbs...
Read More

Thursday, 15 November 2012

IPtables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 268: restorecon: command not found

Solution to : IPtables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 268: restorecon: command not found root@server1:~# ls -l /sbin/ | grep restore lrwxrwxrwx 1 root root     14 May 23 17:52 iptables-restore -> iptables-multi Means policycoreutils not Installed So Install policycoreutils...
Read More

Tuesday, 13 November 2012

Read Large Files Line by Line in Python - Best Way

The readlines() function loads the entire file into memory as it runs. A better approach for large files is to use the fileinput module, as follows:import fileinputfor line in fileinput.input(['myfile']):   print(lin...
Read More

Monday, 12 November 2012

Solution: Dovecot error : Unknown database driver mysql

Dovecot error : Unknown database driver mysql because Dovecot requires the dovecot-mysql package to run mysql authentication. So Install  dovecot-mysql yum install dovecot-mysq...
Read More

Friday, 9 November 2012

Load Kernel Module in Linux Example Load IP table module

Below Instructions shows How to Load Kernel module in Linux check whether module is Loaded or Not if you don't know Exact Module Name then Check All Loaded Modules root@system1:~# lsmod Module                  Size  Used by nf_conntrack_ipv4      18850...
Read More

Tuesday, 6 November 2012

Solution to g++: Command not found in Fedora Problem

g++ command not found means gcc-c++ package not  installed so install gcc-c++ package command root@system1:# yum install gcc-c...
Read More

Install deb packages

To install .deb packages use following command root@system1:~# dpkg -i package.d...
Read More

SSH login without password in Linux

Hi to login into Linux System through SSH with out password Follow Below Steps two systems (Below IP addresses are for Example) system1 ip : 2.2.2.2 system2 ip : 3.3.3.3 Note: For Below Command don't type any thing Simply press Enter root@system1:~# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in...
Read More

Monday, 5 November 2012

convert to binary in PHP

In PHP decbin function is used to convert anything to binary Example: <?php $a = "3"; $b = 4; echo decbin($a)."<br>"; echo decbin($b); ?> Output: 11 1...
Read More
Here We Write The Problems we face at different situations and Solutions to those problems.