今天做了一个windows系统下调用摄像头、进行开启、关闭、拍照、设置等等功能演示。

进行源码贡献,欢迎大家下载使用

一、DEMO效果如下:

二、DEMO演示代码如下:

  1. using SNF.Utilities;
  2. using SNF.WinForm;
  3. /// <summary>
  4. /// CameraDemo.cs
  5. /// Windows摄像头调用DEMO
  6. ///
  7. /// 修改记录
  8. ///
  9. /// 2016.10.28 版本:1.0 WangJinDou 创建。
  10. ///
  11. /// <author>
  12. /// <name>王金斗</name>
  13. /// <date>2016.10.28</date>
  14. /// </author>
  15. /// </summary>
  16. public partial class CameraDemo : BaseForm
  17. {
  18. public CameraDemo()
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. Camera WC;
  24. private void CameraDemo_Load(object sender, EventArgs e)
  25. {
  26. WC = new Camera(this.panelPreview.Handle, this.panelPreview.Width, this.panelPreview.Height);
  27. }
  28.  
  29. //打开摄像头
  30. private void btnOpen_Click(object sender, EventArgs e)
  31. {
  32. WC.StartWebCam();
  33. }
  34. //关闭摄像头
  35. private void btnClose_Click(object sender, EventArgs e)
  36. {
  37. WC.CloseWebCam();
  38. }
  39. //拍照
  40. private void btnPicture_Click(object sender, EventArgs e)
  41. {
  42. string path = FileDialogHelper.OpenDir();
  43. if (!string.IsNullOrEmpty(path))
  44. {
  45. WC.GrabImage(path + "/" + DateTime.Now.ToString("yyyy-MM-dd") + ".jpg");
  46. }
  47.  
  48. }
  49. //抓图到剪切板
  50. private void btnPictureClip_Click(object sender, EventArgs e)
  51. {
  52. WC.GrabImageToClipBoard();
  53. }
  54. /// <summary>
  55. /// 弹出视频格式设置对话框
  56. /// </summary>
  57. /// <param name="sender"></param>
  58. /// <param name="e"></param>
  59. private void btnSetCaptureFormat_Click(object sender, EventArgs e)
  60. {
  61. WC.SetCaptureFormat();
  62. }
  63. //弹出色彩设置对话框
  64. private void btnSetCaptureSource_Click(object sender, EventArgs e)
  65. {
  66. WC.SetCaptureSource();
  67. }
  68.  
  69. }

