Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • Spreadsheet annoyance no. 3: quotes have priority

    In an earlier post I complained about spreadsheet programs: Excel, LibreOffice Calc and Gnumeric. All of them confuse non-dates with dates, and automatically interpret certain number strings with 2 colons as [h]:mm:ss. Grrr.

  • Building your own Network Monitor with PyShark – Linux Hint

    Many tools for network analysis have existed for quite some time. Under Linux, for example, these are Wireshark, tcpdump, nload, iftop, iptraf, nethogs, bmon, tcptrack as well as speedometer and ettercap. For a detailed description of them, you may have a look at Silver Moon’s comparison [1].

    So, why not use an existing tool, and write your own one, instead? Reasons I see are a better understanding of TCP/IP network protocols, learning how to code properly, or implementing just the specific feature you need for your use case because the existing tools do not give you what you actually need. Furthermore, speed and load improvements to your application/system can also play a role that motivates you to move more in this direction.

    In the wild, there exist quite several Python libraries for network processing and analysis. For low-level programming, the socket library [2] is the key. High-level protocol-based libraries are httplib, ftplib, imaplib, and smtplib. In order to monitor network ports and the packet stream competitive candidates, are python-nmap [3], dpkt [4], and PyShark [5] are used. For both monitoring and changing the packet stream, the scapy library [6] is widely in use.

    In this article, we will have a look at the PyShark library and monitor which packages arrive at a specific network interface. As you will see below, working with PyShark is straightforward. The documentation on the project website will help you for the first steps — with it, you will achieve a usable result very quickly. However, when it comes to the nitty-gritty, more knowledge is necessary.

    PyShark can do a lot more than it seems at first sight, and unfortunately, at the time of this writing, the existing documentation does not cover that in full. This makes it unnecessarily difficult and provides a good reason to look deeper under the bonnet.

  • Roles, h'uh, what are they good for? | Jesse Shy

    What is a role? Put simply, roles are a form of code reuse. Often, the term shared behavior is used. Roles are said to be consumed and the methods ( including attribute accessors ) are flattened into the consuming class.

    One of the major benefits of roles is they attempt to solve the diamond problem encountered in multi-inheritance by requiring developers to resolve name collisions manually that arise in multi-inheritance. Don't be fooled however, roles are a form of multi-inheritance.

    I often see roles being used in ways they shouldn’t be. Let’s look at the mis-use of roles, then see an example of shared behavior.

    I’m using that word inheritance a lot for a reason, one of the two ways I see roles most often misused is to hide an inheritance nightmare.

    "Look ma, no multi-inheritance support, no problem. I’ll just throw stuff in roles and glum them on wherever I really want to use inheritance. It all sounds fancy, but I am just lumping stuff into a class cause I don’t really understand OO principals."

  • What Is a Software Developer?

    Software developers are highly sought-after tech professionals, and the demand for their skills is continually increasing. In this Life in Tech article, we’ll provide a general look at the various duties and requirements associated with the role of software developer.

    Let’s start with a basic description before getting into the nuances and specifics. Briefly, then, software developers conceive, design, and build computer programs, says ComputerScience.org. To accomplish this, they identify user needs, write and test new software, and maintain and improve it as needed. Software developers occupy crucial roles in a variety of industries, including tech, entertainment, manufacturing, finance, and government.

  • Steinar H. Gunderson: How others program

    How do others program? I realized today that I've never actually seen it; in more than 30 years of coding, I've never really watched someone else write nontrivial code over a long period of time. I only see people's finished patches—and I know that the patches I send out for review sure doesn't look much like the code I initially wrote. (There are exceptions for small bugfixes and the likes, of course.)

  • Sensible integer scale for Gonum Plot

    Over the years, I found myself multiple times using Gonum Plot. I do find it as a very good and easy to use plotting tool for Go.

    The problem I found myself, over and over, dealing with is the tickers scale. If you know before-hand the values that can be expected to be created by the application, it is very straightforward, but the majority of times, this is not the case. I often find myself creating a plotting application on data that track events that have not yet happened and cannot predict their range.

    To solve the issue, I create a package that has a struct that implements the Ticker interface and provides tickers that are usually sensible. Since this struct only works for integer scales, I called it sit, which stands for “Sensible Int Ticks”.

  • Learn JavaScript by writing a guessing game | Opensource.com

    It's pretty safe to say that most of the modern web would not exist without JavaScript. It's one of the three standard web technologies (along with HTML and CSS) and allows anyone to create much of the interactive, dynamic content we have come to expect in our experiences with the World Wide Web. From frameworks like React to data visualization libraries like D3, it's hard to imagine the web without it.

    There's a lot to learn, and a great way to begin learning this popular language is by writing a simple application to become familiar with some concepts. Recently, some Opensource.com correspondents have written about how to learn their favorite language by writing a simple guessing game, so that's a great place to start!

  • Getting your 3D ready for Qt 6

    As was previously discussed, since the 6.0.0 release of Qt, Qt 3D no longer ships as a pre-compiled module. If you need to use it on your projects, try out the new features, or just see your existing application is ready for the next chapter of Qt’s life, you need to compile Qt 3D from source.

    In order to do this, you can do it the traditional way ([cq]make ...; make; make install) or use the Conan-based system that is being pioneered with the latest version of the MaintenanceTool.

  • Qt Open-Source Downloads Temporarily Offline Due To Severe Hardware Failure

    Several readers have expressed concerned that Qt open-source downloads have disappeared but The Qt Company has now commented it's only a temporary issue due to a "severe hardware failure" in the cloud.

    Qt's open-source online installer and offline packages are not currently working for the open-source options but the commercial downloads are working. While that may raise concerns given Qt's increasing commercial focus, The Qt Company posted to their blog that this interruption around open-source package downloads is due to a reported major hardware problem at their cloud provider.

  • Efficient custom shapes in QtQuick with Rust

    Fortunally, the Qt API provides multiple ways to implement custom shapes, that depending on the needs might be enough.

    There is the Canvas API using the same API as the canvas API on the web but in QML. It’s easy to use but very slow and I wouldn’t recommend it.

    Instead of the Canvas API, from the QML side, there is the QtQuick Shapes module. This module allows creating more complex shapes directly from the QML with a straightforward declarative API. In many cases, this is good enough for the application developer but this module doesn’t offer a public C++ API.

    If you need more controls, using C++ will be required to implement custom QQuickItem. Unfortunately drawing on the GPU using QQuickItem is more complex than the QPainter API. You can’t just use commands like drawRect, but will need to convert all your shapes in triangles first. This involves a lot of maths like it can be seen in the example from the official documentation or from the KDAB tutorial (Efficient custom shapes in Qt Quick).

    A QPainer way is also available with QQuickPaintedItem, but it is slow because it renders your shape in a textured rectangle in the Scene Graph.

  • Changes to the Rustdoc team

    Recently, there have been a lot of improvements in rustdoc. It was possible thanks to our new contributors. In light of these recent contributions, a few changes were made in the rustdoc team.

  • Rustdoc performance improvements

    @jyn514 noticed a while ago that most of the work in Rustdoc is duplicated: there are actually three different abstract syntax trees (ASTs)! One for doctree, one for clean, and one is the original HIR used by the compiler. Rustdoc was spending quite a lot of time converting between them. Most of the speed improvements have come from getting rid of parts of the AST altogether.

  • Why and How to Use Optional in Java |

    The Optional object type in Java was introduced with version 8 of Java. It is used when we want to express that a value might not be known (yet) or it’s not applicable at this moment. Before Java 8 developers might have been tempted to return a null value in this case.

  • GraalVM 21.0 Released With Experimental JVM On Truffle - Phoronix

    Oracle on Tuesday released GraalVM 21.0 as the latest version of their Java VM/JDK that also supports other languages and modes of execution.

    One of the notable additions with GraalVM 21.0 is supporting Java on Truffle, as an example JVM implementation using the Truffle interpreter. GraalVM's Truffle framework is an open-source library for writing programming language interpreters. With Java on Truffle, it's of the same nature as the likes of JavaScript, Ruby, Python, and R within the GraalVM ecosystem. Java on Truffle allows for improved isolation from the host JVM, run Java bytecode in a separate context from the JVM, running in the context of a native image but with dynamically loaded bytecode allowed, and other Truffle framework features. More details about the Java on Truffle implementation via the GraalVM manual.

