Saturday, July 30, 2016

PostgreSQL + SQLAlchemy: accent and case insensitive search

Ignore accents & case

Maybe you know what it's like: you store UTF-8 encoded text/strings in your database but you want to be able to execute an ASCII based query ignoring all those pesky diacritics. It's not always straightforward.

The following tutorial is a compilation of 3 StackOverflow posts and it describes how to perform an accent and case insensitive search with PostgreSQL and SQLAlchemy.

Thursday, February 11, 2016

Tor IP changing and web scraping

Anonymous web scraping

Many of us who scrape web pages, be it for fun, data, love or something else, are concerned about anonymity. Well, not anonymity per se, we just don't want our IP blacklisted.

Many of us choose Tor and its network to achieve our goal. In this post I am going to share my experience and observations using Tor + Privoxy for Python driven web scraping.

Tuesday, December 15, 2015

Atom editor and Perforce integration on Linux (Mac)

Atom for editing, Perforce for version control

Atom is a really cool text editor developed by GitHub. It is modern, lightweight, fast, provides it's own package manager and tons of packages/plugins as well. Though, if you are using Perforce for version control, things may get a bit bitter.

This short post provides an easy and elegant fix for integrating Atom with Perforce on a Linux (Mac) machine. It solves the problem when the atom-perforce package is unable to pick the right p4 client.

Tuesday, October 20, 2015

SyntaxHighlighter on Blogger and an unexpected output in a Python snippet

Syntax highlighting on Blogger

I was looking for an easy way to add syntax highlighting to my code snippets here on Blogger. Yes, you can embed Gist code snippets, but this approach is not ideal always. There must be a better way for doing this. And of course there is!

I found SyntaxHighlighter after a few minutes of googling. It does exactly what I want, it's easy to use, supports many syntaxes and is nicely documented. But, for some Python code, it is doing a bit more than it should.

Thursday, May 14, 2015

Python 3.x and packaging issues

Greetings to ...

We will create a very simple Python 3.4 command line greeting app. It will take two arguments. An user name and an effect (if any) that should be applied to the user name. Then it will print out a greeting message. That's all.

While implementing and testing, we will run into and solve imports and packaging issues that may occur when someone used to Python 2.x is creating, testing and distributing a Python 3.x application containing a sub-package.