Zum Hauptinhalt springen
Chris’ wirre Gedankenwelt

Rick Santorum for president

Rick Santorum for president

"Wenn ihr im US-Wahlkampf mithelfen wollt, dann setzt einen Link auf Rick Santorum for president. Die waren mal der 1. Hit bei Rick Santorum, jetzt sind sie deutlich gefallen. Santorum selber hatte Google belästigt, sie sollen das mal aus dem Index schmeißen. Also, einmal an alle: einen Link auf spreadingsantorum.com bloggen oder tweeten, mit Rick Santorum als Text. Die Nachwelt wird euch dankbar sein."

https://blog.fefe.de/?ts=b1b04d72

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

collective.flattr bei der Flattr Developer Challenge

Vor zwei Wochen meldete ich collective.flattr bei Flattr als Plugin fĂĽr Plone an. Mit der Bitte collective.flattr in die Plugin Seite aufzunehmen. Diese Plugin Seite scheint es nicht mehr zu geben. DafĂĽr hat mir ein Entwickler geraten mich mit collective.flattr bei der Flattr Developer Challenge anzumelden. Gesagt, getan... und vielleicht gewinne ich ja :)

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Fotobörse Darmstadt

Es ist jetzt schon wieder einige Zeit her. Aber am 27. November 2011 war ich auf der Fotobörse in Darmstadt des Fotoclubs Darmstadt. Die Börse findet mehrmals im Jahr statt und ein Besuch dort lohnt sich auf jeden Fall, zumindest wenn man sich für Fotoequipment interessiert. Hauptsächlich liegt der Focus auf analogen Systemen, aber auch Digitalfotografen kommen auf ihre Kosten. Vor allem was Linsen und Filter angeht. Allerdings sollte man dennoch ein wenig vorsichtig bei den Preisen sein. Gerade bei den Linsen kommt man im Netz, oder aber auch bei lokalen Fotoläden, günstiger weg.

Ich z.B. habe mir zwei Blitze von Nikon zugelegt, einen SB-24 und einen SB-25, die ich günstiger als auf Ebay bekommen habe. Ein bisschen enttäuscht war ich, dass es keine Lichtformer, Lichtstative o.ä. gab. Aber das scheint wohl am Publikum zu liegen. Die meisten Besucher sind scheinbar Kamera-Nerds, denen es mehr um die Technik als das Foto geht.

Neben den Blitzen bin ich nochmal fündig geworden. Schon lange habe ich mit einer analogen Mittelformatkamera geliebäugelt. Und als die Pentacon Six so da lag und mich angelacht habe, musste ich sie natürlich mitnehmen. Die P6 kommt mit einem 2.8/80mm Biometar Objektiv, was bei der Filmgröße die Normalbrennweite ist.

Bisher habe ich erst einen Film mit der P6 verschossen und bin mit den Ergebnissen ziemlich zufrieden. Nicht nur, dass ich zum ersten mal einen Mittelformatfilm verschossen habe, war das auch meine erste Entwicklung. Ich habe es mir gleich gegeben und eine Pushentwicklung gemacht, da ich fĂĽr eine richtige Belichtung nicht genug Licht hatte. Mehr zur P6 folgt an dieser Stelle bestimmt noch :)

Also, wer Lust auf die Fotobörse bekommen hat.… die nächste findet am 22. April 2011 statt.

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Released collective.flattr

Today I released collective.flattr 0.2 to make it work in https environments.

Visit http://pypi.python.org/collective.flattr and/or http://plone.org/products/collective.flattr for more information. In a few word, collective.flattr integrates Flattr into the CMS Plone . It allows you to flattr the whole site, as well as separate entries. It's able to create things on Flattr for each object in Plone... of course only if you want :)

collective.flattr is integrated into this page.

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Moving around darktable managed photos

Under some circumstances, it's necessary to move photos from one file system structure to another. In my case, I moved my old photos from my notebook hdd to a 2TB external device. With this, I also want to start with a clean database for my new photos.

In my example, I moved the photos from /home/chris/Photosto /media/EXTERNAL/Photos2011/Photos. Have a look at my last blog post . Within the Photosdirectory I have several sub folders, each representing one film roll. So, /home/chrisis the base directory of my Photo directory.

