Open-source News

Facebook Developing THP Shrinker To Avoid Linux Memory Waste

Phoronix - Fri, 08/26/2022 - 17:17
Meta/Facebook engineers have announced their work on THP Shrinker as a way for Linux's Transparent Hugepages (THP) to be more efficient and avoiding memory waste by removing under-utilized transparent hugepages...

More ASUS ROG Laptop Improvements Queued Ahead Of Linux 6.1

Phoronix - Fri, 08/26/2022 - 17:11
Thanks to the work of independent developer Luke Jones and as part of his Asusctl Linux project, ASUS laptops continue seeing better feature support on Linux and with the v6.1 cycle kicking off in October are more ASUS ROG laptop enhancements that have been readied...

LibreOffice Working On New Gestures Support

Phoronix - Fri, 08/26/2022 - 17:06
While LibreOffice has supported some input gestures in the past like swiping and long presses with the GTK front-end as well as some Android and iOS specific additions, it looks like greater gesture support is on the way for this cross-platform, open-source office suite...

How I analyze my music directory with Groovy

opensource.com - Fri, 08/26/2022 - 15:00
How I analyze my music directory with Groovy Chris Hermansen Fri, 08/26/2022 - 03:00 1 reader likes this 1 reader likes this

Lately, I’ve been looking at how Groovy streamlines the slight clunkiness of Java. In this article, I begin a short series to demonstrate Groovy scripting by creating a tool to analyze my music directory.

In this article, I demonstrate how the groovy.File class extends and streamlines java.File and simplifies its use. This provides a framework for looking at the contents of a music folder to ensure that expected content (for example, a cover.jpg file) is in place. I use the JAudiotagger library to analyze the tags of any music files.

Install Java and Groovy

Groovy is based on Java and requires a Java installation. Both a recent and decent version of Java and Groovy might be in your Linux distribution's repositories. Groovy can also be installed directly from the Apache Foundation website. A nice alternative for Linux users is SDKMan, which can be used to get multiple versions of Java, Groovy, and many other related tools. For this article, I use SDK's releases of:

  • Java: version 11.0.12-open of OpenJDK 11
  • Groovy: version 3.0.8

More on Java What is enterprise Java programming? Red Hat build of OpenJDK Java cheat sheet Free online course: Developing cloud-native applications with microservices Fresh Java articles Music metadata

Lately, I've consolidated my music consumption options. I've settled on using the excellent open source Cantata music player, which is a front end for the open source MPD music player daemon. All my computers have their music stored in the /var/lib/mpd/music directory. In that music directory are artist subdirectories, and in each artist subdirectory are album sub-subdirectories containing the music files, a cover.jpg, and occasionally PDFs of the liner notes.

Almost all of my music files are in FLAC format, with a few in MP3 and maybe a small handful in OGG. One reason I chose the JAudiotagger library is because it handles the different tag formats transparently. Of course, JAudiotagger is open source!

So what's the point of looking at audio tags? In my experience, audio tags are extremely poorly managed. The word "careless" comes to mind. But that may be as much a recognition of my own pedantic tendencies as real problems in the tags themselves. In any case, this is a non-trivial problem that can be solved with the use of Groovy and JAudiotagger. It's not only applicable to music collections, though. Many other real-world problems include the need to descend a directory tree in a filesystem to do something with the contents found there.

Using the Groovy script

Here's the basic code required for this task. I've incorporated comments in the script that reflect the (relatively abbreviated) "comment notes" I typically leave for myself:

1 // Define the music libary directory 2 def musicLibraryDirName = '/var/lib/mpd/music' 3 // Print the CSV file header 4 println "artistDir|albumDir|contentFile" 5 // Iterate over each directory in the music libary directory 6 // These are assumed to be artist directories 7 new File(musicLibraryDirName).eachDir { artistDir -> 8 // Iterate over each directory in the artist directory 9 // These are assumed to be album directories 10 artistDir.eachDir { albumDir -> 11 // Iterate over each file in the album directory 12 // These are assumed to be content or related 13 // (cover.jpg, PDFs with liner notes etc) 14 albumDir.eachFile { contentFile -> 15 println "$artistDir.name|$albumDir.name|$contentFile.name" 16 } 17 } 18 }

