zoukankan      html  css  js  c++  java
  • [随手记]笔记+经验集

    2016年6月23日11时22分09秒 6 新增

    -2. text-overflow:ellipsis 显示省略符号来代表被修剪的文本。

    常用 css 本样式在:http://www.w3school.com.cn/cssref/pr_text-overflow.asp

    html 标签对于 C# 的正则表达式是:(?<=<AA>).+?(?=</AA>)

    -1. 用 IE 调试脚本时,总遇到提示 Internet Explorer已限制此网页运行脚本或activex控件

    关闭方法:工具 – Internet选项 – 高级标签 – 安全 分类下面,勾选“允许活动内容在我的计算机上的文件中运行*”后重启 IE 即可。
    此方法也适用于所有阻止本地脚本运行的IE版本。 

     [google 插件API]http://open.chrome.360.cn/extension_dev/manifest.html

    0. C# winform (http://www.cnblogs.com/fsjohnhuang/p/4310533.html)

    // 将这句代码放到设计文件里可以防止 DPI 变化导致的窗体变形this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134)));this.tssVer.Text = string.Format(" 当前版本:v {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());

    防止 DataGridView 闪烁,可以加入以下代码:

    转自:http://www.cnblogs.com/WilliamJiang/archive/2012/06/19/2555023.html

    Type type = dataGridView1.GetType();PropertyInfo pi = type.GetProperty("DoubleBuffered",BindingFlags.Instance | BindingFlags.NonPublic);pi.SetValue(dataGridView1, true, null);

     加入这段代码,再将文件生成改成 嵌入的资源,就可以从资源文件取得图标或图片:

    string _namespace = MethodBase.GetCurrentMethod().DeclaringType.Namespace;
    Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Concat(_namespace, ".favicon.ico"));
    if (stream != null)
        //Image myImage = Image.FromStream(stream);
        icon = new Icon(stream);

    Kotlin 数据类型范围

    数据类型最小值 最大值 空间大小 
    Byte -128 127 8bit
    Short -32768 32767 16bit
    Int -2147483648 2147483647 32bit
    Long -9223372036854775807 9223372036854775807 64bit

    1. 数据库建表 MSSQL

     常用字段  数据类型  说明
     AddTime  char(19)  添加记录时间,Convert(char(19),GetDate(),120),日期 + 时间
     AddMaker  varchar(30)  添加记录的userid
     EditTime  char(19)  修改记录时间,Convert(char(19),GetDate(),120),日期 + 时间
     EditMaker  varchar(30)  修改记录的userid
     IsEnable  tinyint  记录是否可用,1 可用,使用范围 0~127
     _type  char(1)  与 IsEnable 类似,表示记录类型,通常使用 A-Z
     _status  char(1)  与 IsEnable 类似,表示记录类型,通常使用 A-Z
     _version  tinyint  记录版本,用时间表示。也可以考虑 timestamp
     ID  int  primary key identity(1,1) 自增主键
     menuid  smallint  主键,唯一标识,使用范围 1~32766
     parentid  smallint  关联 menuid 用,使用范围 0~32000

     目前制作的程序并没有过多使用量,单部门单表一个月记录 5000条以内,用 int 做自增主键够用。

     menuid 、parentid 主要用于父子级关联

     手动维护时 parentid 是 10 的倍数,比如

    menuid parentid
    10 0
    11 10
    12 10
    13 10
    20 0
    21 20
    22 20
    30 0
    31 30
    32 30

    当然,代码自动生成 menuid 、parentid 时就没这么直观了。

    目前没有遇到过数据库迁移,用不上 GUID 也不喜欢看那么长的字符串。

    insert数据的时候返回自动编号的id,有三种方法实现SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY,它们都返回插入到 IDENTITY 列中的值。 

    SCOPE_IDENTITY :返回为当前会话和当前作用域中的任何表最后生成的标识值

     --下面2行用于清除除零错误,当出现以零除的错误时不报错,而让其为 null。

     -- 转自:http://www.2cto.com/database/201212/173885.html
      SET ANSI_WARNINGS off 
     
      SET ARITHABORT off 

    2. 权限设置 可以参照 Win 7

    对于操作敏感数据,可以先判断权限,不满足的情况下弹出验证窗体,得拥有权限的帐户验证通过了才可以继续。

    而不必武断的拒绝。

    3. 用户模块 可以参照窗体

    登录ID 用户名
    IT00 电脑部
    IT01 张三
    IT02 李四
    QC00 质检部
    QC01 王五
    QC02 赵六
    QC03 钱七

    4. 窗体界面内权限

    常用权限
    查看
    增加
    修改
    删除
    ToExcel

    若还有其它功能按钮,编码时也加入相应权限控制。

    5. NSIS

    用 NSIS 制作安装程序:

    在脚本中实现 DLL 自注册,在一个普通节中调用 RegDLL 进行注册。在 Uninstall 中取消自注册.

    Section "Registration"
    RegDLL "$INSTDIRgregn6.dll"
    RegDLL "$INSTDIRgrdes6.dll"
    ...
    SectionEnd

    Section Uninstall
    UnRegDLL "$INSTDIRgregn6.dll"
    UnRegDLL "$INSTDIRgrdes6.dll"
    ...
    SectionEnd

     

    或者像这样:  

    ExecWait 'regsvr32 /s "$INSTDIRcomdlg32.ocx"'

    卸载:

    ExecWait 'regsvr32 /s /u "$INSTDIRcomdlg32.ocx"'

     

    6. 常用英文词汇

    description 说明书

    condition 条件

    User Guide 用户指南

     

    7. MSSQL 转换时间格式  

    Date 和 Time 样式

    如果 expression 为 date 或 time 数据类型,则 style 可以为下表中显示的值之一。其他值作为 0 进行处理。SQL Server 使用科威特算法来支持阿拉伯样式的日期格式。 

    不带世纪数位 (yy) (1)带世纪数位 (yyyy)标准输入/输出 (3)

    -

    0100 (1,2)

    默认

    mon dd yyyy hh:miAM(或 PM)

    1

    101

    美国

    mm/dd/yyyy

    2

    102

    ANSI

    yy.mm.dd

    3

    103

    英国/法国

    dd/mm/yyyy

    4

    104

    德国

    dd.mm.yy

    5

    105

    意大利

    dd-mm-yy

    6

    106(1)

    -

    dd mon yy

    7

    107(1)

    -

    mon dd, yy

    8

    108

    -

    hh:mi:ss

    -

    9109 (1,2)

    默认设置 + 毫秒

    mon dd yyyy hh:mi:ss:mmmAM(或 PM)

    10

    110

    美国

    mm-dd-yy

    11

    111

    日本

    yy/mm/dd

    12

    112

    ISO

    yymmdd

    yyyymmdd

    -

    13113 (1,2)

    欧洲默认设置 + 毫秒

    dd mon yyyy hh:mi:ss:mmm(24h)

    14

    114

    -

    hh:mi:ss:mmm(24h)

    -

    20120 (2)

    ODBC 规范

    yyyy-mm-dd hh:mi:ss(24h)

    -

    21121 (2)

    ODBC 规范(带毫秒)

    yyyy-mm-dd hh:mi:ss.mmm(24h)

    -

    126 (4)

    ISO8601

    yyyy-mm-ddThh:mi:ss.mmm(无空格)

    -

    127(6, 7)

    带时区 Z 的 ISO8601。

    yyyy-mm-ddThh:mi:ss.mmmZ

    (无空格)

    -

    130 (1,2)

    回历 (5)

    dd mon yyyy hh:mi:ss:mmmAM

    -

    131 (2)

    回历 (5)

    dd/mm/yy hh:mi:ss:mmmAM

    1 这些样式值将返回不确定的结果。包括所有 (yy)(不带世纪数位)样式和一部分 (yyyy)(带世纪数位)样式。

    2 默认值(style010091091311320120 以及 21121)始终返回世纪数位 (yyyy)。

    3 转换为 datetime 时输入;转换为字符数据时输出。

    4 为用于 XML 而设计。对于从 datetimesmalldatetime 到字符数据的转换,其输出格式如上一个表所述。

    5 回历是有多种变体的日历系统。SQL Server 使用科威特算法。

    重要提示:
    默认情况下,SQL Server 基于截止年份 2049 年来解释两位数的年份。换言之,就是将两位数的年份 49 解释为 2049,将两位数的年份 50 解释为 1950。许多客户端应用程序(如基于自动化对象的应用程序)都使用截止年份 2030 年。SQL Server 提供了“两位数年份截止”配置选项,可通过此选项更改 SQL Server 使用的截止年份,从而对日期进行一致处理。建议您指定四位数年份。
     
    获取连接字符串路径
    string connStr = SqlHelper.connStr;if (string.IsNullOrEmpty(connStr))    throw new ApplicationException("遇到未初始化的连接!");connInfo = new ConnectionInfo();int x = connStr.IndexOf("Data Source") + "Data Source".Length + 1;int y = connStr.IndexOf(";", x);int z = connStr.Length;connInfo.ServerName = connStr.Substring(x, (y < 0 ? z : y) - x);x = connStr.IndexOf("Initial Catalog") + "Initial Catalog".Length + 1;y = connStr.IndexOf(";", x);connInfo.DatabaseName = connStr.Substring(x, (y < 0 ? z : y) - x);x = connStr.IndexOf("User ID") + "User ID".Length + 1;y = connStr.IndexOf(";", x);connInfo.UserID = connStr.Substring(x, (y < 0 ? z : y) - x);x = connStr.IndexOf("Password") + "Password".Length + 1;y = connStr.IndexOf(";", x);connInfo.Password = connStr.Substring(x, (y < 0 ? z : y) - x);

    开发时遇到Sql Server 数据库连接不上,提示连接超时。

    经过大量时间排查,结果发现,使用 TOP 100 时可以查询,原来原因是表中数据太多, SELECT * FROM TABLE 超时导致的。

    [转] LigerUI 经验

    layout各个区域我试过了很多办法都加不上滚动条,center区域的div一通到底,有一部分跟bottom重叠了
    这个可以通过用$('.l-layout-left').height()获得高度,然后在你的center区域放一个
    <div id="centerContent" style="overflow : auto"></div>
    ,再用
    $('#centerContent').css({'height' : $('.l-layout-left').height() + 'px'});
    这样就可以解决了!

    // 创建空白配置文件代码

    if(!File.Exists(PublicString.xmlPath))
        new XDocument(new XElement("configuration")).Save(PublicString.xmlPath);

    [读 config 配置]

    public static string GetConfigValue(string appKey)        {            XmlDocument xDoc = new XmlDocument();            XmlNode xNode;            XmlElement xElem = null;            try            {                xDoc.Load(configPath);                xNode = xDoc.SelectSingleNode("//appSettings");                xElem = (XmlElement)xNode.SelectSingleNode("//add[@key="" + appKey + ""]");                if (xElem != null)                {                    return xElem.GetAttribute("value");                }                else                {                    return "";                }            }            catch            {                return "";            }        }

     MD5 加密

    byte[] buffer = (new System.Security.Cryptography.MD5CryptoServiceProvider()).ComputeHash(System.Text.Encoding.UTF8.GetBytes(var));Console.WriteLine(BitConverter.ToString(buffer).Replace("-",""));

     未验证的 Excel 另存为

    excel.ActiveWorkbook.SaveAs(sfd.SelectedPath.ToString()+"\"+ Path.GetFileName(CMBfile.Items[i].ToString()), Excel.XlFileFormat.xlAddIn, null, null, false, false, Excel.XlSaveAsAccessMode.xlNoChange, null, null, null, null, null);

     ashx 跳转到另一页面: context.Server.Transfer("XXX.aspx");

    自己强制结束自己的进程 :

    Process.GetProcessById(Process.GetCurrentProcess().Id).Kill();
  • 相关阅读:
    python读取xml文件报错ValueError: multi-byte encodings are not supported
    使用命令创建jenkins的job,解决jenkinsapi.custom_exceptions.JenkinsAPIException错误
    使用Python命令创建jenkins的job
    使用selenium grid分布式执行之一
    使用python 操作liunx的svn,方案二
    使用python 操作liunx的svn,方案一
    使用shell脚本实现在liunx上进行svn的上传下载更新功能
    java连接ssh执行shell脚本
    perl学习(二)正则表达式
    googletest进行单元测试(使用cmake编译)
  • 原文地址:https://www.cnblogs.com/z5337/p/4802262.html
Copyright © 2011-2022 走看看