Pages

Thursday 18 July 2013

NVIDIA 32bit OpenGL Libraries on 64bit Linux

A short and sweet post, but it appears many people have the same issue installing the latest nvidia drivers using their installer, mainly to do with using the 32bit compatibility libraries. There are a couple of options to the installer you can use to decides where they should be put, these are:

  • --compat32-chroot
  • --compat32-prefix
  • --compat32-libdir
(I think, this is from memory)

You may find your apps still can't find them. Well it turns out theres an easier solution:

# echo "<path to libraries>" >> /etc/ld.so.conf.d/nvidiagl.conf
# ldconfig

Thats it. For example if you use the default paths, <path to libraries> should be /emul/ia32-linux/usr/lib

Wednesday 4 January 2012

Outound ISN/ITAD Dialling with FreeSWITCH

Just a short one, here's my extension configuration for dialing ISN/ITAD extensions from freeswitch. Replace $${local_itad} with your ITAD. This will match all numbers dialled with a * in them, so you may need to modify it to your needs.


<extension name="isn">
  <condition field="destination_number" expression="^(\d+\*\d+)$">
    <action application="enum" data="${destination_number} freenum.org" />
    <action application="set" data="effective_caller_id_number=${effective_caller_id_number}*$${local_itad}" />
    <action application="bridge" data="${enum_auto_route}" />
  </condition>
</extension>




Monday 28 November 2011

Running Django on Fasthosts

Yes, you read that right. This post contains details of how to run Django application on Fasthsots.

You will need:

  1. A fasthosts linux hosting account with a MySQL database and SSH access, and with CGI enabled.
  2. A Centos 5.6 virtual machine to set everything up on.
On your new fresh Centos virtual machine, run the following:

yum install mysql-devel gcc

Download and extract the python source code:

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar xzvf Python-2.7.2.tgz
cd Python-2.7.2

Configure, make and install python:

./configure
make
make install

Now install setuptools:

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar xzvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install

This will allow us to use easy_install to install pip and virtualenv

easy_install pip virtualenv

Right, now log in to fasthosts via SSH, and run

pwd

This is your home folder. Back on your Centos box, create a folder using the exact path pwd gave you on fasthosts:

mkdir -p <folder>
cd <folder>

Now create self-contained python environment:

virtualenv --distribute --no-site-packages django

Activate the virtual environment:

source django/bin/activate

And you should now be able to install any packages you need for your application to run.

pip install django MySQL-python

You will also need the standard python libraries:

