## How to Stream Music from Linux PC to iPhone over Wifi

posted in: Linux | 1

There are endless possiblities to stream music from your computer to your phone over wifi, but few dedicated howtos that walk you through the process step by step.

# Option 1: UPnP

Universal Plug and Play (UpnP) is developed by the Digital Living Network Alliance (DLNA) and has interoperateability in mind. See Make Use Of for a list of possibilities.

## Connect Crunchbang Linux to Bluetooth Speaker

posted in: Linux, Technicalities | 0

I got myself one of these and after setting it up properly I must say that while I am a bit disappointed by the reach, I am very impressed with the sound quality for this kind of money (a white label apparently as »C26« sells under various brands and for different prices).

Anyway, the whole setup was a true Linux afternoon, reminding me of my NDISwrapper-days, just like it was 2006 again.

First, It took me a while to get crunchbang to discover the device and connect [1] (Blueman works much better as a bluetooth manager). Then apparently I manually needed to let pulseaudio know where to send the audio [2]. Atfer fiddling with some files, pulseaudio was broken, so I needed to reinstall [3]. Finally, the sound was much poorer than via my phone. I don’t know if I overlooked it or if loading rtirq changed something [4], but in the volume control center of pulseaudio there is a tab called »configuration« where I had to choose »High Fidelity Playback (A2DP)« to get decent sound (instead of »Telephony Duplex (HSP/HFP)« or »off«). Now most of the times it changes to the Bluetooth-device automatically once I switch it on and back when I switch it off. Sometimes not. But hey.

The sources I used were these:

1. How to make pulseaudio bluetooth-ready: http://askubuntu.com/a/223203/80611

## Automatically batch rename photo files

Following Robert Seale’s advice, I was looking for a solution to batch rename photo files. After my last shoot I used digikam and while the results were as desired, it took a second or more per image, which I thought a bit long. After not finding a different suitable solution I asked the question on unix.stackexchange and was overwhelmed by two people’s in-depth answers. I learned a lot from both mikserv and Gilles and in the end settled with Gilles’ suggestion. I take zero credit for the solution, I don’t even understand parts of what is going on, but I amended it a little bit nonetheless and thought the extended version might help someone.*

### Preliminaries

What I get when I come home is file names looking like this: _DSC1234.NEF. What I wanted instead was

1. date-shot in YYYYMMDD-format plus
2. a descriptive shoot-name plus
3. image-number

looking like this: 20140708_WeddingAdamAndEve_0001.NEF

There are a few issues with this:

ad 1. Date Shot: sometimes I can only copy and rename the files a few days after shooting, so the date should reflect the date the picture was taken, not the date it was copied. Getting date-shot from the file itself is difficult as there is no birth time recorded. The closest is mtime which is the time the file’s content has last been modified. However, creation date is stored in image file’s EXIF data.

ad 2: Name of Shoot: Ideally I wanted this to be a variable I could set as a parameter when calling the script.

ad 3. Number of Image: This should reflect the age of the image with the oldest one having the lowest number. The problem is that cameras usually restart numbering at  0000 once they hit  9999. So images n-9999 can potentially be older than 0000-n. I needed a solution that would cater for this special case.

### The code

# original solution by @Gilles (http://unix.stackexchange.com/questions/141138/)

# set base path and navigate to "basepath + parameter 1"
BASEPATH='/media/data/photo/';
cd $BASEPATH$1

#

## Crunchbang on x200s

posted in: Linux, Technicalities | 0

Through a few very lucky coincidences I received a Thinkpad x200s a few days ago and set it up with Crunchbang which must have been the most straightforward os-installation ever. Two Three Four things though:

## Rawtherapee

A slightly outdated version is in debian’s repositories, but if you want a newer one, go to »Kbyte’s Hideout«. Download .deb package and dpkg -i rawtherapee_<xxx>.deb

If there are unsolved dependencies: apt-get install -f and then  dpkg -i rawtherapee_<xxx>.deb

## Picasa

Well.

It still is the most straightforward programme I know for editing, simple retouches and exporting smaller sizes. I’m not happy with wine, I’m not happy with a google tool, but I cannot and cannot find an alternative (see here). Hence:

before following the webupd8 tutorial I needed
apt-get install libwine-cms:i386
After installation, use
cd ~/.wine/drive_c/Program\ Files/Google/Picasa3 && wine Picasa3.exe
to launch it.

If you would then create a script called »picasa« somewhere, say in ~/scripts containing the following:

#!/bin/bash

cd ~/.wine/drive_c/Program\ Files/Google/Picasa3 &amp;&amp; wine Picasa3.exe

exit 0



Picasa can then be launched from command-line with a simple »picasa« after a final
sudo ln -s ~/scripts/picasa /usr/bin/picasa

## Clock

