- First make sure, two server can ping to each other.
- Turn on forwarding by editing
/etc/sysctl.conf: change net.ipv4.ip_forward to 1
- Turn off the iptables service by command
service iptables stop
Normal port forwarding Aim: Connect b port on B server through a port on A server. Use bash to execute1234iptables -t nat -A PREROUTING -d A.A.A.A -p tcp --dport a -j DNAT --to-destination B.B.B.B:biptables -t nat -A POSTROUTING -d B.B.B.B -p tcp --dport b -j SNAT --to B.B.B.Biptables -A FORWARD -o virbr0 -d B.B.B.B -p tcp --dport b -j ACCEPTiptables -A FORWARD -i virbr0 -s B.B.B.B -p tcp --sport b -j ACCEPT
Reference Port forwarding in Centos
Ftp port forwarding
- Load ftp module123modprobe iptable_natmodprobe ip_conntrack_ftpmodprobe ip_nat_ftp
- Aim connect 21 port on B through a port on A123iptables -t nat -A POSTROUTING -d B.B.B.B -p tcp --dport 21 -j MASQUERADEiptables -t nat -A PREROUTING -d A.A.A.A -p tcp --dport a -j DNAT --to-destination B.B.B.B:21
- Save rules in iptable by
service iptables save
- Start iptable service by
service iptables start
Reference Ftp forwarding
- Load ftp module
YalongYang's Blog A fantastic place for all possible things.
- SNV is a centralized version control system.
- SNV has a configuration file for each project to configure the access right for different developers.
Multiple Project configuration Sometime, use one configuration for all file is easier for management. We will use this method in this post.
- Choose a directory as the root, for instance
- Create the code repository by command
svnadmin create /opt/svn/repos/project2
Configure access right
- create account file
/opt/svn/repos/with the following:123[users]test1 = test1test2 = test2
authzwith the following:1234567891011[aliases][groups]admin = test1,test2[/]@admin = wr* =[project1:/]@admin = wr* = r
This file presents admin group has test1 and test1 two users.
[/]part stands admin group has the write and read access right for all projects.
[project1:/]stands admin group has the write and read access of project1 while other developers only have read access right.
- Make project configuration point to the overall configuration Change
/opt/svn/repos/project1/conf/svnserve.confto the following:No blanks in front for all lines, otherwise, it will cause svnserve.conf: Option expected error.1234[general]password-db = ../../passwdauthz-db = ../../authz[sasl]
- create account file
- Choose a directory as the root, for instance
The common errors for configuring EmguCV could be:
Do not configure the OpenCv environment The EmguCV is only a C# wrapper for OpenCv, so we need to load OpenCv's libraries.
- add related OpenCv libraries to path
- copy related OpenCv libraries to execution directory
- configure execution directory in Visual Studio
The three ways all aim the same thing, let EmguCV find OpenCv libraries.
For example, I use the 2.4.2 EmguCV, so the libraries in
Emgu\emgucv-windows-x64-gpu 184.108.40.2067\bin\x64\are the needed OpenCv libraries.
Graphic card This problem is caused by non-nvidia machines.
You can build a no-gpu version of EmguCV yourself, or just search for a nvcuda.dll and put in the execution directory.
Please make sure you find the correct nvcuda.dll realted to your system (WindowsXp, Windows7 or Windows8)
.Net version 2.4.2 cannot run under .Net 4.5 project, it can run on .Net 4.0. Other versions are not tested.
Hope this could help some other people.
Additional resources: Official Help
The main function could be listed as:
- Multiple thread downloading
- Continue transferring from breakpoint
- Multiple downloading task
- ipv4 & ipv6 full support
In my project, I find some problems in downloading big file in WinRt:
- HttpConnection will be closed forcedly even when the download is not finish
- The initial process will cost to much time
It is because I am not too familiar with the http headers. The solutions are:
For HttpConnection Change the KeepAlive to false
For initialization Use await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) to indicate we only want the header first.
In WinRt C#, there are 3 methods for downloading files through http:
There is a post in StackOverFlow : Download file in winrt, use HttpClient or HttpWebRequest or BackgroundDownloader?
The summary of this post could be:
- HttpClient can change Range in http header, but it cannot get the process of the downloading
- HttpWebRequest can get the process of the downloading, but it cannot change Range in http header
- BackgroundDownloader can change Range in http header and get the process of the downloading Cookies, but it cannot change Cookies.
I think there might be some small problems in the post.
Anyway, in my project, I need to download file in multiple thread, so I need to
- Change the Range in http header
- Write the downloading data to one file
The BackgroundDownloader can only writing one file for one thread. So I decide to use HttpClient to implement my tool and handle the process manually.
PS： In HttpRequestMessage, use Headers.Add("Range", "XXX-XXX") to declare which part you want to downlaod.
After using yum to install the transmission on Centos, the whitelist is turned on and only
127.0.0.1 can access to transmission.
This default setting is quite weird.
The error when you access it from remote will be:
You could add your ip address in the whitelist for remote access, however, the ip address will always change, so maybe turn off the whitelist is a better way.
Turn off transmission
"rpc-whitelist-enabled": true, to
This is my assignment in "Advanced Operating System" which ask me to implement Lazy Page Allocation manually in xv6 OS.
Lazy Page Allocation is only allocate memory when it is necessary.
Turn off page allocation in xv6
Change sys_sbrk() in
In this part, we returned the origin memory address as the result and comment the page allocation call.
Meanwhile, we increase the sz which is the way we cheat the process that it got the enough resources.
After the change, we could test in Terminal, the result shuold be:
That's the evidence, the process do not get the resources it wanted so it cannot process.
Implement lazy page allocation
We need to use int mappages(pde_t pgdir, voidva, uint size, uint pa, int perm) from
trap.c to allocate memory, so we should not keep the function static.
After that, we use extern to declare the function in
void trap(struct trapframe *tf) in
trap.c is the function to handle the process of this interruption.
The default: part will handle the PAGEBREAK trap, we should add our implementation here:
rcr2() is the call to get the start memory address of this process, newsz is the cheated memory address (the amount of memory needed by the process).
There must be something I do not understand clearly ...
This is my assignment in "Advanced Operating System" which ask me to add a halt system call to xv6 OS.
The procedures are listed as:
Add implementation in kernel mode
add a function in
This is the real implementation of halt.
Add interface in user mode
add the halt function to the user mode function list
syscall.hdefine SYS_halt：1#define SYS_halt 22
syscall.cuse 'extern int sys_halt(void);' to declare the existing function.
Meanwhile, add [SYS_halt] sys_halt, to static int (*syscalls)(void) in
syscall.cto build the function map.
Add interface Add int halt(void); in
user.hand SYSCALL(halt) in
I always want to get a Kindle, and now the Paperwhite has the backlight function, I cannot wait any more.
At first, I want to order one through Taobao, but all the stores need to wait until late November.
I do not want to wait any longer, so I start to search to onw in stock.
I finally find one which need 100 more RMB for stock, I think the price is reasonable and placed the order.
October 28th, I got my Kindle Paperwhite.