As noted above, I'm using groovy.File to move around the directory tree. Specifically:

Line 7 creates a new groovy.File object and calls groovy.File.eachDir() on it, with the code between the { on line 7 and the closing } on line 18 being a groovy.Closure argument to eachDir().

What this means is that eachDir() executes that code for each subdirectory found in the directory. This is similar to a Java lambda (also called an "anonymous function"). The Groovy closure doesn't restrict access to the calling environment in the way lambda does (in recent versions of Groovy, you can use Java lambdas if you want to). As noted above, subdirectories within the music library directory are expected to be artist directories (for example, "Iron Butterfly" or "Giacomo Puccini") so the artistDir is the argument passed by eachDir() to the closure.

Line 10 calls eachDir() on each artistDir, with the code between the { on line 10 and the } on line 17 forming another closure which processes the albumDir.

Line 14, calls eachFile() on each albumDir, with the code between the { on line 14 and the } on line 16 forming the third-level closure that processes the contents of the album.

For the scope of this article, the only thing I need to do with each file is begin to build the table of information, which I'm creating as a bar-delimited CSV file that can be imported into LibreOffice or OnlyOffice, or any other spreadsheet. Right now, the code writes out the first three columns: artist directory name, album directory name, and content file name (also, line 2 writes out the CSV header line).

Running this on my Linux laptop produces the following output:

$ groovy TagAnalyzer.groovy | head
artistDir|albumDir|contentFile
Habib Koite & Bamada|Afriki|02 - Ntesse.flac
Habib Koite & Bamada|Afriki|08 - NTeri.flac
Habib Koite & Bamada|Afriki|01 - Namania.flac
Habib Koite & Bamada|Afriki|07 - Barra.flac
Habib Koite & Bamada|Afriki|playlist.m3u
Habib Koite & Bamada|Afriki|04 - Fimani.flac
Habib Koite & Bamada|Afriki|10 - Massake.flac
Habib Koite & Bamada|Afriki|11 - Titati.flac
Habib Koite & Bamada|Afriki|03 – Africa.flac
[...]
Richard Crandell|Spring Steel|04-Japanese Lullaby [Richard Crandell].flac
Richard Crandell|Spring Steel|Spring Steel.pdf
Richard Crandell|Spring Steel|03-Zen Dagger [Richard Crandell].flac
Richard Crandell|Spring Steel|cover.jpg
$

In terms of performance:

$ time groovy TagAnalyzer.groovy | wc -l
9870

real        0m1.482s
user        0m4.392s
sys        0m0.230s
$

Nice and quick. It processes nearly 10,000 files in a second and a half! Plenty fast enough for me. Respectable performance, compact and readable code—what's not to like?

In my next article, I crack open the JAudiotagger interface and look at the tags in each file.

To simplify Java's clunkiness, I made a Groovy tool to analyze my music directory.

Image by:

WOCinTech Chat. Modified by Opensource.com. CC BY-SA 4.0

Java Audio and music What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

My open source journey from user to contributor to CTO

opensource.com - Fri, 08/26/2022 - 15:00
My open source journey from user to contributor to CTO Jesse White Fri, 08/26/2022 - 03:00 1 reader likes this 1 reader likes this

When people ask me what I love most about open source, my answer is simple: It's the openness. With open source, the work that community developers and contributors do is in the public domain for all to see and benefit from. I couldn't love that philosophy more.

How many people can say that about the fruits of their labor? How many, perhaps 50 years from now, can look back and say, "Check out the code I wrote that day that hundreds/thousands/tens of thousands benefited from." I find that infinitely more exciting than working on software that's hidden from most of the world.

I'm fortunate that my job puts me in the middle of an interesting area where open source and enterprise meet. Today, I'm Chief Technology Officer of The OpenNMS Group, the company that maintains the OpenNMS project. OpenNMS is a leading open source network monitoring and management platform.

While my current role has me firmly rooted in open source, I started as a user and contributor.

