<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>gremu.net - Gregor Müllegger's Weblog</title><link>http://gremu.net/</link><description /><language>en</language><category>python</category><category>django</category><category>vim</category><lastBuildDate>Thu, 22 Jul 2010 19:54:07 +0100</lastBuildDate><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/gremunet-latestentries" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="gremunet-latestentries" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>JPype - Bridging the worlds of Java and Python
</title><link>http://gremu.net/blog/2010/jpype-bridging-worlds-java-and-python/</link><description>

    &lt;a href="http://jpype.sourceforge.net/"&gt;JPype - Bridging the worlds of Java and Python&lt;/a&gt;
    &lt;blockquote&gt;
&lt;p&gt;JPype is an effort to allow python programs full access to java class libraries. This is achieved not through re-implementing Python, as Jython/JPython has done, but rather through interfacing at the native level in both Virtual Machines.&lt;/p&gt;
&lt;p&gt;Eventually, it should be possible to replace Java with python in many, though not all, situations. JSP, Servlets, RMI servers and IDE plugins are good candidates.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;(via &lt;a href="https://twitter.com/ianbicking/status/19270557734"&gt;@ianbicking&lt;/a&gt;)&lt;/p&gt;




</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Thu, 22 Jul 2010 19:54:07 +0100</pubDate><guid>http://gremu.net/blog/2010/jpype-bridging-worlds-java-and-python/</guid></item><item><title>Using ipython&amp;#39;s debugger as pdb replacement.
</title><link>http://gremu.net/blog/2010/using-ipythons-debugger-pdb-replacement/</link><description>



    &lt;p&gt;Do you know how to debug your python code? I usually do the following in my
code to set something like a hardcoded breakpoint:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import pdb; pdb.set_trace();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will bring up a &lt;code&gt;pdb&lt;/code&gt; prompt when the code execution reaches this line.
But &lt;code&gt;pdb&lt;/code&gt; is a bit limited since it doesn't support code completion,
syntax highlighting and so on.&lt;/p&gt;
&lt;p&gt;So here is how you make your debug prompt more fancy by using ipython's
debugger.&lt;/p&gt;
    &lt;h3&gt;some ipython love for your debugging experience&lt;/h3&gt;
&lt;p&gt;Like always, make sure first that all dependecies are installed. In this case
its &lt;a href="http://ipython.scipy.org/moin/FrontPage"&gt;&lt;code&gt;ipython&lt;/code&gt;&lt;/a&gt; &lt;sup&gt;&lt;a href="#f1"&gt;1&lt;/a&gt;&lt;/sup&gt;. Install it with &lt;code&gt;pip install ipython&lt;/code&gt; or &lt;code&gt;easy_install ipython&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now put the following file in &lt;code&gt;ipdb.py&lt;/code&gt; somewhere in your &lt;code&gt;PYTHONPATH&lt;/code&gt; (for me
its &lt;code&gt;~/.local/lib/python2.6/dist-packages/ipdb.py&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import sys
from IPython.Debugger import Pdb
from IPython.Shell import IPShell
from IPython import ipapi

shell = IPShell(argv=[''])

def set_trace():
    ip = ipapi.get()
    def_colors = ip.options.colors
    Pdb(def_colors).set_trace(sys._getframe().f_back)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Know you can use in your code the following snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import ipdb; ipdb.set_trace();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will bring up ipython's debugger instead of the old pdb prompt. Test it
out! It's so cool to have code completion while debugging.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;sup&gt;&lt;a name="f1"&gt;1&lt;/a&gt;&lt;/sup&gt; In case you don't know what ipython is, check their out homepage and try
to run &lt;code&gt;ipython&lt;/code&gt; in your console after installing it. It's definitly worth exploring. (For those
who really don't know what it is: its a fancy, more feature rich python
console).&lt;/p&gt;
&lt;h3&gt;Update&lt;/h3&gt;
&lt;p&gt;As Andrey mentioned in the comments: there is an easier way now to
setup &lt;code&gt;ipdb&lt;/code&gt; in your &lt;code&gt;PYTHONPATH&lt;/code&gt;. Just install the &lt;a href="http://pypi.python.org/pypi/ipdb"&gt;&lt;code&gt;ipdb&lt;/code&gt; package from the
PyPI&lt;/a&gt;: &lt;code&gt;pip install ipdb&lt;/code&gt;&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Thu, 22 Jul 2010 19:47:54 +0100</pubDate><guid>http://gremu.net/blog/2010/using-ipythons-debugger-pdb-replacement/</guid></item><item><title>Websocket support for django!
</title><link>http://gremu.net/blog/2010/websocket-support-django/</link><description>



    &lt;p&gt;You know what &lt;a href="http://websockets.org/"&gt;WebSockets&lt;/a&gt; are? It's a new web protocol for bidirectional connections between the browser and your application server. This is a huge win over AJAX and plain HTTP since you don't need to establish a new connection for every tiny message.&lt;/p&gt;
