*************************************************************************************************************************************************

注意:强烈建议使用srs3.0,srs2.0存在的问题(回调,跨域)等问题不需要修改源码,而且可以修改生成mp4视频。

回调:

  1. # SRS推流开始,结束
  2. def live_publish(request):
  3. # 添加磁盘检测
  4. if not mounted():
  5. return HttpResponse(1)
  6. params = str(request.body, encoding="utf-8")
  7. object = json.loads(params)
  8. l_uuid = object.get('stream')
  9. live = Live.objects.get(uuid=l_uuid)
  10. live.status = 'living'
  11. live.save()
  12. return HttpResponse(0)

跨域:

  没测,一直用nginx代理

MP4:

  后期打算直接生成mp4,替换之前的flv

*************************************************************************************************************************************************

1、公司之前用的是:

直播:rtmp+jwplayer

点播:h5(mp4文件)

弊端:兼容性差,貌似跟系统版本,浏览器,浏览器版本都有关。还有就是rtmp推流生成的文件是flv格式,需要转码成mp4才能点播。

2、SRS+flv.js的优点:

当然是兼容性大大提高了,在pc端谷歌,火狐都可以播放,手机端火狐可以,谷歌不行,其他没测。

3、上图,看看效果:

样式什么的没添加,官方的demon 直接copy过来。

4、flv.js下载,构建:

Github:https://github.com/Bilibili/flv.js

解压后进入mater:

构建:

  1. npm install
  2. npm install -g gulp
  3. gulp release

在dist下生成了我们需要的js

flv.html:

  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  6.  
  7. </head>
  8.  
  9. <body>
  10. <script src="flv.min.js"></script>
  11. <video id="videoElement"></video>
  12. <script>
  13. if (flvjs.isSupported()) {
  14. var videoElement = document.getElementById('videoElement');
  15. var flvPlayer = flvjs.createPlayer({
  16. type: 'flv',
  17. url: 'http://192.168.2.192/live/video.flv'
  18. });
  19. flvPlayer.attachMediaElement(videoElement);
  20. flvPlayer.load();
  21. flvPlayer.play();
  22. }
  23. </script>
  24.  
  25. </body>
  26.  
  27. </html>

type可以是mp4,flv。url的类型要对应,可以是服务器的文件,也可以是rtmp推流的临时文件。

在这一步可以测试下点播是否正常,文件应该放在http服务器下以http协议访问,不能是文件形式访问。http服务器可以是nginx,python,tomcat等都可以

5、如果上一步成功,接下来就是搭建SRS服务器了

Github : https://github.com/ossrs/srs/wiki/v2_CN_SampleHttpFlv

这篇文章介绍的比较详细,下面是简单记录步骤:

假定你已经下载并编译好了SRS,可以参考:SRS服务器搭建,ffmpeg 本地推流

首先复制conf中的http.flv.live.conf为my.http.flv.live.conf,内容:

  1. # the config for srs to remux rtmp to flv live stream.
  2. # @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream
  3. # @see full.conf for detail config.
  4.  
  5. listen 1935;
  6. max_connections 1000;
  7. daemon off;
  8. srs_log_tank console;
  9. http_server {
  10. enabled on;
  11. listen 80;
  12. dir ./objs/nginx/html;
  13. }
  14. vhost __defaultVhost__ {
  15. http_remux {
  16. enabled on;
  17. mount [vhost]/[app]/[stream].flv;
  18. hstrs on;
  19. }
  20.  
  21. dvr {
  22. # https://github.com/ossrs/srs/wiki/v2_CN_DVR
  23.  
  24. enabled on;
  25. dvr_path ./objs/nginx/html/[app]/[stream].flv;
  26. dvr_plan session;
  27. dvr_duration 30;
  28. dvr_wait_keyframe on;
  29. time_jitter full;
  30.  
  31. }
  32.  
  33. }

这里该了http的服务端口为80,添加了保存rtmp流文件的配置,指定存储路径./objs/nginx/html/[app]/[stream].flv。

