Personal musings of all colors, mostly about programming, science and mathematics.

## Rotate and translate

If you rotate a 2-dim. figure around two different center points with the same angle, you need an extra translation to move the images into the same position. For simplicity, we assume that one center is the origin, and the other is \$c=(c_x, c_y, 1)^T\$ (homogeneous coordinates in projective space). Let’s determine the equations to convert the rotation \$R\$ around \$c\$ into a rotation around the origin \$O=(0,0, 1)^T\$, followed by a translation \$t=(t_x, t_y, 1)^T\$.

## The whole browser window but a border

Filling the whole browser window except for a border is surprisingly difficult. Here are three solutions. </head> <body> <div class="outer outer1"> <div class="inner"> </div> </div> </body> </html> Instead of outer1, there is also outer2 and outer3. The solutions use different approaches: The calc() function to do math in CSS, absolute positioning with top, left, bottom, right and the new box-sizing property. Here is the stylesheet: html, body { margin: 0px;

## Docker trouble

Docker containers are great, and the Dockerfile build process is quite good, but there are pitfalls for newbies who come to Docker with a virtualization mindset. Docker containers are not light-weight VMs, because the abstraction happens at a much higher level. Docker is platform-as-a-service, not system-as-a-service. Here is a short list of issues I encountered migrating a couple of services from bare metal to Docker containers: Lack of kernel independence with SE Linux Lack of docker internals independence in the mount table.

## Fun with aptly

aptly (by Andrey Smirnov) seems to be a swiss army knife for Debian/Ubuntu repositories. You can create (partial) mirrors, snapshot them, merge snapshots and push them to an apt-get’able repository. You can also upload packages to a local repository and snapshot and/or publish that, too. Andrey is rocking the Debian world with this, thanks a lot! To illustrate the work-flows that this tool enables, here is an example that extracts firebird 2.5.1 and its dependencies from Ubuntu precise (12.04) and injects it into a published repository for trusty (14.04) installations (which have only firebird 2.5.2).

## Query Semantic MediaWiki with Angular through CORS

I have a private MediaWiki with the Semantic MediaWiki extensions, to keep some personal data. Wouldn’t it be nice to query that data from some other server, or from a web app? Semantic MediaWiki has a nice API that allows us to get data in JSON format. But we need to defeat the Same-Origin-Policy that protects our servers from evil code. JSONP is a well-known method that works, but only for anonymous requests on public wikis.

## Cython Trouble

Here are a couple of things I experienced using Cython to wrap my C++ library grakopp: Assignment and Coercion I couldn’t find a nice way to wrap boost::variant. Although the direct approach works, an assignment to the variant requires an unsafe cast, but that also adds the overhead of a copy. To work around this, I used accessor functions (requires changing the C++ implementation). The operator= is not supported to declare custom assignment functions.

## Manual symbol version override

I had to deal with a proprietary software library that wouldn’t run on CentOS 6.5, because the library was compiled against a newer glibc (>= 2.14) while CentOS was running on glibc 2.12. Actually, there was only one symbol versioned later than 2.11, which was memcpy@2.14. It turns out that this is due to a well-known optimization (nice discussion with links [here). Normally, one would install an appropriate version of the library and set LD_LIBRARY_PATH accordingly, but for libc that ain’t so easy, because you also need a matching runtime linker, and the kernel will always use /lib64/ld-linux-x86-64.so.2 or whatever is found in the INTERP program header of the ELF executable.

## Virtualization Technologies

Virtualization technology is moving fast, and what used to be hot yesterday is as cold as ice today. There is a lot of material to digest, and a lot of documentation that seems somewhat relevant but can be out of date. Surely, this blog post will suffer the same fate, but nevertheless, here it is: A quick list of the most relevant and up to date technology that I could find to set up a small cloud.

## Compiling FreeCad on Fedora 20

FreeCad is a very promising free and portable CAD program. Unfortunately, it’s dependency chain is a bit messy, and building those libraries is not for the faint of heart. Normally, GNU/Linux distributions do a good job on that for you, but in Fedora, the packaging is not quite up to date. The included FreeCad 0.13 works, kinda, but there are crashes and bugs like missing text rendering in Draft mode. As FreeCad is progressing fast, it is useful to build the latest version, and here is how to do just that on Fedora 20.

## OpenSSH authorized_key options by version

This should be in the official documentation, but for what it’s worth:

All versions of OpenSSH support the following options in authorized_keys:

command=””, environment=””, from=””, no-agent-forwarding, no-port-forwarding, no-pty, no-X11-forwarding.

Starting with version 2.5.2, OpenSSH supports permitopen.

Starting with version 4.3, OpenSSH supports tunnel.

Starting with version 4.9, OpenSSH supports no-user-rc.

Starting with version 5.4, OpenSSH supports cert-authority.

Starting with version 5.6, OpenSSH supports principals.

All Posts by Category or Tags.