In Loving Memory of Developers
Once upon a not-so-distant time, before instant answers and endless abstractions, there lived developers, who survived on documentation, patience, and the courage to think before they typed.
Once upon a not-so-distant time, before instant answers and endless abstractions, there lived developers, who survived on documentation, patience, and the courage to think before they typed.
After initial disbelief, failed trials, and frustration, I finally started to appreciate having a little assistant on my side in the form of AI. While one-off simple questions were usually fine when using AI chat, I had never attempted a bigger project before.
Now, I am working on a new programming language, partially written by AI. I feel more like an architect and tester, sometimes taking on the role of a senior engineer, while the AI is like a restless and enthusiastic young developer. For this, I am using ChatGPT Plus.
The official wiki seems to not work nicely describing Sublime setup. Here are some steps to get similar experience to default installation with Notepad++ when working with Sublime Text, and run Raylib examples without issues.
In November 2023, I defended PhD thesis after long years of struggling to finish it. I am proud of this achievement, but it took me longer than expected. Let’s summarise this journey.
This year, I attended the EuroPython conference in Prague for three days. Let me share some thoughts afterwards.
Time has come to move out of Hugo 0.34 to something never (0.128.0). Hugo is expanding quickly and unfortunately in backward incompatible way. Plus this site is already since some time on Github Actions not Wercker..
Example of Azure Pipeline yaml file to configure pytest with code coverage and Nexus IQ / SonarQube scanners for Python application.
It is so funny, I always start looking at alternatives just to come back to a “one-true-fits-all” solution. Welcome back Good Old/New Gnome with Ubuntu 22.04-23.04.
Time to celebrate, today Ubuntu 23.04 is officially available, so time for a blog entry. For Ubuntu Mate users, not much news, except for some cosmetics and AI-generated wallpapers. I am writing this while using Ubuntu Mate 22.04. Some issues I had on my Thinkpad T470 with dual-boot with Windows 10. In the end, some complaints about Linux in general.
The mighty and powerful f-strings. Well, they are only a sugar syntax on string.format, but whatever. Here I will look at one of the usage scenarios that you should not commit - taking format string from the user. Well, I had to do it in my project, so…
When we have time-expensive functionality in our fixtures, it is good to know when they are invoked and run. Although this should be intuitive, let’s test on a simple example.
I was working as an outsourced engineer for Big Corporation, or I could say I was in the “shadow workforce”. And as the initial challenge dust disappeared, I was flying on remaining knowledge, but up to a point. There is a moment when you need to cut yourself out of your comfort zone. And I know that it is really difficult for people, especially after crossing the magic “three-year” point.
In one of the recent episode of Python podcast, Toby Macey was interviewing Luciano Ramalho. I have a lot of respect for this developer as for me it is one of the last true “Pythonista’s” left in the world. During one hour he talks about his Python beginnings, writing “Fluent Python” book, and his view about new Python features. I recommend listening to the whole podcast, but here is a summary of his opinions about Python evolution.
WSGI - Web Server Gateway Interface. This is Python standard interface between web server software and web applications. The specification was created in 2003 and described in PEP 333, further updated in 2010 in PEP 3333, with backward compatibility to prepare for Python 3 changes.
It is funny that when one decides to refresh the basics of Python, watches the first video about types and is already stuck for an hour testing edge cases and wondering why? Let’s explore the bool function with empty containers.
A week ago I passed Google ACE exam, here I post a personal summary and some tips on how to pass it.
Let’s connect MySQL database installed in Ubuntu (WSL2) with Pycharm Professional on Windows.
Recently I have started to dive into game programming a bit more. Coming from Python with Pyglet, my current choice is Godot game engine. I created a simple text-based game menu in both to see what is easier for someone without any prior experience.
Premature optimization - the root of all evil. Or something like: we think that in the future we will need this and that feature, though in reality, in most cases, we do not.
Sometimes when you come to the project, you see EAV database design, and some developers hate it, some do not have an opinion, and the rest do not care. Majority of database designers and developers would tell you that you should use a typical relational model, with all its tooling available out of the box, instead of handcrafting everything on your own. I agree on that, but is there a case when EAV is good?
Recently I dived into design patterns a little bit, to refresh a rusty knowledge. It is something we are using in Python daily, however not often realizing that. And I like reading those religious debates between programmers. One of them is the usage of Singleton in Python. Let’s see what is Pythonistas take on this beloved pattern.
The first paragraph from Python documentation about concurrency titled “Concurrent Execution” mentions a few phrases like, CPU bound, IO bound, event-driven cooperative multitasking or preemptive multitasking. In this intro post to concurrency, let’s clarify these definitions.
In pytest we can parametrize in three different ways:
This article presents a few examples of how to use parametrization in pytest using @pytest.mark.parametrize. The article starts from the basic tests, and end with the usage of ids and indirect.
The famous PEP 572, and one of the reasons Guido Van Rossum - Python BDFL - retired from decision process (stepped down as BDFL). It is called “Assignment Expressions”, and is about adding new syntax := that will allow assign to variables within an expression.
In Python, we have positional and keywords arguments. With the introduction of new syntax in PEP 570, we can specify positional-only parameters in Python function definitions. This feature is especially useful for library developers, to ensure correct usage of an API. Let’s discuss what this PEP is all about.
PEP (Python Enhancement Proposal) are describing new features, processes or other guidelines and information. They are written primarily for core CPython or other implementation developers. But actually, they are fun and interesting read for a regular developer as well. It is because the authors are really polishing the documents (standards are rigorous) and in addition to documentation, we can get to know proposed or already implemented features. Anyway, fun to read. One disadvantage, PEPs are sometimes long.
Coming from for Java world we could ask what the best way for method overloading in Python language is. There are many ways to achieve that; some are even considered an anti-patterns. Let’s through a few of them and choose the best.
Task: Define the function that takes two parameters (dictionaries as default). Without modifying original dictionaries return the new one that includes all key and value pairs however, if key repeats itself, then add values
a = {'a': 5, 'b': 1, 'c': -1, 'd': 1}
b = {'a': 1, 'b': 5, 'c': 1, 'e': 1}
solution = {'a': 6, 'b': 6, 'c': 0, 'd': 1, 'e': 1}
Task: merge and sort two ordered lists
list_a = [8, 10, 12, 44, 63, 66]
list_b = [2, 3, 20, 106, 144]
solution = [2, 3, 8, 10, 12, 20, 44, 63, 66, 106, 144]
In my spare time, I am creating small Django web application, designed for language schools administration. This month I decided to deploy it to the server finally. Quick research gave me a few possibilities: home setup with raspberry pi (kind of free), pythonanywhere.com (free/paid), heroku.com (free/paid), digitalocean.com (paid), linode.com (paid). I have chosen DigitalOcean, and here are is why.
Santa Claus Rally is a seasonal increase of stock value in financial markets that usually occurs in last weeks of December. It is caused by, as always too optimistic, feelings of traders. This year expected rally did not start very positively (special greetings for crypto holders), and I can almost hear cries of many people.. ;)
Well, at least in software development things are not changing in such a drastic way. A good example of this is the Django web framework. Because Django is mature and stable, even having an increased release cycle (currently feature release is every eight months and LTS every two years), things are progressing rather slowly.
This morning for the interviewed person we had a short algorithmic task. Given n = 5, create a list of multiplied integers:
[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]
My little tour on Python Web Shops is over for now. It has been an excellent chance to see what is going on in the town. I have been applying mainly for a web developer position. Below is a list of few interview questions I have got. I will answer the most interesting or ones that require more in-depth research in the next articles.
As software developers, we have a very comfortable life because usually, the recruiters are calling to us, and not otherwise. Not always the talks are intelligent and sometimes are just a waste of time. Usually, it is not the fault of recruiters, because it is easy to get lost in the myriads of technology buzzwords and misinterpret them. Occasionally they are just not experienced enough to distinguish junior from a senior candidate.
Sometimes, however, the developers need to put more work in having a well presented professional side of our personality, and worse, update it often. Apparently, this is not our strongest side, an excellent solution would be to put ourselves in the hands of the professional agency. Some still will choose the harder way, well…
I did “Learn Python the Hard Way”
Python 3.5 brought us 4-100 times faster OrderedDict thanks to its implementation in C, before was written in Python. Python 3.6 improved a standard library dictionary, by making it use more compact representation. Now dictionary could use 20% to 25% less memory compared to Python 3.5, and the order of items was kept but as suggested it was only an implementation detail and should not be used officially (backwards compatibility). Well, in Python 3.7 it has been approved.
Which one should we use now? Standard dict or OrderedDict ?
I have just finished Bandit wargame from overthewire. Twenty-six levels packed with mini quizzes aimed at beginner Linux/security enthusiasts. First thirteen levels can be solved by using simple Linux commands with the goal of finding password hidden or encrypted in some file. Then it becomes interesting because we start to play with bits of networking knowledge like ssh, netcat, telnet etc. And last five are about cron jobs and writing bash scripts. I totally recommend this game.
I have had a chance to solve Codility demo test. It is available for free, and you can try it unlimited times. While I do not believe that such tests correlate to typical real-world programming tasks, they are often used as a first interview filter by some companies. Here I show a few Python variations for the solution.
One month of fighting with Mate I returned to “classic Ubuntu” with Unity desktop. And it just works. That’s it.
Update (December 2018): Ubuntu 18.04 is running fine as well. Even my bluetooth headphones ;)
Update: After recent update laptop freezes at boot!
I was looking for a new laptop for some time now, and specifically, I wanted to try ThinkPad series, based on sound reviews. Electronic equipment in Poland has a higher price compared to for example the USA, but I bought on a sale a T470 without Windows preinstalled for 1140$ (3800 PLN on 26 Jan 2018). The usual price for this model was around 5000 PLN. Anyway, I was going to install Ubuntu, with choices between Lubuntu (my long-time favourite on all virtual machines) and Ubuntu Mate (more pretty but not so heavy as default Unity or currently Gnome 3).
After three years of using Sublime Text 3, more than one year with PyCharm (Community at home and Professional at work) should I switch to Wing IDE? It has some of the best features from previous editors. Time to compare them.
Can git be used as automatic deploment tool? Some say that as for mvp it is enough. Others give quite good explanations how to do it, see gitolite.com/deploy.
Update: Similar setup but for CircleCI 2.0 is HERE
Deploying to CircleCI as easy as creating yaml file (sometimes you even do not need it as Circle will automatically recognize structure and behavior). But usually it is better to setup at least basic configuration. The problem begins with more complicated functionality and CI documentation is minimal, or to say ‘very hacker friendly’.
My problem was how to use build-in PostgreSQL database with Python application. This is quick tip how I solved it.
The easiest solution how to publish with Hugo to Github Pages is to have two separate repositories, one with blog source files and second with html files. Simple.
We can push files from both repositories manually or can do better. Push just source content and leave the rest for automatic deployment.
Update: Use Wercker. It is better.
While trying to make this little space in the web finally working, I set up dozens of different static site generators (Jekyll, Pelican, Nikola, Lektor, Sculpin..). I was even thinking about writing my own for some time. I tried wordpress and blogspot. But finally arrived at Hugo and it make my day much better.