Skip to main content

Posts

Dual Strike Sidewinder Xpadder Profile

How to macro program the Dual Strike in Windows 8 By far I consider the Dual Strike Sidewinder the best Frist Person Shooter (FPS) controller device. Sadly though this controller is no longer manufactured and although Windows 8 does include the needed drivers the bundled software that allows you to program and create macros no longer works - without this functionality the controller is nothing but a shadow of it's potential. Xpadder to the rescue I stumbled onto this utility after reading this post and in my testing it is the perfect solution, not only for this controller but for any that you mihgt have and not only for controller aware games! That is if you ever wanted to play Minecraft, Xenominer, or Starmine with your favorite controller well with Xpadder you can make that happen. Yes it's not free and costs $9.99, yes it's not the best looking software, and yes the site look like it was made at the same time as my Dual Strike Sidewinder stopped selling bu...

Minecraft server update cron script

Automatically update crafbukkit server to latest development version Modify as need and place or link the below script into your '/etc/cron.daily/' folder; remember not to use dots in your cron files as they will not be read - for example name it or soft link it as 'update-crafbukkit-minecraft'. #!/bin/sh # # file: update-craftbukkit-minecraft.sh /etc/init.d/minecraft-server.sh stop wget -N http://dl.bukkit.org/latest-dev/craftbukkit.jar # got the link by reading here: http://wiki.bukkit.org/Setting_up_a_server and guessing to change '-rb' to '-dev' rm minecraft_server.jar ln -s craftbukkit.jar minecraft_server.jar /etc/init.d/minecraft-server.sh start You can find my minecraft setup and my minecraft init.d startup script at an older post Minecraft Server on Debian .

Normalize '__unicode__' accross django models

Don't repeat your self, use monkeypatching - a better default '__unicode__' This latest top-secret project for sure is keeping me busy and time wise leaves little to keep blogging, however it being Friday and all and because you're worth it here is a Django expert tip. Django's default '__unicode__' representation leaves a bit to be desired to say the least. In a nut shell it returns the class name + 'object' for all instances and so requires that all your models have a '__unicode__' defined to have a useful string represenation. Well with a bit of friendly monkeys we can patch it right up as per the code below: from django.db.models.base import Model import logging import hashlib import re from django.conf import settings logger = logging.getLogger(__name__) #---------------------------------------------------------------------------------------------------------------------- logger.info("Patching 'django.db.models.base.M...

Django Custom Chainable QuerySets

How to reuse custom defined 'models.Manager' QuerySets Django recommends to define custom query sets on your sublcassed models.Manager, there is one problem however that these are not chainable, that is you can only call your custom queryset once - assuming I have defined an '.active()' queryset the following will not work: >> PaymentTerm.objects.active().active() Traceback (most recent call last): File " ", line 1, in AttributeError: 'PaymentTermManager' object has no attribute 'active' >>> Current solutions on the web involve creating a subclassed 'models.Manager' and a custom 'QuerySet' which do work but are to code verbose for my linking. I believe the below approach is simpler, cleaner and more succinct. class OfferManager(models.Manager): ... STATUS_CHOICES = ( (STATUS_DISABLED, "Disabled"), (STATUS_ENABLED, "Enabled"), (STATUS_NEGOTIATED, "Negotiated")...

CommandError: Unable to serialize database: Error encountered checking Geometry returned from GEOS C function "GEOSWKBReader_read_r".

ERROR django.contrib.gis libgeos.py@80: GEOS_ERROR: ParseException: Unknown WKB type 0 These cryptic messages are caused by using the vanilla Django `model.Manager` with your geo enabled models. This caused me a frew hours of grief trying to figure it out, thinking it's the import data, or an issue with the third party app, etc. but the fix is to just extend your custom model manager from the `gis.models.GeoManager` which is super easy to forget: from django.contrib.gis.db import models class MyCustomManager(models.GeoManager): """ Additional methods / constants to Base's objects manager - using a GeoManager is fine even for plain models: ``BaseManager.objects.public()`` - all instances that are asccessible through front end """ # Model (db table) wide constants - we put these and not in model definition to avoid circular imports. # one can access these constants through .objects.STATUS_DISABLED or ImageManager.S...

Django import fixtures IntegrityError: Problem installing fixtures:

IntegrityError: Problem installing fixtures: The row in table 'geonames_alternatename' with primary key '1830' has an invalid foreign key: geonames_alternatename.locality_id contains a value '109436' that does not have a corresponding value in geonames_locality.geonameid. In a situation where a third party app data export works just fine but the fixutre fails due to any IntegrityError is most likley cause by an overiden `objects` manager that returns only a subset. The solution is to explicitly tell django to export using the default model managers using the `--all` argument for example like so: dumpdata geonames --indent=4 --all --settings=settings_development > geonames_ext/fixtures/initial_data.json This is clearly a situation where explicit is better then implicit, that is when defining custom model managers do not touch the `get_query_set` method rather instead add an explict method; for post completeness below is my Eclipse PyDev template I utli...

Unable to configure handler 'console': __init__() got an unexpected keyword argument 'strm'

Django and upgraded from 2.6 to Python 2.7 Hopefuly this quick post will save someone time, I recently upgraded our Debian servers from stable (squeeze) to testing (wheezy). Unfortunately this resulted in an odd error: Traceback (most recent call last): File "manage.py", line 12, in execute_from_command_line(sys.argv) File "/srv/www/django/development.FOO.com/virtualenv/src/github-django-django-stable/django/core/management/__init__.py", line 453, in execute_from_command_line utility.execute() File "/srv/www/django/development.FOO.com/virtualenv/src/github-django-django-stable/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/www/django/development.FOO.com/virtualenv/src/github-django-django-stable/django/core/management/__init__.py", line 263, in fetch_command app_name = get_commands()[subcommand] File "/srv/www/django/development.F...