Open-source News

LoongArch Enables PCI & Other Features For Linux 6.0

Phoronix - Fri, 08/12/2022 - 17:26
While support for the loongArch Chinese CPU architecture was merged in Linux 5.19, it wasn't actually enough to yield a booting system due to some driver code not yet being finished and ready for merging in time. LoongArch was allowed to merge that preliminary code in v5.19 so the Glibc support could land and now for Linux 6.0 more of the CPU port is ready to hit the kernel...

Writing project documentation in HTML

opensource.com - Fri, 08/12/2022 - 15:00
Writing project documentation in HTML Jim Hall Fri, 08/12/2022 - 03:00 Register or Login to like Register or Login to like

Documentation is an important part of any technical project. Good documentation tells the end user how to run the program, how to use it, or how to compile it. For many projects, plain text documentation is the standard. After all, every system can display plain text files.

However, plain text is limiting. Plain text files lack formatting elements like italics text, bold text, and titles. To add these elements, we can leverage HTML. HyperText Markup Language (HTML) is the markup language used in all web browsers. And with a little extra effort, you can use HTML to write project documentation that can be read by everyone.

HTML uses a series of tags enclosed in angle brackets to control how different parts of a document should be displayed. These tags define elements in an HTML document, such as document headings, paragraphs, italics text, bold text, and other kinds of text. Almost every tag comes in a pair: an opening tag, like

to start a paragraph, and a closing tag to end the element, such as

to end a paragraph. When using these tags, remember this rule: if you open a tag, you need to close it. Not closing a tag properly can result in the web browser incorrectly.

Some tags define a block within the HTML document, while others are inline. For more information about block and inline elements, read my other article about a gentle introduction to HTML.

Start an empty document

Begin by creating a boilerplate empty HTML document. Every HTML document should provide a document type declaration. Use the single tag on the first line of the HTML file to define an HTML document. The HTML standard also requires that pages wrap the document text in two block elements: to define the HTML document, and to define the body text. While HTML doesn't require indenting each new code block, but I add it anyway so you can see that is actually "inside" the block:


<html>
  <body>
 
  </body>
</html>

HTML documents also need a block before the that provides extra information called metadata about the page. The only required metadata is the title of the document, defined by the element. An empty document might look like this:


<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
 
  </body>
</html>Add the text

Let's exercise some HTML knowledge by adapting an existing plain text "Readme" file to HTML. For this example, I'm using part of the documentation about how to play an open source board game, called Simple Senet:

HOW TO PLAY SIMPLE SENET

The game will automatically "throw" the throwing sticks for you, and
display the results in the lower-right corner of the screen.

If the "throw" is zero, then you lose your turn.

When it's your turn, the game will automatically select your first
piece on the board. You may or may not be able to make a move with
this piece, so select your piece to move, and hit Space (or Enter) to
move it. You can select using several different methods:

-  Up/down/left/right to navigate to a specific square.

-  Plus (+) or minus (-) to navigate "left" and "right" on the
   board. Note that this will automatically follow the "backwards S"
   shape of the board.

-  Tab to select your next piece on the board.

To quit the game at any time, press Q (uppercase Q) or hit Esc, and
the game will prompt if you want to forfeit the game.

You win if you move all of your pieces off the board before your
opponent. It takes a combination of luck and strategy!

Start by adding this Readme text into your empty HTML file. The main content of an HTML page is the , so that's where you put the text:


<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    HOW TO PLAY SIMPLE SENET
   
    The game will automatically "throw" the throwing sticks for you, and
    display the results in the lower-right corner of the screen.
   
    If the "throw" is zero, then you lose your turn.
   
    When it's your turn, the game will automatically select your first
    piece on the board. You may or may not be able to make a move with
    this piece, so select your piece to move, and hit Space (or Enter) to
    move it. You can select using several different methods:
   
    - Up/down/left/right to navigate to a specific square.
   
    - Plus (+) or minus (-) to navigate "left" and "right" on the
      board. Note that this will automatically follow the "backwards S"
      shape of the board.
   
    - Tab to select your next piece on the board.
   
    To quit the game at any time, press Q (uppercase Q) or hit Esc, and
    the game will prompt if you want to forfeit the game.
   
    You win if you move all of your pieces off the board before your
    opponent. It takes a combination of luck and strategy!
  </body>
</html>

Without further changes, this HTML document looks completely wrong when you view it in a web browser. That's because HTML, like most markup systems, collects words from the input file and fills paragraphs in the output. Because you have not yet added other markup, a web browser displays the text in a single paragraph:

Image by:

(Jim Hall, CC BY-SA 4.0)

Body paragraphs

