shaoshao
茶飘香,酒罢去,聚朋友,再回楼。
Your story may not have such a happy beginning,
but that doesn’t make who you are.
It’s the rest of your story,who you choose to be.
为天地立心,为生民立命,为往圣继绝学,为万世开太平。
你不是父母续集,子女的前传,朋友的番外。你不妨大胆点生活,不要因为没有掌声而丢掉梦想,不要因为看不清前路而轻易放弃。我相信你生来就是高山,而非溪流。亲爱的,勇敢而热烈的活着吧。
2023新春快乐!
2023新春快乐!
旧岁千般皆如意,新年万事定称心!
命令行Tab自动补全
Windows命令行Tab自动补全
使用win+r打开 运行 控制台
输入 regedit 打开注册表
进入HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar 将值改为十进制的 9 ;点击确定
以后运行CMD的时候 输入首字母按住 TAB键就能自动补全输入的命令了。
ArcGIS自定义Python工具箱
ArcGIS 自定义 Python 工具箱Python 工具箱模板12345678910111213141516171819202122232425262728293031323334353637383940414243444546# -*- coding: utf-8 -*-import arcpyclass Toolbox(object): def __init__(self): # 定义工具箱(工具箱的名称是.pyt文件的名称)。 self.label = "Toolbox" self.alias = "" # 与此工具箱关联的工具类列表 self.tools = [Tool]class Tool(object): def __init__(self): # 定义工具(工具名称是类的名称)。 self.label = "Tool" self.description = "" ...
Arcpy发布矢量切片服务
Arcpy发布矢量切片服务main.py1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import arcpyimport osimport shutilimport uuidimport argparseimport sysimport zlogimport jsonparser = argparse.ArgumentParser()parser.add_argument('-shp', '--shapefile-path', type=str, help='ShapeFile Path')parser.add_argument('-sn', '--service-name', type=str, ...
Arcpy导出ArcGIS全部坐标系及目录结构
Arcpy导出ArcGIS全部坐标系及目录结构1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import arcpyimport osimport jsondef checkDir(dir): if not os.path.exists(dir): os.makedirs(dir)# 获取所有内置的坐标系spatial_references = arcpy.ListSpatialReferences()# 输出坐标系文件的目录output_directory = r"D:\file\program\py\ExportSpatialReference\output"# 遍历所有坐标系并导出为.prj文件for spatial_reference in spatial_references: try: # 创建一个空间参考对象 ...
WPF中添加System.Windows.Forms.dll
WPF中添加System.Windows.Forms.dll在项目文件中添加配置项 <UseWindowsForms>true</UseWindowsForms> 即可,位置如下:
123456<PropertyGroup> <TargetFramework>net6.0-windows</TargetFramework> <Nullable>enable</Nullable> <UseWPF>true</UseWPF> <UseWindowsForms>true</UseWindowsForms></PropertyGroup>
System.OverflowException: 数组维度超过了支持的范围。
System.OverflowException: 数组维度超过了支持的范围。Code:
12345678910111213FileStream fs = File.OpenRead(file);byte[] buffer = new byte[fs.Length];fs.Read(buffer, 0, buffer.Length);string tempfile = file.Substring(staticFile.LastIndexOf("\\") + 1);ZipEntry entry = new ZipEntry(tempfile);entry.DateTime = DateTime.Now;entry.Size = fs.Length;fs.Close();crc.Reset();crc.Update(buffer);entry.Crc = crc.Value;outstream.PutNextEntry(entry);outstream.Write(buffer, 0, buffer.Length);
日志:
[2023-09-25 15:21:2 ...
文件流定位时报错:试图将文件指针移到文件开头之前。
文件流定位时报错:试图将文件指针移到文件开头之前。Code:
1234567891011byte[] fileContentByte;if (totalChunk == curChunk){ var temp = new FileInfo(filePath).Length - (totalChunk - 1) * BYTES_PER_CHUNK; fileContentByte = new byte[temp];}else fileContentByte = new byte[BYTES_PER_CHUNK];// position 类型 intfs.Seek(position, SeekOrigin.Begin);fs.Read(fileContentByte, 0, fileContentByte.Length);
日志:
[2023-09-26 11:21:29.244 +08:00] [INF] PostUtil.cs UploadFormdataWithParaAsync:47 上传切片文件: 1024 / 5559[202 ...
WMS,WFS,WMTS,TMS互联网地图服务
WMS,WFS,WMTS,TMS互联网地图服务作为一个地图开发者,当然要对互联网地图服务有一个认识。
首先,要知道有这么一个联盟,叫OGC(Open Geospatial Consortium),这个联盟/组织定义了很多关于互联网地图的规则。
然后,开发者,企业,组织机构依照这个规则进行地理信息系统的开发。
事实上互联网地图的数据源也就那么几个。换句话说,能作为地图数据源的数据格式有限。那让我们先来介绍一下互联网地图的常用数据源,数据格式。
1.一张图片是肯定可以作为地图数据源的。例如一张tiff格式的遥感影像,作为地图当然可以,另外,我们从arcgis中导出一张jpeg,png格式的地图,再通过网络发布出去当然也行。
那么,第一种地图数据源我们暂且可以概括为image(图片)类型的。
2 .矢量形式的,就像在arcgis里我们用编辑工具绘制的那种第五轮廓的多边形。还有一些不随放大程度改变而失真的SVG图形。这些都是矢量类型的。举个例子就是我们从arcgis中
导出一个shapefile,shp文件,把它发布成互联网地图,也是可以的。这种类型我们归纳为vector(矢量)类型 ...
Sandcastle:.NET API文档构建器
Sandcastle:.NET API文档构建器
Sandcastle 软件安装GitHub仓库地址:Releases · EWSoftware/SHFB (github.com)
安装说明:安装说明 (ewsoftware.github.io)
使用说明官方文档:Welcome (ewsoftware.github.io)
常见报错:Errors and Warnings (ewsoftware.github.io)
演练:创建您的第一个项目本演练将指导您创建第一个帮助文件生成器项目。
重要
本演练假定您使用的是帮助文件生成器的独立 GUI。如果你 正在使用Visual Studio扩展包,过程类似,但命令位置会有所不同 在某些情况下。有关 Visual Studio 扩展包的概述以及如何在其中查找与 独立 GUI,请参阅 Visual Studio 集成包主题。
先决条件在创建帮助文件生成器项目之前,请确保已安装所有必要的工具,并且已在项目中启用了 XML 注释,并且 在代码中添加了一些注释。
新项目创建一个全新的项目
选择文件 |新项目
在“ ...
Zhy.Components.Wpf:WPF组件库
Zhy.Components.Wpf:WPF组件库
ComponentsZDataGrid - UserControlDemo
ZDataGrid-IsReadOnly
ZDataGrid
ZDataGrid-ZFormTextColumn
ZDataGrid-ZFormTextButtonColumn
ZDataGrid-ZFormComboColumn
ZDataGrid-ZFormMultiCheckColumn
ZDataGrid-Search
ZFormDialog - WindowsDemo
ZFormDialog
DocAPI帮助文档
ZhyForm:WPF台账自定义用户控件
ZhyFormZDataGrid:WPF台账用户控件,支持CheckBox、ListBox、TextBox样式信息显示,支持操作列、顶部控制项自定义功能按钮,支持信息查询功能;
GitHub仓库地址
代码示例Xaml:
123456789101112131415<Window x:Class="zhy.common.datagrid.core.test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:lib="clr-namespace:zhy.common.datagrid.core.view;assembly= ...
ZhyForm:WPF表单组件
ZhyForm:WPF表单组件WPF表单组件,表单项支持:简单文本、格式校验文本、多选项、按钮选择项,支持两种界面风格。
ZFormDialog
ZFormGrid
GitHub地址:ZhyForm:WPF表单组件
目录说明:
zhy.common.form:基于.Net Framework 4.8框架。
zhy.common.form.core:基于.Net 6.0框架。
项目引用:
编译源码后,在项目中添加编译生成的zhy.common.form.dll或zhy.common.form.core.dll引用;Dll文件
在解决方案中直接引入zhy.common.form.csproj或zhy.common.form.core.csproj项目;
代码示例:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081//简单输入项ZT ...
加密算法
SM2加解密Code1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992 ...
Arcpy 调用gp分析工具提示未获得许可
Arcpy 调用gp分析工具提示未获得许可
解决方法:调用gp分析工具前,添加如下代码
12if arcpy.CheckExtension("spatial") == "Available": arcpy.CheckOutExtension("spatial")
WPF全局未处理异常捕获
WPF全局未处理异常捕获事件订阅1System.Windows.Application.DispatcherUnhandledException += Application_DispatcherUnhandledException;
Application_DispatcherUnhandledException方法1234private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e){ ProMessageUtils.ShowDialog($"捕获未处理异常:{e.Exception.Message}\r\n{e.Exception.StackTrace}", "错误", System.Windows.MessageBoxButton.OK, System.Windows.Messa ...
C#开发工具类
CommonEnumUtils123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293public static class EnumUtils{ public static string GetDescription(this System.Enum obj) { string objName = obj.ToString(); Type t = obj.GetType(); FieldInfo fi = t.GetField(objName); DescriptionAttribute[] descriptionAttributes = (DescriptionAttribute[ ...
Windows访问网络共享失败解决办法
Windows访问网络共享失败解决办法网络错误Windows 无法访问 192.168.200.121 请检查名称的拼写。否则,网络可能有问题。要尝试识别并解决网络问题,请单击“诊断”。查看详细信息——————————————————————————-诊断(D)———-取消—————————
解决:
12//cmdnet use \\地址 密码 /user:用户
C#实现程序卸载功能效果,删除程序自身
思路一通过调用 cmd 运行删除文件、目录命令实现。
code12345678910111213141516171819202122232425262728Dictionary<string,string> Uninstall_RemoveList = new Dictionary<string, string>() { { "d:\\test\\UninstallApp\\conf", "d" }, { "d:\\test\\Uninstall\\UninstallApp.exe", "f" }, { "d:\\test\\Uninstall\\UninstallApp.dll", "f" }, { "d:\\test\\UninstallApp\\log", "d" }};//因 ...
Windows注册表记录
Windows注册表记录
\HKEY_CLASSES_ROOT\SystemFileAssociations\ — 文件鼠标右键打开方式
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall — 卸载软件软件
C# 类型转换器 TypeConverter
自定义类型转换器1234567891011121314151617181920212223242526272829303132333435363738394041424344454647using System;using System.ComponentModel;using System.Globalization;using System.Drawing;public class PointConverter : TypeConverter { // Overrides the CanConvertFrom method of TypeConverter. // The ITypeDescriptorContext interface provides the context for the // conversion. Typically, this interface is used at design time to // provide information about the design-time container. public ...