自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(43)
  • 资源 (1)
  • 收藏
  • 关注

原创 高版本导入到Mysql5.5 报错 Index column size too large. The maximum column size is 767 bytes

网上文章全是一大抄,全都一样, 问题仍在。做了以下尝试:set global innodb_large_prefix='on';set global innodb_file_format='Barracuda';set global innodb_file_per_table ='on' //这行一定要打开开关,每个表的数据单独保存另外还遇到datetime(6)报错,改成datetime后解决以上尝试解决了我的问题。...

2021-11-05 11:17:49 647

原创 HttpWebRequest 写入流的字节超出指定的 Content-Length 字节大小

我的解决办法:用下面红色的行,替换掉注释行,不设置ContentLength 代码片断: HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(BaseUrl); httpReq.Method = "POST"; //对发送的数据不使用缓存 httpReq.AllowWriteStreamBuffering = false; ...

2021-06-25 16:58:29 2210

原创 C#从picturebox中截取视频拍照并且通过接口发送照片

WPF中使用winform控件picturebox,获取handle调用公司内部接口显示视频。需求分两步,第一步:实现拍照功能;第二步:给别人提供接口将照片推送到页面中。第一步实现: [DllImport("user32.dll")] public static extern IntPtr GetWindowDC(IntPtr hwnd); [DllImport("user32.dll")] public static extern ...

2021-05-10 16:24:45 837

原创 C#event获取订阅者返回值

