Acoustic Source Localization using Hough Transform

This is rather ugly solution out of conversation with MFTI students. Warm up for "Programming Kata".

Scene: cheap hardwire assempled into robot with 3 mics separated 10 cm each. On "Clap" robot is running towards clapper.

Simulation:

# Scene

c_speed_m = 340.29 # m / s
c_speed_cm= 34029 # cm/sec

# Grid size - area ...
more ...


Wilson Score Confidence interval

Not sure where I got this snipplet - most likely from reddit code or discussion.

from math import sqrt

def confidence_fixed(ups, downs):
    if ups == 0:
        return -downs
    n = ups + downs
    z = 1.64485 #1.0 = 85%, 1.6 = 95%
    phat = float(ups) / n
    return (phat+z*z/(2*n)-z ...
more ...

Estimating user lifetimes with PyMC - Corrected code

I was trying to follow this post, but github gists miss few variables, correct code shall be:

import pymc as mc
import numpy as np

N=20

#create some artificial data, like the data in the figure above.
lifetime = mc.rweibull( 2, 5, size = N )
birth = mc.runiform(0, 10 ...
more ...

Change of database: Percona Mysql to Postrgres for django

Colleague of mine came with strange bug:

  1. I am opening python shell, and sending request User.objects.all()

It returns valid information

* then i'm adding user via web site

* then i send request User.objects.all() again and new user is missing. If i will reopen shell then everything ...

more ...

Monitoring rabbitmq server 2.5.1. with monit

Simple task like setting up monitoring with monit for rabbit mq include two parts:

  1. As discussed here Modify /etc/init.d/rabbitmq-server
The following are added to the start
function:
    pid=`/usr/sbin/rabbitmqctl status | perl -n -e'/{pid,(\d+)/ && print $1'`
    echo $pid > /var/run/rabbitmq.pid
    Right before ...
more ...

Django optimisation in production

Few days ago I realised that my django installation in production started producing too many memory errors - thanks to monit memory alerts were filling my mailbox without any serious service interruption. But hundreds email messages daily annoyed me enough to look deeper into trouble.

1) I switched on django debug ...

more ...

Secure Riak installation using n2n VPN

Recently, I decided to have a closer look at Riak non-sql database, but found out that unlike CouchDB riak doesn't have a HTTP basic auth implemented, or any other way of defining secure access to database.

I have three servers to build a cluster, but I feel very uneasy ...

more ...


Useful JavaScript one-liner for couchdb

I found myself using more and more of this one-liner for working with couchdb database:

var getNewDatabusUUID = JSON.parse($.ajax({ type: "GET", url: "/_uuids/",                async: false }).responseText);  $.log("New uuid generated " + getNewDatabusUUID.uuids);

this example retrieves new uuids from couchdb, but I was using it to retrieve _rev of the ...

more ...


Checkbox and select elements in couch db

If you wanted to make a select or checkbox element using mustache in couch db and trying to find example, here it is:

I am using couchdb so in shows, album-edit.js, I want a dropdown menu for group variable in couchdb.

var Mustache = require("vendor/couchapp/lib/mustache");  var ...

more ...

Amazing examples of misuse of data mining in finance

From stupid Data Mining Tricks: Overfitting S&P 500:

"Norman Bloom, no doubt a champion of all data miners, went beyond trying to predict the stock market. Instead, he used the stock market, along with baseball scores, particularly those involving the New York Yankees, to “read the mind of God ...

more ...



Technical questions which are not valid in the absence of context

Recently I was asked the number of technical questions which I nearly failed to answer, not because I don't now the answer, but because I believe such questions require more information about the context. There is a common assumption about the default mind frame with MS windows and C ...

more ...


Chef cookbook for xtreemfs deployment

I just pushed xtreemfs cookbook to my git repo

This cookbook automates xtreemfs quick start for ubuntu 10.04.

I am using it with vagrant:

config.vm.define : xtreemfs do |xtreemfs_config|     xtreemfs_config.vm.box="base"    xtreemfs_config.vm.provisioner=:chef_solo    xtreemfs_config.vm.forward_port("ssh", 22, 2227,:auto => true)       xtreemfs_config.vm.forward_port ...

more ...

Good way to ad apt repository using chef - from hadoop cookbook

I found an interesting way of adding apt repository in hadoop cookbook:

execute "apt-get update" do  action :nothingendtemplate "/etc/apt/sources.list.d/cloudera.list" do  owner "root"  mode "0644"  source "cloudera.list.erb"  notifies :run, resources("execute[apt-get update]"), :immediatelyendexecute "curl -s http://archive.cloudera.com/debian/archive.key ...

more ...

Many/Multi objective optimisation

Last week I went to the lecture on Evolutionary Algorithms and Multi Objective optimisation, which my friend [Dr Evan Hughes]("http://www.evanhughes.org" Dr Evan Hughes) taught as part of much larger course ("Sensors and Data fusion?"). It is very interesting course and I wish I had an opportunity ...

more ...