三、具体类源码

  1. //-----------------------------------------------------------------
  2. // All Rights Reserved , Copyright (C) 2015 , Spring TECH, Ltd.
  3. //-----------------------------------------------------------------
  4.  
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Text;
  8. using System.Runtime.InteropServices;
  9.  
  10. namespace SNF.Utilities
  11. {
  12. /// <summary>
  13. /// Camera
  14. /// 摄像头操作辅助类,包括开启、关闭、抓图、设置等功能
  15. /// <author>
  16. /// <name>WangJinDou</name>
  17. /// <date>2014-02-05</date>
  18. /// </author>
  19. /// </summary>
  20. public class Camera
  21. {
  22. private IntPtr lwndC;
  23. private IntPtr mControlPtr;
  24. private int mWidth;
  25. private int mHeight;
  26.  
  27. // 构造函数
  28. public Camera(IntPtr handle, int width, int height)
  29. {
  30. mControlPtr = handle;
  31. mWidth = width;
  32. mHeight = height;
  33. }
  34.  
  35. // 帧回调的委托
  36. public delegate void RecievedFrameEventHandler(byte[] data);
  37. public event RecievedFrameEventHandler RecievedFrame;
  38. private AviCapture.FrameEventHandler mFrameEventHandler;
  39.  
  40. /// <summary>
  41. /// 关闭摄像头
  42. /// </summary>
  43. public void CloseWebCam()
  44. {
  45. this.capDriverDisconnect(this.lwndC);
  46. }
  47.  
  48. /// <summary>
  49. /// 开启摄像头
  50. /// </summary>
  51. public void StartWebCam()
  52. {
  53. byte[] lpszName = new byte[100];
  54. byte[] lpszVer = new byte[100];
  55.  
  56. AviCapture.capGetDriverDescriptionA(1, lpszName, 100, lpszVer, 100);
  57. this.lwndC = AviCapture.capCreateCaptureWindowA(lpszName, AviCapture.WS_VISIBLE + AviCapture.WS_CHILD, 0, 0, mWidth, mHeight, mControlPtr, 0);
  58.  
  59. if (this.capDriverConnect(this.lwndC, 0))
  60. {
  61. this.capPreviewRate(this.lwndC, 66);
  62.  
  63. this.capPreview(this.lwndC, true);
  64. this.capOverlay(this.lwndC, true);
  65. AviCapture.BITMAPINFO bitmapinfo = new AviCapture.BITMAPINFO();
  66. bitmapinfo.bmiHeader.biSize = AviCapture.SizeOf(bitmapinfo.bmiHeader);
  67. bitmapinfo.bmiHeader.biWidth = this.mWidth;
  68. bitmapinfo.bmiHeader.biHeight = this.mHeight;
  69. bitmapinfo.bmiHeader.biPlanes = 1;
  70. bitmapinfo.bmiHeader.biBitCount = 24;
  71. this.capSetVideoFormat(this.lwndC, ref bitmapinfo, AviCapture.SizeOf(bitmapinfo));
  72.  
  73. this.mFrameEventHandler = new AviCapture.FrameEventHandler(FrameCallBack);
  74. this.capSetCallbackOnFrame(this.lwndC, this.mFrameEventHandler);
  75. AviCapture.SetWindowPos(this.lwndC, 0, 0, 0, mWidth, mHeight, 6);
  76. }
  77. }
  78.  
  79. /// <summary>
  80. /// 抓图到文件
  81. /// </summary>
  82. /// <param name="path"></param>
  83. public void GrabImage(string path)
  84. {
  85. IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);
  86. AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_SAVEDIB, 0, hBmp.ToInt32());
  87. }
  88.  
  89. /// <summary>
  90. /// 抓图到剪切板
  91. /// </summary>
  92. /// <returns></returns>
  93. public bool GrabImageToClipBoard()
  94. {
  95. return AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_EDIT_COPY, 0, 0);
  96. }
  97.  
  98. /// <summary>
  99. /// 弹出色彩设置对话框
  100. /// </summary>
  101. public void SetCaptureSource()
  102. {
  103. AviCapture.CAPDRIVERCAPS caps = new AviCapture.CAPDRIVERCAPS();
  104. AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_GET_CAPS, AviCapture.SizeOf(caps), ref caps);
  105. if (caps.fHasDlgVideoSource)
  106. {
  107. AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_DLG_VIDEOSOURCE, 0, 0);
  108. }
  109. }
  110.  
  111. /// <summary>
  112. /// 弹出视频格式设置对话框
  113. /// </summary>
  114. public void SetCaptureFormat()
  115. {
  116. AviCapture.CAPDRIVERCAPS caps = new AviCapture.CAPDRIVERCAPS();
  117. AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_GET_CAPS, AviCapture.SizeOf(caps), ref caps);
  118. if (caps.fHasDlgVideoSource)
  119. {
  120. AviCapture.SendMessage(lwndC, AviCapture.WM_CAP_DLG_VIDEOFORMAT, 0, 0);
  121. }
  122. }
  123.  
  124. #region 以下为私有函数
  125. private bool capDriverConnect(IntPtr lwnd, short i)
  126. {
  127. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_DRIVER_CONNECT, i, 0);
  128. }
  129.  
  130. private bool capDriverDisconnect(IntPtr lwnd)
  131. {
  132. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_DRIVER_DISCONNECT, 0, 0);
  133. }
  134.  
  135. private bool capPreview(IntPtr lwnd, bool f)
  136. {
  137. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_SET_PREVIEW, f, 0);
  138. }
  139.  
  140. private bool capPreviewRate(IntPtr lwnd, short wMS)
  141. {
  142. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_SET_PREVIEWRATE, wMS, 0);
  143. }
  144.  
  145. private bool capSetCallbackOnFrame(IntPtr lwnd, AviCapture.FrameEventHandler lpProc)
  146. {
  147. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_SET_CALLBACK_FRAME, 0, lpProc);
  148. }
  149.  
  150. private bool capSetVideoFormat(IntPtr hCapWnd, ref AviCapture.BITMAPINFO BmpFormat, int CapFormatSize)
  151. {
  152. return AviCapture.SendMessage(hCapWnd, AviCapture.WM_CAP_SET_VIDEOFORMAT, CapFormatSize, ref BmpFormat);
  153. }
  154.  
  155. private void FrameCallBack(IntPtr lwnd, IntPtr lpVHdr)
  156. {
  157. AviCapture.VIDEOHDR videoHeader = new AviCapture.VIDEOHDR();
  158. byte[] VideoData;
  159. videoHeader = (AviCapture.VIDEOHDR)AviCapture.GetStructure(lpVHdr, videoHeader);
  160. VideoData = new byte[videoHeader.dwBytesUsed];
  161. AviCapture.Copy(videoHeader.lpData, VideoData);
  162. if (this.RecievedFrame != null)
  163. this.RecievedFrame(VideoData);
  164. }
  165. private bool capOverlay(IntPtr lwnd, bool f)
  166. {
  167. return AviCapture.SendMessage(lwnd, AviCapture.WM_CAP_SET_OVERLAY, f, 0);
  168. }
  169. #endregion
  170.  
  171. }
  172.  
  173. /// <summary>
  174. /// 视频辅助类
  175. /// </summary>
  176. internal class AviCapture
  177. {
  178. //通过调用acicap32.dll进行读取摄像头数据
  179. [DllImport("avicap32.dll")]
  180. public static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, int nID);
  181. [DllImport("avicap32.dll")]
  182. public static extern bool capGetDriverDescriptionA(short wDriver, byte[] lpszName, int cbName, byte[] lpszVer, int cbVer);
  183. [DllImport("User32.dll")]
  184. public static extern bool SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParam);
  185. [DllImport("User32.dll")]
  186. public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, int lParam);
  187. [DllImport("User32.dll")]
  188. public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, FrameEventHandler lParam);
  189. [DllImport("User32.dll")]
  190. public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref BITMAPINFO lParam);
  191. [DllImport("User32.dll")]
  192. public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref CAPDRIVERCAPS lParam);
  193. [DllImport("User32.dll")]
  194. public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
  195. [DllImport("avicap32.dll")]
  196. public static extern int capGetVideoFormat(IntPtr hWnd, IntPtr psVideoFormat, int wSize);
  197.  
  198. //部分常量
  199. public const int WM_USER = 0x400;
  200. public const int WS_CHILD = 0x40000000;
  201. public const int WS_VISIBLE = 0x10000000;
  202. public const int SWP_NOMOVE = 0x2;
  203. public const int SWP_NOZORDER = 0x4;
  204. public const int WM_CAP_DRIVER_CONNECT = WM_USER + 10;
  205. public const int WM_CAP_DRIVER_DISCONNECT = WM_USER + 11;
  206. public const int WM_CAP_SET_CALLBACK_FRAME = WM_USER + 5;
  207. public const int WM_CAP_SET_PREVIEW = WM_USER + 50;
  208. public const int WM_CAP_SET_PREVIEWRATE = WM_USER + 52;
  209. public const int WM_CAP_SET_VIDEOFORMAT = WM_USER + 45;
  210. public const int WM_CAP_SAVEDIB = WM_USER + 25;
  211. public const int WM_CAP_SET_OVERLAY = WM_USER + 51;
  212. public const int WM_CAP_GET_CAPS = WM_USER + 14;
  213. public const int WM_CAP_DLG_VIDEOFORMAT = WM_USER + 41;
  214. public const int WM_CAP_DLG_VIDEOSOURCE = WM_USER + 42;
  215. public const int WM_CAP_DLG_VIDEODISPLAY = WM_USER + 43;
  216. public const int WM_CAP_EDIT_COPY = WM_USER + 30;
  217. public const int WM_CAP_SET_SEQUENCE_SETUP = WM_USER + 64;
  218. public const int WM_CAP_GET_SEQUENCE_SETUP = WM_USER + 65;
  219.  
  220. // 结构
  221. [StructLayout(LayoutKind.Sequential)]
  222. //VideoHdr
  223. public struct VIDEOHDR
  224. {
  225. [MarshalAs(UnmanagedType.I4)]
  226. public int lpData;
  227. [MarshalAs(UnmanagedType.I4)]
  228. public int dwBufferLength;
  229. [MarshalAs(UnmanagedType.I4)]
  230. public int dwBytesUsed;
  231. [MarshalAs(UnmanagedType.I4)]
  232. public int dwTimeCaptured;
  233. [MarshalAs(UnmanagedType.I4)]
  234. public int dwUser;
  235. [MarshalAs(UnmanagedType.I4)]
  236. public int dwFlags;
  237. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
  238. public int[] dwReserved;
  239. }
  240.  
  241. [StructLayout(LayoutKind.Sequential)]
  242. //BitmapInfoHeader
  243. public struct BITMAPINFOHEADER
  244. {
  245. [MarshalAs(UnmanagedType.I4)]
  246. public Int32 biSize;
  247. [MarshalAs(UnmanagedType.I4)]
  248. public Int32 biWidth;
  249. [MarshalAs(UnmanagedType.I4)]
  250. public Int32 biHeight;
  251. [MarshalAs(UnmanagedType.I2)]
  252. public short biPlanes;
  253. [MarshalAs(UnmanagedType.I2)]
  254. public short biBitCount;
  255. [MarshalAs(UnmanagedType.I4)]
  256. public Int32 biCompression;
  257. [MarshalAs(UnmanagedType.I4)]
  258. public Int32 biSizeImage;
  259. [MarshalAs(UnmanagedType.I4)]
  260. public Int32 biXPelsPerMeter;
  261. [MarshalAs(UnmanagedType.I4)]
  262. public Int32 biYPelsPerMeter;
  263. [MarshalAs(UnmanagedType.I4)]
  264. public Int32 biClrUsed;
  265. [MarshalAs(UnmanagedType.I4)]
  266. public Int32 biClrImportant;
  267. }
  268.  
  269. [StructLayout(LayoutKind.Sequential)]
  270. //BitmapInfo
  271. public struct BITMAPINFO
  272. {
  273. [MarshalAs(UnmanagedType.Struct, SizeConst = 40)]
  274. public BITMAPINFOHEADER bmiHeader;
  275. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
  276. public Int32[] bmiColors;
  277. }
  278.  
  279. [StructLayout(LayoutKind.Sequential)]
  280. public struct CAPDRIVERCAPS
  281. {
  282. [MarshalAs(UnmanagedType.U2)]
  283. public UInt16 wDeviceIndex;
  284. [MarshalAs(UnmanagedType.Bool)]
  285. public bool fHasOverlay;
  286. [MarshalAs(UnmanagedType.Bool)]
  287. public bool fHasDlgVideoSource;
  288. [MarshalAs(UnmanagedType.Bool)]
  289. public bool fHasDlgVideoFormat;
  290. [MarshalAs(UnmanagedType.Bool)]
  291. public bool fHasDlgVideoDisplay;
  292. [MarshalAs(UnmanagedType.Bool)]
  293. public bool fCaptureInitialized;
  294. [MarshalAs(UnmanagedType.Bool)]
  295. public bool fDriverSuppliesPalettes;
  296. [MarshalAs(UnmanagedType.I4)]
  297. public int hVideoIn;
  298. [MarshalAs(UnmanagedType.I4)]
  299. public int hVideoOut;
  300. [MarshalAs(UnmanagedType.I4)]
  301. public int hVideoExtIn;
  302. [MarshalAs(UnmanagedType.I4)]
  303. public int hVideoExtOut;
  304. }
  305.  
  306. public delegate void FrameEventHandler(IntPtr lwnd, IntPtr lpVHdr);
  307.  
  308. // 公共函数
  309. public static object GetStructure(IntPtr ptr, ValueType structure)
  310. {
  311. return Marshal.PtrToStructure(ptr, structure.GetType());
  312. }
  313.  
  314. public static object GetStructure(int ptr, ValueType structure)
  315. {
  316. return GetStructure(new IntPtr(ptr), structure);
  317. }
  318.  
  319. public static void Copy(IntPtr ptr, byte[] data)
  320. {
  321. Marshal.Copy(ptr, data, 0, data.Length);
  322. }
  323.  
  324. public static void Copy(int ptr, byte[] data)
  325. {
  326. Copy(new IntPtr(ptr), data);
  327. }
  328.  
  329. public static int SizeOf(object structure)
  330. {
  331. return Marshal.SizeOf(structure);
  332. }
  333. }
  334. }
  1. 作者: 王春天 2015-10-28
    作者Blog:http://www.cnblogs.com/spring_wang
  2. 出处: http://www.cnblogs.com/spring_wang/p/4874584.html