启动SRS:

  1. ./objs/srs -c conf/my.http.flv.live.conf

接下来就是推流了。

假定你安装了ffmpeg。

  1. ffmpeg -re -i /root/Videos/video.flv -c copy -f flv rtmp://192.168.2.192/live/video

如果推流成功那就可以在VLC中播放rtmp://192.168.2.192/live/video了,这样之前的html中的url就是:http://192.168.2.192/live/video.flv,

把之前的html/js copy到SRS的/objs/nginx/html/ 下,访问 http://ip/flv.html(这时的http服务由SRS提供,和之前的不一样) ,注意ip要和html中的ip一致,否则会报跨域的错。

至此整个直播点播服务的雏形就搭建成功!

6、添加回调

希望在开始推流的时候srs请求python服务,修改资源的状态为正在直播,推流结束是再次回调,请求python服务,修改状态为停止直播

srs的配置:

  1. # the config for srs to remux rtmp to flv live stream.
  2. # @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream
  3. # @see full.conf for detail config.
  4.  
  5. listen 1935;
  6. max_connections 1000;
  7. daemon off;
  8. srs_log_tank console;
  9.  
  10. http_server {
  11. enabled on;
  12. listen 8080;
  13. dir ./objs/nginx/html;
  14. }
  15.  
  16. vhost __defaultVhost__ {
  17. http_remux {
  18. enabled on;
  19. mount [vhost]/[app]/[stream].flv;
  20. hstrs on;
  21. }
  22.  
  23. dvr {
  24. # https://github.com/ossrs/srs/wiki/v2_CN_DVR
  25.  
  26. enabled on;
  27. dvr_path ./objs/nginx/html/[app]/[stream].flv;
  28. dvr_plan session;
  29. dvr_duration 30;
  30. dvr_wait_keyframe on;
  31. time_jitter full;
  32.  
  33. }
  34.  
  35. http_hooks {
  36. enabled on;
  37. on_publish http://localhost:8000/on_publish/;
  38. on_unpublish http://localhost:8000/on_unpublish/;
  39.  
  40. }
  41.  
  42. }

注意: on_publish的ip需要根据netstat -pantu 判断,看看监听在哪个地址,比如127.0.0.1:8000,那么就应该保持一致,

按理说写localhost也应该可以,在终端用crul localhos:8000 也是可以访问,但是回调时报错:

  1. [2017-11-30 03:08:22.478][error][20398][220][11] dns resolve server error, ip empty. ret=1029(Resource temporarily unavailable)
  2. [2017-11-30 03:08:22.478][warn][20398][220][11] http client failed, server=localhost, port=8000, timeout=30000000, ret=1029
  3. [2017-11-30 03:08:22.478][warn][20398][220][11] http connect server failed. ret=1029
  4. [2017-11-30 03:08:22.478][error][20398][220][11] http post on_publish uri failed. client_id=220, url=http://localhost:8000/on_publish/, request={"action":"on_publish","client_id":220,"ip":"192.168.2.151","vhost":"__defaultVhost__","app":"live","tcUrl":"rtmp://192.168.2.134:1935/live","stream":"f345f5b0d34a11e78008365426bed70e"}, response=, code=-147690992, ret=1029(Resource temporarily unavailable)
  5. [2017-11-30 03:08:22.478][error][20398][220][11] hook client on_publish failed. url=http://localhost:8000/on_publish/, ret=1029(Resource temporarily unavailable)
  6. [2017-11-30 03:08:22.478][error][20398][220][11] http hook on_publish failed. ret=1029(Resource temporarily unavailable)
  7. [2017-11-30 03:08:22.478][error][20398][220][11] stream service cycle failed. ret=1029(Resource temporarily unavailable)

所以还是保持一致的好。

另外:uwsgi并不对外提供访问服务,只由nginx转发,所以服务不要监听在0.0.0.0:8000,更不要写内网ip如192.168.2.111这样的,应为不确定下次启动ip不变。

