Patrick Müller writing nonsense since 2019

Back into photography

I have been out of photography for a few years now. There may be something on the story behind that later but suffice it to say that I am back. So, in the spirit of this very fact this Post is a bit of a “first impressions”-piece of getting started with digital photography. Back when I was doing more photography I almost only used analogue cameras, for once I did not have the money to buy the digital once I liked and they just felt too much like computers with imaging sensors with all their menus. I recently got started into the Fujifilm X system with an X-T10. I chose the X-T10 over say an X-Pro 2 because I wanted to get into this spending less on my first camera body and rather buy a few good lenses.

First impressions: the camera

I can only say I am really stunned by how great this system is. There are lots of people who can tell you about the technical ins and outs, so I’ll let that aside. What really struck me as great is that these are cameras that have all the dials and knobs I like and don’t force me to go into the menu all the time. In fact, with turning the view-mode to “EVF only” I guess I’m close to my ideal of having a classical camera with a sensor instead of film. Also, in the past whenever I borrowed a DSLR from somebody those (at least the affordable once) felt somewhat plasticky to me, not so Fujis mirrorless cameras.

The lenses: 23mm f2 WR and 50mm f2 WR

As an initial setup I got two the so-called Fujicrons and they are amazing. Are there faster lenses about there? Sure. Do these have a great balance between size, price and speed? I certainly think so. One criterium for me in choosing a system was that it had to be one with aperture rings on the lenses (at least most of them) as I really don’t like to set that on the camera, and in this respect the Fuji lenses just feel like classical lenses. The only minor complaint is that you can freely turn the focus ring without end as I think it is focus by wire – I’d have liked it to work the old-fashioned way. But hey, that’s where my complaints stop.
Words in closing

As you can tell I’m still in the honeymoon period with this system and we’ll see how it and my feelings towards develop. For now I’ll just leave you with the promise of future photography related content.

Changelog, of sorts

There have been a few changes with what I am doing and with this site and now I am finally getting around to writing down at least some of it.

This site is moving backwards

It really is: I have reactivated the old version based on kirby after rolling with Ghost for quite a while. Most of this has to do with the simple fact that I am mainly a php-developer and don't know a lot about world of wiritng node.js applications - or hosting them for that matter. I want however to port over most of the content from there.

On upgrading all of this to the latest version of kirby I did discover a few bugs with my old code, something I hope to iron out over the next few weeks so that this may then be a more permanent version of this site.

Laravel

I have been doing some private working and experimenting with laravel for a few years now and recently it has also become a big part of my daily job to build laravel applications. Of course on thing that's really great about this is that I get to discover a lot about the laravel ecosystem, something that going forward I'd like to try and share here from time to time. Even if it is just so that I don't forget how certain things work or where to look them up.

Collections in PHP

This article was ported over from the old blog

A while ago I stumbled on Adam Wathans book "Refactoring to Collections" and a lot of people saying this is a really great book. Of course I didn't get it at the time: collections were a thing I had never given a lot of thought. Ok, now that some time had passed I read another blogpost by Christoph Rumpel on the topic and eventually commited to find out what's up with this thing that people think is so great. Long story short: I researched a bit, got the book and then I realized some hours had passed. Not bad for a programming-book...

What are Collections?

This was the question I started out with since I head never had much contact with the concept of a collection. To put it short: a collection is an object that implements all the interactions you can have with a normal array but also provides a lot of additional functionallity. Hence the common description as "arrays in steroids".
Since I am a Laravel user anyways and find the things Taylor writes very intuitive to use, I am using his Collection class even when working outside Laravel and also for these examples. So let's start with the most basic thing: How does one create a collection?
There is a nice helper function that returns a Collection Object, so you can use it like this: $collection = collect(['item 1', 'item 2']); Just pass an array, no matter if it's as simple as this one or some large complicated multidimensional construct:

<?php

$items = [
    'bread' => ['amount' => 2, 'price' => 4.99],
    'butter' => ['amount' => 1, 'price' => 6.99],
];

$shoppingList = collect($items);

If you now want to access this collection, you can do this as with any regular array if you want, e.g. $shoppingList['bread']['price'], but of course that's not why we are doing this.

What can I do with a collection?

That was of course the question I asked myself annd upon reading Adams book and having a look through Taylors documentation for the Collection class I have to say that the additional features compared to normal arrays are really quite a great thing to have.
For example, let's find out what we would have to pay for our shopping list:

<?php

$items = [
    'bread' => ['amount' => 2, 'price' => 4.99],
    'butter' => ['amount' => 1, 'price' => 6.99],
];

$price = collect($items)->map(function($item) {
    return $item['amount'] * $item['price'];
})->sum();

What this is doing is to create a collection of items (collect()), map each of them to the value for the money spent on that item and then return the sum of those values. Let's have a look at what I would have done before:

<?php

$items = [
    'bread' => ['amount' => 2, 'price' => 4.99],
    'butter' => ['amount' => 1, 'price' => 6.99],
];

