requirement Watch changes in a ftp folder, whenever a new xml file is created, or when an existing file is modified this needs to be parsed and its contents inserted in the database. tools Python 2..7 watchdog Install from pip pip install watchdog Watchdog is a Python API library and shell utilities to monitor file […]
Category: Uncategorized
Flask Google Maps (plus: how to write a Flask extension)
Last week I was writing a talk to give at Google Developers Bus and I needed to show how to integrate Flask and Google Maps API, as I did not found any extension to Google Maps I decided to create one. One of the best things in Flask is the way it is extended by […]
Quokka CMS new features and roadmap to beta version
I started the development of Quokka CMS in 6th July, and it started as an experiment to learn more about Flask patterns and MongoDB. From the learning experiment I ended creating an extendable CMS. The new logo created by @guswidrig Before talking about the project I have to thank some friends who helped a lot […]
Fetch Current Bitcoin Price with Python
Using the MtGox API, you can easily fetch the current Bitcoin price using a very small Python script. import requests url = ‘http://data.mtgox.com/api/2/BTCUSD/money/ticker’ r = requests.get(url, headers={‘Accept’: ‘application/json’}) print r.json()[‘data’][‘avg’][‘display_short’] If you want to support for multiple currencies and more information, here’s an extended version: # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals […]
Why Are There So Many Pythons? A Python Implementation Comparison
Python is amazing. Surprisingly, that’s a fairly ambiguous statement. What do I mean by ‘Python’? Do I mean Python the abstract interface? Do I mean CPython, the common Python implementation? Or do I mean something else entirely? Maybe I’m obliquely referring to Jython, or IronPython, or PyPy. Or maybe I’ve really gone off the deep […]
How I Made Porn 20x More Efficient with Python Video Streaming
Porn is a big industry. There aren’t many sites on the Internet that can rival the traffic of its biggest players. And juggling this immense traffic is tough. To make things even harder, much of the content served from porn sites is made up of low latency live streams rather than simple static video content. […]
Run-time method patching in Python
Often, when programming, we may want to change some already set behavior. This can be accomplished by sub-classing whatever classes we have and overriding those methods we are not happy with. While this works with our own code, what happens if we want to change third party code? Of course we can edit it so […]
Pillow 2-1-0 is Out
Pillow is a popular fork of PIL by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors Pillow 2.1.0 is out! With this release, the Pillow team has finally removed support for “import _imaging”, thus completing the move of PIL modules into the PIL namespace [1]. Many thanks to […]
Heroku Buildpack for Numpy, Scipy and Scikit-Learn
(TLDR: https://github.com/dbrgn/heroku-buildpack-python-sklearn) Background At Webrepublic we just launched a Python based system that among other things does comparison of large texts using tf-idf vectors in a multi-dimensional vector space and measuring the cosine similarity between them (see http://stackoverflow.com/a/8897648/284318). For this, we needed scikit-learn. During the deployment process, I discovered that one does not simply deploy […]
IPython Notebook
Last PyCon US (2013) I attended, there were many interesting talks, but if I had to talk about what’s happening, what’s the trend, between other things I would mention IPython Notebook. In a few words: it’s an excellent tool, you can have an IPython console within your web browser where you can write code snippets […]
Using Jedi with YouCompleteMe
(In case you’re not familiar with it yet, Jedi is an awesome autocompletion library for Python that tries to understand your code. There are editor plugins available for Vim, Emacs and Sublime Text 2.) The “official” Jedi plugin for vim is jedi-vim, but there’s another vim autocompletion plugin that supports Jedi: YouCompleteMe. In contrast to […]
Enums in Python
Until now, if you wanted to use enumeration types in Python you had to fall back to a class-attribute approach: >>> class Color(object): … RED = 1 … GREEN = 2 … BLUE = 3 … >>> print(Color.RED) 1 This has different downsides, for example with representation (Color.RED is represented as an integer, not as […]
List Outdated Dependencies with Pip
In the past, if you wanted to review your installed pip packages to see if there are updates available, you either had to use tools like pip-tools or check all of them manually. But since version 1.3 (released on 2013-03-07), pip supports the checking of dependencies with the new list command. In contrast to pip […]
New Pyramid Site
For the first time in 10 years, http://aclark.net is not powered by Plone. Nothing against Plone: it’s still one of the greatest loves of my life (inasmuch as you can love a software and community, as I do). Why This was not the result of a revolutionary plan, rather more of an evolution. It happened […]
Introduction to SQLAlchemy – Pycon 2013 – Wrapup
Video is up for my Pycon 2013 tutorial Introduction to SQLAlchemy. For those who want to follow along at home, the full code and prerequisite material is available here: Prerequisite code Slides on Speakerdeck