More in Tux Machines

Games: Koi Farm, Vintage Story, and Valheim

  • Koi Farm is a simple relaxing chill-out experience about raising fish

    Koi Farm released recently and it's quite a little gem. It's a small game though, all about raising Koi with an "infinite number" of patterns you can create by cross-breeding all the different colours and you end up with lots of different mutations as you go along. You can pick them up, drop them between a big display pool and a smaller breeding pool and eventually let them go to swim on with their lives. On top of that, you can also turn them into special cards to stick in your book and progress through it.

  • Survival game Vintage Story gets an official mod database, improved Wayland support

    Out for your next survival game that isn't Valheim? Do give Vintage Story a go, which on the surface looks like Minecraft but it's so much more interesting and far deeper mechanically. While this is mainly a stability update for the previous release, which was pretty huge, some fun bits have been put in. One of the big additions is an official Mod Database, for players to upload and download from. Eventually, they said, it will integrate with the game client to "blur the line on what is vanilla content and what is modded content" (if you want to use it, that is). The rest of the update is mostly small tweaks and fixes but their support of Linux continues shining. For Linux players, you should hopefully see improved support for running the game on Wayland. They upgraded the version of OpenTK used along with some extra Wayland fixes that should improve mouse support there. See the full changelog here. [...] A community member is also hosting a server for Linux fans...

  • The tenth Norse world sure is busy as Valheim hits 5 million sold | GamingOnLinux

    Fully expected of course, Valheim continues pulling in masses of new users with the announcement that it's now sold 5 million copies over the first month. What is it? For those living under a rock: a brutal exploration and survival game for 1-10 players, set in a procedurally-generated purgatory inspired by Viking culture. Across this time more than 15 thousand years have been spent playing Valheim based on a combined player time count, over 35 million hours of Valheim was watched on Twitch, it continues rising up as one of the best reviewed games on Steam (#39) and this is all still from a five-person team. The actual player-count seems to have now settled though from the 502,387 peak 10 days ago to it seeing a more regular player count of around 350,000.

