Skip to main content

Posts

Showing posts from January, 2012

Python / Django UnicodeEncodeError hacks.

Python plays with unicode nicely nowadays. Bt what if you must deal with old time formats conversion, or ASCII files exporting for e.g. You may also use software that is out of date but is too long to rewrite...  Here often errors occur. I have received mine at copy-pasting from MS Word into Django admin UI  by stupid users. Most of the website played nicely with this fancy characters, but exporting to CSV failed due to non ASCII characters support. Google said nothing special. Python docs about unicode usage briefly cover this type of events. So here is the result of some hours of experiments. I've decided to rewrite some of the python functionality to create decode function with behavior for my needs. Hopefully they will shorten you some time with those collisions you may get in your Django apps... Anyway I've started to receive errors like: Exception Type: UnicodeEncodeError Exception Value: 'asc...

Installing CouchDB for Mac OS X. Nuances.

Our project will have a new architecture changes in future. We've chosen from different tech. But now we 're experimenting with CouchDB a bit. It may become a part of our new architectural Changes. I'll try to cover most of newbies observations with CouchDB for Python(Django) programmer, planning to use it in your project. First article will be, unsurprisingly, installing CouchDB under Mac OS X. It, sure, has some inches that you need to scratch. So let's roll... CouchDB is not a simple SQL database like you used to install before. It has own server to accept connections. And, in fact, you can work with database from your browser GUI (without other server proxy, like Django or ...). Anyway it will not be our target. Building JS UI is quite easier with CouchDB and changes your logic dramatically. To build UI with Python we need some proxy parts. Anyway, again, CouchDB is a standalone server, that runs on your server's port and talks to your APP/Browser/wha...

Establishing Dev environment with PyCharm + Virtualenv for Django development

I'm a fan of IDE's. Also I'm a fan of GUI's. I also use console where needed, but why waist time typing commands when you can just point and click. I've been using Eclipse + PyDev for almost a year and recently switched to PyCharm. Why I prefer PyCharm: - Template Debugging. (you can set a normal breakpoints in templates) - Easy Virtualenv connection. (Set an interpreter from your virtualenv and you're ready to roll) - Has excellent set of most common CVS integrations (Git, SVN, Redmine, etc...) - Has looots of tiny tasty things for coding and proper code highlighting over JS and HTML out of the box) - Has proper and shiny themes out of the box. So I'm a blind minded blond, it seems now. But design of this IDE is really attractive IMHO :) - OH and it's quite quick and has ALL the functions I need. Here is a brief instruction to setup PyCharm IDE to work with my typical Django project. 1.  First thing you need is a PyCharm installation. Y...