Your first step in updating this Readme file to HTML is to mark every paragraph so the web browser can display it properly. The tag to define a paragraph is

. While not everything in this file is actually a paragraph, start by wrapping everything in

and

tags:


<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>HOW TO PLAY SIMPLE SENET</p>
   
    <p>The game will automatically "throw" the throwing sticks for you, and
    display the results in the lower-right corner of the screen.</p>
   
    <p>If the "throw" is zero, then you lose your turn.</p>
   
    <p>When it's your turn, the game will automatically select your first
    piece on the board. You may or may not be able to make a move with
    this piece, so select your piece to move, and hit Space (or Enter) to
    move it. You can select using several different methods:</p>
   
    <p>- Up/down/left/right to navigate to a specific square.</p>
   
    <p>- Plus (+) or minus (-) to navigate "left" and "right" on the
         board. Note that this will automatically follow the "backwards S"
         shape of the board.</p>
   
    <p>- Tab to select your next piece on the board.</p>
   
    <p>To quit the game at any time, press Q (uppercase Q) or hit Esc, and
    the game will prompt if you want to forfeit the game.</p>
   
    <p>You win if you move all of your pieces off the board before your
    opponent. It takes a combination of luck and strategy!</p>
  </body>
</html>

This makes the Readme look more like a document you want to read. When you view the new document in a web browser, every paragraph starts on a new line, with some extra space above and below. The paragraph is the most common example of a block element.

Image by:

(Jim Hall, CC BY-SA 4.0)

More great content Free online course: RHEL technical overview Learn advanced Linux commands Download cheat sheets Find an open source alternative Explore open source resources Headings and subheadings

The first line in your content is your document's title, so you should make this into a heading. HTML provides six levels of headings, from to . In most documents, you might use to define the title of the document, and for major subsections. Make this change in your sample Readme document. Use the name of the program ("Simple Senet") as the main section title, and "How to Play" as a subsection in the document.

Note that in this example, I've also updated the in the document metadata to use the same title as the heading. This doesn't actually change how browsers display the document, but it is a good practice to use:


<html>
  <head>
    <title>Simple Senet</title>
  </head>
  <body>
    <h1>Simple Senet</h1>
    <h2>How to Play</h2>
    ...
  </body>
</html>

By adding these section headings, you've made the document easier to read:

Image by:

(Jim Hall, CC BY-SA 4.0)

Ordered and unordered lists

Your document includes a list of different ways to navigate the board game. Because this document started out as a plain text file, each item in the list starts with a hyphen. But you can use HTML to define these three paragraphs as list items.

HTML supports two kinds of lists: ordered and unordered lists. An ordered list

    is a numbered series, which you might use to define a sequence of steps. An unordered list
      defines a list of items that may or may not be related, but are generally not done in order. Both lists use list items
    • for entries within the list.

      Update the Readme document to use an ordered list instead of paragraphs. This presents the three navigation options in a numbered list:

         <ol>
            <li>Up/down/left/right to navigate to a specific square.</li>

            <li>Plus (+) or minus (-) to navigate "left" and "right" on the
                board. Note that this will automatically follow the "backwards S"
                shape of the board.</li>
         
            <li>Tab to select your next piece on the board.</li>
          </ol>

      This presents the three options in a numbered list:

      Image by:

      (Jim Hall, CC BY-SA 4.0)

      However, these three items aren't really a sequence of steps, but different options to move the selection in the Simple Senet game. So instead of an ordered list, we want to use an unordered list. This requires updating the

        to
          in the document:

             <ul>
                <li>Up/down/left/right to navigate to a specific square.</li>

                <li>Plus (+) or minus (-) to navigate "left" and "right" on the
                    board. Note that this will automatically follow the "backwards S"
                    shape of the board.</li>
             
                <li>Tab to select your next piece on the board.</li>
              </ul>

          The unordered list uses bullets for each list item, because the entries are not part of a sequence:

          Image by:

          (Jim Hall, CC BY-SA 4.0)

          Bold and italics

          You can highlight certain information in the document by applying bold and italics styles. These are very common text styles in technical writing. You might use bold to highlight important information, or italics to emphasize key phrases and new terms.

          The bold tag was originally defined as , but newer versions of the HTML standard prefer the tag to indicate strong importance, such as key steps in a set of instructions. Both tags are valid, but are semantically slightly different. now means "bring attention to."

          Similarly, the original HTML standard used for italics text. Later versions of HTML instead prefer to bring emphasis to parts of the text. Instead, now identifies idiomatic text or technical terms.

          For this example, use bold to identify the single-letter keypresses, and italics to indicate special keys on a keyboard like Enter and Space. For simplicity, use and tags here (but you could use and tags instead to get the same effect:)


          <html>
            <head>
              <title>Simple Senet</title>
            </head>
            <body>
              <h1>Simple Senet</h1>
              <h2>How to Play</h2>
             
              <p>The game will automatically "throw" the throwing sticks for you, and
              display the results in the lower-right corner of the screen.</p>
             
              <p>If the "throw" is zero, then you lose your turn.</p>
             
              <p>When it's your turn, the game will automatically select your first
              piece on the board. You may or may not be able to make a move with
              this piece, so select your piece to move, and hit <i>Space</i> (or <i>Enter</i>) to
              move it. You can select using several different methods:</p>

              <ul>
                <li><i>Up</i>/<i>down</i>/<i>left</i>/<i>right</i> to navigate to a specific square.</li>

                <li>Plus (<b>+</b>) or minus (<b>-</b>) to navigate "left" and "right" on the
                    board. Note that this will automatically follow the "backwards S"
                    shape of the board.</li>
             
                <li><em>Tab</em> to select your next piece on the board.</li>
              </ul>

              <p>To quit the game at any time, press <b>Q</b> (uppercase Q) or hit <i>Esc</i>, and
              the game will prompt if you want to forfeit the game.</p>
             
              <p>You win if you move all of your pieces off the board before your
              opponent. It takes a combination of luck and strategy!</p>
            </body>
          </html>

          These extra styles help special items to stand out in the text:

          Image by:

          (Jim Hall, CC BY-SA 4.0)

          The point of writing documentation is for users to understand how to use the software, so every open source project should make the effort to write documentation in a way that is easy to read. With a few basic HTML tags, you can write documentation that presents the information more clearly to your users.

          For more information on using HTML to write documentation, check out the complete HyperText Markup Language reference at MDN, the Mozilla Developer Network, hosted by the Mozilla web project.

          HyperText has more features than plain text to level up your documentation.

          Image by:

          Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0

          Programming Linux Documentation What to read next How I use the Linux fmt command to format text How I use the Linux sed command to automate file edits Old-school technical writing with groff Create beautiful PDFs in LaTeX A gentle introduction to HTML This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