所以uwsgi最好还是监听在127.0.0.1:8000。

python:

  1. # SRS推流开始,结束
  2. def live_publish(request):
  3. params = str(request.body, encoding="utf-8")
  4. object = json.loads(params)
  5. l_uuid = object.get('stream')
  6. live = Live.objects.get(uuid=l_uuid)
  7. live.status = 'living'
  8. live.save()
  9. return HttpResponse(0)
  10.  
  11. def live_unpublish(request):
  12. params = str(request.body, encoding="utf-8")
  13. object = json.loads(params)
  14. l_uuid = object.get('stream')
  15. live = Live.objects.get(uuid=l_uuid)
  16. live.status = 'stop'
  17. live.save()
  18. return HttpResponse(0)

官方文档的说明:

https://github.com/ossrs/srs/wiki/v2_CN_HTTPCallback

根据:an int value specifies the error code(0 corresponding to success)

大概是说要返回一个0,不过我尝试各种返回值0,“0“,{”code”:0}...都没用

一返回srs就报错:empty response

不知道为毛srs接收不到。

没办法,改源码:

在srs/trunk/src/app/srs_app_http_hooks.cpp

找到报错的位置:

  1. // should never be empty.
  2. res = SRS_HTTP_RESPONSE_OK;
  3. if (res.empty()) {
  4. ret = ERROR_HTTP_DATA_INVALID;
  5. srs_error("invalid empty response. ret=%d", ret);
  6. return ret;
  7. }

在进入判断前先赋值:res = SRS_HTTP_RESPONSE_OK;

然后重新编译安装。

还可以打包传服务器上用。

  1. ./scripts/package.sh --x86-x64

当然这只是权宜之计,因为我不需要判断用户的权限来滤用户,所以不用控制response返回值,希望日后搞明白说明原因导致。

如果有读者知道原因,还请告知,谢谢。

7、视频编辑

剪切:

  1. ffmpeg -ss 0:1:30 -t 0:0:20 -i input.avi -vcodec copy -acodec copy output.avi

-ss 开始时间,-t 持续时间

提取图片:

  1. ffmpeg i test.avi r 1 f image2 image-%3d.jpeg

封装:

  1. ffmpeg i video_file i audio_file vcodec copy acodec copy output_file

flv快速添加关键帧(为了拖动播放):

  1. yamdi -i tmp.flv -o 51e714ded33a11e7889a365426bed70e.flv

8、压力测试

  1. ~/Downloads/flazr-0.7-RC2# ./client.sh rtmp://192.168.2.134:1935/live/a54b2dceda5911e7a5b1365426bed70e -load 200

查看srs服务器的网卡信息:

  1. ethtool eth0

查看 srs服务器的流量:

  1. iftop

9、转了一圈回到原点

前段时间用以上方案搭建的直播点播系统测试结果还是比较满意的

笔记本(百兆网卡)网线直连开发板(千兆网卡):

子码流(100-150并发)主码流(10-20)

笔记本(千兆网卡)网线直连开发板(千兆网卡):

子码流(没测,不过不会超过1000,srs中有最大连接数设置)主码流(100-200)(目标就是支持100人在线观看)

但是前两天用录播主机推流到开发板,出现视频流畅,声音卡顿的现象。

之前怀疑过网络不畅通,视频源有问题,录播主机有问题,flv.js。

后来发现是flv.js在处理某些视频流,或视频文件(直播http-flv,点播xx.flv)会发生以上现象。

但是直接用VLC客户端播放没有声音卡顿的现象。

没办法,只好改回JWPlayer(播放rtmp),Video(播放mp4)

这就需要将推流的临时文件xxx.flv重新封装成xxx.mp4。

希望flv.js的后续版本可以解决这样的问题。

10、转机

测试几天发现只有录播设备播放文件通道的时候声音会卡顿,直接将其他电脑的音视频接入没有卡顿,但是随着播放时间加长,会出现声音延迟的现象。

