musicmatzes blog

software

It happened that I ordered a new mobile phone for myself. And because I don't want to have a google account, pre-installed facebook Apps and the like, it is a OnePlus One.

The order

Well, to order a oneplusone you can go to amazon and order it for like 433 Euro (64 GB version). Or you go to the oneplus store and order it for 299 Euro, which is what I did. I also ordered a screen protector and a case for it, to protect it even more.

But well, if you want to order from the manufacturer, you have to register on their page, which pissed me off a bit. The second problem was that you can only pay via Paypal and because you order from non-germany, you have to setup your Paypal account with a credit card. I do not have a Paypal account (because it really sucks) – so I asked someone else to pay the order for me and transfered the money to the persons bank account.

Unboxing

The One arrived seven days after I ordered it. It was absolutely nicely boxed, though some boxing was rather ridiculous: I understand that the power adapter has to be boxed separately, because of adapter variants. I do not understand why it has to be boxed two times – one time in a box, another time in a plastic-foil.

Screen protector

I also ordered a screen protector. It was shiped together with the One, nice! I applied it accordingly to this tutorial and I managed to get only one really tiny bubble under the protector foil. Well done!

Update!

Of course, when starting the One for the first time, it asks you to insert your google account data, etc. etc. I do not have a google account, so I was really pleasant surprised when I was offered a “skip” button!

As I do not have a micro/nano-SIM card yet, I also skipped the SIM setup.

Then, after some localization and skipping, I was offered to update the phone from CM 11 to CM 12. I did this, of course. It was really fast, although it said it would take up to 20 minutes. While updating it told me that 128 Apps are optimized. I always thought CM comes without Apps preinstalled? Well... We will see.

Initial setup

After applying the update I was asked for several things again, including google account data. Of course I switched off what I could switch off.

I also disabled everything the google apps want to do. None of the google apps should now be able to access my texts or other data. I hope.

The initial setup was fun. I really enjoyed using the device. It is a bit heavier than my old device, but it is also a few inches bigger, so that's completely okay.

I really hope I can get my SIM card as soon as possible, so I can start using the device properly.

What really bothered me in the first place: I have a 64 GB device. I can use about 55 GB of this – copying music will be painful! But well... I solved that “issue”. I found out, that one can install git-annex on Android. So I did that and just imported my complete music library. It took a rather long time to create the 44771 files and 3913 folders on the device. But having git-annex available on my Android device is a great plus point. So I don't have to care about syncing the files and so on, I just can use git-annex and it does everything for me. I just have to be careful with the available memory, as 55 GB can not handle my 500 GB music library, of course.

And, just you know, I do not use the web interface. I use the terminal emulator, of course!

But then, the disillusion: The music player didn't work with the symlinks git-annex generates. So I removed the git-annex repository from the device and copied music to it as I am used to.

Sync with owncloud

Well, syncing with owncloud was a topic. I thought it would be easy, but it wasn't.

There is this DavDroid app on both the market and F-Droid, which can by used to sync between caldav/carddav servers and the device. I entered my owncloud data and synced, but it just won't work.

So I filed a bug in the forum of the developers, but they couldn't help me with my problem (though they responded really quickly and were really nice at all).

So I tried other synchronization apps and finally landed with CalDAV Sync Adapter and carddav sync free which worked.

Now I have everything set up to use the oneplusone as my daily driver! Yay!

A gem I found

I found a nice app in the f-droid as well: whohasmystuff, which can be used to keep track of things you lend to someone. Really nice and basic app. It just works™.

tags: #android #cmmod #linux #media #music #open source #software #oneplusone

Read another NixOS success story here, about how I updated my kernel and removed the old graphics driver and using another one in one step.

And I didn't even care about the fact that my system maybe wasn't bootable afterwards.

Indeed, that's NixOS awesomeness. So, the problem is, I have an AMD graphics card in my workstation at home. I was on kernel 3.18 a rather long time. I mean, I was on 3.18 from 3.18.1 to 3.18.whatisitatthemoment – I guess I was there until 3.18.16 or something!

