I use Python at work and for private projects. I also aim to write tests for my code, especially recently. And as I usually don’t start from 100% code coverage (TDD is not my game), I at least want to know if the code I just wrote have full coverage.
Articles under this tag
I started looking at decentralised/federated tools some years ago, but other than Matrix I didn’t use any of them until recently. Then this February I joined the Fediverse (federated universe) by spinning up my own Mastodon instance. I’m not going to lie, this place is pure awesome. I follow only 53 people but unlike on Twitter or Facebook, I can’t just scroll through my timeline; I have to read the all. These 53 accounts are real persons over the Internet with meaningful posts. I could never find this on the noisy Twitter or Facebook timeline during the last 10 or so years.
I’m in a team who are developing a Flask-based web application, which uses
logging extensively. For a while now it spews out a lot of lines so the
need arose to index them in ElasticSearch, and more importantly, to search
through them for auditing purposes. This latter user story brought up one
more question: why don’t we categorize our log messages? I quickly came up
with an extended log format (
[auth] is the new category name):
I have recently messed up my Alembic migrations while modifying my SQLAlchemy models. To start with, I didn’t update the auto-generated migration files to name the indexes/foreign keys a name, so Alembic used its own naming scheme. This is not an actual problem until you have to modify columns that have such constraints. I have since fixed this problem, but first I had to find which column references what (I had no indexes other than primary key back then, so I could go with foreign keys only). Here is a query I put together, mostly using this article.
When creating multilingual software, be it on the web, mobile, or desktop, you will eventually fail to mark strings as translatable. I know, I know, we developers are superhuman and never do that, but somehow I stopped trusting myself recently, so I came up with an idea.
Today I needed a function to create a slug (an ASCII-only representation of a string). I went Googling a bit, and found an excellend Flask snippet. Problem is, it is designed for Python 2, so I came up with a Python 3 version.
Now that I write Python code for a living, I write a lot of functions, classes, and modules. What I still tend to forget, and also find tedious, is adding docstrings. Unlike many developers, writing documentation is not an enemy of mine, but it usually comes to my mind when I finish implementation. The procedure, roughly, is this:
I have recently found this article by Bozhidar Batsov on opening the current file as root. I barely use tramp for sudo access, but when I do, I almost never use root as the target user. So I decided to fix it for my needs.
Before I started using Vala (and sometimes even after that) I often needed to generate new classes based on GObject.
Although I have just started making it in C, I decided to move my Matrix GLib SDK to Vala. First to learn a new language, and second because it is much easier to write GObject based stuff with it.
I have recently started creating a GLib implementation of the Matrix.org API. For that, I have created a GObject interface, MatrixAPI, which has as many virtual functions as API calls (which is a lot, and expanding). This way I ended up with the following scenario.
I have recently bumped into this article. Naturally, I quickly calculated the FAIL metrics for all my projects (most of them are pretty high). To ease calculation, I made up a small page based on this list (although I have divided the points by 5; I really don’t understand why spot is using such big points if all of them can be divided by 5). Feel free to use it, and if you have any recommendations (point additions/removal, new categories, etc.), leave me a comment!
I have recently faced a problem, where I had a bunch of SVG files with a large amount of fraction numbers in the path definitions. These images were displayed in small size, so this amount of precision was irrelevant, and these numbers took almost half of my SVG images’ size. So I created an Elisp defun to round these numbers to 2 decimals:
In this post I said I will get through the GLib Makefiles to add an enum type to GLib in a more sophisticated way.
Few of you may know that I’m interested in astrology. About two months ago I have decided to create an astrologers’ software for the GNOME desktop. Since then, I have contacted Jean-André Santoni, who created a software called Astrognome some years ago. We exchanged some e-mails, and after several weeks of coding, I’m proud to present SWE-GLib 1.0.1. This is “just” a library which wraps around Swiss Ephemeris, creating a nice GLib-ish interface around it. See the project page and the built-in GTK-Doc document for more information.
Today I’ve realised that the name I gave to one of my Symfony 2 bundles should be something else. To rename a bundle, one must do four things (at least).
Just insert it in your database, feed them two Google coordinates, and you get
the distance in kilometres. If you happen to need it in miles, change the
12756.200 in the
RETURN row to
I have read several opinions about routing configuration in Symfony. I stayed with annotation based routing as it was convinient for me to see the URL right above the controller action. This was because by just checking the URL, I remembered the controlling code, as they always were fresh ones. Well, until today.
I have recently learned about
git rm --cached. It’s a very good tool, as it
removes a file from tracking, without removing your local copy of it. However,
be warned that if you use
git pull in another working copy, the file will be
removed from there! If you accidentally put the configuration of a production
project, and remove it on your dev machine, it can cause a lot of trouble ;)
I faced a problem in my GLib self-teaching
project, wMUD today. I wanted to
register a signal for a
GObject, whose handler should accept two
parameters for which I had to register a new
GEnum type in the
system. However, the documentation on this
(thanks for pointing out goes to hashem on
#gnome-hackers) is not… uhm…
obvious. Making the long story short, I have checked with the
GIO sources for
an example, and using that, I have created this small, working chunk:
If you use Fedora (like me), and can’t find the development manual pages for
printf(3) (like me), just
yum install man-pages (like me).
I have a development server, on which I have several Symfony 2.x projects under the same hostname in different directories. Now I’m facing a funny problem which is caused by that the cookies Symfony places for each of my projects have the same name.
A friend of mine asked me today how to become a web developer. It took me a while, but I made up a checklist. It’s short, but it’s enough for the first steps.
I’m writing a software for my company in PHP, using the Symfony 2 framework. I’ve finished all the work, created some sample data, it loaded perfectly. Now I put the whole thing into production and tried to upload the production data into it. Guess what… it didn’t load.
Gergely Polonkai is a systems engineer of a telco company, and also a freelancer self- and software developer.
He is learning about different IT subjects since the late 1990s. These include web development, application building, systems engineering, IT security and many others. He also dug his nose deeply into free software, dealing with different types of Linux and its applications, while also writing and contributing to some open source projects.
On this site he is writing posts about different stuff he faces during work (oh my, yet another IT solutions blog), hoping they can help others with their job, or just to get along with their brand new netbook that shipped with Linux.
“I believe one can only achieve success if they follow their own instincts and listen to, but not bend under others’ opinions. If you change your course just because someone says so, you are following their instincts, not yours.”