$price = 0;

foreach($items as $item) {  
    $price += $item['price'] * $item['price'];
};

So yes: there are more then enough reasons not to want to go back. And this is a rather simplistic example, so the way I see it right now the collection would shine even more in a more complex situation where we would normally have nested loops and can get rid of those.

  • The new code looks way more readable then the "old" code.
  • No need to manually deal with implementation details like having a variable thats counted up.
  • No writing loops. We write enough of those as it is.

So long story short: I will continue to get on peoples nerves with this and most likely show some more interesting example after really having worked with this a while.

Remodelling the local network

This article was ported over from the old blog and will soon receive a follow-up

My current network setup is a bit of a mess, so I thought I'd share a little of what I have running right now and how I want to reconfigure all of this to make it a little more usefull for a wide array of tasks. As an aside: since I am currently not living on my own I have to be somewhat mindful of not disturbing the network for anybody else - though in this case that shoudl not be an issue.

My Setup

I am right now fielding a wide collection of different hardware:

  • On a 16-Port TP-Link Switch
  • Whitebox Workstation (Xeon E3-1230 V3, 16gb RAM)
  • Supermicro 1U Server with an Intel Atom CPU
  • HP DL380 G6 (Two E5-Somethingrather, 72gb RAM)
  • Raspberry Pi 3 for testing purposes

On a Linksys 8-Port Switch in the basement

  • HP Microserver G9 with Freenas
  • Raspberry Pi 3 with PiHole

The stuff in the basement is open to everyone in the house and is not something I want to make any changes to. The Raspberry Pi there provides reliable DHCP and DNS for everybode and the storage is also a well proven and reliable system. While I'd like to put some additional RAM into the microserver I'd say I'm ok on that front for now. What needs to change is the stuff around my desk - my workstation/gaming-system, the rest has proven somewhat impractical.

Proposed changes

The issues with the current setup are a) that it's all rackmounted gear (and I dont have a rack) and b) that it's rather more on the loud side for stuff thats in a room where people are living and working. While I might be able to move the DL380 in the basement (and it really is a nice system that I like a lot) doing that would be quite the hassle. What it comes down to is, that I need less power then this mashine offers but I need it in a package that allows me to run the system 24/7. Also the small 1U system is not useful right now since its original purpose never materialized, so this one is going to ebay. This leaves me with the switch as the sole rackmountable-formfactor component - and while it's working great I'd rather have something web-managed. So, yeah: ebay once more ...
After some back and forth I remebered this article https://tinkertry.com/supermicro-superserver-sys-e200-8d-and-sys-e300-pictures and the videos that came with it as a possible way to solve my server-issues. While the e300 is a bit more expensive that a used DL380, it might well be a mashine that could stick with me for quite a long time. Also some of the price would be offset be pushing things to ebay. I might start a little smaller with the ram and just up this later, after all we are not talking about production-systems with a lot of users - so that bit of downtime someday won't be a problem. Also storage won't be an issue, after all it's only meant to run a hypervisor and mount storage via NFS or iSCSI - so a small SSD or something like that may well be ok for now.
Of course that leaves the networking part: after reading a lot of good things about them I thought I'd give Ubuquity a try with one of their 8-port UniFi switches. 8 ports will be more then enough and this is a nice way of having a look at their products.
So there you have it: another project to keep reporting on. While we are at it, I also want to bring the blog bag over from ghost to kirby - yeah, I need 48h days ....

Deployment, let's put things on the internet

Since I've recently played arount with this a little more, let's talk about how to deploy a website.

FTP & SFTP - the classics

At least for me these two get the bonus of being what I've always used. Everyone who can handle a filemanager will most likely be able to handle any FTP client.

  • Version control: You can get that, at least kinda. Just don't overwrite you files all the time, instead rename the old file with a version number, the date or whatever suits your needs. It may not be fany but here you go, it works.
  • Available everywhere: you don't need any software that anyone might consider excotic and more or less ever webhosting company out there gives you (S)FTP.

While I still use this a lot has its issues: large numbers of (small) files take really long to upload and with the pseudo 'version control' I've outlined above you really have to be careful not to miss uploading a file after having renamed the original when you are updating something.

git for deployment

Something that has become popular in recent years is to deploy websites via git.

If you dont have the option to deploy to your host via git something like deploybot may be for you: they are serving as a bridge between git and different other methods of deployments and allow to run your buildscripts on their end. And that is something I want to play around with in the future and maybe move towards it a little more. However this depends on what kind of use I will eventually make of all the buildtools available there.

What this site uses: deployment with git on frotrabbit

This site is hosted on fortrabbit who provide me with a very nice way of git-based deployment, all I have to do is to push to a remote repository and they will run any buildscripts I define and then deploy to production. I have acutally never used their service before but have looked at it several times over the last year or so, looking for a project to try it out.

git push -u fr master

That is actually how easy it is to deplay a site in this way, after that you just watch the script running and everything is taken care of.