Hello and welcome to my little nock of the internet. Here I have my blog which mainly contain posts about tech, the outdoors, cooking, and some times mead brewing.

A bit of background information before you step into my world of crazy. I am Lars, a.k.a. looopTools, a Software Engineer living in East Jutland, Denmark. I have 10+ years of experience from industry mainly through student positions, but also as self-employed consultant, or full-time employee. I mainly work in low-level user space, high-level kernel space, and storage systems in general. Besides research and software development, I also love the outdoors and try to go out as often as possible (not enough at the moment) and I am an aspiring author currently working on a few different novels. I also dabble in being a more advance home cook and baker, which you may see some posts about. Finally I like the ancient art of brewing mead, a.k.a. honey wine, and experiment with different flavour combinations and ageing times.

I prefer Ruby over Python... sorry

19 September 2021

For some reason people tend to assume I prefer Python over all other languages since I am an academic researcher. This has a) always been weird to me and b) it is not true.

One of the main reasons people think I prefer Python is the quick turn around from idea to “product”. Which apparently is preferable if your are researcher, that is true but language such as Ruby, Crystal, Java, and C# offers this as well, in my opinion and there for Python is not “better” compared to these languages on that note.

The second big assumption is that because I am researcher I must be using numpy, pandas, matplotlib and Jypyter Notebook. Well fun fact, I use none of them. I use to be a heavy user of numpy, matplotlib, and Jupyter notebooks. But as I did less and less data analysis, numpy fell out of my tool box. Matplotlib got replaced by pgfplots, and finally I replaced Jupyter Notebook with Emacs’s Org-mode. The later may sound weird to some, but most of my stuff is in org-mode already and I could easily enough replicate the behaviour I need. Finally, I have never done complex enough data analysis that Pandas was ever on my radar as an every day tool, though it may be in the future.

But may main reason for moving away from the tools, was actually not the tools, they are awesome! My main issue was Python. I have worked at companies, such as Chocolate Cloud Aps and is currently working for a company, that does most of the work in Python. Both through such jobs and my academic journey, I have come to the conclusion “I don’t really like Python”

./Lars

My Experience Installing Fedora 34 Dell XPS

12 September 2021

I got a new work laptop which is a Dell XPS 15”, which replaces my old Dell XPS 15”. Now back in 2018 when I got my old work laptop installing Linux was a bot of a troubleshooting paradise or hell, depending on how you look at it. I tried to install Fedora (I believe) 31 and Ubuntu 18.04 Unity and Mate versions, and both sucked to install. Fedoras installer would not even start properly and both Ubuntu’s was just a cluster f… of errors during the install process and afterwards, even after installing proprietary drivers (FUCK YOU NVIDIA). My supervisor found a GitHub README describing in detail how to install Ubuntu Mate and switch to Gnome 3, which seemed to work. Which did work and was an okay work around, however a firmware update from Dell broke my system and I could not fix the issue. After much Googling I conclude that I needed to reinstall my system and since I like Fedora more than Ubuntu I decide to try this again. I found a guide with over eight steps I needed to follow, where of 3 was just to get the install to boot. Anyways I succeed and ran with Fedora 31, upgrade to 32, and last 33 without any major issues, except for one time breaking Ethernet but that was an easy fix.

Now fast forward to 2021 I needed a new laptop and let me just touch on this. I did not need a new laptop because the Dell XPS is crap and broke, I need a new laptop because I literally (due to my research) wore out the SSD in the machine and did not want to bored with even trying to replace it (I have seen those YouTube videos).

So I got the newest Dell XPS 15” and my first worry was the USB-C only ports and an SD card reader. But unlike Apple, Dell actually includes a USB-C to USB-A and HDMI convert (much appreciated Dell), now here I had a small worry, would the XPS let me boot from a USB-A stick through the converter? Well I created the USB and plugged it in BEHOLD IT booted no problem what so ever. Then my problems started… When I go to the part of the install where I should choose installation disk, there was no options. What the heck! A little bit of searching the internet and I remember that Dell disable AHCI and opt for Intel’s Raid thingy instead. Reboot the laptop into BIOS disable stupid Intel Raid and enable AHCI. BOOM! I could now choose my disk and installed Fedora 34 and it worked, right?

