unsigned

laravel errno 150 foreign key constraint is incorrectly formed

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can anybody help me to solve this problem? There are 3 tables with 2 foreign keys: Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); Schema::create('firms', function (Blueprint $table) { $table->increments('id'); $table->string('title')->nullable(); $table->integer('user_id')->unsigned()->nullable(); $table->foreign('user_id')->references('id')->on('users'); $table->timestamps

what is the need of hh and h format specifiers?

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: what is the use of using hhx instead of x ,in the code below mac_str is char pointer and mac is a uint8_t array , sscanf(mac_str,"%x:%x:%x:%x:%x:%x",&mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5]); when i try the above code it giving warning , warning: format ‘%x’ expects argument of type ‘unsigned int *’, but argument 8 has type ‘uint8_t *’ [-Wformat] but i saw in some code they specified sscanf(str,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",&mac[0],&mac[1],&mac[2],&mac[3],&mac[4],&mac[5]); which dont give any warning but both are working the same ,

Compile leveldb c++ program in linux error?

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have install leveldb in my home directory ~/local like this. [~/temp/leveldb-1.15.0] $ make [~/temp/leveldb-1.15.0] $ cp -av libleveldb.* $HOME/local/lib/ [~/temp/leveldb-1.15.0] $ cp -av include/leveldb $HOME/local/include/ My c++ program like this: #include <assert.h> #include <iostream> #include "leveldb/db.h" using namespace std; int main(int argc,char * argv[]) { leveldb::DB* db; leveldb::Options options; options.create_if_missing = true; std::string dbpath = "tdb"; leveldb::Status status = leveldb::DB::Open(options, dbpath, &db);

Writing unsigned int of 4 bytes over network

拈花ヽ惹草 提交于 2019-12-03 08:27:33
I have problem writing an unsigned 4 bytes int in java. Either writing a long value in java has different result on 64 bit MacOS and 32 bit Linux (Ubuntu) OR Writing to network a 4 byte unsigned int has a problem. The following call works perfectly on my local OSX writeUInt32(999999,outputstream) Reading it back gives me 999999 However when the application is deployed to a network writing a long value results in some other random number (I assume the endian has been switched?) and reading it gives me some other large number. ---------- The complete method stack is as below---------------

Bitfields in C with struct containing union of structs

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Hm... why is it that, when I print sizeof(struct MyStruct) , it outputs 3 (instead of 2) for this code? #pragma pack ( push , 1 ) struct MyStruct { unsigned char a : 6 ; union { struct { unsigned int b : 9 ; }; }; }; #pragma pack ( pop ) In case it matters, I'm running MinGW GCC 4.5.0 on Windows 7 x64, but honestly, the result is weird enough for me that I don't think the compiler and the OS matter too much here. :\ 回答1: You can't have the field starting at an address that is not byte aligned. You're expecting: 6 bits + 9 bits ->

perf mem -D report

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was using perf mem -t load record "commands" to profile system memory access latency. After, I run perf mem -D report and I got the following results: [root@mdtm-server wenji]# perf mem -D report # PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL 2054 2054 0xffffffff811186bf 0x016ffffe8fbffc804b0 49 0x68100842 /lib/modules/3.12.23/build/vmlinux:perf_event_aux_ctx 2054 2054 0xffffffff81321d6e 0xffff880c7fc87d44 7 0x68100142 /lib/modules/3.12.23/build/vmlinux:ghes_copy_tofrom_phys What does "ADDR", "DSRC", "SYMBOL" mean? 回答1: IP - PC of the

kernel task_struct

喜你入骨 提交于 2019-12-03 07:40:20
struct task_struct { struct thread_info thread_info; volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped: */ void *stack; /* 堆指针 */ atomic_t usage; /* 进程描述符使用计数,被置为2时,表示进 程描述符正在被使用而且 其相应的进程处于活动状态 */ unsigned int flags; /* Per task flags (PF_*), defined further below: */ unsigned int ptrace; /* ptrace系统调用,成员ptrace被设置为0时表示不需要被跟踪 */ /* SMP CPU: */ struct llist_node wake_entry; int on_cpu; /* 在SMP上帮助实现无加锁的进程切换 */ unsigned int cpu; /* end: */ unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; /* * recent_used_cpu is initially set as the last CPU

自定义日历(四)-区间选择控件

妖精的绣舞 提交于 2019-12-03 07:25:30
目录 一、概述 二、效果展示 三、整体结构 四、分析实现 1、QPickDate 2、QDatePanel 3、QDateWidget、QDateContent 4、 调度绘制 五、相关文章 原文链接: 自定义日历(四)-区间选择控件 一、概述 很早很早以前,写过几篇关于日历的文章,不同于Qt原生的控件,这些控件都是博主使用自绘的方式进行完成,因此可定制性更强一些,感兴趣的可以参考 自定义日历(一) 、 自定义日历(二) 和 自定义日历(三)) 。 本篇文章还是继续来写我们的日历控件,仍然采用自绘的方式,带来更加炫酷的效果。看本文的标题就应该就能明白,这次实现的是一个可以区间选择的日历控件。 二、效果展示 效果图如下,一个简单的效果展示。 日历控件与Qt原生的QDateEdit一样,是由一个按钮进行触发,弹出如期选择面板。不同的是这个日历选择面板由2个小的日期面板组成,分别是开始和结束日期,规则如下: 开始日期必须小于结束日期 顶部有快速返回按钮 选中的日期段上有高亮背景色 选中的日期点上有蓝色圆形标识 点击确定按钮以后日期选择面板关闭 三、整体结构 开始讲解具体内容之前,先来看下整体的结构划分,实现这个日期段选择控件,总共需要以下4个类,下图是工程结构 以下是4个类的说明 QDateContent:单个日历窗口 QDateWidget:包含了年月选择的单个日历窗口

Advice on unsigned int (Gangnam Style edition)

若如初见. 提交于 2019-12-03 06:53:36
问题 The video "Gangnam Style" (I'm sure you've heard it) just exceeded 2 billion views on youtube. In fact, Google says that they never expected a video to be greater than a 32-bit integer... which alludes to the fact that Google used int instead of unsigned for their view counter. I think they had to re-write their code a bit to accommodate larger views. Checking their style guide: https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Integer_Types ...they advise "don't use an

Initialize unsigned byte array using hex number

最后都变了- 提交于 2019-12-03 06:37:43
I know that unsigned byte is missing in Java Then how can I initialize the byte array using integer from 0 to 255 (in hex) ? final byte assoc_resp_msg_int[] = new byte[] { 0xe3, 0x00, //APDU CHOICE Type(AareApdu) 0x00, 0x2c, //CHOICE.length = 44 0x00, 0x00, //result=accept 0x50, 0x79, //data-proto-id = 20601 0x00, 0x26, //data-proto-info length = 38 0x80, 0x00, 0x00, 0x00, //protocolVersion 0x80, 0x00, //encoding rules = MDER 0x80, 0x00, 0x00, 0x00, //nomenclatureVersion 0x00, 0x00, 0x00, 0x00, //functionalUnits, normal Association 0x80, 0x00, 0x00, 0x00, //systemType = sys-type-manager 0x00,