-
Recent Posts
Recent Comments
Archives
- June 2011
- February 2011
- January 2011
- December 2010
- April 2010
- March 2010
- February 2010
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- February 2007
Categories
- Algorithms
- Assembly
- C
- Challenges
- Compilation
- computer science
- Cryptography
- CSS
- Databases
- decompilation
- Design
- Fractals
- Game Development
- Geometry
- gotchas
- Graphics
- Group Theory
- Humour
- Javascript
- Linux
- Math
- Miscellaneous
- Optimization
- Optimization
- Optimization
- Optimization
- Origami
- Personal
- Programming
- Programming Philosophy
- Projects
- Protocols
- Python
- rants
- Research
- Security
- Sound
- startup
- Statistics
- Teaching Programming
- Testing
- Uncategorized
- Utility Functions
- web-design
Category Archives: Utility Functions
Fast Peak Autocorrelation
So, I was at geekcon. It was a blast. There were many interesting projects, and I didn’t get to play with them all. I did get to work a bit on the Lunar Lander from last year, and this year … Continue reading
Posted in Algorithms, Math, Programming, Projects, Python, Utility Functions
Tagged autocorellation, automatic guitar improviser, geekcon, Math, pyimprov, signal processing
Leave a comment
Easy Harvesting
Image by existentist. I’ve been doing a lot of harvesting (aka screen-scraping) lately. Fortunately, I don’t need forms automation, so I’m using urllib2 and not Mechanize like my friend Ron Reiter recommended. At first, when I wanted to get some … Continue reading
Posted in Programming, Python, Utility Functions
Tagged BeautifulSoup, Harvesting, Programming, Python
Leave a comment
Small Python Interactive Interface Trick
Not too long ago, I helped someone with some research work, and one of the research tools was also used from the Python interactive prompt. The interface used was handy enough for development: intuitive, readable, short, and useful. Still, for … Continue reading
Posted in Programming, Python, Research, Utility Functions
Tagged Interactive Prompt, NoParens, Python, Research
9 Comments
Python Tidbits
Memory Leaks With the advent of the Python’s garbage collector, it would seem that Python programs should not leak memory. However, this is not always the case. With just a bit of circular references, you can find yourself leaking quite … Continue reading
Posted in Programming, Python, Utility Functions
Tagged gc, memory leak, Python, reference cycle, undefined
Leave a comment
Various Small Python Helpers
I’ve been working lately with arkon on various projects related to diStorm. One of these projects involved writing a solid Python API around an existing C API. This C API uses a lot of flags as arguments and return values … Continue reading
Posted in Programming, Python, Utility Functions
Tagged Programming, Python, Utility Functions
5 Comments
Solution for the Random Selection Challenge
A few days ago, I wrote up two small Python Challenges. Several people have presented solutions for the first challenge, and I also posted my solution in the comments there. However, the second challenge remained unsolved, and I will present … Continue reading
Harvesting with threadmap
From time to time, I need to harvest a website, or many websites. For example, to collect the data from IMDB to run the Pagerank algorithm. Other times I need to query some non-web servers. Usually in such cases, I … Continue reading
Posted in Programming, Python, Utility Functions
Tagged Harvesting, Map, Multi-Threading, Programming, Python
3 Comments
Small Python Challenge No. 2 – LRU Cache
Caching is easy. Consider the cache I used to optimize the recursive spring: class _NotInDict(object): pass _NotInDict = _NotInDict() def cached(func): cache = {} def wrapper_func(*args): prev_result = cache.get(args, _NotInDict) if prev_result is _NotInDict: result = func(*args) cache[args] = result … Continue reading
Posted in Algorithms, Challenges, computer science, Programming, Python, Utility Functions
Tagged challenge, LRU-cache, Python
2 Comments
Simple word lookup for crosswords and such…
I am swamped with university homework. I did manage to come up with some small somewhat useful utility. Do you know when you need a word that ends with a double letter and then an ‘n’? you would want to … Continue reading
Posted in Programming, Python, Utility Functions
Tagged Algorithm, Natural Language Processing, NLTK, Python
Leave a comment
Small Python Utility Functions
While working with Gil Dabach on Distorm3, I found out that I’ve been missing a lot of utility functions. I’m going to write about some of them now. def classify_to_dict(seq, key_func): result = {} for item in seq: key = … Continue reading