Well almost, I ran dnf check-update it lets you check if any updates are available and what they are. I was a bit worried because there was a kernel update and two firmware updates from Dell. However, I installed all system upgrades and the only thing that was a problem was the second Dell update, which somehow killed external keyboard inputs. But that was a quick fix release came two days later and while it was not fixed I rolled back the update.

Now one thing I had big trouble with last time was NVIDIA drivers (fuck you NVIDIA), but someone have been really nice to “fix” this on Fedora by creating an auto installer: https://copr.fedorainfracloud.org/coprs/t0xic0der/nvidia-auto-installer-for-fedora/ which makes the whole process super easy.

I forgot one thing and that was to disable secure boot as this block usage of the NVIDIA driver so I had to do that. So all in all compared to last time very easy.

I did run into one lite weird issue I had to install Open Broadcast Software and after doing that, somehow secure boot was re-enabled. I am not fully sure what happened there.

-Lars

Let me explain what I meant!!!

01 September 2021

In July I replied to a tweet by Scott Hanselman and where my reply was apparently offensive.

The tweet both part 1 and 2 is here:

Whiteboard programming has multiple benefits.
a) it helps gauge the communication skills of the applicant 
b) catch “fraudulent” devs who cannot code without autocomplete, intellisens, and so on 
c) (personal opinion) it exposes better what the applicant is thinking 1/2

2/2 because when people sit with a keyboard they seem to be more quite, 
where at the whiteboard words flow more freely

The main issue people had was the following “b) catch “fraudulent” devs who cannot code without autocomplete, intellisens, and so on”. There was a couple of issues

  • People apparently do not know what fraudulent mean
  • and thought I said that all who use intellisens and auto complete are not developers

In this post I would like to fully explained what I mean with b) to address the issues people clearly had with it. So first of, fraudulent does not mean a cheater (look it up people), it is synonym for one who is deceiving, i.e., some one who wants to give the impression that they are a developer but is not, in the case. NOW! The reason this is at all relevant for me, is because I have been part of hiring committees a couple of times, where an applicant could not even write a simple for loop on the white board. In one case it was so bad that I wrote the following on the whiteboard and asked the applicant to replace the blank spots with the appropriate tokens.


for (___ in ____):
 print(___)
 

But the applicant was unable to fill in the code, even though the applicants CV listed the last position as a software developer (for a fortune 500 company) working in Python for roughly five years. Therefore, to me an the other members of the hiring committee this applicant was a fraud. Sadly this is not the only time I have experienced this and therefore I am a firm believer in white board programming and its ability to expose “fraudulent programmers”.

Back to the fraudulent versus cheating, people thought I meant that people who are depended on auto complete and other intellisense tools are cheaters. I would like to emphasis here that it is okay to utilise intellisense tools, if they make you a better developer or improves your performance. However, I do believe that you should know the basics of the languages you use (not the none standard library libraries) to be able to write trivial programs and use the basic data structures without the need for intellisense. Now why do I think this? I believe this because I have seen and know developers who in, for instance, C# translates for-loops to LINQ expression which they are unable to read, or translates a function to a lambda expression even though they cannot read it. Why, you ask? The argument is (and I kid you not) and I quote: “It makes me look smarter to management”. Even though code well written in simple structures can be a) more effective and b) easy to maintain later.

[LaTeX Part 1] Advice for smart things to do in LaTeX

27 May 2021

Throughout most of my Academic career I have used LaTeX for everything and when I say everything I mean everything. I use it for papers, books, presentations, and more. In my opinion it is so much easier to use than Microsoft Word, LibreOffice Writer, and Apple Pages, although these have their benefits as well. In this post and maybe future post, I will cover some things I do to make my life in LaTeX even easier.

1. Use vector graphics for your Figures and Plots

When reviewing papers one thing I see often is that plots and figures are pixelated and in most cases this is due to authors not using vector graphics (I have been at fault for doing this myself). Therefore when you make your figures and plots use a tool that is able to generate vector graphic output. a) It allows you to scale the image as you please and b) you do not get the ugly pixelated pictures any more.

