Simple python logging module wrapper

Simple python logging module wrapper that can be inherited to the class or can be used as a standalone. This logging wrapper supports logging level of INFO, ERROR and DEBUG with option to print to CONSOLE, FILE , BOTH and NONE.  git pull from mlogger repo.

Following is an example

# Inherited to Class
class tester(MLOGGER):
    def __init__(self):
        MLOGGER.__init__(self,'test',logtype='NONE', filename = 'mylogg.log')
    def testmethod(self):
        self.error('error test')
        self.debug('debug test')
        self.warn('warn test')'info test')

t = tester()

# As Standalone
logger= MLOGGER('Test', level=INFO, logtype = 'CONSOLE', filename = 'mylog.log')
logger.debug('debug test')'info test')
logger.warn('warn test')
logger.error('error test')

Python Natural Sort (Alphanumeric Sort)


Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are ordered as a single character. Natural sort order has been promoted as being more human-friendly (“natural”) than the machine-oriented pure alphabetical order.

def atoi(text):
    return int(text) if text.isdigit() else text

def natural_keys(text):
    alist.sort(key=natural_keys) sorts in human order
    return [ atoi(c) for c in re.split('(\d+)', text) ]


Python: How to create zip of files?

Download Code From Here

import zipfile
import time
import os

def create_zip(zip_filenames):
  print "Creating ", zipped_name
  zf = zipfile.ZipFile(zipped_name, mode='w')

for filename in zip_filenames:
    print "Adding",filename,"in",zipped_name
    ":::ERROR::: Unable to add file to zipped file"
     print "Created Zipped File",zipped_name 

def remove_files(remove_filesnames):
  for filename in remove_filesnames:
    print "Removing", filename

if __name__=="__main__":

  filenames= ['syspreset001','syspreset0161.prst','zip']

Python: How to download file using FTP?

Download the following script from Here.

#Download File with FTP.
#Download_System requires two variables HOST & directory & filename

import ftplib
import sys

#Host and Gets the Filename of the Preset
def Download_System(HOST,directory,filename):
    ftp_download=ftplib.FTP(HOST) #opens Ftp Connection to the HOST
    ftp_download.login( "root", "root") #username, password
    ftp_download.cwd(directory_get) #Change Directory to file directory
    localfile=open(filename_get,'wb') #Open Localfile to write
    ftp_download.retrbinary("RETR " + filename_get, localfile.write) #Get the Filname in Binary
  except Exception as e:
    print ":::ERROR:::: " +str(e)

if __name__=="__main__":
  Directory='Change Directory Here'

Learning Python GUI using Tkinter

As I wanted to learn the python GUI,
I searched on internet and found these very nice tutorials on how to built GUI using Tkinter library of python. There are few more GUI libraries available on the internet as you may be aware such as wxpython, but I found Tkinter suitable for my needs and easy to work with. I started learning from UsingPython , it also has a good basic python tutorials if you want to have a refresher course.


The other one was the Python Course which also has some really nice examples and a bit more than using python but both are good and you can start from either one.

Following are library references which are handy to know what things you can change using arguments.

Persistent Header/ Sticky Header/Stick to Scroll Web (IE/Chrome/Firefox)

I was searching the internet on how to code a sticky header using javascript and found so many articles and multiple ways to achieve it but most of them didn’t work on IE or some of them were too complicated to understand for a person like me who has little know how of the Javascript. So after searching for hours I found the article below which was simple and easy to understand furthermore it was working on IE .


“Many must’ve seen this automatic-header-scroll-stick feature. Where a normal looking header suddenly sticks to the page when the page is scrolled.

Gmail to recently introduced such a “auto-sticking-interaction-header”. I thought I should give a simple explanation about it.”

<!DOCTYPE html>
  <meta name="generator" content= "HTML Tidy for Linux (vers 25 March 2009), see">
  <title>Auto Scroll Lock Header with jQuery</title> 
  <script src= "" type="text/javascript"> </script> 
  <style type="text/css">
    table { 
      background: black;
      color: white;
    body, td {
      font: 13px sans-serif;
    #stickyheader {
      width: 100%;
      height: 10px; 
    #stickyalias { 
      display: none; 
      height: 10px;
    #unstickyheader {
      margin-bottom: 15px;
    #othercontent { 
      margin-top: 20px;
</head> .... ... .. .

 [Read More: Article by Ruturaj]

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required

One of the best article I found to start the wordpress.

You want to start your own blog but you don’t want to look tacky by using an existing design. Creating your own theme can be daunting, but with some assistance you can have a unique design for your blog in no time. This post will help you put it all together using WordPress, the most popular (and free) blogging software available. P

How to Create a Custom Theme for Your WordPress Blog with Minimal Coding Required

Creating a WordPress theme can take quite a bit of work when you’re starting from scratch because you have to put together quite a bit of PHP code (the programming language WordPress uses) before you can even get to creating the look and feel of your site. We’re going to save you the trouble by providing those files pre-made for you, plus a skeletal structure of the CSS you’re going to need to make your WordPress site look the way you want. The PHP code is based upon the work of Ian Stewart, but has been updated for WordPress 3.3.1. If you’re ready to get started, here’s what you’ll need:

[Read More: Full article by Adam Dachis]