&lt;p&gt;Like TCP socket but for the web.&lt;/p&gt;
&lt;p&gt;It's an exciting new technology - so I started experimenting with WebSockets and with my favourite webframework Django. Here is what I came up with, bundled into a reusable app called &lt;a href="http://pypi.python.org/pypi/django-websocket"&gt;&lt;strong&gt;django-websocket&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
    &lt;h2&gt;What can I do with it?&lt;/h2&gt;
&lt;p&gt;You usually want to use WebSockets for single URLs - so the common design for
making single views more powerful is by wrapping them with a decorator. Thats
exactly how &lt;strong&gt;django-websocket&lt;/strong&gt; will upgrade your views to accept websocket
connections.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;from django_websocket import require_websocket

# the decorator rejects all requests that aren't websockets
@require_websocket
def echo(request):
    while True:
        # wait() will return new messages as they arrive
        message = request.websocket.wait()
        # wait() returns None if the connection was closed by the client
        if message is None:
            return
        # simple method for sending messages
        request.websocket.send(message)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Above is a very basic example of an echo server that sends every message it
receives back to the client.&lt;/p&gt;
&lt;p&gt;You see its very easy to make websockets available. The decorator will attach
a simple websocket-API-object to the request object. It has some primitive
methods you can easily work with. Two of them are already used in the example
above.&lt;/p&gt;
&lt;p&gt;Another is for example &lt;code&gt;request.websocket.read()&lt;/code&gt;. Unlike &lt;code&gt;wait()&lt;/code&gt;, &lt;code&gt;read()&lt;/code&gt;
will not block your code if no messages are ready to be processed. It just
returns &lt;code&gt;None&lt;/code&gt; if new messages are received from the client.&lt;/p&gt;
&lt;p&gt;Have a look into the &lt;a href="http://github.com/gregor-muellegger/django-websocket/blob/master/README"&gt;documention&lt;/a&gt; to get an idea of the other methods that are available or to see more examples.&lt;/p&gt;
&lt;h2&gt;Explore&lt;/h2&gt;
&lt;p&gt;The project is still very experimental and has not been proved to be production ready. But its a lot of fun to work with. Dive into it and get creative!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The project and documentation on PyPI:&lt;br /&gt;
&lt;a href="http://pypi.python.org/pypi/django-websocket"&gt;http://pypi.python.org/pypi/django-websocket&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Code on github:&lt;br /&gt;
&lt;a href="http://github.com/gregor-muellegger/django-websocket"&gt;http://github.com/gregor-muellegger/django-websocket&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I would really appreciate any feedback you can give. Flame, rant or make
suggestions for improvements.&lt;/p&gt;
&lt;p&gt;I'm especially interested in when you try to build something serious with
&lt;strong&gt;django-websocket&lt;/strong&gt;. Let me know about your awesome ideas and how it will
make the django ecosystem even more colorful.&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Tue, 20 Jul 2010 22:50:36 +0100</pubDate><guid>http://gremu.net/blog/2010/websocket-support-django/</guid></item><item><title>Enable setup.py test in your Django apps
</title><link>http://gremu.net/blog/2010/enable-setuppy-test-your-django-apps/</link><description>



    &lt;p&gt;&lt;a href="http://ericholscher.com/"&gt;Erich Holscher&lt;/a&gt; has posted &lt;a href="http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/"&gt;a blog entry with the same title&lt;/a&gt; about a year ago. This helped me out quite a lot to get &lt;code&gt;python setup.py test&lt;/code&gt; working with a reusable app.&lt;/p&gt;