If the tool you use provide Embedded Post Script (EPS) as an output option, the you can use the epstodpdf package to automatically convert your EPS figures to PDFs without additional work. Sample code for this is shown below:

    \usepackage{graphicx}
    \usepackage{epstopdf}
    
    \begin{figure}
        \includegraphics[scale=.5]{PATH/figure.eps}
    \end{figure}

If you decide to go with Scalable Vector Graphics (SVG) instead you might run in to problems. There are native LaTeX solutions to handle SVG but none of them have provided me with a result I like. My recommendation here is to convert the SVG to EPS and then use epstopdf.

2. SVG names for colours

There exists a package for LaTeX called xcolor which provides definitions for different colours, allowing us to write colour names such as red, green, black, and so on. However, what many do not know is that there is an option to xcolor which also grants access to colours using their SVG names, these are often easier to “read” when printed in my experience. You can see the different SVG color names on page 38 and 39 of the xcolor documentation. In the documentation you will see that there are the options of dvipsnames and x11names as well. These two options are good to and can be used in tandem with svgnames but dvipsnames have colour definitions that clashes with svgnames definition. All three options are great, I just prefer svgnames.

Additionally, it is (in my experience) beneficial to provide the option to the document class as it propagates to other packages besides xcolor. To provide the option to xcolor the usepackage statement has to look as follows;

\usepackage[svgnames]{xcolor}

3. Keep one BibTex file

One thing I have been extremely annoyed with during my PhD in particular is that I have copied BibTex entries from one BibTex file to another, between different papers. To me this was not a good solution but the only one I really could find. However, some one made me a suggestion and I like it. Have a single BibTex file with all references you have EVER used and have it a git repository. Then when you have a new paper, add it as a submodule and push change to the repo when you add a new reference. This is something that I will start to do from now on.

4. Keep the BibTex file organised

Another element of BiTex files is that they often are left unstructured, which is super annoying if you want to navigate them. I suggest ordering them by category and put in small comments about what a give category is and stop using the doi or another id for the BibTex reference name, give the entry a good name easy to remember why it has the name (long names are not always bad!). I even know people who have a small description of each BibTex entry as a comment just above.

5. Get to know your compiler

Get to know the different parameters and options you can parse to your LaTeX compiler. Some times you will be surprised what the compile can do for you. As an example I use pdflatex and one option I constantly use is -jobname where I can set the name of output PDF.

6. Do what you can do in LaTeX, do it.

This may or may not be controversial. So, what do I mean, well if you can do something in LaTeX do it in LaTex do not use another tool. Again, what the hell am I talking about? Well I mean instead of using an external tool for making figures, the use TikZ or if you need to make a plot use pgfplots. Before you flip the table and rage quite HEAR ME OUT. Even though the initial learning curve for packages such as TikZ is step, it is time well spend. As you become more proficient with the package and start having your own little macro collection you will become more effective. Additionally, you will have more control over your stuff as the complete landscape of LaTeX comments are at your disposal.
So try to do it.

./Lars

[PostgreSQL] Select from list instead of tabel

20 April 2021

One of the things I love with SQL in general and not just PostgreSQL is the ability to say SELECT * FROM tbl WHERE column IN LIST, where the list is an input. But for a while, I have wanted to do the revers SELECT * FROM LIST WHERE LIST. Element IN (SELECT column FROM tbl) and I could not figure out how to do that. However, I could not find a good way for how to do this UNTIL NOW.

We have a table with a column called fingerprint, and we want to check if for each fingerprint in a list if the element is in the table tbl. Just for fun, let us say that the table fingerprints make up [1, 3, 5, 7] and the list of fingerprints we want to check with is [1, 2, 4, 5, 8] and we want to know what fingerprints from the list is in tbl, then we can formulate the query;

SELECT * FROM (values (1), (2), (4), (5), (8)) as v(fingerprint) 
    WHERE v.fingerprint IN (SELECT fingerprint FROM tbl)

This will give us the result [1, 5] and we can ask the inverse what elements of the list is not in tbl

SELECT * FROM (values (1), (2), (4), (5), (8)) as v(fingerprint) 
    WHERE v.fingerprint NOT IN (SELECT fingerprint FROM tbl)

For me, both of these queries are super powerful, and I will add the ability to express these queries QueryC++

./Lars