摘要:按照协议匹配,避免串口数据接收时顺序换乱错误。包头长度地址码回复状态校验和包尾备注C0C002F5AAYYCF成功1,转移字符 a) 数据包基本格式中的数据长度、数据和校验和中如果出现关键字C0、CF或CA则需要在其前端加上转义字符CA,即将数据C0、CF或CA发送成CAC0、CACF或CACA,将...
阅读全文
随笔分类 - 往事追忆录
记录曾经用到的代码
摘要:exec master..xp_cmdshell'net use \\192.168.1.8\testfolder "0123" /user:192.168.1.8\wjp'EXEC master..xp_cmdshell 'bcp FH2_SJH.dbo.dCurrent in c:\tt.txt...
阅读全文
摘要:USE [master]GOALTER DATABASE FH2_SJH SET RECOVERY SIMPLE WITH NO_WAITGOALTER DATABASE FH2_SJH SET RECOVERY SIMPLE --简单模式GOUSE FH2_SJHGODBCC SHRINKFILE (N'FH2_log' , 11, TRUNCATEONLY)GO --这里的DNName_Log 如果不知道在sys.database_files里是什么名字的话,可以用以下注释的语句进行查询USE FH2_SJHGOSELECT file_id, name FROM sys.d
阅读全文
摘要:简单的定义下面的路由事件类,死东西,敲熟练 public class MyRoutedEvents : UIElement { public static readonly RoutedEvent ButtonClickEvent = EventManager.RegisterRoutedEvent("ButtonClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyRoutedEvents)); public event RoutedEventHandler ButtonC...
阅读全文
摘要:下面代码是常用的包装方式,是死的,好好练熟,使劲敲。 public static readonly DependencyProperty NameProperty = DependencyProperty.Register("Name",typeof(string),typeof(Student),new UIPropertyMetadata("王俊鹏")); public string Name { get { return (string)GetValue(NameProperty); } set { SetValue...
阅读全文
摘要:1.新建一个继承Image的基类,因为要在Image对象上画图,所以下面的代码必须放入基类中,如果放在加载图片的主窗体上,背景会变成黑色。 protected override Visual GetVisualChild(int index) { return visuals[index]; } protected override int VisualChildrenCount { get { return visuals.Count; } }下面是新建的基类代...
阅读全文
摘要:public static void loadConfigFile() { ExeConfigurationFileMap file = new ExeConfigurationFileMap(); file.ExeConfigFilename = Application.StartupPath + "\\PermissionAllocator.exe.config"; Program.Config = ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None); }
阅读全文
摘要:设置FileDialog ..::.AutoUpgradeEnabled 属性 为false如果此 FileDialog 实例在 Windows Vista 上运行时应自动升级外观和行为,则为 true;否则为 false。 默认值为 true。 如果此属性为 false,则 FileDialog 类在 Windows Vista 上将具有 Windows XP 样式的外观和行为。在 Windows XP 上,此属性不起任何作用。
阅读全文
摘要:第一种 直接操作byte数组private void SetValue(byte[] byteArr) { byte[] LenK = new byte[4]; byte[] LenIV = new byte[4]; Buffer.BlockCopy(byteArr,0,LenK,0,4); Buffer.BlockCopy(byteArr, 4, LenIV, 0, 4); int lenK = BitConverter.ToInt32(LenK, 0); int lenIV = BitConverter.ToInt32(LenIV, 0); byte[] KeyE...
阅读全文
摘要:对于SQL的Join,在学习起来可能是比较乱的。我们知道,SQL的Join语法有很多inner的,有outer的,有left的,有时候,对于Select出来的结果集是什么样子有点不是很清楚。Coding Horror上有一篇文章,通过文氏图 Venn diagrams 解释了SQL的Join。我觉得清楚易懂,转过来。假设我们有两张表。Table A 是左边的表。Table B 是右边的表。其各有四条记录,其中有两条记录name是相同的,如下所示:让我们看看不同JOIN的不同A表idname1Pirate2Monkey3Ninja4SpaghettiB表idname1Rutabaga2Pirat
阅读全文
摘要:reportInfoForm = new ReportInfoForm(timsControl); reportInfoForm.MdiParent = this; reportInfoForm.Location = new Point(0, 0); reportInfoForm.Show(); particularInfo = new ParticularInfo(timsControl); particularInfo.MdiParent = this; particularInfo.Location = new Point(reportInfoForm.Left, reportInfoF
阅读全文
摘要:本例主要功能为跨线程为控件赋值,并且实现listview控件保持选中状态以及在可见区域显示 /// <summary> /// 为控件赋值的委托 /// </summary> /// <param name="realTimeRecord"></param> delegate void SetListViewCallback2(List<CheckedItRecord> checkedItRecordList); int itemIndex = -1;//初始化listview选中项的索引#region 跨线程绑定
阅读全文
摘要:#region 初始化历史播放列表 /// <summary> /// 初始化历史播放列表 /// </summary> private void InitHistoryPlayList(string date, string deviceID) { try { this.lvwHistoryPlaylists.Items.Clear(); List<CheckedItRecord> checkItRecordList = timsControl.GetPublishSuccessInfo(date, deviceID); if (checkItRecord
阅读全文
摘要:#region 初始化设备信息 /// <summary> /// 初始化设备信息 /// </summary> private void InitVMSDevice() { DataTable dt = timsControl.GetVMSDeviceInfo(); DataRow dr = dt.NewRow(); dr["glid"] = "-1"; dr["azdd"] = "请选择"; dt.Rows.InsertAt(dr, 0); if (dt != null &&am
阅读全文
摘要:#region 上移位置 /// <summary> /// 上移方法 /// </summary> /// <param name="listView"></param> private void ListViewUpMove(ListView listView) { if (listView.SelectedItems.Count == 0) { return; } listView.BeginUpdate(); if (listView.SelectedItems[0].Index > 0) { foreach (
阅读全文
摘要:在网上找的资料int[] intArr = GetRandom1(1, 100000, 10000); /// <summary> /// 获取不重复的随机数数组 /// </summary> /// <param name="minValue">最小值</param> /// <param name="maxValue">最大值</param> /// <param name="count">数量</param> /// <retu
阅读全文

浙公网安备 33010602011771号