设置

为了观战韩服职业选手排位历史记录

  1. 下载外服客户端

  2. 修改配置

C:\ProgramData\Riot Games\Metadata\league_of_legends.live 目录下
找到league_of_legends.live.product_settings.yaml
修改如下

auto_patching_enabled_by_player: false
dependencies:
Direct X 9:
hash: "9f22c993a42816d61a3063badbf25f9dd299721051ca0665a7cb295ba97591b0"
phase: "Succeeded"
version: "1.0.0"
locale_data:
available_locales: # 配置语言选项
- "en_US" #英文
- "zh_CN" #中文
- "ko_KR" #韩文
- "ja_JP" #日文
default_locale: "en_US" #默认语言
patching_policy: "manual"
patchline_patching_ask_policy: "ask"
product_install_full_path: "G:\\Riot Games\\League of Legends"
product_install_root: "G:/Riot Games"
settings:
create_shortcut: false
create_uninstall_key: true
locale: "ko_KR" # 这里设置为你想要的语言,参考上面
shortcut_name: "League of Legends.lnk"
should_repair: false

为了ob韩服不乱码,所以需要将上述的locale 后面的值改成ko_KR

  1. 修改观战进程语言

找到 LOL 安装目录 ,这里以我的为例,G:\Riot Games\League of Legends\Config
打开 LeagueClientSettings.yaml 文件,
修改如下

install:
crash_reporting:
enabled: true
type: "crashpad"
game-settings:
accountId: 238191481
modified: false
timestamp: 0
gameflow-patcher-lock: null
gameflow-process-info: null
gameflow-spectate-reconnect-info: null
globals:
locale: "en_US" # 这里设置为ko_KR 就不会乱码了
region: "NA"
lcu-settings:
accountId: 238191481
modified: true
timestamp: 0
patcher:
client_migrated: true
client_patcher_available: true
game_migrated: true
game_patcher_available: true
locales:
- "en_US"
- "ja_JP"
- "ko_KR"
toggles:
new_client_patcher: 0
new_game_patcher: 0
perks-settings:
accountId: 238191481
modified: false
timestamp: 0
riotclient-upgrade:
seq-success-count: 16
success-count: 16
rso-auth:
install-identifier: "7ca3c8997368594881546f6d2d70a551"


准备工作

  1. 配置环境变量 SSLKEYLOGFILE 值为拥有读写权限的文件,例如:D:\A_TLS_LOG\sslkeylog.log

  2. 打开wireshark,找到首选项(ctrl+shift+p),Protocols >> TLS ,TLS debug file 配置tls日志,(Pre)-Master-Secret log filename配置上述环境变量SSLKEYLOGFILE中指定的文件

概论

计算中的任何数据都是由二进制表示,因为IC(Integrated Circuit)集成电路的引脚只有直流电压0V5V两个状态,也就是一个IC引脚只能表示两个状态,和二进制 0 1 契合

二进制数0000 0101 转成10进制数结果为5 = 1*2^2 + 0*2^1 +1*2^0 = 4 + 0 + 1 = 5 即数值和位权相乘后相加

正数和负数的表示

通常将数的二进制最高位作为符号位,1表示负数,0 表示正数

10进制数1 的二进制数为:0000 0001, 负数为 :~1 + 1 = -2 + 1 =-1

v取反:

正数:-(v+1)

负数 |v| -1

正数取反结果为负数,负数取反结果为整数

任何数取反加一的结果都为该数的相反数

正加负减(-(v+1))

以下数取反后的值
10 -11
1 -2
-2 1
-5 4
-6 5

位移

只有右移时才能区分出逻辑位移算术位移

java中 >> 为算术右移,>>> 为逻辑位移

int x = -4;
int y = -4 >>2;// -1
int z = -4 >>>2; // 1073741823

逻辑位移

补零就行了

算术位移

将二进制数作为带符号的数值进行运算时,移位后需要在最高位补充符号位(0或者1)

浮点数

符号、尾数、基数、指数

双精度(64bit)

符号部分(1bit) + 指数部分(11bit) + 尾数部分(52bit)

单精度(32bit)

符号部分(1bit) + 指数部分(8bit) + 尾数部分(23bit)

sds (Simple dynamic string)

sdsHeader

sdsHdr{
size_t len;
size_t alloc;
size_t flag
char [] buf;//柔性数组,内存分配时不占用空间,根据需要可以动态构建该区域,且内存空间连续
}

List (双链表实现)

rio (面向stream的IO抽象层)

实现了sds,file,socket,fd的相关读写

其中针对aof(Append only file)文件,定义了序列化协议 *<argv_num>\r\n$<count>\r\n<payload>\r\n

开启redis aof,需要在redis.conf中配置appendonly yes

例子:假如需要往aof中写入字符串Hello,实际写入的是$5\r\nHello

例子:redis-cli执行set test abc

那么aof文件将会追加下面这段内容

*3
$3
set
$4
test
$3
abc

翻译成人话就是:三个字符串,分别为set test abc

dictht (HashTable)