如果觉得还不错,欢迎转载。

SNF快速开发平台框架的系列文章:

SNF开发平台WinForm之五-高级查询使用说明-http://www.cnblogs.com/spring_wang/p/6116640.html

SNF开发平台WinForm之四-开发-主细表管理页面-http://www.cnblogs.com/spring_wang/p/6116626.html

SNF开发平台WinForm之三-开发-单表选择控件创建-http://www.cnblogs.com/spring_wang/p/6116592.html

SNF开发平台WinForm之二-开发-单表表单管理页面-http://www.cnblogs.com/spring_wang/p/6116572.html

SNF开发平台WinForm之一-开发-单表表格编辑管理页面-http://www.cnblogs.com/spring_wang/p/6116523.html

Winform开发框架之通用高级查询模块--SNF快速开发平台3.3-Spring.Net.Framework

Winform开发框架之图表报表在线设计器2-图表-SNF.EasyQuery项目--SNF快速开发平台3.3-Spring.Net.Framework

Winform开发框架之图表报表在线设计器-报表-SNF.EasyQuery项目--SNF快速开发平台3.3-Spring.Net.Framework(

Winform开发框架之通用附件管理模块 --SNF快速开发平台3.3-Spring.Net.Framework

SNFAutoupdater通用自动升级组件V2.0-WinForm

SNF快速开发平台3.2之--.Net可扩展的单据编号生成器-SNF.CodeRule

SNF快速开发平台3.1之--审核流(3)低调奢华,简单不凡,实例演示-SNF.WorkFlow

SNF快速开发平台3.1之--审核流(2)流程设计-SNF.WorkFlow功能使用说明

SNF快速开发平台3.1之--审核流(1)SNF.WorkFlow审核流简介

SNF快速开发平台3.0之--完美的代码生成器SNF.CodeGenerator-快速开发者的利器

基于MVC4+EasyUI的Web开发框架--Spring.Net.FrameworkV3.0总体介绍

SNF快速开发平台3.0之--MVC 打印解决方案

SNF快速开发平台3.0之--文件批量上传-统一附件管理器-在线预览文件(有互联网和没有两种)

SNF快速开发平台3.0之--asp.net mvc4 强大的导出和不需要上传文件的批量导入EXCEL

SNF快速开发平台3.0之MVC通用控件库展示-Asp.net+MVC4.0+WebAPI+EasyUI+Knockout

SNF快速开发平台3.0之BS页面展示和九大优点-部分页面显示效果-Asp.net+MVC4.0+WebAPI+EasyUI +Knockout

SNF快速开发平台3.0之-界面个性化配置+10种皮肤+7种菜单-Asp.net+MVC4.0+WebAPI+EasyUI+Knockout

SNF快速开发平台3.0之-CS页面-Asp.net+Spring.Net.Framework

SNF快速开发平台3.0之--系统里广播的作用--迅速及时、简明扼要的把信息发送给接收者

Winform开发框架之通用Windows摄像头调用拍照--SNF快速开发平台3.3-Spring.Net.Framework的更多相关文章

  1. SNF开发平台WinForm之十四-站内发送系统信息-SNF快速开发平台3.3-Spring.Net.Framework

    1运行效果: 2开发实现: .组装站内信息发送实体对象. SNFService SNFService = new SNFService(); if (this.ucUser.SelectedIds ! ...

  2. SNF开发平台WinForm之十二-发送手机短信功能调用-金笛-SNF快速开发平台3.3-Spring.Net.Framework

    1.调用前组装参数 2.调用发送信息服务脚本   .调用前组装参数: BaseSendTaskEntity entity = new BaseSendTaskEntity(); entity.Mess ...

  3. SNF开发平台WinForm之十三-单独从服务器上获取PDF文件进行显示-SNF快速开发平台3.3-Spring.Net.Framework

    1运行效果: 2开发实现: 如果需要单独显示PDF文件时用下面代码去实现,指定url地址. 地址: . 获取附件管理的实体对象: List<KeyValuePair<string, obj ...

  4. SNF开发平台WinForm之十一-程序打包-SNF快速开发平台3.3-Spring.Net.Framework

    原来我们用的是微软自带的打包工具去打包,但感觉好像也是第三方做的打包并且很是麻烦,还有时不成功报错.那综合考虑就找一个简单实用的打包工具吧,就找到了NSIS这个.具体打包步骤如下: 1.安装NSIS ...

  5. SNF开发平台WinForm之十-Excel导入-SNF快速开发平台3.3-Spring.Net.Framework

    7.1运行效果: 2.Excel导入开发实现 2.1. 创建窗体,修改命名空间 新增的窗体命名“FrmImport表名”,这个导入窗口比较其它窗口会特殊一些,需要继承BaseFormImport父级窗 ...

  6. SNF开发平台WinForm之九-代码生成器使用说明-SNF快速开发平台3.3-Spring.Net.Framework

    下面就具体的使用说明: 1.获取代码生成器的授权码(根据本机)-----还原数据库-------改config-----代码生成器 改代码生成器Config 2.登录代码生成器 3.查看是否连接成功 ...

  7. SNF开发平台WinForm之八-自动升级程序部署使用说明-SNF快速开发平台3.3-Spring.Net.Framework

    9.1运行效果: 9.2开发实现: 1.首先配置服务器端,把“SNFAutoUpdate2.0\服务器端部署“目录按网站程序进行发布到IIS服务器上. 2.粘贴语句,生成程序 需要调用的应用程序的Lo ...

  8. SNF开发平台WinForm之七-单据打印和使用说明-SNF快速开发平台3.3-Spring.Net.Framework

    8.1运行效果: 8.2开发实现: 1.  先要创建.grf报表模版,指定数据列.存储位置:Reports\Template文件夹下 2.  之后在程序当中查出数据,之后把数据和打印模版 传入方法进行 ...

  9. SNF开发平台WinForm之六-上传下载组件使用-SNF快速开发平台3.3-Spring.Net.Framework

    6.1运行效果: 6.2开发实现: 1.先在要使用的项目进行引用,SNF.WinForm.Attachments.dll文件. 2.在工具箱内新建选项卡->选择项,浏览找到文件SNF.WinFo ...

随机推荐

  1. C#对Windows文件/文件夹/目录的一些操作总结

    1.   在一个目录下创建一个文件夹 if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path); ...

  2. NDK 开发实例一(Android.mk环境配置下)

         在我写这篇文章的时候,Android Studio已经是2.3版本了,已经集成CMake 编译工具, 用户只需在 新建项目的时候,添加选项(Include C++ support),Andr ...

  3. POJ3237 Tree 树链剖分 线段树

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - POJ3237 题意概括 Description 给你由N个结点组成的树.树的节点被编号为1到N,边被编号为1 ...

  4. 005 Spark快速入门的简单程序案例

    参考:官网的quick start http://spark.apache.org/docs/1.6.0/quick-start.html 这里只是在shell命令行中简单的书写一些命令,做一个简单的 ...

  5. xpath-helper: 谷歌浏览器安装xpath helper 插件

    1.下载文件xpath-helper.crx xpath链接:https://pan.baidu.com/s/1dFgzBSd 密码:zwvb,感谢这位网友,我从这拿到了 2.在Google浏览器里边 ...

  6. Java 之递归遍历目录

    Java 之递归遍历目录 一.内容 输出指定目录(文件夹)下的所有文件(包括目录)的绝对路径 二.源代码:RecursiveListDirectory.java package cn.com.zfc. ...

  7. 潭州课堂25班:Ph201805201 爬虫基础 第八课 selenium (课堂笔记)

    Selenium笔记(1)安装和简单使用 简介 Selenium是一个用于Web应用程序测试的工具. Selenium测试直接运行在浏览器中,就像真正的用户在操作一样.支持的浏览器包括IE(7, 8, ...

  8. swoole深入学习 4. process

    swoole-1.7.2增加了一个进程管理模块,用来替代PHP的pcntl扩展.pcntl是php新增的一个多进程扩展,用来实现多进程,但是有很多不完善的地方,swoole 就完善了这些地方,而且使得 ...

  9. 面向对象&网络编程

    1 接口与归一化设计 1.1 归一化概念: 归一化的好处: 1.归一化让使用者无需关心对象的类是什么,只需要知道这些对象都具备某些功能就可以了,这极大降低了使用者的使用难度. 2.归一化使得高层的外部 ...

  10. Java程序员面试中的多线程问题1

    转自:http://blog.jobbole.com/18571/ 很多核心Java面试题来源于多线程(Multi-Threading)和集合框架(Collections Framework), 理解 ...