asc

JAVA中常用的加密算法总结

主宰稳场 提交于 2019-12-07 22:00:57
项目中第一次深入地了解到加密算法的使用,现第一阶段结束,将使用到的加密算法和大家分享一下: 首先还是先给大家普及一下常用加密算法的基础知识 基本的单向加密算法 BASE64 严格地说,属于编码格式,而非加密算法 MD5(Message Digest algorithm 5,信息摘要算法) SHA(Secure Hash Algorithm,安全散列算法) 复杂的加密算法 RSA(算法的名字以发明者的名字命名:Ron Rivest, AdiShamir 和Leonard Adleman) DES/3DES(Digital Signature Algorithm,数字签名) 国密算法 SM2/SM4(是由国家密码管理局编制的一种商用密码分组标准对称算法) 使用方法: base64 public static byte [] encode2Base64 ( byte [] bytes) { byte [] bts = Base64.encodeBase64(bytes); return bts; } public static byte [] decode2Base64 (String str) { byte [] bts = Base64.decodeBase64(str); return bts; } MD5 public static String md5 (String str)

MySQL死锁及解决方案

强颜欢笑 提交于 2019-12-06 10:31:35
一、MySQL 锁类型 1. MySQL 常用存储引擎的锁机制 MyISAM和MEMORY采用表级锁(table-level locking) BDB采用页面锁(page-level locking)或表级锁,默认为页面锁 InnoDB支持行级锁(row-level locking)和表级锁,默认为行级锁 2. 各种锁特点 表级锁:开销小,加锁快;不会出现死锁;锁定粒度大,发生锁冲突的概率最高,并发度最低 行级锁:开销大,加锁慢;会出现死锁;锁定粒度最小,发生锁冲突的概率最低,并发度也最高 页面锁:开销和加锁时间界于表锁和行锁之间;会出现死锁;锁定粒度界于表锁和行锁之间,并发度一般 3. 各种锁的适用场景 表级锁更适合于以查询为主,只有少量按索引条件更新数据的应用,如Web应用 行级锁则更适合于有大量按索引条件并发更新数据,同时又有并发查询的应用,如一些在线事务处理系统。 二、 MySQL 死锁产生原因 所谓死锁<DeadLock>:是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程。表级锁不会产生死锁.所以解决死锁主要还是针对于最常用的InnoDB。 死锁的关键在于:两个(或以上)的Session加锁的顺序不一致。

Mysql查询语句之排序查询

半腔热情 提交于 2019-12-06 05:20:40
语法: /* select 查询列表   from 表   【where 筛选条件】   order by 排序列表 【asc/desc】 */ ①asc为升序,desc为降序,且默认为升序 ②order by子句可以支持单个字段、多个字段、表达式、函数、别名 ③order by子句一般放在查询语句的最后面,limit子句除外 来源: https://www.cnblogs.com/algorithmpuppy/p/11963775.html

PHP获取首字母笔记

