Programming: Rust, Haskell, Qt and Python

-
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.
-
- Login or register to post comments
Printer-friendly version
- 1600 reads
PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
today's howtos
| Wine Developers Are Working On A New Linux Kernel Sync API To Succeed ESYNC/FSYNC
While there is the prior "ESYNC" and "FSYNC" work pursued by Wine for the Linux kernel, it appears Wine developers are back to the drawing board in coming up with a Linux kernel implementation for Wine synchronization primitives that will address all their needs and match the Windows behavior well.
CodeWeavers developer Zebediah Figura sent out a lengthy mailing list post on Sunday night outlining the current state and objectives of coming up with kernel-based Wine synchronization primitives. While the ESYNC/FSYNC patches were successful in improving the performance of many Windows games running on Linux, they are still working towards a more all encompassing solution and to match the behavior well for Windows and with optimal speed.
|
Linux Weekly Roundup: Wine 6.0, Fedora i3 Spin, and More
Here’s this week’s (ending Jan 17, 2021) roundup series, curated for you from the Linux and the open-source world on application updates, new releases, distribution updates, major news, and upcoming highlights. Have a look.
| Linux 5.11-rc4
Things continue to look fairly normal for this release: 5.11-rc4 is solidly average in size, and nothing particularly scary stands out. In the diff itself, the new ampere modesetting support shows up fairly clearly - it's one of those hardware enablement things that should be entirely invisible to people who don't have that hardware, but it does end up being about a fifth of the whole rc4 patch. If you ignore that oddity, the rest looks pretty normal, with random patches all over, and a lot of it being quite small. All the usual suspects: drivers (gpu, sound, rdma, md, networking..) arch updates (arm64, risc-v, x86), fiesystems (ext4, nfs, btrfs), core networking, documentation and tooling. And just random fixes. The appended shortlog gives the details as usual.. Linus ![]() |
Recent comments
13 min 44 sec ago
40 min ago
41 min 55 sec ago
5 hours 12 min ago
5 hours 15 min ago
11 hours 38 min ago
11 hours 48 min ago
23 hours 16 min ago
1 day 10 min ago
1 day 6 hours ago