Wed 08 February 2023
Context: I'm loading data from one database (A) to another database (Weaviate).
Weaviate only supports UUID, however database A is using strings as the primary
identifier for some tables.
Problem: In order to not duplicate data I need to ensure that the string
identifier gets converted to an UUID in …
Continue reading »
Mon 06 February 2023
Code:
import uuid
my_uuid = uuid.UUID(int=1)
print(my_uuid)
That should show the following string:
00000000-0000-0000-0000-000000000001
You can also convert back to integer by doing:
For my use case this was needed because my source database
has integer based IDs, however the destination …
Continue reading »
Thu 30 May 2013
Noticed that pip install pyqt isn't working? At least at the time of
writing this blog it isn't..
This is the error that I got:
IOError: [Errno 2] No such file or directory: setup.py
It seems they didn't package it well and it's using configure.py to
install. So …
Continue reading »
Fri 13 April 2012
For a mobile project I required a background worker which sents an email
with 300 generated QR codes zipped together as attachment. This costs
quite some time so we need a background worker to execute this task.
I wanted to achieve the following result:
- When the user wants to generate …
Continue reading »
Wed 11 April 2012
While setting up sentgrid I was searching for my password of sendgrid,
but coudn't find it. You can get it in the following way:
Which will show the parameters:
SENDGRID_PASSWORD, SENDGRID_USERNAME
After you get your username don't forget to add it to django settings:
Continue reading »
Thu 23 February 2012
To make my life easier I made a simple decorator which checks if the
parameters are present in the request.POST or request.GET and returns a
response if they are not.
It accepts a list of parameters in string format and will loop through
each parameter to check if …
Continue reading »
Wed 22 February 2012
Just a small code snippet I use when I need to return json, comments are
welcomed.
from django.http import HttpResponse
from django.utils import simplejson as json
def json_response(dict_to_convert_to_json):
return HttpResponse(json.dumps(dict_to_convert_to_json),
mimetype="application/json")
To use it in your view you just do it this …
Continue reading »
Tue 01 November 2011
Just tried to install scrapy with pip / easy_install, but when it comes
to installing lxml it will give the following error:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2
-Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c
src/lxml/lxml.etree.c -o
build/temp.linux-x86_64-2.7/src/lxml/lxml …
Continue reading »
Mon 18 July 2011
To install easy_install for a specific python version. I just installed
from source and used the python version you want to install setuptools
too. I used the following steps in Ubuntu 11.04 with Python 2.5 and
Python 2.7 installed. The following commands will install setuptools to
python …
Continue reading »