别说谁变了你拦得住时间么 提交于 2019-12-05 06:22:38
方法如下: function getFirstChar($s0) { $fchar = ord($s0{0}); if ($fchar >= ord("A") and $fchar <= ord("z")) return strtoupper($s0{0}); $s1 = iconv("UTF-8", "GBK", $s0); $s2 = iconv("GBK", "UTF-8", $s1); if ($s2 == $s0) { $s = $s1; } else { $s = $s0; } $asc = ord($s{0}) * 256 + ord($s{1}) - 65536; if ($asc >= -20319 and $asc <= -20284) return "A"; if ($asc >= -20283 and $asc <= -19776) return "B"; if ($asc >= -19775 and $asc <= -19219) return "C"; if ($asc >= -19218 and $asc <= -18711) return "D"; if ($asc >= -18710 and $asc <= -18527) return "E"; if ($asc >= -18526 and $asc <= -18240) return "F";

高效的SQLSERVER分页查询

扶醉桌前 提交于 2019-12-03 13:42:53
Sqlserver数据库分页查询一直是Sqlserver的短板,闲来无事,想出几种方法,假设有表ARTICLE,字段ID、YEAR...(其他省略),数据53210条(客户真实数据,量不大),分页查询每页30条,查询第1500页(即第45001-45030条数据),字段ID聚集索引,YEAR无索引,Sqlserver版本:2008R2 第一种方案、最简单、普通的方法: SELECT TOP 30 * FROM ARTICLE WHERE ID NOT IN (SELECT TOP 45000 ID FROM ARTICLE ORDER BY YEAR DESC, ID DESC) ORDER BY YEAR DESC,ID DESC 第二种方案: 代码如下: SELECT * FROM (SELECT TOP 30 * FROM (SELECT TOP 45030 * FROM ARTICLE ORDER BY YEAR DESC, ID DESC) f ORDER BY f.YEAR ASC, f.ID DESC) s ORDER BY s.YEAR DESC,s.ID DESC 平均查询100次所需时间:138S 第三种方案: 代码如下: SELECT * FROM ARTICLE w1, ( SELECT TOP 30 ID FROM ( SELECT TOP 50030

CheckBox! Specified cast is not valid

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i had this error: specified cast is not valid when i try to add a new row to my grid that contain a itemtemplate checkbox as shown below. Whenever i use the word "Checked" instead of "Text", the error is shown. But what i want to do is to show the checkbox "checked" when my "choiceQn" is true and not show the "true" next to my checkbox. Please help me out if you can solve my problem. ASP.NET <ItemTemplate> <asp:CheckBox ID="ChoiceCheckBox" runat="server" **Checked**='<%# Bind("ChoiceQn") %>'/> </ItemTemplate> C# private void AddNewRowToGrid(

Call Variable from reactive data() in R Shiny App

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I would like to call a certain variable within a reactive expression. Something like this: server.R library ( raster ) shinyServer ( function ( input , output ) { data <- reactive ({ inFile <- input$test #Some uploaded ASCII file asc <- raster ( inFile$datapath ) #Reads in the ASCII as raster layer #Some calculations with 'asc': asc_new1 <- 1 / asc asc_new2 <- asc * 100 }) output$Plot <- renderPlot ({ inFile <- input$test if ( is . null ( inFile ) return ( plot ( data () $asc_new1 )) #here I want to call asc_new1 plot ( data ()

Ruby on Rails: how do I sort with two columns using ActiveRecord?

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to sort by two columns, one is a DateTime ( updated_at ), and the other is a Decimal (Price) I would like to be able to sort first by updated_at, then, if multiple items occur on the same day, sort by Price. 回答1: Assuming you're using MySQL, Model.all(:order => 'DATE(updated_at), price') Note the distinction from the other answers. The updated_at column will be a full timestamp, so if you want to sort based on the day it was updated, you need to use a function to get just the date part from the timestamp. In MySQL, that is DATE() .

Order By Date ASC with Spring Data

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to make an application with Spring-Data-JPA on a table in order by ASC but it gives me an error: Invalid derived query! No property asc found for type java.util.Calendar Why ? List<Foo> findAllOrderByDateAsc(); or @Query("SELECT * FROM foo ORDER BY date ASC") List<Foo> findAllOrderByDateAsc(); 回答1: Try to add "By" between "All" and "Order" like this: List<Foo> findAllByOrderByDateAsc(); 回答2: I don't think you can use findAll as a prefix. Regarding the query, select * is not valid JPQL. It should be select foo from Foo foo order by foo

Sorting HTML table with JavaScript

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm after a table sorting solution (in JavaScript) but I can't seem to find a suitable one yet. I just need it to sort each column alphabetically. It doesn't need to ignore any code or any numbers or to work with currency. Just a click on the column header switches it from sorted a-z/z-a. Does anyone know of a really simple solution like this? 回答1: Just revisiting an old solution , I thought I'd give it a facelift for it's ~5 year anniversary! Plain Javascript (ES6) Does alpha and numeric sorting - ascending and descending Works in Chrome ,