锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 鍦?/span>python涓敤浜庢暟鎹簱鍙鍖栫殑2D緇樺浘搴撱?/span> 浜岋紝瀹夎 http://matplotlib.org/users/installing.html 涓夛紝浜や簰妯″紡涓庨潪浜や簰妯″紡 1錛岄潪浜や簰妯″紡 鍦?/span>python shell閲岄潰鎵ц 鎵цshow涔嬪悗浼氭墦寮涓涓?/span>GUI紿楀彛鏄劇ず錛屽悓鏃朵氦浜掑懡浠や細闃誨銆?/span> 2錛屼氦浜掓ā寮?/span> matplotlib.is_interactive()鍙互鏌ョ湅褰撳墠鏄惁鍦ㄤ氦浜掓ā寮忥紱 matplotlib.pyplot.ion()鐢ㄤ簬鎵撳紑浜や簰妯″紡錛?/span> matplotlib.pyplot.ioff()鐢ㄤ簬鍏抽棴浜や簰妯″紡錛?/span> 鎵цplot涔嬪悗鎵撳紑浜嗕竴涓?/span>GUI紿楀彛錛屼氦浜掑懡浠ゆ病鏈夐樆濉烇紝緇х畫鎵ц錛?/span> 鍙互鐪嬪埌鍦ㄧ獥鍙i噷闈㈠啀鐢諱簡涓鏉$嚎銆?/span> 涔熷氨鏄湪闈炰氦浜掓ā寮忥紝闇瑕佷竴嬈$敾濂藉啀璋冪敤show鏄劇ず錛涜屼氦浜掓ā寮忓湪姣忔緇樺埗鍚庨兘鑳藉疄鏃剁湅鍒版晥鏋溿?/span> 3錛宨python鐨?/span>magic command 鍦╥python鐨?matplotlib涔熷彲浠ユ墦寮浜や簰妯″紡銆?/span> 鍦ㄤ氦浜掓ā寮忎腑濡傛灉鏌愪簺淇敼娌℃湁鑷姩鍒鋒柊錛屽彲浠ヨ皟鐢╩atplotlib.pyplot.draw()鍒鋒柊銆?/span> 鍥涳紝鍦╦upyter notebook涓嬌鐢╩atplotlib 1錛?matplotlib 浠ヤ氦浜掓ā寮忔墦寮鐙珛鐨凣UI紿楀彛錛屽鍚屼竴涓猣igure鐨勭粯鍒墮兘鑷姩鍒鋒柊鍒板搴旂殑GUI紿楀彛銆?/span> 2錛岋紖matplotlib notebook 鍚?matplotlib錛屽彧鏄細灝咷UI紿楀彛宓屽叆鍒癱ell鐨勮緭鍑恒?/span> 3錛?matplotlib inline 灝嗙粯鍒剁殑鍥捐漿鎹負闈欐佸浘鐗囧祵鍏ュ埌cell鐨勮緭鍑恒傚湪涓嶅悓鐨刢ell榪涜緇樺埗鏁堟灉涓嶄細鍙犲姞銆?/span> 浜旓紝figure鐨勫悇涓粍鎴愰儴鍒?/span> http://matplotlib.org/faq/usage_faq.html#parts-of-a-figure 鍏紝matplotlib鐨勪袱縐嶇粯鍥炬帴鍙?/span> 1錛?/span>matlab椋庢牸鎺ュ彛 鎵鏈夌殑plt鍛戒護閮戒細搴旂敤鍒拌嚜鍔ㄥ垱寤虹殑“褰撳墠”鐨?/span>figure鍜?/span>axes瀵硅薄銆備嬌鐢?/span>plt.gcf鍜?/span>plt.gca鑾峰彇“褰撳墠”鐨?/span>figure鍜?/span>axes銆?/span> 璋冪敤plt.plot([1, 2])鍗崇粯鍒跺埌鑷姩鍒涘緩鐨?/span>figure鍜?/span>axes銆?/span> 2錛岄潰鍚戝璞℃帴鍙?/span> 鏄懼紡鑾峰緱緇樺埗瀵硅薄錛屽湪鐗瑰畾瀵硅薄鎵ц鐩稿簲鎿嶄綔銆?/span> 3錛屽樊鍒?/span> 瀵逛簬綆鍗曠粯鍒朵袱縐嶆帴鍙g殑宸埆涓嶅ぇ錛屽鏉傛儏鍐甸潰鍚戝璞℃帴鍙d細鏇村悎閫傘?/span> 鍙﹀plt鐨勫緢澶氬嚱鏁伴兘鍙互鐩存帴杞負ax鐨勫嚱鏁幫紝渚嬪plt.plot() -> ax.plot()錛屼絾鏌愪簺浼氭湁宸埆錛屼緥濡?/span>plt.xlabel() -> ax.set_xlabel()銆?/span> 涓冿紝鍚勭被鍥懼艦demo http://matplotlib.org/gallery.html 鍏紝API http://matplotlib.org/api/index.html 鍙傝冿細 1錛?a >http://matplotlib.org/index.html# 2錛?a >http://matplotlib.org/faq/usage_faq.html#what-is-interactive-mode 3錛?a >http://jupyter.org 4錛?a >http://www.labri.fr/perso/nrougier/teaching/matplotlib/#introduction
5錛?a >http://nbviewer.jupyter.org/github/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/04.00-Introduction-To-Matplotlib.ipynb#Two-Interfaces-for-the-Price-of-One
plt.plot([1, 2])
plt.show()
plt.ion()
plt.plot([1, 2])


