Pages

Saturday 30 June 2012

Uncle Bob Videos

I simply like them:

svn in virtualenv

I had some issues having svn in my virtual env - because it is created with the --no-site-packages (as it is the default).
What to do?
From the local python, this script will print out the commands for you:
python - << EOF
from os.path import dirname, join
import svn
dist_packages_dir = dirname(dirname(svn.__file__))
print 'cp -r', ' '.join(
  [join(dist_packages_dir, lib) 
    for lib in ['svn', 'libsvn']]),\
  "yourvirtualenvssitepackagesdir"
EOF
And replace yourvirtualenvssitepackagesdir with the site packages dir of your virtualenv

Saturday 23 June 2012

Useless Tests

Make sure, that all the tested functionality is used

Connect Bluetooth Mouse to Linux

Thanks, Arch wiki
hciconfig
hcitool scan
Scanning ...
       00:02:76:25:A2:23ThinkPad Bluetooth Laser Mouse
echo "0000" | bluez-simple-agent hci0 00:02:76:25:A2:23
RequestPinCode (/org/bluez/899/hci0/dev_00_02_76_25_A2_23)
Enter PIN Code: Release
New device (/org/bluez/899/hci0/dev_00_02_76_25_A2_23)
dbus-send --system --type=method_call --print-reply --dest=org.bluez "/" org.bluez.Manager.ListAdapters
dbus-send --system --type=method_call --print-reply \
--dest=org.bluez "/org/bluez/899/hci0/dev_00_02_76_25_A2_23" \
org.bluez.Device.SetProperty \
string:Trusted variant:boolean:true
sudo hidd --connect 00:02:76:25:A2:23

Saturday 9 June 2012

Python package structure

I always forgot what should be - the project structure - the contents of setup.py Basically it is just a duplication of The Hitchhiker's Guide to Packaging v1.0 documentation/Creating a Package
TowelStuff/
    bin/
    CHANGES.txt
    docs/
    LICENSE.txt
    MANIFEST.in
    README.txt
    setup.py
    towelstuff/
        __init__.py
        location.py
        utils.py
        test/
            __init__.py
            test_location.py
            test_utils.py
And your setup.py should look like this:
from setuptools import setup

setup(
    name="TowelStuff",
    version="0.1",
    packages=["towelstuff"],
    install_requires=["nose"]
    )
The other question: What should the subversion structure look like? I looked the Trac guys, to see how they do:
http://svn.edgewall.org/repos/trac/trunk/
  ...
  trac
  setup.py
  ...
So I will use the same setup.

Sunday 3 June 2012

Specify ssh port for subversion in IDEA

Say you have an ssh server listening on the port 2222. You can edit yout personal config file, located at
~/.subersion/config
but IDEA won't pick that up. Use the global config file instead:
$ grep -B1 222 /etc/subversion/config
[tunnels]
sshtunnel = ssh -p 2222

And now you can do things like:
svn ls svn+sshtunnel://HOSTNAME/repolocation