11、环境和部署脚本:

  1. ├── CentOS-Base.repo
  2. ├── ffmpeg-3.4
  3. ├── install.sh
  4. ├── my.http.flv.live.conf
  5. ├── nginx-1.12.2
  6. ├── nohup.out
  7. ├── Python-3.5.0
  8. ├── run.sh
  9. ├── SRS-Ubuntu12-armv7cpu-2.0.243
  10. ├── stop.sh
  11. ├── touch
  12. ├── touch.conf
  13. ├── touch.ini
  14. └── yamdi-1.9

install.sh:

  1. #!/bin/bash
  2.  
  3. install_list='system python srs nginx deploy env ffmpeg yamdi'
  4. #install_list='ffmpeg yamdi'
  5. if [[ ${install_list} =~ system ]]
  6. then
  7. #替换yum源,更新系统
  8. yum_path='/etc/yum.repos.d/'
  9. for file in ${yum_path}*
  10. do
  11. end_str=${file:0-3}
  12. if [ "${end_str}" != 'bak' ]
  13. then
  14. mv $file ${file}.bak
  15. fi
  16. done
  17. cp CentOS-Base.repo ${yum_path}
  18. yum update
  19.  
  20. #安装基本工具
  21. yum install net-tools
  22. yum install nc
  23. else
  24. echo '>>>pass system'
  25. fi
  26.  
  27. if [[ ${install_list} =~ "python" ]]
  28. then
  29. #Python3.5安装
  30. cd Python-3.5.0/
  31. ./configure
  32. make
  33. make install
  34. pip3 install uwsgi
  35. cd ..
  36. else
  37. echo '>>>pass python'
  38. fi
  39.  
  40. if [[ ${install_list} =~ "nginx" ]]
  41. then
  42. #nginx 安装
  43. yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
  44. cd nginx-1.12.2/
  45. ./configure
  46. make
  47. make install
  48. cd ..
  49. else
  50. echo '>>>pass nginx'
  51. fi
  52.  
  53. if [[ ${install_list} =~ "srs" ]]
  54. then
  55. #srs 安装
  56. yum install redhat-lsb -y
  57. cd SRS-Ubuntu12-armv7cpu-2.0.243/
  58. ./INSTALL
  59. cd ..
  60. else
  61. echo '>>>pass srs'
  62. fi
  63.  
  64. if [[ ${install_list} =~ "ffmpeg" ]]
  65. then
  66. #ffmpeg 安装
  67. cd ffmpeg-3.4/
  68. #./configure
  69. make
  70. make install
  71. cd ..
  72. else
  73. echo '>>>pass ffmpeg'
  74. fi
  75.  
  76. if [[ ${install_list} =~ "yamdi" ]]
  77. then
  78. #yamdi 安装
  79. cd yamdi-1.9/
  80. make
  81. make install
  82. cd ..
  83. else
  84. echo '>>>pass yamdi'
  85. fi
  86.  
  87. if [[ ${install_list} =~ "deploy" ]]
  88. then
  89. #部署项目
  90. mkdir /opt/script/
  91. cp my.http.flv.live.conf /usr/local/srs/conf/
  92. cp touch.conf /usr/local/nginx/conf/
  93. cp touch.ini /opt/script/
  94. cp touch /opt/
  95. mkdir /usr/local/nginx/html/images/
  96. cp touch/tmp/* /usr/local/nginx/html/images/
  97. else
  98. echo '>>>pass deploy'
  99. fi
  100.  
  101. if [[ ${install_list} =~ "env" ]]
  102. then
  103. #安装项目依赖
  104. pip3 install django==1.9.8
  105. pip3 install xadmin
  106. pip3 install future
  107. pip3 install django_crispy_forms
  108. pip3 install django-formtools
  109. pip3 install httplib2
  110. pip3 install six
  111. pip3 install django_import_export
  112. pip3 install django-cors-headers
  113. pip3 install django-pure-pagination
  114.  
  115. yum install python-devel zlib-devel libjpeg-turbo-devel -y
  116. pip3 install Pillow
  117.  
  118. else
  119. echo '>>>pass env'
  120.  
  121. fi

run.sh:

  1. #!/bin/bash
  2.  
  3. #启动项目
  4. #touch
  5. pkill -9 uwsgi
  6. cd /opt/
  7. uwsgi --ini script/touch.ini &
  8. chmod 766 /opt/script/touchrnb.sock
  9.  
  10. #nginx
  11. pkill -9 nginx
  12. cd /usr/local/nginx/
  13. ./sbin/nginx -c conf/touch.conf &
  14.  
  15. #srs
  16. pkill -9 srs
  17. cd /usr/local/srs/
  18. ./objs/srs -c conf/my.http.flv.live.conf > /dev/null &

stop.sh:

  1. #!/bin/bash
  2.  
  3. #停止项目
  4. #nginx
  5. pkill -9 nginx
  6. #srs
  7. pkill -9 srs
  8. #touch
  9. pkill -9 uwsgi

开机启动:

编辑/etc/rc.d/rc.local,添加run.sh脚步路径

12、文件瘦身

strip   objs/srs

(arm版本:arm-hisiv300-linux-strip)

可以从7-8兆减到2-3兆

13、srs跨域

之前是nginx代理服务器和srs在同一台机器上,但是公司考虑到嵌入式板的性能问题,需要提供更换直播服务器的功能,为了避免修改nginx配置的问题,所以

直播服务器地址由后台配置,存到数据库,而不使用nginx代理。但是这样就有跨域的问题了,我使用的srs版本为2.0,目前解决跨域的方法是修改源码。

参考:https://github.com/ossrs/srs/issues/1002

修改 src/app/srs_app_http_stream.cpp

在486行添加 w->header()->set("Access-Control-Allow-Origin", "*");

重新编译安装即可

14、集群和负载均衡

集群很简单参考:https://github.com/ossrs/srs/wiki/v3_CN_SampleHttpFlvCluster

负载均衡:

如果集群较大推荐CDN,如果小集群可以用nginx

值得一提的是srs在接收nginx的转发请求时不是用的相对路径

nginx配置文件:

  1. worker_processes 4;
  2.  
  3. events {
  4. worker_connections 1024;
  5. }
  6.  
  7. http {
  8.  
  9. include mime.types;
  10. default_type application/octet-stream;
  11. sendfile on;
  12. keepalive_timeout 65;
  13. gzip on;
  14. client_max_body_size 4096m;
  15.  
  16. upstream localhost{
  17. ip_hash;
  18. server 127.0.0.1:8080;
  19. server 192.168.2.127:8080;
  20. }
  21.  
  22. server {
  23. listen 80;
  24. server_name 192.168.2.192 ;
  25. charset utf-8;
  26.  
  27. location / {
  28. add_header 'Access-Control-Allow-Origin' '*';
  29. proxy_pass http://127.0.0.1:8000/;
  30. }
  31.  
  32. # 指定静态文件路径
  33. location /static/ {
  34. alias /root/GitClient/touch/static_all/;
  35. index index.html index.htm;
  36. }
  37.  
  38. location /uwsgi_http/ {
  39.  
  40. proxy_pass http://localhost/;
  41.  
  42. }
  43.  
  44. }
  45.  
  46. }

如果upstream localhost 改为upstream aaa,浏览器访问: http://127.0.0.1/uwsgi_http/live/123.flv

srs接收到的是:http://aaa/live/123.flv

所以srs服务器要配置hosts文件,使aaa指向127.0.0.1

这里我直接命名为localhost,这样就可以偷懒啦。

还有负载均衡策略指定ip_hash,因为源站和边缘之间的视频可能不同步,这样可以提高用户体验。

但是如果srs集群的性能差异较大,还是用weight策略好一点。

15、flv.js优化--低延时(为了导播,直播不需要)

  1. <script>
  2. if (flvjs.isSupported()) {
  3. var videoElement = document.getElementById("myplayer");
  4. var flvPlayer = flvjs.createPlayer({
  5. type: 'flv',
  6. isLive: true,
  7. url: '{{ LIVE_URL }}{{ current_live.uuid }}.flv',
  8. },
  9. {
  10. enableWorker: false,
  11. enableStashBuffer: false,
  12. stashInitialSize: 1,
  13. lazyLoad: false,
  14. lazyLoadMaxDuration: 1,
  15. lazyLoadRecoverDuration: 1,
  16. deferLoadAfterSourceOpen: false,
  17. autoCleanupMaxBackwardDuration: 1,
  18. autoCleanupMinBackwardDuration: 1,
  19. statisticsInfoReportInterval: 1,
  20. fixAudioTimestampGap: false,
  21.  
  22. });
  23.  
  24. flvPlayer.attachMediaElement(videoElement);
  25. flvPlayer.load();
  26. flvPlayer.play();
  27. }
  28. </script>

srs低延时配置:

  1. vhost __defaultVhost__ {
  2. gop_cache off;
  3. queue_length 10;
  4. min_latency on;
  5. mr {
  6. enabled off;
  7. }
  8. mw_latency 100;
  9. tcp_nodelay on;
  10. }

video低延时:

  1. videoElement.addEventListener('progress', function() {
  2. var range = 0;
  3. var bf = this.buffered;
  4. var time = this.currentTime;
  5.  
  6. while(!(bf.start(range) <= time && time <= bf.end(range))) {
  7. range += 1;
  8. }
  9. this.currentTime = this.buffered.end(range) - 0.01;
  10. });

设置video低延时会触发waiting事件,出现一个圆圈和降低屏幕亮度,有待处理...

这样大概可以把延时从2~3降到1秒左右。(环境不同可能有差别,在网线接交换机的情况下会比连WiFi要好)

延时和流畅不可兼得,需求不同要设置不同参数。

16、音频不同步和卡顿的解决

参考:https://github.com/Bilibili/flv.js/issues/136

解决方法是 fixAudioTimestampGap: false,注意这个配置要在config的位置

17、添加HLS流

官方文档:https://github.com/ossrs/srs/wiki/v3_CN_SampleHLS

  1. vhost __defaultVhost__ {
  2. ...
  3.  
  4. hls {
  5. enabled on;
  6. hls_fragment 10;
  7. hls_window 60;
  8. hls_path ./objs/nginx/html;
  9. hls_m3u8_file [app]/[stream].m3u8;
  10. hls_ts_file [app]/[stream]-[seq].ts;
  11. hls_dispose 10;
  12.  
  13. }
  14. }

存在的问题:同一地址第一次正常,后面推的都不能看,第一次生成ts切片正常,后面的ts切片会重复丢弃和生成。

参考: 转hls输出时出现的问题 #894:https://github.com/ossrs/srs/issues/894

在SrsHls::on_unpublish的时候设置SrsHls::aac_samples=0后正常。

SRS+flv.js打造兼容性较高的直播、点播平台的更多相关文章

  1. js 利用canvas + flv.js实现视频流 截屏 、本地下载功能实现,兼容火狐,谷歌;canvas截屏跨域问题,无音频视频流加载不显示问题

    项目:物联网监控项目----后台视频流管理(前端实现视频截屏功能) 本文就不同视频源分情况展示: 1 本地视频(项目同目录视频)截屏(canvas.getContext("2d).drawI ...

  2. JS打造的跟随鼠标移动的酷炫拓扑图案

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. Flv.js

    Flv.js 是 HTML5 Flash 视频(FLV)播放器,纯原生 JavaScript 开发,没有用到 Flash.由 bilibili 网站开源. 该项目依托于 Media Source Ex ...

  4. CSS+JS实现兼容性很好的无限级下拉菜单

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DT ...

  5. js实现未知宽高的元素在指定元素中垂直水平居中

    js实现未知宽高的元素在指定元素中垂直水平居中:本章节介绍一下如何实现未知宽高的元素在指定元素下实现垂直水平居中效果,下面就以span元素为例子,介绍一下如何实现span元素在div中实现水平垂直居中 ...

  6. flv.js怎么用?全面解读flv.js代码

    flv.js项目的代码有一定规模,如果要研究的话,我建议从demux入手,理解了demux就掌握了媒体数据处理的关键步骤,前面的媒体数据下载和后面的媒体数据播放就变得容易理解了. 先普及点背景知识,为 ...

  7. livego+obs+flv.js 搭建视频直播

    一.流程 主播通过 obs软件通过直播 ->推流到->直播服务器 客户通过浏览器 访问站点->flv.js拉取直播服务器视频流并播放 二.环境 centos7 直播服务器 https ...

  8. 【FastDFS】如何打造一款高可用的分布式文件系统?这次我明白了!!

    写在前面 前面我们学习了如何基于两台服务器搭建FastDFS环境,而往往在生产环境中,需要FastDFS做到高可用,那如何基于FastDFS打造一款高可用的分布式文件系统呢?别急,今天,我们就一起来基 ...

  9. Flv.js文档使用随记

    关键字:Flv.js | Flv js | Flv-js | HTML5 FLV Player | 0x001: 前言以下涉及到 flv.js 所有内容均是V1.5.0版本内的,如方法.属性.常量.监 ...

随机推荐

  1. Pairs Forming LCM LightOJ - 1236 (算术基本定理)

    题意: 就是求1-n中有多少对i 和 j 的最小公倍数为n  (i <= j) 解析: 而这题,我们假设( a , b ) = n ,那么: n=pk11pk22⋯pkss, a=pd11pd2 ...

  2. 架构师成长之路2.2-PXE+Kickstart安装部署

    点击返回架构师成长之路 架构师成长之路2.2-PXE+Kickstart安装部署 系统测试环境: 实验环境:VMware Workstation 12 系统平台:CentOS Linux releas ...

  3. rt-thread learning notes

    rt-thread learning notes 2018-01-15 > 001 具有相同优先级的线程,每个线程的时间片大小都可以在初始化或创建该线程时指定 rt_thread_t rt_th ...

  4. 洛谷 P2300 合并神犇 解题报告

    P2300 合并神犇 题目背景 loidc来到了NOI的赛场上,他在那里看到了好多神犇. 题目描述 神犇们现在正排成一排在刷题.每个神犇都有一个能力值p[i].loidc认为坐在附近的金牌爷能力参差不 ...

  5. 支持ajax跨域调用的WCF搭建示例

    支持ajax 跨域调用的WCF搭建 1.新建一个"ASP.NET空Web应用程序"项目. 2.新建一个“WCF服务(支持ajax)”. 3.修改WCFAjaxService.svc ...

  6. oracle 按 123456789 排序 而不是 1 10 11 2 这种

    order by  decode(trim(translate(cptm,'0123456789',' ')),null,to_number(cptm))

  7. 洛谷 P4378 [USACO18OPEN]Out of Sorts S(树状数组求冒泡排序循环次数)

    传送门:Problem P4378 https://www.cnblogs.com/violet-acmer/p/9833502.html 要回宿舍休息了,题解明天再补吧. 题解: 定义一数组 a[m ...

  8. Java 多线程间通信

    JDK 1.5 以后, 将同步和锁封装成了对象, 并将操作锁的隐式方法定义到了该对象中, 将隐式动作变成了显示动作. Lock 接口 Lock 接口, 位于 java.util.concurrent. ...

  9. 用socket写一个简单的客户端和服务端程序

    用来练手写写socket代码 客户端代码 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h ...

  10. linux_shell使用

    一.hash命令 说明:linux系统下会有一个hash表,当你刚开机时这个hash表为空,每当你执行过一条命令时,hash表会记录下这条命令的路径,就相当于缓存一样.第一次执行命令shell解释器默 ...