Language Selection

English French German Italian Portuguese Spanish

Programming: Rust, Haskell, Qt and Python

Filed under
Development
  • Sonja Heinze: What this blog is about

    In order to ask for an Outreachy grant for a certain open-source project, applicants first have to contribute to that project for about a month. When choosing a project, I didn’t know any Rust. But the fact that Fractal is written in Rust was an important point in favor due to curiosity. But I also expected to have a hard time at the beginning. Fortunately, that wasn’t really the case. For those who haven’t used Rust, let me give two of the reasons why:

    If you just start coding, the compiler takes you by the hand giving you advice like “You have done X. You can’t do that because of Y. Did you maybe mean to do Z?”. I took those pieces of advice as an opportunity to dig into the rules I had violated. That’s definitely a possible way to get a first grip on Rust.

    Nevertheless, there are pretty good sources to learn the basics, for example, the Rust Book. Well, to be precise, there’s at least one (sorry, I’m a mathematician, can’t help it, I’ve only started reading that one so far). It’s not short, but it’s very fast to read and easy to understand. In my opinion, the only exception being the topics on lifetimes. But lifetimes can still be understood by other means.

  • Joey Hess: announcing the filepath-bytestring haskell library

    filepath-bytestring is a drop-in replacement for the standard haskell filepath library, that operates on RawFilePath rather than FilePath.

  • Parsing XML with Qt: Updates for Qt 6

    This module provides implementations for two different models for reading and writing XML files: Document Object Model (DOM) and Simple API for XML (SAX). With DOM model the full XML file is loaded in memory and represented as a tree, this allows easy access and manipulation of its nodes. DOM is typically used in applications where you don't care that much about memory. SAX, on the other hand, is an event based XML parser and doesn't load the whole XML document into memory. Instead it generates events for tokens while parsing, and it's up to the user to handle those events. The application has to implement the handler interfaces (fully, or partially by using QXmlDefaultHandler). A lot of people find this inconvenient as it forces them to structure their code around this model.

    Another problem is that the current implementation of SAX (and as a consequence DOM, since it's implemented using SAX) is not fully compliant with the XML standard. Considering these downsides, Qt does not recommend using SAX anymore, and the decision has been made to deprecate those classes starting from Qt 5.15.

  • pathlib and paths with arbitrary bytes

    The pathlib module was added to the standard library in Python 3.4, and is one of the many nice improvements that Python 3 has gained over the past decade. In three weeks, Python 3.5 will be the oldest version of Python that still receive security patches. This means that the presence of pathlib can soon be taken for granted on all Python installations, and the quest towards replacing os.path can begin for real.

    In this post I’ll have a look at how pathlib can be used to handle file names with arbitrary bytes, as this is valid on most file systems.

  • PyCoder’s Weekly: Issue #398 (Dec. 10, 2019)
  • Variables in Python

    If you want to write code that is more complex, then your program will need data that can change as program execution proceeds.

  • Creating an email service for my son’s childhood memories with Python

    This was very flexible as it allowed me to keep anything else I wanted in this document – and it was portable (to anyone who have access to some way of reading Word documents) – and accessible to non-technical people such as my son’s grandparents.

    After a while though, I wondered if I’d made the right decision: shouldn’t I have put it into some other format that could be accessed programmatically? After all, if I kept doing this for his entire childhood then I’d have a lot of interesting data in there…

    Well, it turns out that a Word table isn’t too awful a format to store this sort of data in – and you can access it fairly easily from Python.

    Once I realised this, I worked out what I wanted to create: a service that would email me every morning listing the things I’d put as diary entries for that day in previous years. I was modelling this very much on the Timehop app that does a similar thing with photographs, tweets and so on, so I called it julian_timehop.

  • Executing Shell Commands with Python

    Repetitive tasks are ripe for automation. It is common for developers and system administrators to automate routine tasks like health checks and file backups with shell scripts. However, as those tasks become more complex, shell scripts may become harder to maintain.

    Fortunately, we can use Python instead of shell scripts for automation. Python provides methods to run shell commands, giving us the same functionality of those shells scripts. Learning how to run shell commands in Python opens the door for us to automate computer tasks in a structured and scalable way.

    In this article, we will look at the various ways to execute shell commands in Python, and the ideal situation to use each method.

More in Tux Machines

KMyMoney 5.0.8 released

The KMyMoney development team today announces the immediate availability of version 5.0.8 of its open source Personal Finance Manager. Despite even more testing we understand that some bugs may have slipped past our best efforts. If you find one of them, please forgive us, and be sure to report it, either to the mailing list or on bugs.kde.org. Besides the software itself, the KMyMoney website was refurbished and now has a more modern clean look. Thanks to all who were involved in the process. Read more

Use this Twitter client for Linux to tweet from the terminal

Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. I love social networking and microblogging. It's quick, it's easy, and I can share my thoughts with the world really quickly. The drawback is, of course, that almost all the desktop options for non-Windows users are wrappers around the website. Twitter has a lot of clients, but what I really want is something lightweight, easy to use, and most importantly, attractive. Read more

Manjaro Linux Laptop with 10th Gen Intel Chips to Launch as “Dell XPS 13 Killer”

Manjaro Lead Project Developer Philip Müller confirmed in an interview with Forbes that a partnership with Tuxedo Computers will bring us several new Linux laptops powered by Intel’s 10th Generation Core i7 chips. In essence updated versions of the InfinityBook Pro 15 model, the Manjaro-powered laptops will boast a maximum of 64GB RAM and feature 2TB SSD storage thanks to a Samsung EVO Plus NVMe drive. Like several other Tuxedo Computers, all devices support aftermarket upgrades without losing warranty. Read more

MarsCat is a Bionic Cat Powered by Raspberry Pi 3 (Crowdfunding)

Elephant Robotics MarsCat is a robotic cat that tries to mimic the behavior of actual cats through artificial intelligence. It can have a life of its own roaming the house, and you can also interact with it as it will play with toys/teasers through its camera, and you can send voice command to ask it to walk, run, look at you, be quiet. etc… but the trick is that it may not always obey like a real cat, and its personality will evolve depending on how you interact with it. Beside being a bionic pet, MarsCat can also be used to teach/learn robotics as the company will release an open-source SDK allowing you to change the Python code running on the Raspberry Pi 3 board powering the cat, and access API’s to control the camera, microphone, touch sensors, as well as the 16 servos connected to a Microchip ATMega2560 MCU via two servo boards. Visual programming for the robot will be made possible through Scratch 3.0 program. Read more