problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Why does Oracle add a hidden column here? : <p>We recently migrated a customer system to Oracle 12c and to the latest version of our product. This process includes running a number of migration scripts which mostly add or change tables. We noticed that adding a column to a table while also providing a default value, creates an additional hidden column <code>SYS_NC00002$</code>.</p>
<p>You should be able to reproduce this with the following code</p>
<pre><code>create table xxx (a integer);
alter table xxx add (b integer default 1);
select table_name, column_name, data_type, data_length, column_id, default_length, data_default from user_tab_cols where table_name='XXX';
Table_Name|column_Name |data_Type|data_Length|column_Id|default_Length|data_Default|
------------------------------------------------------------------------------------
XXX |A |NUMBER | 22| 1| | |
XXX |SYS_NC00002$|RAW | 126| | | |
XXX |B |NUMBER | 22| 2| 1|1 |
</code></pre>
<p>When I populate the table and look at the values in that hidden column, they are all the same:</p>
<pre><code>select distinct SYS_NC00002$ from xxx;
Sys_Nc00002$|
-------------
01 |
</code></pre>
<p>Amazingly, when I don't set the default value right away but in an extra statement, no additional hidden column is created.</p>
<pre><code>create table xxy (a integer);
alter table xxy add (b integer);
alter table xxy modify b default 1;
select table_name, column_name, data_type, data_length, column_id, default_length, data_default from user_tab_cols where table_name='XXY';
Table_Name|column_Name|data_Type|data_Length|column_Id|default_Length|data_Default|
-----------------------------------------------------------------------------------
XXY |A |NUMBER | 22| 1| | |
XXY |B |NUMBER | 22| 2| 1|1 |
</code></pre>
<p>Can anyone explain what this hidden column is for and why it is only created in the first example, but not in the second?</p>
| 0debug |
static MigrationState *migrate_init(Monitor *mon, int detach, int blk, int inc)
{
MigrationState *s = migrate_get_current();
int64_t bandwidth_limit = s->bandwidth_limit;
memset(s, 0, sizeof(*s));
s->bandwidth_limit = bandwidth_limit;
s->blk = blk;
s->shared = inc;
s->mon = mon;
s->bandwidth_limit = bandwidth_limit;
s->state = MIG_STATE_SETUP;
if (!detach) {
migrate_fd_monitor_suspend(s, mon);
}
return s;
}
| 1threat |
int ppcmas_tlb_check(CPUState *env, ppcmas_tlb_t *tlb,
target_phys_addr_t *raddrp,
target_ulong address, uint32_t pid)
{
target_ulong mask;
uint32_t tlb_pid;
if (!(tlb->mas1 & MAS1_VALID)) {
return -1;
}
mask = ~(booke206_tlb_to_page_size(env, tlb) - 1);
LOG_SWTLB("%s: TLB ADDR=0x" TARGET_FMT_lx " PID=0x%x MAS1=0x%x MAS2=0x%"
PRIx64 " mask=0x" TARGET_FMT_lx " MAS7_3=0x%" PRIx64 " MAS8=%x\n",
__func__, address, pid, tlb->mas1, tlb->mas2, mask, tlb->mas7_3,
tlb->mas8);
tlb_pid = (tlb->mas1 & MAS1_TID_MASK) >> MAS1_TID_SHIFT;
if (tlb_pid != 0 && tlb_pid != pid) {
return -1;
}
if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK)) {
return -1;
}
*raddrp = (tlb->mas7_3 & mask) | (address & ~mask);
return 0;
}
| 1threat |
void cpu_alpha_store_fpcr (CPUState *env, uint64_t val)
{
int round_mode, mask;
set_float_exception_flags((val >> 52) & 0x3F, &env->fp_status);
mask = 0;
if (val & FPCR_INVD)
mask |= float_flag_invalid;
if (val & FPCR_DZED)
mask |= float_flag_divbyzero;
if (val & FPCR_OVFD)
mask |= float_flag_overflow;
if (val & FPCR_UNFD)
mask |= float_flag_underflow;
if (val & FPCR_INED)
mask |= float_flag_inexact;
env->fp_status.float_exception_mask = mask;
switch ((val >> FPCR_DYN_SHIFT) & 3) {
case 0:
round_mode = float_round_to_zero;
break;
case 1:
round_mode = float_round_down;
break;
case 2:
round_mode = float_round_nearest_even;
break;
case 3:
round_mode = float_round_up;
break;
}
set_float_rounding_mode(round_mode, &env->fp_status);
} | 1threat |
How to design nested 3 level json : <p>I have an object like below:</p>
<pre><code>Parent: { Child1: [ {name:'grandchild1', value:'abc', checked:true}, {name:'grandchild2', value:'pqr', checked:false} ], Child2: [ {name:'grandchild3', value:'abcd', checked:false}, {name:'grandchild4', value:'pqrs', checked:true} ], parent2{...........}.... };
</code></pre>
<p>How can I make it nested JSON.</p>
<p>Just like in root: parent1, parent2...
Child: children1, ....( Corresponding to parent)
Grandchildren: based on children</p>
<p>Please guide me how can I make it?</p>
| 0debug |
What GPU computing can do? : <p>I almost know nothing about GPU computing. I already have seen articles written about GPU computing, say <a href="https://dl.acm.org/citation.cfm?id=1572769.1572796&coll=ACM&dl=ACM&type=series&idx=SERIES304&part=series&WantType=Proceedings&title=GH" rel="nofollow noreferrer">Fast minimum spanning tree for large graphs on the GPU</a> or <a href="https://dl.acm.org/citation.cfm?id=1413966" rel="nofollow noreferrer">All-pairs shortest-paths for large graphs on the GPU</a>. It sounds GPU has some restrictions in computing that CPU doesn't have. I need to know what kind of computations a GPU can do?</p>
<p>thanks.</p>
| 0debug |
Parse retrieving value of nested object : Lets say i have object like this:
var a = {
b: {
c: 1,
d: 2
}
}
And i have saved this object in Parse. There are 100 objects, but with different c and d values. Can i do search searching only objects which contains d:2. Or the only way is to query all objects and then use for loop which will search for d:2?
Dont read this!
Writting this line just to get posted, because system does not allow to post me question, dont know why
Thank you | 0debug |
What exactly is an XML file? : <p>I've been working on various projects and have been seeing XML files pop up everywhere. </p>
<p>I understand that XML stands for <em>Extensible Markup Language</em> and don't necessarily do anything themselves (other than describe data), but I'm curious why these files are so common among many different project types and what makes them so effective.</p>
| 0debug |
static int avi_write_ix(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
char tag[5];
char ix_tag[] = "ix00";
int i, j;
assert(pb->seekable);
if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
return -1;
for (i = 0; i < s->nb_streams; i++) {
AVIStream *avist = s->streams[i]->priv_data;
int64_t ix, pos;
avi_stream2fourcc(tag, i, s->streams[i]->codecpar->codec_type);
ix_tag[3] = '0' + i;
ix = avio_tell(pb);
ffio_wfourcc(pb, ix_tag);
avio_wl32(pb, avist->indexes.entry * 8 + 24);
avio_wl16(pb, 2);
avio_w8(pb, 0);
avio_w8(pb, 1);
avio_wl32(pb, avist->indexes.entry);
ffio_wfourcc(pb, tag);
avio_wl64(pb, avi->movi_list);
avio_wl32(pb, 0);
for (j = 0; j < avist->indexes.entry; j++) {
AVIIentry *ie = avi_get_ientry(&avist->indexes, j);
avio_wl32(pb, ie->pos + 8);
avio_wl32(pb, ((uint32_t) ie->len & ~0x80000000) |
(ie->flags & 0x10 ? 0 : 0x80000000));
}
avio_flush(pb);
pos = avio_tell(pb);
avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
ffio_wfourcc(pb, "indx");
avio_skip(pb, 8);
avio_wl32(pb, avi->riff_id);
avio_skip(pb, 16 * avi->riff_id);
avio_wl64(pb, ix);
avio_wl32(pb, pos - ix);
avio_wl32(pb, avist->indexes.entry);
avio_seek(pb, pos, SEEK_SET);
}
return 0;
}
| 1threat |
Find usage % of a directory in the disk : <p>How to find the % of disk space used by a directory using du command in linux. </p>
| 0debug |
How to fix Time Limit Exceeded Error : For n (0 < n < 10^9), calculate this Eq
re=(2^n)%1000000007
but for n=10^9 I take Time Limit Exceeded Error in online judge
What can I do to solve this error ?
int main()
{
int n,i,re=1;
scanf("%d",&n);
for(i=0; n>i; i++) re=(2*re)%1000000007;
printf("%d",re);
}
| 0debug |
static void gen_sse(CPUX86State *env, DisasContext *s, int b,
target_ulong pc_start, int rex_r)
{
int b1, op1_offset, op2_offset, is_xmm, val;
int modrm, mod, rm, reg;
SSEFunc_0_epp sse_fn_epp;
SSEFunc_0_eppi sse_fn_eppi;
SSEFunc_0_ppi sse_fn_ppi;
SSEFunc_0_eppt sse_fn_eppt;
TCGMemOp ot;
b &= 0xff;
if (s->prefix & PREFIX_DATA)
b1 = 1;
else if (s->prefix & PREFIX_REPZ)
b1 = 2;
else if (s->prefix & PREFIX_REPNZ)
b1 = 3;
else
b1 = 0;
sse_fn_epp = sse_op_table1[b][b1];
if (!sse_fn_epp) {
goto illegal_op;
}
if ((b <= 0x5f && b >= 0x10) || b == 0xc6 || b == 0xc2) {
is_xmm = 1;
} else {
if (b1 == 0) {
is_xmm = 0;
} else {
is_xmm = 1;
}
}
if (s->flags & HF_TS_MASK) {
gen_exception(s, EXCP07_PREX, pc_start - s->cs_base);
return;
}
if (s->flags & HF_EM_MASK) {
illegal_op:
gen_exception(s, EXCP06_ILLOP, pc_start - s->cs_base);
return;
}
if (is_xmm && !(s->flags & HF_OSFXSR_MASK))
if ((b != 0x38 && b != 0x3a) || (s->prefix & PREFIX_DATA))
goto illegal_op;
if (b == 0x0e) {
if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW))
goto illegal_op;
gen_helper_emms(cpu_env);
return;
}
if (b == 0x77) {
gen_helper_emms(cpu_env);
return;
}
if (!is_xmm) {
gen_helper_enter_mmx(cpu_env);
}
modrm = cpu_ldub_code(env, s->pc++);
reg = ((modrm >> 3) & 7);
if (is_xmm)
reg |= rex_r;
mod = (modrm >> 6) & 3;
if (sse_fn_epp == SSE_SPECIAL) {
b |= (b1 << 8);
switch(b) {
case 0x0e7:
if (mod == 3)
goto illegal_op;
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx));
break;
case 0x1e7:
case 0x02b:
case 0x12b:
if (mod == 3)
goto illegal_op;
gen_lea_modrm(env, s, modrm);
gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
break;
case 0x3f0:
if (mod == 3)
goto illegal_op;
gen_lea_modrm(env, s, modrm);
gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
break;
case 0x22b:
case 0x32b:
if (mod == 3)
goto illegal_op;
gen_lea_modrm(env, s, modrm);
if (b1 & 1) {
gen_stq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(0)));
gen_op_st_v(s, MO_32, cpu_T[0], cpu_A0);
}
break;
case 0x6e:
#ifdef TARGET_X86_64
if (s->dflag == MO_64) {
gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0);
tcg_gen_st_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,fpregs[reg].mmx));
} else
#endif
{
gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,fpregs[reg].mmx));
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
gen_helper_movl_mm_T0_mmx(cpu_ptr0, cpu_tmp2_i32);
}
break;
case 0x16e:
#ifdef TARGET_X86_64
if (s->dflag == MO_64) {
gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,xmm_regs[reg]));
gen_helper_movq_mm_T0_xmm(cpu_ptr0, cpu_T[0]);
} else
#endif
{
gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,xmm_regs[reg]));
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
gen_helper_movl_mm_T0_xmm(cpu_ptr0, cpu_tmp2_i32);
}
break;
case 0x6f:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx));
} else {
rm = (modrm & 7);
tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env,
offsetof(CPUX86State,fpregs[rm].mmx));
tcg_gen_st_i64(cpu_tmp1_i64, cpu_env,
offsetof(CPUX86State,fpregs[reg].mmx));
}
break;
case 0x010:
case 0x110:
case 0x028:
case 0x128:
case 0x16f:
case 0x26f:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movo(offsetof(CPUX86State,xmm_regs[reg]),
offsetof(CPUX86State,xmm_regs[rm]));
}
break;
case 0x210:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_op_ld_v(s, MO_32, cpu_T[0], cpu_A0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)));
tcg_gen_movi_tl(cpu_T[0], 0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(1)));
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(2)));
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_L(0)));
}
break;
case 0x310:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
tcg_gen_movi_tl(cpu_T[0], 0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(2)));
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
}
break;
case 0x012:
case 0x112:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(1)));
}
break;
case 0x212:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_L(0)));
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(2)),
offsetof(CPUX86State,xmm_regs[rm].XMM_L(2)));
}
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(1)),
offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)));
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)),
offsetof(CPUX86State,xmm_regs[reg].XMM_L(2)));
break;
case 0x312:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
}
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(1)),
offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)));
break;
case 0x016:
case 0x116:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(1)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(1)),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
}
break;
case 0x216:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(1)),
offsetof(CPUX86State,xmm_regs[rm].XMM_L(1)));
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)),
offsetof(CPUX86State,xmm_regs[rm].XMM_L(3)));
}
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)),
offsetof(CPUX86State,xmm_regs[reg].XMM_L(1)));
gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].XMM_L(2)),
offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)));
break;
case 0x178:
case 0x378:
{
int bit_index, field_length;
if (b1 == 1 && reg != 0)
goto illegal_op;
field_length = cpu_ldub_code(env, s->pc++) & 0x3F;
bit_index = cpu_ldub_code(env, s->pc++) & 0x3F;
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,xmm_regs[reg]));
if (b1 == 1)
gen_helper_extrq_i(cpu_env, cpu_ptr0,
tcg_const_i32(bit_index),
tcg_const_i32(field_length));
else
gen_helper_insertq_i(cpu_env, cpu_ptr0,
tcg_const_i32(bit_index),
tcg_const_i32(field_length));
}
break;
case 0x7e:
#ifdef TARGET_X86_64
if (s->dflag == MO_64) {
tcg_gen_ld_i64(cpu_T[0], cpu_env,
offsetof(CPUX86State,fpregs[reg].mmx));
gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1);
} else
#endif
{
tcg_gen_ld32u_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,fpregs[reg].mmx.MMX_L(0)));
gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1);
}
break;
case 0x17e:
#ifdef TARGET_X86_64
if (s->dflag == MO_64) {
tcg_gen_ld_i64(cpu_T[0], cpu_env,
offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)));
gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1);
} else
#endif
{
tcg_gen_ld32u_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)));
gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1);
}
break;
case 0x27e:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
}
gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(1)));
break;
case 0x7f:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx));
} else {
rm = (modrm & 7);
gen_op_movq(offsetof(CPUX86State,fpregs[rm].mmx),
offsetof(CPUX86State,fpregs[reg].mmx));
}
break;
case 0x011:
case 0x111:
case 0x029:
case 0x129:
case 0x17f:
case 0x27f:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg]));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movo(offsetof(CPUX86State,xmm_regs[rm]),
offsetof(CPUX86State,xmm_regs[reg]));
}
break;
case 0x211:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)));
gen_op_st_v(s, MO_32, cpu_T[0], cpu_A0);
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movl(offsetof(CPUX86State,xmm_regs[rm].XMM_L(0)),
offsetof(CPUX86State,xmm_regs[reg].XMM_L(0)));
}
break;
case 0x311:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)));
}
break;
case 0x013:
case 0x113:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
goto illegal_op;
}
break;
case 0x017:
case 0x117:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(1)));
} else {
goto illegal_op;
}
break;
case 0x71:
case 0x72:
case 0x73:
case 0x171:
case 0x172:
case 0x173:
if (b1 >= 2) {
goto illegal_op;
}
val = cpu_ldub_code(env, s->pc++);
if (is_xmm) {
tcg_gen_movi_tl(cpu_T[0], val);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_t0.XMM_L(0)));
tcg_gen_movi_tl(cpu_T[0], 0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_t0.XMM_L(1)));
op1_offset = offsetof(CPUX86State,xmm_t0);
} else {
tcg_gen_movi_tl(cpu_T[0], val);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(0)));
tcg_gen_movi_tl(cpu_T[0], 0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(1)));
op1_offset = offsetof(CPUX86State,mmx_t0);
}
sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 +
(((modrm >> 3)) & 7)][b1];
if (!sse_fn_epp) {
goto illegal_op;
}
if (is_xmm) {
rm = (modrm & 7) | REX_B(s);
op2_offset = offsetof(CPUX86State,xmm_regs[rm]);
} else {
rm = (modrm & 7);
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
}
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op1_offset);
sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0x050:
rm = (modrm & 7) | REX_B(s);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,xmm_regs[rm]));
gen_helper_movmskps(cpu_tmp2_i32, cpu_env, cpu_ptr0);
tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32);
break;
case 0x150:
rm = (modrm & 7) | REX_B(s);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env,
offsetof(CPUX86State,xmm_regs[rm]));
gen_helper_movmskpd(cpu_tmp2_i32, cpu_env, cpu_ptr0);
tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32);
break;
case 0x02a:
case 0x12a:
gen_helper_enter_mmx(cpu_env);
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
op2_offset = offsetof(CPUX86State,mmx_t0);
gen_ldq_env_A0(s, op2_offset);
} else {
rm = (modrm & 7);
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
}
op1_offset = offsetof(CPUX86State,xmm_regs[reg]);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
switch(b >> 8) {
case 0x0:
gen_helper_cvtpi2ps(cpu_env, cpu_ptr0, cpu_ptr1);
break;
default:
case 0x1:
gen_helper_cvtpi2pd(cpu_env, cpu_ptr0, cpu_ptr1);
break;
}
break;
case 0x22a:
case 0x32a:
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
op1_offset = offsetof(CPUX86State,xmm_regs[reg]);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
if (ot == MO_32) {
SSEFunc_0_epi sse_fn_epi = sse_op_table3ai[(b >> 8) & 1];
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
sse_fn_epi(cpu_env, cpu_ptr0, cpu_tmp2_i32);
} else {
#ifdef TARGET_X86_64
SSEFunc_0_epl sse_fn_epl = sse_op_table3aq[(b >> 8) & 1];
sse_fn_epl(cpu_env, cpu_ptr0, cpu_T[0]);
#else
goto illegal_op;
#endif
}
break;
case 0x02c:
case 0x12c:
case 0x02d:
case 0x12d:
gen_helper_enter_mmx(cpu_env);
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
op2_offset = offsetof(CPUX86State,xmm_t0);
gen_ldo_env_A0(s, op2_offset);
} else {
rm = (modrm & 7) | REX_B(s);
op2_offset = offsetof(CPUX86State,xmm_regs[rm]);
}
op1_offset = offsetof(CPUX86State,fpregs[reg & 7].mmx);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
switch(b) {
case 0x02c:
gen_helper_cvttps2pi(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0x12c:
gen_helper_cvttpd2pi(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0x02d:
gen_helper_cvtps2pi(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0x12d:
gen_helper_cvtpd2pi(cpu_env, cpu_ptr0, cpu_ptr1);
break;
}
break;
case 0x22c:
case 0x32c:
case 0x22d:
case 0x32d:
ot = mo_64_32(s->dflag);
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
if ((b >> 8) & 1) {
gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.XMM_Q(0)));
} else {
gen_op_ld_v(s, MO_32, cpu_T[0], cpu_A0);
tcg_gen_st32_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,xmm_t0.XMM_L(0)));
}
op2_offset = offsetof(CPUX86State,xmm_t0);
} else {
rm = (modrm & 7) | REX_B(s);
op2_offset = offsetof(CPUX86State,xmm_regs[rm]);
}
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset);
if (ot == MO_32) {
SSEFunc_i_ep sse_fn_i_ep =
sse_op_table3bi[((b >> 7) & 2) | (b & 1)];
sse_fn_i_ep(cpu_tmp2_i32, cpu_env, cpu_ptr0);
tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32);
} else {
#ifdef TARGET_X86_64
SSEFunc_l_ep sse_fn_l_ep =
sse_op_table3bq[((b >> 7) & 2) | (b & 1)];
sse_fn_l_ep(cpu_T[0], cpu_env, cpu_ptr0);
#else
goto illegal_op;
#endif
}
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
break;
case 0xc4:
case 0x1c4:
s->rip_offset = 1;
gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0);
val = cpu_ldub_code(env, s->pc++);
if (b1) {
val &= 7;
tcg_gen_st16_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,xmm_regs[reg].XMM_W(val)));
} else {
val &= 3;
tcg_gen_st16_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,fpregs[reg].mmx.MMX_W(val)));
}
break;
case 0xc5:
case 0x1c5:
if (mod != 3)
goto illegal_op;
ot = mo_64_32(s->dflag);
val = cpu_ldub_code(env, s->pc++);
if (b1) {
val &= 7;
rm = (modrm & 7) | REX_B(s);
tcg_gen_ld16u_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,xmm_regs[rm].XMM_W(val)));
} else {
val &= 3;
rm = (modrm & 7);
tcg_gen_ld16u_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,fpregs[rm].mmx.MMX_W(val)));
}
reg = ((modrm >> 3) & 7) | rex_r;
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
break;
case 0x1d6:
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
gen_stq_env_A0(s, offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(0)));
} else {
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)),
offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)));
gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[rm].XMM_Q(1)));
}
break;
case 0x2d6:
gen_helper_enter_mmx(cpu_env);
rm = (modrm & 7);
gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(0)),
offsetof(CPUX86State,fpregs[rm].mmx));
gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].XMM_Q(1)));
break;
case 0x3d6:
gen_helper_enter_mmx(cpu_env);
rm = (modrm & 7) | REX_B(s);
gen_op_movq(offsetof(CPUX86State,fpregs[reg & 7].mmx),
offsetof(CPUX86State,xmm_regs[rm].XMM_Q(0)));
break;
case 0xd7:
case 0x1d7:
if (mod != 3)
goto illegal_op;
if (b1) {
rm = (modrm & 7) | REX_B(s);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm]));
gen_helper_pmovmskb_xmm(cpu_tmp2_i32, cpu_env, cpu_ptr0);
} else {
rm = (modrm & 7);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx));
gen_helper_pmovmskb_mmx(cpu_tmp2_i32, cpu_env, cpu_ptr0);
}
reg = ((modrm >> 3) & 7) | rex_r;
tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32);
break;
case 0x138:
case 0x038:
b = modrm;
if ((b & 0xf0) == 0xf0) {
goto do_0f_38_fx;
}
modrm = cpu_ldub_code(env, s->pc++);
rm = modrm & 7;
reg = ((modrm >> 3) & 7) | rex_r;
mod = (modrm >> 6) & 3;
if (b1 >= 2) {
goto illegal_op;
}
sse_fn_epp = sse_op_table6[b].op[b1];
if (!sse_fn_epp) {
goto illegal_op;
}
if (!(s->cpuid_ext_features & sse_op_table6[b].ext_mask))
goto illegal_op;
if (b1) {
op1_offset = offsetof(CPUX86State,xmm_regs[reg]);
if (mod == 3) {
op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]);
} else {
op2_offset = offsetof(CPUX86State,xmm_t0);
gen_lea_modrm(env, s, modrm);
switch (b) {
case 0x20: case 0x30:
case 0x23: case 0x33:
case 0x25: case 0x35:
gen_ldq_env_A0(s, op2_offset +
offsetof(XMMReg, XMM_Q(0)));
break;
case 0x21: case 0x31:
case 0x24: case 0x34:
tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0,
s->mem_index, MO_LEUL);
tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, op2_offset +
offsetof(XMMReg, XMM_L(0)));
break;
case 0x22: case 0x32:
tcg_gen_qemu_ld_tl(cpu_tmp0, cpu_A0,
s->mem_index, MO_LEUW);
tcg_gen_st16_tl(cpu_tmp0, cpu_env, op2_offset +
offsetof(XMMReg, XMM_W(0)));
break;
case 0x2a:
gen_ldo_env_A0(s, op1_offset);
return;
default:
gen_ldo_env_A0(s, op2_offset);
}
}
} else {
op1_offset = offsetof(CPUX86State,fpregs[reg].mmx);
if (mod == 3) {
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
} else {
op2_offset = offsetof(CPUX86State,mmx_t0);
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, op2_offset);
}
}
if (sse_fn_epp == SSE_SPECIAL) {
goto illegal_op;
}
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1);
if (b == 0x17) {
set_cc_op(s, CC_OP_EFLAGS);
}
break;
case 0x238:
case 0x338:
do_0f_38_fx:
b = modrm | (b1 << 8);
modrm = cpu_ldub_code(env, s->pc++);
reg = ((modrm >> 3) & 7) | rex_r;
switch (b) {
case 0x3f0:
case 0x3f1:
do_crc32:
if (!(s->cpuid_ext_features & CPUID_EXT_SSE42)) {
goto illegal_op;
}
if ((b & 0xff) == 0xf0) {
ot = MO_8;
} else if (s->dflag != MO_64) {
ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32);
} else {
ot = MO_64;
}
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[reg]);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
gen_helper_crc32(cpu_T[0], cpu_tmp2_i32,
cpu_T[0], tcg_const_i32(8 << ot));
ot = mo_64_32(s->dflag);
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
break;
case 0x1f0:
case 0x1f1:
if (s->prefix & PREFIX_REPNZ) {
goto do_crc32;
}
case 0x0f0:
case 0x0f1:
if (!(s->cpuid_ext_features & CPUID_EXT_MOVBE)) {
goto illegal_op;
}
if (s->dflag != MO_64) {
ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32);
} else {
ot = MO_64;
}
gen_lea_modrm(env, s, modrm);
if ((b & 1) == 0) {
tcg_gen_qemu_ld_tl(cpu_T[0], cpu_A0,
s->mem_index, ot | MO_BE);
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
} else {
tcg_gen_qemu_st_tl(cpu_regs[reg], cpu_A0,
s->mem_index, ot | MO_BE);
}
break;
case 0x0f2:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
tcg_gen_andc_tl(cpu_T[0], cpu_regs[s->vex_v], cpu_T[0]);
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
gen_op_update1_cc();
set_cc_op(s, CC_OP_LOGICB + ot);
break;
case 0x0f7:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
{
TCGv bound, zero;
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
tcg_gen_ext8u_tl(cpu_A0, cpu_regs[s->vex_v]);
tcg_gen_shr_tl(cpu_T[0], cpu_T[0], cpu_A0);
bound = tcg_const_tl(ot == MO_64 ? 63 : 31);
zero = tcg_const_tl(0);
tcg_gen_movcond_tl(TCG_COND_LEU, cpu_T[0], cpu_A0, bound,
cpu_T[0], zero);
tcg_temp_free(zero);
tcg_gen_shri_tl(cpu_A0, cpu_regs[s->vex_v], 8);
tcg_gen_ext8u_tl(cpu_A0, cpu_A0);
tcg_gen_movcond_tl(TCG_COND_LEU, cpu_A0, cpu_A0, bound,
cpu_A0, bound);
tcg_temp_free(bound);
tcg_gen_movi_tl(cpu_T[1], 1);
tcg_gen_shl_tl(cpu_T[1], cpu_T[1], cpu_A0);
tcg_gen_subi_tl(cpu_T[1], cpu_T[1], 1);
tcg_gen_and_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
gen_op_update1_cc();
set_cc_op(s, CC_OP_LOGICB + ot);
}
break;
case 0x0f5:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
tcg_gen_ext8u_tl(cpu_T[1], cpu_regs[s->vex_v]);
{
TCGv bound = tcg_const_tl(ot == MO_64 ? 63 : 31);
tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src,
cpu_T[1], bound);
tcg_gen_movcond_tl(TCG_COND_GT, cpu_T[1], cpu_T[1],
bound, bound, cpu_T[1]);
tcg_temp_free(bound);
}
tcg_gen_movi_tl(cpu_A0, -1);
tcg_gen_shl_tl(cpu_A0, cpu_A0, cpu_T[1]);
tcg_gen_andc_tl(cpu_T[0], cpu_T[0], cpu_A0);
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
gen_op_update1_cc();
set_cc_op(s, CC_OP_BMILGB + ot);
break;
case 0x3f6:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
switch (ot) {
default:
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EDX]);
tcg_gen_mulu2_i32(cpu_tmp2_i32, cpu_tmp3_i32,
cpu_tmp2_i32, cpu_tmp3_i32);
tcg_gen_extu_i32_tl(cpu_regs[s->vex_v], cpu_tmp2_i32);
tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp3_i32);
break;
#ifdef TARGET_X86_64
case MO_64:
tcg_gen_mulu2_i64(cpu_regs[s->vex_v], cpu_regs[reg],
cpu_T[0], cpu_regs[R_EDX]);
break;
#endif
}
break;
case 0x3f5:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
if (ot == MO_64) {
tcg_gen_mov_tl(cpu_T[1], cpu_regs[s->vex_v]);
} else {
tcg_gen_ext32u_tl(cpu_T[1], cpu_regs[s->vex_v]);
}
gen_helper_pdep(cpu_regs[reg], cpu_T[0], cpu_T[1]);
break;
case 0x2f5:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
if (ot == MO_64) {
tcg_gen_mov_tl(cpu_T[1], cpu_regs[s->vex_v]);
} else {
tcg_gen_ext32u_tl(cpu_T[1], cpu_regs[s->vex_v]);
}
gen_helper_pext(cpu_regs[reg], cpu_T[0], cpu_T[1]);
break;
case 0x1f6:
case 0x2f6:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_ADX)) {
goto illegal_op;
} else {
TCGv carry_in, carry_out, zero;
int end_op;
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
TCGV_UNUSED(carry_in);
carry_out = (b == 0x1f6 ? cpu_cc_dst : cpu_cc_src2);
switch (s->cc_op) {
case CC_OP_ADCX:
if (b == 0x1f6) {
carry_in = cpu_cc_dst;
end_op = CC_OP_ADCX;
} else {
end_op = CC_OP_ADCOX;
}
break;
case CC_OP_ADOX:
if (b == 0x1f6) {
end_op = CC_OP_ADCOX;
} else {
carry_in = cpu_cc_src2;
end_op = CC_OP_ADOX;
}
break;
case CC_OP_ADCOX:
end_op = CC_OP_ADCOX;
carry_in = carry_out;
break;
default:
end_op = (b == 0x1f6 ? CC_OP_ADCX : CC_OP_ADOX);
break;
}
if (TCGV_IS_UNUSED(carry_in)) {
if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) {
gen_compute_eflags(s);
}
carry_in = cpu_tmp0;
tcg_gen_shri_tl(carry_in, cpu_cc_src,
ctz32(b == 0x1f6 ? CC_C : CC_O));
tcg_gen_andi_tl(carry_in, carry_in, 1);
}
switch (ot) {
#ifdef TARGET_X86_64
case MO_32:
tcg_gen_ext32u_i64(cpu_regs[reg], cpu_regs[reg]);
tcg_gen_ext32u_i64(cpu_T[0], cpu_T[0]);
tcg_gen_add_i64(cpu_T[0], cpu_T[0], cpu_regs[reg]);
tcg_gen_add_i64(cpu_T[0], cpu_T[0], carry_in);
tcg_gen_ext32u_i64(cpu_regs[reg], cpu_T[0]);
tcg_gen_shri_i64(carry_out, cpu_T[0], 32);
break;
#endif
default:
zero = tcg_const_tl(0);
tcg_gen_add2_tl(cpu_T[0], carry_out,
cpu_T[0], zero,
carry_in, zero);
tcg_gen_add2_tl(cpu_regs[reg], carry_out,
cpu_regs[reg], carry_out,
cpu_T[0], zero);
tcg_temp_free(zero);
break;
}
set_cc_op(s, end_op);
}
break;
case 0x1f7:
case 0x2f7:
case 0x3f7:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
if (ot == MO_64) {
tcg_gen_andi_tl(cpu_T[1], cpu_regs[s->vex_v], 63);
} else {
tcg_gen_andi_tl(cpu_T[1], cpu_regs[s->vex_v], 31);
}
if (b == 0x1f7) {
tcg_gen_shl_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
} else if (b == 0x2f7) {
if (ot != MO_64) {
tcg_gen_ext32s_tl(cpu_T[0], cpu_T[0]);
}
tcg_gen_sar_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
} else {
if (ot != MO_64) {
tcg_gen_ext32u_tl(cpu_T[0], cpu_T[0]);
}
tcg_gen_shr_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
}
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
break;
case 0x0f3:
case 0x1f3:
case 0x2f3:
case 0x3f3:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
switch (reg & 7) {
case 1:
tcg_gen_neg_tl(cpu_T[1], cpu_T[0]);
tcg_gen_and_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
gen_op_mov_reg_v(ot, s->vex_v, cpu_T[0]);
gen_op_update2_cc();
set_cc_op(s, CC_OP_BMILGB + ot);
break;
case 2:
tcg_gen_mov_tl(cpu_cc_src, cpu_T[0]);
tcg_gen_subi_tl(cpu_T[0], cpu_T[0], 1);
tcg_gen_xor_tl(cpu_T[0], cpu_T[0], cpu_cc_src);
tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]);
set_cc_op(s, CC_OP_BMILGB + ot);
break;
case 3:
tcg_gen_mov_tl(cpu_cc_src, cpu_T[0]);
tcg_gen_subi_tl(cpu_T[0], cpu_T[0], 1);
tcg_gen_and_tl(cpu_T[0], cpu_T[0], cpu_cc_src);
tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]);
set_cc_op(s, CC_OP_BMILGB + ot);
break;
default:
goto illegal_op;
}
break;
default:
goto illegal_op;
}
break;
case 0x03a:
case 0x13a:
b = modrm;
modrm = cpu_ldub_code(env, s->pc++);
rm = modrm & 7;
reg = ((modrm >> 3) & 7) | rex_r;
mod = (modrm >> 6) & 3;
if (b1 >= 2) {
goto illegal_op;
}
sse_fn_eppi = sse_op_table7[b].op[b1];
if (!sse_fn_eppi) {
goto illegal_op;
}
if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask))
goto illegal_op;
if (sse_fn_eppi == SSE_SPECIAL) {
ot = mo_64_32(s->dflag);
rm = (modrm & 7) | REX_B(s);
if (mod != 3)
gen_lea_modrm(env, s, modrm);
reg = ((modrm >> 3) & 7) | rex_r;
val = cpu_ldub_code(env, s->pc++);
switch (b) {
case 0x14:
tcg_gen_ld8u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_B(val & 15)));
if (mod == 3) {
gen_op_mov_reg_v(ot, rm, cpu_T[0]);
} else {
tcg_gen_qemu_st_tl(cpu_T[0], cpu_A0,
s->mem_index, MO_UB);
}
break;
case 0x15:
tcg_gen_ld16u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_W(val & 7)));
if (mod == 3) {
gen_op_mov_reg_v(ot, rm, cpu_T[0]);
} else {
tcg_gen_qemu_st_tl(cpu_T[0], cpu_A0,
s->mem_index, MO_LEUW);
}
break;
case 0x16:
if (ot == MO_32) {
tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env,
offsetof(CPUX86State,
xmm_regs[reg].XMM_L(val & 3)));
if (mod == 3) {
tcg_gen_extu_i32_tl(cpu_regs[rm], cpu_tmp2_i32);
} else {
tcg_gen_qemu_st_i32(cpu_tmp2_i32, cpu_A0,
s->mem_index, MO_LEUL);
}
} else {
#ifdef TARGET_X86_64
tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env,
offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(val & 1)));
if (mod == 3) {
tcg_gen_mov_i64(cpu_regs[rm], cpu_tmp1_i64);
} else {
tcg_gen_qemu_st_i64(cpu_tmp1_i64, cpu_A0,
s->mem_index, MO_LEQ);
}
#else
goto illegal_op;
#endif
}
break;
case 0x17:
tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(val & 3)));
if (mod == 3) {
gen_op_mov_reg_v(ot, rm, cpu_T[0]);
} else {
tcg_gen_qemu_st_tl(cpu_T[0], cpu_A0,
s->mem_index, MO_LEUL);
}
break;
case 0x20:
if (mod == 3) {
gen_op_mov_v_reg(MO_32, cpu_T[0], rm);
} else {
tcg_gen_qemu_ld_tl(cpu_T[0], cpu_A0,
s->mem_index, MO_UB);
}
tcg_gen_st8_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_B(val & 15)));
break;
case 0x21:
if (mod == 3) {
tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env,
offsetof(CPUX86State,xmm_regs[rm]
.XMM_L((val >> 6) & 3)));
} else {
tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0,
s->mem_index, MO_LEUL);
}
tcg_gen_st_i32(cpu_tmp2_i32, cpu_env,
offsetof(CPUX86State,xmm_regs[reg]
.XMM_L((val >> 4) & 3)));
if ((val >> 0) & 1)
tcg_gen_st_i32(tcg_const_i32(0 ),
cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(0)));
if ((val >> 1) & 1)
tcg_gen_st_i32(tcg_const_i32(0 ),
cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(1)));
if ((val >> 2) & 1)
tcg_gen_st_i32(tcg_const_i32(0 ),
cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(2)));
if ((val >> 3) & 1)
tcg_gen_st_i32(tcg_const_i32(0 ),
cpu_env, offsetof(CPUX86State,
xmm_regs[reg].XMM_L(3)));
break;
case 0x22:
if (ot == MO_32) {
if (mod == 3) {
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[rm]);
} else {
tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0,
s->mem_index, MO_LEUL);
}
tcg_gen_st_i32(cpu_tmp2_i32, cpu_env,
offsetof(CPUX86State,
xmm_regs[reg].XMM_L(val & 3)));
} else {
#ifdef TARGET_X86_64
if (mod == 3) {
gen_op_mov_v_reg(ot, cpu_tmp1_i64, rm);
} else {
tcg_gen_qemu_ld_i64(cpu_tmp1_i64, cpu_A0,
s->mem_index, MO_LEQ);
}
tcg_gen_st_i64(cpu_tmp1_i64, cpu_env,
offsetof(CPUX86State,
xmm_regs[reg].XMM_Q(val & 1)));
#else
goto illegal_op;
#endif
}
break;
}
return;
}
if (b1) {
op1_offset = offsetof(CPUX86State,xmm_regs[reg]);
if (mod == 3) {
op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]);
} else {
op2_offset = offsetof(CPUX86State,xmm_t0);
gen_lea_modrm(env, s, modrm);
gen_ldo_env_A0(s, op2_offset);
}
} else {
op1_offset = offsetof(CPUX86State,fpregs[reg].mmx);
if (mod == 3) {
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
} else {
op2_offset = offsetof(CPUX86State,mmx_t0);
gen_lea_modrm(env, s, modrm);
gen_ldq_env_A0(s, op2_offset);
}
}
val = cpu_ldub_code(env, s->pc++);
if ((b & 0xfc) == 0x60) {
set_cc_op(s, CC_OP_EFLAGS);
if (s->dflag == MO_64) {
val |= 1 << 8;
}
}
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_eppi(cpu_env, cpu_ptr0, cpu_ptr1, tcg_const_i32(val));
break;
case 0x33a:
b = modrm | (b1 << 8);
modrm = cpu_ldub_code(env, s->pc++);
reg = ((modrm >> 3) & 7) | rex_r;
switch (b) {
case 0x3f0:
if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2)
|| !(s->prefix & PREFIX_VEX)
|| s->vex_l != 0) {
goto illegal_op;
}
ot = mo_64_32(s->dflag);
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
b = cpu_ldub_code(env, s->pc++);
if (ot == MO_64) {
tcg_gen_rotri_tl(cpu_T[0], cpu_T[0], b & 63);
} else {
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
tcg_gen_rotri_i32(cpu_tmp2_i32, cpu_tmp2_i32, b & 31);
tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32);
}
gen_op_mov_reg_v(ot, reg, cpu_T[0]);
break;
default:
goto illegal_op;
}
break;
default:
goto illegal_op;
}
} else {
switch(b) {
case 0x70:
case 0xc6:
case 0xc2:
s->rip_offset = 1;
break;
default:
break;
}
if (is_xmm) {
op1_offset = offsetof(CPUX86State,xmm_regs[reg]);
if (mod != 3) {
int sz = 4;
gen_lea_modrm(env, s, modrm);
op2_offset = offsetof(CPUX86State,xmm_t0);
switch (b) {
case 0x50 ... 0x5a:
case 0x5c ... 0x5f:
case 0xc2:
if (b1 == 2) {
sz = 2;
} else if (b1 == 3) {
sz = 3;
}
break;
case 0x2e:
case 0x2f:
if (b1 == 0) {
sz = 2;
} else {
sz = 3;
}
break;
}
switch (sz) {
case 2:
gen_op_ld_v(s, MO_32, cpu_T[0], cpu_A0);
tcg_gen_st32_tl(cpu_T[0], cpu_env,
offsetof(CPUX86State,xmm_t0.XMM_L(0)));
break;
case 3:
gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.XMM_D(0)));
break;
default:
gen_ldo_env_A0(s, op2_offset);
break;
}
} else {
rm = (modrm & 7) | REX_B(s);
op2_offset = offsetof(CPUX86State,xmm_regs[rm]);
}
} else {
op1_offset = offsetof(CPUX86State,fpregs[reg].mmx);
if (mod != 3) {
gen_lea_modrm(env, s, modrm);
op2_offset = offsetof(CPUX86State,mmx_t0);
gen_ldq_env_A0(s, op2_offset);
} else {
rm = (modrm & 7);
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
}
}
switch(b) {
case 0x0f:
if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW))
goto illegal_op;
val = cpu_ldub_code(env, s->pc++);
sse_fn_epp = sse_op_table5[val];
if (!sse_fn_epp) {
goto illegal_op;
}
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0x70:
case 0xc6:
val = cpu_ldub_code(env, s->pc++);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_ppi = (SSEFunc_0_ppi)sse_fn_epp;
sse_fn_ppi(cpu_ptr0, cpu_ptr1, tcg_const_i32(val));
break;
case 0xc2:
val = cpu_ldub_code(env, s->pc++);
if (val >= 8)
goto illegal_op;
sse_fn_epp = sse_op_table4[val][b1];
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1);
break;
case 0xf7:
if (mod != 3)
goto illegal_op;
tcg_gen_mov_tl(cpu_A0, cpu_regs[R_EDI]);
gen_extu(s->aflag, cpu_A0);
gen_add_A0_ds_seg(s);
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_eppt = (SSEFunc_0_eppt)sse_fn_epp;
sse_fn_eppt(cpu_env, cpu_ptr0, cpu_ptr1, cpu_A0);
break;
default:
tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset);
tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset);
sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1);
break;
}
if (b == 0x2e || b == 0x2f) {
set_cc_op(s, CC_OP_EFLAGS);
}
}
}
| 1threat |
static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
int do_search_pc,
const uint8_t *searched_pc)
{
int opc, op_index, macro_op_index;
const TCGOpDef *def;
unsigned int dead_iargs;
const TCGArg *args;
#ifdef DEBUG_DISAS
if (unlikely(loglevel & CPU_LOG_TB_OP)) {
fprintf(logfile, "OP:\n");
tcg_dump_ops(s, logfile);
fprintf(logfile, "\n");
}
#endif
tcg_liveness_analysis(s);
#ifdef DEBUG_DISAS
if (unlikely(loglevel & CPU_LOG_TB_OP_OPT)) {
fprintf(logfile, "OP after la:\n");
tcg_dump_ops(s, logfile);
fprintf(logfile, "\n");
}
#endif
tcg_reg_alloc_start(s);
s->code_buf = gen_code_buf;
s->code_ptr = gen_code_buf;
macro_op_index = -1;
args = gen_opparam_buf;
op_index = 0;
for(;;) {
opc = gen_opc_buf[op_index];
#ifdef CONFIG_PROFILER
dyngen_table_op_count[opc]++;
#endif
def = &tcg_op_defs[opc];
#if 0
printf("%s: %d %d %d\n", def->name,
def->nb_oargs, def->nb_iargs, def->nb_cargs);
#endif
switch(opc) {
case INDEX_op_mov_i32:
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
#endif
dead_iargs = s->op_dead_iargs[op_index];
tcg_reg_alloc_mov(s, def, args, dead_iargs);
break;
case INDEX_op_nop:
case INDEX_op_nop1:
case INDEX_op_nop2:
case INDEX_op_nop3:
break;
case INDEX_op_nopn:
args += args[0];
goto next;
case INDEX_op_discard:
{
TCGTemp *ts;
ts = &s->temps[args[0]];
if (ts->val_type != TEMP_VAL_CONST && !ts->fixed_reg) {
if (ts->val_type == TEMP_VAL_REG)
s->reg_to_temp[ts->reg] = -1;
ts->val_type = TEMP_VAL_DEAD;
}
}
break;
case INDEX_op_macro_goto:
macro_op_index = op_index;
op_index = args[0] - 1;
args = gen_opparam_buf + args[1];
goto next;
case INDEX_op_macro_end:
macro_op_index = -1;
op_index = args[0] - 1;
args = gen_opparam_buf + args[1];
goto next;
case INDEX_op_macro_start:
tcg_abort();
case INDEX_op_set_label:
tcg_reg_alloc_bb_end(s);
tcg_out_label(s, args[0], (long)s->code_ptr);
break;
case INDEX_op_call:
dead_iargs = s->op_dead_iargs[op_index];
args += tcg_reg_alloc_call(s, def, opc, args, dead_iargs);
goto next;
case INDEX_op_end:
goto the_end;
case 0 ... INDEX_op_end - 1:
#ifdef CONFIG_PROFILER
{
extern int64_t dyngen_old_op_count;
dyngen_old_op_count++;
}
#endif
tcg_reg_alloc_bb_end(s);
if (do_search_pc) {
s->code_ptr += def->copy_size;
args += def->nb_args;
} else {
args = dyngen_op(s, opc, args);
}
goto next;
default:
dead_iargs = s->op_dead_iargs[op_index];
tcg_reg_alloc_op(s, def, opc, args, dead_iargs);
break;
}
args += def->nb_args;
next: ;
if (do_search_pc) {
if (searched_pc < s->code_ptr) {
if (macro_op_index >= 0)
return macro_op_index;
else
return op_index;
}
}
op_index++;
#ifndef NDEBUG
check_regs(s);
#endif
}
the_end:
return -1;
}
| 1threat |
static void usbredir_control_packet(void *priv, uint32_t id,
struct usb_redir_control_packet_header *control_packet,
uint8_t *data, int data_len)
{
USBRedirDevice *dev = priv;
int len = control_packet->length;
AsyncURB *aurb;
DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status,
len, id);
aurb = async_find(dev, id);
if (!aurb) {
free(data);
return;
}
aurb->control_packet.status = control_packet->status;
aurb->control_packet.length = control_packet->length;
if (memcmp(&aurb->control_packet, control_packet,
sizeof(*control_packet))) {
ERROR("return control packet mismatch, please report this!\n");
len = USB_RET_NAK;
}
if (aurb->packet) {
len = usbredir_handle_status(dev, control_packet->status, len);
if (len > 0) {
usbredir_log_data(dev, "ctrl data in:", data, data_len);
if (data_len <= sizeof(dev->dev.data_buf)) {
memcpy(dev->dev.data_buf, data, data_len);
} else {
ERROR("ctrl buffer too small (%d > %zu)\n",
data_len, sizeof(dev->dev.data_buf));
len = USB_RET_STALL;
}
}
aurb->packet->len = len;
usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);
}
async_free(dev, aurb);
free(data);
}
| 1threat |
int qemu_global_option(const char *str)
{
char driver[64], property[64];
QemuOpts *opts;
int rc, offset;
rc = sscanf(str, "%63[^.].%63[^=]%n", driver, property, &offset);
if (rc < 2 || str[offset] != '=') {
error_report("can't parse: \"%s\"", str);
return -1;
}
opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort);
qemu_opt_set(opts, "driver", driver, &error_abort);
qemu_opt_set(opts, "property", property, &error_abort);
qemu_opt_set(opts, "value", str + offset + 1, &error_abort);
return 0;
}
| 1threat |
Best way to read million line txt file while using multi processing to improve speed in python : So I'm running multiple functions, each function takes a section out of the million line txt file. Each function has a for loop that runs through every line in that section of million line file. It takes info from those lines to see if it matches info in 2 other files, one about 50,000-100,000 lines long, the other about 500-1000 lines long. I checked to see if the lines match by running for loops through the other 2 files. Once the info matches I write the output to a new file, all functions write to the same file. The program will produce about 2,500 lines a minute, but will slow down the longer it runs. Also when i run 1 of the functions it does about 500 a minute, but when I do it with 23 other processes it only makes 2500 a minute, why is that? Does anyone know why that would happen? Any way i could import something to make the program run/read through files faster, im already using the 'with '' as file1:' method? Can the multi-processes be redone to run faster? thanks in advance for your input | 0debug |
How IdentityHashMap v get(key) methods woks in these below situation : import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
public class IdentityHashMapExample {
public static void main(String args[]){
// Created HashMap and IdentityHashMap objects
Map hashmapObject = new HashMap();
Map identityObject = new IdentityHashMap();
// Putting keys and values in HashMap and IdentityHashMap Object
hashmapObject.put(new String("key") ,"Google");
hashmapObject.put(new String("key") ,"Facebook");
identityObject.put(new String("identityKey") ,"Google");
identityObject.put(new String("identityKey") ,"Facebook");
// Print HashMap and IdentityHashMap Size : After adding keys
System.out.println("HashMap after adding key :"+ hashmapObject);
System.out.println("Getting value from HashMap :"+ hashmapObject.get("key"));
System.out.println("IdentityHashMap after adding key :"+ identityObject);
// why get(key) method return the null value in case of identityHash Map
System.out.println("Getting value from IdentityHashMap :"+ identityObject.get("identityKey"));
}
} | 0debug |
The policy failed legacy parsing : <p>I am trying to create IAM Role in AWS, but while I am creating I am facing error</p>
<p>"We encountered the following errors while processing your request:
Problem in attaching permission to role. Role will be created without permission.
The policy failed legacy parsing "</p>
<pre><code>{"Version": "2012-10-17", "Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Action": [
"sqs:SendMessage",
"sqs:GetQueueUrl"
],
"Effect": "Allow",
"Resource": "arn:aws:sqs:ap-northeast-1:SOME_ID_HERE:test-messages"
}]}
</code></pre>
| 0debug |
static int dxva_get_decoder_guid(AVCodecContext *avctx, void *service, void *surface_format,
unsigned guid_count, const GUID *guid_list, GUID *decoder_guid)
{
FFDXVASharedContext *sctx = DXVA_SHARED_CONTEXT(avctx);
unsigned i, j;
*decoder_guid = ff_GUID_NULL;
for (i = 0; dxva_modes[i].guid; i++) {
const dxva_mode *mode = &dxva_modes[i];
int validate;
if (mode->codec != avctx->codec_id)
continue;
for (j = 0; j < guid_count; j++) {
if (IsEqualGUID(mode->guid, &guid_list[j]))
break;
}
if (j == guid_count)
continue;
#if CONFIG_D3D11VA
if (sctx->pix_fmt == AV_PIX_FMT_D3D11)
validate = d3d11va_validate_output(service, *mode->guid, surface_format);
#endif
#if CONFIG_DXVA2
if (sctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
validate = dxva2_validate_output(service, *mode->guid, surface_format);
#endif
if (validate) {
*decoder_guid = *mode->guid;
break;
}
}
if (IsEqualGUID(decoder_guid, &ff_GUID_NULL)) {
av_log(avctx, AV_LOG_VERBOSE, "No decoder device for codec found\n");
return AVERROR(EINVAL);
}
if (IsEqualGUID(decoder_guid, &ff_DXVADDI_Intel_ModeH264_E))
sctx->workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO;
return 0;
}
| 1threat |
static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size,
const uint8_t *n_val)
{
OMAContext *oc = s->priv_data;
uint32_t pos, taglen, datalen;
struct AVDES av_des;
if (!enc_header || !n_val)
return -1;
pos = OMA_ENC_HEADER_SIZE + oc->k_size;
if (!memcmp(&enc_header[pos], "EKB ", 4))
pos += 32;
if (AV_RB32(&enc_header[pos]) != oc->rid)
av_log(s, AV_LOG_DEBUG, "Mismatching RID\n");
taglen = AV_RB32(&enc_header[pos + 32]);
datalen = AV_RB32(&enc_header[pos + 36]) >> 4;
if (taglen + (((uint64_t)datalen) << 4) + 44 > size)
return -1;
pos += 44 + taglen;
av_des_init(&av_des, n_val, 192, 1);
while (datalen-- > 0) {
av_des_crypt(&av_des, oc->r_val, &enc_header[pos], 2, NULL, 1);
kset(s, oc->r_val, NULL, 16);
if (!rprobe(s, enc_header, oc->r_val))
return 0;
pos += 16;
}
return -1;
}
| 1threat |
Windows 10 will not update until Samsung Easy Settings is manually uninstalled : <p>When I try to run the [Samsung] <strong>Easy Settings</strong> uninstall, Windows 10 blocks it from running saying that it is for a different version of Windows and might be unsafe.</p>
<p>I can't seem to find any valid or manual solutions on Samsung or Microsoft sites.</p>
| 0debug |
static int cinvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
CinVideoContext *cin = avctx->priv_data;
int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size, res = 0;
palette_type = buf[0];
palette_colors_count = AV_RL16(buf+1);
bitmap_frame_type = buf[3];
buf += 4;
bitmap_frame_size = buf_size - 4;
if (bitmap_frame_size < palette_colors_count * (3 + (palette_type != 0)))
return AVERROR_INVALIDDATA;
if (palette_type == 0) {
if (palette_colors_count > 256)
return AVERROR_INVALIDDATA;
for (i = 0; i < palette_colors_count; ++i) {
cin->palette[i] = 0xFFU << 24 | bytestream_get_le24(&buf);
bitmap_frame_size -= 3;
}
} else {
for (i = 0; i < palette_colors_count; ++i) {
cin->palette[buf[0]] = 0xFFU << 24 | AV_RL24(buf+1);
buf += 4;
bitmap_frame_size -= 4;
}
}
switch (bitmap_frame_type) {
case 9:
cin_decode_rle(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 34:
cin_decode_rle(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 35:
cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 36:
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 37:
cin_decode_huffman(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
case 38:
res = cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP],
cin->bitmap_size);
if (res < 0)
return res;
break;
case 39:
res = cin_decode_lzss(buf, bitmap_frame_size,
cin->bitmap_table[CIN_CUR_BMP],
cin->bitmap_size);
if (res < 0)
return res;
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
break;
}
cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if ((res = avctx->reget_buffer(avctx, &cin->frame))) {
av_log(cin->avctx, AV_LOG_ERROR, "failed to allocate a frame\n");
return res;
}
memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette));
cin->frame.palette_has_changed = 1;
for (y = 0; y < cin->avctx->height; ++y)
memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0],
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
cin->avctx->width);
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);
*data_size = sizeof(AVFrame);
*(AVFrame *)data = cin->frame;
return buf_size;
}
| 1threat |
Why should a python variable of type list should be defined first before assigning a value? : <p><code>x = 2</code></p>
<p>creates an integer variable. </p>
<p><code>y.append(3)</code></p>
<p>gives an error message (name 'y' is not defined). </p>
<p>In the first one a variable <code>x</code> can be assigned a value without first defining it, why can't we do the same thing with the lists (you have to first define it using <code>l = []</code>). Is this the result of a fundamental design choice in the Python language?
Thanks.</p>
| 0debug |
How to insert image in azure cosmos db (Document DB) : <p>I am using <strong>xamarin</strong> with <strong>UWP</strong> and I want to insert an image into azure <strong>cosmos DB(Document DB)</strong>.</p>
<p>So how can I achieve this?</p>
| 0debug |
static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)
{
int rtas;
GString *hypertas = g_string_sized_new(256);
GString *qemu_hypertas = g_string_sized_new(256);
uint32_t refpoints[] = { cpu_to_be32(0x4), cpu_to_be32(0x4) };
uint64_t max_hotplug_addr = spapr->hotplug_memory.base +
memory_region_size(&spapr->hotplug_memory.mr);
uint32_t lrdr_capacity[] = {
cpu_to_be32(max_hotplug_addr >> 32),
cpu_to_be32(max_hotplug_addr & 0xffffffff),
0, cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE),
cpu_to_be32(max_cpus / smp_threads),
};
_FDT(rtas = fdt_add_subnode(fdt, 0, "rtas"));
add_str(hypertas, "hcall-pft");
add_str(hypertas, "hcall-term");
add_str(hypertas, "hcall-dabr");
add_str(hypertas, "hcall-interrupt");
add_str(hypertas, "hcall-tce");
add_str(hypertas, "hcall-vio");
add_str(hypertas, "hcall-splpar");
add_str(hypertas, "hcall-bulk");
add_str(hypertas, "hcall-set-mode");
add_str(hypertas, "hcall-sprg0");
add_str(hypertas, "hcall-copy");
add_str(hypertas, "hcall-debug");
add_str(qemu_hypertas, "hcall-memop1");
if (!kvm_enabled() || kvmppc_spapr_use_multitce()) {
add_str(hypertas, "hcall-multi-tce");
}
if (spapr->resize_hpt != SPAPR_RESIZE_HPT_DISABLED) {
add_str(hypertas, "hcall-hpt-resize");
}
_FDT(fdt_setprop(fdt, rtas, "ibm,hypertas-functions",
hypertas->str, hypertas->len));
g_string_free(hypertas, TRUE);
_FDT(fdt_setprop(fdt, rtas, "qemu,hypertas-functions",
qemu_hypertas->str, qemu_hypertas->len));
g_string_free(qemu_hypertas, TRUE);
_FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points",
refpoints, sizeof(refpoints)));
_FDT(fdt_setprop_cell(fdt, rtas, "rtas-error-log-max",
RTAS_ERROR_LOG_MAX));
_FDT(fdt_setprop_cell(fdt, rtas, "rtas-event-scan-rate",
RTAS_EVENT_SCAN_RATE));
if (msi_nonbroken) {
_FDT(fdt_setprop(fdt, rtas, "ibm,change-msix-capable", NULL, 0));
}
_FDT(fdt_setprop(fdt, rtas, "ibm,extended-os-term", NULL, 0));
_FDT(fdt_setprop(fdt, rtas, "ibm,lrdr-capacity",
lrdr_capacity, sizeof(lrdr_capacity)));
spapr_dt_rtas_tokens(fdt, rtas);
}
| 1threat |
sklearn train_test_split on pandas stratify by multiple columns : <p>I'm a relatively new user to sklearn and have run into some unexpected behavior in train_test_split from sklearn.model_selection. I have a pandas dataframe that I would like to split into a training and test set. I would like to stratify my data by at least 2, but ideally 4 columns in my dataframe. </p>
<p>There were no warnings from sklearn when I tried to do this, however I found later that there were repeated rows in my final data set. I created a sample test to show this behavior:</p>
<pre><code>from sklearn.model_selection import train_test_split
a = np.array([i for i in range(1000000)])
b = [i%10 for i in a]
c = [i%5 for i in a]
df = pd.DataFrame({'a':a, 'b':b, 'c':c})
</code></pre>
<p>It seems to work as expected if I stratify by either column:</p>
<pre><code>train, test = train_test_split(df, test_size=0.2, random_state=0, stratify=df[['b']])
print(len(train.a.values)) # prints 800000
print(len(set(train.a.values))) # prints 800000
train, test = train_test_split(df, test_size=0.2, random_state=0, stratify=df[['c']])
print(len(train.a.values)) # prints 800000
print(len(set(train.a.values))) # prints 800000
</code></pre>
<p>But when I try to stratify by both columns, I get repeated values:</p>
<pre><code>train, test = train_test_split(df, test_size=0.2, random_state=0, stratify=df[['b', 'c']])
print(len(train.a.values)) # prints 800000
print(len(set(train.a.values))) # prints 640000
</code></pre>
| 0debug |
static int find_real_tpr_addr(VAPICROMState *s, CPUX86State *env)
{
target_phys_addr_t paddr;
target_ulong addr;
if (s->state == VAPIC_ACTIVE) {
return 0;
}
for (addr = 0xfffff000; addr >= 0x80000000; addr -= TARGET_PAGE_SIZE) {
paddr = cpu_get_phys_page_debug(env, addr);
if (paddr != APIC_DEFAULT_ADDRESS) {
continue;
}
s->real_tpr_addr = addr + 0x80;
update_guest_rom_state(s);
return 0;
}
return -1;
}
| 1threat |
the android phone does not vibrate what is the error here is the code : public void onReceive(Context arg0, Intent arg1) {
mySQLiteAdapter.openToWrite();
Calendar ctaq = Calendar.getInstance();
SimpleDateFormat dfaq = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String crntdt = dfaq.format(ctaq.getTime());
String appt ="SELECT * FROM MYDATABASE_NAME where KEY_DATE ='"+crntdt+"';";
cursor = mySQLiteAdapter.queueAll();
String title, place;
title = cursor.getString(1);
place = cursor.getString(2);
Toast.makeText(arg0, "Beellamni keessan!!"+title+" dhaqabeera !!!!.", Toast.LENGTH_LONG).show();
Vibrator vibrator = (Vibrator) arg0.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(2000);
} | 0debug |
static int h261_probe(AVProbeData *p)
{
int code;
const uint8_t *d;
if (p->buf_size < 6)
return 0;
d = p->buf;
code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
if (code == 0x10) {
return 50;
}
return 0;
}
| 1threat |
How can I mock an ES6 module import using Jest? : <p>I'm beginning to think this isn't possible, but I want to ask anyway.</p>
<p>I want to test that one of my ES6 modules calls another ES6 module in a particular way. With Jasmine this is super easy --</p>
<p>The app code:</p>
<pre><code>// myModule.js
import dependency from './dependency';
export default (x) => {
dependency.doSomething(x * 2);
}
</code></pre>
<p>And the test code:</p>
<pre><code>//myModule-test.js
import myModule from '../myModule';
import dependency from '../dependency';
describe('myModule', () => {
it('calls the dependency with double the input', () => {
spyOn(dependency, 'doSomething');
myModule(2);
expect(dependency.doSomething).toHaveBeenCalledWith(4);
});
});
</code></pre>
<p>What's the equivalent with Jest? I feel like this is such a simple thing to want to do, but I've been tearing my hair out trying to figure it out.</p>
<p>The closest I've come is by replacing the <code>import</code>s with <code>require</code>s, and moving them inside the tests/functions. Neither of which are things I want to do.</p>
<pre><code>// myModule.js
export default (x) => {
const dependency = require('./dependency'); // yuck
dependency.doSomething(x * 2);
}
//myModule-test.js
describe('myModule', () => {
it('calls the dependency with double the input', () => {
jest.mock('../dependency');
myModule(2);
const dependency = require('../dependency'); // also yuck
expect(dependency.doSomething).toBeCalledWith(4);
});
});
</code></pre>
<p>For bonus points, I'd love to make the whole thing work when the function inside <code>dependency.js</code> is a default export. However, I know that spying on default exports doesn't work in Jasmine (or at least I could never get it to work), so I'm not holding out hope that it's possible in Jest either.</p>
| 0debug |
static void mps2_common_init(MachineState *machine)
{
MPS2MachineState *mms = MPS2_MACHINE(machine);
MPS2MachineClass *mmc = MPS2_MACHINE_GET_CLASS(machine);
MemoryRegion *system_memory = get_system_memory();
DeviceState *armv7m, *sccdev;
if (!machine->cpu_model) {
machine->cpu_model = mmc->cpu_model;
}
if (strcmp(machine->cpu_model, mmc->cpu_model) != 0) {
error_report("This board can only be used with CPU %s", mmc->cpu_model);
exit(1);
}
memory_region_allocate_system_memory(&mms->psram,
NULL, "mps.ram", 0x1000000);
memory_region_add_subregion(system_memory, 0x21000000, &mms->psram);
switch (mmc->fpga_type) {
case FPGA_AN385:
make_ram(&mms->ssram1, "mps.ssram1", 0x0, 0x400000);
make_ram_alias(&mms->ssram1_m, "mps.ssram1_m", &mms->ssram1, 0x400000);
make_ram(&mms->ssram23, "mps.ssram23", 0x20000000, 0x400000);
make_ram_alias(&mms->ssram23_m, "mps.ssram23_m",
&mms->ssram23, 0x20400000);
make_ram(&mms->blockram, "mps.blockram", 0x01000000, 0x4000);
make_ram_alias(&mms->blockram_m1, "mps.blockram_m1",
&mms->blockram, 0x01004000);
make_ram_alias(&mms->blockram_m2, "mps.blockram_m2",
&mms->blockram, 0x01008000);
make_ram_alias(&mms->blockram_m3, "mps.blockram_m3",
&mms->blockram, 0x0100c000);
break;
case FPGA_AN511:
make_ram(&mms->blockram, "mps.blockram", 0x0, 0x40000);
make_ram(&mms->ssram1, "mps.ssram1", 0x00400000, 0x00800000);
make_ram(&mms->sram, "mps.sram", 0x20000000, 0x20000);
make_ram(&mms->ssram23, "mps.ssram23", 0x20400000, 0x400000);
break;
default:
g_assert_not_reached();
}
object_initialize(&mms->armv7m, sizeof(mms->armv7m), TYPE_ARMV7M);
armv7m = DEVICE(&mms->armv7m);
qdev_set_parent_bus(armv7m, sysbus_get_default());
switch (mmc->fpga_type) {
case FPGA_AN385:
qdev_prop_set_uint32(armv7m, "num-irq", 32);
break;
case FPGA_AN511:
qdev_prop_set_uint32(armv7m, "num-irq", 64);
break;
default:
g_assert_not_reached();
}
qdev_prop_set_string(armv7m, "cpu-model", machine->cpu_model);
object_property_set_link(OBJECT(&mms->armv7m), OBJECT(system_memory),
"memory", &error_abort);
object_property_set_bool(OBJECT(&mms->armv7m), true, "realized",
&error_fatal);
create_unimplemented_device("zbtsmram mirror", 0x00400000, 0x00400000);
create_unimplemented_device("RESERVED 1", 0x00800000, 0x00800000);
create_unimplemented_device("Block RAM", 0x01000000, 0x00010000);
create_unimplemented_device("RESERVED 2", 0x01010000, 0x1EFF0000);
create_unimplemented_device("RESERVED 3", 0x20800000, 0x00800000);
create_unimplemented_device("PSRAM", 0x21000000, 0x01000000);
create_unimplemented_device("CMSDK APB peripheral region @0x40000000",
0x40000000, 0x00010000);
create_unimplemented_device("CMSDK peripheral region @0x40010000",
0x40010000, 0x00010000);
create_unimplemented_device("Extra peripheral region @0x40020000",
0x40020000, 0x00010000);
create_unimplemented_device("RESERVED 4", 0x40030000, 0x001D0000);
create_unimplemented_device("VGA", 0x41000000, 0x0200000);
switch (mmc->fpga_type) {
case FPGA_AN385:
{
Object *orgate;
DeviceState *orgate_dev;
int i;
orgate = object_new(TYPE_OR_IRQ);
object_property_set_int(orgate, 6, "num-lines", &error_fatal);
object_property_set_bool(orgate, true, "realized", &error_fatal);
orgate_dev = DEVICE(orgate);
qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12));
for (i = 0; i < 5; i++) {
static const hwaddr uartbase[] = {0x40004000, 0x40005000,
0x40006000, 0x40007000,
0x40009000};
Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hds[i] : NULL;
static const int uartirq[] = {0, 2, 4, 18, 20};
qemu_irq txovrint = NULL, rxovrint = NULL;
if (i < 3) {
txovrint = qdev_get_gpio_in(orgate_dev, i * 2);
rxovrint = qdev_get_gpio_in(orgate_dev, i * 2 + 1);
}
cmsdk_apb_uart_create(uartbase[i],
qdev_get_gpio_in(armv7m, uartirq[i] + 1),
qdev_get_gpio_in(armv7m, uartirq[i]),
txovrint, rxovrint,
NULL,
uartchr, SYSCLK_FRQ);
}
break;
}
case FPGA_AN511:
{
Object *orgate;
DeviceState *orgate_dev;
int i;
orgate = object_new(TYPE_OR_IRQ);
object_property_set_int(orgate, 10, "num-lines", &error_fatal);
object_property_set_bool(orgate, true, "realized", &error_fatal);
orgate_dev = DEVICE(orgate);
qdev_connect_gpio_out(orgate_dev, 0, qdev_get_gpio_in(armv7m, 12));
for (i = 0; i < 5; i++) {
static const int uart_txrx_irqno[] = {0, 2, 45, 46, 56};
static const hwaddr uartbase[] = {0x40004000, 0x40005000,
0x4002c000, 0x4002d000,
0x4002e000};
Chardev *uartchr = i < MAX_SERIAL_PORTS ? serial_hds[i] : NULL;
Object *txrx_orgate;
DeviceState *txrx_orgate_dev;
txrx_orgate = object_new(TYPE_OR_IRQ);
object_property_set_int(txrx_orgate, 2, "num-lines", &error_fatal);
object_property_set_bool(txrx_orgate, true, "realized",
&error_fatal);
txrx_orgate_dev = DEVICE(txrx_orgate);
qdev_connect_gpio_out(txrx_orgate_dev, 0,
qdev_get_gpio_in(armv7m, uart_txrx_irqno[i]));
cmsdk_apb_uart_create(uartbase[i],
qdev_get_gpio_in(txrx_orgate_dev, 0),
qdev_get_gpio_in(txrx_orgate_dev, 1),
qdev_get_gpio_in(orgate_dev, 0),
qdev_get_gpio_in(orgate_dev, 1),
NULL,
uartchr, SYSCLK_FRQ);
}
break;
}
default:
g_assert_not_reached();
}
cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ);
cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ);
object_initialize(&mms->scc, sizeof(mms->scc), TYPE_MPS2_SCC);
sccdev = DEVICE(&mms->scc);
qdev_set_parent_bus(sccdev, sysbus_get_default());
qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2);
qdev_prop_set_uint32(sccdev, "scc-aid", 0x02000008);
qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id);
object_property_set_bool(OBJECT(&mms->scc), true, "realized",
&error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(sccdev), 0, 0x4002f000);
lan9118_init(&nd_table[0], 0x40200000,
qdev_get_gpio_in(armv7m,
mmc->fpga_type == FPGA_AN385 ? 13 : 47));
system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
0x400000);
}
| 1threat |
void qmp_disable_command(const char *name)
{
QmpCommand *cmd;
QTAILQ_FOREACH(cmd, &qmp_commands, node) {
if (strcmp(cmd->name, name) == 0) {
cmd->enabled = false;
return;
}
}
}
| 1threat |
changing background colour when stringvariable is higher than 5 (tkinter/python) : my problem is that iam trying to change a background colour to change when the(string)variable is higher than 5.
this is the code:
colour_p1="White"
kills_p1 = IntVar()
kills_p1.set(0)
def kill_count_p1():
kills_p1.set(kills_p1.get()+1)
Label(master, textvariable=kills_p1, bg=colour_p1, font=("Courier", 20)).grid(column = 4, row=2)
I have tried a few different ways like "if", but it keeps it on the same colour all the time. I want the background to be yellow when the variable "kills_p1" is higher than 5.
ps. this is only a part of the project and not the whole | 0debug |
static int mkv_write_attachments(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
AVIOContext *dyn_cp, *pb = s->pb;
ebml_master attachments;
AVLFG c;
int i, ret;
if (!mkv->have_attachments)
return 0;
mkv->attachments = av_mallocz(sizeof(*mkv->attachments));
if (!mkv->attachments)
return ret;
av_lfg_init(&c, av_get_random_seed());
ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_ATTACHMENTS, avio_tell(pb));
if (ret < 0) return ret;
ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, &attachments, MATROSKA_ID_ATTACHMENTS, 0);
if (ret < 0) return ret;
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
ebml_master attached_file;
mkv_attachment *attachment = mkv->attachments->entries;
AVDictionaryEntry *t;
const char *mimetype = NULL;
uint32_t fileuid;
if (st->codecpar->codec_type != AVMEDIA_TYPE_ATTACHMENT)
continue;
attachment = av_realloc_array(attachment, mkv->attachments->num_entries + 1, sizeof(mkv_attachment));
if (!attachment)
return AVERROR(ENOMEM);
mkv->attachments->entries = attachment;
attached_file = start_ebml_master(dyn_cp, MATROSKA_ID_ATTACHEDFILE, 0);
if (t = av_dict_get(st->metadata, "title", NULL, 0))
put_ebml_string(dyn_cp, MATROSKA_ID_FILEDESC, t->value);
if (!(t = av_dict_get(st->metadata, "filename", NULL, 0))) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no filename tag.\n", i);
return AVERROR(EINVAL);
}
put_ebml_string(dyn_cp, MATROSKA_ID_FILENAME, t->value);
if (t = av_dict_get(st->metadata, "mimetype", NULL, 0))
mimetype = t->value;
else if (st->codecpar->codec_id != AV_CODEC_ID_NONE ) {
int i;
for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_mime_tags[i].str;
break;
}
for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_image_mime_tags[i].id == st->codecpar->codec_id) {
mimetype = ff_mkv_image_mime_tags[i].str;
break;
}
}
if (!mimetype) {
av_log(s, AV_LOG_ERROR, "Attachment stream %d has no mimetype tag and "
"it cannot be deduced from the codec id.\n", i);
return AVERROR(EINVAL);
}
if (s->flags & AVFMT_FLAG_BITEXACT) {
struct AVSHA *sha = av_sha_alloc();
uint8_t digest[20];
if (!sha)
return AVERROR(ENOMEM);
av_sha_init(sha, 160);
av_sha_update(sha, st->codecpar->extradata, st->codecpar->extradata_size);
av_sha_final(sha, digest);
av_free(sha);
fileuid = AV_RL32(digest);
} else {
fileuid = av_lfg_get(&c);
}
av_log(s, AV_LOG_VERBOSE, "Using %.8"PRIx32" for attachment %d\n",
fileuid, mkv->attachments->num_entries);
put_ebml_string(dyn_cp, MATROSKA_ID_FILEMIMETYPE, mimetype);
put_ebml_binary(dyn_cp, MATROSKA_ID_FILEDATA, st->codecpar->extradata, st->codecpar->extradata_size);
put_ebml_uint(dyn_cp, MATROSKA_ID_FILEUID, fileuid);
end_ebml_master(dyn_cp, attached_file);
mkv->attachments->entries[mkv->attachments->num_entries].stream_idx = i;
mkv->attachments->entries[mkv->attachments->num_entries++].fileuid = fileuid;
}
end_ebml_master_crc32(pb, &dyn_cp, mkv, attachments);
return 0;
}
| 1threat |
static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
GArray *table_data, BIOSLinker *linker,
GArray *dsm_dma_arrea)
{
Aml *ssdt, *sb_scope, *dev;
int mem_addr_offset, nvdimm_ssdt;
acpi_add_table(table_offsets, table_data);
ssdt = init_aml_allocator();
acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
sb_scope = aml_scope("\\_SB");
dev = aml_device("NVDR");
aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012")));
nvdimm_build_common_dsm(dev);
nvdimm_build_device_dsm(dev, 0);
nvdimm_build_nvdimm_devices(device_list, dev);
aml_append(sb_scope, dev);
aml_append(ssdt, sb_scope);
nvdimm_ssdt = table_data->len;
g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len);
mem_addr_offset = build_append_named_dword(table_data,
NVDIMM_ACPI_MEM_ADDR);
bios_linker_loader_alloc(linker,
NVDIMM_DSM_MEM_FILE, dsm_dma_arrea,
sizeof(NvdimmDsmIn), false );
bios_linker_loader_add_pointer(linker,
ACPI_BUILD_TABLE_FILE, mem_addr_offset, sizeof(uint32_t),
NVDIMM_DSM_MEM_FILE, 0);
build_header(linker, table_data,
(void *)(table_data->data + nvdimm_ssdt),
"SSDT", table_data->len - nvdimm_ssdt, 1, NULL, "NVDIMM");
free_aml_allocator();
}
| 1threat |
return type must be 'bool' error c# : I have created application using xamarin android need to display and alert box , and based on the value selected I am doing some calculations. so on menu item click I have added below code.
public override async Task<bool> OnOptionsItemSelected(IMenuItem item)
{
bool bTotalResult = false;
switch (item.ItemId)
{
case Resource.Id.action_next:
bTotalResult = await ShowPayMentTypeDialog();
return await Task.Run(() => true).ConfigureAwait(true); ;
default:
return await Task.Run(() => base.OnOptionsItemSelected(item)).ConfigureAwait(true);;
}
//return await Task.Run(() => false ).ConfigureAwait(true);
}
private async Task<bool> ShowPayMentTypeDialog()
{
bool bResult = false;
try
{
LayoutInflater layoutInflater = LayoutInflater.From(this);
View view = layoutInflater.Inflate(Resource.Layout.lyt_cash_credit_popup, null);
Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
alertbuilder.SetView(view);
var userdata = view.FindViewById<Spinner>(Resource.Id.spnrPaymentTerms);
List<cls_spinner_adapter> resultsWayNo = new List<cls_spinner_adapter> {
new cls_spinner_adapter {SZ_SPINNER_TEXT ="CASH"},
new cls_spinner_adapter {SZ_SPINNER_TEXT ="CREDIT" } };
CommonSpinnerAdapter paymentAdapter = new CommonSpinnerAdapter(this, resultsWayNo);
userdata.Adapter = paymentAdapter;
alertbuilder.SetCancelable(false)
.SetPositiveButton("OK", delegate
{
if (resultsWayNo[userdata.SelectedItemPosition].SZ_SPINNER_TEXT == "CASH")
{
cls_statics.B_IS_PROMOMAYMANET_CASH = true;
}
else
{
cls_statics.B_IS_PROMOMAYMANET_CASH = false;
}
bResult = true;
})
.SetNegativeButton("Cancel", delegate
{
cls_statics.B_IS_PROMOMAYMANET_CASH = false;
bResult = true;
alertbuilder.Dispose();
});
Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
dialog.Show();
}
catch
{
}
return await Task.Run(() => bResult).ConfigureAwait(true);
}
But while compiling I am getting below error.
'return type must be 'bool' to match overridden member 'Activity.OnOptionsItemSelected(IMenuItem)'
Any help would be appreciated. | 0debug |
How do i read a command line? : <p>In the program i need to have a way of reading a command line thats given to the program with the running of the program. so for example: </p>
<p>"flying-postman.exe mail.txt boeing-spec.txt 23:00 –o itinerary.txt"</p>
<p>so this line should firstly run the program(which is flying-postman.exe) and then it also needs to feed those 4 following variables to the program. </p>
<p>So i know that ReadLine() exists, but it wont be helpful in the case because i need it to take those variables at the same time the program is called not after the program is called. i.e i dont want it to run the program then wait for the user to enter in the values.</p>
| 0debug |
Splitting raw data into separate tables in VBA : using excel and VBA:
I have a set of raw data in the following format:
**Date | Product | Value**
30/10/2017 | A | 100
29/10/2017 | A | 100
28/10/2017 | A | 100
30/10/2017 | B | 100
29/10/2017 | B | 100
28/10/2017 | B | 100
30/10/2017 | C | 100
29/10/2017 | C | 100
28/10/2017 | C | 100
I need this split into separate tables A, B, C with date and value as their columns.
| 0debug |
Excel - Find values that dont have a second value : This one is a bit complicated. Below is a sample data structure. Essentially, I am looking for a list of column A where there isn't a specific value in column B as well as any other value in Column B.
Example:
COLUMN A COLUMN B
LEFT ALPHA
LEFT BETA
LEFT CHARLIE
RIGHT BETA
RIGHT CHARLIE
UP ALPHA
UP CHARLIE
DOWN BETA
I want to know all Column A Where There is an Alpha and at least one other value for Column A. So Left has an Alpha and another value that's not alpha so it would be included. Right doesn't have an alpha so auto excluded. Up has an Alpha and another value that's not alpha so it would be included. Down has no alpha and is excluded. This can populate the list on another worksheet that would be best. I think I have to go the Macro VB route but Im unsure where to even start.
I hope this makes sense. Sorry if it doesn't but please feel free to ask clarifying questions. I really appreciate your help. | 0debug |
How to replace all non-NAN values with unity? : <p>I have a 3500*7500 matrix where I have NAN and other values. I want to basically convert all non-NAN values with 1.</p>
<p>I can use ~isnan(mat) to convert NAN to 0 and non-NAN to 1. </p>
<p>Is there a similar function to convert non-NAN values with 1 and leaving NANs as they are.</p>
| 0debug |
static inline int get_bat(CPUPPCState *env, mmu_ctx_t *ctx,
target_ulong virtual, int rw, int type)
{
target_ulong *BATlt, *BATut, *BATu, *BATl;
target_ulong BEPIl, BEPIu, bl;
int i, valid, prot;
int ret = -1;
LOG_BATS("%s: %cBAT v " TARGET_FMT_lx "\n", __func__,
type == ACCESS_CODE ? 'I' : 'D', virtual);
switch (type) {
case ACCESS_CODE:
BATlt = env->IBAT[1];
BATut = env->IBAT[0];
break;
default:
BATlt = env->DBAT[1];
BATut = env->DBAT[0];
break;
}
for (i = 0; i < env->nb_BATs; i++) {
BATu = &BATut[i];
BATl = &BATlt[i];
BEPIu = *BATu & 0xF0000000;
BEPIl = *BATu & 0x0FFE0000;
if (unlikely(env->mmu_model == POWERPC_MMU_601)) {
bat_601_size_prot(env, &bl, &valid, &prot, BATu, BATl);
} else {
bat_size_prot(env, &bl, &valid, &prot, BATu, BATl);
}
LOG_BATS("%s: %cBAT%d v " TARGET_FMT_lx " BATu " TARGET_FMT_lx
" BATl " TARGET_FMT_lx "\n", __func__,
type == ACCESS_CODE ? 'I' : 'D', i, virtual, *BATu, *BATl);
if ((virtual & 0xF0000000) == BEPIu &&
((virtual & 0x0FFE0000) & ~bl) == BEPIl) {
if (valid != 0) {
ctx->raddr = (*BATl & 0xF0000000) |
((virtual & 0x0FFE0000 & bl) | (*BATl & 0x0FFE0000)) |
(virtual & 0x0001F000);
ctx->prot = prot;
ret = check_prot(ctx->prot, rw, type);
if (ret == 0) {
LOG_BATS("BAT %d match: r " TARGET_FMT_plx " prot=%c%c\n",
i, ctx->raddr, ctx->prot & PAGE_READ ? 'R' : '-',
ctx->prot & PAGE_WRITE ? 'W' : '-');
}
break;
}
}
}
if (ret < 0) {
#if defined(DEBUG_BATS)
if (qemu_log_enabled()) {
LOG_BATS("no BAT match for " TARGET_FMT_lx ":\n", virtual);
for (i = 0; i < 4; i++) {
BATu = &BATut[i];
BATl = &BATlt[i];
BEPIu = *BATu & 0xF0000000;
BEPIl = *BATu & 0x0FFE0000;
bl = (*BATu & 0x00001FFC) << 15;
LOG_BATS("%s: %cBAT%d v " TARGET_FMT_lx " BATu " TARGET_FMT_lx
" BATl " TARGET_FMT_lx "\n\t" TARGET_FMT_lx " "
TARGET_FMT_lx " " TARGET_FMT_lx "\n",
__func__, type == ACCESS_CODE ? 'I' : 'D', i, virtual,
*BATu, *BATl, BEPIu, BEPIl, bl);
}
}
#endif
}
return ret;
}
| 1threat |
Making 'make clean' ask for confirmation : <p>Is there a way to make the command <code>make clean</code> require user confirmation? I mistakenly executed it and now I have to wait 6 hours for the build to complete again.</p>
<p>The <code>Makefile</code>s were created by <code>cmake</code>.</p>
<p>Desired workflow:</p>
<pre><code>> make clean
> [make] Are you sure you want to remove all the built files? [Y/N]
> N
> [make] Target 'make clean' not executed.
> make clean
> [make] Are you sure you want to remove all the built files? [Y/N]
> Y
> [make] Target 'make clean' executed.
</code></pre>
| 0debug |
Chrome Angular Unchecked runtime.lastError: The message port closed before a response was received : <p>I am getting the following error in Chrome on Mac (Version 71.0.3578.98) while accessing my angular app:</p>
<p>targets/showTargetsByStream:1 Unchecked runtime.lastError: The message port closed before a response was received.</p>
<p>My app is accessing REST api hosted by a node express server.</p>
<p>Above error is coming for every page, like navigating to new URL within the app.</p>
<p>Also noticed that Safari is not throwing above error. </p>
<p>Appreciate any help in resolving this error.</p>
| 0debug |
int egl_rendernode_init(const char *rendernode)
{
qemu_egl_rn_fd = -1;
qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode);
if (qemu_egl_rn_fd == -1) {
error_report("egl: no drm render node available");
goto err;
}
qemu_egl_rn_gbm_dev = gbm_create_device(qemu_egl_rn_fd);
if (!qemu_egl_rn_gbm_dev) {
error_report("egl: gbm_create_device failed");
goto err;
}
qemu_egl_init_dpy_mesa((EGLNativeDisplayType)qemu_egl_rn_gbm_dev);
if (!epoxy_has_egl_extension(qemu_egl_display,
"EGL_KHR_surfaceless_context")) {
error_report("egl: EGL_KHR_surfaceless_context not supported");
goto err;
}
if (!epoxy_has_egl_extension(qemu_egl_display,
"EGL_MESA_image_dma_buf_export")) {
error_report("egl: EGL_MESA_image_dma_buf_export not supported");
goto err;
}
qemu_egl_rn_ctx = qemu_egl_init_ctx();
if (!qemu_egl_rn_ctx) {
error_report("egl: egl_init_ctx failed");
goto err;
}
return 0;
err:
if (qemu_egl_rn_gbm_dev) {
gbm_device_destroy(qemu_egl_rn_gbm_dev);
}
if (qemu_egl_rn_fd != -1) {
close(qemu_egl_rn_fd);
}
return -1;
}
| 1threat |
void OPPROTO op_addw_EDI_T0(void)
{
EDI = (EDI & ~0xffff) | ((EDI + T0) & 0xffff);
}
| 1threat |
How to set the height of CKEditor 5 (Classic Editor) : <p>In CKEditor 4 to change the editor height there was a configuration option: <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-height" rel="noreferrer">config.height</a>. </p>
<p>How do I change the height of CKEditor 5? (the Classic Editor)</p>
| 0debug |
Promise.all invoking array variable full of functions : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function getMyFunction(data) {
return () => new Promise((resolve, reject) => {
resolve('here is the value:' + data);
});
}
const whatToGet = [
'a',
'b',
'c',
'd',
'e',
];
const stuffArray = whatToGet.map(thing => getMyFunction(thing));
Promise.all(stuffArray).then((result) => {
console.log('result: ', result);
});</code></pre>
</div>
</div>
</p>
<p>I am expecting </p>
<pre><code>result: [
'here is the value: a',
'here is the value: b',
'here is the value: c',
'here is the value: d',
'here is the value: e'
]
</code></pre>
<p>but I instead get result:</p>
<pre><code>result: [ () => new Promise((resolve, reject) => {
resolve('here is the value:', data);
}), () => new Promise((resolve, reject) => {
resolve('here is the value:', data);
}), () => new Promise((resolve, reject) => {
resolve('here is the value:', data);
}), () => new Promise((resolve, reject) => {
resolve('here is the value:', data);
}), () => new Promise((resolve, reject) => {
resolve('here is the value:', data);
})
]
</code></pre>
| 0debug |
How can i find count of capital laters , small laters and worlds in prolog :
I need to read a txt file and find the number of capital laters, small letters and the number of words.Which way can i follow to do this? | 0debug |
static av_cold int vqa_decode_init(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
unsigned char *vqa_header;
int i, j, codebook_index;
s->avctx = avctx;
avctx->pix_fmt = PIX_FMT_PAL8;
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
return -1;
}
vqa_header = (unsigned char *)s->avctx->extradata;
s->vqa_version = vqa_header[0];
s->width = AV_RL16(&vqa_header[6]);
s->height = AV_RL16(&vqa_header[8]);
if(av_image_check_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
s->vector_width = vqa_header[10];
s->vector_height = vqa_header[11];
s->partial_count = s->partial_countdown = vqa_header[13];
if ((s->vector_width != 4) ||
((s->vector_height != 2) && (s->vector_height != 4))) {
return -1;
}
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
s->next_codebook_buffer = av_malloc(s->codebook_size);
if (s->vector_height == 4) {
codebook_index = 0xFF00 * 16;
for (i = 0; i < 256; i++)
for (j = 0; j < 16; j++)
s->codebook[codebook_index++] = i;
} else {
codebook_index = 0xF00 * 8;
for (i = 0; i < 256; i++)
for (j = 0; j < 8; j++)
s->codebook[codebook_index++] = i;
}
s->next_codebook_buffer_index = 0;
s->decode_buffer_size = (s->width / s->vector_width) *
(s->height / s->vector_height) * 2;
s->decode_buffer = av_malloc(s->decode_buffer_size);
s->frame.data[0] = NULL;
return 0;
}
| 1threat |
static enum CodecID find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
{
const char *codec_string = encoder ? "encoder" : "decoder";
AVCodec *codec;
if(!name)
return CODEC_ID_NONE;
codec = encoder ?
avcodec_find_encoder_by_name(name) :
avcodec_find_decoder_by_name(name);
if(!codec) {
av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
exit_program(1);
}
if(codec->type != type) {
av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
exit_program(1);
}
return codec->id;
}
| 1threat |
error: expected ';', ',' or ') before numeric constant : <p>I am making a stack class, and trying to make an object of it and using it in another class. However, it mentions that there is an error.
here's my code of intializing the stack object in the class:</p>
<pre><code>class functions{
public:
int m[5];
int c=0;
stack_x mem(5);
</code></pre>
| 0debug |
How to implement RowMapper using java lambda expression : <p>I had a working RowMapper code that maps database table row in to a java object. I wanted to change the implementation using lambda expression. However, I am always getting error; Code snippet as follows;</p>
<pre><code>String queryString = "select * from person where person_id = ? ";
RowMapper rowMapper = (rs, rowNum) -> {
Person p = new Person();
p.setName(rs.getString("personName"));
p.setAddress(rs.getString("address"));
p.setAge(rs.getInt("age"));
}
Person person = getJdbcTemplate().query(queryString, personId, rowMapper);
return person;
</code></pre>
<p>Can someone help me to implement code correctly?
Any idea to get list of persons?</p>
| 0debug |
C - series of if statements vs else if time messuring : I am sorry beforehand if my terminology is lacking.
I wrote a code to demonstrate inefficiency of series of if statements vs else/if statements. And the results dont make any sense to me.
It's a simple algorithm that goes through an array (100000000 of elements) and counts occurrences of the elements, being 1,2,3,4,5 or else.
clock_t time1;
time1 = clock();
for (int i=1; i<=n; i++)
{
if (arr[i]==1)
p1++;
if (arr[i]==2)
p2++;
if (arr[i]==3)
p3++;
if (arr[i]==4)
p4++;
if (arr[i]==5)
p5++;
if (!(arr[i]>=1 && arr[i]<=5))
j++;
}
time1 = clock() - time1;
printf("count of 1s:\t %d\n",p1);
printf("count of 2s:\t %d\n",p2);
printf("count of 3s:\t %d\n",p3);
printf("count of 4s:\t %d\n",p4);
printf("count of 5s:\t %d\n",p5);
printf("count of errors:\t %d\n",j);
printf("\n --- counting took: %.10f ms---\n",((double)(time1)/CLOCKS_PER_SEC)*1000);
and then the same but with else if
clock_t time2;
time2 = clock();
for (int i=1; i<=n; i++)
{
if (arr[i]==1)
p1++;
else if (arr[i]==2)
p2++;
else if (arr[i]==3)
p3++;
else if (arr[i]==4)
p4++;
else if (arr[i]==5)
p5++;
else j++;
}
time2 = clock() - time2;
as expected when given an array of random values from 1 to 5 the else if is faster about two times
BUT (here comes the confusion) when its given an array of thousand 1s I would expect the if series to take the same amount of time bc it has to check every condition even tho the first one is already true - but it takes HALF the time
and when I give it array of only 5s it is also quicker.
Can anyone explain how it can be faster, please? - Thanks :/ (when I give it ran values from 4 to 5 it is actually takes about the same time as with values from 1 to 5)
[(here are the results of the whole thing [ignore the Czech please])][1]
[1]: https://i.stack.imgur.com/MfNY5.png | 0debug |
How to count how many times a word appears in a list in python : <p>I have the following list in python</p>
<pre><code>texts = [
["great", "even", "for", "the", "non", "runner", "this", "sound",
"track", "was", "brilliant"],
["cannot", "recommend", "as", "a", "former", "comrade", "i", "did",
"not", "want", "to", "have", "to", "do", "this"]
]
</code></pre>
<p>and I want to go through the list and count how often each word appears in it.</p>
<p>I have tried counting the individual words using <code>length()</code> and I get a <code>2</code> as a result which means it does not work.</p>
<p>Is there any way I can count how often a word appears in a list as I intend storing the counted word in a new list and it's frequency in another list.</p>
<p>Thanks in advance </p>
| 0debug |
void show_banner(void)
{
fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n",
program_name, program_birth_year, this_year);
fprintf(stderr, " built on %s %s with %s %s\n",
__DATE__, __TIME__, CC_TYPE, CC_VERSION);
fprintf(stderr, " configuration: " FFMPEG_CONFIGURATION "\n");
print_all_libs_info(stderr, INDENT|SHOW_CONFIG);
print_all_libs_info(stderr, INDENT|SHOW_VERSION);
}
| 1threat |
static const uint8_t *decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
int i, si, di;
uint8_t *dst;
int bufidx;
h->nal_ref_idc= src[0]>>5;
h->nal_unit_type= src[0]&0x1F;
src++; length--;
#if 0
for(i=0; i<length; i++)
printf("%2X ", src[i]);
#endif
for(i=0; i+1<length; i+=2){
if(src[i]) continue;
if(i>0 && src[i-1]==0) i--;
if(i+2<length && src[i+1]==0 && src[i+2]<=3){
if(src[i+2]!=3){
length=i;
}
break;
}
}
if(i>=length-1){
*dst_length= length;
*consumed= length+1;
return src;
}
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0;
h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length);
dst= h->rbsp_buffer[bufidx];
if (dst == NULL){
return NULL;
}
si=di=0;
while(si<length){
if(si+2<length && src[si]==0 && src[si+1]==0 && src[si+2]<=3){
if(src[si+2]==3){
dst[di++]= 0;
dst[di++]= 0;
si+=3;
continue;
}else
break;
}
dst[di++]= src[si++];
}
*dst_length= di;
*consumed= si + 1;
return dst;
}
| 1threat |
Copy multiple files from s3 bucket : <p>I am having trouble downloading multiple files from AWS S3 buckets to my local machine. </p>
<p>I have all the filenames that I want to download and I do not want others. How can I do that ? Is there any kind of loop in aws-cli I can do some iteration ?</p>
<p>There are couple hundreds files I need to download so that it seems not possible to use one single command that takes all filenames as arguments. </p>
| 0debug |
Docker: Looks something went wrong in step Looking for vboxmanage.exe : <p>I just installed Docker Toolbox on my windows 7 machine.
After installing I run the Docker Quickstart terminal which displays the following message:</p>
<p>Looks something went wrong in step nLooking for vboxmanage.exen... Press any key to continue....</p>
<p>Anyone here who knows how to solve this?</p>
<p>Regards,</p>
| 0debug |
Multithreading in C , Fİbonacci Program : I have newly started studying operating systems and creating processes/threads on Linux system by using C programming language(thats what is expected us to use) but I have some problems on the code that I've been trying to write:
Here is my code written on an Ubuntu system:
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
int total = 0;
typedef struct
{
int start;
int end;
int threadNo;
}THREAD_PARAMETERS;
void *work(void *parameters);
int threadCount;
int main(int argc, char* argv[])
{
printf("please give the number of terms you want to diplay..");
scanf("%d", &threadCount);
pthread_t tid[threadCount];
pthread_attr_t attr[threadCount];
THREAD_PARAMETERS* lpParameter;
int n;
lpParameter = malloc(sizeof(THREAD_PARAMETERS)* threadCount);
int i=0;
`
for(i=0; i<threadCount; i++)
{
lpParameter[i].start = 0;
lpParameter[i].end = 1;
lpParameter[i].threadNo = i + 1;
pthread_attr_init(&attr[i]);
pthread_create(&tid[i],&attr[i],work,&lpParameter[i]);
}
for(i=0; i<threadCount; i++)
{
pthread_join(tid[i],NULL);
}
return 1;
}
void fibonacci(int a)
{
int prev_term = 0, current_term = 1, next_term = 0;
if(a==0){
printf("%d\n",prev_term);
}
else if(a==1){
next_term=current_term+prev_term;
printf("%d\n",current_term);
prev_term=current_term;
current_term=next_term;
void *work(void * parameters)
{
THREAD_PARAMETERS* param = (THREAD_PARAMETERS*)parameters;
fibonacci(threadCount);
pthread_exit(0);
}
The problem is the program counts with the threadCount variable but what the program prints is just threadCount times zeros.
And the main question is how can I make each of the threads write "only one term" of the Fibonacci series depending on the number of terms (which is at the same time the number of threads) entered by the user? Is there any other more logical way to implement this kind of program?
Thanks in advance. | 0debug |
es6 spread operator - mongoose result copy : <p>I'm developping an express js API with mongo DB and mongoose.</p>
<p>I would like to create an object in Javascript es6 composed of few variables and the result of a mongoose request and want to do so with es6 spread operator :</p>
<pre><code>MyModel.findOne({_id: id}, (error, result) => {
if (!error) {
const newObject = {...result, toto: "toto"};
}
});
</code></pre>
<p>The problem is that applying a spread operator to <strong>result</strong> transform it in a wierd way:</p>
<pre><code>newObject: {
$__: {
$options: true,
activePaths: {...},
emitter: {...},
getters: {...},
...
_id: "edh5684dezd..."
}
$init: true,
isNew: false,
toto: "toto",
_doc: {
_id: "edh5684dezd...",
oneFieldOfMyModel: "tata",
anotherFieldOfMyModel: 42,
...
}
}
</code></pre>
<p>I kind of understand that the object result is enriched by mongoose to permit specific interactions with it but when I console.log before doing so it depict a simple object without all those things.</p>
<p>I would like not to cheat by doing <strong>...result._doc</strong> because I abstract this part and it won't fit that way. Maybe there is a way to copy an object without eriched stuff.</p>
<p>Thank you for your time.</p>
| 0debug |
Converting RDD[Long, String, Long] to sql.DataFrame : <p>I have RDD[Long, String, Long] and i want to convert it to sql.DataFrame in order to execute spark sql on the data.</p>
<p>Any insights?</p>
| 0debug |
SQLite Database: Is there a way to put same data into 2 tables? : So this is the code for my database
[First Photo][1]
[2nd Photo][2]
I tried making my first insert of data to be in the same tables but after i inserted the data, only the 1st table is being updated. And I also want to add 2 more rows to be used later in the 2nd table
[1]: https://i.stack.imgur.com/WSE2N.png
[2]: https://i.stack.imgur.com/dwhJi.png | 0debug |
how to render/generate Dynamic HTML content in angular application . : Please help me .
Situation : I am new to Angular and knows mostly theory concepts .
Objective : Need to create a web based application with .net and angular perhaps angular version 2,4 or whatever. the angular app html page is dynamic is nature. For example, based on specific user’s login , the html may shows ’n’ number of say Tab controls in panel and even the display ordering of tab on the html page would be different per user based on db saved values. this configuration of tab controls plus other controls like textboxes etc. would come from Database via an seperate .net application on which user can config that for his/her angular website h**e may choose ’n’ tab controls along with there** **display order** so **everything would be dynamic like tab controls, there child data pages** etc.
Someone told me that it can be done via Pipes but still I am not getting much of clue how to implement this. kindly share me some link or provide me some clue.
Kindly help | 0debug |
postgres and docker-compose : can't create a custom role and database : <p>I'am trying to create a simple postgreSQL container with a custum user and database. </p>
<p>This is my docker-compose file : </p>
<pre><code>version: '2'
services:
db.postgres:
container_name: db.postgres
image: postgres:10
environment:
- POSTGRES_USER:'myuser'
- POSTGRES_PASSWORD:'myuserpassword'
- POSTGRES_DB:'mydb'
ports:
- '5432:5432'
volumes:
- ./pgdata:/var/lib/postgresql/data
</code></pre>
<p>And the error when I try to connect to my database. </p>
<pre><code>docker exec -it db.postgres psql -U myuser myuserpassword
psql: FATAL: role "myuser" does not exist
</code></pre>
<p>OR</p>
<pre><code>$ docker exec -it db.postgres /bin/bash
root@1a0531e0350f:/# psql -U myuser
psql: FATAL: role "myuser" does not exist
</code></pre>
<p>Docker-compose environment variables appear to be ignored when creating the database.</p>
<p>I don't known what can I do. Do you have an idea of the problem?</p>
<p>Thanks ! </p>
| 0debug |
static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
{
TLSContext *c = h->priv_data;
TLSShared *s = &c->tls_shared;
int ret;
if ((ret = ff_tls_open_underlying(s, h, uri, options)) < 0)
goto fail;
c->ssl_context = SSLCreateContext(NULL, s->listen ? kSSLServerSide : kSSLClientSide, kSSLStreamType);
if (!c->ssl_context) {
av_log(h, AV_LOG_ERROR, "Unable to create SSL context\n");
ret = AVERROR(ENOMEM);
goto fail;
}
if (s->ca_file) {
if ((ret = load_ca(h)) < 0)
goto fail;
CHECK_ERROR(SSLSetSessionOption, c->ssl_context, kSSLSessionOptionBreakOnServerAuth, true);
}
if (s->cert_file)
if ((ret = load_cert(h)) < 0)
goto fail;
if (s->verify)
CHECK_ERROR(SSLSetPeerDomainName, c->ssl_context, s->host, strlen(s->host));
CHECK_ERROR(SSLSetIOFuncs, c->ssl_context, tls_read_cb, tls_write_cb);
CHECK_ERROR(SSLSetConnection, c->ssl_context, h);
while (1) {
OSStatus status = SSLHandshake(c->ssl_context);
if (status == errSSLServerAuthCompleted) {
SecTrustRef peerTrust;
SecTrustResultType trustResult;
if (!s->verify)
continue;
if (SSLCopyPeerTrust(c->ssl_context, &peerTrust) != noErr) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (SecTrustSetAnchorCertificates(peerTrust, c->ca_array) != noErr) {
ret = AVERROR_UNKNOWN;
goto fail;
}
if (SecTrustEvaluate(peerTrust, &trustResult) != noErr) {
ret = AVERROR_UNKNOWN;
goto fail;
}
if (trustResult == kSecTrustResultProceed ||
trustResult == kSecTrustResultUnspecified) {
status = errSSLWouldBlock;
} else if (trustResult == kSecTrustResultRecoverableTrustFailure) {
status = errSSLXCertChainInvalid;
} else {
status = errSSLBadCert;
}
if (peerTrust)
CFRelease(peerTrust);
}
if (status == noErr)
break;
av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session: %i\n", (int)status);
ret = AVERROR(EIO);
goto fail;
}
return 0;
fail:
tls_close(h);
return ret;
}
| 1threat |
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
{
if(st->request_probe>0){
AVProbeData *pd = &st->probe_data;
int end;
av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->probe_packets);
--st->probe_packets;
if (pkt) {
pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
pd->buf_size += pkt->size;
memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
} else {
st->probe_packets = 0;
}
end= s->raw_packet_buffer_remaining_size <= 0
|| st->probe_packets<=0;
if(end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
int score= set_codec_from_probe_data(s, st, pd);
if( (st->codec->codec_id != CODEC_ID_NONE && score > AVPROBE_SCORE_MAX/4)
|| end){
pd->buf_size=0;
av_freep(&pd->buf);
st->request_probe= -1;
if(st->codec->codec_id != CODEC_ID_NONE){
av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
}else
av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index);
}
}
}
}
| 1threat |
How to run a PowerShell script with verbose output? : <p>I'm wondering if there's a way to run a PowerShell script such that both the commands and the output of each line of the script are printed. For example, in Bash you would write <code>bash -x myscript</code> or place a <code>set -x</code> at the top of your script. In Batch, you would omit the <code>@echo off</code> traditionally left at the top of your script. Does PowerShell have an equivalent of these constructs?</p>
<p><strong>Things I've tried:</strong> Running <code>powershell -? | sls verbose</code>, which turned up nothing.</p>
| 0debug |
What is the difference between using 'this' keyword and var in a constructor function in JavaScript? : <p>I'm learning object concepts in JavaScript and have this doubt. Here is the link to the Bin <a href="http://jsbin.com/yoyepetewa/edit?js,console" rel="nofollow noreferrer">http://jsbin.com/yoyepetewa/edit?js,console</a></p>
<pre><code>function Obj() {
//using 'this' and var produces the same result
//this.x = 1;
var x = 1;
}
var a = new Obj();
var b = new Obj();
a.x = 2;
b.x = 3;
console.log(`a's x = ${a.x}`);
console.log(`b's x = ${b.x}`);
</code></pre>
| 0debug |
Cloundant : Error with running weatherreport to check cluster health : We have three node cluster setup and facing issue to run weather report command.
By looking at error, it is clear that machine from where weatherreport utility is running not able to connect to other two machines. I have checked all machines and they are accessible using fqdn. But from message it looks like it is using shortname while connecting to peer machine. So how to check from where it is taking peer machine names? So I can give a try to change them to full machine name and that might work for me. if there is any other solution then let us know.
Error is coming as
['cloudant_diag17506@machine2031.domain.com'] [crit] Could not run check weatherreport_check_safe_to_rebuild on cluster node 'cloudant@machine2031'
['cloudant_diag17506@machine2031.domain.com'] [crit] Could not run check weatherreport_check_safe_to_rebuild on cluster node 'cloudant@machine2032'
['cloudant_diag17506@machine2031.domain.com'] [crit] Could not run check weatherreport_check_safe_to_rebuild on cluster node 'cloudant@machine2033'
['cloudant@machine2032.domain.com'] [crit] Rebuilding this node will leave the following shard with NO live copies: default/t_alpha e0000000-ffffffff, default/t_alpha a0000000-bfffffff, default/t_alpha 60000000-7fffffff, default/t_alpha 20000000-3fffffff, default/metrics_app e0000000-ffffffff, default/metrics_app a0000000-bfffffff, default/metrics_app 60000000-7fffffff, default/metrics_app 20000000-3fffffff
| 0debug |
How to show results of a map in two or more columns using react : <p>I think I have a simple question, but I can't get a solution to do this with react, I would like show results in two columns like:</p>
<pre><code>item 1 | item 4
item 2 | item 5
item 3 | item 6
</code></pre>
<p>I tried verify if array lenght is 0 or new start column, but I can't draw a start div element without draw the end div element</p>
<p>I would like to do something like this:</p>
<pre><code>render() {
const secondColumnStart = this.props.result.length / 2;
return <div className="row">
{this.props.result.map((item, i) =>
{ (i == 0 || i == secondColumnStart) && <div className="col-md-6"> }
item.value
{ (i == 0 || i == secondColumnStart) && </div> })}
</div>;
}
</code></pre>
| 0debug |
ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value : <p>So i've recently completed an application for a study project. It's all good, and all I have left is putting the application to production.</p>
<p>I'm using MySQL with Node.js(I know, we don't like that, but someone's gotta try it). I have a socket that adds a chat message to the mysql Message Table, which contains the text, date time etc. The date time is set to <code>new Date()</code>.</p>
<p>Now as I placed the application in a production server(reinstalling dependencies, mysql etc.), I suddenly get this error when I write messages:</p>
<pre><code>Error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2017-06-01T09:45:06.253Z' for column 'message_datetime' at row 1
</code></pre>
<p>I did not get that error in development, so I asked myself if I downloaded different versions of mysql... and I did:</p>
<p><strong>Development:</strong></p>
<pre><code>mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (i686) using readline 6.3
</code></pre>
<p><strong>Production</strong></p>
<p><code>mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper</code></p>
<p>and the message table looks like this:</p>
<p><code>CREATE TABLE message (
message_id INT AUTO_INCREMENT,
message_sender_id VARCHAR(80) NOT NULL,
message_datetime DATETIME,
message_text TEXT,
message_chat_id INT NOT NULL,
PRIMARY KEY(message_id),
FOREIGN KEY(message_chat_id) REFERENCES chat(id)
ON DELETE CASCADE
) ENGINE=InnoDB;</code></p>
<p>So what are the differences? Why is <code>'yyyy-mm-ddThh:mm:ss.%%%Z'</code> suddenly not a valid date format? How do I fix this? </p>
<p>Thankful for any help!</p>
| 0debug |
static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
{
if (!ac->oc[1].m4ac.chan_config) {
return ac->tag_che_map[type][elem_id];
}
if (!ac->tags_mapped && type == TYPE_CPE && ac->oc[1].m4ac.chan_config == 1) {
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
push_output_configuration(ac);
if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
2) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
2, OC_TRIAL_FRAME) < 0)
return NULL;
ac->oc[1].m4ac.chan_config = 2;
}
if (!ac->tags_mapped && type == TYPE_SCE && ac->oc[1].m4ac.chan_config == 2 && 0) {
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
push_output_configuration(ac);
av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
1) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
1, OC_TRIAL_FRAME) < 0)
return NULL;
ac->oc[1].m4ac.chan_config = 1;
}
switch (ac->oc[1].m4ac.chan_config) {
case 7:
if (ac->tags_mapped == 3 && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
}
case 6:
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
ac->tags_mapped++;
return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
}
case 5:
if (ac->tags_mapped == 2 && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
}
case 4:
if (ac->tags_mapped == 2 && ac->oc[1].m4ac.chan_config == 4 && type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
}
case 3:
case 2:
if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) && type == TYPE_CPE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
} else if (ac->oc[1].m4ac.chan_config == 2) {
return NULL;
}
case 1:
if (!ac->tags_mapped && type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
}
default:
return NULL;
}
} | 1threat |
Parsing JSON object from String in Android : I am trying to parse the json object from the data at the end of the post using the following code but I seem to have problem converting the intial string to JSON and also extracting JSON object in the key values of "feed" and "entry".
protected void JSONparse(String result) {
//parse JSON data
try {
JSONObject reader = new JSONObject(result);
JSONObject head = reader.getJSONObject("feed").getJSONObject("entry").getJSONObject(result);
JSONArray jArray = new JSONArray(head);
for(int i=0; i < jArray.length(); i++) {
JSONObject jObject = jArray.getJSONObject(i);
String name = jObject.getString("name");
String location = jObject.getString("location");
String contact = jObject.getString("contact");
Toast toast = Toast.makeText(this, name+" "+location+" "+contact, Toast.LENGTH_SHORT);
toast.show();
} // End Loop
} catch (JSONException e) {
Log.e("JSONException", "Error: " + e.toString());
} // catch (JSONException e)
}
Data String:
{"version":"1.0","encoding":"UTF-8",
"feed":
{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended","id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],
"title":{"type":"text","$t":"Sheet1"},"link":[{"rel":"alternate","type":"application/atom+xml","href":"https://docs.google.com/spreadsheets/d/"key"/pubhtml"},{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values"},{"rel":"http://schemas.google.com/g/2005#post","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values"},
{"rel":"self","type":"application/atom+xml",
"href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values?alt\u003djson"}],
"author":[{"name":{"$t":"appsmedion"},"email":{"$t":"appsmedion@gmail.com"}}],"openSearch$totalResults":{"$t":"6"},"openSearch$startIndex":{"$t":"1"},
"entry":
[{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cokwr"},
"updated":{"$t":"2018-09-17T01:06:22.497Z"},
"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006",
"term":"http://schemas.google.com/spreadsheets/2006#list"}],
"title":{"type":"text","$t":"Chris knight "},
"content":{"type":"text","$t":"location: Crows Nest NSW, type: dji, contact: na"},
"link":[{"rel":"self","type":"application/atom+xml",
"href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cokwr"}],"gsx$name":{"$t":"Chris knight "},"gsx$location":{"$t":"Crows Nest NSW"},"gsx$type":{"$t":"dji"},
"gsx$contact":{"$t":"na"}},{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cpzh4"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"Shayne Johnston"},"content":{"type":"text","$t":"location: Hay Nsw , type: dji, contact: 466863944"},"link":[{"rel":"self","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cpzh4"}],"gsx$name":{"$t":"Shayne Johnston"},"gsx$location":{"$t":"Hay Nsw "},"gsx$type":{"$t":"dji"},"gsx$contact":{"$t":"466863944"}},{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cre1l"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"Edward Morris"},"content":{"type":"text","$t":"location: Alkimos WA, type: dji, contact: edwardcmorris@yahoo.com.au"},"link":[{"rel":"self","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/cre1l"}],"gsx$name":{"$t":"Edward Morris"},"gsx$location":{"$t":"Alkimos WA"},"gsx$type":{"$t":"dji"},"gsx$contact":{"$t":"edwardcmorris@yahoo.com.au"}},{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/chk2m"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"Andy"},"content":{"type":"text","$t":"location: Wellington St Mulgrave VIC, type: dji, contact: 413556955"},"link":[{"rel":"self","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/chk2m"}],"gsx$name":{"$t":"Andy"},"gsx$location":{"$t":"Wellington St Mulgrave VIC"},"gsx$type":{"$t":"dji"},"gsx$contact":{"$t":"413556955"}},{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/ciyn3"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"Cody"},"content":{"type":"text","$t":"location: Alice Spring NT, type: parrot, contact: 412222222"},"link":[{"rel":"self","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/ciyn3"}],"gsx$name":{"$t":"Cody"},"gsx$location":{"$t":"Alice Spring NT"},"gsx$type":{"$t":"parrot"},"gsx$contact":{"$t":"412222222"}},{"id":{"$t":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/ckd7g"},"updated":{"$t":"2018-09-17T01:06:22.497Z"},"category":[{"scheme":"http://schemas.google.com/spreadsheets/2006","term":"http://schemas.google.com/spreadsheets/2006#list"}],"title":{"type":"text","$t":"Anthony "},"content":{"type":"text","$t":"location: Bundaberg , type: dji, contact: anthonycarrick1978@yahoo.com.au"},"link":[{"rel":"self","type":"application/atom+xml","href":"https://spreadsheets.google.com/feeds/list/"key"/od6/public/values/ckd7g"}],"gsx$name":{"$t":"Anthony "},"gsx$location":{"$t":"Bundaberg "},"gsx$type":{"$t":"dji"},"gsx$contact":{"$t":"anthonycarrick1978@yahoo.com.au"}}]}}
| 0debug |
static void raw_reopen_abort(BDRVReopenState *state)
{
g_free(state->opaque);
state->opaque = NULL;
}
| 1threat |
int page_check_range(target_ulong start, target_ulong len, int flags)
{
PageDesc *p;
target_ulong end;
target_ulong addr;
if (start + len < start)
return -1;
end = TARGET_PAGE_ALIGN(start+len);
start = start & TARGET_PAGE_MASK;
for(addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
p = page_find(addr >> TARGET_PAGE_BITS);
if( !p )
return -1;
if( !(p->flags & PAGE_VALID) )
return -1;
if ((flags & PAGE_READ) && !(p->flags & PAGE_READ))
return -1;
if (flags & PAGE_WRITE) {
if (!(p->flags & PAGE_WRITE_ORG))
return -1;
if (!(p->flags & PAGE_WRITE)) {
if (!page_unprotect(addr, 0, NULL))
return -1;
}
return 0;
}
}
return 0;
}
| 1threat |
suming two coloumns together (each cell separately) : Im using excel and ive just started using vba in excel.
I need to add the values of column I, cells I6:I26 in sheet 1 to column D, cells D1:D21 in sheet 2.
So if I6 = 4 and D1 = 6, and I press the ADD button, D6 will equal to 10. Same goes for the rest of the cells.
I don't want it cell I6 to replace the value of D6, I want it to add to it.
This is the code I have so far for it;
Dim r1 as Range, v as variant
Set r1 = Sheets("Sheet2"). Range("D1")
V = Application.WorksheetFunction.Sum(Sheet1.Range("I6"), Sheet2.Range("D1"))
R1 = v
I had to do that 20 times..is there anyway to simply this? | 0debug |
static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
{
VirtioPCIClass *vpciklass = VIRTIO_PCI_GET_CLASS(qdev);
VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev);
PCIDevice *pci_dev = &proxy->pci_dev;
if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_PCIE) &&
!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN)) {
pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
}
vpciklass->parent_dc_realize(qdev, errp);
}
| 1threat |
Difference between frontend/backend and listen in haproxy : <p>Hopefully a simple question. I apologize if this has been covered before. I'm learning haproxy and overall seems very straightforward and simple. However I am curious what the difference is between using frontend/backend and listen config blocks? My assumption is that listen is just simpler, for basic configurations, while frontend/backend is more advanced, allowing you to dynamically switch backends or share backends, etc. Is that it in a nutshell?</p>
<p>Thanks,</p>
<p>Al</p>
| 0debug |
qio_channel_websock_source_prepare(GSource *source,
gint *timeout)
{
QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source;
GIOCondition cond = 0;
*timeout = -1;
if (wsource->wioc->rawinput.offset) {
cond |= G_IO_IN;
}
if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
cond |= G_IO_OUT;
}
return cond & wsource->condition;
}
| 1threat |
Leaflet.js: Use ctrl + scroll to zoom the map & Move map with two fingers on mobile : <p>I'm using <a href="http://leafletjs.com/" rel="noreferrer">http://leafletjs.com/</a> ... is it possible to only: </p>
<ol>
<li><p>Use ctrl + scroll to zoom the map </p></li>
<li><p>Move map with two fingers on mobile/tablet</p></li>
</ol>
<p>... so similar what google maps does? With the comments ...</p>
<p>So far thats my setup:</p>
<pre><code>// Leaflet Maps
var contactmap = L.map('contact-map', {
center: [41.3947688, 2.0787279],
zoom: 15,
scrollWheelZoom: false
});
</code></pre>
| 0debug |
static int RENAME(epzs_motion_search)(MpegEncContext * s,
int *mx_ptr, int *my_ptr,
int P[10][2], int pred_x, int pred_y, uint8_t *src_data[3],
uint8_t *ref_data[3], int stride, int uvstride, int16_t (*last_mv)[2],
int ref_mv_scale, uint8_t * const mv_penalty)
{
int best[2]={0, 0};
int d, dmin;
const int shift= 1+s->quarter_sample;
uint32_t *map= s->me.map;
int map_generation;
const int penalty_factor= s->me.penalty_factor;
const int size=0;
const int h=16;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmp, chroma_cmp;
LOAD_COMMON
cmp= s->dsp.me_cmp[size];
chroma_cmp= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(s);
CMP(dmin, 0, 0, size);
map[0]= map_generation;
score_map[0]= dmin;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<256 && ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
s->me.skip=1;
return dmin;
}
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
if(dmin>256*2){
CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
}
if(dmin>256*4){
if(s->me.pre_pass){
CHECK_CLIPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->end_mb_y == s->mb_height || s->mb_y+1<s->end_mb_y)
CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(s->avctx->last_predictor_count){
const int count= s->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
if(s->me.dia_size==-1)
dmin= RENAME(funny_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride,
pred_x, pred_y, penalty_factor,
shift, map, map_generation, size, h, mv_penalty);
else if(s->me.dia_size<-1)
dmin= RENAME(sab_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride,
pred_x, pred_y, penalty_factor,
shift, map, map_generation, size, h, mv_penalty);
else if(s->me.dia_size<2)
dmin= RENAME(small_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride,
pred_x, pred_y, penalty_factor,
shift, map, map_generation, size, h, mv_penalty);
else
dmin= RENAME(var_diamond_search)(s, best, dmin, src_data, ref_data, stride, uvstride,
pred_x, pred_y, penalty_factor,
shift, map, map_generation, size, h, mv_penalty);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
| 1threat |
static void add_xblock(DWTELEM *dst, uint8_t *src, uint8_t *obmc, int s_x, int s_y, int b_w, int b_h, int mv_x, int mv_y, int w, int h, int dst_stride, int src_stride, int obmc_stride, int mb_type, int add){
uint8_t tmp[src_stride*(b_h+5)];
int x,y;
if(s_x<0){
obmc -= s_x;
b_w += s_x;
s_x=0;
}else if(s_x + b_w > w){
b_w = w - s_x;
}
if(s_y<0){
obmc -= s_y*obmc_stride;
b_h += s_y;
s_y=0;
}else if(s_y + b_h> h){
b_h = h - s_y;
}
if(b_w<=0 || b_h<=0) return;
dst += s_x + s_y*dst_stride;
if(mb_type==1){
src += s_x + s_y*src_stride;
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
if(add) dst[x + y*dst_stride] += obmc[x + y*obmc_stride] * 128 * (256/OBMC_MAX);
else dst[x + y*dst_stride] -= obmc[x + y*obmc_stride] * 128 * (256/OBMC_MAX);
}
}
}else{
int dx= mv_x&15;
int dy= mv_y&15;
s_x += (mv_x>>4) - 2;
s_y += (mv_y>>4) - 2;
src += s_x + s_y*src_stride;
if( (unsigned)s_x >= w - b_w - 4
|| (unsigned)s_y >= h - b_h - 4){
ff_emulated_edge_mc(tmp + 32, src, src_stride, b_w+5, b_h+5, s_x, s_y, w, h);
src= tmp + 32;
}
if(mb_type==0){
mc_block(tmp, src, tmp + 64+8, src_stride, b_w, b_h, dx, dy);
}else{
int sum=0;
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
sum += src[x+ y*src_stride];
}
}
sum= (sum + b_h*b_w/2) / (b_h*b_w);
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
tmp[x + y*src_stride]= sum;
}
}
}
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
if(add) dst[x + y*dst_stride] += obmc[x + y*obmc_stride] * tmp[x + y*src_stride] * (256/OBMC_MAX);
else dst[x + y*dst_stride] -= obmc[x + y*obmc_stride] * tmp[x + y*src_stride] * (256/OBMC_MAX);
}
}
}
}
| 1threat |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
static void dec_pattern(DisasContext *dc)
{
unsigned int mode;
int l1;
if ((dc->tb_flags & MSR_EE_FLAG)
&& !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)
&& !((dc->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {
tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);
t_gen_raise_exception(dc, EXCP_HW_EXCP);
}
mode = dc->opcode & 3;
switch (mode) {
case 0:
LOG_DIS("pcmpbf r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd)
gen_helper_pcmpbf(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]);
break;
case 2:
LOG_DIS("pcmpeq r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
l1 = gen_new_label();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_EQ,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
case 3:
LOG_DIS("pcmpne r%d r%d r%d\n", dc->rd, dc->ra, dc->rb);
l1 = gen_new_label();
if (dc->rd) {
TCGv t0 = tcg_temp_local_new();
tcg_gen_movi_tl(t0, 1);
tcg_gen_brcond_tl(TCG_COND_NE,
cpu_R[dc->ra], cpu_R[dc->rb], l1);
tcg_gen_movi_tl(t0, 0);
gen_set_label(l1);
tcg_gen_mov_tl(cpu_R[dc->rd], t0);
tcg_temp_free(t0);
}
break;
default:
cpu_abort(dc->env,
"unsupported pattern insn opcode=%x\n", dc->opcode);
break;
}
}
| 1threat |
ASP.NET Core WebAPI default route not working : <p>I've followed several examples suggesting that to set my default route in an ASP.NET Core WebAPI project, I need to replace</p>
<pre><code>app.UseMvc();
</code></pre>
<p>with</p>
<pre><code>app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}",
defaults: new { controller = "Traders", action = "Get" });
});
</code></pre>
<p>But when I run it defaults to <code>localhost:54321/api/values</code> and it should default to <code>localhost:54321/Traders</code></p>
<p>What's wrong?</p>
| 0debug |
static int pci_ich9_ahci_init(PCIDevice *dev)
{
struct AHCIPCIState *d;
d = DO_UPCAST(struct AHCIPCIState, card, dev);
pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_82801IR);
pci_config_set_class(d->card.config, PCI_CLASS_STORAGE_SATA);
pci_config_set_revision(d->card.config, 0x02);
pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);
d->card.config[PCI_CACHE_LINE_SIZE] = 0x08;
d->card.config[PCI_LATENCY_TIMER] = 0x00;
pci_config_set_interrupt_pin(d->card.config, 1);
d->card.config[0x90] = 1 << 6;
qemu_register_reset(ahci_reset, d);
pci_register_bar_simple(&d->card, 5, 0x1000, 0, d->ahci.mem);
msi_init(dev, 0x50, 1, true, false);
ahci_init(&d->ahci, &dev->qdev, 6);
d->ahci.irq = d->card.irq[0];
return 0;
}
| 1threat |
what's wrong with my return statement and static method : <p>This is not a homework question. It is one of my practices. Please help me understand where i did wrong. The original was static void changeArray, but i changed it to static int changeArray and inserted a return statement at the end, but it still won't update the main code. </p>
<p>public class testing{</p>
<pre><code>/*
* Change the method to also update the key at the main
*/
static int changeArray(int key, int array[]){
key = key + 7;
for (int i = 0; i < array.length; i++){
array[i] = array[i] + key;
}
System.out.println("*At changeArray *");
System.out.println("The key is: "+ key);
return key;
}
static void printArray(int array[]){
System.out.print("[ ");
for (int element:array){
System.out.print(element + " ");
}
System.out.println("]");
}
public static void main(String[] args){
int key = 5;
int[] array = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
System.out.println("*At the main *");
System.out.println("The key is: "+ key);
printArray(array);
changeArray(key, array);
System.out.println("*At the main *");
System.out.println("The key is: "+ key); <--- (this is supposed to be 12 after the method is called, but it keeps printing out 5)
printArray(array);
}
</code></pre>
<p>}</p>
| 0debug |
static void virtio_blk_rw_complete(void *opaque, int ret)
{
VirtIOBlockReq *req = opaque;
trace_virtio_blk_rw_complete(req, ret);
if (ret) {
int p = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type);
bool is_read = !(p & VIRTIO_BLK_T_OUT);
if (virtio_blk_handle_rw_error(req, -ret, is_read))
return;
}
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
block_acct_done(bdrv_get_stats(req->dev->bs), &req->acct);
virtio_blk_free_request(req);
}
| 1threat |
How to return from a forEach loop in Dart? : <p>I have this function</p>
<pre><code> bool nameExists(players, player) {
players.forEach((f) {
if (f.data['name'].toLowerCase() == player.toLowerCase()) {
return true;
}
});
return false;
}
</code></pre>
<p>It always return false, even if the condition is satisfied.</p>
<p>Any ideas?</p>
| 0debug |
static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
const uint8_t *buf, int buf_size,
int first_field)
{
static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
static const uint8_t header_prefixhr1[] = { 0x00, 0x00, 0x02, 0x80, 0x03 };
static const uint8_t header_prefixhr2[] = { 0x00, 0x00, 0x03, 0x8C, 0x03 };
int i, cid, ret;
int old_bit_depth = ctx->bit_depth, bitdepth;
int old_mb_height = ctx->mb_height;
if (buf_size < 0x280) {
av_log(ctx->avctx, AV_LOG_ERROR,
"buffer too small (%d < 640).\n", buf_size);
return AVERROR_INVALIDDATA;
}
if (memcmp(buf, header_prefix, 5) && memcmp(buf, header_prefix444, 5) &&
memcmp(buf, header_prefixhr1, 5) && memcmp(buf, header_prefixhr2, 5)) {
av_log(ctx->avctx, AV_LOG_ERROR,
"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
buf[0], buf[1], buf[2], buf[3], buf[4]);
return AVERROR_INVALIDDATA;
}
if (buf[5] & 2) {
ctx->cur_field = buf[5] & 1;
frame->interlaced_frame = 1;
frame->top_field_first = first_field ^ ctx->cur_field;
av_log(ctx->avctx, AV_LOG_DEBUG,
"interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
} else {
ctx->cur_field = 0;
}
ctx->mbaff = (buf[0x6] >> 5) & 1;
ctx->height = AV_RB16(buf + 0x18);
ctx->width = AV_RB16(buf + 0x1a);
switch(buf[0x21] >> 5) {
case 1: bitdepth = 8; break;
case 2: bitdepth = 10; break;
case 3: bitdepth = 12; break;
default:
av_log(ctx->avctx, AV_LOG_ERROR,
"Unknown bitdepth indicator (%d)\n", buf[0x21] >> 5);
return AVERROR_INVALIDDATA;
}
cid = AV_RB32(buf + 0x28);
if ((ret = dnxhd_init_vlc(ctx, cid, bitdepth)) < 0)
return ret;
if (ctx->mbaff && ctx->cid_table->cid != 1260)
av_log(ctx->avctx, AV_LOG_WARNING,
"Adaptive MB interlace flag in an unsupported profile.\n");
ctx->act = buf[0x2C] & 7;
if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)
av_log(ctx->avctx, AV_LOG_WARNING,
"Adaptive color transform in an unsupported profile.\n");
ctx->is_444 = (buf[0x2C] >> 6) & 1;
if (ctx->is_444) {
if (bitdepth == 8) {
avpriv_request_sample(ctx->avctx, "4:4:4 8 bits\n");
return AVERROR_INVALIDDATA;
} else if (bitdepth == 10) {
ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P10
: AV_PIX_FMT_GBRP10;
} else {
ctx->decode_dct_block = dnxhd_decode_dct_block_12_444;
ctx->pix_fmt = ctx->act ? AV_PIX_FMT_YUV444P12
: AV_PIX_FMT_GBRP12;
}
} else if (bitdepth == 12) {
ctx->decode_dct_block = dnxhd_decode_dct_block_12;
ctx->pix_fmt = AV_PIX_FMT_YUV422P12;
} else if (bitdepth == 10) {
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
} else {
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
}
ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;
if (ctx->bit_depth != old_bit_depth) {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
ff_zigzag_direct);
}
if (ctx->width != ctx->cid_table->width &&
ctx->cid_table->width != DNXHD_VARIABLE) {
av_reduce(&ctx->avctx->sample_aspect_ratio.num,
&ctx->avctx->sample_aspect_ratio.den,
ctx->width, ctx->cid_table->width, 255);
ctx->width = ctx->cid_table->width;
}
if (buf_size < ctx->cid_table->coding_unit_size) {
av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size (%d < %d).\n",
buf_size, ctx->cid_table->coding_unit_size);
return AVERROR_INVALIDDATA;
}
ctx->mb_width = (ctx->width + 15)>> 4;
ctx->mb_height = buf[0x16d];
if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)
ctx->height <<= 1;
av_log(ctx->avctx, AV_LOG_VERBOSE, "%dx%d, 4:%s %d bits, MBAFF=%d ACT=%d\n",
ctx->width, ctx->height, ctx->is_444 ? "4:4" : "2:2",
ctx->bit_depth, ctx->mbaff, ctx->act);
if (!memcmp(buf, header_prefixhr2, 5)) {
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
} else {
if (ctx->mb_height > 68 ||
(ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
av_log(ctx->avctx, AV_LOG_ERROR,
"mb height too big: %d\n", ctx->mb_height);
return AVERROR_INVALIDDATA;
}
ctx->data_offset = 0x280;
}
if (buf_size < ctx->data_offset) {
av_log(ctx->avctx, AV_LOG_ERROR,
"buffer too small (%d < %d).\n", buf_size, ctx->data_offset);
return AVERROR_INVALIDDATA;
}
if (ctx->mb_height != old_mb_height) {
av_freep(&ctx->mb_scan_index);
ctx->mb_scan_index = av_mallocz_array(ctx->mb_height, sizeof(uint32_t));
if (!ctx->mb_scan_index)
return AVERROR(ENOMEM);
}
for (i = 0; i < ctx->mb_height; i++) {
ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
ff_dlog(ctx->avctx, "mb scan index %d, pos %d: %u\n", i, 0x170 + (i << 2), ctx->mb_scan_index[i]);
if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {
av_log(ctx->avctx, AV_LOG_ERROR,
"invalid mb scan index (%u vs %u).\n",
ctx->mb_scan_index[i], buf_size - ctx->data_offset);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| 1threat |
Regular Expression for Simple Maths Equation parser in Java : <p>Currently learning Java, and trying to parse a maths equation for valid inputs:</p>
<p>For example, the user has to input integers in the form:</p>
<p>Operand Operator Operand</p>
<p>in that specific order, and the program would then need to be able to tell if the inputs were in that form, and then work out the simple equation.</p>
<p>An example would be:</p>
<p>4 * 8 which the result would give as 32</p>
<p>the program would also reject something like 45.6 * 0.3, or 45 + 3 / 4</p>
<p>For this to work, do I have to use regular expression, or some other method of if loops?</p>
| 0debug |
Angular universal redering only css and no html : I have an angular universal project up and running and it work correctly but in the page source of the browser I only see CSS outputted and no HTML. Am I missing something? | 0debug |
void usb_attach(USBPort *port, USBDevice *dev)
{
if (dev != NULL) {
if (port->dev) {
usb_attach(port, NULL);
}
dev->port = port;
port->dev = dev;
port->ops->attach(port);
usb_send_msg(dev, USB_MSG_ATTACH);
} else {
dev = port->dev;
port->ops->detach(port);
if (dev) {
usb_send_msg(dev, USB_MSG_DETACH);
dev->port = NULL;
port->dev = NULL;
}
}
}
| 1threat |
CUDA run solution with three.cu files : I have CUDA 8 and Visual Studio 2015.
I would to run three cuda files from "CUDA by example" book (example is histogram).
I have three cu. files:
hist_cpu.cu
hist_gpu_gmem_atomics.cu
hist_gpu_shmem_atomics.cu
I would to run it at the same time. All three files include "book.h".
How to compile it and show results from three files on one output? It is possible? | 0debug |
Why this InputStreamReader throws an exception : <p>When I compile this code in eclipse ,it throws a NullPointerException,but the code in the book is written in this way.Here is this code.</p>
<pre><code> InputStream in = ClassLoader
.getSystemResourceAsStream("javagames/filesandres/Test1.txt");
try {
InputStreamReader reader =new InputStreamReader(in);
BufferedReader buf = new BufferedReader(reader);
String line = null;
while ((line = buf.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (Exception e) {
}
}
}
</code></pre>
| 0debug |
How to check if ur form is already opned or not and close it : I have a form named as outobjects.cs it can luanch every 5 mins, So after I can luanch any of them I need to check if outobjects.cs open or not and close it. | 0debug |
static void setup_rt_frame(int sig, struct target_sigaction *ka,
target_siginfo_t *info,
target_sigset_t *set, CPUSH4State *regs)
{
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
int i;
int err = 0;
int signal;
frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
goto give_sigsegv;
signal = current_exec_domain_sig(sig);
err |= copy_siginfo_to_user(&frame->info, info);
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, (unsigned long *)&frame->uc.tuc_link);
__put_user((unsigned long)target_sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(regs->gregs[15]),
&frame->uc.tuc_stack.ss_flags);
__put_user(target_sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->uc.tuc_mcontext,
regs, set->sig[0]);
for(i = 0; i < TARGET_NSIG_WORDS; i++) {
__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
}
if (ka->sa_flags & TARGET_SA_RESTORER) {
regs->pr = (unsigned long) ka->sa_restorer;
} else {
__put_user(MOVW(2), &frame->retcode[0]);
__put_user(TRAP_NOARG, &frame->retcode[1]);
__put_user((TARGET_NR_rt_sigreturn), &frame->retcode[2]);
regs->pr = (unsigned long) frame->retcode;
}
if (err)
goto give_sigsegv;
regs->gregs[15] = frame_addr;
regs->gregs[4] = signal;
regs->gregs[5] = frame_addr + offsetof(typeof(*frame), info);
regs->gregs[6] = frame_addr + offsetof(typeof(*frame), uc);
regs->pc = (unsigned long) ka->_sa_handler;
unlock_user_struct(frame, frame_addr, 1);
return;
give_sigsegv:
unlock_user_struct(frame, frame_addr, 1);
force_sig(TARGET_SIGSEGV);
}
| 1threat |
'KeyPressEventArgs' does not contain defintion for KeyCode' error in visual studio : Im trying to make a key press event in visual studio windows forms but getting this error. Any ideas?
```
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyCode = Keys.E)
{
// The Code when key 'E' is pressed
}
}
```
but I keep getting the error CS1061 | 0debug |
eliminate line in stacked bar ggplot : <p>this graph is made by ggplots but I don't know how to eliminate the lines between the stacked bars (e.g. I want to combine two pink bars into one). </p>
<p><a href="https://i.stack.imgur.com/YLG7U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YLG7U.png" alt="enter image description here"></a></p>
| 0debug |
Can i do someting before view being generated using spring mvc jsp shiro : <p>I want to check session and add it's information to model, but i don't want to add code in every controller, so is there something I can use to solve this problem?</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.