Merge Sort Algorithm in Python

Merge sort algorithm breaks a larger list into several smaller lists, sorts them individually and incrementally merges them back to return the sorted list. For instance, let us say we need to sort a list of 500 elements. An algorithm implementation like bubble sort would take O(n^2) number of steps, which is about 250,000 steps. […]

Youtube Upload : Recommended Format & Video Size

After having spent a lot of time looking for the best format & video size for Youtube uploads, I decided to do some testing on the various available options. And here’s what the test results have to say. Best Video Format for Streaming Videos I took up a video and converted into three formats: Flash […]

Insertion Sort Algorithm in Python

Insertion sort algorithm works by comparing two elements at a time and swapping them if required. Up till this, it is similar to the bubble sort algorithm. However unlike bubble sort algorithm which iterates through the entire loop multiple times swapping just two elements at a time, insertion sort keeps swapping elements at one end […]

Bubble Sort Algorithm in Python

The bubble sort is simplest of all sorting routines. Sorting in this context refers to arranging a list of data(array in other languages) in some order say ascending and descending for numbers and alphabetical order for strings. To begin with, imagine that we have an list of numbers that we wish to sort in ascending […]

Book: “Tkinter GUI Application Development Hotshot”

After many months of writing, my first ever book finally stands published. This book is titled: “Tkinter GUI Application Development Hotshot” and it has been published by Packt Publishing, a market leader in publishing technical books on open source software. Key Features 1) Book explains GUI programming in Tkinter by developing 10 real world applications […]

Multi-Threaded TCP/IP Port Scanner in Python

Majority of communication over Internet happens using TCP. For instance, the web server normally resides on TCP port 80, email server on port 25, and FTP server on port 21. Here’s the code for conducting a TCP full connect scan. from socket import * from threading import * def connect_to_host(host, port): lock_object = Semaphore(value=1) try: […]

Tkinter ttk Treeview Simple Demo

Did not find a suitable documentation for ttk Treeview widget. Keeping it here for records and reference. from Tkinter import * import ttk root = Tk() tree = ttk.Treeview(root) tree[“columns”]=(“one”,”two”) tree.column(“one”, width=100 ) tree.column(“two”, width=100) tree.heading(“one”, text=”coulmn A”) tree.heading(“two”, text=”column B”) tree.insert(“” , 0, text=”Line 1″, values=(“1A”,”1b”)) id2 = tree.insert(“”, 1, “dir2″, text=”Dir 2”) tree.insert(id2, […]

Getting Started with HTML5 Canvas

HTML5 canvas markup is expected to take the web by storm as new avenues for its usage are being explored by advertisers, artists, educators, game developers, media, data visualizers and others. HTML5 implements many new and exciting feature and canvas is perhaps the most powerful of these. This is the first in a series of […]

Tkinter Color Chooser Dialog Simple Demo

Here’s a quick demo of Color Chooser Dialog from Tkinter. Python 2.x Version from Tkinter import * from tkColorChooser import askcolor def getColor(): color = askcolor() print color Button(text=’Select Color’, command=getColor).pack() mainloop() Python 3.x Version from tkinter import * from tkinter.colorchooser import * def getColor(): color = askcolor() print color Button(text=’Select Color’, command=getColor).pack() mainloop() The […]