How I get students excited about math with Python and Raspberry Pi

opensource.com - Fri, 08/12/2022 - 15:00
How I get students excited about math with Python and Raspberry Pi Don Watkins Fri, 08/12/2022 - 03:00 Register or Login to like Register or Login to like

I am teaching Python using Raspberry Pi 400 computers in a local library for the second year in a row. A couple of this year's students have not experienced success with mathematics in their school. One asked me if she needed algebra to attend our class. I told her I had failed algebra, geometry, and trigonometry in school. She was relieved. Another student rushed in the door a bit late because she was taking geometry in summer school after failing to pass the course during the school year. I shared my own story of learned helplessness and my distress at the thought of math tests. My own bad experiences impacted my high school and early college years.

I like Python, and in particular, the turtle module, because of an experience in graduate school in the early 1990s. The exercise used Apple's logo to teach students geometry, leading to an epiphany that completely changed my attitude toward mathematics. This week's class has four eighth-grade students. Two have math backgrounds, and two have math phobias. On the first day of class in the Olean Public Library, we started with a brief explanation of the RaspberryPi 400 and how to connect each of those computers to old VGA monitors that came from storage. I gave the students a brief overview and tour of the ports, peripheral mouse, and microHDMI cable we would use. We proceeded, step by step, to assemble the parts of the Raspberry Pi 400 units and connect them to the monitors. We powered up the units, and I assisted the students as they properly configured their computers for the United States and the Eastern Time Zone. We connected to the library's wireless network and were ready to begin.

More on Raspberry Pi What is Raspberry Pi? eBook: Guide to Raspberry Pi Getting started with Raspberry Pi cheat sheet eBook: Running Kubernetes on your Raspberry Pi Whitepaper: Data-intensive intelligent applications in a hybrid cloud blueprint Understanding edge computing Our latest on Raspberry Pi

I gave the students a brief overview of all the software on their computers. Then I introduced them to the Mu-Editor that comes pre-installed on their computers. We reviewed the Read-Evaluate-Print-Loop (REPL). I explained that while we could execute code in the REPL, they would find it easier to write the code in the Mu-Editor and then save their code with a .py extension to ensure that the system could execute it properly. I explained how our code needed comments and how to add and save them properly.

# first program print("Hello World")

Then I introduced them to the turtle module. We talked about the elements of a square; that squares are made up of four equal sides and contain 90-degree angles. We wrote the following code together, saved our work, and executed it.

# First Turtle Square import turtle turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90)

I explained how to change the code and add features like a different pen color and a different color background.

