Posts from 2011-06

Resize Images from Context Menu on Gnome / Ubuntu Linux

Easiest way using the Ubuntu/Debian package nautilus-image-converter:

sudo apt-get install nautilus-image-converter

Using a Custom Photo Resize Script for the Nautilus File Manager

This context menu script can resize to 3 predefined sizes (more can be added) and it asks to put the resized pics in a folder or rename them....

Read on

Resize Images from Context Menu on Mac OS X

...

Read on

Windows PowerShell

http://de.wikipedia.org/wiki/Windows_PowerShell
Windows 7 ships with v2.0 of the Windows PowerShell. On a German Win7 installation you can start it via Start → Alle Programme → Zubehör → Windows PowerShell → Windows PowerShell (ISE).

Get Help

Owner's manual: http://technet.microsoft.com/en-us/library/ee221100.aspx

Help -?

or via get-help *.

Translating Simple DOS Commands to Powershell cmdLets

Read on

cherokee – A Very Fast and Small Webserver Software

http://www.cherokee-project.com/

Installation

http://www.cherokee-project.com/doc/

Debian/Ubuntu offers Cherokee packages but they are quite outdated for the stable branch. So you may want to prefer the manual installation from source.

Manual Installation From Source

The easy way of installation:

wget http://cherokee-project.com/install && python install

or get the source and compile it yourself:

wget...

Read on

Markdown for the Gedit Text Editor on Ubuntu 11.04

This is the continuation of the topic gedit Markdown plugin and the comment by Jean-Philippe Fleury, the author of the plugin.

If you frequently have to create Markdown documents, you might want your text editor of choice to support you. Jean-Philippe Fleury developed a nice plugin for Gedit to...

Read on

Use Synergy on Mac

http://synergy-foss.org/pm/projects/synergy/wiki/UsingSynergy

Install:

cd ~/Downloads
curl -C - -O http://synergy.googlecode.com/files/synergy-1.4.5-MacOSX107-x86_64.dmg
open synergy-1.4.5-MacOSX107-x86_64.dmg
cd /Volumes/Synergy/
cp -r Synergy.app /Applications/

Start the server:

synergys -f --config ~/synergy.conf

where synergy.conf is:

# sample synergy configuration file
#
# comments begin with the # character and continue to the end of line.
# comments may appear anywhere the syntax...

Read on

js-Unicode-Selector – A tool to have a closer look at Unicode Symbols

Yesterday, I had to prepare for an exam at the University but instead of learning for it I wrote a small tool to browse the unicode characters. You can have a look at it on http://pklaus.github.com/js-Unicode-Selector. It's fun...

Read on

The Bash

The Bash is probably the most important shell and scripting language in the world as it is included with almost any operating system (excl. MS Windows). The automation that can be achieved with very predictable results is great even though the complexity of the scripts is somehow limited. Doing calculations...

Read on

First Contact with amd64 (x86_64) Assembler Code

On Wikipedia there is a Comparison of (x86) assemblers. You can sort the table by x86_64 capability.

Syntax

Most x86 assemblers use Intel syntax. Here is a little comparison: http://asm.sourceforge.net/articles/linasm.html#Syntax

Intel syntax

Most widely used assembler syntax.

AT&T syntax

At the end of the mnemonics you put a size suffix (one letter). To change...

Read on

The Programming Language C

Operators in C

Operators in C and C++: http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

C supports a rich set of operators, which are symbols used within an expression to specify the manipulations to be performed while evaluating that expression. C has operators for:

  • arithmetic (+, -, *, /, %)
  • equality testing (==, !=)
  • order relations (<, <=, >, >=)
  • boolean...

Read on

AppleScript

Language References

Applescript Language Guide PDF | HTML

Great Tools

The AppleScript Editor shipped with Mac OS X (or XCode...) PreFab UI Browser http://pfiddlesoft.com/uibrowser/ Script Debugger 4.5 http://www.latenightsw.com Smile http://www.satimage.fr/software/en/smile/index.html

Run a Terminal Command

http://developer.apple.com/library/mac/#technotes/tn2065/_index.html

set hostname to "www.apple.com"
do shell script "ping -c1 " & hostname

Resources

  • Wikipedia...

Read on

Solve PHP5-GD2 trouble: Missing configuration file gd.ini

I had a nasty problem with Piwik today. I use it on a low traffic website until today (updated to 1.5) I did not mind that the sparklines were not displayed. But today I wanted to fix the problem and at first I didn't come to the conclusion that

Read on

`python-sipgate-xmlrpc` – Easy to use Python bindings for the Sipgate XML-RPC API

The German VoIP provider Sipgate has a great offer for people who want to replace their landline with a modern internet based SIP telephony account. Sipgate offers an XML-RPC API to all its customers (you must at least have created a free 'basic' account). With the API, you...

Read on

Install Gitosis on Debian Squeeze

You can use gitosis to allow people to collaborate on a project via git. Its a utility to allow read and write access based on SSH encryption keys. And you only need to create a single system account, not one for every contributor.

First, install gitosis:

su
apt-get install gitosis

Now...

Read on

Install as many python modules as you like - in virtual environments