I used the ati_unfree driver in my system, so it wasn't appropriate for Christmas and holy St. GNUcius. I wanted to fix this. Kernel 4.3 will have the free AMD driver infrastructure, but it isn't out there right now, so I thought of updating to kernel 4.2 with the ati_unfree driver package. But it didn't work, ati_unfree couldn't be build on my system. I don't know why and I actually do not care.

So here's what I did:

I removed the ati_unfree driver from my services.xserver.videoDrivers setting and set it to [ "ati" "nouveau" ] – each of the drivers listed will be loaded and tested, told me the description of this option. I then did a nixos-rebuild build run, to verify it builds. It did. So I updated the kernel to boot.kernelPackages = pkgs.linuxPackages_4_2; and did a nixos-rebuild switch (actually I used my awesome nixos-scripts for this), but yeah...

And then I rebooted. I didn't even have to think about potential breakage, I just tried to boot the new system. If it would have been unbootable, I would just boot into an older generation and instantly be back on my kernel 4.1 and ati_unfree driver I used before the update.

This is what I call NixOS awesomeness.

tags: #nixos #linux #software

I started a project some time ago, where I develop a template for a wiki which is statically compiled into a html page. As the template is more mature now, I want to introduce you wiki.template and explain why I wrote it.

Once upon a time...

If you read this blog you know that I'm a member of the NixOS community. The NixOS community has, of course, a wiki. And the quality of this wiki is bad. No really, it is just one large page (the landing page) linking to sub-pages which are more or less maintained and contain only snippets of information. Sure – there's a lot of content in there, but (especially beginners) one has to search for it. You can't simply find it.

That's why I wanted to have a new wiki for the NixOS community. And because I like git, I wanted the content to be stored in a git repository.

So I came up with the idea to recreate the NixOS wiki and start it from scratch. Of course, the content of the original wiki has to be migrated to the new wiki then, but this has to be done carefully and by hand to ensure that things are ordered and easy to find afterwards.

The requirements

The requirements where rather simple, but nevertheless important to me. As already said, I wanted to have the content version controlled with git. The templates and markups for other data should be version controlled as well, if possible. This way, the content (or whole wiki) can be distributed with git, hosted on github or similar hosting platforms and so on.

I wanted to be able to customize the style of the wiki completely and I wanted to be able to write snippets of markup which can be reused, such as a warning-alert template where you can pass custom text and get a red alert box in your wiki page. Pretty normal stuff for a wiki.

Syntax highlighting, TOC-generating, all these things should be integrated or available through plugins (or there should be the possibility to write such plugins).

So I searched for wiki software with git backends...

The state of git-backend-driven wiki software

