在这篇文章中,我们将带领您了解Ubuntunotes的全貌,同时,我们还将为您介绍有关/notes/create/处的NoReverseMatch与'notes_list'反向未找到参数尝试了1个模式
在这篇文章中,我们将带领您了解Ubuntu notes的全貌,同时,我们还将为您介绍有关/ notes / create /处的NoReverseMatch与'notes_list'反向未找到参数尝试了1个模式:['notes / list /?? P <用户名> [^ /] +$']、apt-get update 失败 ubuntu:Tempory failure resolving 'cn.archive.ubuntu.com ubuntu、Beginning Linux Programming Notes: Working with Files、Compilers Notes: 01的知识,以帮助您更好地理解这个主题。
本文目录一览:- Ubuntu notes
- / notes / create /处的NoReverseMatch与'notes_list'反向未找到参数尝试了1个模式:['notes / list /?? P <用户名> [^ /] +$']
- apt-get update 失败 ubuntu:Tempory failure resolving 'cn.archive.ubuntu.com ubuntu
- Beginning Linux Programming Notes: Working with Files
- Compilers Notes: 01
Ubuntu notes
ubuntu notes
Table of Contents
- 1. backup data
- 2. Basics Ubuntu
- 3. Install,uninstall packages
- 4. Basic Unix
- 5. Glossary
-
6. FAQ
- 6.1. sudo: unable to resolve host 127.0.0.1localhost
- 6.2. check packages installed
-
6.3. Ubuntu on lenovo ideapad 100s
- 6.3.1. system does not have any USB boot option,please select other boot option in Boot manager menu
- 6.4. killing unnecessary processes
- 6.5. Image Converter
- 6.6. images to video
-
7. screen recording on Ubuntu
-
- 7.0.1. byzanz
-
-
8. Packages
- 8.1. extract a page from a multiple pages pdf
- 8.2. Mendeley
- 8.3. Light Ubuntu OS
- 8.4. Python
- 8.5. Octave: matlab alternative
- 8.6. video Download
- 8.7. Transmission
- 8.8. PDF viewer
- 8.9. Tor Browser on Ubuntu 16.04
-
8.10. Thunderbird
- 8.10.1. office 365
- 8.10.2. add Gmail account to thunderbird
- 8.11. To set up Thunderbird to sync to your Outlook.com account’s email:
- 8.12. Outlook 365
- 9. Update
-
10. Chinese input
- 10.1. fcitx
- 10.2. Sougou input
-
11. Resilio sync
- 11.1. installation
- 11.2. reset my WebUI password
-
12. Commands
- 12.1. make
-
13. Package Manager
- 13.1. dpkg
-
14. BEM code
- 14.1. compiling
- 15. Introduction
- 16. update
- 17. Resilio sync
- 18. change directory
- 19. list files
- 20. copy,delete and remove
- 21. SSH Shell
-
22. file format
- 22.1. Bourne Shell Script
-
23. Error Log
- 23.1. -bash: ./foo.sh: Permission denied.
- 23.2. When adding shared folder with btsync: “Don‘t have permissions to write to selected folder”
- 24. FAQ
1 backup data
CHAPTER 32 backing Up Data,Keir Thomas,Beginning Ubuntu linux
packages:
- Simple Backup Suite (SBackup
- tar
2 Basics Ubuntu
extract .tar.gz
file in Ubuntu
Compress an Entire Directory or a Single File
tar cvzf example.tar.gz /path/to/directory
-c: Create an archive -z: Compress the archive with g*z*ip -v: dispaly progress in the terminal -f: specify the *f*ilename of the archive
Extract an Archive
tar -xzvf archive.tar.gz
cutting,copying and pasting in terminal Ubuntu X #cutting C # copying Ctrl+Shift+V #pasting
3 Install,uninstall packages
sudo apt-get install packagename
sudo apt-get remove packagename
sudo apt-get purge packagename #remove package and dependencies
https://www.wikihow.com/Uninstall-Ubuntu-Software
4 Basic Unix
-
pwd
#print Working Directory -
ls
#prints filenames in a list - ls -a #prints all filenames,including hidden files
- ls -l #‘long‘ list,displays info including permissions.
- ls -h #prints the sizes of files in units you can read
- ls -tr #t for time sorted,r for reverse
- cd ~/ # return to
home directory
- cd ../ # move up one directory
- mkdir [foldername] # make directory
5 Glossary
- PPA
- personal package archives
6 FAQ
6.1 sudo: unable to resolve host 127.0.0.1localhost
solution:
$ vim /etc/hostname Ubuntu $ vim /etc/hosts 127.0.0.1 localhost Ubuntu
6.2 check packages installed
use dpkg,a package manager for Ubuntu
To check a specified package:
$ dpkg -s [package name]
To list all packages:
$ dpkg-query -l
6.3 Ubuntu on lenovo ideapad 100s
default windows,UEFI,only allow to disable secure boot,
- do not have BIOS compatibility mode
- Turn off the machine
- Press the recovery button next to the HDD light.
- Select BIOS Setup
- In configuration,turn off Secure boot,select Reset to Setup Mode.
- Press F10 to save and exit.
- Turn off the machine again,press the recovery button.
- Select Boot Menu
- Select Ubuntu under EFI Boot Devices.
6.3.1 system does not have any USB boot option,please select other boot option in Boot manager menu
6.4 killing unnecessary processes
keywords: background process,kill
To list all processes:
- ps -ef
From the terminal,ps -ef
will list all the processes. See man ps. See man kill,man 2 kill,man killall,man nice,man pkill,man renice,man 7 signal,and man skill to mess with processes. However,simply killing a process that you think is useless may be a mistake. The system might restart the process,or something you depend on might depend on the process you killed. Learn what the processes do,and look at etc/init and /etc/init.d,/etc/rc?.d,man service to see how processes are started by the system.
6.5 Image Converter
change image format
eps to pdf > epstopdf package > epstopdf [options] [epsfile]
6.6 images to video
use avconv
Syntax:
avconv [global options] [[infile options][‘-i’ infile]]... {[outfile options] outfile}
e.g.
avconv -r 10 -startnumber 8 -i filename_%d.png -b:v 1000k test.mp4
avconv -i v_%d.png -b:v 1000k veLocity.mp4
- i
- input file
- b
- bitrate
https://libav.org/avconv.html https://stackoverflow.com/questions/16315192/avconv-make-a-video-from-a-subset-on-images
7 screen recording on Ubuntu
packages:
- byzanz
- kazam
-recordmydesktop https://www.ubuntupit.com/15-best-linux-screen-recorder-and-how-to-install-those-on-ubuntu/ https://fedoraproject.org/wiki/ScreenCasting
7.0.1 byzanz
To record full screen on a 24 inch monitor:
$byzanz-record --duration=10 -c --width=1920 --height=1080 test1.gif
- 1080p=1920*1080
- coordinates start from the left corner
byzanz-record -d 20 -c -x 0 -y 0 -w 700 -h 550 -v out.gif
where -d : duration : 20 seconds to be recorded -c : cursor also to be recorded -x : left co-ordinate of the recording rectangle -y : right co-ordinate of the recording rectangle -w : width of the recoding rectangle -h : height of the recording rectangle -v : verbose output out.gif : output file name
To launch a terminal $ byzanz-record –help
which returns:
************* Usage: byzanz-record [OPTION...] record your current desktop session Help Options: -?,--help Show help options --help-all Show all help options --help-gtk Show GTK+ Options Application Options: -d,--duration=SECS Duration of animation (default: 10 seconds) --delay=SECS Delay before start (default: 1 second) -l,--loop Let the animation loop -c,--cursor Record mouse cursor -x,--x=PIXEL X coordinate of rectangle to record -y,--y=PIXEL Y coordinate of rectangle to record -w,--width=PIXEL Width of recording rectangle -h,--height=PIXEL Height of recording rectangle -v,--verbose Be verbose --display=disPLAY X display to use ****************
Three shell scripts:
- byzanz-record-window –> to select a window for recording
- byzanz-record-region –> to select a part of the screen for recording
- a simple GUI front-end for 1,by MHC
https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/
https://wiki.ubuntu.com/CreatingScreencasts
8 Packages
To check xxPackage installation path
dpkg -L <packagename>
the terminal responding as:
/usr/lib/paraview/
8.1 extract a page from a multiple pages pdf
use pdftk
package
pdftk full-pages.pdf cat 1 output outfile_1.pdf
in the above command,input file is full-pages.pdf
,you extract page 1 and save it as outfile_1.pdf
8.2 Mendeley
https://www.mendeley.com/guides/download-mendeley-desktop/ubuntu/instructions
8.3 Light Ubuntu OS
linux lite
Lubuntu
8.4 Python
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get
8.5 Octave: matlab alternative
https://www.gnu.org/software/octave/
8.6 video Download
you-get
package To upgrade you-get
: > $ pip3 install –upgrade you-get
e.g.
$ you-get -i ‘https://www.youtube.com/watch?v=jNQXAC9IVRw‘
then you can see all formats and their corresponding tags,download a specified video format.
$ you-get –itag=18 ‘https://www.youtube.com/watch?v=jNQXAC9IVRw‘
8.7 Transmission
download a BitTorrent https://help.ubuntu.com/community/TransmissionHowTo#Transmission
8.8 PDF viewer
Okular set default pdf viewer
8.9 Tor browser on Ubuntu 16.04
sudo add-apt-repository ppa:webupd8team/tor-browser
sudo apt-get update
sudo apt-get install tor-browser https://www.linuxbabe.com/desktop-linux/install-tor-browser-on-ubuntu-16-04-via-ppa
8.10 Thunderbird
8.10.1 office 365
8.10.2 add Gmail account to thunderbird
- first enable IMAP on your Gmail account. See Gmail‘s instructions for help. (IMAP is enabled on new Gmail accounts by default.)
On your computer,open Gmail. In the top right,click Settings Settings. Click Settings. Click the Forwarding and POP/IMAP tab. In the "IMAP Access" section,select Enable IMAP. Click Save Changes.
- Step 2: Change SMTP & other settings in your email client
File > New > Existing Mail Account
The "Mail Account Setup" dialog is displayed. After you provide your account information (real name,email address and password),Thunderbird will automatically configure your Gmail connection. Click Done,sign in with your Google account if prompted and that‘s all! Thunderbird will download your existing messages and your Gmail will be ready to use.
Use the table below to update your client with the correct information. For help updating your settings,search your email client‘s Help Center for instructions on setting up IMAP.
Incoming Mail (IMAP) Server:
imap.gmail.com
Requires SSL: Yes
Port: 993
Outgoing Mail (SMTP) Server
smtp.gmail.com
Requires SSL: Yes
Requires TLS: Yes (if available)
Requires Authentication: Yes
Port for SSL: 465
Port for TLS/STARTTLS: 587 Full Name or display Name Your name Account Name,User name,or Email address Your full email address Password Your Gmail password
https://support.mozilla.org/en-US/kb/thunderbird-and-gmail
8.11 To set up Thunderbird to sync to your outlook.com account’s email:
- Open Thunderbird.
- From the Application menu,choose Add Account…
- Input your account information,choose Options… then Account Settings…
- Click the Account Actions button,then choose Add Mail Account…
- Input your account information.
- Click Continue.
- Click Manual config.
- Set the Incoming settings as follows:
a. Server hostname: imap-mail.outlook.com. (smtp.office365.com)
b. Port: 993.
c. SSL: SSL/TLS.
d. Authentication: normal password.
- Set the Outgoing settings as follows:
a. Server hostname: smtp-mail.outlook.com. (smtp.office365.com)
b. Port: 587.
c. SSL: STARTTLS.
d. Authentication: normal password.
- Click Done.
For more information on connecting your app to outlook.com,visit this link: http://windows.microsoft.com/en-us/windows/outlook/send-receive-from-app.
8.12 Outlook 365
- Start your Thunderbird client.
- Go to Tools and then Account Settings…
- Select Account Actions and then Add Mail Account…
- Enter Your name and your QMUL Email address (eg [email protected]) and QMUL Password.
- Don’t forget to tick the Remember password option before clicking Continue.
- If successful you will be able to click Done to complete the email set up and start using your account.
- Thunderbird may not automatically find the settings and the following error message will appear:
‘Thunderbird Failed to find the settings for your email account.‘
- Amend Incoming IMAP server hostname to ‘outlook.office365.com’ and Outgoing SMTP to ‘smtp.office365.com’.
- Change the Incoming port to 993 and the Outgoing port to 587.
- Change the Incoming SSL to ‘SSL/TLS’ and the Authentication to ‘normal Password’,and the Outgoing SSL to ‘Autodetect’ and Authentication to ‘Autodetect’.
- Amend the entry for Username to your QMUL username including the ‘@qmul.ac.uk‘ suffix (eg [email protected]).
- Click Re-Test.
13 .Click Done to complete the email set up and start using your account.
http://www.its.qmul.ac.uk/support/self-help/email_setup/settingupemail/thunderbird/
9 Update
sudo apt update && sudo apt upgrade
10 Chinese input
10.1 fcitx
- install fcitx
sudo apt install fcitx fcitx-googlepinyin
- After that,launch Language Support utility and select use Fcitx:
- Finally restart your computer and you’ll see a keyboard icon in panel. Go to Configure (see menu in the top picture) and do:
click the bottom left plus icon. uncheck “show current language” scroll down and choose an IM you want finally click OK.
10.2 Sougou input
Install fcitx > sudo apt install fcitx fcitx-googlepinyin fcitx-table-wbpy fcitx-pinyin fcitx-sunpinyin
http://ubuntuhandbook.org/index.php/2016/07/2-best-chinese-pinyin-im-ubuntu-16-04/
11 Resilio sync
11.1 installation
https://www.linuxbabe.com/ubuntu/install-resilio-sync-ubuntu-16-04-16-10
11.2 reset my WebUI password
To reset login and password settings,follow these steps:
- Quit Sync and close WebUI.
- Go to the Sync storage folder Linux packages:
var/lib/resilio-sync if launched as default rslsync user. /home/username.config/resilio-sync/storage if launched as current user.
- Locate and remove the following files:
settings.dat settings.dat.old
- Once the files are removed,restart Sync,open WebUI and enter your new login and password.
12 Commands
- chmod
- is the command and system call which may change the access permissions to file system objects.
- systemctl
- Control the systemd system and service manager
12.1 make
- make
- a build automation tool that automatically builds
executable programs and libraries from source code
13 Package Manager
13.1 dpkg
- dpkg
-
a package manager for
Debian-based
systems.It can install,remove,and build packages,but unlike other package management systems,it cannot automatically download and install packages or their dependencies.
- (no term)
- you can install a local .deb ile by entering:
sudo dpkg -i example.deb
Change=example.deb=to the actual file name of the local .deb file you wish to install.
2 . Uninstalling a package can be accomplished by:
sudo dpkg -r zip
Uninstalling packages using dpkg,in most cases,is NOT recommended. It is better to use a package manager that handles dependencies to ensure that the system is in a consistent state. For example using dpkg -r zip will remove the zip package,but any packages that depend on it will still be installed and may no longer function correctly.
https://help.ubuntu.com/lts/serverguide/dpkg.html.en
14 BEM code
14.1 compiling
>f95 waketudk.f dynaero.f #compile TUDK model >f95 wakegh.f dynaero.f # GH model
15 Introduction
16 update
sudo apt-get update # Fetches the list of available updates sudo apt-get upgrade # Strictly upgrades the current packages sudo apt-get dist-upgrade # Installs updates (new ones)
17 Resilio sync
https://www.linuxbabe.com/ubuntu/install-resilio-sync-ubuntu-16-04-16-10
Installing Resilio Sync on Ubuntu 16.04 and Ubuntu 16.10 via Official Repository
Open up a terminal window and edit the sources.list file with nano or your preferred text editor.
>> sudo nano /etc/apt/sources.list
Append the following APT line at the end of this file.
>> deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free Save and close the file.
In order for APT to authenticate packages from the above repository,we need to import Resilio Sync’s public key. First download the public key with wget.
>> wget https://linux-packages.resilio.com/resilio-sync/key.asc
Then import the public key with apt-key.
>> sudo apt-key add key.asc
update local package index and install Resilio Sync.
>> sudo apt update
>> sudo apt install resilio-sync
Managing Resilio Sync
To start Resilio Sync,use systemctl command.
sudo systemctl start resilio-sync
And enable auto start at boot time using the following command:
sudo systemctl enable resilio-sync
Check its status.
systemctl status resilio-sync
jack Ali
18 change directory
cd #change directory format: cd [option] [directory] cd ./ #current folder cd .. # upper folder cd ~ #home directory pwd #print working directory mkdir #make directory rmdir #remove directory cd - #last directory
19 list files
ls #list files/folder in the current directory
20 copy,delete and remove
cp #copy rm #remove mv #move
21 SSH Shell
Working with the Shell
22 file format
22.1 Bourne Shell Script
extension: .sh
23 Error Log
23.1 -bash: ./foo.sh: Permission denied.
I have a script called foo.sh in my home folder.
When I navigate to this folder,and enter ./foo.sh,I get
-bash: ./foo.sh: Permission denied.
When I use sudo ./foo.sh,I get
sudo: foo.sh: command not found.
Why does this happen and how I can fix it?
23.2 When adding shared folder with btsync: “Don‘t have permissions to write to selected folder”
If your btsync is run by the user named btsync,you should actually add your folder‘s owner to btsync:
chown -R btsync foldername
Or if you‘re using resilio you should change folder owner to relsync:
chown -R rslsync foldername
24 FAQ
Author: kemina
Created: 2019-03-19 Tue 22:26
Emacs 24.5.1 (Org mode 8.2.10)
Validate
/ notes / create /处的NoReverseMatch与'notes_list'反向未找到参数尝试了1个模式:['notes / list /?? P <用户名> [^ /] +$']
如何解决/ notes / create /处的NoReverseMatch与''notes_list''反向未找到参数尝试了1个模式:[''notes / list /?? P <用户名> [^ /] +$'']
我不知道如何在侧边栏中添加用户注释列表的链接。
错误出现在模板的以下几行
pages / base_stuff / side_bar.html。我想在给定模板中添加链接,以便可以将用户重定向到usernotes_list模板
<li>
<a href="{%url ''notes:notes_list'' notes.author.username %}">
<i></i> <spanfont-weight: normal;''>Your Notes</span>
</a>
</li>
notes / urls.py
app_name = ''notes''
urlpatterns = [
path(''list/<str:username>'',views.NotesListView.as_view(),name=''notes_list''),]
notes / views.py
class NotesListView(LoginrequiredMixin,ListView):
login_url = ''/accounts/login/''
model = Notes
context_object_name = ''notes_data''
# paginate_by =
def get_queryset(self):
user = get_object_or_404(auth.models.User,username=self.kwargs.get(''username''))
return Notes.objects.filter(author=user).order_by(''-create_date'')
notes / models.py
class Notes(models.Model):
author = models.ForeignKey(auth.models.User,on_delete=models.CASCADE)
title = models.CharField(max_length=150)
essay = models.TextField()
create_date = models.DateTimeField(default=timezone.Now)
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse("notes:notes_detail",kwargs={"pk": self.pk})
pages / base_stuff / side_bar.html
{% load static %}
<aside>
<!-- sidebar: style can be found in sidebar.less -->
<section>
<!-- Sidebar user panel -->
<div>
<div>
<img src="{{ user.userprofile.avatar.url }}"alt="User Image" />
</div>
<div>
<p>{{ user.username }}</p>
<a href="#">{% if user.is_active %}<i></i> Online {% else %}<i></i> Offline {% endif %}</a>
</div>
</div>
<!-- search form -->
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul>
<li>MAIN NAVIGATION</li>
<li>
<a href="{% url ''test'' %}">
<i></i> <spanfont-weight: normal;''>Home</span>
</a>
</li>
<li>
<a href="#">
<i></i>
<spanfont-weight: normal;''>Courses</span>
</a>
</li>
<li>
<a href="{% url ''videos:videos_playlist'' %}">
<i></i> <spanfont-weight: normal;''>Videos</span>
</a>
</li>
<li>
<a href="{%url ''notes:notes_create''%}">
<i></i> <spanfont-weight: normal;''>Create Note</span>
</a>
</li>
<li>
<a href="{%url ''notes:notes_list'' %}">
<i></i> <spanfont-weight: normal;''>Your Notes</span>
</a>
</li>
<li>
<a href="{%url ''quiz:home''%}">
<i></i>
<spanfont-weight: normal;''>Quiz</span>
</a>
</li>
{% if user.is_superuser %}
<li>
<a href="{% url ''admin:index'' %}">
<i></i> <spanfont-weight: normal;''>Admin</span>
</a>
</li>
{% endif %}
<li>
<a href="{% url ''about'' %}">
<i></i> <spanfont-weight: normal;''>About</span>
</a>
</li>
<li>
<a href="pages/calendar.html">
<i></i> <spanfont-weight: normal;''>Contact</span>
</a>
</li>
</section>
解决方法
您尚未在使用该链接的行处传递参数。也是这样:
<li>
<a href="{% url ''notes:notes_list'' user.username %}">
<i></i> <spanfont-weight: normal;''>Your Notes</span>
</a>
</li>
,
正如您在评论中所说,如果要在模板中显示当前用户的注释列表,则可以尝试这样。
class NotesListView(LoginRequiredMixin,ListView):
login_url = ''/accounts/login/''
model = Notes
context_object_name = ''notes_data''
# paginate_by =
def get_queryset(self):
return Notes.objects.filter(author=self.request.user).order_by(''-create_date'')
现在,您无需从网址中传递多余的用户名参数
path(''list/user/notes/'',views.NotesListView.as_view(),name=''notes_list''),
还有模板中的网址
<a href="{% url ''notes:notes_list'' %}">
apt-get update 失败 ubuntu:Tempory failure resolving 'cn.archive.ubuntu.com ubuntu
当运行apt-get update后出现如下错误时:E: Some index files Failed to download,they have been ignored,or old ones used instead.
可以将目录下/var/lib/apt/lists/partial/所有的文件清掉,再次运行apt-get update即可!自带源在大陆不好。
出现以下错误:
ubuntu:Tempory failure resolving ''cn.archive.ubuntu.com ubuntu
1,重启生效:
sudovi/etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)
在里面插入:
nameserver8.8.8.8
nameserver8.8.4.4
如果有多个DNS就一行一个
修改好保存,然后执行
sudoresolvconf-u
再看/etc/resolv.conf,最下面就多了2行:
cat/etc/resolv.conf
#Dynamicresolv.conf(5)fileforglibcresolver(3)generatedbyresolvconf(8)
#DONOTEDITTHISFILEBYHAND--YOURCHANGESWILLBEOVERWRITTEN
可以看到我们的设置已经加上了,然后再ping一个域名,当时就可以解析了,无需重启。
2,重启失效:
配置文件地址 /etc/resolv.conf
使用编辑器打开
改为如下内容:
search localdomain
nameserver 202.96.128.86 希望修改成的DNS
nameserver 202.96.128.166 备用DNS
重启网络:sudo /etc/init.d/networking restart。即可
Beginning Linux Programming Notes: Working with Files
Linux中几乎任何东西都是文件,包括设备。常用的一些设备:
- /dev/null
- /dev/stdin
- /dev/stdout
Sys Call
System Call Manage Files
- lseek
- stat/fstat/lstat return values into a stat struct
- dup/dup2
- fopen/fclose
- fread/fwrite
- fflush
- fseek
- fgetc/getc/getchar(stdin)
- fputc/putc/puchar(stdout)
- fgets/gets
- printf/fprintf/sprintf
- scanf/fscanf/sscanf
/proc 文件
- /proc/PID
- /proc/cpuinfo
fcntl/mmap
Compilers Notes: 01
compilers outline:
1.Lexical Analysis
2.Parsing
3.Semantic Analysis
4.Optimization
5.Code Generation
1&2 语法
3 type, scope
5 translation to machine code, byte code or another language
关于Ubuntu notes的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于/ notes / create /处的NoReverseMatch与'notes_list'反向未找到参数尝试了1个模式:['notes / list /?? P <用户名> [^ /] +$']、apt-get update 失败 ubuntu:Tempory failure resolving 'cn.archive.ubuntu.com ubuntu、Beginning Linux Programming Notes: Working with Files、Compilers Notes: 01的相关知识,请在本站寻找。
本文标签: