WindowsForms 后台

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Http;
using Newtonsoft.Json;
using Aspose.Cells;
namespace WindowsDB2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// 显示
/// </summary>
void Bind(string name="",int type=1)
{
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/show?name=" + name + "&type=" + type).Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuModel>>(p);
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = js;
}
}
/// <summary>
/// 下拉
/// </summary>
void xia()
{
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/xia").Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuType>>(p);
comboBox1.DisplayMember = "TypeName";
comboBox1.ValueMember = "Typeid";
comboBox1.DataSource = js;
}
}
/// <summary>
/// 加载 显示
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

private void Form1_Load(object sender, EventArgs e)
{
xia();
Bind("", 1);
}
/// <summary>
/// 图片显示
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
DataGridView p = sender as DataGridView;
if (p.Columns[e.ColumnIndex].Name == "Tu")
{
e.Value = Image.FromFile(Application.StartupPath + "\\img\\" + e.Value);
}
}
/// <summary>
/// 添加
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
Add d = new Add();
d.ShowDialog();
Bind("", 1);
}
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/show").Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuModel>>(p);
Workbook book = new Workbook();
Worksheet s = book.Worksheets[0];
Cells cell = s.Cells;
int i = 0;
cell[i, 0].PutValue("编号");
cell[i, 1].PutValue("名称");
cell[i, 2].PutValue("价格");
cell[i, 3].PutValue("图片");
cell[i, 4].PutValue("类型");
foreach (stuModel item in js)
{
i++;
cell[i, 0].PutValue(item.ID);
cell[i, 1].PutValue(item.Names);
cell[i, 2].PutValue(item.Price);
cell[i, 3].PutValue(item.Imgname);
cell[i, 4].PutValue(item.TypeName);
}
string newname = Guid.NewGuid().ToString() + ".xlsx";
book.Save(newname);
System.Diagnostics.Process.Start(Application.StartupPath + "\\" + newname);
}
}

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap p = new Bitmap(groupBox1.Width, groupBox1.Height);
groupBox1.DrawToBitmap(p, new Rectangle(0,0,p.Width, p.Height));
e.Graphics.DrawImage(p, 0, 0, p.Width, p.Height);
}
/// <summary>
/// 打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button4_Click(object sender, EventArgs e)
{
printPreviewDialog1.ShowDialog();
}
/// <summary>
/// 删除 修改
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView p = sender as DataGridView;
DataGridViewRow row = p.Rows[e.RowIndex];
if (p.Columns[e.ColumnIndex].Name == "del")
{
var id = row.Cells[0].Value;
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.DeleteAsync("actionApi/showApi/shan?id=" + id).Result;
if (mesa.IsSuccessStatusCode)
{
var ppp = mesa.Content.ReadAsStringAsync().Result;
if (Convert.ToInt32(ppp) > 0)
{
MessageBox.Show("删除成功");
Bind("", 1);
}
}

}
if (p.Columns[e.ColumnIndex].Name == "update")
{
var id = row.Cells[0].Value;
xiu f = new xiu(Convert.ToInt32(id));
f.ShowDialog();
Bind("", 1);
}
}
/// <summary>
/// 全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button5_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].Cells[1].Value = true;
}
}

//批量删除

private void button6_Click(object sender, EventArgs e)
{
string id = string.Empty;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewRow row = dataGridView1.Rows[i];
if (Convert.ToBoolean(row.Cells[1].Value))
{
id += row.Cells[0].Value + ",";
}
}
id = id.TrimEnd(',');
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.DeleteAsync("actionApi/showApi/shan?id=" + id).Result;
if (mesa.IsSuccessStatusCode)
{
var ppp = mesa.Content.ReadAsStringAsync().Result;
if (Convert.ToInt32(ppp) > 0)
{
MessageBox.Show("删除成功");
Bind("",1);
}
}
}

//查询

private void button3_Click(object sender, EventArgs e)
{
var name = textBox1.Text;
int type =Convert.ToInt32(comboBox1.SelectedValue);
Bind(name, type);
}
}
}

