mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
commit
f058a20c34
@ -0,0 +1,114 @@
|
||||
[#]: subject: (Windows 11 Makes Your Hardware Obsolete, Use Linux Instead!)
|
||||
[#]: via: (https://news.itsfoss.com/windows-11-linux/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Windows 11 Makes Your Hardware Obsolete, Use Linux Instead!
|
||||
======
|
||||
|
||||
Windows 11 is finally here. We’re not entirely thrilled by it – but it introduces problems for many computer users.
|
||||
|
||||
And I’m not even talking the privacy aspect or its design choice. But it seems that Windows 11 is demanding newer hardware to work, which makes your old computer obsolete in a way and forces you to upgrade your hardware for no good reason.
|
||||
|
||||
What else is a problem with the arrival of Windows 11? What’s so bad about it?
|
||||
|
||||
### Only Eligible Devices Can Get the Windows 11 Upgrade
|
||||
|
||||
To start with, Windows 11 has interestingly added a minimum system requirement which looks good on paper:
|
||||
|
||||
* 1 GHz dual-core 64-bit processor
|
||||
* 4 GB RAM
|
||||
* 64 GB storage
|
||||
* UEFI, Secure Boot support
|
||||
* Trusted Platform Module version 2.0
|
||||
* DirectX 12 compatible graphics
|
||||
* 720p resolution display
|
||||
|
||||
|
||||
|
||||
![][1]
|
||||
|
||||
You can check if your system is eligible by downloading the **PC Health Check** app from [Microsoft’s official site][2].
|
||||
|
||||
Most of the computers from the last decade should meet these criteria – but there’s a catch.
|
||||
|
||||
The hardware should have a TPM chip, which may not be the case for some PC builds or laptops. Fortunately, it is not all bad, you may just need to enable it from your BIOS settings including the Secure Boot support, to make your PC eligible. There’s a guide on [PCGamer][3] to help you with that.
|
||||
|
||||
Technically, processors older than **Intel 8th gen and Ryzen 3000 series** are not officially supported as per Microsoft’s official documentations ([AMD][4] | [Intel][5]).
|
||||
|
||||
However, there are a sound number of systems that may not have the support for it. So, what do you do?
|
||||
|
||||
Easy, [**switch to Linux in 2021**][6] before Windows 10 no longer receives updates. This year, it makes more sense than ever for you to try Linux for your personal computer!
|
||||
|
||||
### Windows 11 Installation Requires Internet Connectivity
|
||||
|
||||
![][7]
|
||||
|
||||
While we do not have enough clarity about this but as per its system requirement specifications, it will require users to have an active Internet connection for Windows 11 installation.
|
||||
|
||||
But, with Linux, you do not need that.
|
||||
|
||||
That’s just one of the [benefits of using Linux over Windows][8] – you get complete control of your operating system.
|
||||
|
||||
### No 32-Bit Support
|
||||
|
||||
![][7]
|
||||
|
||||
Windows 10 did support 32-bit systems, but Windows 11 ends that.
|
||||
|
||||
This is where Linux shines.
|
||||
|
||||
Even though the 32-bit support is dwindling everywhere, we still have a bunch of [**Linux distributions that support 32-bit systems**][9]. Your 32-bit system may still live for a decade with Linux.
|
||||
|
||||
### Windows 10 Support Ends in 2025
|
||||
|
||||
Well, this was unexpected considering Microsoft initially planned to never have an upgrade after Windows 10 but support it for the foreseeable future.
|
||||
|
||||
Now, Windows 10 will be killed in 2025…
|
||||
|
||||
So, what do you do then? Upgrade your hardware just because it does not support Windows 11?
|
||||
|
||||
Unless there’s a necessity, Linux is your friend forever.
|
||||
|
||||
You can try several [**lightweight Linux distributions**][10] that will revive any of your computers that Microsoft considers obsolete!
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
While Windows 11 plans to force users to upgrade their hardware in the next few years, Linux lets you keep your hardware for a long time along with several added benefits.
|
||||
|
||||
So, if you are not happy with Windows 11 release, you may want to start using Linux instead. Fret not, you can refer to our guides on our main web portal [It’s FOSS][11] to learn everything you need to get started using Linux!
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/windows-11-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjIyNSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[2]: https://www.microsoft.com/en-us/windows/windows-11
|
||||
[3]: https://www.pcgamer.com/Windows-11-PC-Health-Check/
|
||||
[4]: https://docs.microsoft.com/en-us/windows-hardware/design/minimum/supported/windows-11-supported-amd-processors
|
||||
[5]: https://docs.microsoft.com/en-us/windows-hardware/design/minimum/supported/windows-11-supported-intel-processors
|
||||
[6]: https://news.itsfoss.com/switch-to-linux-in-2021/
|
||||
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQzOSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[8]: https://itsfoss.com/linux-better-than-windows/
|
||||
[9]: https://itsfoss.com/32-bit-linux-distributions/
|
||||
[10]: https://itsfoss.com/lightweight-linux-beginners/
|
||||
[11]: https://itsfoss.com
|
@ -0,0 +1,65 @@
|
||||
[#]: subject: (How the Apache Software Foundation selects open source projects)
|
||||
[#]: via: (https://opensource.com/article/21/6/apache-software-foundation)
|
||||
[#]: author: (Justin Mclean https://opensource.com/users/justin-mclean)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How the Apache Software Foundation selects open source projects
|
||||
======
|
||||
The Apache Software Foundation (ASF) is built around a unique set of
|
||||
processes and values to ensure openness.
|
||||
![Wide open sky and trees][1]
|
||||
|
||||
As a longtime volunteer and mentor (and current board member) at the [Apache Software Foundation][2] (ASF) and vice president of the Apache Incubator, I'm proud to offer my insights into the unique processes and values with which the ASF operates.
|
||||
|
||||
Centered upon the permissive and pragmatic open source [Apache License][3], the ASF conducts itself differently from many other foundations simply because it is a charitable organization constructed for the public good. For example, the ASF board is elected by members. No one can buy a seat on the board, and the ASF's affiliations are with individuals, not companies. Generally, the corporate affiliation of any individual involved with ASF goes unstated, and it doesn't matter. As an outcome, the ASF has fostered a vendor-neutral environment where companies can comfortably collaborate on building valuable projects.
|
||||
|
||||
Let's take a look at how the ASF selects its projects, the state of open source licensing today, and what you can expect from the ASF heading into the future.
|
||||
|
||||
### The Apache Incubator process and 'The Apache Way'
|
||||
|
||||
Potential Apache projects begin in the [Apache Incubator][4], where they receive assistance and mentoring toward their hopeful graduation as top-level Apache projects. Anyone is welcome to put together a project proposal for the Incubator (they simply need to find someone inside the ASF who's willing to help champion it). When vetting a potential project, the ASF prefers to see a diversity of people and entities involved—and certainly not just a singular corporate body. We've found this greater diversity results in projects that are more widely used and longer lasting.
|
||||
|
||||
The central purpose of the Incubator is to help projects learn and operate in alignment with what we call [The Apache Way][5]. It is a set of values that inform best practices for community-led development. The most important aspects of The Apache Way include strict vendor-neutral independence and prioritization of a strong community, even over the strength of a project's code. Open and transparent communication is crucial as well: The ASF requires that all project communication is publicly accessible and permanently archived to enable asynchronous collaboration. In addition, the open source Apache License is attached to all accepted projects, ensuring that all source code is publicly available as well.
|
||||
|
||||
At the Incubator, we initially look at whether a project is a good fit in terms of how it aligns with these Apache values. It isn't necessary to have 100% alignment, but the project needs to be willing to adapt. There will also be a discussion around ensuring that the project is fully compatible with Apache from a licensing perspective—in some scenarios, dependencies will be removed or replaced as needed. The Apache Way prepares projects to build communities that are self-sustaining. That said, it can be difficult for some projects to build a community, and some don't make it through the incubator.
|
||||
|
||||
Another key element of The Apache Way—one essential to thriving communities—is making decisions based on consensus. In our experience, open discussions and avoiding a single individual project leader are mission-critical to that process. We have had a couple of incubating projects that included a strong personality trying to retain control, and well, those projects didn't succeed for that reason.
|
||||
|
||||
### Open source and the Apache License
|
||||
|
||||
Open source projects come in many varieties. At the same time, using an open source license doesn't automatically make a project open source. It's a project's community that unlocks open source benefits and whose contributions precipitate greater openness and transparency.
|
||||
|
||||
Recently, some companies have made high-profile moves away from the Apache License to less-permissive licensing. If your company changes from an open source to a non-open source license, I have to question why you had that open source license in the first place. It probably meant that the business model didn't fit open source. I believe that by changing away from open source licenses, companies are doing a huge disservice to their communities and their users.
|
||||
|
||||
As I said, the ASF is a non-profit, charitable organization that creates software for the public good. That's the purpose of the permissive Apache License. Making money off that software is fine, but that's not what the Apache License is about. As a rule, ASF disallows any field-of-use restrictions. _Anyone_ can use Apache projects for any reason. The idea behind true open source is that some people who use a project will give back to it, but contributions absolutely cannot be required. The companies that seem so hung up on that point need to understand that isn't how open source works, and that isn't how it should work.
|
||||
|
||||
### The future of open source and the ASF
|
||||
|
||||
Open source has certainly seen outsized adoption in the last five to 10 years and particular acceleration among enterprises. I think it's safe to say that there's hardly any software on the planet that doesn't include or rely upon open source projects in some way. That adoption is only going to grow.
|
||||
|
||||
Unlike some foundations, the ASF is fairly hands-off in terms of project recruitment. Expect the ASF to continue as it has, stating the values of The Apache Way and working with those projects that see value in the ASF's approach. With ASF projects leading at the forefront of major industry shifts—initially with web servers and more recently with big data through projects like Apache Hadoop and Spark, Cassandra, and Kafka—the hands-off stance has shown to be successful and sustainable.
|
||||
|
||||
When it comes to what's next, the ASF has several large and buzzed-about artificial intelligence and machine learning projects. In addition, several Internet of Things (IoT) projects have also been passing through the Apache Incubator, some of which will likely become quite influential. Looking forward, expect the ASF to continue as it has, introducing some hugely successful open source projects used by major industry players, with other smaller projects providing vital—if more niche—appeal.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/apache-software-foundation
|
||||
|
||||
作者:[Justin Mclean][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/justin-mclean
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/nature_open_sky_tree.png?itok=2J79Futp (Wide open sky and trees)
|
||||
[2]: https://www.apache.org/
|
||||
[3]: https://www.apache.org/licenses/LICENSE-2.0
|
||||
[4]: https://incubator.apache.org/
|
||||
[5]: https://apache.org/theapacheway/
|
137
sources/tech/20210625 How to program in C on FreeDOS.md
Normal file
137
sources/tech/20210625 How to program in C on FreeDOS.md
Normal file
@ -0,0 +1,137 @@
|
||||
[#]: subject: (How to program in C on FreeDOS)
|
||||
[#]: via: (https://opensource.com/article/21/6/program-c-freedos)
|
||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to program in C on FreeDOS
|
||||
======
|
||||
Programming in C on FreeDOS is very similar to C programming on Linux.
|
||||
![Woman sitting in front of her computer][1]
|
||||
|
||||
When I first started using DOS, I enjoyed writing games and other interesting programs using BASIC, which DOS included. Much later, I learned the C programming language.
|
||||
|
||||
I immediately loved working in C! It was a straightforward programming language that gave me a ton of flexibility for writing useful programs. In fact, much of the FreeDOS core utilities are written in C and Assembly.
|
||||
|
||||
So it's probably not surprising that FreeDOS 1.3 RC4 includes a C compiler—along with other programming languages. The FreeDOS 1.3 RC4 LiveCD includes two C compilers—Bruce's C compiler (a simple C compiler) and the OpenWatcom C compiler. On the Bonus CD, you can also find DJGPP (a 32-bit C compiler based on GNU GCC) and the IA-16 port of GCC (requires a '386 or better CPU to compile, but the generated programs can run on low-end systems).
|
||||
|
||||
Programming in C on FreeDOS is basically the same as C programming on Linux, with two exceptions:
|
||||
|
||||
1. **You need to remain aware of how much memory you use.** Linux allows programs to use lots of memory, but FreeDOS is more limited. Thus, DOS programs used one of four [memory models][2] (large, medium, compact, and small) depending on how much memory they needed.
|
||||
2. **You can directly access the console.** On Linux, you can create _text-mode_ mode programs that draw to the terminal screen using a library like _ncurses_. But DOS allows programs to access the console and video hardware. This provides a great deal of flexibility in writing more interesting programs.
|
||||
|
||||
|
||||
|
||||
I like to write my C programs in the IA-16 port of GCC, or OpenWatcom, depending on what program I am working on. The OpenWatcom C compiler is easier to install since it's only a single package. That's why we provide OpenWatcom on the FreeDOS LiveCD, so you can install it automatically if you choose to do a "Full installation including applications and games" when you install FreeDOS 1.3 RC4. If you opted to install a "Plain DOS system," then you'll need to install the OpenWatcom C compiler afterward, using the FDIMPLES package manager.
|
||||
|
||||
![installing OpenWatcom][3]
|
||||
|
||||
Installing OpenWatcom on FreeDOS 1.3 RC4
|
||||
(Jim Hall, [CC-BY SA 4.0][4])
|
||||
|
||||
### DOS C programming
|
||||
|
||||
You can find documentation and library guides on the [OpenWatcom project website][5] to learn all about the unique DOS C programming libraries provided by the OpenWatcom C compiler. To briefly describe a few of the most useful functions:
|
||||
|
||||
From `conio.h`:
|
||||
|
||||
* `int getch(void)—`Get a single keystroke from the keyboard
|
||||
* `int getche(void)—`Get a single keystroke from the keyboard, and echo it
|
||||
|
||||
|
||||
|
||||
From `graph.h`:
|
||||
|
||||
* `_settextcolor(short color)—`Sets the color when printing text
|
||||
* `_setbkcolor(short color)—`Sets the background color when printing text
|
||||
* `_settextposition(short y, short x)—`Move the cursor to row `y` and column `x`
|
||||
* `_outtext(char _FAR *string)—`Print a string directly to the screen, starting at the current cursor location
|
||||
|
||||
|
||||
|
||||
DOS only supports [sixteen text colors][6] and eight background colors. You can use the values 0 (Black) to 15 (Bright White) to specify the text colors, and 0 (Black) to 7 (White) for the background colors:
|
||||
|
||||
* **0**—Black
|
||||
* **1**—Blue
|
||||
* **2**—Green
|
||||
* **3**—Cyan
|
||||
* **4**—Red
|
||||
* **5**—Magenta
|
||||
* **6**—Brown
|
||||
* **7**—White
|
||||
* **8**—Bright Black
|
||||
* **9**—Bright Blue
|
||||
* **10**—Bright Green
|
||||
* **11**—Bright Cyan
|
||||
* **12**—Bright Red
|
||||
* **13**—Bright Magenta
|
||||
* **14**—Yellow
|
||||
* **15**—Bright White
|
||||
|
||||
|
||||
|
||||
### A fancy "Hello world" program
|
||||
|
||||
The first program many new developers learn to write is a program that just prints "Hello world" to the user. We can use the DOS "conio" and "graphics" libraries to make this a more interesting program and print "Hello world" in a rainbow of colors.
|
||||
|
||||
In this case, we'll iterate through each of the text colors, from 0 (Black) to 15 (Bright White). As we print each line, we'll indent the next line by one space. When we're done, we'll wait for the user to press any key, then we'll reset the screen and exit.
|
||||
|
||||
You can use any text editor to write your C source code. I like using a few different editors, including [FreeDOS Edit][7]** **and [Freemacs][8], but more recently I've been using the [FED editor][9] because it provides _syntax highlighting_, making it easier to see keywords, strings, and variables in my program source code.
|
||||
|
||||
![writing a simple C program][10]
|
||||
|
||||
Writing a simple test program in C
|
||||
(Jim Hall, [CC-BY SA 4.0][4])
|
||||
|
||||
Before you can compile using OpenWatcom, you'll need to set up the DOS [environment variables][11]** **so OpenWatcom can find its support files. The OpenWatcom C compiler package includes a setup [batch file][12] that does this for you, as `\DEVEL\OW\OWSETENV.BAT`. Run this batch file to automatically set up your environment for OpenWatcom.
|
||||
|
||||
Once your environment is ready, you can use the OpenWatcom compiler to compile this "Hello world" program. I've saved my C source file as `TEST.C`, so I can type `WCL TEST.C` to compile and link the program into a DOS executable, called `TEST.EXE`. In the output messages from OpenWatcom, you can see that `WCL` actually calls the OpenWatcom C Compiler (`WCC`) to compile, and the OpenWatcom Linker (`WLINK`) to perform the object linking stage:
|
||||
|
||||
![compiling with OpenWatcom][13]
|
||||
|
||||
Compiling the test program with OpenWatcom
|
||||
(Jim Hall, [CC-BY SA 4.0][4])
|
||||
|
||||
OpenWatcom prints some extraneous output that may make it difficult to spot errors or warnings. To tell the compiler to suppress most of these extra messages, use the `/Q` ("Quiet") option when compiling:
|
||||
|
||||
![compiling with OpenWatcom][14]
|
||||
|
||||
If you don't see any error messages when compiling the C source file, you can now run your DOS program. This "Hello world" example is `TEST.EXE`. Enter `TEST` on the DOS command line to run the new program, and you should see this very pretty output:
|
||||
|
||||
![running the test program][15]
|
||||
|
||||
C is a very efficient programming language that works well for writing programs on limited-resource systems like DOS. There's lots more that you can do by programming in C on DOS. If you're new to the C language, you can learn C yourself by following along in our [Writing FreeDOS Programs in C][16] self-paced ebook on the FreeDOS website, and the accompanying "how-to" video series on the [FreeDOS YouTube channel][17].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/program-c-freedos
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_2.png?itok=JPlR5aCA (Woman sitting in front of her computer)
|
||||
[2]: https://devblogs.microsoft.com/oldnewthing/20200728-00/?p=104012
|
||||
[3]: https://opensource.com/sites/default/files/uploads/install-ow.png (Installing OpenWatcom on FreeDOS 1.3 RC4)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: http://openwatcom.org/
|
||||
[6]: https://opensource.com/article/21/6/freedos-sixteen-colors
|
||||
[7]: https://opensource.com/article/21/6/freedos-text-editor
|
||||
[8]: https://opensource.com/article/21/6/freemacs
|
||||
[9]: https://opensource.com/article/21/1/fed-editor
|
||||
[10]: https://opensource.com/sites/default/files/uploads/fed-test.png (Writing a simple test program in C)
|
||||
[11]: https://opensource.com/article/21/6/freedos-environment-variables
|
||||
[12]: https://opensource.com/article/21/6/automate-tasks-bat-files-freedos
|
||||
[13]: https://opensource.com/sites/default/files/uploads/wcl-test.png (Compiling the test program with OpenWatcom)
|
||||
[14]: https://opensource.com/sites/default/files/uploads/wcl-q-test.png (Use the /Q ("Quiet") option to make OpenWatcom print less output)
|
||||
[15]: https://opensource.com/sites/default/files/uploads/test.png (You can create beautiful programs in C)
|
||||
[16]: https://www.freedos.org/books/cprogramming/
|
||||
[17]: https://www.youtube.com/freedosproject
|
@ -0,0 +1,87 @@
|
||||
[#]: subject: (Mount cue/bin image files with CDemu)
|
||||
[#]: via: (https://fedoramagazine.org/mount-cue-bin-image-files-with-cdemu/)
|
||||
[#]: author: (Luca Rastelli https://fedoramagazine.org/author/luca247/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Mount cue/bin image files with CDemu
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Photo by [Cameron Bunney][2] on [Unsplash][3]
|
||||
|
||||
The other day I needed to burn a disc. Yeah, I know, some of you might be wondering, “A disc? What’s that?” Others might ask, “Are you really using that archaic media?”
|
||||
|
||||
Well, yes I am. I feel there is still something charming about physical things that digital media cannot replace.
|
||||
|
||||
I needed to burn a very old game that was comprised of a [cue file][4], some audio tracks in [cda format][5], and a [bin file][6] which stored all the binary content that was indexed by the cue file.
|
||||
|
||||
First I tried to use [Brasero][7]. Yeah I know, it’s old but it does the job generally and it fits with the rest of the system, so it’s my choice generally. Unfortunately, this time it was not up to the task. It stated that it had some problems reading the cue file. Then I tried [Xfburn][8] and [K3b][9]. But neither of those worked either. They both detected the bin file but not the cda files.
|
||||
|
||||
Next, I searched on the web and I found lots of posts explaining how to burn image files using command line applications. Or how to create [iso images][10] and then write those out to discs. These methods seemed excessively complex for what I wanted to do. Why all that difficulty for a task that should be easy as clicking on a button? Fedora Linux should be about freedom, not about difficulties! Although it can be used by experts, an easy way of doing things is always appreciated.
|
||||
|
||||
I had almost surrendered. Then, in a forum post buried under all the suggestions mentioned previously, I found the answer I was looking for – [CDemu][11].
|
||||
|
||||
Those familiar with [Daemon Tools][12] may find CDemu to be similar. I find CDemu to be even easier and far less bloated. With CDemu, you can mount cue images with the classic double-click. Sounds easy? Well that’s because it actually is.
|
||||
|
||||
CDemu is not present in Fedora Linux’s default repositories. So if you want to try it out, you will have to use the [rok/cdemu][13] Copr repository that is compatible with your version of Fedora Linux.
|
||||
|
||||
**Note**: _Copr is not officially supported by Fedora infrastructure. Use packages at your own risk._
|
||||
|
||||
Open a terminal and enable the Copr repo by entering the following command.
|
||||
|
||||
```
|
||||
$ sudo dnf copr enable rok/cdemu
|
||||
```
|
||||
|
||||
Then install the daemon and the clients by entering the following commands.
|
||||
|
||||
```
|
||||
$ sudo dnf install cdemu-daemon
|
||||
$ sudo dnf install cdemu-client
|
||||
$ sudo dnf install gcdemu
|
||||
```
|
||||
|
||||
Next, enter the following commands to ensure the right kernel module is available and loaded.
|
||||
|
||||
```
|
||||
$ sudo akmods
|
||||
$ sudo systemctl restart systemd-modules-load.service
|
||||
```
|
||||
|
||||
Now CDemu is installed. To associate it with your CD images, you just need to right-click on a file type that you want to mount with CDemu, select _properties_, and the select _Open with CDemu_. Now, double-clicking on those image types should mount them in Nautilus like a physical drive.
|
||||
|
||||
If you need to burn the image (like I did), open Brasero and select _copy disc_.
|
||||
|
||||
CDemu can also be run from the command line. But this guide was all about getting easy, right?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/mount-cue-bin-image-files-with-cdemu/
|
||||
|
||||
作者:[Luca Rastelli][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/luca247/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/06/cdemu-816x345.jpg
|
||||
[2]: https://unsplash.com/@bdbillustrations?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/dvd?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://en.wikipedia.org/wiki/Cue_sheet_(computing)
|
||||
[5]: https://en.wikipedia.org/wiki/.cda_file
|
||||
[6]: https://en.wikipedia.org/wiki/Binary_file
|
||||
[7]: https://en.wikipedia.org/wiki/Brasero_(software)
|
||||
[8]: https://en.wikipedia.org/wiki/Xfce#Xfburn
|
||||
[9]: https://en.wikipedia.org/wiki/K3b
|
||||
[10]: https://en.wikipedia.org/wiki/Optical_disc_image
|
||||
[11]: https://en.wikipedia.org/wiki/CDemu
|
||||
[12]: https://en.wikipedia.org/wiki/Daemon_Tools
|
||||
[13]: https://copr.fedorainfracloud.org/coprs/rok/cdemu/
|
205
sources/tech/20210625 Use Python to parse configuration files.md
Normal file
205
sources/tech/20210625 Use Python to parse configuration files.md
Normal file
@ -0,0 +1,205 @@
|
||||
[#]: subject: (Use Python to parse configuration files)
|
||||
[#]: via: (https://opensource.com/article/21/6/parse-configuration-files-python)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Use Python to parse configuration files
|
||||
======
|
||||
The first step is choosing a configuration format: INI, JSON, YAML, or
|
||||
TOML.
|
||||
![Python programming language logo with question marks][1]
|
||||
|
||||
Sometimes, a program needs enough parameters that putting them all as command-line arguments or environment variables is not pleasant nor feasible. In those cases, you will want to use a configuration file.
|
||||
|
||||
There are several popular formats for configuration files. Among them are the venerable (although occasionally under-defined) `INI` format, the popular but sometimes hard to write by hand `JSON` format, the extensive yet occasionally surprising in details `YAML` format, and the newest addition, `TOML`, which many people have not heard of yet.
|
||||
|
||||
Your first task is to choose a format and then to document that choice. With this easy part out of the way, it is time to parse the configuration.
|
||||
|
||||
It is sometimes a good idea to have a class that corresponds to the "abstract" data in the configuration. Because this code will do nothing with the configuration, this is the simplest way to show parsing logic.
|
||||
|
||||
Imagine the configuration for a file processor: it includes an input directory, an output directory, and which files to pick up.
|
||||
|
||||
The abstract definition for the configuration class might look something like:
|
||||
|
||||
|
||||
```
|
||||
`from __future__ import annotations`[/code] [code]
|
||||
|
||||
import attr
|
||||
|
||||
@attr.frozen
|
||||
class Configuration:
|
||||
@attr.frozen
|
||||
class Files:
|
||||
input_dir: str
|
||||
output_dir: str
|
||||
files: Files
|
||||
@attr.frozen
|
||||
class Parameters:
|
||||
patterns: List[str]
|
||||
parameters: Parameters
|
||||
```
|
||||
|
||||
To make the format-specific code simpler, you will also write a function to parse this class out of dictionaries. Note that this assumes the configuration will use dashes, not underscores. This kind of discrepancy is not uncommon.
|
||||
|
||||
|
||||
```
|
||||
def configuration_from_dict(details):
|
||||
files = Configuration.Files(
|
||||
input_dir=details["files"]["input-dir"],
|
||||
output_dir=details["files"]["output-dir"],
|
||||
)
|
||||
parameters = Configuration.Paraneters(
|
||||
patterns=details["parameters"]["patterns"]
|
||||
)
|
||||
return Configuration(
|
||||
files=files,
|
||||
parameters=parameters,
|
||||
)
|
||||
```
|
||||
|
||||
### JSON
|
||||
|
||||
JSON (JavaScript Object Notation) is a JavaScript-like format.
|
||||
|
||||
Here is an example configuration in JSON format:
|
||||
|
||||
|
||||
```
|
||||
json_config = """
|
||||
{
|
||||
"files": {
|
||||
"input-dir": "inputs",
|
||||
"output-dir": "outputs"
|
||||
},
|
||||
"parameters": {
|
||||
"patterns": [
|
||||
"*.txt",
|
||||
"*.md"
|
||||
]
|
||||
}
|
||||
}
|
||||
"""
|
||||
```
|
||||
|
||||
The parsing logic parses the JSON into Python's built-in data structures (dictionaries, lists, strings) using the `json` module and then creates the class from the dictionary:
|
||||
|
||||
|
||||
```
|
||||
import json
|
||||
def configuration_from_json(data):
|
||||
parsed = json.loads(data)
|
||||
return configuration_from_dict(parsed)
|
||||
```
|
||||
|
||||
### INI
|
||||
|
||||
The INI format, originally popular on Windows, became a de facto configuration standard.
|
||||
|
||||
Here is the same configuration as an INI:
|
||||
|
||||
|
||||
```
|
||||
ini_config="""
|
||||
[files]
|
||||
input-dir = inputs
|
||||
output-dir = outputs
|
||||
|
||||
[parameters]
|
||||
patterns = ['*.txt', '*.md']
|
||||
"""
|
||||
```
|
||||
|
||||
Python can parse it using the built-in `configparser` module. The parser behaves as a `dict`-like object, so it can be passed directly to `configuration_from_dict`:
|
||||
|
||||
|
||||
```
|
||||
import configparser
|
||||
|
||||
def configuration_from_ini(data):
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read_string(data)
|
||||
return configuration_from_dict(parser)
|
||||
```
|
||||
|
||||
### YAML
|
||||
|
||||
YAML (Yet Another Markup Language) is an extension of JSON that is designed to be easier to write by hand. It accomplishes this, in part, by having a long specification.
|
||||
|
||||
Here is the same configuration in YAML:
|
||||
|
||||
|
||||
```
|
||||
yaml_config = """
|
||||
files:
|
||||
input-dir: inputs
|
||||
output-dir: outputs
|
||||
parameters:
|
||||
patterns:
|
||||
- '*.txt'
|
||||
- '*.md'
|
||||
"""
|
||||
```
|
||||
|
||||
For Python to parse this, you will need to install a third-party module. The most popular is `PyYAML` (`pip install pyyaml`). The YAML parser also returns built-in Python data types that can be passed to `configuration_from_dict`. However, the YAML parser expects a stream, so you need to convert the string into a stream.
|
||||
|
||||
|
||||
```
|
||||
import io
|
||||
import yaml
|
||||
def configuration_from_yaml(data):
|
||||
fp = io.StringIO(data)
|
||||
parsed = yaml.safe_load(fp)
|
||||
return configuration_from_dict(parsed)
|
||||
```
|
||||
|
||||
### TOML
|
||||
|
||||
TOML (Tom's Own Markup Language) is designed to be a lightweight alternative to YAML. The specification is shorter, and it is already popular in some places (for example, Rust's package manager, Cargo, uses it for package configuration).
|
||||
|
||||
Here is the same configuration as a TOML:
|
||||
|
||||
|
||||
```
|
||||
toml_config = """
|
||||
[files]
|
||||
input-dir = "inputs"
|
||||
output-dir = "outputs"
|
||||
|
||||
[parameters]
|
||||
patterns = [ "*.txt", "*.md",]
|
||||
"""
|
||||
```
|
||||
|
||||
In order to parse TOML, you need to install a third-party package. The most popular one is called, simply, `toml`. Like YAML and JSON, it returns basic Python data types.
|
||||
|
||||
|
||||
```
|
||||
import toml
|
||||
def configuration_from_toml(data):
|
||||
parsed = toml.loads(data)
|
||||
return configuration_from_dict(parsed)
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
Choosing a configuration format is a subtle tradeoff. However, once you make the decision, Python can parse most of the popular formats using a handful of lines of code.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/parse-configuration-files-python
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks)
|
Loading…
Reference in New Issue
Block a user