其他

//设置状态
flags |= STATE_OEPN

//取消状态
flags &= ~STATE_OPEN

void updateFlag(int*flags,int flag,int enable){
if(enable){
*flags |= flag;
}else{
*flags &= ~flag;
}
}

自动配置

@EnableTransactionManagement
-> @Import(TransactionManagementConfigurationSelector.class)
-> ProxyTransactionManagementConfiguration

ProxyTransactionManagementConfiguration
@Bean
-> BeanFactoryTransactionAttributeSourceAdvisor
->setTranactionAttributeSource (TransactionAttributeSource())
->setAdvice(TransactionInterceptor()->ref->TransactionManager)

    7vPUtZJ6pMgebJvzi4C,eWDpdRrVLwQk56uCCIE

sheet中的单位

统一使用EMU

1EMU = (1 / 914400) US inch = (1 / 360000) cm

PIXEL_DPI = 96

POINT_DPI = 72

emu = (pixel / 96) * 914400

emu = (point / 72) * 914400

1 pixel = (914400 / 96 ) = 9525 emu

1 point = (914400 / 72) = 12700 emu

7 is single char pixel 

cell width:

((8*7+5)/7*256)/256 = 8.714285714

width to pixel:

(((256*8.714285714+(128/7))/256)*7) = 61.499999998

pixel to char width


31 is single char pixel

cell width:

((8*32+8)/32*256)/256

((8*32+5)/32*256)/256 = 8.15625

width to pixel:

(((256*8.15625+(128/32))/256)*32) = 261.5

字体像素计算

计算

using System;
using System.Drawing;
using System.Drawing.Text;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace FontMesure
{
public partial class FontMeasure : Form
{
int[] _font_size = new int[] { 6, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 };
FontStyle[] _font_style = new FontStyle[] { FontStyle.Regular, FontStyle.Bold, FontStyle.Italic };
String fontSizeDelimeter = "|";
String fontDelimeter = "__";
String fontPixelStr = "";
public FontMeasure()
{
InitializeComponent();
dumpToTxt.Enabled = false;
}

private void Form1_Load(object sender, EventArgs e)
{
Bitmap bm = new Bitmap(10, 10);
bm.SetResolution(96, 96);
Graphics g = Graphics.FromImage(bm);
InstalledFontCollection fonts = new InstalledFontCollection();
StringBuilder str = new StringBuilder(2000);
foreach (FontFamily family in fonts.Families)
{
str.Append(family.Name);
str.Append("\n");
foreach (FontStyle style in _font_style)
{
str.Append(style.ToString());
str.Append("@");
foreach (int fontSize in _font_size)
{
Font tmp = new Font(family.Name, fontSize, style);
float w = 0;
for (int i = 0; i < 10; i++)
{
SizeF sf = g.MeasureString(i + "", tmp, Int32.MaxValue, StringFormat.GenericTypographic);
if (sf.Width > w)
{
w = sf.Width;
}
}
str.Append(fontSize + ":" + w +fontSizeDelimeter);
}
str.Remove(str.Length - 1, 1);
str.Append("\n");
}
str.Append(fontDelimeter);
str.Append("\n");
}
fontPixelStr = str.ToString();
richTextBox1.Text = fontPixelStr;
g.Dispose();
dumpToTxt.Enabled = true;
}

private void richTextBox1_TextChanged(object sender, EventArgs e)
{

}

private void dumpToTxt_Click(object sender, EventArgs e)
{
TextWriter textWriter = new StreamWriter("fontPixelRaw.txt", false);
textWriter.Write(fontPixelStr);
textWriter.Close();
}
}
}

转json


import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;

import java.nio.charset.StandardCharsets;