Assuming, you have moved your photos as well as the database and config files to /media/EXTERNAL/Photos2011, you now have to adjust the paths to your film rolls in library.db.

Lets have a look into library.db: (make sure, darktable is currently not running)

$ cd /media/EXTERNAL/Photos2011/.config/darktable
$ sqlite3 library.db
sqlite> .schema film_rolls
CREATE TABLE film_rolls (id integer primary key, datetime_accessed char(20), folder varchar(1024));
sqlite> select * from film_rolls;
1|2011:09:08 11:16:16|/home/chris/Photos/20110904_XXX
2|2011:09:08 11:17:46|/home/chris/Photos/20110908_YYY
[...]

As you can see, the table film_rollscontains an id, the last access time and the folder - which is the base directory of this film roll. If you want to, you also could have a look into the table images. Most important in it is the foreign key film_id, which refers to the film roll of the specific photo.

However, you just have to adjust the paths of the film rolls and leave the literal photos untouched.

The change in the database should result in something like:

$ sqlite3 library.db
sqlite> select * from film_rolls;
1|2011:09:08 11:16:16|/media/EXTERNAL/Photos2011/Photos/20110904_XXX
2|2011:09:08 11:17:46|/media/EXTERNAL/Photos2011/Photos/20110908_YYY

I just wrote a few lines of python to do this move_darktable_photos.py . This small script runs on python >= 2.6, build with sqlite3 support.

Just call it:

$ ./move_darktable_photos.py \
--library /media/EXTERNAL/Photos2011/.config/darktable/library.db \
-o /home/chris \
-n /media/EXTERNAL/Photos2011
Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Starting darktable isolated

Sometimes, e.g. if you moved your data to an external device which is not permanently available, or even if you just want to use separated databases for managing your photos, it is useful to to start darktable isolated. It is be possible to launch darktable with the --libraryparameter, to force darktable to use a specific database file:

$ darktable --library /PATH/TO/library.db

However, with this approach your "default" config files and thumbnail cache is edited as well. For me, that's annoying.

If you start darktable in an isolated home directory, each database comes with its own config files and image cache. Just copy .config/darktableand .cache/darktableto your external device (the library file is located in .config/darktable/library.db):

$ cp -rp ~/.config/darktable ~/.cache/darktable /media/EXTERNAL/Photos2011/

Take care, to update the path to your photos in library.db(film_rolls is the relevant table). I will write a few sentences about moving darktables photos in another post .

However, /media/EXTERNAL/Photos2011is the isolated home directory and you have kind of this structure:

.cache/
└── darktable
    ├── mipmaps
    └── mipmaps.fallback
.config
└── darktable
    ├── darktablerc
    ├── keyboardrc
    ├── keyboardrc_default
    └── library.db
Photos
└── 201112
    └── IMG0001.CR3

Remember, the paths to your images has to be updated!

Now you have to set the HOME environment variable to your new directory and start darktable:

$ HOME=/media/EXTERNAL/Photos2011 darktable
Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Neuinstallation Webserver (redpill)

Im laufe der nächsten Wochen 19.12.-01.01.2012 installieren wir unseren Server neu. Unsere Services werden in der Zeit also auf jeden Fall mal weg sein.

Aber als Weihnachtsgeschenk gibt es dafür ein schönes neues Arch :)

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Scribus Vorlage Wandkalender 2012

Weihnachten steht vor der TĂĽre und ich plane einen eigenen Wandkalender mit selbst geschossenen Fotos zu verschenken. Wie schon letztes Jahr lasse ich den Kalender bei Pixelspeed im A3-Querformat drucken.

DafĂĽr habe ich ein Scribus Dokument erstellt, in dem nur noch die Bilder eingefĂĽgt und das daraus erstellte PDF hochgeladen werden. Wichtig ist, die Ăśbergabestandards einzuhalten. Innerhalb des Scribus Dokuments gibt es eine Masterpage, in der mein Name noch ausgetauscht werden muss. Die eingefĂĽgten Bilder sollten in 300dpi vorliegen, werden ansonsten automatisch hochskaliert. Bei der Generierung des PDFs sollte darauf geachtet werden, die verwendeten Fonts zu integrieren und die PDF Version 1.3 zu erzeugen.