&lt;p&gt;Unfortunatelly the code in his blog post is not working anymore exactly like this. Django has changed its internal structure of its default test runner. So here is how you can get &lt;code&gt;setup.py test&lt;/code&gt; working today.&lt;/p&gt;
    &lt;p&gt;Let's assume you have a repository layout for your app like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;|-\ django_app/
| |- __init__.py
| |- models.py
| |- etc ...
|
|-\ django_app_tests/
| |-\ test_app
| | |- models.py
| | |- etc ...
| |- manage.py
| |- settings.py
| |- etc ...
|
|- setup.py
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You would usually run your tests with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd django_app_tests
python manage.py test test_app
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Right? Now lets create a new file &lt;code&gt;django_app_tests/runtests.py&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# This file mainly exists to allow python setup.py test to work.
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_app_tests.settings'
test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, test_dir)

from django.test.utils import get_runner
from django.conf import settings

def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['test_app'])
    sys.exit(bool(failures))

if __name__ == '__main__':
    runtests()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will make running tests a bit easier:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd django_app_tests
python runtests.py
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now lets tell setuptools what it should do when you call &lt;code&gt;setup.py test&lt;/code&gt;. Go
to your &lt;code&gt;setup.py&lt;/code&gt; file and add
&lt;code&gt;test_suite='django_app_tests.runtests.runtests&lt;/code&gt; to the &lt;code&gt;setup()&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;Thats it -- now you can run your app tests with &lt;code&gt;python setup.py test&lt;/code&gt;.&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Sat, 17 Jul 2010 14:07:50 +0100</pubDate><guid>http://gremu.net/blog/2010/enable-setuppy-test-your-django-apps/</guid></item><item><title>Django admin with read-only permission
</title><link>http://gremu.net/blog/2010/django-admin-read-only-permission/</link><description>



    &lt;p&gt;I work as a freelancer and do many django related projects. My clients care in
most cases very much about django's admin site and want to have it customized
in many different ways.&lt;/p&gt;
&lt;p&gt;One client even has a django project that uses the admin site as only frontend.
It's an intranet CRM system - but they need to assigned every employee change
permissions because every user must be able to view every entry.&lt;/p&gt;
&lt;p&gt;Since django doesn't support read permissions in the admin this was the only
way to do it. Here is a quick-and-dirty fix without creating extra views for
readonly pages, extra templates etc.&lt;/p&gt;
    &lt;p&gt;The basic idea is to reuse the &lt;code&gt;change_view&lt;/code&gt; and &lt;code&gt;changelist_view&lt;/code&gt; pages and
just deny any POST requests for users without change permissions.&lt;/p&gt;
&lt;script src="http://gist.github.com/460485.js"&gt;&lt;/script&gt;

&lt;noscript&gt;&lt;pre&gt;&lt;code&gt;
from django.core.exceptions import PermissionDenied
from django.contrib import admin
from crm.models import Customer

class ReadPermissionModelAdmin(admin.ModelAdmin):
    def has_change_permission(self, request, obj=None):
        if getattr(request, 'readonly', False):
            return True
        return super(ReadPermissionModelAdmin, self).has_change_permission(request, obj)

def changelist_view(self, request, extra_context=None):
        try:
            return super(ReadPermissionModelAdmin, self).changelist_view(
                request, extra_context=extra_context)
        except PermissionDenied:
            pass
        if request.method == 'POST':
            raise PermissionDenied
        request.readonly = True
        return super(ReadPermissionModelAdmin, self).changelist_view(
            request, extra_context=extra_context)

def change_view(self, request, object_id, extra_context=None):
        try:
            return super(ReadPermissionModelAdmin, self).change_view(
                request, object_id, extra_context=extra_context)
        except PermissionDenied:
            pass
        if request.method == 'POST':
            raise PermissionDenied
        request.readonly = True
        return super(ReadPermissionModelAdmin, self).change_view(
            request, object_id, extra_context=extra_context)