The state of wiki software with git backend is bad. No, it is even worse. There are actually two projects I had a look at and one which is written in Perl (and I didn't have a look on this one, because Perl).

gitit

First of all, there is gitit. Gitit is a wonderful piece of Haskell software. It works great and is fast. But it has its issues:

  1. No Templates. Period.
  2. Content is checked in, but neither templates nor style information
  3. Haskell. So writing plugins – nah, not really.
  4. Just few plugins available

So it was pretty clear that gitit is not an option for me.

gollum

Gollum was the other alternative. Developed by github, ruby thing, sounds well, right?

But. There's a big but.

  1. No templates
  2. No plugins
  3. No custom styling or at least no documentation about it

It was clear to me: No option!

The solution

Well, the solution? Just write it yourself! And that's what I did. I started to work on a template for a wiki which is statically compiled with nanoc. Later I switched to jekyll.

Compiling the wiki to a static site has several advantages. First of all, hosting the site is cheap. A common web server can host thousands of pages without even noticing. Of course, you are also protected against hacking and all this stuff, as you do not have the problems dynamic websites have.

But these are common advantages of static compiled sites. An even bigger advantage is, that contributions to the wiki must pass a review-process of some kind. Of course, I will not grant push access to the repository to anyone and of course nobody gets access to merge pull requests, besides myself. I will protect myself against pushes to master as well, so each change to the wiki has to be reviewed. And that's what matters when it comes to quality: Changes must be reviewed.

Besides this big advantage, I do not have to care about updates (of the compilersoftware). I can do them locally and roll back if they fail. I do not have to keep track of spam bots, security updates, user account data, etc. etc. etc.

So here's the story how I wrote the template:

wiki.template

I started the project with nanoc, the static site compiler I love. The project is at version 4 these days and the compiler is really really good. It is flexible, scales well, fast and a joy to work with.

I just failed integrating foundation, the CSS framework I wanted to use. I played around with Jekyll a bit, but wasn't able to get Haml working. But at some point, foundation seemd to be more important than Haml, so I switched to Jekyll.

I also thought of the option to build the site with Jekyll directly from the github repository and build a github page with it, just because this way I can save money for hosting. I still think of that option, but as I use Jekyll with plugins I cannot build it on github directly. So I searched for tutorials on how to build it with travis and deploy my github page from travis. This is documented and a known as working.

Current state of wiki.template

To get my stuff working, I had to use some plugins. And these plugins basically work for me, but the code was either a mess or lacked features I wanted to have. So what did I do? Right, I forked them and send pull requests to the maintainers.

At this very point in time, I have three pending pull requests to these plugins, two of them just normal “cleanup codebase” PRs, one feature. I also opened issues for other features I do not necessarily need but would like to see implemented. I would implement them myself, but well... not enough time.

So what is the current state? Well, wiki.template is basically usable. I want to integrate some more features and it completely lacks of documentation on how to use it.

But these things will be done soon and I hope I can then create a fork of it to start my NixOS Wiki.

The NixOS Wiki

I already announced the NixOS Wiki fork (semi) officially on the NixOS mailinglist. Of course, as always in such communities, a discussion started on whether to do such a thing or not, which software to use and whatever. I don't care about this, I will simply do this and we will see whether it succeeds or not. Discussion all over the place helps nobody.

tags: #git #linux #nix #nixos #open source #programming #software #wiki

Imagine you have an idea for an awesome web application. Or an desktop program or even a library in your favourite programming language do make complicated things easy. You really want to implement it, maybe you already know that it will work really well, maybe you don't and you want to try whether you can make it work or not.

But how to start?

The first steps are easy. You make a new directory, maybe a directory structure. You create some files, such as a README.md or a LICENSE file. You create a MyGreatSoftware.MyFavouriteLanguage file and you open it in your favourite text editor or IDE.

But then you struggle and you don't know what to do first. Let's imagine you want to write a commandline application – do you start with the argument parsing part or do you add some backend abstraction in the first step? Do you build up a great framework around some functionality so you can use it more easily later on or do you implement functionality directly?

I had such problems, too. I started a project for a rather simple commandline application and I really didn't know where to start. It was a ruby project, so Imy initial steps where rather clear: I installed some dependencies I wanted to use, such as an option parsing library and a commandline output helper for pretty formatted output (colored things and so on). I created the directories lib and bin – and then the file lib/app.rb (where “app” is the name of the program.

And then I failed to continue because I didn't know what to implement first. So I ended up implementing the commandline parsing part and the backend abstractions at the same time (on different branches, of course) and it resulted in me deleting the project because things got complicated.

Then, I restarted the project and did something I've never done before: I started to do TDD and I started with the very first line of code.

Disclaimer: I'm not a TDD professionalist. I never had any training in TDD and I don't even know whether I did it right. But it's not the point whether you do TDD right or not here. The point is, you think about simple, neat pieces of code with a lot more focus. You try to imaging what explicit feature you want to have. For example your test says something like this:

If I pass an argument --update a File ~/.app_timestamp gets the current time is appended.

That's a really really compact thing and you can implement this in one single line of Ruby. And that's exactly my point. You start implementing things without building layers and layers of abstraction and losing yourself in the codebase you created yourself for not losing track of things.

I learned that writing tests and implementing just the very functionality that makes the test succeed helps me a damn lot to focus on the functionality I want to build rather than building layers and layers and afterwards having a kind of framework which does nothing (and is mostly even too complicated to use).

Of course, after implementing things you can clean up your codebase and refactor things, so the abstraction layers will be created at some point. But that's after the features have been implemented. And a damn great bonus: You have tests which are there to ensure you don't break your functionality by refactoring and making yourself happier with the codebase.

So that's what I call Test-Driven Project Initialization. You don't need to perform perfect TDD and stick to it all the time. You don't need to test every aspect of your functionality. The tests are there to keep you focused on the functionality, not to ensure there are no bugs. Of course, that's a neat side effect and you can continue and extend your test cases later on to find bugs. But for Test-Driven Project Initialization it is not the point to find bugs.

tags: #programming #software #testing

I just released the version 0.2 of the nixos-scripts. Read here what is included in this release.

44 patches are included in this release, merges not counted. There were some basic changes and a handful of features were added.

First, the switch command includes the hostname of your machine by default now, whereas the flag is now changed from adding your hostname to preventing the hostname in your tag.

The tags which are generated by switch are no longer annotated.

The switch command also has now an option to do all the things, but not nixos-rebuild at all.

The switch command can also tag the local nixpkgs clone now if the switch succeeded. The subcommand switch is default for the switch command now, you don't have to do nix-script switch -c switch, you can do nix-script switch.

The command for updating a package definition has now a flag for not checking out a new branch before updating the package. This can be used to mass-update packages on one branch. Also a flag for not checking out the base branch after a successful update of a package.

The user gets less output now, only output which can be relevant to the user is printed if the -v flag is passed to the nix-script command. The -d (debugging) flag prints all the information which can be used to debug the scripts now. But normal users don't need this flag.

All the scripts have support for the RC file now. You can put configuration in ~/.nix-script.rc now, so you don't have to pass things all the time. For examples, see the nixos-scripts repository at github.

Channel tools were integrated as well. The channel tools can be used to diff between channel generations, list the channel generations, checkout a specific channel generation and so on. More utilities will be included as time goes on, of course.

What is in the pipeline

Of course, the next release is already planned. v0.3 will land as soon as there are enough new features. In the pipeline is already:

  • A tool to update the nixos channel and generate tags for it in the configuration directory
  • A repo-reset command, which can be used to generate a branch in your nixpkgs which is based on the commit which your current nixos generation is build from
  • Container helpers. Everything you need to manage nixos-containers
  • diff-generations will be able to list the diff in your configuration
  • A tool for test-building a package based on a special branch

More things will be done behind the scenes: Verification that everything worked well, checks before commands are executed, on so on.

v0.4 will be a one-feature-release which will only include completion support. The PR on github for this feature exists already, but it will be developed until v0.3 is ready and if everything works, it will be integrated with a single merge commit.

So that's it for today. tags: #linux #nix #nixos #software #tools

This semester is at its end in about one and a half week. It was a good semester, even if mine is not over yet (I'm in my praxis semester right now and I have to work four weeks longer than the other students – but they have exams)! Since one year I'm the leader of the local LUG (Linux User Group) and I really like beeing it.

As far as I can tell I will be the leader for the next semester as well, but I guess one year is a great point to reflect and look back what I've done and what was awesome and maybe even what was not so good.

What was

So, in the last year, we had (during the semester) one talk each week (in alphabetical order here):

  • 31C3-Review
  • C++ – Arcane and rusty (2 parts)
  • Docker
  • Email (In)Security
  • FTP-Searchengine
  • Fish
  • Git-Intro
  • Go
  • Nix(OS) (my talk, actually)
  • Pimp my x86 (2x)
  • Presentation of a Bachelors Thesis
  • Presentation of a semester project (2x)
  • Racket
  • Regex Workshop
  • Reverse-engineering Workshop (2 parts)
  • Ruby on Rails 1
  • Ruby on Rails 2
  • Rust

Almost all talks were held by students, only one was help by an ex-student, who does one talk each semester for us. And they were awesome.

We also managed to go to the 31C3 as a group, which was an awesome experience and I'd really love it if we manage to go there this year as well. I also started a rewrite of our website, hopefully I will finish it this weekend, so I can do a talk about it next week, which is the last week where a talk is held in this semester (traditionally we do a “Pimp my x86” talk at the very end of the semester, where each student is allowed to talk for about 10 minutes, so it is lightning-talk-ish).

Plans

So next semester I really want to start organizing for the next Unix Friends and User Campus Kamp (Yes, the shortcut for this is UnFUCK). I really hope we can manage to get this event in the following semester, in the early months of 2016. It would be awesome to have a full weekend of nerdish talks and awesome people hanging around in our university, talking about Linux, programming languages and other foo which scratches my fields of interest.

And, of course, I hope we have some more awesome talks.

tags: #linux #open source #programming #social #software #tools

Yesterday I was at tübix in Tübingen, Germany. And it was awesome, thank you guys for making this event happening!

There were several really interesting talks for me, starting with, of course, a talk about NixOS, held by a NixOS guy I didn't knew by then. Joachim was there, too, and we had a nice chat about but not limited to NixOS! Thank you for beeing great, Joachim!

Afterwards I attended the talk about mutt and gpg, which was held by Sven, a really nice and inspiring guy who likes colors.

Afterwards I switched to the lightning talks, where I arrived just in time to see Ingo talking about Haskell. Oh my god, I really like this guy! He was really charged with energy when he started talking about Haskell. Awesome! I had a little chat with him afterwards about how to learn Haskell, as I still have some problems (not with Monads, as he assumed first, but) with getting the theory to do practical things for me. Thank you for the nice time, Ingo!

After some pizza, which was really tasty, I learned about pandoc from Kurt (no link here, sorry). And with this talk, I got to learn about a tool which I can use to write my thesis, so big thanks to Kurt for this! We also had some short chats where I learned even more about Pandoc and what it is able to do! Thanks a lot!

Then I went back to the room of the lightning talks, where several LUGs presented what they are doing and so on and I was forced to talk about UnFUCK without further preparation. I don't mind it, thank you all for listening and giving me the opportunity to talk about the Unix Friends and User Campus Kamp at my University!

Then I went to a talk about Network Steganography held by my former fellow student Florian. Thank you, too, Florian, I've learned another bunch of things, so: Success!

After that I saw some notes from Joachim on nice stuff from the net and a talk about functional programming in C++ which was more or less a selling talk for Haskell. I don't mind it, of course. It convinced me even more not to get an C++ programmer, because holy shit, this language sucks!

The exit talk was nice as well and afterwards we had some more time to socialize and talk with people and so on. But then we had to drive home again. It was an absolutely awesome day and I'd really love to be there again in 2016! Hopefully this was not the last tuebix!

tags: #social #software #linux #nixos

So I'm in my praxis semester at the moment, and I have to work with fastcgi++, a C++ library for fastcgi. And it is a nightmare! Here comes why...

So first, the codebase of fastcgi++ is a mess. Code snippets like

bool foo = someFunction();
if (foo) return true;
else return false;

are everywhere. You really don't want to read that kind of code. And yes, you have to actually read this code because there is no documentation on how to use the library! There is a wonderful doxygen-generated API documentation, but that does not help you because, yeah, you know the types and the interfaces now – lucky you! How to build a fastcgi module with them – figure it out by reading through the codebase!

Secondly, you are not allowed to define your custom accept() handler. You have to inherit from a Request class template and you have to implement the virtual bool response(void) = 0; method. Okay, no problem, I can do this! But then, you want to start accepting requests. You do this by creating an instance of a class called Manager:

Fastcgipp::Manager<MyRequestInheritedClass> man();
man.handler();

or something like this (this is no real code, I just want to demonstrate how it looks like). The manager accepts one connection (through many layers of abstraction, actually), creates an instance of your request class and calls response() on it.

Well, that's not a problem, is it? Well, it gets to a big problem if you want to be able to handle multiple requests at once, speaking of multithreading/concurrency here. It is a huge mess! My codebase exists of three classes, actually. A ThreadedRequest class, a BlockingQueue where requests get stored thread-safe and a RequestDispatcher which is a singleton which runs several worker threads. These worker threads take the requests out of the queue and process them if they can.

The ThreadedRequest class puts itself into the queue, which is a member of the RequestDispatcher singleton instance. The problem is not that it is unnecessarily complicated to build these 1-N multiplexing thing, but that the library provides an interface which enforces you to couple your classes realy tightly. And this is freaking bullshit.

So, finally: I'm building a wrapper lib around fastcgi++ to be able to handle requests in a concurrent way. And it sucks. But it works.

So, my conclusion is: Stay away from this bullshit library. And even from fastcgi if you can. Apache for example offers a way to write modules, so you can simply write your own module for apache if you need to – which is faster anyways!

If you have to use fastcgi, consider writing your own library!

tags: #c++ #linux #server #open source #programming #software

Firefox – The browser we all love (or hate?) and use almost every day (or never). But what the hell is this thing doing, actually? I just wondered why this thing eats the most resources on my device – while doing nothing.

So here it goes: I just synced my complete music, movie, library and image database. I do this using git-annex. If you don't know git-annex, you should really check it out! It's a tool for keeping things in git without actually checking it in. Sounds strange, but that's it! SO, git-annex is written in Haskell by Joeh Hess, the Debian guy you probably know. It is an awesome piece of software and does a great job for me. I sync several thousand of music pieces with it (something above 42,000, actually), several hundret GiB of movies, a collection of books (including audio-books) which is about 3,000 files and my private image database, which is about 7,000 files. And I do this without worrying that I might lose something. I know I always have at least 2 copies of the stuff, for music there are always 3 copies of everything. If I want to put something on my notebook (which, of course, does not have a 3TiB drive in it but only a 256 GiB SSD) I say “git annex, get XYZ for me” and it fetches it from somewhere – I don't have to check all my drives manually.

So, that's git-annex. git-annex does some heavyish stuff when keeping track of my data. It creates hashes of the data on and on. It does a lot of IO, of course. It propably does more things I don't even know of – I'm just a user. But what does this all have to do with firefox, you might ask? Well... here it goes.

So I was just syncing my music and the other stuff to two external drives. It synced about 2,5 TiB to each drive, so we're speaking of about 5 TiB data which was checksummed, synced via slow USB2.0, etc. It was fast, anyways. While syncing, I hacked a bit on one of my projects and thought about eggs with bacon, as I still had no breakfast this morning. And on my second screen, there was the login of my owncloud opened in Firefox. Nothing more, it was just the login screen (you might know that owncloud re-loads every now and then, which results in page rendering and all this stuff – but no, there was just the login). And you know what? Firefox used more resources than the heavy git-annex syncing processes together. What the hell does this thing? I mean... it just has to display this freaking web page. There is no javascript animation, no flash plugin (uuuh, I just said an ugly word) – I don't even have flash installed – and no re-rendering because of page reload or some shit like this. Just displaying. Why the hell does this thing need more resources than another process which actually does something?

So, well ... Maybe I'll never know. If you know why Firefox needs that much resources, you're welcome to tell me!

This rant ends here. tags: #git #haskell #software #tools #network

Yes, I use chromium. And I just installed the “cvim” plugin, to be able to navigate with vim bindings in my chromium instances. And it just feels like it should! Out of the box!

Awesome!

For my daily browsing, I use dwb (but I want to switch to luakit, I just didn't find the time to do the actual switch, yet). For some pages I use firefox and lately also started using chromium for it. And, of course, I wanted chromium to behave like vim. So I installed “cvim”. I first thought “Yeah, another vim emulatro plugin, could be nice... but well... it is not really a vim” – But after installing it, I just continued with my normal workflow. It just felt right, right from the beginning. I started navigating web pages without thinking about it.

Awesome! I just wanted to share this, so if you're looking for a vim plugin for chromium, just use cvim. It is awesome.

tags: #software #vim