ICode9

精准搜索请尝试: 精确搜索
  • C语言 unsigned 溢出2022-08-13 09:03:26

    无聊写写   溢出 每一种数据类型都有数值范围,如果存放的数值超出了这个范围(小于最小值或大于最大值),需要更多的二进制位存储,就会发生溢出。大于最大值,叫做向上溢出(overflow);小于最小值,叫做向下溢出(underflow)。     unsigned char x = 255; x = x + 1; printf("%d\n", x); // 0

  • Soldity0.8-Delegatecall2022-08-02 12:33:45

    delegatecall is a low level function similar to call. When contract A executes delegatecall to contract B, B's code is executed with contract A's storage, msg.sender and msg.value.   // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; // N

  • Solidty0.8-Calling Other Contract2022-08-02 12:33:28

    ontract can call other contracts in 2 ways. The easiest way to is to just call it, like A.foo(x, y, z). Another way to call other contracts is to use the low-level call. This method is not recommended.   // SPDX-License-Identifier: MIT pragma solidity ^0.

  • Soldlity0.8-ABI Decode2022-08-01 01:05:36

    abi.encode encodes data into bytes. abi.decode decodes bytes back into data. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract AbiDecode { struct MyStruct { string name; uint[2] nums; } function encode(

  • Soldlity0.8-Library2022-08-01 01:04:30

    Libraries are similar to contracts, but you can't declare any state variable and you can't send ether. A library is embedded into the contract if all library functions are internal. Otherwise the library must be deployed and then linked before

  • Solidity0.8.0-Calling Other Contract2022-07-31 22:01:26

    Contract can call other contracts in 2 ways. The easiest way to is to just call it, like A.foo(x, y, z). Another way to call other contracts is to use the low-level call. This method is not recommended.   // SPDX-License-Identifier: MIT pragma solidity ^0

  • Soldity0.8.0-import2022-07-31 22:00:33

    You can import local and external files in Solidity. Local Here is our folder structure.   ├── Import.sol └── Foo.sol Foo.sol   // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; struct Point { uint x; uint y; } error Unauthorized(add

  • ZABBIX之MySQL数据库历史表优化2022-07-31 09:00:08

    前言   手上有一套ZABBIX监控上线后,没特意关注过数据库,没想到两年不到的时间数据量增长到了500G,造成磁盘空间。 方案1:DELETE删除旧数据,周期太长了,而且空间释放不及时,optimize操作也费时间。 方案2:将体积大的表改造成分区表,将部分历史数据导入新表中,后期分区表删除分区释放空间更

  • Go 多线程 API2022-07-16 17:02:57

    //400ms package main import ( "fmt" "time" ) const SIZE uint = 4 const limit uint = 4e9 func sum(l uint, r uint, c chan uint) { sum := uint(0) for i := l; i <= r; i++ { sum += i ^ limit } c <- sum } func main() {

  • C# Winform 使用全局快捷键2022-07-12 12:35:02

    作者: 张赐荣 .NET 类库本身没有封装注册全局快捷键的函数,想要实现注册全局热键,就需要使用Win32API。 在WinAPI中,注册和注销全局快捷键分别通过registerhotkey和unregisterhotkey函数实现。 注册快捷键后,还需要重写窗口过程函数。 以下代码封装了全局快捷键注册功能 (在 Winform

  • xv6——文件系统:FS的布局和inode的读写操作2022-07-10 23:31:07

    目录框架图文件系统在磁盘上的布局block块管理: free bitmap区inode保存数据的结构数据结构定义磁盘上的保存的数据结构超级块对象dinode 结构目录项的结构内存中的数据结构inode 结构函数接口对block块的操作读到超级块到内存中从磁盘上申请一个空闲的block块释放磁盘上的一个bloc

  • P54952022-07-09 10:31:33

    Dirichlet 前缀和 复健一下子。。。 直接暴力枚举因数是 \(O(n \ln n)\) 的,这里卡的很紧,基本过不掉。 我们类似埃氏筛的方法来做前缀和即可,时间复杂度是 \(O(n\ln \ln n)\) 的,就能过了。 代码: #include<iostream> #include<cstdio> #define ll long long #define uint unsigned in

  • loj67372022-07-04 16:03:18

    前言 喜提最劣解。 此做法系与神 SegmentTree 交流得到。 在此前,你能在网上找到的题解似乎只有某神仙的神秘做法,反正我根本不会。 故,本篇题解要旨在于给出思维的过程。 Version 1 读题。 你有一个正整数集合 \(S\),现在请你回答对于 \(1\le k\le n\),有多少种将编号为 \(1\sim k\)

  • 长链剖分学习笔记2022-07-03 14:32:07

    概念 长链剖分属于链剖分的一种 一般讲的树剖指重链剖分,它可以用于维护树上路径的信息 而长链剖分则是用于维护有关深度的信息 实现 长链剖分的剖分方法与树链剖分极其相似,只需要把以子树大小判断重儿子改成以节点深度判断长儿子即可 有啥用? 它有这么些性质 长链剖分后,所有节点都

  • solidity基础-合约调用2022-06-09 00:01:27

    A合约调用B合约 合约B contract B { uint public x; uint public value; function setX(uint _x) public returns (uint){ x = _x; return x; } function setXandSendEther(uint _x) public payable returns(uint, uint256){ x = _x; value = ms

  • 【luogu P5495】Dirichlet 前缀和(高维前缀和)2022-06-02 18:33:40

    Dirichlet 前缀和 题目链接:luogu P5495 题目大意 给你一个数组,要你求它狄利克雷卷积数组的异或和。 思路 考虑那些位置会被贡献给 \(x\)。 先拆分:\(p_1^{k_1}p_2^{k_2}...p_{m}^{k_{m}}\) 然后就是所有的 \(p_1^{k_1'}p_2^{k_2'}...p_{m}^{k_{m}'}\) 满足所有 \(k'_i\leq k_i\)。

  • 用ListView 控件修改单元格数据,并update到SQLite数据库2022-05-10 17:03:21

    用ListView控件显示SQlite数据,响应双击消息,在对应的单元格上放置Edit控件,编辑后回车,保存数据,更新Item中字符串,ESC取消数据。 保存时,利用备份的单元格数据和ListView Item显示的数据一起构建成 update语句,保存进数据库。    主要的代码: SQLView.h #pragma once #include "xmdiv

  • solidity基础-常量、变量和函数2022-04-13 13:34:10

    一、变量   solidity 的变量和 其他语言一样,分为局部变量,全局变量,状态变量; 1.1、局部变量   变量仅在函数中有效; contract VariableTest{ function getResult() public view returns(uint){ uint a = 1; return a; } } 1.2、全局变量 ( Global Variab

  • 9. Lab: file system2022-04-05 10:00:50

    https://pdos.csail.mit.edu/6.S081/2021/labs/fs.html 1. Large files (moderate) 1.1 要求 Modify bmap() so that it implements a doubly-indirect block, in addition to direct blocks and a singly-indirect block. You'll have to have only 11 direct blocks, r

  • Direct3D11学习:(九)绘制基本几何体2022-04-01 23:00:07

    转载请注明出处:http://www.cnblogs.com/Ray1024   一、概述 Direct3D中很多复杂的几何效果都是由基本的几何体组合而成的,这篇文章中,我们来学习集中常见的基本几何体的绘制方法。   二、准备工作 我们使用一个类来组织这些绘制基本几何体的代码,以方便我们以后的使用。GeometryGen

  • 以太坊智能合约开发:solidity精简速成版2022-03-20 15:34:03

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 以太坊智能合约开发:solidity精简速成版 一、相关概念二、solidity编程基础 一、相关概念 以太坊:以太坊是一个分布式的平台,可以运行智能合约,应用程序按照既定的程序运行,不会出现停机、审查、欺诈或第三方

  • solidity 类型强制转换2022-03-06 09:35:47

        oraclize result以string格式返回,solidity没有uint(string)这样的强制转换功能,如果要解析其中的数字,可以用oraclize提供的parseInt方法:   pragma solidity ^0.4.21; import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; contract StringToUint is usingOracl

  • 【洛谷 P5495】【数学】Dirichlet 前缀和2022-02-26 10:01:22

    【洛谷 P5495】【数学】Dirichlet 前缀和 题目 解题思路 如果求出每一个数的因子然后累加必定TLE 可以先用埃氏筛求出质数 然后质数x对其的倍数y,a[y]+=a[y/x] 因为是从小到大,累加过去的,就能累加到所有除x的因子的数 代码 #include<iostream> #include<cstdio> using name

  • EasyCVR平台接入海康Ehome未携带ssrc导致视频无法播放的解决办法2022-02-14 18:01:52

    EasyCVR视频融合云服务平台支持的协议类型与设备类型非常丰富,它能够兼容国标GB28181、RTSP/Onvif、海康SDK、Ehome、大华SDK等协议的前端设备。其中,Ehome协议是海康的私有协议,相对于GB28181国标协议,都是基于设备端主动向平台注册,更适用于无固定IP地址的设备,只需要配置一下设备注册

  • Source of Randomness2022-02-09 15:01:56

    Vulnerability blockhash and block.timestamp are not reliable sources for randomness. // SPDX-License-Identifier: MIT pragma solidity ^0.8.10; /* NOTE: cannot use blockhash in Remix so use ganache-cli npm i -g ganache-cli ganache-cli In remix switch env

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有