Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-04-08 09:56:57 +08:00
commit 6ca567e9e6
8 changed files with 653 additions and 118 deletions

View File

@ -0,0 +1,74 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (15 years of Git: How to get started or learn something new)
[#]: via: (https://opensource.com/article/20/4/get-started-git)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
15 years of Git: How to get started or learn something new
======
On Git's 15th anniversary, learn why it is a major component in keeping
the software industry running.
![Scissors cutting open access to files][1]
If there's anything that's changed software in the past two decades, [Git][2] is at the top of the list.
If you don't use Git personally, you might think it's just a tech fad, an incidental darling among developers just because it was created by the same person who started the [Linux][3] project itself. There may be some truth to that, but Git does manage to achieve some feats that no other industry has managed. With Git, developers spread all over the world are able to work on the same code, literally at the same time, with a history of every change made, and then merge all the work together to result in a finished product. The complexity is enormous, and so the tool itself can get complex, but in the end, it's a major component in keeping the software industry running.
Whether you know Git or not, you'll very likely encounter it should you dig deep enough into open source software or enter into computer science. Whether you use Git to just download an installer package or whether you interface with it daily to manage code, learning more about it is elucidating and empowering.
### Git terminology
As with any specialized tool, there's a lot of jargon in Git. Terms like "clone" and "merge" and "rebase" are mysterious at best, and at worst can feel almost exclusionary. Trying to understand what all of these terms mean can be overwhelming, but not if you take a little guidance from Matthew Broberg's excellent [Git Terminology 101][4] article. In just one quick read, you'll be able to listen in on conversations about Git with real comprehension.
### Getting started with Git
If you need to know how to use Git, then my own [introductory article series about using Git][5] is a great place to start. The articles are several years old now, but as with so many Linux and UNIX technologies, the interface hasn't changed significantly, so the articles are as relevant today as they were when I wrote them. The series introduces you to the most basic concepts of Git, and steps you through the process of creating a repository, committing files, restoring files, merging branches, and much more.
### Common Git services
One of the most common uses of Git is a public Git hosting service, such as GitLab and GitHub. In his [How to clone, modify, add, and delete files in Git][6] article, Kedar Vijay Kulkarni demonstrates the everyday tasks most developers perform with Git. This isn't required reading for non-developers, but it's a must for anyone who wants to contribute to a project on a public Git hosting service. This article addresses Github specifically because it's one of the most common platforms today, but the principles apply to any web front-end for Git, including popular open source frameworks like [GitLab][7], [Gogs][8], and [Gitea][9].
### Try this Git walkthrough
Do you prefer a guided tour to aimless exploration? Sometimes the easiest way to learn something is to mimic someone else's exact steps. You know the end result is a guaranteed success, so you have confidence while performing the exercise, and your brain and fingers get the benefit of repetition, which builds memory. If that's your learning style, then follow along with Alan Formy-Duvall's [practical learning exercise for Git][10] and find out what a successful Git session feels like.
### Git apps
Believe it or not, Git has more interfaces than text you type into a terminal. Obviously there are the web interfaces of Git hosts online, but you can use Git clients on your computer, too. For just a light layer of assistance, read Jesse Duffield's article about [Lazygit][11] or Olaf Anders' article about [Tig][12]. For the full graphical application experience, read my article about [Git-cola][13], [Sparkleshare][14], and [still others][15]. And yes, there are even [interfaces for your mobile devices][16]!
### Learn more about Git
Knowledge is power, so don't let Git be a mystery to you. Whether you use it directly or you only know it by name or you'd never heard of it before, now's a great time to learn about Git. There are great resources out there to help you understand how it works, why it works, and why people love it so much.  Dive in, take it at your own pace, and learn to love Git!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/get-started-git
作者:[Seth Kenlon][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/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files)
[2]: https://en.wikipedia.org/wiki/Git
[3]: https://opensource.com/resources/linux
[4]: https://opensource.com/article/19/2/git-terminology
[5]: https://opensource.com/life/16/7/stumbling-git
[6]: https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files
[7]: https://about.gitlab.com/install/
[8]: https://gogs.io/
[9]: https://gitea.io/en-us/
[10]: https://opensource.com/article/19/5/practical-learning-exercise-git
[11]: https://opensource.com/article/20/3/lazygit
[12]: https://opensource.com/article/19/6/what-tig
[13]: https://opensource.com/article/20/3/git-cola
[14]: https://opensource.com/article/19/4/file-sharing-git
[15]: https://opensource.com/life/16/8/graphical-tools-git
[16]: https://opensource.com/article/19/4/calendar-git#mobile

View File

@ -1,117 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using data from spreadsheets in Fedora with Python)
[#]: via: (https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/)
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
Using data from spreadsheets in Fedora with Python
======
![][1]
[Python][2] is one of the most popular and powerful programming languages available. Because its free and open source, its available to everyone — and most Fedora systems come with the language already installed. Python is useful for a wide variety of tasks, but among them is processing comma-separated value (**CSV**) data. CSV files often start off life as tables or spreadsheets. This article shows how to get started working with CSV data in Python 3.
CSV data is precisely what it sounds like. A CSV file includes one row of data at a time, with data values separated by commas. Each row is defined by the same _fields_. Short CSV files are often easily read and understood. But longer data files, or those with more fields, may be harder to parse with the naked eye, so computers work better in those cases.
Heres a simple example where the fields are _Name_, _Email_, and _Country_. In this example, the CSV data includes a field definition as the first row, although that is not always the case.
```
Name,Email,Country
John Q. Smith,jqsmith@example.com,USA
Petr Novak,pnovak@example.com,CZ
Bernard Jones,bjones@example.com,UK
```
### Reading CSV from spreadsheets
Python helpfully includes a _csv_ module that has functions for reading and writing CSV data. Most spreadsheet applications, both native like Excel or Numbers, and web-based such as Google Sheets, can export CSV data. In fact, many other services that can publish tabular reports will also export as CSV (PayPal for instance).
The Python _csv_ module has a built in reader method called _DictReader_ that can deal with each data row as an ordered dictionary (OrderedDict). It expects a file object to access the CSV data. So if our file above is called _example.csv_ in the current directory, this code snippet is one way to get at this data:
```
f = open('example.csv', 'r')
from csv import DictReader
d = DictReader(f)
data = []
for row in d:
data.append(row)
```
Now the _data_ object in memory is a list of OrderedDict objects :
```
[OrderedDict([('Name', 'John Q. Smith'),
('Email', 'jqsmith@example.com'),
('Country', 'USA')]),
OrderedDict([('Name', 'Petr Novak'),
('Email', 'pnovak@example.com'),
('Country', 'CZ')]),
OrderedDict([('Name', 'Bernard Jones'),
('Email', 'bjones@example.com'),
('Country', 'UK')])]
```
Referencing each of these objects is easy:
```
>>> print(data[0]['Country'])
USA
>>> print(data[2]['Email'])
bjones@example.com
```
By the way, if you have to deal with a CSV file with no header row of field names, the _DictReader_ class lets you define them. In the example above, add the _fieldnames_ argument and pass a sequence of the names:
```
d = DictReader(f, fieldnames=['Name', 'Email', 'Country'])
```
### A real world example
I recently wanted to pick a random winner from a long list of individuals. The CSV data I pulled from spreadsheets was a simple list of names and email addresses.
Fortunately, Python also has a helpful _random_ module good for generating random values. The _randrange_ function in the _Random_ class from that module was just what I needed. You can give it a regular range of numbers — like integers — and a step value between them. The function then generates a random result, meaning I could get a random integer (or row number!) back within the total number of rows in my data.
So this small program worked well:
```
from csv import DictReader
from random import Random
d = DictReader(open('mydata.csv'))
data = []
for row in d:
data.append(row)
r = Random()
winner = data[r.randrange(0, len(data), 1)]
print('The winner is:', winner['Name'])
print('Email address:', winner['Email'])
```
Obviously this example is extremely simple. Spreadsheets themselves include sophisticated ways to analyze data. However, if you want to do something outside the realm of your spreadsheet app, Python may be just the trick!
* * *
_Photo by [Isaac Smith][3] on [Unsplash][4]._
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/
作者:[Paul W. Frields][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/pfrields/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/spreadsheets-python-816x345.jpg
[2]: https://python.org
[3]: https://unsplash.com/@isaacmsmith?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://unsplash.com/s/photos/spreadsheets?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,94 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to avoid man-in-the-middle cyber attacks)
[#]: via: (https://opensource.com/article/20/4/mitm-attacks)
[#]: author: (Jackie Lam https://opensource.com/users/beenverified)
How to avoid man-in-the-middle cyber attacks
======
Understanding MITM attacks is the first step in not being a victim of
this high-tech style of eavesdropping.
![Security monster][1]
Whether you're sending data on your computer or talking to someone online, you want to assume some level of security and privacy.
But what if a third party is eavesdropping online, unbeknownst to you? And worse, what if they're impersonating someone from a business you trust in order to gain damaging information? This could put your personal data into the hands of dangerous, would-be thieves.
Welcome to what's called a man-in-the-middle (MITM) attack.
### What are man-in-the-middle attacks?
A man-in-the-middle attack occurs when a cybercriminal inserts themselves into communications between you, the targeted victim, and a device in order to steal sensitive information that can be used for a variety of criminal purposes—most notably identity theft, says Steve J. J. Weisman, founder of Scamicide.
"A man-in-the-middle-attack can also occur when the victim believes he or she is communicating with a legitimate app or website," says Weisman, "when the truth is that the victim is communicating with a phony website or app and thereby providing sensitive information to the criminal."
One of the oldest forms of cyberattacks, MITM attacks have been around since the 1980s. What's more, they're quite common. As Weisman explains, there are a handful of ways a MITM attack can happen:
* **Attacking a WiFi router that is not properly secured:** This typically occurs when someone is using public WiFi. "While home routers might be vulnerable, it's more common for criminals to attack public WiFi networks," says Weisman. The goal is to spy on unsuspecting people who are handling sensitive information, such as their online bank accounts, he adds.
* **Hacking email accounts of banks, financial advisers, and other companies:** "Once [the criminals] have hacked these email systems, they send out emails that appear to come from the legitimate bank or other company," Weisman says. "[They ask] for personal information, such as usernames and passwords, under the guise of an emergency. The targeted victim is lured into providing that information."
* **Sending phishing emails:** Thieves might also send emails pretending to be legitimate companies that the targeted victim does business with, asking the recipient for their personal information. "In many instances, the spear-phishing emails will direct the victim to a counterfeit website that appears to be that of a legitimate company with which the victim does business," says Weisman.
* **Using malicious code in legitimate websites:** Attackers can also place malicious code—usually JavaScript—into a legitimate website by way of a web application. "When the victim loads the legitimate page, the malicious code just sits in the background until the user enters sensitive information, such as account login or credit card details, which the malicious code then copies and sends to the attackers' servers," says Nicholas McBride, a cybersecurity consultant.
### What is an example of an MITM attack?
The Lenovo case is a well-known example of an MITM attack. In 2014 and 2015, the major computer manufacturer sold consumer laptops with preinstalled software that meddled with how a user's browser communicated with websites. Whenever the user's cursor hovered over a product, this software, called VisualDiscovery, sent pop-up ads from retail partners that sold similar products.
Here's the kicker: This MITM attack allowed VisualDiscovery to access all of the user's personal data, including social security numbers, info about financial transactions, medical info, and logins and passwords. All without the user knowing or granting permission beforehand. The FTC deemed this a deceptive and unfair online scam. Lenovo agreed to pay $8.3 million in a class-action settlement in 2019.
### How can I protect myself from an online attack?
* **Avoid using public WiFi:** Weisman recommends never using public WiFi for financial transactions unless you've installed a reliable virtual private network (VPN) client on your device and have a VPN host you can use and trust. Over a VPN connection, your communications are encrypted, so your information can't be stolen.
* **Be on the lookout:** Be wary of emails or text messages that ask you to update your password or provide your username or personal information. These methods can be used to steal your identity.
If you are unsure of the actual identity of the party sending you the email, you can use tools such as a reverse phone or email search. With a reverse phone number lookup, you may be able to find out more about the identity of an unknown texter. And with a reverse email lookup, you can try to determine who might have sent you a message.
Generally, if something's actually a problem, you'll hear from someone you know and trust within your company, or from someone you can also go and meet, in person, at your bank or school or other organization. Important account information is never the purview of an unknown technician.
* **Don't click on links contained in emails:** If someone sends you an email telling you that you need to sign into an account, don't click on the link provided in the email. Instead, navigate to the site yourself, log in as you normally would, and look for an alert there. If you don't see an alert message in your account settings, contact a representative by phone using contact information on the site and _not_ from the email.
* **Install reliable security software:** If you're on Windows, install good open source antivirus like [ClamAV][2]. On all platforms, keep your software up to date with the latest security patches.
* **Take alerts seriously:** If you're visiting a site that starts with HTTPS, your browser might alert you to an issue, says McBride. For instance, if the domain name on the site's certificate doesn't match the one you're trying to visit. Don't ignore the alert. Heed it and navigate away from the site for now. Verify that you haven't [mistyped it][3], and if the problem persists, contact the site owner if you can.
* **Use an ad blocker:** Pop-up ads (also known as _adware attacks_) can be used to intercept your personal information, so use an ad blocker. "The truth is, as an individual user, it's hard to protect against a MITM attack," says McBride, "as it is designed to leave the victim in the dark and to prevent them from noticing that there is anything wrong."
A good open source ad blocker (or "wide-spectrum blocker," in the developer's words) is [uBlock origin][4]. It's available for both Firefox and Chromium (and all Chromium-based browsers, such as Chrome, Brave, Vivaldi, Edge, and so on), and even Safari.
### Stay alert
Remember, you don't have to click anything online right away, and you don't have to follow random people's instructions, no matter how urgent they may seem. The internet will still be there after you step away from the computer and verify the identity of a person or site demanding your attention.
While MITM attacks can happen to anyone, understanding what they are, knowing how they happen, and actively taking steps to prevent them can safeguard you from being a victim.
* * *
_This article was originally published on [BeenVerified.com][5] under a [CC BY-SA 2.0][6] license._
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/mitm-attacks
作者:[Jackie Lam][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/beenverified
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu (Security monster)
[2]: https://www.clamav.net
[3]: https://opensource.com/article/20/1/stop-typosquatting-attacks
[4]: https://github.com/gorhill/uBlock
[5]: https://www.beenverified.com/crime/what-is-a-man-in-the-middle-attack/
[6]: https://creativecommons.org/licenses/by-sa/2.0/

View File

@ -0,0 +1,186 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to use pyenv to run multiple versions of Python on a Mac)
[#]: via: (https://opensource.com/article/20/4/pyenv)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
How to use pyenv to run multiple versions of Python on a Mac
======
If you need to run a project that uses a Python version you don't have
installed on macOS, try pyenv.
![Searching for code][1]
Managing a local Python development environment continues to be a challenge, even for experienced developers. While there are well-documented [strategies for package management][2], there is another step necessary to ensure you are running the version of Python you need when you need it.
### Why does the version of Python matter?
It's a strange concept at first, but programming languages change like any other software. They have bugs, fixes, and updates like any of your favorite [APIs][3] and any other software. Similarly again, different releases are identified by a three-digit number known as a [semantic version][4].
> 😭😭😭 [pic.twitter.com/yt1Z2439W8][5]
>
> — Denny Perez (@dennyperez18) [May 28, 2019][6]
For many years, Python 2 was the commonly used major version of the programming language. In January 2020, Python 2 [reached end of life][7], and only Python 3 will be supported by the language's core maintainers from then forward. Python 3 is developing steadily, and releasing new updates regularly. That makes it important for me to regularly get those updates.
Recently, I tried to run a project on macOS that depended on Python 3.5.9, a version that I did not have installed on my system. It might seem logical to think the Python package manager **pip** could install it*, but that wasn't the case:
```
$ pip install python3.5.9
Collecting python3.5.9
  ERROR: Could not find a version that satisfies the requirement python3.5.9 (from versions: none)
ERROR: No matching distribution found for python3.5.9
```
Alternatively, I could have downloaded that version from the official Python website, but how would I run it in on my Mac alongside my existing version of Python? Specifying the version of Python I intend to use every time I run the interpreter (python3.7 or python3.5 for example) seems error-prone at best. There has to be a better way.
_(A note on the above: I know this makes no sense to seasoned Python developer, but it made sense to me at the time. I would happily talk about why I still think it should.)_
### Installing and setting up pyenv
Thankfully, **pyenv** exists to work around this series of complexities. To start, I needed to install pyenv. I could clone and compile it myself [from source][8], but I prefer to manage packages like this through the Homebrew package manager:
```
`$ brew install pyenv`
```
In order to use the version of Python through pyenv, it's essential to understand the shell's PATH variable. PATH determines where the shell searches for files by the name of the command. You must ensure the shell will find the version of Python run by pyenv, not the one installed by default (which is often called the _system version_). If you don't change the path, here is the result:
```
$ which python
/usr/bin/python
```
That's the system version of Python.
To set up pyenv correctly, you can run the following in Bash or zsh:
```
`$ PATH=$(pyenv root)/shims:$PATH`
```
Now, if you check the version of Python, you'll see it is the one managed by pyenv:
```
$ which python
/Users/my_username/.pyenv/shims/python
```
That export statement (PATH=) will only change for this shell instance, so make it a permanent change, you need to add it to your dotfiles. Since zsh is officially macOS's default shell, I'll focus on it. Append that same syntax to the **~/.zshrc** file:
```
`$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc`
```
Now every time we run a command in zsh, it will use the pyenv version of Python. Note that I used single quotes with **echo** so it does not evaluate and expand the commands.
The .zshrc file only manages zsh instances, so be sure to check what your shell is and edit the associated dotfiles. If you need to double-check what your default shell is, you can run **echo $SHELL**. If it's zsh, use the command above. If you use Bash, change **~/.zshrc** to **~/.bashrc**. You can dive deep into [path setting][9] in pyenv's README if you would like to learn more.
### Using pyenv to manage Python versions
Now that pyenv is in control, we can see it only has the system Python available to it:
```
$ pyenv versions
system
```
As mentioned above, you absolutely do not want to use this version ([read more on why][10]). Now that pyenv is set up correctly, I want it to have a few different versions of Python that I regularly use.
There is a way to see all Python versions available from all the different repositories pyenv has access to by running **pyenv install --list**. It's a long, overwhelming list that may be helpful to review in the future. For now, I stick with the latest of each dot-release (3.5.x or 3.6.x where x is the latest) found on the [Python download page][11]. With that in mind, I'll install 3.5.9 and 3.8.0:
```
$ pyenv install 3.5.9
$ pyenv install 3.8.0
```
This will take a while, so get some tea (or read one of the links above). It's interesting to note that the output walks through the download and building of that version of Python. For example, the output shows that the file comes directly from [Python.org][12].
Once everything is installed, you can set up your defaults. I like to live at the cutting edge, so I set my global default Python version to the latest:
```
`$ pyenv global 3.8.0`
```
And that version is immediately set in my shell. To confirm:
```
$ python -V
Python 3.8.0
```
The project I want to run works only with Python 3.5, so I'll set the version locally and confirm it's in use:
```
$ pyenv local 3.5.9
$ python -V
Python 3.5.9
```
Because I used the **local** option with pyenv, it added a file to my current directory to track that information. 
```
$ cat .python-version
3.5.9
```
Now, I can finally set up a virtual environment for the project I want and be sure I'm running the right version of Python.
```
$ python -m venv venv
$ source ./venv/bin/activate
(venv) $ which python
/Users/mbbroberg/Develop/my_project/venv/bin/python
```
To learn more, check out this tutorial about [managing virtual environments on a Mac][13].
### Wrapping up
By default, running multiple Python versions can be a challenge. I find starting with pyenv ensures I have the versions of Python I need set up to run when I need them.
Do you have other beginner or intermediate Python questions? Leave a comment, and we will consider them for a future article.
Newcomers to python-ideas occasionally make reference to the idea of "Python 4000" when proposing...
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/pyenv
作者:[Matthew Broberg][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/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code)
[2]: https://opensource.com/article/19/4/managing-python-packages
[3]: https://opensource.com/article/19/5/api-evolution-right-way
[4]: https://semver.org/
[5]: https://t.co/yt1Z2439W8
[6]: https://twitter.com/dennyperez18/status/1133505310516232203?ref_src=twsrc%5Etfw
[7]: https://opensource.com/article/19/11/end-of-life-python-2
[8]: https://github.com/pyenv/pyenv
[9]: https://github.com/pyenv/pyenv#understanding-path
[10]: https://opensource.com/article/19/5/python-3-default-mac
[11]: https://www.python.org/downloads/
[12]: http://python.org
[13]: https://opensource.com/article/19/6/python-virtual-environments-mac

View File

@ -0,0 +1,92 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Love or hate chat? 4 best practices for remote teams)
[#]: via: (https://opensource.com/article/20/4/chat-tools-best-practices)
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike)
Love or hate chat? 4 best practices for remote teams
======
Plus, learn about a few open source alternatives for chat.
![Chat via email][1]
Chat is a part of most people's daily lives, especially if you work in tech, and especially if you work with teammates located in different parts of the world. It can be a great way to achieve these goals:
* **to connect**; to share with teammates on a personal level
* **to get work done**; to communicate with teammates about work in progress
* **to share**; to give notes and feedback from experiences, meetings, and interactions outside of the group that may be relevant to your work or interests
I encourage you to explore [open source alternatives to chat][2] like [Mattermost][3], [Rocket.Chat][4], and [Riot][5].
### To chat or not to chat, that is the question
First, it's important to make time to have a discussion with each member of your team focused on answering whether they are comfortable with using a chat platform to keep in touch throughout the workday. Some people enjoy chat and see it as a vital part of their workday, getting things done and communicating with teammates who they rely on to get that work done and move forward with projects. Others struggle with chat as a way of getting work done and prefer to use it when they feel like having more casual conversations with teammates on topics less focused on work and more on social interaction and personal sharing. Some people wish chat would burn in a fire.
Gather these opinions and talk through these feelings with each person. You can do this as a group or one-on-one if that feels more appropriate.
Why? Because communication is important and always will be, and your team will find a way to chat no matter what you do. We're human, and need various levels and types of interaction with each other throughout our days and lives. And when it comes to our work colleagues, it's helpful to put some structure in place to guide your team.
### Best practices for team chat
If you have decided to use chat in some form, the next step is to place structure around when and how to use it and **not** use it. These best practices work well for teams who are working remotely and at home, as well as in the office.
**1\. Create rooms and threads to focus your conversations.**
My team has a room for each of our sub-teams who work on a particular project together. We also have an at-large room for all of us to banter and share.
Additionally, we use threads to focus on one topic at a time which is helpful when you have several to dozens of teammates in one room together. It helps conversations to continue and not stop prematurely because they were lost in the mix of other conversations.
**2\. Decide when your team will be signed in and available to talk.**
Is it throughout the workday (whatever hours those are for you), during a set timeframe, or as desired?
My team has set the expectation that they will be signed in and available to chat at some point during the workday **about work-related topics**, and that at that time they will check for and respond to messages that were sent to them while they were away. So, we are using it as an asynchronous way to communicate about work.
For us, asynchronous chat helps us plan and schedule each day how we see fit with the goal of being productive and serving our project in the best we can _that day_.
If a teammate does **not** plan on signing in and responding to messages one day, that is OK, and we set the expectation that they will send a message to let the team know. For my team, almost no communication is wrong (see guideline #4), but it should be communicated. We also review our schedules for the following week in a team meeting the week before so we know when someone will be away from their desk, not working, or blocking out a chunk of time for a project.
**3\. Decide when your teammates are responsible for responding (and when they are not).**
Use @ mentions if you want someone to see and respond to your question or comment in chat. Don't expect them to be watching every thread and conversation. 
And I would recommend that you take it a step further and define when teammates should be responsible for responding and when they should not. This type of decision is meant to free you and your teammates, not hold you down. The more you understand the expectations, the freer you are to operate within the same understood universe. When you are unsure of the rules, you may act and make decisions in fear or trepidation instead, like staying signed in to chat all day when you really just need to block it out to get something done.
Our team has decided that it's nice if you can respond in chat when you are mentioned, but if you don't that is OK. Perhaps you were AFK during that time and lost track of the notification. For us, if you definitely want a response to something from someone, send them an email. 
**4\. Communicate clearly and with kindness.**
The way we interpret messages when we are chatting via text is different than when we are chatting verbally, in-person or over video.
My team uses a lot of humor, emojis, and clear, concise messages to chat with each other.
We also hold weekly in-person or video conference meetings so that we can get to know each other better. The more you trust someone, the easier it is to give them the benefit of the doubt when you're confused by a message and the better you are at understanding what they are saying and what their intention is behind the text coming through to you.
### Signing off
What best practices does your team use? Do you love or hate chat, and why? 
For all kinds of teams today, chat is a special part of how we stay connected, working, and sharing with each other. Finding ways to do that in a healthy and committed way is part of everyone's responsibility.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/chat-tools-best-practices
作者:[Jen Wike Huger][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/jen-wike
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email)
[2]: https://opensource.com/alternatives/slack
[3]: https://mattermost.com/
[4]: https://rocket.chat/
[5]: https://riot.im/app/

View File

@ -0,0 +1,89 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Create Templates in LibreOffice to Save Time and Increase Productivity)
[#]: via: (https://itsfoss.com/create-templates-libreoffice/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
How to Create Templates in LibreOffice to Save Time and Increase Productivity
======
Creating a template in [LibreOffice][1] can save you some time for the documents that you use often. It can be a letter, a financial spreadsheet or even a presentation.
Time is one factor that a template can save and on the other hand it provides consistency where a group of people in an organization work together at the same project.
For example, if you are a small organization that has to often issue certificates of experience, instead of copy-pasting from a saved document somewhere, you can create a template. When you need to issue a new certificate of experience, you create a new one from the template, edit it slightly and you are good to go.
LibreOffice comes with a few templates by default but you are not restricted to use just them. You are free to create your own as per your requirements.
I think templates are one of the [essential LibreOffice tips][2] that every user should know. Let me show you how to do it.
### How to create a template in LibreOffice
First, create the document that you want to reuse with minimal editing. It could be a document, spreadsheet or presentation. I am using a word document in the example but the steps are the same for all of them.
Now go to file and select Save as Template. You will be prompted to give a name and a category from the menu, the press save.
![Creating a new template in LibreOffice][3]
This file will be saved in the LibreOffice template folder in .ots format. You can use these .ots files on other systems that have LibreOffice installed and use the same templates on those systems as well.
### How to use templates in LibreOffice
To use a template, select File and then Templates.
Dont worry! Opening a template LibreOffice creates a copy without affecting the original template. You can edit the document without worrying about your template getting changed.
![Using templates][4]
Once you choose your template, click open. You can edit it as you like.
### How to change a template in LibreOffice
Needs may change from time to time and adjustments to your templates can be necessary.
To edit an existing template go to File -> Templates and then right click on the desired template and click edit.
![edit Template][5]
When you finish editing the template, click on save to make the changes permanent.
**Recommended Read:**
![][6]
#### [7 LibreOffice Tips To Get More Out of It][2]
LibreOffice is an excellent office suite. These LibreOffice tips will enable you to use it more effectively.
All in all templates are great not only at reducing the workload on repetitive tasks but also for user mistake proofing. You can take advantage of your computers ability to handle a repetitive task but with flexibility. It increases your efficiency.
Bonus Tip!
You can find tons of additional templates on the [LibreOffice website][7]. You can search for the ones you need, download them and use them. Be advised that these are from third-party, unverified users. So use them at your risk.
Ill keep on sharing more such tips in future. Meanwhile, you may also learn about creating templates to [add the “create new document” option in the right click menu context in GNOME][8].
--------------------------------------------------------------------------------
via: https://itsfoss.com/create-templates-libreoffice/
作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/
[b]: https://github.com/lujun9972
[1]: https://www.libreoffice.org/
[2]: https://itsfoss.com/libreoffice-tips/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.Template-save-as.png?resize=800%2C567&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.Use-a-template.png?ssl=1
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.edit-template.png?ssl=1
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/LibreOffice-logo.jpeg?fit=800%2C450&ssl=1
[7]: https://extensions.libreoffice.org/templates
[8]: https://itsfoss.com/add-new-document-option/

View File

@ -0,0 +1,117 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using data from spreadsheets in Fedora with Python)
[#]: via: (https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/)
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
在 Fedora 中使用 Python 读取电子表格中的数据
======
![][1]
[Python][2] 是最流行、功能最强大的编程语言之一。由于它是免费和开源的,因此每个人都可以使用。大多数 Fedora 系统都已安装了该语言。Python 可用于多种任务,其中包括处理逗号分隔值(**CSV**数据。CSV 文件通常作为表格启动。本文介绍了如何在 Python 3 中处理 CSV 数据。
CSV 数据正是它听起来的样子。CSV 文件一次包含一行数据数值之间用逗号分隔。每行由相同的_字段_定义。简短的 CSV 文件通常易于阅读和理解。但是较长的数据或具有更多字段的数据文件可能很难用肉眼解析,因此在这种情况下计算机做得更好。
这是一个简单的示例,其中的字段是 _Name _、_ Email_ 和 _Country_。在此例中CSV 数据将字段定义作为第一行,尽管并非总是如此。
```
Name,Email,Country
John Q. Smith,jqsmith@example.com,USA
Petr Novak,pnovak@example.com,CZ
Bernard Jones,bjones@example.com,UK
```
### 从电子表格读取 CSV
Python 包含了一个 _csv_ 模块,它可读取和写入 CSV 数据。大多数电子表格应用,无论是原生(例如 Excel 或 Numbers还是基于 Web 的(例如 Google Sheet都可以导出 CSV 数据。实际上,许多其他可发布表格报告的服务也将导出为 CSV例如PayPal
Python _csv_ 模块有一个名为 _DictReader_ 的内置读取器方法,它可以将每个数据行作为有序字典 OrderedDict 处理。它需要一个文件对象访问 CSV 数据。因此,如果上面的文件在当前目录中为 _example.csv_,那么以下代码段是获取此数据的一种方法:
```
f = open('example.csv', 'r')
from csv import DictReader
d = DictReader(f)
data = []
for row in d:
data.append(row)
```
现在,内存中的 _data_ 对象是 OrderedDict 对象的列表:
```
[OrderedDict([('Name', 'John Q. Smith'),
('Email', 'jqsmith@example.com'),
('Country', 'USA')]),
OrderedDict([('Name', 'Petr Novak'),
('Email', 'pnovak@example.com'),
('Country', 'CZ')]),
OrderedDict([('Name', 'Bernard Jones'),
('Email', 'bjones@example.com'),
('Country', 'UK')])]
```
引用这些对象很容易:
```
>>> print(data[0]['Country'])
USA
>>> print(data[2]['Email'])
bjones@example.com
```
顺便说一句,如果你需要处理没有字段名标题行的 CSV 文件,那么 _DictReader_ 类可以让你定义它们。在上面的示例中,添加 _fieldnames_ 参数并传递一系列名称:
```
d = DictReader(f, fieldnames=['Name', 'Email', 'Country'])
```
### 真实例子
我最近想从一长串人中随机选择一名赢家。我从电子表格中提取的 CSV 数据是一个简单的名称和邮件地址列表。
幸运的是Python 有一个有用的 _random_ 模块,可以很好地生成随机值。该模块 _Random_ 类中的 _randrange_ 函数正是我需要的。你可以给它一个常规的数字范围(例如整数),以及它们之间的步长值。然后,该函数会生成一个随机结果,这意味着我可以在数据的总行数范围内获得一个随机整数(或行号!)。
这个小程序运行良好:
```
from csv import DictReader
from random import Random
d = DictReader(open('mydata.csv'))
data = []
for row in d:
data.append(row)
r = Random()
winner = data[r.randrange(0, len(data), 1)]
print('The winner is:', winner['Name'])
print('Email address:', winner['Email'])
```
显然这个例子非常简单。电子表格本身包含了复杂的分析数据的方法。但是如果你想在电子表格应用之外做某事Python 或许是一种技巧!
* * *
_由 [Isaac Smith][3] 拍摄,发表于 [Unsplash][4]。_
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/
作者:[Paul W. Frields][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/pfrields/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/spreadsheets-python-816x345.jpg
[2]: https://python.org
[3]: https://unsplash.com/@isaacmsmith?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://unsplash.com/s/photos/spreadsheets?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText