以太坊调用staticall
❶ java静态方法(方法前冠以static)和实例方法(未冠以static)的区别
静态方法(方法前冠以static)和实例方法(前面未冠以static)的区别
调用静态方法或说类方法时,可以使用类名做前缀,也可以使用某一个具体的对象名;通常使用类名。
非static的方法是属于某个对象的方法,而static的方法是属于整个类的,不被任何一个对象单独拥有;
由于static方法是属于整个类的,所以它不能操纵和处理属于某个对象的成员变量,而只能处理属于整个类的成员变量,也即,static方法只能处理static域或静态方法。实例方法可以访问实例域, 静态域或静态方法, 记住都行。
声明为static的方法有以下几条限制: 1.它们仅能调用其他的static方法。
2.它们只能访问static数据。
3.它们不能以任何方式引用this或super(关键 字super与继承有关,在下一章中描述)。
static method Have No this Reference
All instance methods have a hidden parameter—this
So,
Static method can’t access instance methods and fields; it can only
invoke other static class
members.It can access class members only.
instance can use static method.
Instance methods:
If a method is declared without the static modifier keyword,
that method is known as an instance method. Instance methods
are associated with objects – not classes.
It can access either instance or class members.
本章源码
class StaticExa {
static int a = 4;
static int b = 9;
static void call() {
System.out.println("a = " + a);//静态方法可以访问静态属性
}
}
public class Test {
static int c = 43;
public static void main(String args[]) {
/*刚运行到这一步时,debug观察,StaticExa.a的值就等于42,Test.c的值就等于43,
说明系统在我们的程序一开始时,就会给所有的类变量赋值。如果是对象参考, 就是null,
见photoshop的例子*/
。。。。。。。。。。。。。。。。详情网上找“马克-to-win”,参考他的网站或他的网络空间:java第2章的内容
❷ unity5 onpostprocessallassets导入的时候为什么不会调用
创建AssetBundle
1.创建一个空的Prefab,命名Cube,然后创建一个Cube,将其拉到刚创建好的Prefab
2.新建一个脚本ExportAssetBundles.cs(代码来自官方文档),保存在Asset/Editor目录下
[csharp] view plainprint?
//在Unity编辑器中添加菜单
[MenuItem("Assets/Build AssetBundle From Selection")]
static void ExportResourceRGB2()
{
// 打开保存面板,获得用户选择的路径
string path = EditorUtility.SaveFilePanel("Save Resource", "", "New Resource", "assetbundle");
if (path.Length != 0)
{
// 选择的要保存的对象
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
//打包
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.StandaloneWindows);
}
}
❸ arm-none-linux-gnueabi-gcc: error: unrecognized command line option '-all-static'
明显就是用错命令了。-all-static 这个选项参数出错了吧,格式改改,改成-allstatic 试试。不行就搜一下你这个选项是控制啥的,然后输正确的选项参数。
❹ 批处理改IP。要实现自动调用IPCONFIG/ALL后的网卡名称。脚本如下
这个比较深奥………… 暂时不会………………
❺ 在cygwin下想用c语言调用libpcap实现网络抓包。是不是cygwin下不支持libpcap
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <errno.h>
/* 接收缓冲区大小 */
#define RCV_BUF_SIZE 1024 * 5
/* 接收缓冲区 */
static int g_iRecvBufSize = RCV_BUF_SIZE;
static char g_acRecvBuf[RCV_BUF_SIZE] = {0};
/* 物理网卡接口,需要根据具体情况修改 */
static const char *g_szIfName = "eth1";
/* 以太网帧封装的协议类型 */
static const int g_iEthProId[] = { ETHERTYPE_PUP,
ETHERTYPE_SPRITE,
ETHERTYPE_IP,
ETHERTYPE_ARP,
ETHERTYPE_REVARP,
ETHERTYPE_AT,
ETHERTYPE_AARP,
ETHERTYPE_VLAN,
ETHERTYPE_IPX,
ETHERTYPE_IPV6,
ETHERTYPE_LOOPBACK
};
static const char g_szProName[][24] = {
"none", "xerox pup", "sprite", "ip", "arp",
"rarp", "apple-protocol", "apple-arp",
"802.1q", "ipx", "ipv6", "loopback"
};
/* 输出MAC地址 */
static void ethmp_showMac(const int iType, const char acHWAddr[])
{ int i = 0;
if (0 == iType)
{
printf("SMAC=[");
}
else
{
printf("DMAC=[");
}
for(i = 0; i < ETHER_ADDR_LEN - 1; i++)
{
printf("%02x:", *((unsigned char *)&(acHWAddr[i])));
}
printf("%02x] ", *((unsigned char *)&(acHWAddr[i])));
}
/* 物理网卡混杂模式属性操作 */
static int ethmp_setPromisc(const char *pcIfName, int fd, int iFlags)
{ int iRet = -1;
struct ifreq stIfr;
/* 获取接口属性标志位 */
strcpy(stIfr.ifr_name, pcIfName);
iRet = ioctl(fd, SIOCGIFFLAGS, &stIfr);
if (0 > iRet)
{ perror("[Error]Get Interface Flags");
return -1;
}
if (0 == iFlags)
{ /* 取消混杂模式 */
stIfr.ifr_flags &= ~IFF_PROMISC;
}
else
{ /* 设置为混杂模式 */
stIfr.ifr_flags |= IFF_PROMISC;
}
iRet = ioctl(fd, SIOCSIFFLAGS, &stIfr);
if (0 > iRet)
{ perror("[Error]Set Interface Flags");
return -1;
}
return 0;
}
/* 获取L2帧封装的协议类型 */
static char *ethmp_getProName(const int iProNum)
{ int iIndex = 0;
for(iIndex = 0; iIndex < sizeof(g_iEthProId) / sizeof(g_iEthProId[0]); iIndex++)
{ if (iProNum == g_iEthProId[iIndex])
{
break;
}
}
return (char *)(g_szProName[iIndex + 1]);
}
/* Init L2 Socket */
static int ethmp_initSocket()
{ int iRet = -1;
int fd = -1;
struct ifreq stIf;
struct sockaddr_ll stLocal = {0};
/* 创建SOCKET */
fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (0 > fd)
{ perror("[Error]Initinate L2 raw socket");
return -1;
}
/* 网卡混杂模式设置 */
ethmp_setPromisc(g_szIfName, fd, 1);
/* 设置SOCKET选项 */
iRet = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &g_iRecvBufSize,sizeof(int));
if (0 > iRet)
{ perror("[Error]Set socket option");
close(fd);
return -1;
}
/* 获取物理网卡接口索引 */
strcpy(stIf.ifr_name, g_szIfName);
iRet = ioctl(fd, SIOCGIFINDEX, &stIf);
if (0 > iRet)
{ perror("[Error]Ioctl operation");
close(fd);
return -1;
}
/* 绑定物理网卡 */
stLocal.sll_family = PF_PACKET;
stLocal.sll_ifindex = stIf.ifr_ifindex;
stLocal.sll_protocol = htons(ETH_P_ALL);
iRet = bind(fd, (struct sockaddr *)&stLocal, sizeof(stLocal));
if (0 > iRet)
{ perror("[Error]Bind the interface");
close(fd);
return -1;
}
return fd;
}
/* 解析Ethernet帧首部 */
static int ethmp_parseEthHead(const struct ether_header *pstEthHead)
{ unsigned short usEthPktType;
if (NULL == pstEthHead)
{ return -1;}
/* 协议类型、源MAC、目的MAC */
usEthPktType = ntohs(pstEthHead->ether_type);
printf(">>>\nEth-Pkt-Type:0x%04x(%s) ", usEthPktType, ethmp_getProName(usEthPktType));
ethmp_showMac(0, pstEthHead->ether_shost);
ethmp_showMac(1, pstEthHead->ether_dhost);
return 0;
}
/* 解析IP数据包头 */
static int ethmp_parseIpHead(const struct ip *pstIpHead)
{ struct protoent *pstIpProto = NULL;
if (NULL == pstIpHead)
{ return -1;}
/* 协议类型、源IP地址、目的IP地址 */
pstIpProto = getprotobynumber(pstIpHead->ip_p);
if(NULL != pstIpProto)
{ printf("\nIP-Pkt-Type:%d(%s) ", pstIpHead->ip_p, pstIpProto->p_name); }
else
{ printf("\nIP-Pkt-Type:%d(%s) ", pstIpHead->ip_p, "None");}
printf("SAddr=[%s] ", inet_ntoa(pstIpHead->ip_src));
printf("DAddr=[%s]\n", inet_ntoa(pstIpHead->ip_dst));
return 0;
}
/* 数据帧解析函数 */
static int ethmp_parseFrame(const char *pcFrameData)
{ int iRet = -1;
struct ether_header *pstEthHead = NULL;
struct ip *pstIpHead = NULL;
/* Ethnet帧头解析 */
pstEthHead = (struct ether_header*)g_acRecvBuf;
iRet = ethmp_parseEthHead(pstEthHead);
if (0 > iRet)
{ return iRet;}
/* IP数据包类型 */
pstIpHead = (struct ip *)(pstEthHead + 1);
iRet = ethmp_parseIpHead(pstIpHead);
return iRet;
}
/* 捕获网卡数据帧 */
static void ethmp_startCapture(const int fd)
{ int iRet = -1;
socklen_t stFromLen = 0;
/* 循环监听 */
while(1)
{ /* 清空接收缓冲区 */
memset(g_acRecvBuf, 0, RCV_BUF_SIZE);
/* 接收数据帧 */
iRet = recvfrom(fd, g_acRecvBuf, g_iRecvBufSize, 0, NULL, &stFromLen);
if (0 > iRet)
{ continue;}
/* 解析数据帧 */
ethmp_parseFrame(g_acRecvBuf);
}
}
/* Main */
int main(int argc, char *argv[])
{ int iRet = -1;
int fd = -1;
/* 初始化SOCKET */
fd = ethmp_initSocket();
if(0 > fd) {
return -1;
}
/* 捕获数据包 */
ethmp_startCapture(fd);
/* 关闭SOCKET */
close(fd);
return 0;
}
编译命令
gcc -o a a.c
./a
实现效果图
...
>>>Eth-Pkt-Type:0x0800(ip) SMAC=[00:1a:92:ef:b6:dd] DMAC=[00:24:7e:dc:99:18] IP-Pkt-Type:6(tcp) SAddr=[192.168.0.111] DAddr=[192.168.0.100]
>>> Eth-Pkt-Type:0x0800(ip) SMAC=[00:24:7e:dc:99:18] DMAC=[00:1a:92:ef:b6:dd] IP-Pkt-Type:6(tcp) SAddr=[192.168.0.100] DAddr=[192.168.0.111]
>>> Eth-Pkt-Type:0x0800(ip) SMAC=[00:24:7e:dc:99:18] DMAC=[00:1a:92:ef:b6:dd] IP-Pkt-Type:1(icmp) SAddr=[192.168.0.100] DAddr=[192.168.0.111]
>>> Eth-Pkt-Type:0x0800(ip) SMAC=[00:1a:92:ef:b6:dd] DMAC=[00:24:7e:dc:99:18] IP-Pkt-Type:1(icmp) SAddr=[192.168.0.111] DAddr=[192.168.0.100]
>>> Eth-Pkt-Type:0x0800(ip) SMAC=[00:1a:92:ef:b6:dd] DMAC=[00:24:7e:dc:99:18] IP-Pkt-Type:6(tcp) SAddr=[192.168.0.111] DAddr=[192.168.0.100]
...
用到的工具:Tokenall
首先需打开Tokenall的币联钱包,然后会显示出下面这个页面,我们选择交易选项即可。
❼ Linux用什么命令设置IP地址啊
Ip命令需要和参数一起使用才能指明精确的显示内容。使用ip addr可以查看当前的网络;使用ip link可以分析网卡的状态;使用ip route可以查看路由表。
所有这些命令都可以和show命令进行搭配。ip address show可以显示当前的IP地址配置;ip link show可以告诉你链路的统计信息;ip route show会显示当前的路由表。
在这个输出内容里面,ip addr show命令展现了你的Linux网络配置中所有接口的信息。例1中展现了两个网卡。lo网卡是它的回环接口,是给进程用来做基于IP协议的通讯的。比较重要的接口是eth0,是这台服务器上第一个以太网接口。你可以从中看到有三个比较重要的信息:MAC地址(用link/ether表示),IPv4地址以及IPv6地址。可以通过验证这些信息来确认是否与你需要使用的一致。
不是所有的Linux系统都会将标准的以太网卡显示为eth0。新的Linux内核会使用biosdevname功能,它会使辨别一张特定的网卡更加容易。设备的名称是唯一的,类似于eno1677736,不过这个命名在不同的Linux系统间也不是标准统一的。
另一个比较有用的来查看Linux网络配置的命令是ip –s link。这个命令展示了从一个网卡发出去的数据包的统计信息。Linux的ip –s link命令(查看例2)在你遭遇网卡故障并且希望能确保网卡在传输中没有丢包的时候会有帮助。
当检查完网络配置之后,可能还需要检查一下路由。可以使用ip route show(见例3)来查看当前的路由表。你将会看到默认路由,它表明了当机器需要访问其他网络的时候需要经过的网关的IP地址。
早在10年前,在Linux服务器上使用ifconfig命令查看当前网络信息这种方法已经开始弃用。
Linux网络栈已经从全盛时期的ifconfig发生变化了,如果现在还在使用ifconfig,那么你会错过很多信息。随着网络栈的变化,ip命令被引进来管理Linux网络配置的各个方面,而ifconfig命令的开发也再没有继续了。
Linux的ifconfig命令并不准确。举个例子,当管理员希望在网卡上配置额外的IP地址时,如果这个地址是使用ip常规命令配置的,那么你使用ifconfig将看不到这个IP地址。正因为如此,在现在很多Linux发行版本中,ifconfig命令已经不再包含于其中了。
❽ CentOS 6.5上搭建以太坊私有链,编译时报错: make: *** [geth] Error 1,请各位大神指教
build/env.sh go run build/ci.go install ./cmd/geth
make: *** [geth] Error 1
没有这个目录,或者这个目录权限不够
❾ unity batching static在哪
StaticBatchingUtility 静态批处理工具
StaticBatchingUtility can prepare your objects to take advantage of Unity's static batching.
StaticBatchingUtility可以准备你的物体,利用Unity的静态批处理优势批处理。
This step is useful as a performance optimization allowing engine to rece number of draw-calls dramatically, but keep amount of rendered geometry intact.
这步是非常有用的,作为性能优化允许引擎去减少大幅的draw-calls(描绘指令)数,但保持完整的渲染几何量。
By calling one of the Combine methods you will create an internal mesh which will contain combined geometry, however each original GameObject will be present in the scene and will be culled indivially. The fact that GameObjects can be culled indivially allows run-time to render the same amount of geometry as it would without batching, unlike combining geometry in the modeling tool. Combining geometry in the modeling tool prevents effecient culling and results in much higher amount of geometry being rendered.
通过调用Combine方法,将创建一个内部网格,其中包含合并的几何体,然而每个原始游戏物体,将出现在场景,并且被单独检选。事实上,GameObjects可以单独检选,允许运行时渲染同样数量几何体,因此没有批处理,不像在建模工具合并几何体。在建模工具合并几何体,防止生效的剔除和导致较高的几何体数量被渲染。
Note that you do not need to call Combine methods on objects which were already marked as "Static" in the Editor. They will be prepared for static batching automatically ring the Build Player step.
注意,你不需要在物体上调用Combine方法,本来就在编辑器已经标识为“Static”。它们将准备在生成时,自动静态批处理。
IMPORTANT: only objects with the same material can be batched, thus it is useful to share as many textures/material as you can.
主要事项:仅在物体具有相同材质可以被批处理,因此你可以用于共享尽可能多的纹理/材质。
Class Functions类函数
Combine
Combine will prepare all children of the staticBatchRoot for static batching.
合并将准备staticBatchRoot的所有子物体用于静态批处理。