Linux tun/tap 应用程序 15C

我写了一个程序,来对tun驱动进行操作,能创建 tun设备 ping也ping的通,但是我程序
里用read函数对tun设备进行读取时,为什么读取不到数据呢?按理说 有数据写到虚拟网卡后,然后我在读tun 的字符 应该有数据,但是不知道为什么没数据.求大神解答

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
在ubuntu上用tun可以ping通但不能浏览网页
各位大神见教: 在ubuntu上打开/dev/net/tun创建了一个tun设备(tun0),具体代码都是参考网上的例子,物理设备用的是一个3g数据卡,数据卡注册上网络后网络会分配ip和dns并返回给用户,数据卡会在linux中生成ttyUSB0作为数据通道,tun0就通过该通道与数据卡进行交互,这是背景,具体问题是将网络分配的ip作为linux的默认网关,同时将eth0 down掉了,即现在linux中只有tun0一个网卡,这个用ifconfig及route -n都能看到相关信息,但ping百度或其他外网的ip地址都是可以ping通的,ping域名就不行,用浏览器上网也没有反应,用tcpdump监听tun0可以看到浏览器上网(用的ip地址或域名)没有数据交互,感觉像是系统并不知道有tun0这个网卡存在似的,但为什么ping ip又能ping通呢?
builder.establish创建的tun虚拟网卡
在利用vpnservice框架的时候,用builder.establish创建的tun虚拟网卡,如何得到整型的设备文件描述符,也就是说我想用c语言的应用程序使用已经创建好的tun设备。求大神指教。
qos规则对tap设备有效吗
从vm发包,到宿主机对应的tap设备收包(write?)再到br-int设备接收到报文,中间经过了哪些主要函数? 比如tun_chr_aio_write()->tun_get_user()->netif_rx_ni() 之后的过程怎么走? 会走到__netif_receive_skb_core吗? 还是会走到tun_net_xmit()? dev_queue_xmit()? 到br-int的时候是走netdev_port_receive()? 如果能走到_netif_receive_skb_core或者dev_queue_xmit 为什么我在tap设备上绑定的qos规则,无论是ingress还是egress方向都不生效?
求问ubuntu 13.10下ns3.8安装遇到python2.7-config意外停止
运行./build.py时,报错说“对不起,应用程序i386-linux-gnu-python2.7-config意外停止” 所以就build failed,遇见错误的地方如下: # Build NS-3 Entering directory `./ns-3.8' Note: configuring ns-3 without NSC => python waf configure --with-regression-traces ../ns-3.8-ref-traces --with-pybindgen ../pybindgen-0.14.1 Checking for program gcc or cc : /usr/bin/gcc Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for gcc : ok Checking for program g++ or c++ : /usr/bin/g++ Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok Checking for program pkg-config : /usr/bin/pkg-config Checking for regression traces location : ok ../ns-3.8-ref-traces (given) Checking for -Wl,--soname=foo support : yes Checking for header stdlib.h : yes Checking for header signal.h : yes Checking for header pthread.h : yes Checking for high precision time implementation : 128-bit integer Checking for header stdint.h : yes Checking for header inttypes.h : yes Checking for header sys/inttypes.h : not found Checking for library rt : yes Checking for header netpacket/packet.h : yes Checking for header linux/if_tun.h : yes Checking for pkg-config flags for GTK_CONFIG_STORE : ok Checking for pkg-config flags for LIBXML2 : ok Checking for library sqlite3 : yes Checking for NSC location : not found Checking for header sys/socket.h : yes Checking for header netinet/in.h : yes Checking for program python : /usr/bin/python Checking for Python version >= 2.3 : ok 2.7.5 Checking for library python2.7 : yes Checking for program python2.7-config : /usr/bin/python2.7-config File "/usr/bin/python2.7-config", line 5 echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir" ^ SyntaxError: invalid syntax Traceback (most recent call last): File "waf", line 158, in <module> Scripting.prepare(t, cwd, VERSION, wafdir) File "/home/daisy/workspace/eclipseWorkspace/ns3.8/ns-3.8/.waf-1.5.16-e6d03192b5ddfa5ef2c8d65308e48e42/wafadmin/Scripting.py", line 105, in prepare prepare_impl(t,cwd,ver,wafdir)
Mayan Dates 程序编写过程
Description Background The NASA has secretly built a Time machine which allows them to travel into the past. Its first application is to explore the Mayan culture. They have been able to gather some important dates from Maya monuments which are suitable for further investigation. They are now faced with a problem - they need to convert those Mayan dates to the Gregorian format, which is the only kind of input their time machine understands. Problem Write a conversion program to calculate the Gregorian date, the Mayan longcount and the Mayan ritual date for a given Gregorian date or Mayan longcount. Mayan Longcount The starting date, day zero, for the Mayan calendar is the 13th of August 3114 BC (before Christ). From this day zero onwards the days to a certain date are counted. One day is called K'in, 20 K'in are a Winal.18 Winal are a Tun, 20 Tun make a K'atun and 20 K'atun will form a Bak'tun. Example: 12.4.9.13.3 tells us that 12 Bak'tun, 4 K'atun, 9 Tun, 13 Winal and 3 K'in (days) have passed since August 13th 3114 BC. Mayan Ritual Dates The Mayans had the solar year with 365 days, there were no leap days to correct the calendar. The year was split in 18 month with 20 days and one month with 5 days. The names of the months are the following:Pob,Wo, Sip, Sotz', Tzek, Xul, Yaxk'in, Mol, Ch'en, Yax, Sak, Keh, Mak, K'ank'in, Muwan, Pax, K'ayab,Kumk'u, Wayeb. The days of the month were numbered 1 to 19 (or 1 to 4), the last day of the month was noted as day zero of the following month (i.e. you would not write 20 Pop, but 0 Wo to note the last day of the first month, the same applies to the five day month called Wayeb, its last day 5 Wayeb is written 0 Pop).Additionally to the months and days notation there is a notation which could be compared to our weeks and weekdays. Every day is labelled by both a number in the range from 1 to 13 and one of the following 20 names: Imix, Ik', Ak'bal, K'an, Chikchan, Kimi, Manik', Lamat, Muluk, Ok, Chuwen, Eb, Ben, Ix, Men,Kib, Kaban, Etz'nab, Kawak, Ahaw. Both the numbers and the names are running in cycles, so the count will go: 1 Imix, 2 Ik', 3 Ak'bal, ... 13 Ben, 1 Ix, 2 Men. It will thus take a 260 day cycle (called the ritual year) until 1 Imix is counted again (compare Figure 1 on next page). The weekday and month notation are used together as in the following example: 2 Kimi (weekday) 10 Yax (day and month). The 13th of August 3114 BC has the ritual date 4 Ahaw 8 Kumk'u. Gregorian Dates In our calendar we use leap days. A leap day is inserted every 4 years, except every 100 years. Overruling this a leap day will be inserted every 400 years. It is also important to know that there is no year 0. Accordingly, 31th of December 1 BC is followed by 1st of January AD 1. The last leap year before Christ is 1 BC (the 400 year rule applies here), the next leap year after that is AD 4. Input The first line contains the number of scenarios. For each scenario, there is one line containing either a Mayan longcount or a Gregorian date in the following formats: A Mayan longcount consists of 5 non-negative integers separated by dots. A Gregorian date consists first of three integers d, m, and y, separated by slashes, and satisfying 1 <= d <= 31, 1 <= m <= 12, and 0 < y. The values may or may not be zero padded, but will never exceed two characters for d and m, and four for y. This representation is always followed by a single blank and either "BC" or "AD". We will neither ask for dates preceding August 13th 3114 BC, nor for dates after 13.0.0.0.0 which is the last day in the Mayan longcount calendar. Also, you will never be given invalid dates in either calendar. Output The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then, regardless of the format given in the input, three lines have to be printed representing the given date in the following order: 1. the Gregorian date in the same format as specified in the input description, but without any padding zeros; 2. the Mayan longcount representation of the date, also as described before; 3. the Mayan ritual date consisting of four parts separated by single blanks: the weekday notation with its number and name, then the day of the month followed by the name of the month. After these three lines, always a blank line must be printed. Sample Input 2 13/08/3114 BC 12.19.10.6.14 Sample Output Scenario #1: 13/8/3114 BC 0.0.0.0.0 4 Ahaw 8 Kumk'u Scenario #2: 28/6/2003 AD 12.19.10.6.14 9 Ix 2 Tzek
openVPN提示连接失败
以下是服务器和客户端的配置文件: 服务器: port 1194 //用1194端口进行通信 proto udp //用UDP协议进行中间层协议封包(可选TCP,在不稳定网络状态更可靠) dev tap //虚拟设备型号 ca ca.crt cert server.crt key server.key # This file should be kept secret / dh dh1024.pem //上面就是服务端要用的证书 server 10.8.0.0 255.255.255.0 //服务网关的虚拟网段服务端默认IP 10.8.0.1 客户端默认10.8.0.2 ifconfig-pool-persist ipp.txt client-to-client ;duplicate-cn keepalive 10 120 tls-auth ta.key 0 # This file is secret //认证方式协商 用证书方式进行密钥交换(事实上openvpn也可以使用口令认证方式) comp-lzo ;max-clients 100 //user nobody //group nobody persist-key persist-tun status openvpn-status.log verb 6 客户端: client dev tap proto udp remote 192.168.197.129 1194 //请填写服务端的真实有效IP地址 resolv-retry infinite //此处表示无限次重复请求服务端 nobind //user nobody //group nobody persist-key persist-tun ;http-proxy-retry # retry on connection failures ;http-proxy [proxy server] [proxy port #] ca ca.crt cert client.crt key client.key //上述就是客户端要用的证书及密钥文件 ns-cert-type server tls-auth ta.key 1 comp-lzo # Set log file verbosity. verb 6 这是报的错:ptions error: Unrecognized option or missing parameter(s) in client.ovpn:7: //user (2.0.9) Use --help for more information. 按老师的步骤来的,不知道错在哪里了,求大神们帮忙解答~~万分感谢~
ubuntu下NS3使用“./test.py -c core”命令测试一直报错,求大神帮忙
Build failed -> task in 'test-runner' failed (exit status 1): {task 140009040312272: cxx test-runner.cc -> test-runner.cc.1.o} ['/usr/bin/g++', '-O3', '-g', '-Wall', '-Werror', '-march=native', '-fstrict-overflow', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-DNS3_BUILD_PROFILE_OPTIMIZED', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_GTK2=1', '../utils/test-runner.cc', '-c', '-o', '/home/chenhl/ns-allinone-3.25/ns-3.25/build/utils/test-runner.cc.1.o'] Waf died. Not running tests
在Ubuntu下装ns-3,编译时总是中途出错,具体如下:
Build failed -> task failed (exit status 1): {task 139621304904464: cxx print-introspected-doxygen.cc -> print-introspected-doxygen.cc.4.o} ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-fno-strict-aliasing', '-fwrapv', '-fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=.', '-fstack-protector-strong', '-fno-strict-aliasing', '-Ibuild', '-I.', '-I.', '-I/home/zhangzq/tarballs/ns-allinone-3.13', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/libpng16', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-I/usr/include/python2.7', '-I/usr/include/x86_64-linux-gnu/python2.7', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DPYTHONDIR="/usr/local/lib/python2.7/dist-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/dist-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNDEBUG', '-D_FORTIFY_SOURCE=2', '../utils/print-introspected-doxygen.cc', '-c', '-o', 'utils/print-introspected-doxygen.cc.4.o'] Traceback (most recent call last): File "./build.py", line 147, in <module> sys.exit(main(sys.argv)) File "./build.py", line 138, in main build_ns3(config, build_examples, build_tests, args, build_options) File "./build.py", line 61, in build_ns3 run_command([sys.executable, "waf", "build"] + build_options) File "/home/zhangzq/tarballs/ns-allinone-3.13/util.py", line 24, in run_command raise CommandError("Command %r exited with code %i" % (argv, retval)) util.CommandError: Command ['/usr/bin/python', 'waf', 'build'] exited with code 1
GIGA Universe Cup 计算概率几分
Description Following FIFA World Cup, a larger competition called "GIGA Universe Cup" is taking place somewhere in our universe. Both FIFA World Cup and GIGA Universe Cup are two rounds competitions that consist of the first round, also known as "group league", and the second called "final tournament." In the first round, participating teams are divided into groups of four teams each. Each team in a group plays a match against each of the other teams in the same group. For example, let's say we have a group of the following four teams, "Engband, Swedon, Argontina, and Nigerua." They play the following six matches: Engband - Swedon, Engband - Argontina, Engband - Nigerua, Swedon - Argontina, Swedon - Nigerua, and Argontina - Nigerua. The result of a single match is shown by the number of goals scored by each team, like "Engband 1 - 0 Argontina," which says Engband scored one goal whereas Argontina zero. Based on the result of a match, points are given to the two teams as follows and used to rank teams. If a team wins a match (i.e., scores more goals than the other), three points are given to it and zero to the other. If a match draws (i.e., the two teams score the same number of goals), one point is given to each. The goal difference of a team in given matches is the total number of goals it scored minus the total number of goals its opponents scored in these matches. For example, if we have three matches "Swedon 1 - 2 Engband," "Swedon 3 - 4 Nigerua," and "Swedon 5 - 6 Argontina," then the goal difference of Swedon in these three matches is (1 + 3 + 5) - (2 + 4 + 6) = -3. Given the results of all the six matches in a group, teams are ranked by the following criteria, listed in the order of priority (that is, we first apply (a) to determine the ranking, with ties broken by (b), with ties broken by (c), and so on). (a) greater number of points in all the group matches, (b) greater goal difference in all the group matches, (c) greater number of goals scored in all the group matches. If two or more teams are equal on the basis of the above three criteria, their place shall be determined by the following criteria, applied in this order: (d) greater number of points obtained in the group matches between the teams concerned, (e) greater goal difference resulting from the group matches between the teams concerned, (f) greater number of goals scored in the group matches between the teams concerned, If two or more teams are still equal, apply (d), (e), and (f) as necessary to each such group. Repeat this until those three rules to equal teams do not make any further resolution. Finally, teams that still remain equal are ordered by : (g) drawing lots by the Organizing Committee for the GIGA Universe Cup. The two teams coming first and second in each group qualify for the second round. Your job is to write a program which, given the results of matches played so far in a group and one team specified in the group, calculates the probability that the specified team will qualify for the second round. You may assume each team has played exactly two matches and has one match to play. In total, four matches have been played and two matches are to be played. Assume the probability that any team scores (exactly) p goals in any match is: 8!/(P!(8 - P)!)*(1/4)^p*(3/4)^(8-p) , for p <= 8, and zero for p > 8. Assume the lot in the step (g) is fair. Input The first line of the input is an integer, less than 1000, that indicates the number of subsequent records. The rest of the input is the indicated number of records. A single record has the following format: (empty) (-) (team)1 (-) (team)2 (-) (team)3 (-) (team)4 (team)1 (-) (empty) (-) (m)12 (-) (m)13 (-) (m)14 (team)2 (-) (empty) (-) (empty) (-) (m)23 (-) (m)24 (team)3 (-) (empty) (-) (empty) (-) (empty) (-) (m)34 (team)4 (-) (empty) (-) (empty) (-) (empty) (-) (empty) In the above, (-) is a single underscore (-) and (empty) a sequence of exactly four underscores (____). Each of (team)1,?,(team)4 is either an asterisk character (*) followed by exactly three uppercase letters (e.g., *ENG) , or an underscore followed by exactly three uppercase letters (e.g., _SWE). The former indicates that it is the team you are asked to calculate the probability of the second round qualification for. You may assume exactly one of (team)1,?, (team)4 is marked with an asterisk. Each (m)ij (1 <= i < j <= 4) is a match result between the (team)i and (team)j. Each match result is either __-_ (i.e., two underscores, hyphen, and another underscore) or of the form _x-y where each of x and y is a single digit (<= 8). The former indicates that the corresponding match has not been played, whereas the latter that the result of the match was x goals by (team)i and y goals by (team)j. Since each team has played exactly two matches, exactly two match results are in the former format. Output The output should consist of n lines where n is the number of records in the input. The ith line should show the probability that the designated team (marked with an asterisk) will qualify for the second round in the ith record. Numbers should be printed with exactly seven digits after the decimal point. Each number should not contain an error greater than 10^(-7). Sample Input 5 _____*AAA__BBB__CCC__DDD *AAA_______0-0__0-0___-_ _BBB_____________-___0-0 _CCC_________________0-0 _DDD____________________ ______CHN__CRC__TUR_*BRA _CHN_______0-2___-___0-4 _CRC____________1-1___-_ _TUR_________________1-2 *BRA____________________ ______CMR_*KSA__GER__IRL _CMR_______1-0___-___1-1 *KSA____________0-8___-_ _GER_________________1-1 _IRL____________________ ______TUN__JPN_*BEL__RUS _TUN________-___1-1__0-2 _JPN____________2-2__1-0 *BEL__________________-_ _RUS____________________ ______MEX__CRO_*ECU__ITA _MEX_______1-0__2-1___-_ _CRO_____________-___2-1 *ECU_________________0-2 _ITA____________________ Sample Output 0.5000000 1.0000000 0.0000000 0.3852746 0.0353304
linux,隧道4in,其中一头ipv6的路由设置
我在A,B两台机器上搭了一个4in6隧道,我要设置在这个网卡的流量都通过隧道走。这样设置的。(隧道tun_4in6的地址是2001::2) ip -6 route add default dev tun_4in6 table 300 ip -6 rule add from 2001::2 table 300 这样设置后,A,B隧道两头可以互相ping通,但是从Aping其他地址,在B这头捕包没有icmp包,而且也ping不通。
关闭WIFI/3G/GPRS后,如何欺骗Android的ConnectiviyManager仍然存在可用连接?
我在Android上做了一个网络App,创建了一个tun设备作为网卡。首先我关闭其他的网络设备包括eth0(WLAN)和rmnet0(3G/GPRS),然后加一条路由 ip route add default dev tun0 来把所有网络数据转向到我创建的这个虚拟网卡。接下来当我做ping的时候,能够发现我的虚拟网卡收到了数据,这时候QQ和系统原生的浏览器也可以正常工作了。 但有些App是先检测连接可用性,然后再真正上网。因为我已经关闭了WIFI和GPRS,当这些App检测可用性的时候,Android告诉它们没有可用连接,然后这些App就不工作了。 我的问题就是: 如何欺骗Android的ConnectivityManager,使它通知App仍然有可用的连接? 这个问题我也发到了stackoverflow上,现在还没回应。[链接在这里][1] [1]: http://stackoverflow.com/questions/14192869/how-to-cheat-android-at-checking-connectivity
关于rotate和translate的两个问题
![图片说明](https://img-ask.csdn.net/upload/201704/07/1491542290_183448.png) 问题1.一个正方形 让它向右旋转90度,以下面这种代码方式再让它向右转90度 mybox.style.transform=mybox.style.transform+"rotate(90deg)"; 为什么第二次反向转到目标位置 比如上面的程序执行两次右转 问题2.rotate和translate同时执行的时候 rotate应该是影响了translate的坐标轴的 rotate的坐标轴基点在中心。可以设置transform-origin设置 我下在想让正方形相对浏览器水平移动100px 同时旋转60deg transform:rotate(60deg) transform(100px,0) 这种实现是有问题的 rotate影响了translate的坐标轴 我能不能设置translate的坐标轴为浏览器(固定不变的参考系)?我没有查到相关资料。 如果不行的话 我怎么实现 正方形相对浏览器水平移动100px 同时旋转60deg(怎么让rotate不影响tranlate ) 上面程序就是rotate后影响了go的方向 源码: ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>task3-3</title> <style type="text/css"> .box { position: relative; width: 500px; height: 500px; margin: 100px auto 20px auto; border: 2px solid black; } .container { width: 100%; height: 100%; font-size: 0; } .container div { box-sizing: border-box; width: 10%; height: 10%; display: inline-block; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; } .cont_row{ position: absolute; margin-top: -50px; width: 100%; height: 10%; } .cont_row div,.cont_col div{ height: 50px; width: 50px; float: left; display: inline-block; text-align: center; line-height: 50px; } .cont_col{ position: absolute; margin-top: -500px; margin-left: -50px; width: 10%; height: 100%; } form{margin-top: 30px;} #myBox{ position: absolute; top: 350px; left: 250px; box-sizing: border-box; width: 50px; height: 50px; background-color: #ec3325; border: none; transition: all 1s linear; } #myHead{ position: absolute; box-sizing: border-box; width: 50px; height: 15px; background-color:#001df5 ; border: none; } </style> </head> <body> <div class="box"> <div class="cont_row"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> </div> <div class="container"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div id="myBox"><div id="myHead"></div></div> </div> <div class="cont_col"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> </div> <form action="#"> <input style="width:200px; height: 25px; " type="text" id="order"> <input type="button" value="执行" id="action"> </form> <p>指令有:GO:向蓝色边所面向的方向前进一格<br> TUN LEF:向左转(逆时针旋转90度)<br> TUN RIG:向右转(顺时针旋转90度)<br> TUN BAC:向右转(旋转180度)</p> </div> <script> //规定方向 1:上, 2:右 ,3:下, 4:左。di属性储存方向值,方向控制go命令的走法 //旋转 注意累计角度值即可 var act = document.getElementById("action"); var order = document.getElementById("order"); var mybox = document.getElementById("myBox"); var angle=0;//角度计数 var count=1;//计步 mybox.di=1; function takeOrder() { if(order.value=="TUN LEF"){ //为了不出现负方向先进行判断 if(mybox.di==1){mybox.di=4;} else {mybox.di=(mybox.di-1)%4;} console.log(mybox.di); mybox.style.transform=mybox.style.transform+"rotate(-90deg)"; } if(order.value=="TUN RIG"){ if(mybox.di==3){mybox.di=4} else{mybox.di=(mybox.di+1)%4;} mybox.style.transform=mybox.style.transform+"rotate(90deg)"; console.log(mybox.di); } if(order.value=="TUN BAC"){ if(mybox.di==2){mybox.di=4} else{mybox.di=(mybox.di+2)%4;} mybox.style.transform=mybox.style.transform+"rotate(180deg)"; console.log(mybox.di); } if(order.value=="GO"){ console.log(mybox.di); if(mybox.di==1){mybox.style.transform=mybox.style.transform+"translate(0,-50px)";} if(mybox.di==2){mybox.style.transform=mybox.style.transform+"translate(50px,0)";} if(mybox.di==3){mybox.style.transform=mybox.style.transform+"translate(0,50px)";} if(mybox.di==4){mybox.style.transform=mybox.style.transform+"translate(-50px,0)";} } } window.onload=function () { act.onclick=takeOrder; } </script> </body> </html> ```
64位LINUX X86关于DMA API的一些问题, 求高手不吝赐教,急急急!
pSendDmaPool = dma_pool_create("DmaPool",pci_dev->dev), (size_t)(512 * 64*1024+1024), (size_t)(64*1024), (size_t)0); pDmaBuf = (unsigned char*)dma_pool_alloc(pSendDmaPool, GFP_KERNEL, &dma_handle); 我的平台是64位X86,我执行完dma_pool_create后,再执行dma_pool_alloc,就崩溃了,然后打印信息是: ------------[ cut here ]------------ WARNING: at mm/page_alloc.c:2139 __alloc_pages_nodemask+0x7a8/0x8d0() (Not tainted) Hardware name: All Series Modules linked in: fh130drv(U) ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle bridge autofs4 8021q garp stp llc cpufreq_ondemand acpi_cpufreq freq_table mperf ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 vhost_net macvtap macvlan tun kvm uinput ppdev iTCO_wdt iTCO_vendor_support microcode parport_pc parport r8169 mii sg serio_raw lpc_ich mfd_core i2c_i801 shpchp snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc ext4 jbd2 mbcache sd_mod crc_t10dif ahci xhci_hcd i915 drm_kms_helper drm i2c_algo_bit i2c_core video output dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan] Pid: 3725, comm: fh130demo Not tainted 2.6.32-504.el6.x86_64 #1 Call Trace: [<ffffffff81074df7>] ? warn_slowpath_common+0x87/0xc0 [<ffffffff81074e4a>] ? warn_slowpath_null+0x1a/0x20 [<ffffffff811343e8>] ? __alloc_pages_nodemask+0x7a8/0x8d0 [<ffffffff815300da>] ? atomic_notifier_call_chain+0x1a/0x20 [<ffffffff813429ae>] ? notify_update+0x2e/0x30 [<ffffffff813443b0>] ? vt_console_print+0x260/0x330 [<ffffffff810a4c2f>] ? up+0x2f/0x50 [<ffffffff81074ffa>] ? _call_console_drivers+0x4a/0x80 [<ffffffff81012fe6>] ? dma_generic_alloc_coherent+0xa6/0x160 [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20 [<ffffffff81041fd1>] ? x86_swiotlb_alloc_coherent+0x31/0x70 [<ffffffff81164f5c>] ? dma_pool_alloc+0xfc/0x2a0 [<ffffffff815293c5>] ? printk+0x41/0x44 [<ffffffffa0546b36>] ? hbaDevAllocDmaBuffers+0x2f6/0x8f0 [fh130drv] [<ffffffffa0547298>] ? hbaDevInitialize+0x168/0x1b0 [fh130drv] [<ffffffffa053fd44>] ? Hba_FC_ASM_LoadConfig+0x54/0xa0 [fh130drv] [<ffffffffa053e532>] ? hba_dev_ioctl+0x1e2/0xbd0 [fh130drv] [<ffffffff81234be1>] ? avc_has_perm+0x71/0x90 [<ffffffff8133a483>] ? pty_write+0x73/0x80 [<ffffffff812369d4>] ? inode_has_perm+0x54/0xa0 [<ffffffff8109eefc>] ? remove_wait_queue+0x3c/0x50 [<ffffffff8105bd23>] ? __wake_up+0x53/0x70 [<ffffffff811a3752>] ? vfs_ioctl+0x22/0xa0 [<ffffffff811a38f4>] ? do_vfs_ioctl+0x84/0x580 [<ffffffff811a3e71>] ? sys_ioctl+0x81/0xa0 [<ffffffff810e5a7e>] ? __audit_syscall_exit+0x25e/0x290 [<ffffffff8100b072>] ? system_call_fastpath+0x16/0x1b ---[ end trace 03df1cd6b697aafa ]--- 求高手解答这个是怎么回事? 然后我想问一下,我可以分配 512 * 64*1024+1024这么大的DMA内存吗?并且对齐方式是64*1024? 然后我alloc的时候,每一块是多大呢? 谢谢了,没有金币了,不好意思!
Maya日期的一个计算的问题,使用C语言的程序的代码编写思想的实现的方式是什么的
Description The Classical Maya civilization developed in what is today southern Mexico, Guatemala, Belize and northern Honduras. During its height they developed a sophisticated system for time keeping which they used both to record history and for divinatory rituals. Their calendar consisted of 3 components: the Tzolkin, the Haab and the Long Count. For divinatory purposes the Maya used the Tzolkin which was composed of 20 day names to which numeric coefficients from 1 to 13 were attached giving a total of 260 distinct combinations. This is the size of the Tzolkin, or ritual, year. From Spanish colonial sources, we know the names of the days: Imix, Ik, Akbal, Kan, Chikchan, Kimi, Manik, Lamat, Muluk, Ok, Chuen, Eb, Ben, Ix, Men, Kib, Kaban, Etznab, Kawak, Ajaw The sequence of days developed as follows (starting for example at 9 Imix): 9 Imix, 10 Ik, 11 Akbal, 12 Kan, 13 Chikchan, 1 Kimi, 2 Manik, ... The Haab calendar was an astronomical one. It had 365 days divided into 19 months each with 20 days, except the last one which had only 5 days. In a manner similar to the Tzolkin each month name had a number from 1 to 20 indicating the day number within the month. Again, from Spanish colonial sources, we know the names of the months: Pohp, Wo, Sip, Zotz, Sek, Xul, Yaxkin, Mol, Chen, Yax, Sak, Keh, Mak, Kankin, Muan, Pax, Kayab, Kumku, Wayeb The month Wayeb had just 5 days and was considered an unlucky time of the year. The Tzolkin and Haab were combined in the inscriptions to create the Calendar Round, combining the 260 day cycle of the Tzolkin and the 365 day cycle of the Haab. A typical Calendar Round date in the inscriptions might be: 3 Lamat 6 Pax. Note that not all of the combination of days, months and coefficients are possible. A typical sequence of days in the Calendar Round (starting for example at 3 Lamat 6 Pax): 3 Lamat 6 Pax, 4 Muluk 7 Pax, 5 Ok 8 Pax, 6 Chuen 9 Pax, 7 Eb 10 Pax, 8 Ben 11 Pax, 9 Ix 12 Pax, 10 Men 13 Pax, 11 Kib 14 Pax, 12 Kaban 15 Pax, 13 Etznab 16 Pax, 1 Kawak 17 Pax, 2 Ajaw 18 Pax, 3 Imix 19 Pax, 4 Ik 20 Pax, 5 Akbal 1 Kayab, 6 Kan 2 Kayab, ... Finally, at the beginning of the Classic Period (AD 200 - 900), the Maya developed an absolute calendar called Long Count which counted the days from a fixed date in the past (the date when the current world was created according to Maya belief). Dates in the Long Count are given (for simplicity) in 5-tuples of the form: 9.2.3.4.5. Such a date one reads "9 baktuns 2 katuns 3 tuns 4 winals 5 kins since the zero date". A "kin" is just one day. A winal is a group of 20 days. A tun is a group of 18 winals (thus a tun has 20 * 18 = 360 days, 5 days short of a year). From here on all units come in multiples of 20. Thus a katun is equal to 20 tuns (almost 20 years) and a baktun means 20 katuns (almost 400 years). Thus 9.2.3.4.5 really means "9 * 144 000 + 2 * 7 200 + 3 * 360 + 4 * 20 + 5 days since the zero date". Note that for every Long Count date b.k.t.w.i we have 0 <= k < 20; 0 <= t < 20; 0 <= w < 18; 0 <= i < 20. Given the periodicity of the Calendar Round, a legal date such as 3 Lamat 6 Pax has multiple occurrences in the Long Count. Thus, one difficulty in reading inscriptions is in establishing a date for the inscription when the date is given only in terms of a Calendar Round (very common). In this case one must compute "all" the possible Long Count dates associated with the particular Calendar Round and based in some other context information deduce (for example, the text mentions a king for which other dates are known) which one applies. We limit our interest to the Long Count dates in the baktuns 8 and 9 (they cover all the Classic Period). We know that the Long Count date 8.0.0.0.0 fell on the Calendar Round 9 Ajaw 3 Sip. Task Write a program which for each data set: reads a Calendar Round date, computes all Long Count dates in the baktuns 8 and 9 for the given Calendar Round date if this date is legal, writes the result. Input The first line of the input contains exactly one positive integer d equal to the number of data sets, 1 <= d <= 30. The data sets follow. Each data set consists of exactly one line that contains exactly one Calendar Round date (maybe illegal): Tzolkin day number, Tzolkin day name, Haab day number and Haab month name separated by single spaces. Output For every data set your program must output an ascending sequence of Long Count dates computed for a given Calendar Round date. The first line of the output for the given input set should contain exactly one integer n equal to the length of the sequence (0, if the input date is illegal). Each of the next n lines should contain exactly one Long Count date specified by exactly 5 integers (meaning the numbers of baktuns, katuns, tuns, winals and kins respectively) separated by single dots. Sample Input 2 3 Lamat 6 Pax 1 Ajaw 9 Chen Sample Output 15 8.0.17.17.8 8.3.10.12.8 8.6.3.7.8 8.8.16.2.8 8.11.8.15.8 8.14.1.10.8 8.16.14.5.8 8.19.7.0.8 9.1.19.13.8 9.4.12.8.8 9.7.5.3.8 9.9.17.16.8 9.12.10.11.8 9.15.3.6.8 9.17.16.1.8 0
gnuradio tunnel实例问题
Traceback (most recent call last): File "./tunnel.py", line 296, in <module> main() File "./tunnel.py", line 242, in main (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) File "./tunnel.py", line 79, in open_tun_interface ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) IOError: [Errno 1] Operation not permitted ``` ``` 出现了什么错误,求高手指教,不知道怎么办
大家看我的这个自定义属性为什么不能储存值
![图片说明](https://img-ask.csdn.net/upload/201704/07/1491531049_74424.png) 第221行赋值为1 然后不同状态改变它的值 240行进行判断 我在控制台检测它的值 为什么是空 源码: ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>task3-3</title> <style type="text/css"> .box { position: relative; width: 500px; height: 500px; margin: 100px auto 20px auto; border: 2px solid black; } .container { width: 100%; height: 100%; font-size: 0; } .container div { box-sizing: border-box; width: 10%; height: 10%; display: inline-block; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; } .cont_row{ position: absolute; margin-top: -50px; width: 100%; height: 10%; } .cont_row div,.cont_col div{ height: 50px; width: 50px; float: left; display: inline-block; text-align: center; line-height: 50px; } .cont_col{ position: absolute; margin-top: -500px; margin-left: -50px; width: 10%; height: 100%; } form{margin-top: 30px;} #myBox{ position: absolute; top: 350px; left: 250px; box-sizing: border-box; width: 50px; height: 50px; background-color: #ec3325; border: none; transition: all 1s linear; } #myHead{ position: absolute; box-sizing: border-box; width: 50px; height: 15px; background-color:#001df5 ; border: none; } </style> </head> <body> <div class="box"> <div class="cont_row"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> </div> <div class="container"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div id="myBox"><div id="myHead"></div></div> </div> <div class="cont_col"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> </div> <form action="#"> <input style="width:200px; height: 25px; " type="text" id="order"> <input type="button" value="执行" id="action"> </form> <p>指令有:GO:向蓝色边所面向的方向前进一格<br> TUN LEF:向左转(逆时针旋转90度)<br> TUN RIG:向右转(顺时针旋转90度)<br> TUN BAC:向右转(旋转180度)</p> </div> <script> //规定方向 1:上, 2:右 ,3:下, 4:左。dir属性储存方向值,方向控制go命令的走法 //旋转 注意累计角度值即可 var act = document.getElementById("action"); var order = document.getElementById("order"); var mybox = document.getElementById("myBox"); var angle=0;//角度计数 mybox.dir=1; function takeOrder() { if(order.value=="TUN LEF"){ //为了不出现负方向先进行判断 if(mybox.dir==1){mybox.dir=5;} mybox.dir=(mybox.dir-1)%4; mybox.style.transform="rotate("+(angle-90)+"deg)"; angle=-90+angle; } if(order.value=="TUN RIG"){ mybox.dir=(mybox.dir+1)%4; mybox.style.transform="rotate("+(angle+90)+"deg)"; angle=90+angle; } if(order.value=="TUN BAC"){ mybox.dir=(mybox.dir+1)%4; mybox.style.transform="rotate("+(angle+180)+"deg)"; angle=180+angle; } if(order.value=="GO"){ mybox.dir=1; if(mybox.dir==1){mybox.style.transform="translate(0,50px)";} if(mybox.dir==2){mybox.style.transform="translate(50px,0)";} if(mybox.dir==3){mybox.style.transform="translate(0,-50px)";} if(mybox.dir==4){mybox.style.transform="translate(-50px,0)";} } } window.onload=function () { act.onclick=takeOrder; } </script> </body> </html> ```
LVS高性能高可用:TCP socket bind failed. Reschedu....
![图片说明](https://img-ask.csdn.net/upload/201706/28/1498611021_719097.png) 以下是代理机的配置: 1、yum -y install keepalived 2、> /etc/keepalived/keepalived.conf 3、vi /etc/keepalived/keepalived.conf ``` global_defs { router_id LVS_DEVEL } vrrp_instance VI_1 { state MASTER interface ens32 # 虚拟ip所在的网卡 virtual_router_id 51 # 标识ID,请务必保证内网唯一性,和备机必须一致! priority 100 # 权重需比备机高 advert_int 1 # 主备检测间隔 # 主备通信密码,必须一致 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.43.200 # 多个需换行填写 } } virtual_server 192.168.43.200 8080 { delay_loop 6 # 每隔6秒检测Realserver健康状况 lb_algo rr lb_kind DR # 采用DR模式,即直接路由,其他还有TUN和NAT两种模式 nat_mask 255.255.255.0 persistence_timeout 1 # #会话保持时间,相当于session 保持时间 protocol TCP real_server 192.168.43.31 8080 { # 第一个realserver,请注意80和后面 { 之间有个空格! weight 1 # 权重 TCP_CHECK { connect_timeout 10 # 超时10秒,则失败 nb_get_retry 3 # 失败重试次数 delay_before_retry 3 # 重试间隔时间 } } real_server 192.168.43.32 8080 { weight 1 TCP_CHECK { connect_timeout 10 # 超时10秒,则失败 nb_get_retry 3 # 失败重试次数 delay_before_retry 3 # 重试间隔时间 } } } ``` 4、 启动服务 systemctl start keepalived.service **# 问题描述:** 可以实现转发,但无法实现负载均衡和故障转移
window server 2003上运行VC++2012编译的托管C++库 失败
安装了VC2012 C++运行时库,仍然报错“Unable to find a version of the runtime to tun this application”求CSDN的大神指导
【C#】菜鸟一枚,有关汉字转拼音的编程问题,谢!
下面粘贴的是书上的源代码,有以下几个问题: 1.asc=M1*256+M2-65536 这个式子是什么含义? 2.为什么计算机内有自己的编码系统,还要自己去定义拼音编码数组和相对应的拼音数组呢? 3.这个编程的思路是怎样的呢? 菜鸟一枚,特别晕菜,希望给予指点。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace ChineseToABC { class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请输入要转换的内容:"); string str = Console.ReadLine(); Regex reg = new Regex("^[\u4e00-\u9fa5]$");//验证输入是否为汉字 byte[] arr = new byte[2];//定义字节数组 string pystr = "";//定义字符串变量并添加引用 char[] mChar = str.ToCharArray();//获取汉字对应的字符数组 Console.WriteLine("转换后的拼音:"+GetStr(mChar, pystr, reg, arr)+"\n");//返回获取到的汉字拼音 } } //定义拼音区编码数组 private static int[] getValue = new int[] { -20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-20036, -20032,-20026,-20002,-19990,-19986,-19982,-19976,-19805,-19784,-19775,-19774,-19763, -19756,-19751,-19746,-19741,-19739,-19728,-19725,-19715,-19540,-19531,-19525,-19515, -19500,-19484,-19479,-19467,-19289,-19288,-19281,-19275,-19270,-19263,-19261,-19249, -19243,-19242,-19238,-19235,-19227,-19224,-19218,-19212,-19038,-19023,-19018,-19006, -19003,-18996,-18977,-18961,-18952,-18783,-18774,-18773,-18763,-18756,-18741,-18735, -18731,-18722,-18710,-18697,-18696,-18526,-18518,-18501,-18490,-18478,-18463,-18448, -18447,-18446,-18239,-18237,-18231,-18220,-18211,-18201,-18184,-18183, -18181,-18012, -17997,-17988,-17970,-17964,-17961,-17950,-17947,-17931,-17928,-17922,-17759,-17752, -17733,-17730,-17721,-17703,-17701,-17697,-17692,-17683,-17676,-17496,-17487,-17482, -17468,-17454,-17433,-17427,-17417,-17202,-17185,-16983,-16970,-16942,-16915,-16733, -16708,-16706,-16689,-16664,-16657,-16647,-16474,-16470,-16465,-16459,-16452,-16448, -16433,-16429,-16427,-16423,-16419,-16412,-16407,-16403,-16401,-16393,-16220,-16216, -16212,-16205,-16202,-16187,-16180,-16171,-16169,-16158,-16155,-15959,-15958,-15944, -15933,-15920,-15915,-15903,-15889,-15878,-15707,-15701,-15681,-15667,-15661,-15659, -15652,-15640,-15631,-15625,-15454,-15448,-15436,-15435,-15419,-15416,-15408,-15394, -15385,-15377,-15375,-15369,-15363,-15362,-15183,-15180,-15165,-15158,-15153,-15150, -15149,-15144,-15143,-15141,-15140,-15139,-15128,-15121,-15119,-15117,-15110,-15109, -14941,-14937,-14933,-14930,-14929,-14928,-14926,-14922,-14921,-14914,-14908,-14902, -14894,-14889,-14882,-14873,-14871,-14857,-14678,-14674,-14670,-14668,-14663,-14654, -14645,-14630,-14594,-14429,-14407,-14399,-14384,-14379,-14368,-14355,-14353,-14345, -14170,-14159,-14151,-14149,-14145,-14140,-14137,-14135,-14125,-14123,-14122,-14112, -14109,-14099,-14097,-14094,-14092,-14090,-14087,-14083,-13917,-13914,-13910,-13907, -13906,-13905,-13896,-13894,-13878,-13870,-13859,-13847,-13831,-13658,-13611,-13601, -13406,-13404,-13400,-13398,-13395,-13391,-13387,-13383,-13367,-13359,-13356,-13343, -13340,-13329,-13326,-13318,-13147,-13138,-13120,-13107,-13096,-13095,-13091,-13076, -13068,-13063,-13060,-12888,-12875,-12871,-12860,-12858,-12852,-12849,-12838,-12831, -12829,-12812,-12802,-12607,-12597,-12594,-12585,-12556,-12359,-12346,-12320,-12300, -12120,-12099,-12089,-12074,-12067,-12058,-12039,-11867,-11861,-11847,-11831,-11798, -11781,-11604,-11589,-11536,-11358,-11340,-11339,-11324,-11303,-11097,-11077,-11067, -11055,-11052,-11045,-11041,-11038,-11024,-11020,-11019,-11018,-11014,-10838,-10832, -10815,-10800,-10790,-10780,-10764,-10587,-10544,-10533,-10519,-10331,-10329,-10328, -10322,-10315,-10309,-10307,-10296,-10281,-10274,-10270,-10262,-10260,-10256,-10254 }; //定义拼音数组 private static string[] getStr = new string[] { "A","Ai","An","Ang","Ao","Ba","Bai","Ban","Bang","Bao","Bei","Ben", "Beng","Bi","Bian","Biao","Bie","Bin","Bing","Bo","Bu","Ba","Cai","Can", "Cang","Cao","Ce","Ceng","Cha","Chai","Chan","Chang","Chao","Che","Chen","Cheng", "Chi","Chong","Chou","Chu","Chuai","Chuan","Chuang","Chui","Chun","Chuo","Ci","Cong", "Cou","Cu","Cuan","Cui","Cun","Cuo","Da","Dai","Dan","Dang","Dao","De", "Deng","Di","Dian","Diao","Die","Ding","Diu","Dong","Dou","Du","Duan","Dui", "Dun","Duo","E","En","Er","Fa","Fan","Fang","Fei","Fen","Feng","Fo", "Fou","Fu","Ga","Gai","Gan","Gang","Gao","Ge","Gei","Gen","Geng","Gong", "Gou","Gu","Gua","Guai","Guan","Guang","Gui","Gun","Guo","Ha","Hai","Han", "Hang","Hao","He","Hei","Hen","Heng","Hong","Hou","Hu","Hua","Huai","Huan", "Huang","Hui","Hun","Huo","Ji","Jia","Jian","Jiang","Jiao","Jie","Jin","Jing", "Jiong","Jiu","Ju","Juan","Jue","Jun","Ka","Kai","Kan","Kang","Kao","Ke", "Ken","Keng","Kong","Kou","Ku","Kua","Kuai","Kuan","Kuang","Kui","Kun","Kuo", "La","Lai","Lan","Lang","Lao","Le","Lei","Leng","Li","Lia","Lian","Liang", "Liao","Lie","Lin","Ling","Liu","Long","Lou","Lu","Lv","Luan","Lue","Lun", "Luo","Ma","Mai","Man","Mang","Mao","Me","Mei","Men","Meng","Mi","Mian", "Miao","Mie","Min","Ming","Miu","Mo","Mou","Mu","Na","Nai","Nan","Nang", "Nao","Ne","Nei","Nen","Neng","Ni","Nian","Niang","Niao","Nie","Nin","Ning", "Niu","Nong","Nu","Nv","Nuan","Nue","Nuo","O","Ou","Pa","Pai","Pan", "Pang","Pao","Pei","Pen","Peng","Pi","Pian","Piao","Pie","Pin","Ping","Po", "Pu","Qi","Qia","Qian","Qiang","Qiao","Qie","Qin","Qing","Qiong","Qiu","Qu", "Quan","Que","Qun","Ran","Rang","Rao","Re","Ren","Reng","Ri","Rong","Rou", "Ru","Ruan","Rui","Run","Ruo","Sa","Sai","San","Sang","Sao","Se","Sen", "Seng","Sha","Shai","Shan","Shang","Shao","She","Shen","Sheng","Shi","Shou","Shu", "Shua","Shuai","Shuan","Shuang","Shui","Shun","Shuo","Si","Song","Sou","Su","Suan", "Sui","Sun","Suo","Ta","Tai","Tan","Tang","Tao","Te","Teng","Ti","Tian", "Tiao","Tie","Ting","Tong","Tou","Tu","Tuan","Tui","Tun","Tuo","Wa","Wai", "Wan","Wang","Wei","Wen","Weng","Wo","Wu","Xi","Xia","Xian","Xiang","Xiao", "Xie","Xin","Xing","Xiong","Xiu","Xu","Xuan","Xue","Xun","Ya","Yan","Yang", "Yao","Ye","Yi","Yin","Ying","Yo","Yong","You","Yu","Yuan","Yue","Yun", "Za", "Zai","Zan","Zang","Zao","Ze","Zei","Zen","Zeng","Zha","Zhai","Zhan", "Zhang","Zhao","Zhe","Zhen","Zheng","Zhi","Zhong","Zhou","Zhu","Zhua","Zhuai","Zhuan", "Zhuang","Zhui","Zhun","Zhuo","Zi","Zong","Zou","Zu","Zuan","Zui","Zun","Zuo" }; private static string GetStr(char[] mChar, string pystr, Regex reg, byte[] arr) { int asc = 0, M1 = 0, M2 = 0; for (int j = 0; j < mChar.Length; j++) { if (reg.IsMatch(mChar[j].ToString()))//如果输入的是汉字 { arr = System.Text.Encoding.Default.GetBytes(mChar[j].ToString()); M1 = (short)(arr[0]); M2 = (short)(arr[1]); **asc = M1 * 256 + M2 - 65536;** if (asc > 0 && asc < 160) { pystr += mChar[j]; } else { switch (asc) { case -9254: pystr += "Zhen"; break; case -8985: pystr += "Qian"; break; case -5463: pystr += "Jia"; break; case -8274: pystr += "Ge"; break; case -5448: pystr += "Ga"; break; case -5447: pystr += "La"; break; case -4649: pystr += "Chen"; break; case -5436: pystr += "Mao"; break; case -5213: pystr += "Mao"; break; case -3597: pystr += "Die"; break; case -5659: pystr += "Tian"; break; default: for (int i = (getValue.Length - 1); i >= 0; i--) { if (getValue[i] <= asc)//判断汉字的拼音区编码是否在指定范围内 { pystr += getStr[i];//如果不超出范围则获取对应的拼音 break; } } break; } } } else//如果不是汉字 { pystr += mChar[j].ToString();//如果不是汉字则返回 } } return pystr; } } }
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
Android 9.0系统新特性,对刘海屏设备进行适配
其实Android 9.0系统已经是去年推出的“老”系统了,这个系统中新增了一个比较重要的特性,就是对刘海屏设备进行了支持。一直以来我也都有打算针对这个新特性好好地写一篇文章,但是为什么直到拖到了Android 10.0系统都发布了才开始写这篇文章呢?当然,一是因为我这段时间确实比较忙,今年几乎绝大部分的业余时间都放到写新书上了。但是最主要的原因并不是这个,而是因为刘海屏设备的适配存在一定的特殊性
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
日均350000亿接入量,腾讯TubeMQ性能超过Kafka
整理 | 夕颜出品 | AI科技大本营(ID:rgznai100) 【导读】近日,腾讯开源动作不断,相继开源了分布式消息中间件TubeMQ,基于最主流的 OpenJDK8开发的
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
相关热词 c# 输入ip c# 乱码 报表 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件
立即提问