In 2007, I got my first real tech job as a network analyst at Datavalet Technologies, a Montreal, Canada-based telecommunications service provider. Within five years, I expanded to a solutions architect role, where I was tasked with helping to select a network management solution for the organization. We chose OpenNMS, and it was through that experience that I realized the true power of open source.

While onboarding the platform, we identified some missing features that would help optimize our experience. A representative from The OpenNMS Group was on site to help us with the deployment and suggested I attend the community's upcoming DevJam to work with the core developers on building the capabilities that we needed.

During that DevJam, I quickly settled in alongside the team and community. We rolled up our sleeves and started coding to create the enhancements Datavalet needed. Within days, the additional features were ready. It was amazing and transformative—this experience really opened my eyes to the power of open source.

I left my job a year later to study math full-time at Concordia University. It was there that I once again had the opportunity to collaborate with The OpenNMS Group, this time on a project for that year's Google Summer of Code. In this annual program, participants aim to successfully complete open source software development projects.

Summer of Code turned out to be a career-changing experience for me—two of the organization's leaders attended our project demo, and a year later, The OpenNMS Group team asked me to come on board as a full-stack developer.

More open source career advice Open source cheat sheets Linux starter kit for developers 7 questions sysadmins should ask a potential employer before taking a job Resources for IT artchitects Cheat sheet: IT job interviews

I worked hard, quickly rose through the ranks, and was named CTO in 2015. I consider this a personal achievement and another validation of what makes the open source world so special—if you enjoy working with the community and love what you do, your contributions are quickly recognized.

The open source ethos also informed my evolution from individual contributor to CTO, where I now lead a product development organization of more than 50 people. The community is inherently egalitarian, and my experience working with community contributors has taught me to lead with context rather than control.

I've had an amazing open source ride, from user to contributor to an executive at an open source company. The open source approach goes beyond the tech, as the barriers to entry and growth often found in proprietary development environments can be overcome through collaboration, transparency, and community. For that reason, the possibilities are endless for anyone thinking about a career in open source. I'm proof of that.

We live in a time when people are deeply examining their lives and the impact they have on the world. Working in an open source company is especially rewarding because I can interact directly with and influence the user community. The typical guardrails between the end user and developer are broken down, and I can see exactly how my work can change someone's daily life or inspire someone to contribute to a project. Building community through a mutual love for a project creates connections that can last a lifetime.

I know this has all been true for me, and it's why I am so passionate about my work. I'm an open source geek to the core and proud of it.

The possibilities are endless for anyone thinking about a career in open source. Here's my story.

Image by:

opensource.com

Careers What to read next Our journey to open source during Google Summer of Code This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Modernization: Developing your code migration strategy

Red Hat News - Fri, 08/26/2022 - 12:00

This article is part of an ongoing series that has already covered quite a bit of ground, including:

Lutris 0.5.11 Released With Amazon Games Integration, Gamescope For NVIDIA R515+

Phoronix - Fri, 08/26/2022 - 03:45
Lutris as the open-source game manager that integrates with the likes of Steam, GOG, Humble Bundle, and other game collections and emulators is out with a new update...

Intel Arc Graphics Running On Fully Open-Source Linux Driver

Phoronix - Fri, 08/26/2022 - 03:17
Intel's GPUs from the consumer desktop Arc Graphics hardware to the Intel Data Center Flex GPU Series "Arctic Sound M" and forthcoming Xe HPC Ponte Vecchio are built around fully open-source drivers. A common misconception or confusion I've heard many times over the past number of months has been questioning whether Intel's discrete GPU driver support on Linux is open-source or is closed-source, etc. Well, it's fully open-source aside from the usual firmware caveat and running on Linux. Here is some initial commentary with running the Intel Arc Graphics A380 on Linux!

Readfile System Call Revised For Efficiently Reading Small Files

Phoronix - Fri, 08/26/2022 - 00:30
Brought up back in 2020 was the readfile system call for efficiently reading small files with the intention of it being simple for reading small files such as those via sysfs, procfs, and similar file-systems. The readfile patches were re-based yesterday against the current Linux 6.0 state, leaving hope that the new system call might finally be sent in for the next kernel cycle...

Pages