sprintf

Appending a png pHYs chunk in php

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to tack on some information about the physical size for printing my PNGs just before they are generated. Reading the libpng doc and the pHYs chunk specifications has been helpful but I just can't seem to crack it. I have tried adding this chunk in the most manual and simplest way possible, however, the .png file ends up corrupted. Am I missing an encoding trick? For the CRC computation I have used the 32-bit result of this site , having plugged in the ASCII values for the chunk that the code below gives me. $encoded = $_POST[

Shell: In-file converting first field of a text file from decimal to hexadecimal

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is my example text file: $ cat RealVNC\ MRU.reg "10"="Lamborghini-:1" "16"="Terminus-" "20"="Midnighter-:5915" "35"="ThreepWood-:1" "81"="Midnighter-:1" "58"="Midnighter-" And I would like to convert values of the first field (the numbers between "" ) from decimal to hexadecimal (it is a .reg file for Windows, so I meesed it up thinking the numbers were in a decimal base, and now the file is too long to manually edit). Example result that I need to obtain: $ cat Hex\ RealVNC\ MRU.reg "0A"="Lamborghini-:1" "10"="Terminus-" "14"=

sprintf函数

匿名 (未验证) 提交于 2019-12-03 00:26:01
sprintf就是化其他量为字符或字符串 sprintf('%s%s_st%d.mat',PATH,FILE_ROI(1:end-4),st);,如果后面的量变量名,则表示变量名内的内容 文章来源: sprintf函数

Golang读取并修改非主流配置文件