class CustomerAdmin(ReadPermissionModelAdmin):
    pass

admin.site.register(Customer, CustomerAdmin)
&lt;/code&gt;&lt;/pre&gt;&lt;/noscript&gt;

&lt;p&gt;The actual implementation does the following if a user tries to access the
change or changelist pages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Call the original change view from django - everything works fine if the
    user has change permissions.&lt;/li&gt;
&lt;li&gt;If the permission is denied we check that no POST request is performed,
    otherwise we reject the request.&lt;/li&gt;
&lt;li&gt;We set a &lt;code&gt;readonly&lt;/code&gt; flag on the &lt;code&gt;request&lt;/code&gt; to indicate that we have
    readonly access, this flag is used by &lt;code&gt;has_change_permission&lt;/code&gt; to grant
    permission for this request. &lt;em&gt;Note:&lt;/em&gt; this doesn't mean the user can change
    data now - we already have prevented this since we deny POST requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At the end some pro and contra:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pro&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Very easy implementation since nearly no custom code needs to be written.&lt;/li&gt;
&lt;li&gt;Should work with most customizations you have already made to your
    &lt;code&gt;ModelAdmin&lt;/code&gt; subclasses.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Contra&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The links from the admin index page to the model's changelist doesn't show
    up. This was no problem in my case since the client does not use the
    default index page.&lt;/li&gt;
&lt;li&gt;The user can still edit the fields in the change form since they are not
    marked as "readonly" or anything else. The page just shows a not very
    userfriendly &lt;code&gt;Permission Denied&lt;/code&gt; after he tries to save.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Feel free to write any thoughts about readonly possibilities in django's admin
page in the comments. Every critic about my (very simplistic) approach is
welcome.&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Thu, 01 Jul 2010 22:37:47 +0100</pubDate><guid>http://gremu.net/blog/2010/django-admin-read-only-permission/</guid></item><item><title>Howto reset your ASUS EEE 1101HA
</title><link>http://gremu.net/blog/2010/howto-reset-your-asus-eee-1101ha/</link><description>



    &lt;p&gt;I recently bought a cute little ASUS EEE 1101HA. The first thing I've done after receiving it was installing the latest Ubuntu version. So I hoped the best. But after trying some things and searching the Internet it seems that the Linux support for this netbook really &lt;em&gt;sucks&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Display isn't working very well, multitouch touchpad doesn't work, microphone doesn't work properly and so on. I expected to have some small issues which I need to solve, but this was too much.&lt;/p&gt;
&lt;p&gt;I decided to sell it again - but usually customers aren't that happy if you promise them a WinXP netbook but they receive one with a broken ubuntu ;-)&lt;/p&gt;
&lt;p&gt;So I needed to do reinstall windows xp from the recovery DVD. This isn't as easy as it sounds, since the netbook has no optical drive.&lt;/p&gt;
    &lt;p&gt;I first expected to use my USB stick for the recovery as I used it to install