Achtung: Ich habe diese Vorlage noch nicht drucken lassen. Daher weiĂź ich noch nicht, ob die Fonts richtig rauskommen. Laut des Ăśbergabestandards sollte ein Standard- und am besten keine freien Fonts verwendet werden. Daher habe ich mich fĂĽr Lucida Grande entschieden, den ich direkt aus dem AUR installiert habe.

Ăśber Feedback freue ich mich natĂĽrlich :)

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

Python and Flattr API v2

In Fiddled around with python-oauth2 and flattr I described how to access the Flattr API. Since this post, the Flattr guys relased a new API which is currently still beta but already useful working. However, at least after a fix of the access token process ;-)

So. What exactly changed? Almost everything, starting with a completely new and different authentication and authorization process.

I think, with v2 it's easier to develop apps. The API seems to be more straight forward. The process to get an access token is much simpler. I also like that JSON is used by default. Also the documentation is better than before, and very easy to understand and follow. What I really like, I don't need python-oauth2 as dependency any more. Everything is working with e.g. httplib2 .

First we have to send the User to Flattr, for authorizing our app. Therefor we have to include our client_id, which is the KEYof our app on https://flattr.com/apps :

https://flattr.com/oauth/authorize?scope=thing&response_type=code& client_id=KEY&redirect_uri=http://localhost

After the authentication, we will be redirected to http://localhost/?code=NEW_CODE.Your app should be registered now at https://flattr.com/settings/applications .

The next step is already to get the access token, using HTTP Basic Auth:

>>> http = httplib2.Http(disable_ssl_certificate_validation=True)
>>> http.add_credentials(key, secret)
>>> code=NEW_CODE
>>> params = {'code': code,
... 'grant_type': 'authorization_code',
... 'redirect_uri': 'http://localhost/'}
>>> ret = http.request('https://flattr.com/oauth/token', 'POST', j.dumps(params), headers={'Content-Type': 'application/json'})
>>> ret
({'status': '200',
  'content-length': '73',
  'strict-transport-security': 'max-age=500',
  'set-cookie': 'PHPSESSID=3hceaj0umb533cipg462briq64; path=/; domain=.flattr.com; HttpOnly',
  'expires': 'Thu, 19 Nov 1981 08:52:00 GMT',
  'vary': 'Accept-Encoding',
  'server': 'lighttpd',
  'connection': 'close',
  '-content-encoding': 'gzip',
  'pragma': 'no-cache',
  'cache-control': 'no-store',
  'date': 'Sun, 20 Nov 2011 10:48:44 GMT',
  'content-type': 'application/json; charset=utf-8'},
'{"access_token":"NEW_ACCESS_TOKEN","token_type":"bearer"}')


That's it. We now have our access token and are able to use it.

Get my user information using the access token:

>>> headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer NEW_ACCESS_TOKEN'}
>>> ret = http.request('https://api.flattr.com/rest/v2/user', headers=headers)
>>> ret
({'status': '200',
  'x-ratelimit-remaining': '4990',
  'content-location': 'https://api.flattr.com/rest/v2/user',
  '-content-encoding': 'gzip',
  'strict-transport-security': 'max-age=500',
  'vary': 'Accept-Encoding',
  'content-length': '274',
  'server': 'lighttpd',
  'connection': 'close',
  'x-ratelimit-limit': '5000',
  'date': 'Sun, 20 Nov 2011 10:54:01 GMT',
  'content-type': 'application/json'}, 
'{"type":"user","resource":"https:\\/\\/api.flattr.com\\/rest\\/v2\\/users\\/chrigl","link":"https:\\/\\/flattr.com\\/profile\\/chrigl","username":"chrigl","firstname":"Christoph","lastname":"Glaubitz","city":"","zip":"","province":"","cellphone":"","avatar":"","about":"","country":0}')
>>> simplejson.loads(ret[1])
{'about': '',
 'avatar': '',
 'cellphone': '',
 'city': '',
 'country': 0,
 'firstname': 'Christoph',
 'lastname': 'Glaubitz',
 'link': 'https://flattr.com/profile/chrigl',
 'province': '',
 'resource': 'https://api.flattr.com/rest/v2/users/chrigl',
 'type': 'user',
 'username': 'chrigl',
 'zip': ''}

