解决办法参考:https://github.com/babel/babel-preset-env/issues/186 即在命令行输入命令安装模块:npm install babel-preset-env from:https://blog.csdn.net/acoolgiser/article/details/88814071
View Details第一步
1 |
npm install vue-signature |
第二步 main.js
1 2 |
import vueSignature from "vue-signature" Vue.use(vueSignature) |
vue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
<template> <div id="app"> <vueSignature ref="signature" :sigOption="option" :w="'800px'" :h="'400px'" :disabled="disabled" :defaultUrl="dataUrl" ></vueSignature> <vueSignature ref="signature1" :sigOption="option"></vueSignature> <button @click="save">Save</button> <button @click="clear">Clear</button> <button @click="undo">Undo</button> <button @click="addWaterMark">addWaterMark</button> <button @click="handleDisabled">disabled</button> </div> </template> <script> export default { name: "app", data() { return { option: { penColor: "rgb(0, 0, 0)", backgroundColor: "rgb(255,255,255)", }, disabled: false, dataUrl: "https://avatars2.githubusercontent.com/u/17644818?s=460&v=4", }; }, methods: { save() { var _this = this; var png = _this.$refs.signature.save(); var jpeg = _this.$refs.signature.save("image/jpeg"); var svg = _this.$refs.signature.save("image/svg+xml"); console.log(png); console.log(jpeg); console.log(svg); }, clear() { var _this = this; _this.$refs.signature.clear(); }, undo() { var _this = this; _this.$refs.signature.undo(); }, addWaterMark() { var _this = this; _this.$refs.signature.addWaterMark({ text: "mark text", // watermark text, > default '' font: "20px Arial", // mark font, > default '20px sans-serif' style: "all", // fillText and strokeText, 'all'/'stroke'/'fill', > default 'fill fillStyle: "red", // fillcolor, > default '#333' strokeStyle: "blue", // strokecolor, > default '#333' x: 100, // fill positionX, > default 20 y: 200, // fill positionY, > default 20 sx: 100, // stroke positionX, > default 40 sy: 200, // stroke positionY, > default 40 }); }, fromDataURL(url) { var _this = this; _this.$refs.signature.fromDataURL( "data:image/png;base64,iVBORw0K..." ); }, handleDisabled() { var _this = this; _this.disabled = !_this.disabled; }, }, }; </script> |
from:https://blog.csdn.net/XLL20001022/article/details/101548655
View Details一、索引基础 定义 索引,也叫做“键(Key)”,是存储引擎用于快速查找记录的一种数据结构。索引对于良好的性能非常关键,索引是对查询性能优化最有效的手段。 索引类型 1.B-Tree索引 当人们谈论索引的时候,如果没有特别指明类型,那多半说的是B-Tree索引,它使用B-Tree数据结构来存储数据。B-Tree通常意味着所有的值是按顺序存储的,并且每一个叶子节点到根的距离相同。 B-Tree索引的几个匹配原则: a.全值匹配:和索引中的所有列进行匹配。 b.匹配最左前缀:即索引的第一列。 c.匹配列前缀:即只匹配某一列的值的开头部分。 d.匹配范围值。 e.精确匹配某一列并范围匹配另外一列。 f.只访问索引的查询,即:覆盖索引。 B-Tree索引的几个限制(索引失效): a.不是按照索引的最左列开始查找,则不能使用索引。 b.不能跳过索引中的列。 c.如果查询中有某个列的范围查询,则其右边所有列都无法使用索引。 2.哈希索引 哈希索引(hash index)基于哈希表实现,只有精确匹配索引所有列的查询才有效。在MySQL中只有Memory引擎显式支持哈希索引。我们在这里只作了解。 3.R-Tree索引 R-Tree索引(空间数据索引),可以用作地理数据存储。MySQL中目前仅MyISAM引擎支持。与B-Tree不同,此类型的索引无须前缀查询。必须使用MySQL的GIS相关函数来维护数据,但遗憾的是MySQL的GIS支持并不完善。 4.全文索引 全文索引是一种特殊类型的索引,它查找的是文本中关键词,而不是直接比较索引中的值。全文索引更类似于搜索引擎做的事情,而不是简单的WHERE条件匹配。 二、索引的优点 优点: 1.索引大大减少了服务器需要扫描的数据量。 2.索引可以帮助服务器避免排序和临时表。 3.索引可以将随机I/O变为顺序I/O。 什么样的表需要使用索引?简单的说应该遵循以下3条准则: 1.非常小的表:全表扫描更高效。 2.中到大型表:索引非常有效。 3.特大型的表:创建和使用索引的代价非常高。如果表有大量插入和更新,更新索引将是很大的一个开销。对于特大表,建议使用表分区技术,分区后再使用索引。 三、高性能的索引策略 示例以【居民表:resident】为例,以下是此表的结构: 1.独立的列 独立的列是指索引列不能是表达式的一部分,也不能是函数的参数。 反例: 2.前缀索引和索引选择性 前缀索引:如果需要索引的字符列很长,这会让索引变得大且慢。通常可以只索引此列开始的部分字符。这样可以大大节约索引空间,从而提高索引效率。 索引选择性:是指不重复的索引值和数据表的记录总数的比值。此值越高,索引效率越高。例如:唯一索引和主键的索引选择性是1,性能也是最好的。 索引选择性是创建前缀索引依据。 例子:给列RESIDENT_NAME加索引,varchar(500)显然太长了,我们用前缀做索引。 先计算完整列的选择性:0.4867 再计算最接近的前缀选择性,可以看到15个字符后,20个字符也是0.4867,因此15个字符作为前缀是最合适的。 最后创建索引: 3.多列索引 很多人对多列索引的理解都不够。一个常见的错误是:为每个列都创建独立的索引;另一个是按照错误的顺序创建多列索引。 反例:独立索引对多条件查询的性能提升是很小的,一般只能匹配到一个索引,效率肯定要大打折扣的。 正例:创建一个多列索引,扫描的行数马上降了下来,快了十几倍,这还只是个简单的示例。 4.选择合适的列顺序 最让人困惑的问题莫过于索引列的顺序,正确的顺序依赖于使用该索引的查询。也要考虑到排序和分组的需要。 例子:是什么让我决定以SP_ID在前创建了上面的多列索引:SP_ID_GENDER_CODE ? 答案是:计算各列的选择性。 5.聚簇索引 聚簇索引并不是一种单独的索引类型,而是一种数据存储方式。InnoDB的聚簇索引实际上在同一个结构中保存了B-Tree索引和数据行。主键就是一个典型的聚簇索引。 6.覆盖索引 如果一个索引包含要查询的所有字段,不需要再去表里读取数据,这样的索引就叫做覆盖索引。覆盖索引能极大的提高查询性能。 例子:把查询中需要的字段改为索引中的字段时,这样一个覆盖索引就形成了。索引也只匹配到多列索引,ref也变为了常数。Extra也显示了Using index。 7.用索引做排序 可以用同一个索引既满足排序,又用于查询。这样的索引是最优的,历为我们日常工作中遇到查询一般都是要排序的。这里有个限制:如果查询涉及到多表联合,排序用的字段必须全部是第一个表的,才能使用索引做排序。 例子: 8.冗余和重复索引 重复索引:是指在相同的列上按照相同的顺序创建的相同类型的索引。避免出现这样的情况,发现要删除。 冗余索引:是指一个或多个列同步出现在多个索引中,各索引的列数、顺序不同。冗余索引也应避免。但有时查询写的不合理,可能出现单独为优化某个查询出现的冗余索引。 P.S 创建冗余索引时可能影响其他索引的匹配,从而导致以前的查询性能降低。 四、索引案例 索引 index(a, b, […]
View DetailsServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; 调用对方提供的webservice 方法之前,加上这一句,即可解决。 ———————————————— 版权声明:本文为CSDN博主「qq_42072922」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_42072922/article/details/82620052
View Details在后台代码中进行基于https协议的请求时,我们经常会遇到一个错误:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel(基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。) 1,先加入命名空间: using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; 2,再重载CheckValidationResult方法,返回true private bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } 3.然后在执行请求的代码之前加上 ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; 通过以上三步忽略证书的错误,但是不安全,其他解决方式可以参考https://stackoverflow.com/questions/703272/could-not-establish-trust-relationship-for-ssl-tls-secure-channel-soap 然而,对于一些https接口,加了上述代码之后,调用时回报错:基础连接已经关闭: 发送时发生错误 发生该错误的原因是,使用上述代码默认是以ssl安全协议进行的,但是有些https接口服务并没有使用ssl安全协议,具体参考 https://stackoverflow.com/questions/28286086/default-securityprotocol-in-net-4-5 解决方案1:硬编码,枚举出所有的安全协议,比较简单 在ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;这行代码前面加上如下代码: ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; 解决方案2:让OS自动选择安全协议(推荐) https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls from:https://blog.csdn.net/ujm097/article/details/89334667
View Details前面的文章说了怎么实现代理类的生成我使用。 在使用的过程 中我又碰到了一个很棘手的问题这是我的代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
//官方查询结果xml [WebMethod ] public OrderNciis GetNciisResult(string onName, string onId) { //获取授权文件 string inLicense = LotteryMethods.GetContext(11); //生成的WSDL类() nciicGetCondition objText = new nciicGetCondition(); //获取基础URL objText.Url = LotteryMethods.GetContext(12); //编码 objText.RequestEncoding = Encoding.UTF8; //创建证书文件 X509Certificate objx509 = new X509Certificate(System.Configuration.ConfigurationSettings.AppSettings["cd"].ToString().Trim()); //证书 objText.ClientCertificates.Add(objx509); //方式可有可无 objText.UserAgent = "Client Cert Sample"; //读XML文件 string inConditions = OrderNciisXml(onName, onId); //返回查询结果XML OrderNciis model = new OrderNciis(); model.onLottery = objText.nciicCheck(inLicense, inConditions); return model; } |
代码应该是没有问题,在本地的Vs里测试没有问题,如果在ISS里使用时报基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系”证书验证失败 城刚开始我还以为是文章路径的问题,结果不是, 接着找,后来认为是IIS里配置问题,还是不对,后来,看到 网上也有很多这的问题,但是没有真正解决的,一般都 是在说怎么生成代理类,还有带有证书的过程 我想了想,还是自己想办法解决吧,我把代理类分析了一下才知道 ,原来证书是在代理类里验证的,验证后会返回一个值 表示是否通过,这就好看了, 我们定义一个方法
1 2 3 4 5 6 7 |
private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error){ // trust any certificate!!! System.Console.WriteLine("Warning, trust any certificate"); //为了通过证书验证,总是返回true return true; } |
只要这个方法返回为True不就完了吗?呵呵 还需要几个命名空间
1 2 3 4 |
using System.Net; using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; |
这个应该在什么时候调用呢,当然 是在构造器里合适些
1 2 3 4 5 6 |
/// <remarks/> public nciicGetCondition() { //验证服务器证书回调自动验证 ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate; } |
from:https://www.cnblogs.com/sufei/archive/2010/03/23/1692811.html
View Details要想知道每个数据库的大小的话,步骤如下: 1、进入information_schema 数据库(存放了其他的数据库的信息) use information_schema; 2、查询所有数据的大小: select concat(round(sum(data_length/1024/1024),2),’MB') as data from tables; 3、查看指定数据库的大小: 比如查看数据库home的大小 select concat(round(sum(data_length/1024/1024),2),’MB') as data from tables where table_schema=’home'; 4、查看指定数据库的某个表的大小 比如查看数据库home中 members 表的大小 select concat(round(sum(data_length/1024/1024),2),’MB') as data from tables where table_schema=’home' and table_name=’members'; from:https://blog.csdn.net/weixin_34050389/article/details/89826749
View Details
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
public partial class _404 : System.Web.UI.Page { /// <summary> /// 目标服务器URL /// </summary> private readonly string targetUrl = "目标服务器"; protected void Page_Load(object sender, EventArgs e) { var folderPath = ""; try { // PrintSeverVariables(); // 取出资源地址 var fullUrl = Request.ServerVariables["QUERY_STRING"]; // 全地址 var resourceUrl = Regex.Replace(fullUrl, @"404;https?\://[^/]+", ""); // 取出文件名 var lastMatch = Regex.Match(resourceUrl, @"[^/]+(?!.*\.xlsx?)"); if (!lastMatch.Success || lastMatch.Groups.Count < 1) { Response.StatusCode = 404; return; } var fileName = lastMatch.Groups[0].Value.Split('?')[0]; if (string.IsNullOrEmpty(fileName) || fileName.IndexOf('.') < 0) { Response.StatusCode = 404; return; } // 扩展名 var extensionName = fileName.Split('.')[1].ToLower(); if (extensionName != "xls" && extensionName != "xlsx") // 只拉取excel文件 { Response.StatusCode = 404; return; } // 拉取文件 并保存 using (var stream = Get(targetUrl + resourceUrl)) { // 创建文件夹 folderPath = Server.MapPath(resourceUrl.Replace(fileName, "").Replace("/jq", "")); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } // 保存文件 SaveFile(stream, folderPath + fileName); } // 转向拉取的静态资源 Response.ContentType = "application/octet-stream"; Response.WriteFile(folderPath + fileName); } catch (Exception ex) { Response.StatusCode = 404; return; } } /// <summary> /// 保存文件 /// </summary> /// <param name="stream"></param> /// <param name="fileName"></param> public void SaveFile(Stream stream, string fileName) { // 保存文件 using (var fs = new FileStream(fileName, FileMode.OpenOrCreate)) { stream.CopyTo(fs); fs.Close(); stream.Close(); } } /// <summary> /// Get请求 /// </summary> /// <param name="url"></param> /// <param name="postData"></param> /// <returns></returns> static Stream Get(string url) { //请求 var request = (HttpWebRequest)WebRequest.Create(url); request.Timeout = 600000; // 600秒 request.Method = "GET"; //接收 var response = (HttpWebResponse)request.GetResponse(); return response.GetResponseStream(); } /// <summary> /// 打印环境变量 /// </summary> void PrintSeverVariables() { foreach (string key in Request.ServerVariables) { Response.Write("<b>" + key + ":</b>" + Request.ServerVariables[key] + "<br>"); } } } |
View Details
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
public HttpResponseMessage ImportTemplate(string fileName) { var context = HttpContext.Current; var response = new HttpResponseMessage(HttpStatusCode.OK); var path = context.Server.MapPath("~/App_Data/" + fileName); if (string.IsNullOrEmpty(fileName) || !File.Exists(path)) { response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent($"<meta charset=\"utf-8\"><h3>【{fileName}】不存在。</h3>", Encoding.UTF8) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return response; } var stream = new FileStream(path, FileMode.Open, FileAccess.Read); response.Content = new StreamContent(stream); response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = HttpUtility.UrlEncode(fileName) }; response.Headers.Add("Access-Control-Expose-Headers", "FileName"); response.Headers.Add("FileName", HttpUtility.UrlEncode(fileName)); return response; } |
View Details