su
easy_install virtualenv

And create your virtualenv :

mkdir ~/venv
virtualenv --no-site-packages ~/venv/django-cooking
source ~/venv/django-cooking/bin/activate

Now you can install a whole bunch of stuff to that virtual python environment:

easy_install django psycopg2 django-extensions werkzeug south reportlab pypdf html5lib pisa pil

When using virtualenv, you should also consider using virtualenvwrapper! It provides...

Read on

Python 2.7 on Mac OS X

Praveen Gollakota shed light on Installing Python 2.7, easy_install, pip, virtualenv and virtualenvwrapper on Mac OS X. He gives you all the information you need if you want to use an up-to-date Python on Mac OS X! Thx!

Alternative way of installing python using homebrew:

brew install python
...

Read on

Deployment of a Django based Website

...

Read on

Django Internationalization

Please refer to https://docs.djangoproject.com/en/dev/topics/i18n/ for up to date information.

There are three steps on the way to Django i18n:

  • For application authors wishing to make sure their Django apps can be used in different locales: Internationalization.
  • For translators wanting to translate Django apps: Localization.
  • For system administrators/final users...

Read on

The Django template engine

http://docs.djangoproject.com/en/dev/ref/templates/api/

Using the template system, a two-step process:

  • First, you compile the raw template code into a Template object.
  • Then, you call the render() method of the Template object with a given context.

Example for use in standalone-mode:

from 

Read on

The Django Web Framework

The website of the Django web framework can be found on https://www.djangoproject.com/.

Installation

The current version of Django (2011-06-13: v1.3) can be installed on Ubuntu/Debian using

sudo apt-get install python-setuptools
sudo easy_install django

(The install-dir on Ubuntu 11.04 will be /usr/local/lib/python2.7/dist-packages. More on the install-dir can be read in a blog...

Read on

Convert between Power and dBm

Many devices that send & receive data via antennas give you information about their power in units of dBm. If you wan to know how to convert this unit to a power value given in mW (and vice versa) you may read on.

The formulae found in the Wikipedia article...

Read on

Investigating Domain Update Errors (ERROR: 901 Unexpected RCODE - SERVFAIL)

Today I wanted to try out the DNS Service by Hurricane Electric (including a free IPv6 DynDNS service): https://dns.he.net. I have a spare domain and tried to update my domain information to the new nameservers (from the set ns1.he.net, ns2.he.net, ns3.he.net, ns4.he.net, ns5.he.net) at Denic, the German TLD...

Read on

Convert between plus-cylinder and minus-cylinder notation in eyeglass prescription writings using Python

Doctors in Germany usually give out prescriptions with negative values for the cylinder. Some eyeglass manufacturers list their products with plus-cylinder notation so the optometrists have to convert the notations.

Online Converter

If you want to convert your prescription writings, I created this online tool to convert your values:

Convert Cylindrical Notation

It...

Read on

Sandboxing on Ubuntu with Arkose using LXC

Arkose can serve to make sandboxing easy on Ubuntu Linux. It uses LXC as technology to isolate programs that you don't trust fully.

On Natty 11.04 the installation is as simple as

sudo apt-get install arkose

Check the links below for more information.

Resources

Read on

PHP SQlite3 with PDO

If you want to use SQlite3 databases with PHP you should probably use PDO.

Install it like this:

su
apt-get install php5 php5-sqlite
echo -e "\nextension=pdo.so\n" >> ../conf/php.ini

Note: You don't need any command like pecl install pdo_sqlite or pecl install pdo as PDO is now included in the package php5-sqlite...

Read on

Using Python to interact with the Google Spreadsheets API

update 2015-09-08: this is outdated, please refer to my new blog post instead.


Install the Google Data Library (you should consider installing it in an isolated virtualenv environment):

cd ~/Downloads
curl -C - -O http://gdata-python-client.googlecode.com/files/gdata-2.0.14.tar.gz
tar -xf gdata-2.0.14.tar.gz
cd gdata-2.0.14
python setup.py install

Now you are ready to test the example...

Read on

Communicate with the identi.ca API using Python via tweepy

Install tweepy via PyPI:

easy_install tweepy

Example usage with identi.ca:

import tweepy
username, password = "identi.ca_username", "identi.ca_password"
auth = tweepy.BasicAuthHandler(username, password)
api = tweepy.API(auth, 

Read on

A Pygments Highlighter for Code Blocks of Wordpress Posts Written in Markdown Syntax

The WordPress plugin pygments-markdown-highlighter makes the Pygments highlighter available to highlight your code blocks when writing posts in Markdown syntax.

To use it, you need to install Pygments on your web server and install the plugin itself. And you should also have PHP Markdown installed in your blog (and they...

Read on

Automatic Line Breaks With vim

First set the textwidth:

:set textwidth=76

Reformatting

If you want to reformat a block of text, format it and press gq. For example to format the following 4 lines from the current cursor position, press v4jgq (v4j to enter markup mode and mark the following 4 lines).

References

...

Read on

Open Source (Web) Server Administration Software

Alternatives to Confixx, Plesk etc.

More general server administration

...

Read on