To change the format from Hour:Minute open ~/.config/tint2/tint2rc and consult strftime-man to change to your liking.

## Change Key Bindings

Keyboard shortcuts can be changed in ~/.config/openbox/rc.xml

After saving, go to Openbox menu > Preferences > Openbox Config > Reconfigure. (Thanks, MysteryMember)

## Redecorating the place II

posted in: Random, Technicalities, www | 0

After almost eight years using (and helping develop) Polypager, a very versatile and friendly content management system, and after three years of having Zenphoto manage my pictures, I finally decided I had to retire both and move to a different system altogether: a single one for text and images that would also treat my mobile visitors better (a third of my total traffic).

Polypager’s strength clearly was in handling the database – it has foreign key capability and without the faintest complaint, Polly will display any mysql-database it is being fed. However, it was never built with serving images as a central part in mind. There is a gallery plugin in place, but my desires soon surpassed the capabilities.

Zenphoto in turn is fantastic in handling text and images (and video by the way, which surprisingly posed the biggest hurdle in wordpress – the other was 301, but in the end Tony McCreath’s redirect generator helped). The problem with zenphoto is more an aesthetic one as the available skins are limited and don’t really meet my expectations. The one I hacked together unfortunately »grew organically« over the years until recently it gracefully started falling apart.

Thus, today I make the move to WordPress and while I am at ease parting from Zenphoto, leaving Polly behind really hurts. So, thanks Nic for developing it and having me aboard, because in the process, I learned many a thing about distinguishing sensible feature requests from the other ones, about version management using svn and git, and also, in 2008, about how it feels to be at the receiving end of a proper hack.

## MTPFS FAIL

posted in: Linux, Technicalities | 2

My ubuntu 12.04 computer cannot see my Android 4.1.2 phone, instead I must install go-mtpfs and control it via command line. Thankfully, Andrew over at webupd8 provides all the necessary tools (all credit goes to him, for long version see there):

sudo add-apt-repository ppa:webupd8team/unstable
sudo apt-get update
sudo apt-get install go-mtpfs

Optional:

sudo apt-get install go-mtpfs-unity

Mount:

go-mtpfs /media/MyAndroid

Unmount:

fusermount -u /media/MyAndroid

Ironic that I should now need a special

## Removing Juice from Keyboard

posted in: Other, Technicalities | 0

Recently I bought a faulty pack of grapefruit juice. The plastic nozzle was not glued to the carton properly, so instead of filling my glass, I filled my trusty old Logitech UltraX Premium keyboard. I wiped it clean immediately, but the next day the keys were as responsive as a panda after a month of sleep deprivation. I searched and among the many »how to remove all the keys from your keyboard«-articles, I found one that said: in the shower with it!

I closed my eyes, hoped for the best and thoroughly rinsed it. Then, like people in this 2005 Boing-Boing-piece recommend, I placed it over a radiator for three days, turned it round from time to time and today I plugged it back in.

Result? It works as good as new!

## Network Sync

posted in: Linux, Technicalities | 0

I recently got my hands on a shiny eee-PC for surprisingly little money. As I am travelling a fair bit at the moment, the opportunity was more than welcome. Now, mobility comes at a price and the price is called »multiple instances of files«. When the files in question are your PhD, it has the potential for a fantastic nightmare. Most people use dropbox to tackle this, but for one reason and another, I neither want to use that, nor ubuntu one. I have owncloud [see here], and after resolving some issues, the sync client works, but I still would like to keep more data in tune then I could possibly channel through my shared hosting plan. Unison (via ssh) seems the way to go.

Setting it up was a lot easier then I though. All it took was rbgeek’s exccellent article »File Synchronization Between Two Ubuntu Servers using Unison«.

Falko Timme’s article »Setting Up Unison File Synchronization Between Two Servers On Debian Squeeze« at howtoforge was also helpful. Another insightful article is Chris Lale’s »Synchronising laptop and desktop files using Unison« at Sourceforge.

One issue: normally your device gets an IP address automatically from your router. Unison settings depend on the IP address (for ssh connection), so if the IP address changes, Unison gets confused. Thus, we want a static IP address on the remote machine. Johnathan Hobson’s »Networking Tips and Tricks« are a good start. The settings that finally worked for me I got via chili555’s post on ubuntuforums. Using Netman’s GUI, I set:

Method: Manual

Address: 192.168.0.9

Netmask: 255.255.255.0

Gateway: 192.168.0.1

DNS Servers: 8.8.8.8, 192.168.0.1

Search domains:

I understand little, but what I do understand is this:

• »address« needs to be outside the router’s scope. Mine is configured to start at 10, so I picked 9.
• »gateway« simply seems to be the router’s ip-address
• »DNS-Servers«: no clue why 8.8.8.8, the other again seems to be router’s ip address

