Programming Methods & Algorithms scripts - Top 4 Download

Programming Methods & Algorithms script downloads

Random Password Generation

Random Password Generation script is a code snippet to generate an 8 character alphanumeric password. ...
Python

A meta class that provides behavior like Ruby

This script brings a Ruby-like class behavior. When a class is declared, it extends the old class if the class name exists already. ...
Python

Missed SIGINT in multithreaded programs

Multithreaded Python programs often ignore the SIGINT generated by a Keyboard Interrupt, especially if the thread that gets the signal is waiting or sleeping. This module provides a workaround by forking a child process that executes the rest of the program while the parent process waits for signals and kills the ...
Python

The Singleton Pattern implemented with Python

This script contains a class that shows how to implement the singleton pattern in Python. A singleton is a class that makes sure only one instance of it is ever created. Typically such classes are used to manage resources that by their very nature can only exist once. ...
Python

Get system language dependent paths on windows

This module provides a few functions to retrieve the path names of some windows system directories from the registry and the environment. These path names can be different depending on OS version, installation language, current user and personal setup. Because of this, they should not be included statically in your program. ...
Python

Get attributes of an object in MS Active Directory

Sometimes it is useful to know what attributes are available to you for an object in active directory. You cannot ask the object directly for that, instead you need to use the schema of the object. All of this is done with python's COM support using win32com. By default only attributes ...
Python

Tkinter moving geometry methods

A common way to create new compound widgets is to inherit Frame, create everything you need inside it and pack this base Frame on your application.This script is an alternative to this method, that sets geometry methods and options from a wiget to another. ...
Python

Permutation

This script contains a small but efficient recursive function for printing the permutation of characters in a given string. ...
Python

Encrypting A String

The main purpose of these functions are to encrypt and decrypt a string (or change the string from one "language" into another). The code is simple, but it provides a simple solution to a well-known encryption scheme. As a recommendation, this may be better when used in conjunction with an encoding ...
Python

Ruby like syntactic sugar

Ruby offers very nice language constructs for loops or for iterating over lists like the following: 5.times { print "Hello World" }. This recipe shows how to implement these features in python. ...
Python

Call a Callback when a Tkinter Text is Modified

This script shows you how to make use of the virtual event that determines to call your own callback. Tkinter Text widget notices when it's modified. ...
Python

Allowing the Python profiler to profile C modules

This script lets you take into account time spent in C modules when profiling your Python code. Normally the profiler only profiles Python code, so finding out how much time is spent accessing a database, running encryption code, sleeping and so on is difficult. Profilewrap makes it easy to profile C ...
Python

Computing permutations with duplicates

This script handles duplicate values in a list. It could easily be made a generator, and it does not require recursion. ...
Python

Finite State Machine FSM

This script shows a Finite State Machine (FSM) that can be used for small parsing tasks. The code is quite simple. The bulk of it is comments. In addition to state this FSM also maintains a user defined "something". This "something" is effectively memory, so this FSM could be considered a ...
Python

Drawing inheritance diagrams with Dot

Dot is a very nice graph description language developed at MIT. Combined with Python, it makes an ideal tool to automatically generate diagrams. This script produces beautiful inheritance diagrams for Python classes (and metaclasses too). In particular the recipe allows to display the MRO (Method Resolution Order) for complicate inheritance hierarchies. ...
Python

Load data in browser without using temp files

This script displays the html files in the default web browser without creating a temp file. It instantiates a trivial http server and calls webbrowser.open with a URL to retrieve html from that server. ...
Python

A generator for any number of for loop

Python has a number of nice methods to handle 'for' loops. However, the situation often arises where you have a large number of nested loops. This script allows you to reduces the number of loops to one. ...
Python

Arrayterator

This class creates a buffered iterator for reading big arrays in small contiguous blocks. The class is useful for objects stored in the filesystem. It allows iteration over the object without reading everything in memory; instead, small blocks are read and iterated over. The class can be used with any object ...
Python

All k subsets from an n set

This script yields each subset of size k from a super set of size n. There are two methods. The first operates on sets of integers of the form range(n). The seconds operates on arbitrary sets or lists. ...
Python

A simple date class

This script can be used by anyone who wants a date object for a program. The code was written as a help for someone trying to do the same thing in C . ...
Python