# First Turtle Square import turtle turtle.pencolor("blue") turtle.bgcolor("yellow") turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90) turtle.forward(200) turtle.right(90)

I introduced them to the turtle.shape to change from the default to look more like a turtle. I encouraged them to save each time and to iterate. They had fun sharing their results.

In our second session, I demonstrated how to use a for loop to draw a square and how to clean up the code by assigning the "turtle" to a specific letter. Then I ran the code.

#For Loop import turtle as t for x in range(4): t.forward(200) t.right(91)

One of the students who had experienced mathematics problems in the past said, "That square looks crooked."

I said, "You're right. What's wrong with it?"

She let me know that my t.right should be 90 and not 91. I corrected the error and reran the code. It looked perfect, and she was proud to have experienced some success with mathematics.

We changed our code, and I introduced them to new possibilities within the turtle module, including speed, pen color, and background color. They enjoyed it when I demonstrated how we could easily create a square spiral using the following code:

# square spiral import turtle as t t.speed(0) t.bgcolor("blue") t.pencolor("yellow") for x in range(200): t.forward(x) t.right(91)

We changed our code again to make circle spirals. The students were leaning into the learning, and our ninety-minute class came to an end. One of the students is in summer school re-taking geometry which she failed during the school year, and each day she runs a block and a half to make it to our class, where she excels at constructing geometric shapes. She has a great eye for detail and regularly helps the other students identify errors in their code. Her watchful eye inspired me to discuss the value of open source software and the power of many eyes on the code with the group.

Image by:

(Don Watkins, CC BY-SA 4.0)

# circle spiral import turtle as t t.speed(0) t.bgcolor("blue") t.pencolor("yellow") for x in range(100): t.circle(x*2) t.right(91) t.setpos(60,75) for x in range(100): t.circle(x) t.right(91) Image by:

(Don Watkins, CC BY-SA 4.0)

Using Python with open source hardware and software to facilitate mathematics instruction amazes me. With a little ingenuity, it's possible to reimagine mathematics education. Each student who participated in our class will receive the Raspberry Pi 400 they worked on to take home and use. They'll have to find a display to connect to, but for a bit over one hundred dollars per unit, we are investing in their future. You can have the same effect in your community if you are willing to donate your time. Public libraries are great spaces for extracurricular activities, and some of the resources I have used as the basis for my classes come from library books. One of those books is Teach Your Kids to Code. Another is Python for Kids and A Simple Turtle Tutorial by Al Sweigart is available online. We used Raspberry PI 400 kits with VGA monitors and microHDMI to VGA adapters. You could easily adapt this instruction using refurbished Linux laptops, Windows, and/or macOS laptops.

Reimagine math with the help of these open source technologies.

Image by:

Opensource.com

Python Raspberry Pi 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.

Top 5 Best WordPress Plugins for e-learning Professionals

Tecmint - Fri, 08/12/2022 - 13:05
The post Top 5 Best WordPress Plugins for e-learning Professionals first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

Whether you are a teacher at a school, academy, or institute, or if you are an independent tutor or a volunteer who gives online classes, you need to have special tools to be able

The post Top 5 Best WordPress Plugins for e-learning Professionals first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Linux Mint 21 XFCE Edition New Features and Installation

Tecmint - Fri, 08/12/2022 - 11:57
The post Linux Mint 21 XFCE Edition New Features and Installation first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

Linux Mint 21, codenamed “Vanessa”, was officially released on July 31, 2022. Linux Mint 21 is based on Ubuntu 22.04 and will be supported until April 2027. Linux Mint 21 comes in three editions:

The post Linux Mint 21 XFCE Edition New Features and Installation first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Asahi Linux May Pursue Writing Apple Silicon GPU Driver In Rust

Phoronix - Fri, 08/12/2022 - 01:55
When it comes to the Apple M1 and M2 support on Linux, one of the biggest obstacles to suitable daily use for end-users is the current lack of GPU acceleration. Reverse engineering has been happening for the Apple Silicon graphics processor, early experiments being carried out under macOS and Asahi's m1n1 environment, and the next step will be to start writing a Direct Rendering Manager (DRM) kernel driver. To some surprise, the feasibility of writing this DRM kernel GPU driver in the Rust programming language is being explored...

Linux 5.19.1 Released With LTS Kernels Back To 4.19 For The "PBRSB" CPU Issue

Phoronix - Thu, 08/11/2022 - 23:00
A number of new Linux kernel stable releases are out this week with new mitigations around the latest batch of published CPU security vulnerabilities. Linux 5.19.1, 5.18.17, 5.15.60, 5.10.136, 5.4.210, and 4.19.255 are the new releases out today...

Pages