Ubuntu. After following and testing some instructions from different EEE sites, I saw that this don't work for me.&lt;/p&gt;
&lt;p&gt;For the rescue I found an old IDE DVD drive at home which I attached by an USB
to IDE adapter to the netbook. This didn't worked either: the recovery DVD
exited on boot with the message &lt;strong&gt;"NTLDR is corrupt. Cannot boot."&lt;/strong&gt;! Isn't it
nice of ASUS to provide such a good recovery experience (and no, ASUS don't
provide instructions howto reinstall the netbook)?&lt;/p&gt;
&lt;p&gt;After a lot of flaming, here is the way how it worked for me:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Insert the recovery DVD into another computer.&lt;/li&gt;
&lt;li&gt;Copy the WINPE.ISO from the DVD to your harddisk.&lt;/li&gt;
&lt;li&gt;Openup the WINPE.ISO file (I used &lt;a href="http://www.magiciso.com/"&gt;MagicISO&lt;/a&gt; - a Windows program to modify ISO images) and change the &lt;code&gt;AppPath&lt;/code&gt; value in &lt;code&gt;I368\SYSTEM32\WINPESHL.INI&lt;/code&gt; to &lt;code&gt;X:\GHOST32.exe&lt;/code&gt;. This is how the file looks for me now:
&lt;p style="font-weight:bold;"&gt;&lt;pre&gt;
[LaunchApp]
AppPath = X:GHOST32.exe
[LaunchApps]
X:devcon.exe, disable &lt;em&gt;usbstordisk&lt;/em&gt;&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Burn the ISO.&lt;/li&gt;
&lt;li&gt;Put the &lt;code&gt;Recovery\EEEPC-GER.gho&lt;/code&gt; file from the recovery DVD on a USB memory stick that is large enough to handle it (the exact filename may vary, since it depends on your language).&lt;/li&gt;
&lt;li&gt;Find a way to boot the burned ISO on your 1101HA (I used an old IDE CD drive with a USB to IDE adapter)&lt;/li&gt;
&lt;li&gt;The Ghost tool pops up automatically. Select "Local &amp;gt; Disk &amp;gt; From image" in the menu.&lt;/li&gt;
&lt;li&gt;Choose the *.gho file which you put on your USB stick earlier.&lt;/li&gt;
&lt;li&gt;Reboot your EEE PC and see if everything is fine.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;bye, bye little 1101HA. &lt;a href="http://www.internetslang.com/LLAP.asp"&gt;LLAP&lt;/a&gt;&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Thu, 17 Jun 2010 18:18:14 +0100</pubDate><guid>http://gremu.net/blog/2010/howto-reset-your-asus-eee-1101ha/</guid></item><item><title>Create patches for upstream with bzr
</title><link>http://gremu.net/blog/2010/create-patches-upstream-bzr/</link><description>



    &lt;p&gt;I searched a long time for a nice way to create clean diffs between two &lt;strong&gt;&lt;a href="http://bazaar.canonical.com/en/"&gt;bzr&lt;/a&gt;&lt;/strong&gt; branches. The command &lt;code&gt;bzr diff remote-branch&lt;/code&gt; is not working ... Now I found a solution using a special &lt;em&gt;revision identifier&lt;/em&gt;.&lt;/p&gt;
    &lt;p&gt;I found by accident in the &lt;a href="http://doc.bazaar.canonical.com/bzr.dev/en/user-reference/"&gt;bzr docs&lt;/a&gt; a page about some &lt;a href="http://doc.bazaar.canonical.com/bzr.dev/en/user-reference/revisionspec-help.html"&gt;special revision identifiers&lt;/a&gt;. One of them is the &lt;strong&gt;branch:&lt;/strong&gt; prefix which can be used to reference a remote branch.&lt;/p&gt;