cp -R /usr/local/lib/python2.7/* django/lib/python2.7/

Copy your Django project to the django folder and scp to the root of you home folder on fasthosts.

scp -r django <user>@<host>:./

You should now be able to ssh into fasthosts and run syncdb.

source django/bin/activate
cd django/<app name>
python manage.py syncdb

Copy any media files to htdocs/media and htdocs/static as required.

Finally, you need just two more files. This .htaccess in htdocs folder:

RewriteEngine on
RewriteRule ^cgi-bin/ - [L]
RewriteRule ^static/ - [L]
RewriteRule ^media/ - [L]
RewriteRule ^(.*)$ /cgi-bin/django.cgi/$1 [QSA,L]

The final file you need is django.cgi to go in your cgi-bin. Instructions of what you need to change can be found here: http://joemaller.com/1467/django-via-cgi-on-shared-hosting/

Wednesday 8 June 2011

World IPv6 Day

I don't know how I managed to forget this, but today is World IPv6 Day. What this means is some of the major players have switched on IPv6 properly, disabling any white listing or any other means they have to stop it breaking the Internet for people who are not ready for IPv6.

What does this mean for most people? Nothing, unless Facebook has stopped working for you.

What does this mean for people who care and know what IPv6 means? Connections to Google and Facebook (amongst others) should be done over IPv6 connections. A quick netstat and a few reverse lookups are showing that it is working for me. About a third of all current TCP connections from the machine I am writing this post from right now are IPv6. It's a good step in the right direction.

Thursday 26 May 2011

Expert Phone Support

Hi all, I can now reveal to you the commercial project I have been working on the past month, and they are currently accepting registrations.

The idea is, you post a question, and experts offer answers. You get an email with a premium rate number to call to be connected to the expert. The expert gets a percentage of the call revenue.

Why I think this idea is different:

  • You pay per minute of the call, not for full hours like a computer repair shop would
  • You time with the expert is one-to-one, you don't drop it off, leave it and wait for a call
  • You can supervise the expert if you give them remote access. This means they can't go through your holiday snaps while you're not looking (sadly, this is a common practice)
Of course, I also see some issues with the way it works, but nothing that cannot be solved with a proper complaints procedure (required by law anyway). If you're interested check out the website at www.expertphonesupport.com and the Facebook Page.

Monday 23 May 2011

Long Time, No Post

Has it really been a month since my last post? Well, basically I haven't posted in a while as all my spare time has been taken up by commercial projects, which I am not at liberty to discuss at this time. Once they are finished and out of the way I'll be able to point you towards them and get back on to IPSEC in DD-WRT.

Wednesday 20 April 2011

UK Alternative Vote

Hi all, yesterday it occurred to me that I didn't really understand how votes are reallocated after each round in the proposed Alternative Vote system here in the UK. The Yes2AV group didn't help the case by explaining it almost as badly as the No2AV group, but after much discussion with friends I did refine it to a process that I did understand.

The basic idea is that you mark your preferences in order. This is simple enough to grasp. What isn't is when all the first preferences are added up and there is no majority (more than 50%), what happens next. The Eelctoral Reform Society has it as this:
If no candidate gains a majority on first preferences, then the second-preference votes of the candidate who finished last on the first count are redistributed. This process is repeated until someone gets over 50 per cent.
To me that is just not clear about what is going on. I spent over an hour on the phone and still did not understand. So we began our own based around Ice Cream to help demonstrate what is going on. Full details can be found on Kitty's blog. It also includes the raw data and my Python implementation amongst others. I recommend you check it out, but I'll come back to it later.

The way I found best to understand this was this:
  1. Imagine your ballot paper is a queue, you choose who is first, second, third and so on in that queue.
  2. When the votes are counted, you count ONLY the first person of each queue.
  3. If one candidate has more that 50%, that candidate wins. If not, the lowest candidate is eliminated, and removed from ALL queues, meaning anyone behind them moves forward into their place. Any that were 2nd choices have now been effectively added to the first choices. 
  4. Go to 2.
That may sound just as cryptic, but lets look at some visual examples. Say we have 3 candidates and 5 voters, and they vote the following. The votes are displayed horizontally, the preferences vertically, the green area being the first preference area.

So, blue has the least 1st preference votes, so is eliminated from the running, leaving this:


Now all the remaining votes move forward, like so:

And we now recount the votes in the green section. If there is still no majority, you continue eliminating the last place and moving votes forward until you do. In this case red wins even though all parties had the same number of votes, because it had the higher preference votes.

If a vote runs out of preferences, it is just discarded (and the quota is decreased accordingly) and the rules for tie-breaking depend upon the rules of the particular ballot you are participating in.

Hopefully you've understood that analogy. Now I'll talk some more about our test ballot. We took 70 votes for 5 candidate flavors of ice cream. Now using First Past The Post, Mint won, with 22 votes for and 44 votes against (the other 4 ballots were spoiled and invalidated). So more people would prefer not to have Mint than to have it.

This is where Alternative Vote comes in. The lowest vote was Strawberry, so we removed it from the votes, and moved the 2nd preferences forward. This was followed by the elimination of Fudge and Chocolate. What this left us with was Vanilla as the winner. It may not have had the most first preference votes, but because more people would accept it than mint (33 instead of 22), it's the least objectionable option, something the majority can enjoy.

So what does AV get us? More than one vote? No. Our first choice? Not necessarily. Someone we'd prefer over another candidate? Most definitely.

I'm not going to try sway anyone's vote for May 5th, everyone is entitled to their own opinion. Whatever your view, I hope this has helped you to understand the counting process under AV.