param

Redis的增删改查 c# key value类型和hash map 类型

为君一笑 提交于 2019-12-02 21:33:46
using Newtonsoft.Json; using StackExchange.Redis; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AIMS.RedisMng { public class RedisContext : IRedisContext { private readonly static string REDIS_CONN = "127.0.0.1:6379"; private readonly static string REDIS_IP = "127.0.0.1"; private readonly static int REDIS_PORT = 6379; private ConnectionMultiplexer redis = null; //private StackExchange redis = null; private IDatabase database = null; private IServer server = null; private int mydb = 0; public RedisContext() { //mydb

任意角度的RGB双色线性渐变算法示例

耗尽温柔 提交于 2019-12-02 21:28:38
用两种RGB颜色对矩形进行线性渐变填充时,需要合适的算法计算各点的颜色,这样才不会出现中间过渡色,或者出现渐变填充不完整。而在增加从任意角度进行渐变后,情况似乎变得更加复杂。 比如这样: 又比如这样: 这些都是色彩计算错误引起的。现在来看看正确的渐变图,其中颜色和渐变角度和上面的一样: 首先说明渐变角度,在本例中是以垂直向上为0度,顺时针增加到360度。 如45度偏转渐变如下: 下边贴出渐变色计算过程代码,例子是在VC2010下做的,颜色的表示借用了windows的COLORREF: /** * 计算线性渐变色 * @param crBegin 前景色 * @param crEnd 渐变色 * @param degree 渐变角度,以垂直向上为0度,顺时针增加到360度 * @param width 矩形区域的宽度 * @param height 矩形区域的高度 * @param x 横坐标,在矩形区域中起点为0,向右递增 * @param y 纵坐标,在矩形区域中起点为0,向下递增 * @return 计算后的线性渐变色 */ COLORREF CalcLinearGradientColor(COLORREF crBegin, COLORREF crEnd, int degree, int width, int height, int x, int y) { /// 渐变高宽值

Struts2 验证框架 validation.xml 常用的验证规则

天涯浪子 提交于 2019-12-02 21:06:38
validation.xml 的命名规则和放置路径: 文件名:<ActionClassName>-validation.xml <ActionClassName>就是要验证的Action类的名字。 要将此文件放于Class文件相同的目录。 如果在Action类在struts配置中有多个action实例(action name),那么对应某个action的验证文件名规则如下: 文件名:<ActionClassName>-<aliasName>-validation.xml 例如:UserAction-login-validation.xml (注意:上面的<aliasName>并不是method name,而是struts.xml中配置的action的name) validation.xml 的内容示例: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> <field name="username"> <field-validator type=

Java 四分位算法

匿名 (未验证) 提交于 2019-12-02 20:41:15
四分位算法实例()    实例1:     数据总量: 6, 47, 49, 15, 42, 41, 7, 39, 43, 40, 36     由小到大排列的结果: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49     一共 11 项      Q1 的位置= (11+1) × 0.25=3 , Q2 的位置= (11+1)× 0.5=6 , Q3 的位置= (11+1) × 0.75=9      Q1 = 15 ,      Q2 = 40 ,      Q3 = 43    实例 2 :     数据总量: 7, 15, 36, 39, 40, 41     一共 6 项     数列项为偶数项时,四分位数 Q2 为该组数列的中数,      (n+1)/4= 7/4 =1.75 , Q1 在第一与第二个数字之间,     3(n+1)/4= 21/4 =5.25, Q3 在第五与第六个数字之间,      Q1 = 0.75*15+0.25*7 = 13,     Q2 = (36+39)/2= 37.5,     Q3 = 0.25*41+0.75*40 = 40.25. Java 代码 1 public static void fourDivsion(double[] param){ 2 if(param == null ||

java ThreadPoolExecutor 自定义线程池优势

半腔热情 提交于 2019-12-02 19:40:16
java并发线程池建议还是多多使用ThreadPoolExecutor的构造函数来设置自定义的线程池,先来看看这个构造函数的参数列表。 /** * Creates a new {@code ThreadPoolExecutor} with the given initial * parameters. * * @param corePoolSize the number of threads to keep in the pool, even * if they are idle, unless {@code allowCoreThreadTimeOut} is set * @param maximumPoolSize the maximum number of threads to allow in the * pool * @param keepAliveTime when the number of threads is greater than * the core, this is the maximum time that excess idle threads * will wait for new tasks before terminating. * @param unit the time unit for the {@code keepAliveTime}

首页报表数据展示(一)

喜欢而已 提交于 2019-12-02 19:38:58
package com.sf.dangbao.core.controller;import com.alibaba.fastjson.JSONObject;import com.sf.dangbao.core.constant.CommonConstant;import com.sf.dangbao.core.entity.PaperUser;import com.sf.dangbao.core.service.DistributionTaskService;import com.sf.dangbao.core.utils.RoleUtils;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;import org.springframework.beans.factory.annotation.Autowired;import

Java Mysql--链接数据库,数据库字段比较

梦想与她 提交于 2019-12-02 19:13:22
连接库操作: 1 package com.qa.xxx; 2 3 4 import org.springframework.stereotype.Component; 5 import java.lang.reflect.Method; 6 import java.sql.*; 7 import java.util.ArrayList; 8 import java.util.List; 9 10 @Component 11 public class MySQLUtil { 12 13 private static final String MYSQL_DRIVER = "com.mysql.cj.jdbc.Driver"; 14 15 private static ThreadLocal<Connection> threadLocal = new ThreadLocal<>(); 16 17 18 public static Connection getMysqlConnection(String url, String userName, String userPassword){ 19 Connection connection = threadLocal.get(); 20 if(null == connection){ 21 try { 22 Class.forName

mybatis问题汇总

女生的网名这么多〃 提交于 2019-12-02 18:22:59
1、 Invalid bound statement (not found): com.**.**Dao.selectList 原因:Dao.xml 没有被绑定 绑定方式:在mybatis配置文件中进行注册 2、 【Mybatis】Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2] sql执行传入多个参数,不能找到对应的参数 在Dao层加入@ Param 注解即可 List<MaterialInfo> selectMaterialInfo(@Param("type") String type, @Param("brandName") String brandName); 来源: https://www.cnblogs.com/ljangle/p/11757489.html

c# base64及MD5工具类

跟風遠走 提交于 2019-12-02 18:14:32
using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; namespace TJCFinanceWriteOff.BizLogic.Common { public class FileUtil { /// <summary> /// 将文件转换为base64String /// </summary> /// <param name="filePath">文件路径</param> /// <returns></returns> public static string GetFileBase64(string filePath) { filePath = filePath ?? throw new ArgumentException("文件路径错误"); try { using(FileStream fs = File.OpenRead(filePath)) { return GetFileBase64(fs); } } catch (Exception ex) { throw; } } /// <summary> ///

BigDecimal的操作工具类

℡╲_俬逩灬. 提交于 2019-12-02 16:28:48
import java.math.BigDecimal; /** * 进行BigDecimal对象的加减乘除,四舍五入等运算的工具类 * @author ameyume * */ public class Arith { /** * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精 * 确的浮点数运算,包括加减乘除和四舍五入。 */ //默认除法运算精度 private static final int DEF_DIV_SCALE = 10; //这个类不能实例化 private Arith(){ } /** * 提供精确的加法运算。 * @param v1 被加数 * @param v2 加数 * @return 两个参数的和 */ public static double add(double v1,double v2){ BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); return b1.add(b2).doubleValue(); } /** * 提供精确的减法运算。 * @param v1 被减数 * @param v2 减数 * @return 两个参数的差 */ public