WindowsForms 添加

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsDB2
{
public partial class Add : Form
{
public Add()
{
InitializeComponent();
}
string tus = "";
void xia()
{
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/xia").Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuType>>(p);
comboBox1.DisplayMember = "TypeName";
comboBox1.ValueMember = "Typeid";
comboBox1.DataSource = js;
}
}
/// <summary>
/// 下拉的列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Add_Load(object sender, EventArgs e)
{
xia();
}
/// <summary>
/// 添加
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog p = new OpenFileDialog();
if (p.ShowDialog() == DialogResult.OK)
{
string flirename = p.FileName;
int page = flirename.LastIndexOf("\\");
string newname = Guid.NewGuid().ToString() + (flirename.Substring(page + 1));
using (FileStream ds = new FileStream(@".\img\" + newname, FileMode.CreateNew))
{
using (Stream str = p.OpenFile())
{
str.CopyTo(ds);
str.Flush();

stuModel m = new stuModel();
m.Names = textBox1.Text;
m.Price = Convert.ToInt32(textBox2.Text);
m.Typeid = Convert.ToInt32(comboBox1.SelectedValue);
m.Imgname = newname;
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpContent cont = new StringContent(JsonConvert.SerializeObject(m));
cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

HttpResponseMessage mesa = client.PostAsync("actionApi/showApi/add", cont).Result;
if (mesa.IsSuccessStatusCode)
{
var pp = mesa.Content.ReadAsStringAsync().Result;
if (Convert.ToInt32(pp) > 0)
{
MessageBox.Show("添加成功");
this.Close();
}
else
{
MessageBox.Show("添加失败");
}
}
pictureBox1.ImageLocation = (@".\img\" + newname).ToString();
}
}
}
}

private void label4_Click(object sender, EventArgs e)
{
OpenFileDialog p = new OpenFileDialog();
if (p.ShowDialog() == DialogResult.OK)
{
string flirename = p.FileName;
int page = flirename.LastIndexOf("\\");
string newname = Guid.NewGuid().ToString() + (flirename.Substring(page + 1));
tus = newname;
using (FileStream ds = new FileStream(@".\img\" + newname, FileMode.CreateNew))
{
using (Stream str = p.OpenFile())
{
str.CopyTo(ds);
str.Flush();
pictureBox1.ImageLocation = (@".\img\" + newname).ToString();
}
}
}
}

private void button2_Click(object sender, EventArgs e)
{
stuModel m = new stuModel();
m.Names = textBox1.Text;
m.Price = Convert.ToInt32(textBox2.Text);
m.Typeid = Convert.ToInt32(comboBox1.SelectedValue);
m.Imgname = tus;
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpContent cont = new StringContent(JsonConvert.SerializeObject(m));
cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

HttpResponseMessage mesa = client.PostAsync("actionApi/showApi/add", cont).Result;
if (mesa.IsSuccessStatusCode)
{
var pp = mesa.Content.ReadAsStringAsync().Result;
if (Convert.ToInt32(pp) > 0)
{
MessageBox.Show("添加成功");
this.Close();
}
else
{
MessageBox.Show("添加失败");
}

}
}
}
}

修改

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsDB2
{
public partial class xiu : Form
{
public xiu()
{
InitializeComponent();
}
string ids = "";
void xia()
{
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/xia").Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuType>>(p);
comboBox1.DisplayMember = "TypeName";
comboBox1.ValueMember = "Typeid";
comboBox1.DataSource = js;
}
}
public xiu(int id)
{
InitializeComponent();
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage mesa = client.GetAsync("actionApi/showApi/dan?id=" + id).Result;
if (mesa.IsSuccessStatusCode)
{
var p = mesa.Content.ReadAsStringAsync().Result;
var js = JsonConvert.DeserializeObject<List<stuModel>>(p).FirstOrDefault();
textBox1.Text = js.Names;
textBox2.Text = js.Price.ToString();
comboBox1.Text = js.TypeName;
pictureBox1.ImageLocation = (@".\img\" + js.Imgname).ToString();
ids = id.ToString();

}

}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog p = new OpenFileDialog();
if (p.ShowDialog() == DialogResult.OK)
{
string flirename = p.FileName;
int page = flirename.LastIndexOf("\\");
string newname = Guid.NewGuid().ToString() + (flirename.Substring(page + 1));
using (FileStream ds = new FileStream(@".\img\" + newname, FileMode.CreateNew))
{
using (Stream str = p.OpenFile())
{
str.CopyTo(ds);
str.Flush();

stuModel m = new stuModel();
m.Names = textBox1.Text;
m.Price = Convert.ToInt32(textBox2.Text);
m.Typeid = Convert.ToInt32(comboBox1.SelectedValue);
m.Imgname = newname;
m.ID =Convert.ToInt32(ids);
Uri uri = new Uri("http://localhost:8231/");
HttpClient client = new HttpClient();
client.BaseAddress = uri;
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpContent cont = new StringContent(JsonConvert.SerializeObject(m));
cont.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

HttpResponseMessage mesa = client.PutAsync("actionApi/showApi/xiu", cont).Result;
if (mesa.IsSuccessStatusCode)
{
var pp = mesa.Content.ReadAsStringAsync().Result;
if (Convert.ToInt32(pp) > 0)
{
MessageBox.Show("修改成功");
this.Close();
}
else
{
MessageBox.Show("修改失败");
}
}
pictureBox1.ImageLocation = (@".\img\" + newname).ToString();
}
}
}
}

private void xiu_Load(object sender, EventArgs e)
{
xia();
}
}
}

分页

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace WindowsDB2
{
public partial class fen : Form
{
public fen()
{
InitializeComponent();
}
int count = 0;
int PageIndex = 0;
int PageSize = 4;
void Bind(int PageIndex,string sql)
{
MySqlParameter[] app = new MySqlParameter[] { (new MySqlParameter("@Exstr", MySqlDbType.VarChar, 200)), new MySqlParameter("@PageIndex", MySqlDbType.Int32),new MySqlParameter("@PageSize", MySqlDbType.Int32) };
app[0].Value = "";
app[0].Direction = ParameterDirection.Input;
app[1].Value = PageIndex;
app[1].Direction = ParameterDirection.Input;
app[2].Value = PageSize;
app[2].Direction = ParameterDirection.Input;
DataSet ds = new DAL.stuDAL().show("P_Lianxi", app);
dataGridView1.DataSource = ds.Tables[0];
}

private void fen_Load(object sender, EventArgs e)
{
count = new DAL.stuDAL().cou();
PageIndex = (int)(Math.Ceiling(Convert.ToDouble(count) / PageSize));
for (int i = 1; i <=PageIndex; i++)
{
comboBox1.Items.Add(i);
}
comboBox1.Text = "1";
Bind(0, "");
}
/// <summary>
/// 首页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
comboBox1.Text = "1";
Bind(0, "");
}
/// <summary>
/// 尾页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button4_Click(object sender, EventArgs e)
{
var row = (int)(Math.Ceiling(Convert.ToDouble(count) / PageSize));
Bind((row - 1) * 4, "");
comboBox1.Text = row.ToString();
}
/// <summary>
/// 下一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
int page = Convert.ToInt32(comboBox1.Text);
PageIndex = (int)(Math.Ceiling(Convert.ToDouble(count) / PageSize));
if (page < PageIndex)
{
comboBox1.Text = (page + 1).ToString();
Bind((Convert.ToInt32(comboBox1.Text) - 1) * 4, "");

}
}
/// <summary>
/// 上一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button3_Click(object sender, EventArgs e)
{
int page = Convert.ToInt32(comboBox1.Text);

if (page!=1)
{
comboBox1.Text = (page -1).ToString();
Bind((Convert.ToInt32(comboBox1.Text) - 1) * 4, "");

}
}
}
}

分页的个数

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
using System.Data;
namespace DAL
{
public class stuDAL
{
public MySqlConnection conn = new MySqlConnection("database = 'lianxi'; data source = 'localhost'; user id = 'root'; password='1234';charset='utf8';pooling=true");
public DataSet show(string name, params MySqlParameter[] par)
{
MySqlCommand cmd = new MySqlCommand(name,conn);
cmd.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
MySqlDataAdapter data = new MySqlDataAdapter();
if (par == null)
{
return null;
}
foreach (MySqlParameter item in par)
{
cmd.Parameters.Add(item);
}
conn.Open();
cmd.ExecuteNonQuery();
data.SelectCommand = cmd;
data.Fill(ds, name);
data.Dispose();
conn.Close();
conn.Dispose();
return ds;

}
public int cou()
{
string sql = " SELECT COUNT(1) from lianxiinfo ";
conn.Open();
MySqlCommand cmd = new MySqlCommand(sql, conn);
object i = cmd.ExecuteScalar();
conn.Close();
return Convert.ToInt32(i);
}
}
}

API

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
namespace WebApplicationDB2.Controllers
{
public class showApiController : ApiController
{
/// <summary>
/// 显示全部
/// </summary>
/// <returns></returns>
// GET: api/showApi
[HttpGet]
public List<stuModel> show(string name = "", int type = 1)
{
var p = new BLL.stuBLL().show(name,type);
return p.ToList();
}
/// <summary>
/// 显示下拉
/// </summary>
/// <returns></returns>
[HttpGet]
public List<stuType> xia()
{
var p = new BLL.stuBLL().xia();
return p.ToList();
}
/// <summary>
/// 一条数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public List<stuModel> dan(int id)
{
var p = new BLL.stuBLL().dan(id);
return p.ToList();
}
/// <summary>
/// 添加
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
// GET: api/showApi/5
[HttpPost]
public int add(stuModel m)
{
var p = new BLL.stuBLL().add(m);
return p;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpDelete]
public int shan(string id)
{
var p = new BLL.stuBLL().shan(id);
return p;
}
/// <summary>
/// 修改
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
[HttpPut]
public int xiu(stuModel m)
{
var p = new BLL.stuBLL().xiu(m);
return p;
}
}
}

配置

config.Routes.MapHttpRoute(
name: "actionApi",
routeTemplate: "actionApi/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);

WindowsForms 调用API的更多相关文章

  1. C#中调用API

    介绍 API( Application Programming Interface ),我想大家不会陌生,它是我们Windows编程的常客,虽然基于.Net平台的C#有了强大的类库,但是,我们还是不能 ...

  2. [转]c#调用API截图

    转自http://blog.csdn.net/hailiannanhai/article/details/6281471 要想完成这个功能,首先要了解一下在C#中如何调用API(应用程序接口)函数.虽 ...

  3. 一个 C# 获取高精度时间类(调用API QueryP*)

    如果你觉得用 DotNet 自带的 DateTime 获取的时间精度不够,解决的方法是通过调用 QueryPerformanceFrequency 和 QueryPerformanceCounter这 ...

  4. ABP手机端调用API时的CORS

    这个问题其实很早就考虑了,当时因为也没有特别着急去解决这个问题,就一直拖着.... 好吧,拖延症是不好的,所有不懒得做的,终将会逼着你去再很短的时间内去解决问题...实现项目 改写一个已有的webfo ...

  5. 调用API函数,在窗口非客户区绘图(通过GetWindowDC获得整个窗口的DC,就可以随意作画了)

    http://hi.baidu.com/3582077/item/77d3c1ff60f9fa5ec9f33754 调用API函数,在窗口非客户区绘图 GDI+的Graphics类里有个FromHdc ...

  6. C#调用API函数EnumWindows枚举窗口的方法

    原文 http://blog.csdn.net/dengta_snowwhite/article/details/6067928 与C++不同,C#调用API函数需要引入.dll文件,步骤如下: 1. ...

  7. 在C#中调用API获取网络信息和流量

    原文 在C#中调用API获取网络信息和流量 最近一项目中要求显示网络流量,而且必须使用C#. 事实上,调用 IpHlpApi.dll 的 GetIfTable API 可以轻易获得网络信息和网络流量. ...

  8. C#区域截图——调用API截图

    原文:C#区域截图——调用API截图 前言:截图对于一个C++开发者来说无非是小菜一碟,也有朋友使用C#的 Graphics.CopyFromScreen 方法屏幕操作,作为一名整天想着用 C++ 开 ...

  9. HttpClient调用api

    /// <summary> /// 模拟调用API /// </summary> /// <param requestUrl="">请求地址&l ...

随机推荐

  1. Cocos Creator Slider(进度条)的三种实现

    实现原理: 方法一:动态计算,slider上增加背景图,根据滑动的进度动态计算背景图的大小:方法二:slider+progress,根据slider滑动的进度,动态改变progress的显示进度:方法 ...

  2. centos----------防火墙firewalld和iptables

    1.CentOS7默认的防火墙不是iptables,而是firewalle. 关闭防火墙 systemctl stop firewalld 启用防火墙 systemctl start firewall ...

  3. Go 初体验 - 令人惊叹的语法 - defer.1 - 基本概念和用法

    在我们编程时,难免遇见 流.远程连接.文件等 io 操作,为了高性能,我们不得不打开和关系这些 io 对象. 在 java.C# 语言里这些打开和关闭的操作都需要程序员自己选择操作时机,一般是在 io ...

  4. Gis数据处理2 ---8.18

    1空间参考: 了解大地水准面,参考椭球体,基准面的概念 以及之间的关系   基准面描述的是参考椭球体中心 跟地心的关系   我们常说的北京54.西安80.CGCS2000,实际上指的是我国的三个大地基 ...

  5. Oarcle的开始

    1.数据库大致分类两种 1.关系型数据库(SQL) Oracle.Mysql(80%).DB2.Microsoft SQL Server.ProsgreSQL.Access.SQLSite 2.非关系 ...

  6. js-cookie的用法

    cookie的作用无需多言,自己封装一个cookie,不停地复制黏贴页颇为麻烦,在这里,有npm为我们封装好的插件js-cookie: https://www.npmjs.com/package/js ...

  7. 机器学习【三】k-近邻(kNN)算法

    一.kNN算法概述 kNN算法是用来分类的,其依据测量不同特征值之间的距离,其核心思想在于用距离目标最近的k个样本数据的分类来代表目标的分类(这k个样本数据和目标数据最为相似).其精度高,对异常值不敏 ...

  8. wireshark抓包结果很多[TCP Retransmission]怎么办?

    有一同事问用wireshark抓包时发现很多[TCP Retransmission],这些包极大影响了自己真正想看的http数据包,如下图. 我拿到pcapng后首先看到这些包的来源ip都是固定的两个 ...

  9. ogg跳过某个RBA

    1.从库复制进程报如下错误 *************************************************************************              ...

  10. opencv学习之路(22)、轮廓查找与绘制(一)

    一.简介 图2 二.代码 #include"opencv2/opencv.hpp" #include<iostream> using namespace std; us ...