today's howtos

  • Openstack RDO && KVM Hypervisor: Install intellij-idea on Fedora 33 via COPR Repository

    Procedure below works quite smoothly and eliminates any issues during similar manual setup which is available as well via `sudo dnf install openjfs`. First enable COPR Repository and perform install $ sudo dnf copr enable lkiesow/intellij-idea-community$ sudo dnf install intellij-idea-community During the very first run you will be given an option to install the most recent Oracle's JDK ( second snapshot )

  • How to Install a Specific Kernel Version in CentOS

    The Linux Kernel is the underlying core of all GNU/Linux distributions. The kernel, GNU standard programs, and additional programs and GUI on top of them make up a GNU/Linux operating system. CentOS is one such popular GNU/Linux operating system that comes under the RedHat family of Linux distributions. As the Linux kernel grows in size, more and more resources are spent in its development; mainly to incorporate support for newer hardware, amongst other things. However, there can be scenarios when an upgraded Kernel version is giving certain errors on a piece of hardware. There can be cases also when you want to test an older version of the kernel for compatibility purposes.

  • Tips for using tmux | Enable Sysadmin

    Prior to Red Hat Enterprise Linux 8, the screen command was included. In version 8, the decision was made to deprecate screen and use tmux instead. tmux is a terminal multiplexer which means that you’re able to have a process running, disconnect from the system, and then reconnect at a later time and from a different computer so that you can continue working in that process. An easy way to demonstrate this is to SSH to a remote system, start tmux, and then from inside of that, start a ping command to a remote system, disconnect from tmux, resume tmux, and you’ll see that the ping is still going.

  • Tips for using screen | Enable Sysadmin

    What happens when you’re connected to a remote system, using a long-running program, and then the connection drops? The odds are, at a minimum, you’re going to have to restart the program, and in a worst-case scenario, you’ll have data corruption. To help get around this, some programs run in a window shell on the system.

  • How to Install the YouTube Add-on in Kodi - LinuxBabe

    In a previous tutorial, we explained how you can install LibreELEC on a Raspberry Pi to set up a home media server and replace your smart TV OS. This tutorial is going to show you how to install the YouTube add-on and set up YouTube API in Kodi.

  • How to enable LUKS disk encryption with keyfile on Linux - nixCraft

    We can easily add a key file to LUKS disk encryption on Linux when running the cryptsetup command. A key file is used as the passphrase to unlock an encrypted volume. The passphrase allows Linux users to open encrypted disks utilizing a keyboard or over an ssh-based session.

  • How to use Bootable USB drive in VMware Player to install OS

    If you want to boot your Virtual Machine running on VMware Workstation Player using a bootable USB drive for the installation of Windows 10/8/7 or Linux (Ubuntu, Linux Mint, CentOS, etc.) operating system. Then here are the simple steps to follow… Whether it is Vmware Workstation Player or VirtualBox when it comes to installing an operating system for VM, most of the time we use ISO files. However, imagine you already have a bootable USB drive of some OS but not the ISO file for the same and you want to install it for a Virtual machine created in VMware. What will you do? The answer is straightforward; we will use the option of VMware to boot from Physical Disk, and here i.e. a USB disk drive attached to PC.

  • How to Dual Boot Ubuntu Linux and Windows 10 with BitLocker Encryption

    Laptops and desktops with Windows 10 Pro version come with BitLocker encryption enabled by default.

