Index ¦ Archives  ¦ Atom  ¦ RSS > Tag: python ¦ RSS

Cara ready to be tried externally!

Wed 29 April 2015

After months of internal use without problems, we're ready to release cara for others to use. We would be very happy if others picked up cara and made it work for them. If you've been looking at the Cap'n Proto project but were hesitant to shoehorn it into your Python …

Continue reading →


Building a binary into your Python package

Mon 15 December 2014

Firstly, let me acknowledge this is a rare problem. So the lack of documentation I ran into is totally acceptable. The problem: I have a Python package that has a C++ component that isn't an extension, it's a binary. I wanted that binary to be on the PATH of users, but it's not a Python entry point, so the usual way failed while attempting to read the file as text.

So I did some hacking, and after a lot of attempts, I whittled the result back down to something that's actually quite reasonable. If I had ever seen a documentation page or blog post mentioning this is how you do it, I would have been able to just follow along and I would have been happy with the result. Sadly, there was none, so I'm writing it:

Continue reading →


Cara generation method changed; delayed

Mon 01 December 2014

Up until this week, cara had been outputting its schema files something like this:

import cara
ann = cara.Annotation(name='ann', type=cara.Text)
class MyStruct(cara.Struct):
    field1 = cara.Field(name='field1', type=cara.Int32)

However, this causes various problems due to capnp allowing use of types declared later …

Continue reading →


Cap'n proto alternative RPC API in the works

Wed 26 November 2014

Having started a new project that requires RPC, but without the benefits (and restrictions) imposed by my previous employer, I've gone on a detour towards building another RPC layer. However, knowing that building the entire layer from scratch is both a waste of time for me and would just add noise to any community I sent this to, I decided to only create the missing parts and rely on existing technologies wherever I could.

Continue reading →


PiCloud cloudpickle

Fri 10 January 2014

There are quite a few implementations for this problem, but none of them worked quite as well. picloud's cloudpickle is great!

The problem: You have a python function on one computer that you want to execute on the other. The naive way is rather simple, but you quickly run into problems.

Continue reading →


pygame - "video system not initialized" error

Sun 09 October 2011

I got this error every time I tried getting an event in pygame, so I had just put a try-catch and hoped it would go away. Turns out, the init check is done for almost every pygame.key function too so I got stuck. I spent a lot of time …

Continue reading →


Django Models without Apps OR Everything Django Truly in a Single File

Sun 02 October 2011

This problem has bugged me for a few years actually, I have tried over and over again to use a single file for all of a Django projects' python code. This has proved very possible as long as your project did not have models, because no tutorial or howto online includes a model. Today I found out how to create models without putting them in a separate file and directory (models.py inside an app folder) so I would like to create the ultimate single-file Django tutorial.

Continue reading →


Django (Simple) Template Maker

Fri 16 September 2011

I was recently building an app that takes an email template and sends it to a membership list, and thought that I should be able to allow the users to make the templates themselves. The templates that I had seen for the past 4 years for the emails have been …

Continue reading →


Random weighted choice

Tue 30 August 2011

Many times I need to choose randomly from a list of 'neighbors' according to some weight assigned to them, and I'd like to share my technique. My language of choice is Python, but this technique should work in any language that has some sort of list and a random number …

Continue reading →


Django + Twisted + IRC Server = django_ircd

Sun 27 March 2011

I've been working with Yardbird (Django + Twisted + IRC Bot) and I thought about extending the bot I use to do more than just log the one channel it's in. What if it logged all the channels? What if it was the main authentication route instead of O: lines and the …

Continue reading →

© Fahrzin Hemmati. Built using Pelican. Theme by Giulio Fidente on github.