触发的地方App.httpservice:定义代理: public delegate int PhoneEventHandler(PhoneEventArgs pea);定义事件: public event PhoneEventHandler loginEvent;调用: if (this.loginEvent != null) { //调用...

2021-04-25 18:22:37 684

原创 .netcore api发布到linux

编辑器:Microsoft Visual Studio Enterprise 2019 版本 16.8.2.netcoreapi发布到linux:1、改端口:在Program.cs中: public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefault...

2021-03-23 09:42:23 270

原创 C# LIST LAMBDA表达式排序

//可用IP列表CanUseIPList.Sort((a, b) => a.StrIpaddr.CompareTo(b.StrIpaddr));CanUseIPList是自定义的类

2020-11-18 10:50:57 276

原创 openssl制作ssl证书

1. 生成4096位rsa私钥,采用des算法加密openssl genrsa -des3 -out ca.key 40962.生成CA的自签名证书openssl req -new -x509 -days 3650 -key ca.key -out ca.crtCountry Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:BJLocality Name (eg, city) []:BJ

2020-09-29 16:06:50 371 1

原创 解决C# HttpListener start时端口被占用的问题

我使用HttpListener启动本地https一个本地端口监听,启动时报:在前缀“http://localhost:端口/”上侦听失败,因为它与计算机上的现有注册冲突cmd命令查看netstat -an |findstr ***没有查到端口被监听。使用netsh http show urlacl命令查到以下信息:URL 保留:----------------- 保留的 URL : http://*:端口/ 用户: BUILTIN\...

2020-09-29 10:11:35 6873

原创 C#richtextbox滚动动最后一行

//设置光标的位置到文本尾richTextBoxLog.Select(richTextBoxLog.TextLength, 0);//滚动到光标处 richTextBoxLog.ScrollToCaret();

2020-09-07 16:13:08 632

原创 解决IIS7下asp.net网站无访问会回收并自动停止服务问题的方法

环境win7,遇到的问题是:我在Global中的设置了定时器,每天晚上指定的时间执行一次任务,但未按时执行。经过排查,发现指定的时间点网站已经停止服务 。网上各种解解办法都不解决问题,包括定时访问一个网站。一直到翻到下面的网页:https://www.jb51.cc/aspnet/253727.html,经过尝试还是没能解决我的问题。过了一段时间后网站又停止运行了。静下心来翻看IIS的每个配置。发现一个参数:闲置超时:20,尝试改成0后,问题解决!以下是详细配置过程:一、配置IIS应用程

2020-06-30 10:45:18 1442

原创 WIN10 64位 netframework3.5 IIS10未能加载文件或程序集“System.Web”或它的某一个依赖项

操作系统:win10 64位;IIS:10.ASP.NET程序使用.netframework 3.5编译。在IIS中,使用 .net CLR版本 V2.0.50727在应用程序池中点击高级设置:重点来啦:启用32位应用程序!!!

2020-06-17 10:26:25 1191

原创 mysql参数化模糊查询(like)的用法

mysql版本:MySQL Server 5.5编程语言:asp.net语句:select ..... where ...and a.deptmentName like concat('%',?DeptSelectedValue,'%')";参数化: mysqlPar.Add(new MySqlParameter("?DeptSelectedValue",值));查询结果符合预期。...

2020-06-15 19:02:43 1366

原创 wpf listbox选中项上移下移

用两个按钮实现上移、下移的功能。不知道有没有更好的方法,自己代码使用。sip_List是listbox;btn_upbtn_down是两个按钮。思路:记住选中项,并判断移动时不越界。先删除,再插到指定位置。 private void btn_up_Click(object sender, RoutedEventArgs e) { int iSelectRow = sip_List.SelectedIndex; if ...

2020-05-20 16:51:29 677

原创 C#从Dictionary中查找指定的key或value并将结果存入Dictionary

Dictionary<string, string> FindPublicBaseDic = dic_Public_base_data.Where(item => item.Key.Equals(varValue.ToString())).ToDictionary(item => item.Key, item => item.Value);

2020-04-17 16:52:00 3489

原创 asp.net HTTP Post使用Multipart_FormData方式上传内存数据到Nexus

使用MultipartFormDataContent上传内存数据到nexus,在System.Net.Http.dll, v2.0.0.0中。/// <summary> ///HTTP Post使用Multipart_FormData方式上传内存数据到Nexus /// </summary> /// <param...

2020-03-05 15:48:09 715

原创 C#从List Dictionary string, string 中查找指定的key,并修改对应的值

//从键值对中查找指定的键 var vara = iniCfg.Key_value.Where(cfgkey => cfgkey.Keys.Contains(strKey)); Dictionary<string, string> dicFind = vara.ToList().FirstOrDefault(); ...

2020-03-04 09:50:51 4317

原创 asp.net中gridview SelectedIndexChanged时的取值

如果是模板列:LabelID.Text = ((Label)gvCfgKeyMouldData.SelectedRow.FindControl("lblid")).Text.ToString();如果是普通列:string strID = gvCfgKeyMouldData.SelectedRow.Cells[0].Text.ToString();备忘。...

2020-02-26 16:51:02 552

原创 C#快速合并两个Dictionary

第一个 Dictionary<string, string> PostdicPars已经赋值第二个: Dictionary<string, string> dicPars = new Dictionary<string, string>(); dicPars.Add("appID", strAppId); ...

2019-12-12 09:46:31 3659

原创 C# 获取网卡IP以及mac地址

//使用ManagementClass类,需要引用:using System.Management; /// <summary> /// 获得当前机器的活动中Mac地址\IP,若无联网则返回空"" /// </summary> /// <returns>IP,mac地址</returns> ...

2019-12-11 17:01:38 564

原创 WPF 代码中正确设置image路径

有时候会在代码中更换image的source,正确的设置方式为://从运行目录的子文件夹中的资源文件获取Uri uri = new Uri("pack://application:,,,/images/btn_close.png");//从资源文件中获取Uri uri = new Uri("pack://application:,,,/ReferencedAssembly;comp...

2019-12-11 16:28:32 1017

原创 mysql 远程连接报:Host is not allowed to connect to this MySQL Server

确认在mysql服务器上访问正常,远程不正常时,在mysql服务器上执行以下命令:1.切换到mysql数据库:use mysql;2.执行update user set host = '%' where user = 'root';这一句会报错,忽视错误。3.刷新系统权限表:FLUSH PRIVILEGES;尝试从远程访问,应该可以连接成功。...

2019-10-22 19:40:10 207

原创 asp.net 中updatePanel里面的下载按钮不弹下载页面或功能失效

<asp:UpdatePanel ID="UpdatePanel2" runat="Server" ChildrenAsTriggers="true" UpdateMode="Conditional">中有一个button,后台功能实现EXCEL导出功能: curContext.Response.BinaryWrite(msResult.GetBuffer());...

2019-09-27 18:00:26 507

原创 python项目调试报错:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE

Error info:  django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS...

2019-06-14 09:21:38 1715

原创 C#设置开机启动的方法

       public void SetSetupWindowOpenRun(bool _bool)        {            if (_bool)            {                string setupPath = this.GetType().Assembly.Location;                string desktop ...

2018-09-10 10:01:16 1091 1

原创 asp.net GridView判断第一列值是否相同,若相同,则合并单元格

    int row = 0;    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)    {        //int i;        //for (i = 0; i &lt;= GridView1.Rows.Count; i++)        //{        //...

2018-09-03 15:24:48 998

原创 C#从datatable中检索满足日期类型条件的记录

DataRow drrow = clsYHAlert.dtCurrentAlarmTable.NewRow(); drrow["NMSAlertid"] = 3300165; drrow["platformName"] = "成都6险"; drrow["carrieroperatorName"] = "九2移动"; drr...

2018-07-18 10:08:48 6459 1

原创 sqlserver insert同时返回新插入行自增ID的值

string strSql = "insert into table(a,b,c) values('1','2','3')   SELECT SCOPE_IDENTITY();"查询: //存入数据库    public static int operateSqlServerDbAndReturnPrimaryKey(string strSql)    {        //update,inse...

2018-07-10 15:48:28 5932

原创 外部控件触发DropDownList根据某个Value或Text自动选定记录

1.DropDownListRoles已经绑定数据。2.GridView也已经绑定数据。3.需要根据GridView选定的行,触发DropDownList更改选定的值:DropDownListRoles.SelectedIndex=DropDownListRoles.Items.IndexOf(DropDownListRoles.Items.FindByText(GridView.Selected...

2018-07-10 14:34:14 348

原创 C#实体类根据类的某属性从List去重

//下行从json中解析获取到数据,EntRecordAnalyseResultVo是一个实体类。List&lt;EntRecordAnalyseResultVo&gt; anlysysResVo = AnalyResultList.rows;   //根据SessionId去重:     anlysysResVo = anlysysResVo.Where((x, firstId) =&gt; a...

2018-06-14 14:52:19 1642

原创 sqlite blob存取image并显示到pictureBox上

保存到数据库(关键代码):  SQLiteParameter[] sqlParameters = {                                                      new SQLiteParameter("@buyPicture",DbType.Binary),                                               ...

2018-05-30 11:28:04 2167

原创 asp.net datatable 添加列并且设置列顺序

 clsTable.dtResourceTopView.Columns.Add("承载率(%)", typeof(decimal));                   //调整列顺序 ,列排序从0开始   clsTable.dtResourceTopView.Columns["承载率(%)"].SetOrdinal(4);...

2018-05-16 16:20:16 1550

原创 ASP.NET NPOI HSSFWorkbook合并单元格、设置单元格格式

    ICellStyle MergeCellstyle = workbook.CreateCellStyle();        MergeCellstyle.VerticalAlignment = VerticalAlignment.Center;        MergeCellstyle.Alignment = HorizontalAlignment.Center;        Mer...

2018-05-15 11:55:00 3272

原创 NPOI设置表头(单元格)背景颜色

 HSSFWorkbook workbook = new HSSFWorkbook(); ICellStyle headStyle = workbook.CreateCellStyle(); headStyle.FillPattern =  FillPattern.SolidForeground; headStyle.FillForegroundColor = NPOI.HSSF.Util.HSS...

2018-05-14 17:48:52 5538

原创 asp.net GridView当鼠标经过时,设置颜色,设置表头背景 ,点击行触发SelectedIndexChanged事件

1.首先在页面 &lt;% Page %&gt; 中增加 EnableEventValidation="false"2.在RowDataBound中给每一行添加事件  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)    {                    //首先判断是...

2018-04-28 10:35:26 672

原创 asp.net GridView 隐藏列、设置列宽

    protected void GridView2_RowCreated(object sender, GridViewRowEventArgs e)    {        if (e.Row.Cells.Count &gt;= 4)        {            e.Row.Cells[0].Visible = false;//设置第1列为隐藏列              e....

2018-04-28 10:31:12 815

原创 C# JSON转成实体对象

调用:modelEntJson eJson = JsonHelper.DeserializeJsonToObject&lt;modelEntJson&gt;(strjson); List&lt;modelEntResouces&gt; EntResources = JsonHelper.DeserializeJsonToList&lt;modelEntResouces&gt;(strEntReso...

2018-04-28 10:28:50 11531

原创 asp.net 调用HTTP接口并使用post传递参数

后台代码:调用:      //POST                IDictionary&lt;string, string&gt; parameters = new Dictionary&lt;string, string&gt;();                parameters.Add("sql", strSql);                parameters.Add("...

2018-04-28 10:21:25 9016 1

原创 C# LINQ对datatable中的数据排序分组统计计算

后台代码:datatable:dtSource//汇总统计 var q1 = from dt1 in dtSource.AsEnumerable()//查询 orderby dt1.Field<string>("字段1") descending//排序 ...

2018-04-28 10:13:22 3464

原创 asp.net UpdatePanel中弹出提示信息

后台代码: ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "提示", "alert(' 删除成功!')", true);

2018-04-28 10:02:57 423

原创 ASP.NET DIV后台控制隐藏及显示

前台:&lt;div id="divPlatTop" runat="server" style="border: solid 0px #0094ff; background: #fff; padding: 3px; z-index: 1; position: relative; display: none; top: 0px; margin: 0 auto; width: 100%; height...

2018-04-28 10:01:02 3750

C#通过系统日志获取开关机时间【源码】

通过系统日志获取开关机时间的源码。可扩展获取系统错误码等等信息。

2011-03-26

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除