You can easily determine the router’s ip-address and the scope for auto DHCP from the router’s admin interface.

## Custom Shortcuts in Kile

posted in: LaTeX, Technicalities | 0

If you use Kile as LaTeX editor and if you find yourself typing the same code all over again – like a specific table environment, or a slide environment in beamer or whatever, why not create your own user tag and assign a custom shortcut? You can even decide where the cursor should be placed and what should happen in case text is selected while pressing your shortcut.

It’s very easy and very fantastic: User defined Tags.

## Bibtex going openout_any = p

posted in: LaTeX, Technicalities | 4

Working with multibib, Bibtex started failing me after a recent reinstallation of texlive on xubuntu. On
bibtex <project-path>/src.aux
I got:

bibtex: Not writing to &lt;project-path&gt;/src.blg (openout_any = p).

I couldn't open file name &lt;project-path&gt;/src.blg'

To get rid of the error, open texmf.cnf, which resides in /usr/share/texlive/texmf/web2c through
sudo gedit /usr/share/texlive/texmf/web2c/texmf.cnf
Then find the entry

openout_any = p

p is the paranoid setting. I changed it to r and it now works again (chapeau to dmj).

[update 31 Jan 2013] If sudo is not an option and thus texmf.cnf can’t be changed, see Sini’s helpful comment below. [/update]

If you want to learn about multiple bibliographies using multibib, there is a very good tutorial by peisistratos. Unfortunately it is in German, but I’m sure there are English ones out there, too.

## .htaccess redirect with GET variable

posted in: Technicalities, www | 0

I wanted to rename a part of this website and I knew, I needed a 301 in order to redirect people from the old to the new address. It was easy to find out that this can be achieved through .htaccess and the basic needs were also pretty easy to gather. Create a text-file called .htaccess on your apache-web-server in the root directory of your website. It needs to contain the following two lines to switch the module on:

RewriteEngine on
RewriteBase /

Then, for the actual rule there’s a lot of generally helpful stuff out there – only it didn’t help me:

1. the string in question was a GET-variable as part of a dynamic URL
2. the string could be in the middle of the URL or at the end

My task was to replace a chunk from a dynamic URL and leave unchanged whatever was before or after this chunk.

The example was the page you’re reading at the moment. It used to be called »Recettes« and I wanted to rename it to »Recipes«.

The overview was reached through http://www.brasserie-seul.com/?Recettes, but this article had the URL http://www.brasserie-seul.com/?Recettes&nr=60. In addition this page has groups, so there is also http://www.brasserie-seul.com/?Recettes&group=web, […]group=ubuntu etc.

It took me literally hours of research, until I finally found Carolyn Shelby’s very helpful article. Her code took me almost there:

RewriteCond %{QUERY_STRING} ^(.*)Recettes(.*)$RewriteRule ^$ Recipes? [R=301,L]
This would take any URL containing the string »Recettes«, no matter where in the url it was, replace it with »Recipes« – and loose everything that followed. Now, Carolyn’s last example contains something she could have been doing if her strings were consistent:

RewriteCond %{QUERY_STRING} ^review=(.*)$RewriteRule ^cgi-bin/script.cgi$ restaurants/%1? [R=301,L]
The interesting bit here is %1 in the rule, because it apparently represents the (.*) from the condition. In my example I have two (.*)‘s: one before the string, one after. It is Regex for »any character or no characterlaquo. When I figured out that the first (.*) could be addressed through %1 and the second through %2, I was finally there:

RewriteEngine on
RewriteBase

## xubuntu 12.04

posted in: Linux, Technicalities | 0

Way too many issues with a first attempt drove me to the decission to reinstall. I had a look around and made eye contact with fedora, arch and debian but in the end thought I’d give a clean xubuntu installation a second chance – and I did not regret it. Here goes:

## 1. Installation from LiveUSB

First surprise:No issues. Only: apparently all of a sudden my computer needs a /boot partition, so my partition map looks like this:

1. primary   ext2    254MB   /boot
2. logical   swap

## Feeds a la Tiny Tiny RSS

posted in: Technicalities, www | 3

[update 2012-10-04] In the meantime, I helped Nic with what he calls scratching some itches for ex-Google-Reader users: we now have gritttt, and gritttt has a) a means to import shared/stared items from g-reader into tt-rss; b) drive-by sharing, meaning you can share any page in tt-rss on the fly; and c) a widget that can display the latest shared items from tt-rss on your website. More here. [/update]

[update 2011-11-10] Both this and Nic’s article have been featured on tt-rss’ project site. There are a bunch of other interesting and useful articles, too, so check it if you’re interested in tt-rss. [/update]

A while ago, Google updated their reader, killing one of the best features: sharing. I looked around a bit for a suitable alternative and in the end settled with tiny, tiny rss.

Advantages:

