Laur IVAN

Redis on Windows – Save RDB but Not Able to Persist

Posted by in IT, Tutorial

TL;DR: My windows service wasn’t installed properly. Change the config file to point the DB to an accessible directory and reinstall the service. When trying to build a perioduc Celery task, I got the following error with Redis on Windows (running as a windows service): redis.exceptions.ResponseError: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. This is quite unfortunate because the error doesn’t show…read more

Select Rows Where Value from One Column Matches Other Column

Posted by in Software, Tutorial

TL;DR: Use a JOIN. I’ve got a table representing a tree, using two columns:

and I want to select all children for parents whose CLASS_ID have a certain value (e.g. abcd). The way I could do it was via a JOIN statement:

This will: Perform a join where child.parent_prop_id = parent.prop_id Filter only parent.class_id = ‘abcd’ Simple. Bonus This will work with other databases as well :) HTH, A little experiment: If you find this post and ad below useful, please check the ad out :-)

Change a django password manually

Posted by in Software

The other day I’ve been confronted with a strange situation: I forgot the admin password for a django application. I was playing with installing my own pypi repository, I’ve configured and deployed a test application and, after a couple of weeks, I forgot the password. I tried several times bu I knew that I used something silly and… unfortunate. Even worse, the user name I thought I used was not the one I had set up for the test. Oops :) After looking online for options I’ve found the following:…read more

Add Primary Key Column to PostgreSQL Table

Posted by in Software

The other day I got a question: How to add a numeric PK column to an already existent table? A quick look on the net showed that it is indeed possible to add an auto-incrementing PK to an already existing table (if you don’t have already a PK that is!). The code is quite simple too! The statement:

will add an autoincrementing column named id to my table_without_pk. HTH, PS: Thanks to a couple of colleagues of mine for asking the question and working together to finding the answer…read more

Loading XSDs into Oracle through Python

Posted by in Software

Following the previous incursions in Oracle and their own documentation, we decided it was useful to attach schemas to the inserted data, just because only XML with schemas attached can be indexed. When you have some million entries, indexing seems like a good idea (once you decide what to index). In Oracle, you have DBMS_XMLSCHEMA.registerSchema() to do just that. It has a bunch of parameters which are thoroughly described in their documentation. Suffices to say that you can choose to generate tables, objects or java beans off the loaded schemas….read more

MacPorts Berkley-DB 4 problem and work around

Posted by in Uncategorized

I’ve upgraded my MacPro’s hardware a bit the other day and I’ve noticed that something went bye-bye when running eclipse. Namely eclipse itself wasn’t working anymore. So I thought: What a great opportunity to do an update (eclipse, jdk…). And MacPorts. Because I wanted to upgrade my python to 2.7 (2.7 has a couple of extra niceties compared to 2.6, and django doesn’t yet work with 3.x). Anyway, I’ve downloaded the Helios eclipse, cleaned up macports and updated it again. Nice. Had to re-download Xcode, which, this time is a…read more