&lt;p&gt;With this knowledge its easy to create a diff between two &lt;strong&gt;bzr&lt;/strong&gt; branches:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;bzr diff -r branch:/path/to/remote-branch
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also use instead of &lt;code&gt;branch:&lt;/code&gt; the &lt;code&gt;submit:&lt;/code&gt; identifier which only provides the diff back to the last common revision. This is exactly the behaviour you want to have for creating patches. You can also leave the argument for &lt;code&gt;submit:&lt;/code&gt; blank and it will use the parent branch (the branch where you branched from) by default.&lt;/p&gt;
&lt;p&gt;Here are now the steps I use when I want to provided a bug fix for an upstream project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Branch the project's repository from &lt;a href="https://launchpad.net/"&gt;launchpad&lt;/a&gt; (if the project is not available, I register it and import the upstream repository)&lt;/li&gt;
&lt;li&gt;Then I branch the local copy of trunk to have a checkout dedicated for fixing the bug.&lt;/li&gt;
&lt;li&gt;Hacking.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;bzr diff -r submit: &amp;gt; ../bugfix.patch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Submit the patch to the developers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Until today I was really disappointed by &lt;strong&gt;bzr&lt;/strong&gt; for not having this feature. I was quite sure it &lt;em&gt;MUST&lt;/em&gt; be there … but haven't found it. Ofcourse I know the &lt;code&gt;bundle&lt;/code&gt; command etc. but this would create a merge directive which looks a bit like a patch but is actually only usefull if the upstream project also uses &lt;strong&gt;bzr&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Maybe this blog post helps someone else saving some time looking for this feature.&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Wed, 21 Apr 2010 23:30:58 +0100</pubDate><guid>http://gremu.net/blog/2010/create-patches-upstream-bzr/</guid></item><item><title>Compile csync from source on Ubuntu 9.10
</title><link>http://gremu.net/blog/2010/building-csync-ubuntu-910/</link><description>



    &lt;p&gt;Since &lt;code&gt;csync&lt;/code&gt; is not available in the Ubuntu repositories and there are no &lt;code&gt;.deb&lt;/code&gt; packages available on &lt;code&gt;csync&lt;/code&gt;'s &lt;a href="http://www.csync.org/"&gt;website&lt;/a&gt; you have to compile it yourself from source. It's nearly straight forward but there were a few issues I ran into. Maybe this short walkthrough help you to make the installation of &lt;code&gt;csync&lt;/code&gt; as easy as possible.&lt;/p&gt;
    &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;I was a bit confused because there is a &lt;code&gt;csync2&lt;/code&gt; package for Ubuntu. But it seems that this is a totally different project and not related to &lt;code&gt;csync&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;resolving dependencies&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;csync&lt;/code&gt; has a few dependencies which are listed in the &lt;code&gt;INSTALL&lt;/code&gt; file. They