And that's it. Thanks for reading, and don't forget to consult the Flattr API v2 documentation .

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.

My Plone configuration

Basically this page is running on a - more or less - plain Plone 4 (currently 4.1.2 ). I just include some packages out of the collective.geo.*(search on pypi ) world, as well as my own plonetheme.sunburst based skin plonetheme.chrigl .

Because this is a really small page, I am only running a single Plone instance and there' s no need for a complex multi-instance-zeo-setup . Because there' s an already running apache2 on my server, I run my Plone behind it, using Zope's VirtualHostMonster .

Because my apache2 also serves home directories (e.g. http://chrigl.de/~chris/ ), my rewritings look like this:

RewriteCond %{REQUEST_URI} !^/~.*
RewriteCond %{REQUEST_URI} !^/icons/.*
RewriteCond %{REQUEST_URI} !^/build/.*
RewriteCond %{REQUEST_URI} !^/default-site/.*
RewriteCond %{REQUEST_URI} !^/error/.*
RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/Plone/VirtualHostRoot/$1 [L,P]

Since ^/~.*is user name, the other directories belong to apache2. It's necessary to pass these directories too, to find the folder, etc. images in apaches directory overview, as well as correct error handling.

Just for fun and testing, I'm running a varnish-3.0.1 cache in front of my instance (apache2 -> varnish -> Plone). With a proper configuration of varnish, it's possible to shut down the Plone instance, but still serve the page. However, at least as long as varnish cache the content. This is my varnish default.vcl

Plone is running on an Ubuntu 9.10 with upstart . So I decided to write two upstart scripts, one for the Plone instance and one for varnish.

/etc/init/plone.conf

# Plone - Web-Content Management System
#
# Based on Python and ZOPE

description "start chrigl's plone"
author "Christoph Glaubitz"
version "0.2"

console none
respawn
emits plone

start on (local-filesystems and net-device-up and runlevel [2345])
stop on runlevel [!2345]

exec /home/myuser/bin/plone-starter /home/myuser/Instances/chrigl/bin/instance console

[UPDATE]: Changed console to none, because of curios behavior of upstart.

Changed exec. Included plone-starter to emit the event plone. This triggers the start of plone-varnish. [/UPDATE]

/etc/init/plone-varnish.conf

# Varnish Cache
#
# ...is an open source, state of the art web application accelerator.
# You install it on your web server and it makes your website fly.

description "start varnish for chrigl's plone"
author "Christoph Glaubitz"
version "0.2"

console none
respawn

start on plone
stop on runlevel [!2345]

# run varnish as user myuser
exec su -s /bin/sh -c 'exec "$0" "$@"' myuser -- /opt/varnish-3.0.2/sbin/varnishd -F -f /home/myuser/Instances/chrigl/varnish/default.vcl -s malloc,100M -T 127.0.0.1:2000 -a 0.0.0.0:8080 -n /home/chris/Instances/chrigl/var/varnish

[UPDATE]: Changed console to none because varnish was not able to bind to ports when using "console output"... do not know why!?

Changed the exec string: appended -n /home/chris/Instances/chrigl/var/varnish, to give varnish a working directory else than the global /opt/varnish-3.0.2/var

Changed to start on plone. The script plone-tester emits this upstart event. However, now varnish is just started when plone is running. No bad idea I think. [/UPDATE]

Because varnish does not have something like Plone's effective-user, it is a little bit tricky to start it as non-root. Also this version of upstart does not provide a solution for this problem. However, my solution is borrowed from here (thanks guys!).

With this scripts, it's very easy to control the daemons via initctl, e.g.:

# initctl start plone
# initctl start plone-varnish
# initctl status plone-varnish
plone-varnish start/running, process 19046

Update: I decided to install varnish not directly into my buildout, but system-wide. Also the default.vcl is handmade and resists outside buildout.

Files:

Autor
Chris Glaubitz
Configuring, coding, debugging computers for a living. Riding bikes for fun.