openSUSE Leap 15.3 Released for Public Beta Testing, Download Now

openSUSE Leap is openSUSE’s regular release that follows the development cycle of the SUSE Linux Enterprise operating system. As such, openSUSE Leap 15.3 beta comes with packages from the SUSE Linux Enterprise (SLE) 15 Service Pack 3 (SP3) release, including the Linux 5.3 kernel. This kernel version is maintained by SUSE and introduces support for AMD Navi GPUs, new IPv4 addresses, RISC-V improvements, and compatibility with the Intel SST (Speed Select Technology) used in Intel Xeon servers. Read more

openSUSE Leap 15.3 Reaches Beta Build Phase

openSUSE Leap has entered into the beta release phase today for its 15.3 minor version. This openSUSE Leap 15.3 version is a solidified release that focuses more on the building of the distribution rather than refreshing the distribution?s packages, but there are some significant changes to the distribution. Many of the packages will remain the same as those in openSUSE Leap 15.2 with a bit of hardware enablement and security backports. An updated version of glibc brings some Power10 support and the Xfce desktop users will have the new 4.16 version. The distribution also gains adds s390x architecture. The biggest change for this release is how Leap is built and its relationship with SUSE Linux Enterprise. Leap transitioned to a new way of building openSUSE Leap releases in the fall of 2020 through a prototype project called Jump. The Jump prototype was used as a proof of concept, but no longer exists; it did prove to work at building a distribution and bringing the code streams of both openSUSE Leap and SLE closer together. The proof of concept was implemented for building the release of openSUSE Leap 15.3 as seen in the beta release today. Building Leap on top of binary packages from SLE, which was part of the rationale for the Jump prototype, allows for easy development on a community release to be put into production on an enterprise release should the need arise. Read more Also: openSUSE Leap 15.3 Beta Begins - Phoronix