include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CMake&lt;/li&gt;
&lt;li&gt;check&lt;/li&gt;
&lt;li&gt;log47&lt;/li&gt;
&lt;li&gt;sqlite3&lt;/li&gt;
&lt;li&gt;libiniparser&lt;/li&gt;
&lt;li&gt;libsmbclient&lt;/li&gt;
&lt;li&gt;libssh&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So lets install these dependecies first:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo aptitude install cmake check liblog4c3 liblog4c-dev libsqlite3-0 libsqlite3-dev libsmbclient-dev libssh-dev
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;installing &lt;code&gt;libiniparser&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Only &lt;code&gt;libiniparser&lt;/code&gt; is not available through &lt;code&gt;aptitude&lt;/code&gt; so we must also download and compile it from source.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;wget http://ndevilla.free.fr/iniparser/iniparser3.0b.tar.gz
tar xf iniparser3.0b.tar.gz
cd iniparser3.0b
make
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These commands will download, extract and build the &lt;code&gt;iniparser&lt;/code&gt; library. You
will see that you now have the files &lt;code&gt;libiniparser.a&lt;/code&gt; and &lt;code&gt;libiniparser.so.0&lt;/code&gt;
in your current directory. Copy them to &lt;code&gt;/usr/lib&lt;/code&gt; to make them available for
other programs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo cp libiniparser.* /usr/lib
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;download and configure &lt;code&gt;csync&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Now we can actually start to compile &lt;code&gt;csync&lt;/code&gt;. Download your prefered release
from the &lt;a href="http://www.csync.org/files/"&gt;download page&lt;/a&gt; and extract it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;wget http://www.csync.org/files/csync-0.44.0.tar.gz
tar xf csync-0.44.0.tar.gz
cd csync-0.44.0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;csync&lt;/code&gt; also wants us to build the project in a seperate directory. So lets
create it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir build
cd build
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we can run &lt;code&gt;cmake&lt;/code&gt; to configure the environment. For me the first try
raised an error which read like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;CMake Error: The following variables are used in this project, but they are
set to NOTFOUND. Please set them or make sure they are set and tested
correctly in the CMake files:&lt;br /&gt;
INIPARSER_INCLUDE_DIR&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So we need to tell &lt;code&gt;cmake&lt;/code&gt; which value the &lt;code&gt;INIPARSER_INCLUDE_DIR&lt;/code&gt; option
should have:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cmake -DINIPARSER_INCLUDE_DIR=/path/to/iniparser3.0b/src ..
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Please note the &lt;code&gt;..&lt;/code&gt; at the end of the command. This tells &lt;code&gt;cmake&lt;/code&gt; where to
find the extracted source tarball.&lt;/p&gt;
&lt;h3&gt;build and install &lt;code&gt;csync&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Now we can try to build and install &lt;code&gt;csync&lt;/code&gt;. On all Unix systems you usually
do a &lt;code&gt;make install&lt;/code&gt; which also should work with &lt;code&gt;csync&lt;/code&gt;.  But &lt;code&gt;make install&lt;/code&gt;
simply ignores Ubuntu's package system. We don't want that and use
&lt;code&gt;checkinstall&lt;/code&gt; instead to build and install a &lt;code&gt;.deb&lt;/code&gt; package. So make sure
&lt;code&gt;checkinstall&lt;/code&gt; is available:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo aptitude install checkinstall
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before we compile the package we need to prevent an error which hit me on the
first try. Copy the source files from the &lt;code&gt;iniparser&lt;/code&gt; package to the &lt;code&gt;build&lt;/code&gt;
directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cp /path/to/iniparser3.0b/src/* .
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you can run &lt;code&gt;checkinstall&lt;/code&gt; from the &lt;code&gt;build&lt;/code&gt; directory in which you
configured &lt;code&gt;csync&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo checkinstall
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will call a wizard which leads you through the process of creating the
&lt;code&gt;.deb&lt;/code&gt; package. Usually you can use the defaults to install the packages by
hitting your return key several times. But since &lt;code&gt;checkinstall&lt;/code&gt; uses the name
of your current directory as package name and you don't want to have the
package named &lt;code&gt;build&lt;/code&gt; you need to change this default while going through
&lt;code&gt;checkinstall&lt;/code&gt;'s wizard.&lt;/p&gt;
&lt;h3&gt;have fun!&lt;/h3&gt;
&lt;p&gt;Now everything should be installed and ready to use. I hope this helped you
going through the few steps that are necessary to compile &lt;code&gt;csync&lt;/code&gt; from source.&lt;/p&gt;
&lt;p&gt;Please note that the urls I use with &lt;code&gt;wget&lt;/code&gt; are just pointing to the current
releases of &lt;code&gt;csync&lt;/code&gt; and &lt;code&gt;libiniparser&lt;/code&gt;. So maybe you want to check their
websites before going through this tutorial if they have released newer
versions.&lt;/p&gt;
&lt;p&gt;Comment below if you have issues with this howto or suggestions how to make it
better. Thanks!&lt;/p&gt;


</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Mon, 15 Mar 2010 13:49:53 +0100</pubDate><guid>http://gremu.net/blog/2010/building-csync-ubuntu-910/</guid></item><item><title>A quote from Volker Dusch
</title><link>http://gremu.net/blog/2010/quote-volker-dusch/</link><description>


    &lt;blockquote&gt;
&lt;p&gt;Unittests are like a warm blanket you can wrap yourself into if you need to go out into the codeforest to refactor&lt;/p&gt;
&lt;/blockquote&gt;
    &lt;p class="quote-author"&gt;by &lt;strong&gt;
        
            &lt;a href="http://twitter.com/__edorian/status/10264131724"&gt;Volker Dusch&lt;/a&gt;
        
    &lt;/strong&gt;&lt;/p&gt;



</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Wed, 10 Mar 2010 11:29:44 +0100</pubDate><guid>http://gremu.net/blog/2010/quote-volker-dusch/</guid></item><item><title>Test Driven Development - The Django Way
</title><link>http://gremu.net/blog/2010/test-driven-development-django-way/</link><description>

    &lt;a href="http://od-eon.com/blogs/tudor/test-driven-development-django-way/"&gt;Test Driven Development - The Django Way&lt;/a&gt;
    &lt;p&gt;Nice little write up about test driven development with django. Nothing special or excitingly new but I wanted to post it because I followed nearly the same principles in my last big project.&lt;/p&gt;
&lt;p&gt;It worked very nice and I will do it the same way with the next project.&lt;/p&gt;




</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gregor Muellegger</dc:creator><pubDate>Wed, 10 Mar 2010 01:21:04 +0100</pubDate><guid>http://gremu.net/blog/2010/test-driven-development-django-way/</guid></item></channel></rss>