plt.plot([2, 1])
ax.plot([1, 2])
ax.plot([2, 1])
]]>
]]>
]]>
1.1, ISO C鏍囧噯鐢盜SO/IEC緇存姢寮鍙?/span>
鏈鏂扮増鏈槸C11錛屽叡鏈?9涓爣鍑嗗ご鏂囦歡銆?/span>
1.2, POSIX鏄竴緋誨垪鐢盜EEE鍒跺畾鐨勬爣鍑?/span>
POSIX鍖呮嫭ISO C鏍囧噯搴撳嚱鏁般?/span>
POSIX鏍囧噯鐨?988鐗堟湰鏄疘EEE 1003.1-1988錛岀粡榪囦慨鏀瑰悗浣滀負IEEE Std.1003.1-1990鎻愪氦ISO錛屾垚涓哄浗闄呮爣鍑咺SO/IEC 9945-1:1990,璇ユ爣鍑嗛氬父縐頒負POSIX.1銆?/span>
褰撳墠鏈鏂扮増鏈槸POSIX.1-2008錛岀敱IEEE鍜孫pen Group鍏卞悓寮鍙戙?/span>
1.3, SUS鏄疨OSIX鐨勮秴闆嗭紝鍏剁郴緇熸帴鍙e叏闆嗙О涓篨SI
The core specifications of the SUS are developed and maintained by the Austin Group, which is a joint working group of IEEE, ISO JTC 1 SC22 and The Open Group.
鍙湁閬靛驚XSI鐨勫疄鐜版墠鑳界О涓篣NIX緋葷粺銆?/span>
褰撳墠鐨勬渶鏂扮増鏈槸SUSv4銆?/span>
1.4, 鎵懼埌涓浜涚綉鍧
C11
http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=57853
POSIX.1-2008
http://pubs.opengroup.org/onlinepubs/9699919799/
https://standards.ieee.org/findstds/standard/1003.1-2008.html
SUSv4
https://www2.opengroup.org/ogsys/jsp/publications/PublicationDetails.jsp?publicationid=12310
https://en.wikipedia.org/wiki/Single_UNIX_Specification#cite_note-11
2, 闄愬埗
2.1 涓ょ闄愬埗
緙栬瘧鏃墮檺鍒跺拰榪愯鏃墮檺鍒躲?/span>
緙栬瘧鏃墮檺鍒墮氳繃澶存枃浠惰幏鍙栵紱
涓嶄笌鏂囦歡鎴栫洰褰曠浉鍏崇殑榪愯鏃墮檺鍒墮氳繃sysconf鍑芥暟鑾峰彇錛?/span>
涓庢枃浠舵垨鐩綍鐩稿叧鐨勮繍琛屾椂闄愬埗閫氳繃pathconf鍜宖pathconf鍑芥暟鑾峰彇銆?/span>
2.2 ISO C闄愬埗
閮芥槸緙栬瘧鏃墮檺鍒訛紝涓昏瀹氫箟鍦?lt;limits.h>閲岄潰銆?/span>
http://en.cppreference.com/w/c/types/limits
2.3 POSIX闄愬埗鍜孹SI闄愬埗
涔︿腑鍒楀嚭鐨勯兘鏄疄鐜頒腑蹇呴』鏀寔鐨勫悇縐嶆渶灝忓鹼紝鐗瑰畾緋葷粺瀹為檯鏀寔鐨勯檺鍒跺奸渶瑕侀氳繃澶存枃浠舵垨鑰呬笁涓嚱鏁板嚱鏁拌幏鍙栥?/span>
涓変釜鍑芥暟鐨刵ame鍙傛暟鏄檺鍒跺悕鍓嶉潰鍔燺SC_鎴栬卂PC_鍓嶇紑寰楀埌銆?/span>
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
2.4 涔︿腑浠g爜
* If name is invalid, -1 is returned, and errno is set to EINVAL.
* Otherwise, the value returned is the value of the system resource and errno is not changed.
* In the case of options, a positive value is returned if a queried option is available, and -1 if it is not.
* In the case of limits, -1 means that there is no definite limit.
*/
#include "apue.h"
#include <errno.h>
#include <limits.h>
#ifdef OPEN_MAX
static long openmax = OPEN_MAX;
#else
static long openmax = 0;
#endif
/*
* If OPEN_MAX is indeterminate, we're not
* guaranteed that this is adequate
*/
#define OPEN_MAX_GUESS 256
long
open_max(void)
{
if (openmax == 0) { /* first time through */
errno = 0;
if ((openmax = sysconf(_SC_OPEN_MAX)) < 0) {
if (errno == 0)
openmax = OPEN_MAX_GUESS; /* it's indeterminate */
else
err_sys("sysconf error for _SC_OPEN_MAX";)
}
}
return(openmax);
}
3, 閫夐」
3.1, 閫夐」紜畾鏂瑰紡
緙栬瘧鏃墮夐」瀹氫箟鍦?lt;unistd.h>涓紱
涓庢枃浠舵垨鐩綍鏃犲叧鐨勯夐」鐢╯ysconf紜畾錛?/span>
涓庢枃浠舵垨鐩綍鏈夊叧鐨勯夐」鐢╬athconf鎴栬協pathconf紜畾錛?/span>
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
3.2, 閫夐」紜畾嫻佺▼
濡傛灉絎﹀彿甯擱噺鏈畾涔夛紝
瀵筥POSIX鍓嶇紑鐨勯夐」錛屽皢_POSIX鍓嶇紑鏇挎崲涓篲SC鎴朹PC鍓嶇紑錛?/span>
瀵筥XOPEN鍓嶇紑鐨勯夐」錛屽湪_XOPEN鍓嶉潰鍔犱笂_SC鎴朹PC鍓嶇紑錛?/span>
鐒跺悗璋冪敤sysconf, pathconf鎴杅pathconf鍑芥暟銆?/span>
濡傛灉絎﹀彿甯擱噺宸茬粡瀹氫箟錛屽垯鏈変笁縐嶅彲鑳斤細
鍊間負-1錛屼笉鏀寔鐩稿簲鐨勯夐」錛?/span>
鍊煎ぇ浜?錛屾敮鎸佺浉搴旂殑閫夐」錛?/span>
鍊間負0錛岄渶璋冪敤鍑芥暟紜畾閫夐」鏄惁鏀寔銆?/span>
娉細鏌愪簺緋葷粺鍙兘鍑虹幇瀹氫箟浜嗙鍙峰父閲忥紝浣嗘病鏈夊畾涔夊肩殑鎯呭喌銆?/span>
3.4, 浠g爜紺轟緥
鍏堝崰鍧戙?/span>
4, 鍔熻兘嫻嬭瘯瀹?/span>
Feature test macros allow the programmer to control the definitions that are exposed by system header files when a program is compiled.
NOTE: In order to be effective, a feature test macro must be defined before including any header files. This can be done either in the compilation command (cc -DMACRO=value) or by defining the macro within the source code before including any headers.
see man page feature_test_macros(7).
]]>
https://shadowsocks.org/en/index.html
2, install shadowsocks server
$ sudo apt-get install python-pip
$ sudo pip install shadowsocks
https://shadowsocks.org/en/download/servers.html
3, shadowsocks server config file
$ vi /etc/shadowsocks.json
{
"server":"my_server_ip",
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":600,
"method":"table"
}
https://shadowsocks.org/en/config/quick-guide.html
4, shadowsocks server command
$ ssserver -h // help message
$ ssserver -c /etc/shadowsocks.json -d start // start in daemon mode
$ ssserver -d stop // stop the server
5, shadowsocks-qt5 client for ubuntu 14.04
$ sudo add-apt-repository ppa:hzwhuang/ss-qt5
$ sudo apt-get update
$ sudo apt-get install shadowsocks-qt5
https://github.com/shadowsocks/shadowsocks-qt5/wiki/Installation
6, install genpac to generate PAC file from gfwlist
$ sudo pip install genpac // install
$ genpac --init // generate config.ini and user-rules.txt
-- modify config.ini
$ vi config.ini
[config]
proxy = SOCKS5 127.0.0.1:1080
gfwlist-url = https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
user-rule-from = /path/to/user-rules.txt
output = /path/to/proxy.pac
$ genpac -c config.ini // generate pac file
https://github.com/JinnLynn/genpac
https://github.com/gfwlist/gfwlist
7, using a PAC file in Firefox
about:preferences#advanced -> Network -> Settings
check 'Automatic proxy configuration URL:'
file:///path/to/proxy.pac
enable 'Remote DNS'
https://www.youtube.com/watch?v=nKB4FoPw15k
]]>
]]>
6錛岀被鍨嬬殑鏋愭瀯鍑芥暟浼氳緙栬瘧鍣ㄦ敼涓篎inalize鏂規硶錛屼笉瑕侀噸杞借繖涓柟娉曘?/span>
]]>
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplicationTest
{
/*
* 鍙樹綋娉涘瀷
*
* .NET4錛屽湪娉涘瀷鎺ュ彛綾誨瀷鎴栬呮硾鍨嬪鎵樼被鍨嬮噷闈紝
* 琚叧閿瓧in澹版槑鐨勬硾鍨嬪弬鏁幫紝鍏剁被鍨嬪彲浠ヤ粠鐖剁被鍚戝瓙綾婚嗗彉錛屽彧鑳界敤浣滆緭鍏ュ弬鏁?br />
* 琚叧閿瓧out澹版槑鐨勬硾鍨嬪弬鏁幫紝鍏剁被鍨嬪彲浠ヤ粠瀛愮被鍚戠埗綾誨崗鍙橈紝鍙兘鐢ㄤ簬榪斿洖鍊?br />
* 鏁翠釜娉涘瀷綾誨瀷鏄笉闄愪簬鐢ㄤ綔杈撳叆鍙傛暟榪樻槸浣滀負榪斿洖鍊?br />
*
* interface IType_IN_OUT<in T1, out T2>
* IType_IN_OUT<Farmer, Person> farmerPersonType = null;
* IType_IN_OUT<Person, Farmer> personfarmerType = null;
* farmerPersonFinder = personFarmerFinder;
*
* 涓轟粈涔堜笉鏀寔“鍙樹綋”class鍛紵璺熷瓧孌墊湁鍏崇郴涔堬紵
*/
class Program
{
static void Main(string[] args)
{
IType_IN<Person> person_in = null;
IType_IN<Farmer> farmer_in = null;
farmer_in = person_in;
Greeting(person_in);
Console.WriteLine(GetTypeIn() == null);
IType_OUT<Person> person_out = null;
IType_OUT<Farmer> farmer_out = null;
person_out = farmer_out;
Greeting(farmer_out);
Console.WriteLine(GetTypeOut() == null);
Finder_IN<Person> personFinderIn = p => Console.WriteLine(p.GetType());
Finder_IN<Farmer> farmerFinderIn = f => Console.WriteLine(f.GetType());
farmerFinderIn = personFinderIn;
Greeting(personFinderIn);
Console.WriteLine(GetFarmerFinder().GetType());
Finder_OUT<Person> personFinderOut = () => new Person();
Finder_OUT<Farmer> farmerFinderOut = () => new Farmer();
personFinderOut = farmerFinderOut;
Greeting(personFinderOut);
Console.WriteLine(GetPersonFinder().GetType());
Finder_IN_OUT<Farmer, Person> farmerPersonFinder = f => new Person();
Finder_IN_OUT<Person, Farmer> personFarmerFinder = p => new Farmer();
farmerPersonFinder = personFarmerFinder;
// interface IType_IN_OUT<in T1, out T2>
IType_IN_OUT<Farmer, Person> farmerPersonType = null;
IType_IN_OUT<Person, Farmer> personfarmerType = null;
farmerPersonType = personfarmerType;
Console.ReadKey();
}
static void Greeting(IType_OUT<Person> person)
{
Console.WriteLine(person == null);
}
static void Greeting(IType_IN<Farmer> farmer)
{
Console.WriteLine(farmer == null);
}
static IType_OUT<Person> GetTypeOut()
{
IType_OUT<Farmer> farmer = null;
return farmer;
}
static IType_IN<Farmer> GetTypeIn()
{
IType_IN<Person> person_IN = null;
return person_IN;
}
static void Greeting(Finder_OUT<Person> personFinder)
{
Console.WriteLine(personFinder().GetType());
}
static void Greeting(Finder_IN<Farmer> farmerFinder)
{
Console.WriteLine(farmerFinder.GetType());
}
static Finder_OUT<Person> GetPersonFinder()
{
Finder_OUT<Farmer> farmerFinder = () => new Farmer();
return farmerFinder;
}
static Finder_IN<Farmer> GetFarmerFinder()
{
Finder_IN<Person> person = p => Console.WriteLine(p.GetType());
return person;
}
}
interface IType_OUT<out T>
{
}
interface IType_IN<in T>
{
}
interface IType_IN_OUT<in T1, out T2>
{
}
delegate T Finder_OUT<out T>();
delegate void Finder_IN<in T>(T t);
delegate T2 Finder_IN_OUT<in T1, out T2>(T1 t1);
class Person
{
}
class Farmer : Person
{
}
}
]]>
]]>

]]>