1. It runs on my server, so nothing can be done to it unless I approve
2. Sharing is easy
3. It’s simple

Nic, who thankfully came up with this great alternative, has

a

## Strikethrough in LaTeX

posted in: LaTeX, Technicalities | 8

Today I found a second way to achieve a strikethrough in LaTeX (what is done by »line-through« in css: strike out text). If you want to put a line across text, your choices are »ulem« and »cancel«:

## Strikethough in LaTeX using »ulem«

\usepackage{ulem} in the preamble gives you two ways to strike out text (and a couple more for underlining):

1. \sout{text to be striked out} for a horizontal line through text to be striked out

## Deny Internet in Ubuntu

posted in: Linux, Technicalities | 0

I have phases in my work cycle, where I want to limit internet access to myself. Thus, I created a »work-user« and in the user’s properties I unticked the boxes

• Connect to internet using a modem
• Connect to wireless and ethernet networks
• Use modems

I thought that should do the trick, yet it didn’t restrict internet

## ffmpeg-GUI

posted in: Linux, Technicalities | 0

I was somewhat flabberghasted when I found out my mobile phone (Sony Ericsson Cyber-shot) was unable to play .mp4, .flv, .avi and what else I tried. It refuses to play all video formats save .3gp.

I was unable to convert to this with avidemux. Google

## Fonts in LaTeX

posted in: LaTeX, Technicalities | 0

In short: To avoid the standard pixel bitmap fonts and go for smooth, scalable post script ones, use one of the following:

\usepackage{palatino}
\usepackage{times}
\usepackage{bookman}
\usepackage{newcent}

or, for standard post script fonts

\usepackage{pslatex}

## Position:Absolute in LaTeX

posted in: LaTeX, Technicalities | 0

In css there is the handy absolute positioning. Today I found out how to do it in LaTeX:

In the preamble

\usepackage{textpos}

In the document

\begin{textblock}{2}[0,0](8,1.5)
Lorem ipsum dolor sit amet
\end{textblock}

The arguments are as follows:

\begin{textpos}
{<width>}
[
<left

## ΛαΤεΧ in Greek

posted in: LaTeX, Technicalities | 0

There are various possibilities to include Greek text in your LaTeX document. The three ones I found are these:

1. $\Gamma\rho\varepsilon\varepsilon\kappa$ gets you Γρεεκ allright, but it looks clumsy and lacks all the accents etc.
2. betababel. It does not work with my customised control sequences, and I am too lazy to change them and learn them all anew.
3. polutonikogreek. Neat, slim, worked straight away.

Nos. 2 & 3 use ngerman, so make sure they don’t start a fight with german.

## update

I had a slight problem with polutonikogreek and titletoc. Whenever I used something like
\greek{p’olemos}
which referred to this entry in the preamble:
\newcommand*{\greek}[1]%
{\selectlanguage{polutonikogreek}{#1}%
\selectlanguage{german}}
the .toc-file looked like this at the corresponding place:
[…]
\contentsline {section}{\numberline {1.1}KAPITEL-1.1}{14}
\contentsline {subsection}{\numberline {1.1.1}UNTERKAPITEL-1.1.1}{14}
\select@language {polutonikogreek}
\select@language {german}
\select@language {polutonikogreek}
\select@language {german}
\contentsline {subsection}{\numberline {1.1.2}UNTERKAPITEL-1.1.2}{20} […]
Wherever \select@language appeared in the toc, the styling of my toc entries of the subsection level was being messed up. I style subsection entries in the toc in a way that they all get written in a single line. It looks like this:

\titlecontents*{subsection}[3.5em]   {\vspace{-0.5mm}\itshape\footnotesize}{}%   {}{\dots\normalfont\footnotesize%   \thecontentspage.\enspace}%   [\itshape][\vspace{1mm}]

There are two solutions.

Ignore the problem, compile your document, open the .toc-file, delete all \select@language entries and compile again (but only once).
Use the following specifications in your preamble:

\usepackage{ucs}\usepackage[utf8x]{inputenc}\usepackage[polutonikogreek,german]{babel}\newcommand{\gdir}%`

## Custom Counter in LaTeX

posted in: LaTeX, Technicalities | 0

## How it does work:

Here is what we do: We define the counter
\newcounter{MyCounter}

then we add

\renewcommand\theMyCounter{\roman{MyCounter}}

after it, and it works. Thanks to Axel for his help on this.

## How it does not work:

When you define a new counter like this

\newcounter{MyCounter}

And later use it like this

\refstepcounter{MyCounter}\label{example}
\roman{MyCounter}. Beispiel eins

And then reference it like this:

And now I reference an example \ref{example}. \end{document}

Then LaTeX still interprets it as something like

\newcommand\theMyCounter{\arabic{MyCounter}}

So it results in an arabic