Open-source News

Intel ME-Enabled System Needed For Updating Arc Graphics GSC Firmware

Phoronix - Fri, 11/04/2022 - 18:25
Stemming from the recent discussion of Intel's open-source Linux driver for Arc Graphics not yet running on POWER, another rather interesting support caveat was also raised. It turns out updating the GSC firmware for Arc Graphics hardware currently requires the Intel Management Engine (ME) functionality, which basically limits the graphics card firmware updating in turn to systems with Intel CPUs...

Intel Granite Rapids Support Submitted For The GCC Compiler

Phoronix - Fri, 11/04/2022 - 18:08
While Xeon Scalable "Sapphire Rapids" will finally see its formal launch in January as recently revealed by Intel, it will then be succeeded down the road by Emerald Rapids. Succeeding Emerald Rapids will then be Granite Rapids to which there is now an initial GCC compiler enablement patch posted. Granite Rapids won't be out until at least well into 2024 while fortunately they have already begun their compiler enablement work to ensure that new CPU instructions and other capabilities are in place well ahead of launch...

LLVM's BOLT Flipped On By Default For Linux x86/AArch64 Test Releases

Phoronix - Fri, 11/04/2022 - 17:43
BOLT as the Facebook/Meta-developed tech for optimizing binaries in the name of greater performance by optimizing the code layout was merged to mainline LLVM at the start of the year. Now as we approach the end of the year BOLT is getting a bit of a promotion with being flipped on by default for Linux x86_64 and AArch64 test releases...

Microsoft Issues Big CBL-Mariner 2.0 Linux Distribution Update

Phoronix - Fri, 11/04/2022 - 17:25
Microsoft has issued a big update to their in-house Linux distribution, CBL-Mariner, with a few new packages introduced as well as various updates to existing packages and other OS modifications...

How to iterate over tables in Lua

opensource.com - Fri, 11/04/2022 - 15:00
How to iterate over tables in Lua Seth Kenlon Fri, 11/04/2022 - 03:00

In the Lua programming language, an array is called a table. A table is used in Lua to store data. If you're storing a lot of data in a structured way, it's useful to know your options for retrieving that data when you need it.

Programming and development Red Hat Developers Blog Programming cheat sheets Try for free: Red Hat Learning Subscription eBook: An introduction to programming with Bash Bash shell scripting cheat sheet eBook: Modernizing Enterprise Java An open source developer's guide to building applications Creating a table in Lua

To create a table in Lua, you instantiate the table with an arbitrary name:

mytable = {}

There are different ways you can structure your data in a table. You could fill it with values, essentially creating a list (called a list in some languages):

mytable = { 'zombie', 'apocalypse' }

Or you could create an associated array (called a map or dictionary in some languages). You can add arbitrary keys to the table using dot notation. You can also add a value to that key the same way you add a value to a variable:

myarray = {}
myarray.baz = 'happy'
myarray.qux = 'halloween'

You can add verification with the assert() function:

assert(myarray.baz == 'happy', 'unexpected value in myarray.baz')
assert(myarray.qux == 'halloween', 'unexpected value in myarray.qux')

You now have two tables: a list-style mytable and an associative array-style myarray.

Iterating over a table with pairs

Lua's pairs() function extracts key and value pairs from a table.

print('pairs of myarray:')

for k,v in pairs(myarray) do
  print(k,v)
end

Here's the output:

pairs of myarray:
baz     happy
qux     halloween

If there are no keys in a table, Lua uses an index. For instance, the mytable table contains the values zombie and apocalypse. It contains no keys, but Lua can improvise:

print('pairs of mytable:')

for k,v in pairs(mytable) do
  print(k,v)
end

Here's the output:

1   zombie
2   apocalypseIterating over a table with ipairs

To account for the fact that tables without keys are common, Lua also provides the ipairs function. This function extracts the index and the value:

print('ipairs of mytable:')

for i,v in ipairs(mytable) do
  print(i,v)
end

The output is, in this case, the same as the output of pairs:

1   zombie
2   apocalypse

However, watch what happens when you add a key and value pair to mytable:

mytable.surprise = 'this value has a key'

print('ipairs of mytable:')

for i,v in ipairs(mytable) do
  print(i,v)
end

Lua ignores the key and value because ipairs retrieves only indexed entries:

1   zombie
2   apocalypse

The key and value pair, however, have been stored in the table:

print('pairs of mytable:')

for k,v in ipairs(mytable) do
  print(k,v)
end

The output:

1          zombie
2          apocalypse
surprise   this value has a keyRetrieving arbitrary values

You don't have to iterate over a table to get data out of it. You can call arbitrary data by either index or key:

print('call by index:')
print(mytable[2])
print(mytable[1])
print(myarray[2])
print(myarray[1])

print('call by key:')
print(myarray['qux'])
print(myarray['baz'])
print(mytable['surprise'])

The output:

call by index:
apocalypse
zombie
nil
nil

call by key:
halloween
happy
this value has a keyData structures

Sometimes using a Lua table makes a lot more sense than trying to keep track of dozens of individual variables. Once you understand how to structure and retrieve data in a language, you're empowered to generate complex data in an organized and safe way.

Create structure that makes it easier to find stored data.

Image by:

Opensource.com

Programming 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.

Best RDP (Remote Desktop) Clients for Linux

Tecmint - Fri, 11/04/2022 - 14:26
The post Best RDP (Remote Desktop) Clients for Linux first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

Brief: In this tutorial, we look at some of the best RDP clients for Linux. Sometimes, you might be required to remotely access your PC in order to carry out a few tasks. You

The post Best RDP (Remote Desktop) Clients for Linux first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Modenization: Strategies for modernizing existing code

Red Hat News - Fri, 11/04/2022 - 08:00
<p><span><span><span><span><span><span>So far </span></span></span></span></span></span><a href="https://www.redhat.com/en/authors/luke-shannon"><span><span><span><span><span><span><span><span>in this series</span></span></span>&amp

AMD Announces Radeon RX 7900 XTX / RX 7900 XT Graphics Cards - Linux Driver Support Expectations

Phoronix - Fri, 11/04/2022 - 04:45
As was expected, AMD's Lisa Su just announced the Radeon RX 7000 series "RDNA3" graphics cards. AMD continues to back their graphics processors by fully open-source Linux driver support and Linux benchmarks will come on Phoronix for launch. Here are the initial details on the announced Radeon RX 7900 XT and Radeon RX 7900 XTX graphics cards.

Deferred Enabling Of ACPI CPUFreq Boost Support Can Help Boot Times For Large Servers

Phoronix - Fri, 11/04/2022 - 01:30
With CPU core counts continuing to rise, we've seen various optimization efforts in recent times to help with the boot speed of getting large servers online. One of the latest discoveries can trim down the boot speed by up to 30 seconds for some large servers and what appears to be a next-generation AMD EPYC "Genoa" platform...

Pages