匿名 (未验证) 提交于 2019-12-03 00:03:02
今天工作中碰到的问题,要求修改此配置文件,没看出来是什么格式,用了下面的思路: mysql { # If any of the files below are set, TLS encryption is enabled tls { ca_file = "/etc/ssl/certs/my_ca.crt" ca_path = "/etc/ssl/certs/" certificate_file = "/etc/ssl/certs/private/client.crt" private_key_file = "/etc/ssl/certs/private/client.key" cipher = "DHE-RSA-AES256-SHA:AES128-SHA" tls_required = yes tls_check_cert = no tls_check_cert_cn = no } # If yes, (or auto and libmysqlclient reports warnings are # available), will retrieve and log additional warnings from # the server if an error has occured. Defaults to 'auto' warnings = auto }

C++ int 和 string 转换

匿名 (未验证) 提交于 2019-12-02 23:45:01
1、使用itoa(int to string) //char *itoa( int value, char *string,int radix); // 原型说明: // value:欲转换的数据。 // string:目标字符串的地址。 // radix:转换后的进制数,可以是10进制、16进制等。 // 返回指向string这个字符串的指针 int aa = 30; char c[8]; itoa (aa,c,16); cout << c << endl; // 1e    注意:itoa并不是一个标准的C函数,它是Windows特有的,如果要写跨平台的程序,请用sprintf。 2、使用sprintf // int sprintf( char *buffer, const char *format, [ argument] … ); //参数列表 // buffer:char型指针,指向将要写入的字符串的缓冲区。 // format:格式化字符串。 // [argument]...:可选参数,可以是任何类型的数据。 // 返回值:字符串长度(strlen) int aa = 30; char c[8]; int length = sprintf(c, "%05X", aa); cout << c << endl; // 0001E 3、使用stringstream int

scapy学习笔记

匿名 (未验证) 提交于 2019-12-02 23:40:02
1、ACK Scan >>>ans,unans=sr(IP(dst="www.baidu.com")/TCP(dport=[80,666],flags="A") 扫描后,若要找出未过虑的端口: for s,r in ans: if s[TCP].dport==r[TCP].sport: print str(s[TCP].dport)+"is unfiltered." 过滤过的: for s in unans: print str(s[TCP].dport)+"is filtered." 2、Xmas Scan >>>ans,unans=sr(IP(dst="192.168.1.1")/TCP(dport=666,flags="FPU")) RST表示端口关闭。 3、IP Scan >>> ans,unans=sr(IP(dst="192.168.1.1",proto=(0,255))/"SCAPY",retry=2) 4、ARP ping >>> ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=2) 结果显示: >>> ans.summary(lambda (s,r): r.sprintf("%Ether.src% %ARP.psrc%") ) 5、ICMP ping >

数据结构之B+树

匿名 (未验证) 提交于 2019-12-02 22:56:40
title: 数据结构之B+树 date: 2018-11-04 20:39:00 tags: 数据结构与算法之美 一棵m阶B-树,或者是空树,或者是满足以下性质的m叉树 根结点至少有两个分支; 除根以外的非叶结点,每个结点包含分支数范围[[m/2],m],即关键字字数的范围是[[m/2]-1,m-1],其中[m/2]表示取大于等于m/2的最小整数 所有叶子结点都在树的同一层上,并且指针域为空; 所有的非终端结点应包含如下信息: (n,A0,K1,A1,K2,A2,… ,Kn,An),结点内关键字互不相等,且从小到大排列。 解释: m阶的意思是这颗树最多的分支是多少,每个节点可以包含很多关键字,范围是[[m/2]-1,m-1],比如m为 3,就说明是3阶的B-树, 那么它的树的节点的关键字最少2,最多4个。下面的B+树也是同样的理解。 设关键字的总数为 N ,求 m阶 B- 树的最大层次 L。 在实际的文件系统中,基本上不使用B_树,而是使用B_树的一种变体,称为m阶B+树。 它与B-树的主要不同是叶子结点中存储记录。在B+树中,所有的非叶子结点可以看成是索引,而其中的关键字是作为“分界关键 字”,用来界定某一关键字的记录所在的子树。一棵m阶B+树与m阶B-树的主要差异是: 1.若一个结点有n棵子树,则必含有n个关键字; 2

imx6q 修改开机LOGO指南

邮差的信 提交于 2019-12-01 22:48:37
imx6q 修改开机LOGO指南 在电鱼电子从事多年,对imx6q这款产品有点经验可谈,特此分享与大家共同探讨,下面是我用SAIL-imx6q修改开机LOGO的做法: 1 修改u-boot中的LOGO 1 更换logo 替换 u-boot-imx/2015.04-r0/git/tools/logos/目录下的freescale.bmp,注意这里要替换的图片一定是256色的位图,如果是24位色的图片转换可能会出错,造成图片显示不正常。 我们也可以,直接把自己需要显示的文件不命名为freescale.bmp,那就需要自己修改u-boot-imx/2015.04-r0/git/tools/Makefile文件,将LOGO_BMP=后面的路径设置为自己的图片的名称。 编译的时候,bmp_logo会将我们指定的图片转换为数组文件,保存在/u-boot-imx/2015.04-r0/git/mx6qsabresd_config/include/目录下的bmp_logo.h、bmp_logo_data.h中 2 将图片居中显示 修改 u-boot-imx/2015.04-r0/git/drivers/video/cfb_console.c 在函数static void *video_logo(void)中修改 splash_get_pos(&video_logo_xpos, &video

php实现大文件断点续传下载实例

梦想的初衷 提交于 2019-11-30 18:03:46
php实现大文件断点续传下载实例,看完你就知道超过100M以上的大文件如何断点传输了,这个功能还是比较经典实用的,毕竟大文件上传功能经常用得到。 require_once('download.class.php'); date_default_timezone_set('Asia/Shanghai'); error_reporting(E_STRICT); function errorHandler($errno, $errstr, $errfile, $errline) { echo '<p>error:', $errstr, '</p>'; exit(); } set_error_handler('errorHandler'); define('IS_DEBUG', true); $filePath = 'test.zip'; $mimeType = 'audio/x-matroska'; $range = isset($_SERVER['HTTP_RANGE']) ? $_SERVER['HTTP_RANGE'] : null; if (IS_DEBUG) { // $range = "bytes=1000-1999\n2000"; // $range = "bytes=1000-1999,2000"; // $range = "bytes=1000-1999,-2000";

PHP如何免费对接调用快递物流单号查询api接口

时光总嘲笑我的痴心妄想 提交于 2019-11-30 12:29:25
博主最近需要做一个物流信息轨迹查询的api接口,就去网上搜索,看到了一个快递鸟的API接口,返回值是以JSON格式,只需要返回是转成数组就能轻松实现各种实例了。真的很方便。 对接流程 快递鸟网站申请接口KEY并认证-对接接口-调试-上线使用 二、对接准备 1. 登录快递鸟注册快账号 2.获取开发者账号信息(ID ,API Key), 登录快递鸟后台中查看 3.进行技术联调,并完成调试,物流查询api地址: http://www.kdniao.com/api-track 实名认证后需开通服务 下图是快递鸟API示意接口, 由于是免费的,所以限制很多,比如每天最多只能查询3000次和需要实名认证。 博主这里贴出博主的代码: `<?php //电商ID defined('EBusinessID') or define('EBusinessID', '电商ID'); //电商加密私钥,快递鸟提供,注意保管,不要泄漏 defined('AppKey') or define('AppKey', '电商加密私钥'); //请求url defined('ReqURL') or define('ReqURL', ' http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx '); //调用查询物流轨迹 //-------------------