F# vs Python development - Giraffe vs Django
Recently I have been playing around with building a web site using F# through the Giraffe library. This has been an enlightening experience. Most of my previous web development knowledge is from the Python world, specifically Django. In this blog I will try to compare the feel these two so different niches have.
F# vs Python
First things first - F# is a statically compiled functional language, which targets .NET framework. I’m using .NET5 specifically, although, of course, earlier versions have F# support as well. The language has been around for quite some time and is popular in some narrow circles. I find it unfortunate - it is a great programming tool and it enjoys from the rich .NET echo system. A fair comparison would be that F# occupies the same position in the .NET/CLI world vs C# as Scala in JVM vs vanilla Java.
Django and Wagtail + math formulas
Since moving my blog to Django and Wagtail, I have been adding new features to it on a regular basis. The most recent addition is the new ability to typeset mathematical equations and formulas. To be fair, all the heavy lifting is courtesy of the MathJax project. These guys did an amazing job - they implemented, in JavaScript, support for LaTeX syntax. Quite astonishing, if you ask me. Very easy to use, assuming you know LaTeX. Works in any modern browser, including on mobile, i.e. Android or iPhone. See for yourself:
Using python to analyse effects of COVID-19 on mortality in the UK
COVID-19 has been with us for almost a year as a news item. The reports indicate, that a lot of people died of the disease. Every lost life is a tragedy, of course. It is important to understand, how exactly the pandemic affected mortality in large populations. Unfortunately, the cause of death attribution to COVID-19 is not always accurate. Sometimes people are recorded as have died of the virus simply because they tested positive, even when they had none of very few real symptoms. On the other hand, some deaths from the infection might very well gone unnoticed. So today I will use some python code and publicly available figures to try and draw some conclusions from the data that we do have and can be reasonably confident about.
Binary self contained structured logs for fun and profit
The number of large software systems in the world is growing steadily. Old first generation solutions get improvements and grow more sophisticated. Completely new areas open up for automation. More systems, more lines of code. More complexity everywhere. Inevitably, more questions about the behaviour - why did it do that??? And, of course, more errors, from bugs in the systems themselves to malfunctioning of external dependencies and processes.
There are various tools that software developers can utilise in order to deal with the complexities of their systems. One of the core ones is known as logging. The sea captains of the old kept meticulous records of their voyages in the ship’s log, allowing those who followed to know more about the state of the currents and the winds, the lands and their natives. In similar fashion, software developers of today add their own log entries at various points of execution to indicate what the program is doing or planning to do, together with other relevant morsels of information. At some later point these records can be examined in order to learn what the system was doing at that particular time.
The age of LinkedIn annoyances
The world we live in is not perfect. Not everyone has enough food. Some people lack even good drinkable water. Lots of children go about without proper education, or any education at all for that matter. Some dudes can’t get their hands on that great Maserati they have been dreaming about all their lives. And only one thing seems to be available in abundance - online social networks!
Facebook, Instagram (owned by FB as well, by the way), Twitter, Reddit and so on. Most of them encourage people to generate as much content as possible, since this is how they attract users and make money by advertisement. And reselling user data, let’s not forget about it. The social networks don’t charge money from their user base, therefore the said users are actually the product.
Welcome to 2021
The year 2020 has been a hard one for many. COVID-19 was a surprise, although health experts made predictions for years regarding a future unknown virus. The restrictions, introduced by governments around the world in order to combat the disease, did as much damage to the humanity as the infection itself. We will continue to feel the consequences for years, if not decades to come, even if an end to the measures and an effective treatment/vaccine arrive in 2021.
Running multiple Django sites on the same server
What if you find yourself managing more than one Django-based web site at the same time in production? Do you have to deploy each one of them on a separate server? Or can you manage with just one, saving on hosting expenses? How will you go about the setup in this case, ensuring smooth running of these sites side by side.
For “real” production web site, with medium to heavy traffic, it is probably the best to have a separate server. Even more so, for busier sites you might very well have multiple servers in order to handle the workload. As they say, it is a good problem to have.
Best programming language for algo trading development
Electronic trading, also known as automated trading, algo/algorithmic trading is, quite simply, a process of automatic buying and selling of financial instruments. It can be fully or partially automated. In recent years electronic trading of various flavours became extremely popular. Large banks, hedge funds and other investment institutions are on one end of scale of users, while small day traders and other part time and amateur players can be found on the other. Almost any kind of instrument is available on one electronic platform or another. Traditional shares, options, futures, Forex, bonds, although for the latter the automated markets are not mature enough yet. Lately we also observe the explosive entrance of cryptocurrencies into this field.
Bootstrap 5 module for Django
Bootstrap is an HTML/CSS styling framework, originally developed by Twitter, and currently published in open source. While not the only player in that field, it remains a very popular choice for many web developers. It helps people with limited artistic abilities, such as yours truly, to create web sites that are reasonably easy on the eye. It provides many styles and utilities to make the visual layout of a web page consistent and user friendly.
Moving from Drupal to Django Wagtail
Close to 15 years I have been using Drupal for my personal web sites. Drupal is a flexible and configurable CMS (Content Management System) web framework, similar to Wordpress. It has been a relatively dependable working horse for my hosting needs - simple and not too flexible, but relatively robust and reliable. It was quite straightforward to bring up a new web site via it:
- Create a new MySQL database
- Create a config directory for the site
- Update the settings file
- Go through the setup wizard
- Configure more stuff in the admin interface
- Voila!
Unfortunately, there are a number of drawbacks to Drupal. I was sort of ignoring those for years, mainly because it “just kinda worked” for most of what I wanted it to do. I didn’t require any advanced configuration that would necessitate code changes, and the rest was relatively simple via the admin interface. However, in the recent year or two I got frustrated with the shortcomings of the framework on one hand, and on the other I decided I did want some more advanced customisation and control over the web sites.