public class FontMeasureBuild {
public static void main(String[] args) {
//把上面输出的fontPixelRaw.txt 转成json格式
String raw = FileUtil.readString("fontPixelRaw.txt", StandardCharsets.UTF_8);
String[] rawSplit = raw.split("\r\n__\r\n");
JSONObject fontMapping = new JSONObject();
for (String fontRaw : rawSplit) {
if (StrUtil.isBlank(fontRaw)) continue;
String[] split = fontRaw.split("\r\n");
//font->bold->k->v
JSONObject styleMapping = new JSONObject();
fontMapping.put(split[0], styleMapping);
String[] RegularSplit = split[1].split("@");
buildFontStyleMapping("r", styleMapping, RegularSplit[1]);

String[] BoldSplit = split[2].split("@");
buildFontStyleMapping("b", styleMapping, BoldSplit[1]);


String[] ItalicSplit = split[3].split("@");
buildFontStyleMapping("i", styleMapping, ItalicSplit[1]);
}
FileUtil.writeString(fontMapping.toJSONString(),"fontPixel.json","utf8");
System.out.println(fontMapping.toJSONString());
}

public static void buildFontStyleMapping(String style, JSONObject styleMapping, String strList) {

String[] split = strList.split("\\|");
for (String str : split) {
if (StrUtil.isNotBlank(str)) {
String[] sizeSplit = str.split(":");
String key = style + "@" + sizeSplit[0];
styleMapping.put(key, sizeSplit[1]);
}
}
}

使用

根据workbook中的字体查表获取对应的digitWidth、cellWidth、cellPixelWidth


Font font = workbook.getFontAt(0);
String defaultFontName = "Calibri";
String fontName = font.getFontName();
short fontSize = font.getFontHeightInPoints();
JSONObject fontPixelConfig = JSON.parseObject(FileUtils.readStr("fontPixel.json"))
JSONObject jsonObject = fontPixelConfig.getJSONObject(fontName);
if (null == jsonObject) {
jsonObject = fontPixelConfig.getJSONObject(defaultFontName);
}
if (null != jsonObject) {
//fontStyle(Initial)@fontSize
String key = "r@" + fontSize;
String digitWidthStr = jsonObject.getString(key);
if (!StringUtils.isEmpty(digitWidthStr)) {
int dw = ColumnHelper.round(new BigDecimal(digitWidthStr).floatValue());
int cellWidthPixel = ColumnHelper.dw2pixel(dw);
float cellWidth = ColumnHelper.pixel2cw(cellWidthPixel, dw);

}
}

转换



import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class ColumnHelper {

public static int round(float v) {
return (int) (v + 0.5f);
}

/**
* @param dw_ digit width
* @return default cell width of pixel
*/
public static int dw2pixel(float dw_) {
int dw = round(dw_);
return align(Math.round(dw * 8f + round((dw) / 4f) * 2 + 1), 8);
}

/**
* @param cw cellWidth
* @param dw_ digitWidth
* @return cell width of pixel
*/
public static int cw2pixel(double cw, float dw_) {
int dw = round(dw_);
return (int) Math.round(cw * dw + round(((dw) / 4f)) * 2d + 1d);
}

/**
* @param pixel cell width of pixel
* @param dw_ digit width
* @return cellWidth of pixel
*/
public static float pixel2cw(int pixel, float dw_) {
int dw = round(dw_);
BigDecimal value = BigDecimal.valueOf(pixel - (((dw) / 4f) * 2 + 1));
value = value.divide(BigDecimal.valueOf(dw), 2, RoundingMode.HALF_UP);
return value.floatValue();
}

/**
* 按给定倍数对齐
*
* @param v 给定值
* @param a 倍数
* @return
*/
public static int align(int v, int a) {
return (v + a - 1) & -a;
}

public static float getCellWidthPixel(Sheet sheet, int colIndex) {
WorkbookInfo workBookInfo = JxlsDrawingContextHolder.getWorkBookInfo();
if (sheet instanceof XSSFSheet) {
CTCol col = ((XSSFSheet) sheet).getColumnHelper().getColumn(colIndex, false);
return (float) (col == null || !col.isSetWidth() ? workBookInfo.getDefaultColumnPixelWidth() : cw2pixel(col.getWidth(), workBookInfo.getDigitWidth()));
} else {
return workBookInfo.getDefaultColumnPixelWidth();
}
}


public static void main(String[] args) {
float dw = 32;
int pixel1 = dw2pixel(dw);
System.out.println(pixel1);//280
System.out.println(pixel2cw(pixel1, dw));//8.22
}


}


Reference

Excel列宽像素值计算方法详解

precisely-placing-images-in-an-open-xml-spreadsheet

ooxml-viewer

Calculating-Cell-Sizes

Convert Excel column width between characters unit and pixels (points)

准备工作

配置

下载MySQL源码成功后,导入到Clion

还需要做如下配置

配置Profile

File | Settings | Build, Execution, Deployment | CMake

点击+号生成了一个Profile

Name:Debug

Build type:Debug

1

CMake options 输入-DDOWNLOAD_BOOST=1 -DWITH_BOOST=boost/boost_1_59_0/

配置Toolchains

File | Settings | Build, Execution, Deployment | Toolchains

点击+号,选择Visual Studio,Clion应该会自动识别到vs2017

2

cmake

上述准备工作完成后,clion应该会自动cmake,由于boost文件较大,下载速度很慢,这个时候,只需要停止cmake.

在源码目录下找到cmake-build-debug\boost\boost_1_59_0这个目录,把上面下载好的boost_1_59_0.tar.gz文件复制过去,然后重新cmake。

不出意外的话,cmake完成后,找到任意源码文件,ctrl+鼠标左键是可以做到跳转的。

特别注意

MySQL的源码路径不能有空格或者中文

导入

mysql shell

mysql -uroot -p123456
create database test;
use test;
source test.sql;

cmd

mysql -uroot -p123456 dbname < test.sql

导出

整个数据库

mysqldump -u username -p password database_name > output.sql

导出一个表

mysqldump -u username -p password database_name table_name > output.sql

后端

java

mybatis

查看最终mapper方法生成的SQL

org.apache.ibatis.binding.MapperMethod#execute
org.apache.ibatis.executor.ReuseExecutor#doUpdate
org.apache.ibatis.executor.ReuseExecutor#doQuery

0%