problem
stringlengths
26
131k
labels
class label
2 classes
If Else Troubles (C#) : I have an issue with my if else statement to where it will only display the else output and not the if output. default: if (GradeVar >= 10) { Console.WriteLine("That grade is a perfect score. Well done!"); } else { Console.WriteLine("That grade is not passing."); } break; } Console.ReadLine(); } } } Here's the specific code I am talking about; its for a program to display certain messages for grades
0debug
PPC_OP(test_ctrz) { T0 = (regs->ctr == 0); RETURN(); }
1threat
static void disas_thumb_insn(CPUState *env, DisasContext *s) { uint32_t val, insn, op, rm, rn, rd, shift, cond; int32_t offset; int i; TCGv tmp; TCGv tmp2; TCGv addr; if (s->condexec_mask) { cond = s->condexec_cond; if (cond != 0x0e) { s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; } } insn = lduw_code(s->pc); s->pc += 2; switch (insn >> 12) { case 0: case 1: rd = insn & 7; op = (insn >> 11) & 3; if (op == 3) { rn = (insn >> 3) & 7; tmp = load_reg(s, rn); if (insn & (1 << 10)) { tmp2 = new_tmp(); tcg_gen_movi_i32(tmp2, (insn >> 6) & 7); } else { rm = (insn >> 6) & 7; tmp2 = load_reg(s, rm); } if (insn & (1 << 9)) { if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); } else { if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); } dead_tmp(tmp2); store_reg(s, rd, tmp); } else { rm = (insn >> 3) & 7; shift = (insn >> 6) & 0x1f; tmp = load_reg(s, rm); gen_arm_shift_im(tmp, op, shift, s->condexec_mask == 0); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } break; case 2: case 3: op = (insn >> 11) & 3; rd = (insn >> 8) & 0x7; if (op == 0) { tmp = new_tmp(); tcg_gen_movi_i32(tmp, insn & 0xff); if (!s->condexec_mask) gen_logic_CC(tmp); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); tmp2 = new_tmp(); tcg_gen_movi_i32(tmp2, insn & 0xff); switch (op) { case 1: gen_helper_sub_cc(tmp, tmp, tmp2); dead_tmp(tmp); dead_tmp(tmp2); break; case 2: if (s->condexec_mask) tcg_gen_add_i32(tmp, tmp, tmp2); else gen_helper_add_cc(tmp, tmp, tmp2); dead_tmp(tmp2); store_reg(s, rd, tmp); break; case 3: if (s->condexec_mask) tcg_gen_sub_i32(tmp, tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); dead_tmp(tmp2); store_reg(s, rd, tmp); break; } } break; case 4: if (insn & (1 << 11)) { rd = (insn >> 8) & 7; val = s->pc + 2 + ((insn & 0xff) * 4); val &= ~(uint32_t)2; addr = new_tmp(); tcg_gen_movi_i32(addr, val); tmp = gen_ld32(addr, IS_USER(s)); dead_tmp(addr); store_reg(s, rd, tmp); break; } if (insn & (1 << 10)) { rd = (insn & 7) | ((insn >> 4) & 8); rm = (insn >> 3) & 0xf; op = (insn >> 8) & 3; switch (op) { case 0: tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); tcg_gen_add_i32(tmp, tmp, tmp2); dead_tmp(tmp2); store_reg(s, rd, tmp); break; case 1: tmp = load_reg(s, rd); tmp2 = load_reg(s, rm); gen_helper_sub_cc(tmp, tmp, tmp2); dead_tmp(tmp2); dead_tmp(tmp); break; case 2: tmp = load_reg(s, rm); store_reg(s, rd, tmp); break; case 3: tmp = load_reg(s, rm); if (insn & (1 << 7)) { val = (uint32_t)s->pc | 1; tmp2 = new_tmp(); tcg_gen_movi_i32(tmp2, val); store_reg(s, 14, tmp2); } gen_bx(s, tmp); break; } break; } rd = insn & 7; rm = (insn >> 3) & 7; op = (insn >> 6) & 0xf; if (op == 2 || op == 3 || op == 4 || op == 7) { val = rm; rm = rd; rd = val; val = 1; } else { val = 0; } if (op == 9) { tmp = new_tmp(); tcg_gen_movi_i32(tmp, 0); } else if (op != 0xf) { tmp = load_reg(s, rd); } else { TCGV_UNUSED(tmp); } tmp2 = load_reg(s, rm); switch (op) { case 0x0: tcg_gen_and_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x1: tcg_gen_xor_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0x2: if (s->condexec_mask) { gen_helper_shl(tmp2, tmp2, tmp); } else { gen_helper_shl_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x3: if (s->condexec_mask) { gen_helper_shr(tmp2, tmp2, tmp); } else { gen_helper_shr_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x4: if (s->condexec_mask) { gen_helper_sar(tmp2, tmp2, tmp); } else { gen_helper_sar_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x5: if (s->condexec_mask) gen_adc(tmp, tmp2); else gen_helper_adc_cc(tmp, tmp, tmp2); break; case 0x6: if (s->condexec_mask) gen_sub_carry(tmp, tmp, tmp2); else gen_helper_sbc_cc(tmp, tmp, tmp2); break; case 0x7: if (s->condexec_mask) { tcg_gen_andi_i32(tmp, tmp, 0x1f); tcg_gen_rotr_i32(tmp2, tmp2, tmp); } else { gen_helper_ror_cc(tmp2, tmp2, tmp); gen_logic_CC(tmp2); } break; case 0x8: tcg_gen_and_i32(tmp, tmp, tmp2); gen_logic_CC(tmp); rd = 16; break; case 0x9: if (s->condexec_mask) tcg_gen_neg_i32(tmp, tmp2); else gen_helper_sub_cc(tmp, tmp, tmp2); break; case 0xa: gen_helper_sub_cc(tmp, tmp, tmp2); rd = 16; break; case 0xb: gen_helper_add_cc(tmp, tmp, tmp2); rd = 16; break; case 0xc: tcg_gen_or_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xd: tcg_gen_mul_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xe: tcg_gen_andc_i32(tmp, tmp, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp); break; case 0xf: tcg_gen_not_i32(tmp2, tmp2); if (!s->condexec_mask) gen_logic_CC(tmp2); val = 1; rm = rd; break; } if (rd != 16) { if (val) { store_reg(s, rm, tmp2); if (op != 0xf) dead_tmp(tmp); } else { store_reg(s, rd, tmp); dead_tmp(tmp2); } } else { dead_tmp(tmp); dead_tmp(tmp2); } break; case 5: rd = insn & 7; rn = (insn >> 3) & 7; rm = (insn >> 6) & 7; op = (insn >> 9) & 7; addr = load_reg(s, rn); tmp = load_reg(s, rm); tcg_gen_add_i32(addr, addr, tmp); dead_tmp(tmp); if (op < 3) tmp = load_reg(s, rd); switch (op) { case 0: gen_st32(tmp, addr, IS_USER(s)); break; case 1: gen_st16(tmp, addr, IS_USER(s)); break; case 2: gen_st8(tmp, addr, IS_USER(s)); break; case 3: tmp = gen_ld8s(addr, IS_USER(s)); break; case 4: tmp = gen_ld32(addr, IS_USER(s)); break; case 5: tmp = gen_ld16u(addr, IS_USER(s)); break; case 6: tmp = gen_ld8u(addr, IS_USER(s)); break; case 7: tmp = gen_ld16s(addr, IS_USER(s)); break; } if (op >= 3) store_reg(s, rd, tmp); dead_tmp(addr); break; case 6: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 4) & 0x7c; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } dead_tmp(addr); break; case 7: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 6) & 0x1f; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld8u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st8(tmp, addr, IS_USER(s)); } dead_tmp(addr); break; case 8: rd = insn & 7; rn = (insn >> 3) & 7; addr = load_reg(s, rn); val = (insn >> 5) & 0x3e; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld16u(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st16(tmp, addr, IS_USER(s)); } dead_tmp(addr); break; case 9: rd = (insn >> 8) & 7; addr = load_reg(s, 13); val = (insn & 0xff) * 4; tcg_gen_addi_i32(addr, addr, val); if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, rd, tmp); } else { tmp = load_reg(s, rd); gen_st32(tmp, addr, IS_USER(s)); } dead_tmp(addr); break; case 10: rd = (insn >> 8) & 7; if (insn & (1 << 11)) { tmp = load_reg(s, 13); } else { tmp = new_tmp(); tcg_gen_movi_i32(tmp, (s->pc + 2) & ~(uint32_t)2); } val = (insn & 0xff) * 4; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, rd, tmp); break; case 11: op = (insn >> 8) & 0xf; switch (op) { case 0: tmp = load_reg(s, 13); val = (insn & 0x7f) * 4; if (insn & (1 << 7)) val = -(int32_t)val; tcg_gen_addi_i32(tmp, tmp, val); store_reg(s, 13, tmp); break; case 2: ARCH(6); rd = insn & 7; rm = (insn >> 3) & 7; tmp = load_reg(s, rm); switch ((insn >> 6) & 3) { case 0: gen_sxth(tmp); break; case 1: gen_sxtb(tmp); break; case 2: gen_uxth(tmp); break; case 3: gen_uxtb(tmp); break; } store_reg(s, rd, tmp); break; case 4: case 5: case 0xc: case 0xd: addr = load_reg(s, 13); if (insn & (1 << 8)) offset = 4; else offset = 0; for (i = 0; i < 8; i++) { if (insn & (1 << i)) offset += 4; } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } } TCGV_UNUSED(tmp); if (insn & (1 << 8)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); } else { tmp = load_reg(s, 14); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } if ((insn & (1 << 11)) == 0) { tcg_gen_addi_i32(addr, addr, -offset); } store_reg(s, 13, addr); if ((insn & 0x0900) == 0x0900) gen_bx(s, tmp); break; case 1: case 3: case 9: case 11: rm = insn & 7; tmp = load_reg(s, rm); s->condlabel = gen_new_label(); s->condjmp = 1; if (insn & (1 << 11)) tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, s->condlabel); else tcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, s->condlabel); dead_tmp(tmp); offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3; val = (uint32_t)s->pc + 2; val += offset; gen_jmp(s, val); break; case 15: if ((insn & 0xf) == 0) { gen_nop_hint(s, (insn >> 4) & 0xf); break; } s->condexec_cond = (insn >> 4) & 0xe; s->condexec_mask = insn & 0x1f; break; case 0xe: gen_exception_insn(s, 2, EXCP_BKPT); break; case 0xa: ARCH(6); rn = (insn >> 3) & 0x7; rd = insn & 0x7; tmp = load_reg(s, rn); switch ((insn >> 6) & 3) { case 0: tcg_gen_bswap32_i32(tmp, tmp); break; case 1: gen_rev16(tmp); break; case 3: gen_revsh(tmp); break; default: goto illegal_op; } store_reg(s, rd, tmp); break; case 6: ARCH(6); if (IS_USER(s)) break; if (IS_M(env)) { tmp = tcg_const_i32((insn & (1 << 4)) != 0); if (insn & 1) { addr = tcg_const_i32(16); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } if (insn & 2) { addr = tcg_const_i32(17); gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } tcg_temp_free_i32(tmp); gen_lookup_tb(s); } else { if (insn & (1 << 4)) shift = CPSR_A | CPSR_I | CPSR_F; else shift = 0; gen_set_psr_im(s, ((insn & 7) << 6), 0, shift); } break; default: goto undef; } break; case 12: rn = (insn >> 8) & 0x7; addr = load_reg(s, rn); for (i = 0; i < 8; i++) { if (insn & (1 << i)) { if (insn & (1 << 11)) { tmp = gen_ld32(addr, IS_USER(s)); store_reg(s, i, tmp); } else { tmp = load_reg(s, i); gen_st32(tmp, addr, IS_USER(s)); } tcg_gen_addi_i32(addr, addr, 4); } } if ((insn & (1 << rn)) == 0) { store_reg(s, rn, addr); } else { dead_tmp(addr); } break; case 13: cond = (insn >> 8) & 0xf; if (cond == 0xe) goto undef; if (cond == 0xf) { gen_set_pc_im(s->pc); s->is_jmp = DISAS_SWI; break; } s->condlabel = gen_new_label(); gen_test_cc(cond ^ 1, s->condlabel); s->condjmp = 1; val = (uint32_t)s->pc + 2; offset = ((int32_t)insn << 24) >> 24; val += offset << 1; gen_jmp(s, val); break; case 14: if (insn & (1 << 11)) { if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } val = (uint32_t)s->pc; offset = ((int32_t)insn << 21) >> 21; val += (offset << 1) + 2; gen_jmp(s, val); break; case 15: if (disas_thumb2_insn(env, s, insn)) goto undef32; break; } return; undef32: gen_exception_insn(s, 4, EXCP_UDEF); return; illegal_op: undef: gen_exception_insn(s, 2, EXCP_UDEF); }
1threat
void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)) { AVPacketList **next_point, *this_pktl; this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl->pkt = *pkt; #if FF_API_DESTRUCT_PACKET FF_DISABLE_DEPRECATION_WARNINGS pkt->destruct = NULL; FF_ENABLE_DEPRECATION_WARNINGS #endif pkt->buf = NULL; av_dup_packet(&this_pktl->pkt); if (s->streams[pkt->stream_index]->last_in_packet_buffer) { next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next); } else next_point = &s->packet_buffer; if (*next_point) { if (compare(s, &s->packet_buffer_end->pkt, pkt)) { while (!compare(s, &(*next_point)->pkt, pkt)) next_point = &(*next_point)->next; goto next_non_null; } else { next_point = &(s->packet_buffer_end->next); } } assert(!*next_point); s->packet_buffer_end = this_pktl; next_non_null: this_pktl->next = *next_point; s->streams[pkt->stream_index]->last_in_packet_buffer = *next_point = this_pktl; }
1threat
Why it's illegal to have static block inside interface JAVA? : <p>It is legal to have static block inside a class but illegal to have inside an interface. Please explain the reason.</p>
0debug
python numpy.savetxt header has extra character # : <p>I am using the following to save the numpy array x with a header:</p> <pre><code>np.savetxt("foo.csv", x, delimiter=",", header="ID,AMOUNT", fmt="%i") </code></pre> <p>However, if I open "foo.cv", the file looks like:</p> <pre><code># ID,AMOUNT 21,100 52,120 63,29 : </code></pre> <p>There is an extra <code>#</code> character in the beginning of the header. Why is that and is there a way to get rid of it?</p>
0debug
Program that generates a serie of carachtere from 1 to 1000 that includes numbers and letters : <p>I would like to create a program that generates a serie of carachtere from 1 to 1000 that includes numbers and letters . for example : 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f ... 000z 0010 00011 ...</p>
0debug
Assign value not reference in javascript : <p>I am having a little problem assigning objects in javascript.</p> <p>take a look at this sample code that reproduces my problem.</p> <pre><code>var fruit = { name: "Apple" }; var vegetable = fruit; vegetable.name = "potatoe"; console.log(fruit); </code></pre> <p>it logs </p> <pre><code>Object {name: "potatoe"} </code></pre> <p>How can I assign the value not the reference of an object to another object?</p>
0debug
How to set a pdf background color? : <p>I want to generate a p d f with report lab. I need to change the background color of the exported p d f ( not FONT color, BACKGROUND color ). Thanks!</p>
0debug
Resize issue in Windows form application in 2560x1600 resolution display : <p>I have a form application working fine on various displays with varying screen resolution but in a machine with 2560x1600 resolution it shrinks to a very small size.</p> <p>It works fine all smaller resolution and i am not able to find a reason behind it. I have used anchor, docking, autoscalemode and various other properties still it fails only in this above mentioned screen resolution</p>
0debug
What does 'separate' in sequelize mean? : <p>I searched in the official docs of sequelize and couldn't find any entry about '<code>separate</code>'.<a href="https://readthedocs.org/search/?q=separate" rel="noreferrer">https://readthedocs.org/search/?q=separate</a></p> <p>I also searched on google but in vain.</p> <pre><code> db.fooTable.find({ where: { id: id }, include: [{ model: db.barTable1, separate: true }, { model: db.barTable2, separate: true }, { model: db.barTable3, separate: true }] }) </code></pre> <p>To find out what it means, I set '<code>separate</code>' to false, but the result of the query were the same as to when I put '<code>true</code>' instead.</p>
0debug
Is there a way how to import keyboard shortcuts from IntelliJ to Visual Studio 2015 : <p>I would like to know if it´s possible to import keymap from IntelliJ or PHPStorm to Visual Studio. I´m used to work with IntelliJ IDE´s. Now I´m starting develop some apps in .NET and it´s kinda hard to get used to the new key schemes.</p>
0debug
DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type) { const char *value; DriveInfo *dinfo = NULL; QDict *bs_opts; QemuOpts *legacy_opts; DriveMediaType media = MEDIA_DISK; BlockInterfaceType type; int cyls, heads, secs, translation; int max_devs, bus_id, unit_id, index; const char *devaddr; const char *werror, *rerror; bool read_only = false; bool copy_on_read; const char *filename; Error *local_err = NULL; qemu_opt_rename(all_opts, "iops", "throttling.iops-total"); qemu_opt_rename(all_opts, "iops_rd", "throttling.iops-read"); qemu_opt_rename(all_opts, "iops_wr", "throttling.iops-write"); qemu_opt_rename(all_opts, "bps", "throttling.bps-total"); qemu_opt_rename(all_opts, "bps_rd", "throttling.bps-read"); qemu_opt_rename(all_opts, "bps_wr", "throttling.bps-write"); qemu_opt_rename(all_opts, "iops_max", "throttling.iops-total-max"); qemu_opt_rename(all_opts, "iops_rd_max", "throttling.iops-read-max"); qemu_opt_rename(all_opts, "iops_wr_max", "throttling.iops-write-max"); qemu_opt_rename(all_opts, "bps_max", "throttling.bps-total-max"); qemu_opt_rename(all_opts, "bps_rd_max", "throttling.bps-read-max"); qemu_opt_rename(all_opts, "bps_wr_max", "throttling.bps-write-max"); qemu_opt_rename(all_opts, "iops_size", "throttling.iops-size"); qemu_opt_rename(all_opts, "readonly", "read-only"); value = qemu_opt_get(all_opts, "cache"); if (value) { int flags = 0; if (bdrv_parse_cache_flags(value, &flags) != 0) { error_report("invalid cache option"); return NULL; } if (!qemu_opt_get(all_opts, "cache.writeback")) { qemu_opt_set_bool(all_opts, "cache.writeback", !!(flags & BDRV_O_CACHE_WB)); } if (!qemu_opt_get(all_opts, "cache.direct")) { qemu_opt_set_bool(all_opts, "cache.direct", !!(flags & BDRV_O_NOCACHE)); } if (!qemu_opt_get(all_opts, "cache.no-flush")) { qemu_opt_set_bool(all_opts, "cache.no-flush", !!(flags & BDRV_O_NO_FLUSH)); } qemu_opt_unset(all_opts, "cache"); } bs_opts = qdict_new(); qemu_opts_to_qdict(all_opts, bs_opts); legacy_opts = qemu_opts_create(&qemu_legacy_drive_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err); if (local_err) { error_report("%s", error_get_pretty(local_err)); error_free(local_err); goto fail; } if (qemu_opt_get(legacy_opts, "boot") != NULL) { fprintf(stderr, "qemu-kvm: boot=on|off is deprecated and will be " "ignored. Future versions will reject this parameter. Please " "update your scripts.\n"); } value = qemu_opt_get(legacy_opts, "media"); if (value) { if (!strcmp(value, "disk")) { media = MEDIA_DISK; } else if (!strcmp(value, "cdrom")) { media = MEDIA_CDROM; read_only = true; } else { error_report("'%s' invalid media", value); goto fail; } } read_only |= qemu_opt_get_bool(legacy_opts, "read-only", false); copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false); if (read_only && copy_on_read) { error_report("warning: disabling copy-on-read on read-only drive"); copy_on_read = false; } qdict_put(bs_opts, "read-only", qstring_from_str(read_only ? "on" : "off")); qdict_put(bs_opts, "copy-on-read", qstring_from_str(copy_on_read ? "on" :"off")); value = qemu_opt_get(legacy_opts, "if"); if (value) { for (type = 0; type < IF_COUNT && strcmp(value, if_name[type]); type++) { } if (type == IF_COUNT) { error_report("unsupported bus type '%s'", value); goto fail; } } else { type = block_default_type; } cyls = qemu_opt_get_number(legacy_opts, "cyls", 0); heads = qemu_opt_get_number(legacy_opts, "heads", 0); secs = qemu_opt_get_number(legacy_opts, "secs", 0); if (cyls || heads || secs) { if (cyls < 1) { error_report("invalid physical cyls number"); goto fail; } if (heads < 1) { error_report("invalid physical heads number"); goto fail; } if (secs < 1) { error_report("invalid physical secs number"); goto fail; } } translation = BIOS_ATA_TRANSLATION_AUTO; value = qemu_opt_get(legacy_opts, "trans"); if (value != NULL) { if (!cyls) { error_report("'%s' trans must be used with cyls, heads and secs", value); goto fail; } if (!strcmp(value, "none")) { translation = BIOS_ATA_TRANSLATION_NONE; } else if (!strcmp(value, "lba")) { translation = BIOS_ATA_TRANSLATION_LBA; } else if (!strcmp(value, "large")) { translation = BIOS_ATA_TRANSLATION_LARGE; } else if (!strcmp(value, "rechs")) { translation = BIOS_ATA_TRANSLATION_RECHS; } else if (!strcmp(value, "auto")) { translation = BIOS_ATA_TRANSLATION_AUTO; } else { error_report("'%s' invalid translation type", value); goto fail; } } if (media == MEDIA_CDROM) { if (cyls || secs || heads) { error_report("CHS can't be set with media=cdrom"); goto fail; } } bus_id = qemu_opt_get_number(legacy_opts, "bus", 0); unit_id = qemu_opt_get_number(legacy_opts, "unit", -1); index = qemu_opt_get_number(legacy_opts, "index", -1); max_devs = if_max_devs[type]; if (index != -1) { if (bus_id != 0 || unit_id != -1) { error_report("index cannot be used with bus and unit"); goto fail; } bus_id = drive_index_to_bus_id(type, index); unit_id = drive_index_to_unit_id(type, index); } if (unit_id == -1) { unit_id = 0; while (drive_get(type, bus_id, unit_id) != NULL) { unit_id++; if (max_devs && unit_id >= max_devs) { unit_id -= max_devs; bus_id++; } } } if (max_devs && unit_id >= max_devs) { error_report("unit %d too big (max is %d)", unit_id, max_devs - 1); goto fail; } if (drive_get(type, bus_id, unit_id) != NULL) { error_report("drive with bus=%d, unit=%d (index=%d) exists", bus_id, unit_id, index); goto fail; } if (qemu_opts_id(all_opts) == NULL) { char *new_id; const char *mediastr = ""; if (type == IF_IDE || type == IF_SCSI) { mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd"; } if (max_devs) { new_id = g_strdup_printf("%s%i%s%i", if_name[type], bus_id, mediastr, unit_id); } else { new_id = g_strdup_printf("%s%s%i", if_name[type], mediastr, unit_id); } qdict_put(bs_opts, "id", qstring_from_str(new_id)); g_free(new_id); } devaddr = qemu_opt_get(legacy_opts, "addr"); if (devaddr && type != IF_VIRTIO) { error_report("addr is not supported by this bus type"); goto fail; } if (type == IF_VIRTIO) { QemuOpts *devopts; devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, &error_abort); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(devopts, "driver", "virtio-blk-s390"); } else { qemu_opt_set(devopts, "driver", "virtio-blk-pci"); } qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id")); if (devaddr) { qemu_opt_set(devopts, "addr", devaddr); } } filename = qemu_opt_get(legacy_opts, "file"); werror = qemu_opt_get(legacy_opts, "werror"); if (werror != NULL) { if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { error_report("werror is not supported by this bus type"); goto fail; } qdict_put(bs_opts, "werror", qstring_from_str(werror)); } rerror = qemu_opt_get(legacy_opts, "rerror"); if (rerror != NULL) { if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { error_report("rerror is not supported by this bus type"); goto fail; } qdict_put(bs_opts, "rerror", qstring_from_str(rerror)); } dinfo = blockdev_init(filename, bs_opts, &local_err); if (dinfo == NULL) { if (local_err) { error_report("%s", error_get_pretty(local_err)); error_free(local_err); } goto fail; } else { assert(!local_err); } dinfo->enable_auto_del = true; dinfo->opts = all_opts; dinfo->cyls = cyls; dinfo->heads = heads; dinfo->secs = secs; dinfo->trans = translation; dinfo->type = type; dinfo->bus = bus_id; dinfo->unit = unit_id; dinfo->devaddr = devaddr; switch(type) { case IF_IDE: case IF_SCSI: case IF_XEN: case IF_NONE: dinfo->media_cd = media == MEDIA_CDROM; break; default: break; } fail: qemu_opts_del(legacy_opts); QDECREF(bs_opts); return dinfo; }
1threat
static void gdb_chr_event(void *opaque, int event) { switch (event) { case CHR_EVENT_RESET: vm_stop(EXCP_INTERRUPT); gdb_syscall_state = opaque; gdb_has_xml = 0; break; default: break; } }
1threat
i am trying to webscrape to pycharm using selenium : this is the HTML text that gives the output -£0.03 I`d like to find this value by xpath and print the output to pycharm console. <div class="pnl runner-info-elem below-runner-info" ng-if="ctrl.vm.events.shouldShowPnl(runner)" ng-class="{'below-runner-info': ctrl.vm.data.displayRaceCardInfo}"><!----><mv-runner-pnl ng-repeat="(type, pnl) in ctrl.vm.data.pnl[runner.key] track by type" type="actual" values="pnl.values" separator="comma" formatter="::pnl.formatter"><!-- PnL --><div class="runner-elem-pnl actual-pnl"><span class="prefix"></span><span class="pnl-value-container"> <span class="pnl-value negative">-£0.03</span> </span><span class="pnl-value-container hidden"><span I have tried the following: driver.find_element_by_xpath('//*[@id="main-wrapper"]/div/div[3]/div/div[2]/div/div[1]/div[3]/div/div[1]/div/bf-main-market/bf-main-marketview/div/div[2]/bf-marketview-runners-list[2]/div/div/div/table/tbody/tr[1]/td[1]/div/div[3]').get_attribute(pnl.value) print(pnl.value) my result is :NameError: name 'pnl' is not defined is this even possible ? if not by xpath then by any other means ? As i said i am totally new to this and trying to learn from youtube tutorials.
0debug
asyncio queue consumer coroutine : <p>I have a <code>asyncio.Protocol</code> subclass receiving data from a server. I am storing this data (each line, because the data is text) in a <code>asyncio.Queue</code>.</p> <pre><code>import asyncio q = asyncio.Queue() class StreamProtocol(asyncio.Protocol): def __init__(self, loop): self.loop = loop self.transport = None def connection_made(self, transport): self.transport = transport def data_received(self, data): for message in data.decode().splitlines(): yield q.put(message.rstrip()) def connection_lost(self, exc): self.loop.stop() loop = asyncio.get_event_loop() coro = loop.create_connection(lambda: StreamProtocol(loop), '127.0.0.1', '42') loop.run_until_complete(coro) loop.run_forever() loop.close() </code></pre> <p>I want to have another coroutine responsible for consuming the data in the queue and processing it.</p> <ul> <li>Should this be a <code>asyncio.Task</code>?</li> <li>What if the queue becomes empty because for a few seconds no data is received? How can I make sure my consumer doesn't stop (<code>run_until_complete</code>)?</li> <li>Is there a cleaner way than using a global variable for my queue?</li> </ul>
0debug
Flutter How to make release version in Android Studio? : <p>By default Android Studio use debug mode when building Flutter application. You can build release version with command line, see <a href="https://stackoverflow.com/questions/49567065/how-to-optimize-the-flutter-app-size">How to optimize the Flutter App size?</a></p> <pre><code> flutter build apk --release </code></pre> <p>Now: how to configure Android Studio to do the same, when I run application (Shift+F10)? I can't find this setting...</p>
0debug
Don't understand output from collect(), please help me : /* please explain output from collect() */ import java.util.List; import java.util.Arrays; import java.util.HashMap; import java.util.stream.Collectors; class example1 { public static void main(String []args){ List <Integer> list = Arrays.asList(new Integer []{3,4,5,6,7,8,9}); HashMap<Integer, List<Integer>> map = list.parallelStream().collect(Collectors.groupingByConcurrent(i->i%2 == 0?1:2)); /* what's problem here */ System.out.println(map.get(0)); } } /*/* output /*java: incompatible types: inference variable R has incompatible bounds /* equality constraints: /*java.util.concurrent.ConcurrentMap<java.lang.Integer,java.util.List<java.lang./* Integer>> /* upper bounds: /*java.util.concurrent.ConcurrentHashMap<java.lang.Integer,java.util.List<java.l/*ang.Integer>>,java.lang.Object */
0debug
if statement doesn't work in for loop : <p>Ok i have this problem: if doesn't want to work and i dont know why.</p> <p>The program is supposed to take from a file some numbers, first indicates the number of numbers on the second line and say what is the minimum and maximum on that line.</p> <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; using namespace std; int main() { ifstream f("file.in"); ofstream g("file.out"); int minim,x,maxim,i,n; f&gt;&gt;n; f&gt;&gt;maxim; minim=maxim; for(i=2;i&lt;=n;i++){ f&gt;&gt;x; if(minim &gt; x)x=minim; if(maxim &lt; x)x=maxim; } g &lt;&lt; "min=" &lt;&lt; minim; g &lt;&lt; "\n" &lt;&lt; "max=" &lt;&lt; maxim; f.close(); g.close(); return 0; } </code></pre> <p>The problem is "if" doesn't work at all.</p> <p>srry for bad english</p>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
php mail() function doesn't return anything : <p>I want to send mail with php mail() function from php code, this function return true but i don't receive any message I've sent is it some problem with my hMailServer in data folder it shows data like the mail was sent but I don't get nothing</p>
0debug
iOS 11, Xcode 9 Error: NSURLConnection finished with error - code -1100 : <p>I'm getting this error when working in JS and Ionic 3. I'm testing on my iPhone 7 plus with iOS 11 and Xcode 9.</p> <pre><code>NSURLConnection finished with error - code -1100 </code></pre> <p>Anyone got a similar error in the past?</p>
0debug
static void gen_smul_dual(TCGv a, TCGv b) { TCGv tmp1 = new_tmp(); TCGv tmp2 = new_tmp(); tcg_gen_ext16s_i32(tmp1, a); tcg_gen_ext16s_i32(tmp2, b); tcg_gen_mul_i32(tmp1, tmp1, tmp2); dead_tmp(tmp2); tcg_gen_sari_i32(a, a, 16); tcg_gen_sari_i32(b, b, 16); tcg_gen_mul_i32(b, b, a); tcg_gen_mov_i32(a, tmp1); dead_tmp(tmp1); }
1threat
Get 1 year old data from begining of month : <p>I want to get 1 year old data from database till current date but from the beginning of month.if today is 25-08-2016 i have to get data from 01-08-2015 till now</p>
0debug
Duplicate elements of array in the same array : <p>I got this array of objects</p> <pre><code>let item = [ { a: 1 }, { b: 2 } ] </code></pre> <p>and would like to duplicate array's elements to the same array. Output should be:</p> <pre><code>[ { a: 1 }, { b: 2 }, { a: 1 }, { b: 2 } ] </code></pre> <p>Can you help?</p>
0debug
WHat does the regex parameter in .replace() function mean : I am a beginner in Python. I was trying to replace few unwanted strings that got scraped from the website. So I tried removing them using codes from this website itself. df["col_1"].replace('', '', regex=True, inplace=True) What exactly does the regex = True and inplace = True mean? I am sorry if this question looks stupid but I am not from the coding background. Thanks.
0debug
rdt_new_extradata (void) { PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL); return rdt; }
1threat
uWSGI error hr_instance_read(): Connection reset by peer : <p>I have deployed a flask web application using uWSGI and NGINX as the reverse proxy. The application response time is about 9ms in average but after a batch of requests my workers crashing and I got this log on my uWSGI log:</p> <pre><code>[uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 24488] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 4059] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 46764] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 9951] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 9449] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 51355] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 39565] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 63142] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 7861] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 10165] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 10917] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] [uwsgi-http key: backend client_addr: 172.17.0.1 client_port: 20392] hr_instance_read(): Connection reset by peer [plugins/http/http.c line 647] </code></pre> <p><strong>The uWSGI config:</strong></p> <pre><code>[uwsgi] http = 0.0.0.0:7000 wsgi-file = app.py callable = app processes = 5 lazy = true lazy-apps = true buffer-size = 16384 logto = /root/logs/data-gathering.log </code></pre> <p><strong>Env:</strong></p> <pre><code>uWSGI==2.0.17 Flask==0.12.2 </code></pre>
0debug
static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr, unsigned int pos) { SubStream *s = &m->substream[substr]; unsigned int mat, channel; for (mat = 0; mat < s->num_primitive_matrices; mat++) if (s->lsb_bypass[mat]) m->bypassed_lsbs[pos + s->blockpos][mat] = get_bits1(gbp); for (channel = s->min_channel; channel <= s->max_channel; channel++) { ChannelParams *cp = &s->channel_params[channel]; int codebook = cp->codebook; int quant_step_size = s->quant_step_size[channel]; int lsb_bits = cp->huff_lsbs - quant_step_size; int result = 0; if (codebook > 0) result = get_vlc2(gbp, huff_vlc[codebook-1].table, VLC_BITS, (9 + VLC_BITS - 1) / VLC_BITS); if (result < 0) return AVERROR_INVALIDDATA; if (lsb_bits > 0) result = (result << lsb_bits) + get_bits(gbp, lsb_bits); result += cp->sign_huff_offset; result <<= quant_step_size; m->sample_buffer[pos + s->blockpos][channel] = result; } return 0; }
1threat
void slirp_pollfds_poll(GArray *pollfds, int select_error) { Slirp *slirp; struct socket *so, *so_next; int ret; if (QTAILQ_EMPTY(&slirp_instances)) { return; } curtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); QTAILQ_FOREACH(slirp, &slirp_instances, entry) { if (slirp->time_fasttimo && ((curtime - slirp->time_fasttimo) >= TIMEOUT_FAST)) { tcp_fasttimo(slirp); slirp->time_fasttimo = 0; } if (slirp->do_slowtimo && ((curtime - slirp->last_slowtimo) >= TIMEOUT_SLOW)) { ip_slowtimo(slirp); tcp_slowtimo(slirp); slirp->last_slowtimo = curtime; } if (!select_error) { for (so = slirp->tcb.so_next; so != &slirp->tcb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->so_state & SS_NOFDREF || so->s == -1) { continue; } if (revents & G_IO_PRI) { sorecvoob(so); } else if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) { if (so->so_state & SS_FACCEPTCONN) { tcp_connect(so); continue; } ret = soread(so); if (ret > 0) { tcp_output(sototcpcb(so)); } } if (!(so->so_state & SS_NOFDREF) && (revents & (G_IO_OUT | G_IO_ERR))) { if (so->so_state & SS_ISFCONNECTING) { so->so_state &= ~SS_ISFCONNECTING; ret = send(so->s, (const void *) &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); } else { ret = sowrite(so); } } #ifdef PROBE_CONN if (so->so_state & SS_ISFCONNECTING) { ret = qemu_recv(so->s, &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } else { ret = send(so->s, &ret, 0, 0); if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) { continue; } so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_NOFDREF; } else { so->so_state &= ~SS_ISFCONNECTING; } } tcp_input((struct mbuf *)NULL, sizeof(struct ip), so, so->so_ffamily); } #endif } for (so = slirp->udb.so_next; so != &slirp->udb; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { sorecvfrom(so); } } for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so_next) { int revents; so_next = so->so_next; revents = 0; if (so->pollfds_idx != -1) { revents = g_array_index(pollfds, GPollFD, so->pollfds_idx).revents; } if (so->s != -1 && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))) { icmp_receive(so); } } } if_start(slirp); } }
1threat
How to check if you have written ES6 code? : <p>I have written a bunch of Javascript code. I was never aware of the fact that there are multiple JS 'versions', like ES5 and ES6.</p> <p>I now have this project hosted on Github, and somebody pointed out that because i'm using ES6 code, I might need to convert it to ES5 with <a href="https://babeljs.io/" rel="noreferrer">Babel</a>.</p> <p>However, I have no idea which parts of my code use ES6. I could read all of the ES6 specifications, but is there some kind of tool/checker which marks all of the ES6 code in my project?</p>
0debug
RAD STUDIO как установить TClientSocket и TServerSocket под мультиплатформу c++? : RAD STUDIO как установить TClientSocket и TServerSocket под мультиплатформу c++ ? Следовал инструкциям с официального сайта, поставилось вроде, но компоненты появляются только при создании VLC проекта, а мне нужно на C++ и под мультиплатформу..
0debug
Encrypt text and save to text file. Also read and decrypt - Java : <p>I am trying to encrypt a string using my own password key. After generate encrypted text i need to save it to text file to later use. Also i need to read that encrypted text end decrypt it. It will be great if some one can give me a solution to do this thing in Java SE App. </p>
0debug
Dart: Do I have to cancel Stream subscriptions and close StreamSinks? : <p>I know I have to cancel <code>Stream</code> Subscriptions when I no longer want to receive any events. Do I have to this even after I receive a 'Done' event? Or do I get memory leaks?</p> <p>What happens to Streams that are passed to <code>addStream</code> of another Stream? Are they automatically canceled? </p> <p>Same Question on the <code>StreamSink</code> side do I have to close them if the stream is already done?</p>
0debug
static int xen_pt_initfn(PCIDevice *d) { XenPCIPassthroughState *s = XEN_PT_DEVICE(d); int rc = 0; uint8_t machine_irq = 0, scratch; uint16_t cmd = 0; int pirq = XEN_PT_UNASSIGNED_PIRQ; XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d" " to devfn %#x\n", s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function, s->dev.devfn); rc = xen_host_pci_device_get(&s->real_device, s->hostaddr.domain, s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function); if (rc) { XEN_PT_ERR(d, "Failed to \"open\" the real pci device. rc: %i\n", rc); return -1; } s->is_virtfn = s->real_device.is_virtfn; if (s->is_virtfn) { XEN_PT_LOG(d, "%04x:%02x:%02x.%d is a SR-IOV Virtual Function\n", s->real_device.domain, s->real_device.bus, s->real_device.dev, s->real_device.func); } if (xen_host_pci_get_block(&s->real_device, 0, d->config, PCI_CONFIG_SPACE_SIZE) < 0) { xen_host_pci_device_put(&s->real_device); return -1; } s->memory_listener = xen_pt_memory_listener; s->io_listener = xen_pt_io_listener; if ((s->real_device.domain == 0) && (s->real_device.bus == 0) && (s->real_device.dev == 2) && (s->real_device.func == 0)) { if (!is_igd_vga_passthrough(&s->real_device)) { XEN_PT_ERR(d, "Need to enable igd-passthru if you're trying" " to passthrough IGD GFX.\n"); xen_host_pci_device_put(&s->real_device); return -1; } if (xen_pt_setup_vga(s, &s->real_device) < 0) { XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n"); xen_host_pci_device_put(&s->real_device); return -1; } xen_igd_passthrough_isa_bridge_create(s, &s->real_device); } xen_pt_register_regions(s, &cmd); if (xen_pt_config_init(s)) { XEN_PT_ERR(d, "PCI Config space initialisation failed.\n"); xen_host_pci_device_put(&s->real_device); return -1; } rc = xen_host_pci_get_byte(&s->real_device, PCI_INTERRUPT_PIN, &scratch); if (rc) { XEN_PT_ERR(d, "Failed to read PCI_INTERRUPT_PIN! (rc:%d)\n", rc); scratch = 0; } if (!scratch) { XEN_PT_LOG(d, "no pin interrupt\n"); goto out; } machine_irq = s->real_device.irq; rc = xc_physdev_map_pirq(xen_xc, xen_domid, machine_irq, &pirq); if (rc < 0) { XEN_PT_ERR(d, "Mapping machine irq %u to pirq %i failed, (err: %d)\n", machine_irq, pirq, errno); cmd |= PCI_COMMAND_INTX_DISABLE; machine_irq = 0; s->machine_irq = 0; } else { machine_irq = pirq; s->machine_irq = pirq; xen_pt_mapped_machine_irq[machine_irq]++; } if (machine_irq != 0) { uint8_t e_intx = xen_pt_pci_intx(s); rc = xc_domain_bind_pt_pci_irq(xen_xc, xen_domid, machine_irq, pci_bus_num(d->bus), PCI_SLOT(d->devfn), e_intx); if (rc < 0) { XEN_PT_ERR(d, "Binding of interrupt %i failed! (err: %d)\n", e_intx, errno); cmd |= PCI_COMMAND_INTX_DISABLE; xen_pt_mapped_machine_irq[machine_irq]--; if (xen_pt_mapped_machine_irq[machine_irq] == 0) { if (xc_physdev_unmap_pirq(xen_xc, xen_domid, machine_irq)) { XEN_PT_ERR(d, "Unmapping of machine interrupt %i failed!" " (err: %d)\n", machine_irq, errno); } } s->machine_irq = 0; } } out: if (cmd) { uint16_t val; rc = xen_host_pci_get_word(&s->real_device, PCI_COMMAND, &val); if (rc) { XEN_PT_ERR(d, "Failed to read PCI_COMMAND! (rc: %d)\n", rc); } else { val |= cmd; rc = xen_host_pci_set_word(&s->real_device, PCI_COMMAND, val); if (rc) { XEN_PT_ERR(d, "Failed to write PCI_COMMAND val=0x%x!(rc: %d)\n", val, rc); } } } memory_listener_register(&s->memory_listener, &s->dev.bus_master_as); memory_listener_register(&s->io_listener, &address_space_io); s->listener_set = true; XEN_PT_LOG(d, "Real physical device %02x:%02x.%d registered successfully!\n", s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function); return 0; }
1threat
Legend of barplot in R : <p>I have a data in table like this <a href="https://i.stack.imgur.com/7gJN4.jpg" rel="nofollow noreferrer">I need a barplot for the same in R.</a>. So what I want is in the x-axis the High_score, Medium_score and Low_score should be plotted with the mean,max and standard deviation(means besides=TRUE )with three different color and the mean, max and SD should be represented in the legend. Can anyone please help me on this?</p>
0debug
How to skip the first item(s) of an iterator in Rust? : <p>When iterating over arguments (for example) thats the most straightforward way to skip the first <em>N</em> elements?</p> <p>eg:</p> <pre><code>use std::env; fn main() { for arg in env::args() { println!("Argument: {}", arg); } } </code></pre> <p>I tried <code>env::args()[1..]</code> but slicing isn't supported.</p> <p>Whats the simplest way to skip the first arguments of an iterator?</p>
0debug
static void gt64120_writel (void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { GT64120State *s = opaque; PCIHostState *phb = PCI_HOST_BRIDGE(s); uint32_t saddr; if (!(s->regs[GT_CPU] & 0x00001000)) val = bswap32(val); saddr = (addr & 0xfff) >> 2; switch (saddr) { case GT_CPU: s->regs[GT_CPU] = val; break; case GT_MULTI: break; case GT_PCI0IOLD: s->regs[GT_PCI0IOLD] = val & 0x00007fff; s->regs[GT_PCI0IOREMAP] = val & 0x000007ff; gt64120_pci_mapping(s); break; case GT_PCI0M0LD: s->regs[GT_PCI0M0LD] = val & 0x00007fff; s->regs[GT_PCI0M0REMAP] = val & 0x000007ff; break; case GT_PCI0M1LD: s->regs[GT_PCI0M1LD] = val & 0x00007fff; s->regs[GT_PCI0M1REMAP] = val & 0x000007ff; break; case GT_PCI1IOLD: s->regs[GT_PCI1IOLD] = val & 0x00007fff; s->regs[GT_PCI1IOREMAP] = val & 0x000007ff; break; case GT_PCI1M0LD: s->regs[GT_PCI1M0LD] = val & 0x00007fff; s->regs[GT_PCI1M0REMAP] = val & 0x000007ff; break; case GT_PCI1M1LD: s->regs[GT_PCI1M1LD] = val & 0x00007fff; s->regs[GT_PCI1M1REMAP] = val & 0x000007ff; break; case GT_PCI0IOHD: s->regs[saddr] = val & 0x0000007f; gt64120_pci_mapping(s); break; case GT_PCI0M0HD: case GT_PCI0M1HD: case GT_PCI1IOHD: case GT_PCI1M0HD: case GT_PCI1M1HD: s->regs[saddr] = val & 0x0000007f; break; case GT_ISD: s->regs[saddr] = val & 0x00007fff; gt64120_isd_mapping(s); break; case GT_PCI0IOREMAP: case GT_PCI0M0REMAP: case GT_PCI0M1REMAP: case GT_PCI1IOREMAP: case GT_PCI1M0REMAP: case GT_PCI1M1REMAP: s->regs[saddr] = val & 0x000007ff; break; case GT_CPUERR_ADDRLO: case GT_CPUERR_ADDRHI: case GT_CPUERR_DATALO: case GT_CPUERR_DATAHI: case GT_CPUERR_PARITY: break; case GT_PCI0SYNC: case GT_PCI1SYNC: break; case GT_SCS0LD: case GT_SCS0HD: case GT_SCS1LD: case GT_SCS1HD: case GT_SCS2LD: case GT_SCS2HD: case GT_SCS3LD: case GT_SCS3HD: case GT_CS0LD: case GT_CS0HD: case GT_CS1LD: case GT_CS1HD: case GT_CS2LD: case GT_CS2HD: case GT_CS3LD: case GT_CS3HD: case GT_BOOTLD: case GT_BOOTHD: case GT_ADERR: case GT_SDRAM_CFG: case GT_SDRAM_OPMODE: case GT_SDRAM_BM: case GT_SDRAM_ADDRDECODE: s->regs[saddr] = val; break; case GT_DEV_B0: case GT_DEV_B1: case GT_DEV_B2: case GT_DEV_B3: case GT_DEV_BOOT: DPRINTF ("Unimplemented device register offset 0x%x\n", saddr << 2); break; case GT_ECC_ERRDATALO: case GT_ECC_ERRDATAHI: case GT_ECC_MEM: case GT_ECC_CALC: case GT_ECC_ERRADDR: break; case GT_DMA0_CNT: case GT_DMA1_CNT: case GT_DMA2_CNT: case GT_DMA3_CNT: case GT_DMA0_SA: case GT_DMA1_SA: case GT_DMA2_SA: case GT_DMA3_SA: case GT_DMA0_DA: case GT_DMA1_DA: case GT_DMA2_DA: case GT_DMA3_DA: case GT_DMA0_NEXT: case GT_DMA1_NEXT: case GT_DMA2_NEXT: case GT_DMA3_NEXT: case GT_DMA0_CUR: case GT_DMA1_CUR: case GT_DMA2_CUR: case GT_DMA3_CUR: DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; case GT_DMA0_CTRL: case GT_DMA1_CTRL: case GT_DMA2_CTRL: case GT_DMA3_CTRL: DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; case GT_DMA_ARB: DPRINTF ("Unimplemented DMA register offset 0x%x\n", saddr << 2); break; case GT_TC0: case GT_TC1: case GT_TC2: case GT_TC3: case GT_TC_CONTROL: DPRINTF ("Unimplemented timer register offset 0x%x\n", saddr << 2); break; case GT_PCI0_CMD: case GT_PCI1_CMD: s->regs[saddr] = val & 0x0401fc0f; break; case GT_PCI0_TOR: case GT_PCI0_BS_SCS10: case GT_PCI0_BS_SCS32: case GT_PCI0_BS_CS20: case GT_PCI0_BS_CS3BT: case GT_PCI1_IACK: case GT_PCI0_IACK: case GT_PCI0_BARE: case GT_PCI0_PREFMBR: case GT_PCI0_SCS10_BAR: case GT_PCI0_SCS32_BAR: case GT_PCI0_CS20_BAR: case GT_PCI0_CS3BT_BAR: case GT_PCI0_SSCS10_BAR: case GT_PCI0_SSCS32_BAR: case GT_PCI0_SCS3BT_BAR: case GT_PCI1_TOR: case GT_PCI1_BS_SCS10: case GT_PCI1_BS_SCS32: case GT_PCI1_BS_CS20: case GT_PCI1_BS_CS3BT: case GT_PCI1_BARE: case GT_PCI1_PREFMBR: case GT_PCI1_SCS10_BAR: case GT_PCI1_SCS32_BAR: case GT_PCI1_CS20_BAR: case GT_PCI1_CS3BT_BAR: case GT_PCI1_SSCS10_BAR: case GT_PCI1_SSCS32_BAR: case GT_PCI1_SCS3BT_BAR: case GT_PCI1_CFGADDR: case GT_PCI1_CFGDATA: break; case GT_PCI0_CFGADDR: phb->config_reg = val & 0x80fffffc; break; case GT_PCI0_CFGDATA: if (!(s->regs[GT_PCI0_CMD] & 1) && (phb->config_reg & 0x00fff800)) { val = bswap32(val); } if (phb->config_reg & (1u << 31)) { pci_data_write(phb->bus, phb->config_reg, val, 4); } break; case GT_INTRCAUSE: s->regs[saddr] = ~(~(s->regs[saddr]) | ~(val & 0xfffffffe)); s->regs[saddr] |= !!(s->regs[saddr] & 0xfffffffe); DPRINTF("INTRCAUSE %" PRIx64 "\n", val); break; case GT_INTRMASK: s->regs[saddr] = val & 0x3c3ffffe; DPRINTF("INTRMASK %" PRIx64 "\n", val); break; case GT_PCI0_ICMASK: s->regs[saddr] = val & 0x03fffffe; DPRINTF("ICMASK %" PRIx64 "\n", val); break; case GT_PCI0_SERR0MASK: s->regs[saddr] = val & 0x0000003f; DPRINTF("SERR0MASK %" PRIx64 "\n", val); break; case GT_HINTRCAUSE: case GT_CPU_INTSEL: case GT_PCI0_INTSEL: case GT_HINTRMASK: case GT_PCI0_HICMASK: case GT_PCI1_SERR1MASK: break; case GT_SDRAM_B0: case GT_SDRAM_B1: case GT_SDRAM_B2: case GT_SDRAM_B3: s->regs[saddr] = val; break; default: DPRINTF ("Bad register offset 0x%x\n", (int)addr); break; } }
1threat
How to add new value to database column without deleting old data : <p>I want to add data to mysql table without removing old data of that column</p> <p>stock = 50 now i want to add 5 more so i want to get result in table as: stock = 50+5 or stock=60 how i can do this in SQL</p>
0debug
def check(string) : p = set(string) s = {'0', '1'} if s == p or p == {'0'} or p == {'1'}: return ("Yes") else : return ("No")
0debug
Make a int number by elements of a array. C code : I have a keypad that connects to lcd by atmega32 avr. I writes its lcd and keypad functions well. But now i have a problem; I store entered key by keypad in a array name l[i].i take numbers by while loop. Operator only can enter number under 999. For example operator enter 2 then 6,then9. My Array is l[3]={2,6,9}. Now i wanna make a int number y=269. How can i? I wanna can do it for 1-3 digit numbers. Keypad can put 0-999 numbers. Thanks
0debug
Enabling Microsoft's Code Analysis on .NET Core Projects : <p>Our team uses the Code Analysis feature with a custom ruleset to cause our build to fail if we forget to do things like null checks on method arguments.</p> <p>However, now as we create a new .NET Core project, it doesn't look like Code Analysis is a feature of these new projects. There is no UI for it in the Project Properties area, and adding a custom ruleset to the project <a href="https://stackoverflow.com/a/43227687/120955">as recommended here</a> only appears to affect StyleCop Analyzers (the <code>SAxxxx</code> rules).</p> <p>Is there any way to enable Code Analysis (<code>CAxxxx</code>) rules in a .NET Core project?</p>
0debug
static uint64_t hpdmc_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistHpdmcState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_SYSTEM: case R_BYPASS: case R_TIMING: case R_IODELAY: r = s->regs[addr]; break; default: error_report("milkymist_hpdmc: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_hpdmc_memory_read(addr << 2, r); return r; }
1threat
iTextSharp: Any support for dotnet core (netstandard1.6)? : <p>I've been using iTextSharp with regular dotnet applications for a while now. We're interested in using it with dotnet core. But it seems that the library is still not supported on the new dotnet core platform: </p> <p>Package iTextSharp 5.5.10 is not compatible with netstandard1.6</p> <p>Do you plan to support dotnet core in a future release?</p>
0debug
How to use enum as props in react/typescript : <p>I have the following enum</p> <pre><code>export enum Sizes{ Small, Large } </code></pre> <p>which is getting used in my <code>&lt;Demo/&gt;</code> component's props interface:</p> <pre><code>export interface IProps{ Label?: string; Size: SizeEnum; } </code></pre> <p>My question is, when I use this <code>&lt;Demo Size={how do i define size here?} /&gt;</code>?</p>
0debug
chart.js Failed to create chart: can't acquire context from the given item : <p>I never got into node so I am pretty sure I am doing something massively wrong here since I cannot find any info at all by googling. </p> <p>I have a django site and I wanted a JS charting library, I chose chart.js. </p> <p>I installed and like the docs, but after that I am unsure of what to do so I tried to fill in the blanks and follow their guide as much as possible. Here is what my html looks like....</p> <pre><code>&lt;script src="/public/node_modules/chart.js/dist/Chart.js"&gt;&lt;/script&gt; &lt;canvas id="myChart" width="400" height="400"&gt;&lt;/canvas&gt; &lt;script&gt; var ctx = document.getElementById("myChart"); console.log(ctx); var options = {} var data = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [ { label: "My First dataset", fill: false, lineTension: 0.1, backgroundColor: "rgba(75,192,192,0.4)", borderColor: "rgba(75,192,192,1)", borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0.0, borderJoinStyle: 'miter', pointBorderColor: "rgba(75,192,192,1)", pointBackgroundColor: "#fff", pointBorderWidth: 1, pointHoverRadius: 5, pointHoverBackgroundColor: "rgba(75,192,192,1)", pointHoverBorderColor: "rgba(220,220,220,1)", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 10, data: [65, 59, 80, 81, 56, 55, 40], spanGaps: false, } ] }; var myChart = new Chart({ type: 'line', data: data, options: options }) &lt;/script&gt; </code></pre> <p>I am just trying to get an example working. I put the node_modules directory that was downloaded via npm somewhere where my server would serve them up....and verified they are being served, but then I get this error when I try to build a chart. I took all the chart codes from their docs so I am pretty sure that part is right, but I can't see why I am getting this error.</p>
0debug
Allow Underscores at the start and end of Usernames : <p>Looking to see how I can edit the Username creation process to allow underscores and hyphens at the beginning and end of usernames.</p> <p>Currently, if you end your username with a _, it drops it from the creation process.</p> <pre><code>$regex = '/^[A-Za-z0-9]+[A-Za-z0-9_.]*[A-Za-z0-9]+$/'; if(!preg_match($regex, $_POST['username'])) { $_SESSION['error'][] = $language-&gt;register-&gt;error_message-&gt;username_characters; } </code></pre>
0debug
int ff_copy_whitelists(AVFormatContext *dst, AVFormatContext *src) { av_assert0(!dst->codec_whitelist && !dst->format_whitelist); dst-> codec_whitelist = av_strdup(src->codec_whitelist); dst->format_whitelist = av_strdup(src->format_whitelist); if ( (src-> codec_whitelist && !dst-> codec_whitelist) || (src->format_whitelist && !dst->format_whitelist)) { av_log(dst, AV_LOG_ERROR, "Failed to duplicate whitelist\n"); return AVERROR(ENOMEM); } return 0; }
1threat
C# unit tests for verifying existing data in SQL server : <p>I am using Visual Studio Unit test framework for writing the unit tests to verify existing base data in the database. The data is very important to our team and we want to make sure at all times that the data is not changed. </p> <p>Any guidance on how to write these type of tests? </p>
0debug
static uint32_t set_allocation_state(sPAPRDRConnector *drc, sPAPRDRAllocationState state) { sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); trace_spapr_drc_set_allocation_state(get_index(drc), state); if (state == SPAPR_DR_ALLOCATION_STATE_USABLE) { if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } if (drc->awaiting_release && drc->awaiting_allocation) { drc->awaiting_allocation_skippable = true; return RTAS_OUT_NO_SUCH_INDICATOR; } } if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->allocation_state = state; if (drc->awaiting_release && drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { trace_spapr_drc_set_allocation_state_finalizing(get_index(drc)); drck->detach(drc, DEVICE(drc->dev), drc->detach_cb, drc->detach_cb_opaque, NULL); } else if (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE) { drc->awaiting_allocation = false; } } return RTAS_OUT_SUCCESS; }
1threat
Undo last Alembic migration : <p>I created a migration with <code>alembic revision --autogenerate</code>, applied it to my development database with <code>alembic upgrade head</code>, and then realised it wasn't quite what I wanted.</p> <p>How can I revert the migration so that I can tweak it and try again?</p>
0debug
How to print the solution of an equation inputted as a String in Java : <p>How to input a string such as : "1+2/3*2" To give the output as 2.333</p> <p>Basically I want to input a string which is a mathematical equation and output the answer using BODMAS . I've tried breaking the string into an array of operands and an array of operators in the same order but I'm unable to do the BODMAS part.</p>
0debug
HTML , body on android device not show correctly : my site on desktop looks great but on android no. u can see the image . and my site URL is http://alkhayatt.com i use bootstrap 3 and RTL and theme. my code is normal i don't know why that happen. i did lot of try but nothing work , i change classes and make another <div>. bootstrap 3 Arabic good style css . [img2][2] [2]: https://i.stack.imgur.com/5MACV.png
0debug
static int ftp_send_command(FTPContext *s, const char *command, const int response_codes[], char **response) { int err; ff_dlog(s, "%s", command); if (response) *response = NULL; if ((err = ffurl_write(s->conn_control, command, strlen(command))) < 0) return err; if (!err) return -1; if (response_codes) { return ftp_status(s, response, response_codes); } return 0; }
1threat
How can i use Chart.js to build Piecharts for Bonita Soft : Please How can i use `Chart.js` to make charts (Pie charts, Bar charts etc) and use in Bonita BPM solution
0debug
How/Where does JavaScript detect the default locale? : <p>Today, the 11th of September, 2017, JavaScript's <code>toLocaleDateString()</code> method is outputting <code>9/11/2017</code> for me. But I am in the UK, so the formatting is wrong in this case. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString" rel="noreferrer">MDN Web Docs</a> tell me that this method returns "a formatted string in the default locale".</p> <p>So, where/how is JavaScript detecting my default locale? Where is this set, or what does it depend on, and (how) can I change it?</p> <p>Edited to add: I'm using Firefox 55.0.3 on Windows 10 if that makes any difference.</p>
0debug
Android TabbedActivity randomly shows fragments but is most of the time blank : I created a TabbedActivity with some fragments, these fragments sometimes load and sometimes they dont, i've searched everywhere but couldn't find the issue. [Example gif][1] **This is my main activity:** package <....>; import <....>; public class TwitterActivity extends AppCompatActivity implements MessagesFragment.OnFragmentInteractionListener, NotificationFragment.OnFragmentInteractionListener, ProfileFragment.OnFragmentInteractionListener, TimeLineFragment.OnFragmentInteractionListener { private static final String APP_TAG = "Twitter"; private SectionsPagerAdapter mSectionsPagerAdapter; private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(null); setContentView(R.layout.activity_twitter); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(3); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager)); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { int position = tab.getPosition(); if(position == 0){ toolbarTitle.setText(R.string.tab_timeline); }else if(position == 1){ toolbarTitle.setText(R.string.tab_messages); }else if(position == 2){ toolbarTitle.setText(R.string.tab_notifications); }else if(position == 3){ toolbarTitle.setText(R.string.tab_profile); } } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); tabLayout.setupWithViewPager(mViewPager, false); } @Override public void onFragmentInteraction(Uri uri) { } public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Log.d(APP_TAG, String.valueOf(position)); if(position == 0){ return TimeLineFragment.newInstance(); }else if(position == 1){ return MessagesFragment.newInstance(); }else if(position == 2){ return NotificationFragment.newInstance(); }else if(position == 3){ return ProfileFragment.newInstance(); } return null; } @Override public int getCount() { return 4; } @Nullable @Override public CharSequence getPageTitle(int position) { switch (position){ case 0: return getString(R.string.tab_timeline); case 1: return getString(R.string.tab_messages); case 2: return getString(R.string.tab_notifications); case 3: return getString(R.string.tab_profile); default: return getString(R.string.tab_timeline); } } } } **This is one of my fragments (They are all the same):** package <....>; import <....>; public class TimeLineFragment extends Fragment { private OnFragmentInteractionListener mListener; public TimeLineFragment() { } public static TimeLineFragment newInstance() { TimeLineFragment fragment = new TimeLineFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_time_line, container, false); } public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof OnFragmentInteractionListener) { mListener = (OnFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } public interface OnFragmentInteractionListener { void onFragmentInteraction(Uri uri); } } **This is my main activity's layout file:** <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".activities.TwitterActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="25dp" android:layout_height="25dp" android:src="@mipmap/ic_launcher" /> <TextView android:id="@+id/toolbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="@string/tab_timeline" android:textSize="18sp" android:textStyle="bold" /> </RelativeLayout> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:elevation="80dp" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="56dp" app:tabGravity="fill" app:tabIndicatorColor="@android:color/holo_orange_dark" app:tabIndicatorHeight="0dp" app:tabMode="fixed"> <android.support.design.widget.TabItem android:id="@+id/tabItem" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tab_text_1" /> <android.support.design.widget.TabItem android:id="@+id/tabItem2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tab_text_2" /> <android.support.design.widget.TabItem android:id="@+id/tabItem3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/tab_text_3" /> </android.support.design.widget.TabLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/container" android:layout_width="match_parent" android:layout_height="100dp" android:layout_above="@+id/tabs" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.CoordinatorLayout> Please help me :C [1]: https://imgur.com/wQ3nKZC
0debug
Python syntax error after using multiple print functions : <p>I have just begun teaching myself Python for a project I am working on. This may be a fairly rookie question, but is there a limit to the number of times you can use the Print function? My code is using Print to request input from the user, however a syntax error (invalid syntax) appears at the 6th instance. As far as I can tell there are no mistakes in/around the line. I am using Python 3.4.4.</p> <p>The problem line is;</p> <pre><code>print('What is the isentropic efficiency of the intake?') </code></pre> <p>The whole exert from the code is;</p> <pre><code># Define cycle print('What is the cruise altitude (m)?') altitude = float(input()) print('What is the cruise Mach number?') print('What is the mass flow?') W = float(input()) mach0 = float(input()) print('What is the OPR?') OPR = float(input()) print('What is the TET?') TET = float(input()) gamma = 1.4 Cp = 1000 # Calculate the freestream properties based on ISA if altitude &lt; 11000: t0 = 288.15 - (6.5*(altitude/1000)) p0 = 101325*((1-(0.0065*(altitude/288.15)))**5.2561) else: t0 = 288.15 - (6.5*11) p0 = (101325*((1-(0.0065*(11000/288.15)))**5.2561))*math.exp((-9.80665*(altitude-11000))/(287.04*t0)) # Calculate Intake Performance T0 = t0*(1+(((gamma-1)/2)*(mach0**2))) P0 = p0*((T0/t0)**(gamma/(gamma-1)) print('What is the isentropic efficiency of the intake?') eta_intake = float(input()) T2 = T0*(1+(((gamma-1)/2)*eta_intake*(mach0**2))) P2 = P0*((T2/T0)**(gamma/(gamma-1)) </code></pre>
0debug
ssl on custom domain for heroku app : <p>I want to connect a custom domain to an app built on Heroku. Can someone confirm that I actually need to buy a certificate and in addition buy the SSL addon on Heroku?</p> <p>Do I need both or is one of them enough? What is the point of the addon?</p> <p>/Knut</p>
0debug
Is there any Javascript library that can validate html? : <p>What I am trying to get is very simple: I have a textbox in my website where i can use html and when i press the "Send" button, the value in that textbox is send to the website. But sometimes a user comes to the site, writes html and forgets to close the tag for example, messing up completly my site. In order to solve this problem, all i want is a validator that when the button is clicked, it checks whatever was written and inspects if something is incorrect and presents a solution to correct the html problem. I've seen plataforms like <a href="https://validator.w3.org/docs/api.html" rel="nofollow noreferrer">https://validator.w3.org/docs/api.html</a> that do exactly what i want but can i use it in my own site?</p> <p>I tried to do something in my own with Javascript but it's very complex and has a lot of issues.</p> <p>Can please someone help me?</p>
0debug
void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value) { qdev_prop_set(dev, name, &value, PROP_TYPE_PTR); }
1threat
How to implement Stripe with React Native? : <p>I have researched on how to implement Stripe using React native, but have not found a solid way to so. Apparently, React Native does not support http module so would have to use Stripe API using <code>fetch</code> (as explained in <a href="http://blog.bigbinary.com/2015/11/03/using-stripe-api-in-react-native-with-fetch.html" rel="noreferrer">http://blog.bigbinary.com/2015/11/03/using-stripe-api-in-react-native-with-fetch.html</a>).</p> <p>So my question is, is using fetch method to Stripe API endpoints a good alternative to <code>stripe.js</code>? And would I be missing out on anything by not using <code>stripe.js</code>? Also, is <code>stripe.js</code> another name for the Stripe SDK? </p> <p>Lastly, by using fetch to Stripe API endpoints in place of <code>stripe.js</code>, would it still be considered a fully PCI-compliant integration as described in <a href="https://stripe.com/docs/security" rel="noreferrer">https://stripe.com/docs/security</a> ?</p> <p>Thank you in advance</p>
0debug
Python: Return tuples from function and print them vertically : I have a list of tuples, for example q = [(Nick,21),(George,41),(Paul,15)] and I am returning them from a function. An html form is using this function and with the right parameters is printing/showing what the function has returned. But instead of: | Name | Age | | Nick | 21 | | George | 41 | | Paul | 15 | , it's printing: | Name | Age | | Nick | 21 | George | 41 | Paul | 15 | Also, the function returns the q like this: return [("Name", "Age"), q] How can I print the q like the first way? Thanks
0debug
static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic, const uint8_t *data, int data_size) { int stream_ptr = 0; unsigned char rle_code; unsigned char extra_byte, odd_pixel; unsigned char stream_byte; int pixel_ptr = 0; int row_dec = pic->linesize[0]; int row_ptr = (avctx->height - 1) * row_dec; int frame_size = row_dec * avctx->height; int i; while (row_ptr >= 0) { FETCH_NEXT_STREAM_BYTE(); rle_code = stream_byte; if (rle_code == 0) { FETCH_NEXT_STREAM_BYTE(); if (stream_byte == 0) { row_ptr -= row_dec; pixel_ptr = 0; } else if (stream_byte == 1) { return 0; } else if (stream_byte == 2) { FETCH_NEXT_STREAM_BYTE(); pixel_ptr += stream_byte; FETCH_NEXT_STREAM_BYTE(); row_ptr -= stream_byte * row_dec; } else { odd_pixel = stream_byte & 1; rle_code = (stream_byte + 1) / 2; extra_byte = rle_code & 0x01; if (row_ptr + pixel_ptr + stream_byte > frame_size) { av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n"); return -1; } for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; FETCH_NEXT_STREAM_BYTE(); pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4; pixel_ptr++; if (i + 1 == rle_code && odd_pixel) break; if (pixel_ptr >= avctx->width) break; pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } if (extra_byte) stream_ptr++; } } else { if (row_ptr + pixel_ptr + stream_byte > frame_size) { av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n"); return -1; } FETCH_NEXT_STREAM_BYTE(); for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; if ((i & 1) == 0) pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4; else pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } } } if (stream_ptr < data_size) { av_log(avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n", stream_ptr, data_size); return -1; } return 0; }
1threat
static void slirp_bootp_load(QEMUFile *f, Slirp *slirp) { int i; for (i = 0; i < NB_BOOTP_CLIENTS; i++) { slirp->bootp_clients[i].allocated = qemu_get_be16(f); qemu_get_buffer(f, slirp->bootp_clients[i].macaddr, 6); } }
1threat
Fonction was used before it was defined : i have a problem in mu javascript so, look the picture for more information [enter image description here][1] [1]: https://i.stack.imgur.com/Km7E6.png and when o add this comment /*jslint latedef:false*/ the error fixed but it's show a new error [enter image description here][2] [2]: https://i.stack.imgur.com/C813g.png
0debug
static int pci_bridge_dev_initfn(PCIDevice *dev) { PCIBridge *br = DO_UPCAST(PCIBridge, dev, dev); PCIBridgeDev *bridge_dev = DO_UPCAST(PCIBridgeDev, bridge, br); int err; pci_bridge_map_irq(br, NULL, pci_bridge_dev_map_irq_fn); err = pci_bridge_initfn(dev); if (err) { goto bridge_error; } memory_region_init(&bridge_dev->bar, "shpc-bar", shpc_bar_size(dev)); err = shpc_init(dev, &br->sec_bus, &bridge_dev->bar, 0); if (err) { goto shpc_error; } err = slotid_cap_init(dev, 0, bridge_dev->chassis_nr, 0); if (err) { goto slotid_error; } if ((bridge_dev->flags & (1 << PCI_BRIDGE_DEV_F_MSI_REQ)) && msi_supported) { err = msi_init(dev, 0, 1, true, true); if (err < 0) { goto msi_error; } } pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &bridge_dev->bar); dev->config[PCI_INTERRUPT_PIN] = 0x1; return 0; msi_error: slotid_cap_cleanup(dev); slotid_error: shpc_cleanup(dev, &bridge_dev->bar); shpc_error: memory_region_destroy(&bridge_dev->bar); bridge_error: return err; }
1threat
Transform Get from api in async : Good afternoon, im trying transform my action get all users to async but when i run, show me per example 2 users but without name email etc, but they're there because show edit and delete. This is my code; public IActionResult Index() { IEnumerable<User> users = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:5000/api/"); //HTTP GET var responseTask = client.GetAsync("users/"); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync<IList<User>>(); readTask.Wait(); users = readTask.Result; } else //web api sent error response { //log response status here.. users = Enumerable.Empty<User>(); ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); } } return View(users); } What i try to transform in async; public async Task<IActionResult> Index() { IEnumerable<User> users = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:5000/api/"); //HTTP GET var response = await client.GetAsync("users/"); if (response.IsSuccessStatusCode) { var resulString = await response.Content.ReadAsStreamAsync(); users = await JsonSerializer.DeserializeAsync<IEnumerable<User>>(resulString); } else { ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); } } return View(users); }
0debug
static void decode_nal_sei_frame_packing_arrangement(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; int cancel, type, quincunx, content; get_ue_golomb(gb); cancel = get_bits1(gb); if (cancel == 0) { type = get_bits(gb, 7); quincunx = get_bits1(gb); content = get_bits(gb, 6); skip_bits(gb, 6); if (quincunx == 0 && type != 5) skip_bits(gb, 16); skip_bits(gb, 8); skip_bits1(gb); } skip_bits1(gb); s->sei_frame_packing_present = (cancel == 0); s->frame_packing_arrangement_type = type; s->content_interpretation_type = content; s->quincunx_subsampling = quincunx; }
1threat
Measure time of query in Mongo : <p>How can I measure execution time of query in MongoDB ? I found Mongo-hacker plugin but it looks like it measure time of query including time of displaying all results. In PostgreSQL I use Explain Analyze SELECT ... , but i didn't found any information about time in mongo's db.collection.find({smth}).explain()</p>
0debug
static void qemu_chr_parse_mux(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *chardev = qemu_opt_get(opts, "chardev"); ChardevMux *mux; if (chardev == NULL) { error_setg(errp, "chardev: mux: no chardev given"); return; } mux = backend->u.mux = g_new0(ChardevMux, 1); qemu_chr_parse_common(opts, qapi_ChardevMux_base(mux)); mux->chardev = g_strdup(chardev); }
1threat
How to parameterize image version when passing yaml for container creation : <p>Is there any way to pass image version from a varibale/config when passing a manifest .yaml to kubectl command</p> <p>Example : </p> <pre><code>apiVersion: v1 kind: ReplicationController metadata: name: nginx spec: replicas: 1 selector: app: nginx template: metadata: name: nginx labels: app: nginx spec: containers: - name: nginx image: nginx:${IMAGE_VERSION} imagePullPolicy: Always resources: limits: cpu: "1.2" memory: 100Mi ports: - containerPort: 80 </code></pre> <p>Use case is to launch specific image version which is set at kubernetes level, and that the variable is resolved by kubernetes itself at server side.</p> <p>Thanks and Regards, Ravi</p>
0debug
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; gs = 0; if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; } } else { int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { mant <<= 24 - bits; if (!log_gain) { mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
1threat
static void address_space_update_topology_pass(AddressSpace *as, const FlatView *old_view, const FlatView *new_view, bool adding) { unsigned iold, inew; FlatRange *frold, *frnew; iold = inew = 0; while (iold < old_view->nr || inew < new_view->nr) { if (iold < old_view->nr) { frold = &old_view->ranges[iold]; } else { frold = NULL; } if (inew < new_view->nr) { frnew = &new_view->ranges[inew]; } else { frnew = NULL; } if (frold && (!frnew || int128_lt(frold->addr.start, frnew->addr.start) || (int128_eq(frold->addr.start, frnew->addr.start) && !flatrange_equal(frold, frnew)))) { if (!adding) { MEMORY_LISTENER_UPDATE_REGION(frold, as, Reverse, region_del); } ++iold; } else if (frold && frnew && flatrange_equal(frold, frnew)) { if (adding) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_nop); if (frold->dirty_log_mask && !frnew->dirty_log_mask) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Reverse, log_stop); } else if (frnew->dirty_log_mask && !frold->dirty_log_mask) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, log_start); } } ++iold; ++inew; } else { if (adding) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_add); } ++inew; } } }
1threat
Symfony2 and AngularJS. Can anyone explain me? : <p>how are you going? Came here to ask you how symfony2 and angularjs can work together, because I tried to find and read about it on google and others, but I still can't understand at all. -Is it possible? -If it is possible, what are the advantages and disadvantages? -symfony2-jquery or symfony2-angularjs? or both(i still don't underestand)?.. -What about twig? how can I work with the {{}} of angular (just explain me how, not the implementation)?</p>
0debug
unfortunately has stopped error on real devic issue : I make an app. it works correctly on emulator. but it go to 'unfortunately has stopped' on real device , specially when i want to go from an activity to another one. and I'm searching for an app or sonthing to save logs or anythig can help me to find the solution to resolve my issue. can anyone help me or introduce an app to me, or share your experience about the same problems.
0debug
static inline void gdb_continue(GDBState *s) { #ifdef CONFIG_USER_ONLY s->running_state = 1; #else vm_start(); #endif }
1threat
set dynamic 'initialRouteName' in react-native : <p>question is simple I know there are lots of answers available for the same question but I have differently set my own <code>App.js</code> file i tried almost all but no success.</p> <p>so my <code>App.js</code> looks like this </p> <pre><code>import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View, StatusBar } from 'react-native'; import { createStackNavigator } from 'react-navigation'; import { Header, Button, Spinner } from './src/components/comman'; import SplashScreen from 'react-native-splash-screen'; import LoginForm from './src/components/LoginForm'; import SignupForm from './src/components/SignupForm'; import Home from './src/components/Home'; import ForgetPassword from './src/components/ForgetPassword'; import { YellowBox } from 'react-native'; YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']); const App = createStackNavigator ({ Login: { screen: LoginForm }, Home: { screen: Home }, Signup: { screen: SignupForm }, ForgetPassword: { screen : ForgetPassword }, }, { initialRouteName: 'Login', }); export default App; </code></pre> <p>Now I store login state in <code>AsyncStorage</code> in my <code>LoginForm.js</code> like this </p> <pre><code>. . AsyncStorage.setItem('isLoggedIn', 'true').then((a) =&gt; { this.onLoginSuccess(responseData.user_id); }); . . </code></pre> <p>so now i want to set <code>initialRouteName</code> based on my local storage element. Simple if <code>isLoggedIn</code> is <code>true</code> then <code>initialRouteName : Home</code> otherwise <code>initialRouteName : Login</code></p> <p>Simple but don't how to use this in <code>my</code> <code>App.js</code> </p> <p>Please help :)</p>
0debug
bool migration_has_finished(MigrationState *s) { return s->state == MIG_STATE_COMPLETED; }
1threat
Angular2: Property 'controls' does not exist on type 'AbstractControl'. Error when accessing .control of an object within a formarray thru an index : <p>I'm trying to push another formbuilder within a formarray but it gives me an error since I think there are no items in the array when initializing the code, hence there are no controls. The error is Property 'controls' does not exist on type 'AbstractControl' after the</p> <pre><code>(&lt;FormArray&gt;this.loanTypeForm.controls['frequency']).controls[index] </code></pre> <p>I'm using angular 2.0.0-beta.17</p> <pre><code>let settingsForm: FormArray = new FormArray([]); (&lt;FormArray&gt;this.loanTypeForm.controls['frequency']).push( this.formBuilder.group({ 'name': [value, Validators.required], 'settings': settingsForm, }) ); (&lt;FormArray&gt;this.loanTypeForm.controls['frequency']).controls[index].controls['settings'].push( this.formBuilder.group({ 'term': [null, Validators.required], 'eir': [null, Validators.required], }) ); </code></pre>
0debug
Accessing bootstrap scss variables in angular 2 component : <p>I'm working on a new Angular2 project built using Angular CLI and have configured the project to use SCSS. I have Bootstrap 4 successfully loaded into my <code>styles.scss</code> file however if I try and access any of Bootstrap's (or my own variables defined in <code>styles.scss</code> from within a component I get <code>Undefined Variable</code> build error. </p> <p>Are the style files for components compiled before the main entry in the <code>styles</code> node of <code>angular-cli.json</code>? How can I make is so that any variables defined at that global level are available to all components in the application? Thanks!</p> <p><strong>angular-cli.json</strong></p> <pre><code>"apps": [ { ... "styles": [ "styles/styles.scss" ], ... } ] </code></pre> <p><strong>styles.scss</strong></p> <pre><code>// Bootstrap $enable-flex: true; // Enable Flexbox mode @import "../../node_modules/bootstrap/scss/bootstrap"; </code></pre> <p><strong>component</strong></p> <pre><code>.navbar { background: $brand-primary; // Undefined variable here } </code></pre>
0debug
static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AC3DecodeContext *s = avctx->priv_data; int16_t *out_samples = (int16_t *)data; int blk, ch, err; const uint8_t *channel_map; const float *output[AC3_MAX_CHANNELS]; if (s->input_buffer) { memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE)); init_get_bits(&s->gbc, s->input_buffer, buf_size * 8); } else { init_get_bits(&s->gbc, buf, buf_size * 8); } *data_size = 0; err = parse_frame_header(s); if(s->frame_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; } if(err != AAC_AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_recognition >= FF_ER_CAREFUL) { if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) { av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); err = AAC_AC3_PARSE_ERROR_CRC; } } if(err && err != AAC_AC3_PARSE_ERROR_CRC) { switch(err) { case AAC_AC3_PARSE_ERROR_SYNC: av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); return -1; case AAC_AC3_PARSE_ERROR_BSID: av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); break; case AAC_AC3_PARSE_ERROR_SAMPLE_RATE: av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_SIZE: av_log(avctx, AV_LOG_ERROR, "invalid frame size\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_TYPE: if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n"); return s->frame_size; } else { av_log(avctx, AV_LOG_ERROR, "invalid frame type\n"); } break; default: av_log(avctx, AV_LOG_ERROR, "invalid header\n"); break; } } if (!err) { avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; s->out_channels = s->channels; s->output_mode = s->channel_mode; if(s->lfe_on) s->output_mode |= AC3_OUTPUT_LFEON; if (avctx->request_channels > 0 && avctx->request_channels <= 2 && avctx->request_channels < s->channels) { s->out_channels = avctx->request_channels; s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; s->channel_layout = ff_ac3_channel_layout_tab[s->output_mode]; } avctx->channels = s->out_channels; avctx->channel_layout = s->channel_layout; if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && s->fbw_channels == s->out_channels)) { set_downmix_coeffs(s); } } else if (!s->out_channels) { s->out_channels = avctx->channels; if(s->out_channels < s->channels) s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; } channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; for (ch = 0; ch < s->out_channels; ch++) output[ch] = s->output[channel_map[ch]]; for (blk = 0; blk < s->num_blocks; blk++) { if (!err && decode_audio_block(s, blk)) { av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels); out_samples += 256 * s->out_channels; } *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t); return s->frame_size; }
1threat
I want to print list of element within a loop : <p>I have some List of web element and I want to print all the elements inside one loop.How can I do this?.I am not sure how to do..Below i put my code that is not work.. Any help will be appreciated</p> <pre><code>List&lt;WebElement&gt; Pid=wd.findElements(By.xpath(".//*[@class='optimizely-propertyid recommend-row-target']")); List&lt;WebElement&gt; Ptitle=wd.findElements(By.xpath(".//*[@class='see-the-world-des listing-thumb-title property-wide-block-title']/a")); List&lt;WebElement&gt; Pprice=wd.findElements(By.xpath(".//*[@class='see-the-world-price-image list-view']/a/span")); List&lt;WebElement&gt; psleeps=wd.findElements(By.xpath(".//*[@class='see-the-world-price with-rating']/span/a")); List&lt;WebElement&gt; Prating=wd.findElements(By.xpath(".//*[@class='rating-text']")); for(WebElement e:Pid){ System.out.println(e.getText()); System.out.println(e.Ptitle.getText()); System.out.println(Pprice.getText()); } </code></pre>
0debug
What is Type in angular 2? : <p>I have come across the <code>Type</code> keyword at many places in the documentation. For example <a href="https://angular.io/docs/ts/latest/api/core/index/ComponentRef-class.html#!#componentType-anchor" rel="noreferrer">as seen here</a> <code>ComponentRef</code> has the <code>componentType</code> property. It is said to be of type <code>Type&lt;any&gt;</code>. On further searching I find <a href="https://angular.io/docs/ts/latest/api/core/index/Type-decorator.html" rel="noreferrer">this entry</a> about it on the docs. It says: <em>Invoke as ES7 decorator</em>.</p> <p>Also on looking <a href="https://github.com/angular/angular/blob/2.0.1/modules/%40angular/core/src/type.ts#L19-L19" rel="noreferrer">up the source</a> on github , I find these comments :</p> <pre><code>/** * @whatItDoes Represents a type that a Component or other object is instances of. * * @description * * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by * the `MyCustomComponent` constructor function. </code></pre> <p>However I am still not clear as to what <code>Type</code> does. Am I missing something basic ?? </p>
0debug
int qemu_register_machine(QEMUMachine *m) { TypeInfo ti = { .name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL), .parent = TYPE_MACHINE, .class_init = machine_class_init, .class_data = (void *)m, }; type_register(&ti); return 0; }
1threat
Linq Query to Sum into new list : <p>I want to create a 2nd list from 1st list to show the sum with descending order.</p> <pre><code>1st list : ID Value 1 20 2 40 3 10 2nd List: ID Value 1 70 2 50 3 10 </code></pre>
0debug
static int kvm_get_xcrs(CPUState *env) { #ifdef KVM_CAP_XCRS int i, ret; struct kvm_xcrs xcrs; if (!kvm_has_xcrs()) return 0; ret = kvm_vcpu_ioctl(env, KVM_GET_XCRS, &xcrs); if (ret < 0) return ret; for (i = 0; i < xcrs.nr_xcrs; i++) if (xcrs.xcrs[0].xcr == 0) { env->xcr0 = xcrs.xcrs[0].value; break; } return 0; #else return 0; #endif }
1threat
How can I disable or hide the scrollbar within an Ionic 2 <ion-content> : <p>I have an Angular 2 app wrapped in Ionic 2. I'm using <code>&lt;ion-tabs&gt;</code>, and within each tab is an <code>&lt;ion-content&gt;</code>. The content in this area needs to be scrollable, but Ionic 2 adds a scrollbar that I don't want displayed. It appears that, when compiled, an <code>&lt;ion-content&gt;</code> has a <code>&lt;scroll-content&gt;</code> injected into it. I don't want this behavior. </p> <p>I have tried many of the solutions that <em>used to</em> work in Ionic 1, but they do not work in Ionic 2:</p> <ul> <li>Setting <code>scroll="false"</code> on the <code>&lt;ion-content&gt;</code></li> <li>Setting <code>scrollbar-y="false"</code> on the <code>&lt;ion-content&gt;</code></li> <li>Setting <code>overflow-scroll="false"</code> on the <code>&lt;ion-content&gt;</code></li> <li><p>Setting the following in css:</p> <p><code>.scroll-bar-indicator { display: none; }</code></p></li> </ul> <p>etc...</p> <p>Setting the following actually does work to remove the scrollbar, but I'd rather not hijack the browser behavior, and also it removes scrollbars from content internal to the <code>&lt;ion-content&gt;</code> tag, which I don't want. </p> <pre><code>::-webkit-scrollbar, *::-webkit-scrollbar { display: none; } </code></pre>
0debug
Docker is installed but Docker Compose is not ? why? : <p>I have installed docker on centos 7. by running following commands, </p> <pre><code>curl -sSL https://get.docker.com/ | sh systemctl enable docker &amp;&amp; systemctl start docker docker run hello-world </code></pre> <p><strong>NOTE: helloworld runs correctly and no issues.</strong></p> <p>however when i trying to run docker-compose (docker-compose.yml exists and valid) it gives me the error on Centos only (Windows version works fine for the docker-compose file)</p> <pre><code>/usr/local/bin/docker-compose: line 1: {error:Not Found}: command not found </code></pre>
0debug
create a google form generator like application using pure "raw php" : <p>I'm new to php and I want to know how to develop a simple application similar to google form generator, using only raw php without using any frameworks, java scripts. The scenario is like this. I have a form with a combo box containing item names; textbox, textarea, radio, checkbox, combo box, etc. Also there is a text field to enter name. user can select an item name from combo box and give a name to that combobox. Likewise can add several fields. after finished adding needed controllers and names for them, there should be a ok button to generate a form by using our selected controllers.And should redirect to that form as well. That created form also has to be work. (this is similar to google form scenario)</p> <p>If anybody can help it would be really helpful and very grateful. Thanks :)</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
target_ulong helper_evpe(CPUMIPSState *env) { CPUMIPSState *other_cpu = first_cpu; target_ulong prev = env->mvp->CP0_MVPControl; do { if (other_cpu != env && !mips_vpe_is_wfi(other_cpu)) { other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); mips_vpe_wake(other_cpu); } other_cpu = other_cpu->next_cpu; } while (other_cpu); return prev; }
1threat
Change item height if it width is more than 500px - jQuery : <p>I have an item on the page(500x200), and when its width is more than 500px, the height should be increased to 400.</p> <p>Is it possible to be done with jQuery?</p>
0debug
How to specify the order of parameters in @AllArgsConstructor in lombok : <p>If I have a class like below,</p> <pre><code>import lombok.AllArgsConstructor; @AllArgsConstructor class MyClass{ private String one; private Integer three; private Integer two; } </code></pre> <p>What will be the order of parameters in the generated constructor ? Is it always like below,</p> <pre><code>public MyClass(String one, Integer three, Integer two) { this.one = one; this.three = three; this.two = two; } </code></pre> <p>I noticed it's the order of declaration in the class itself. But need to confirm it. Couldn't find any documentation that verify that fact.</p> <p>If not can we define the order of params in anyway ?</p>
0debug
PyCharm: Is there a way to make the "data view" auto update when dataframe is changed? : <p>When you select "View as DataFrame" in the variables pane it has a nice spreadsheet like view of the DataFrame. That said, as the DataFrame itself changes, the Data View does not auto update and you need to reclick the View as DataFrame to see it again. Is there a way to make PyCharm autoupdate this? Seems like such a basic feature.</p>
0debug
static int nbd_negotiate_options(NBDClient *client, uint16_t myflags, Error **errp) { uint32_t flags; bool fixedNewstyle = false; bool no_zeroes = false; if (nbd_read(client->ioc, &flags, sizeof(flags), errp) < 0) { error_prepend(errp, "read failed: "); return -EIO; } be32_to_cpus(&flags); trace_nbd_negotiate_options_flags(flags); if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) { fixedNewstyle = true; flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE; } if (flags & NBD_FLAG_C_NO_ZEROES) { no_zeroes = true; flags &= ~NBD_FLAG_C_NO_ZEROES; } if (flags != 0) { error_setg(errp, "Unknown client flags 0x%" PRIx32 " received", flags); return -EINVAL; } while (1) { int ret; uint32_t option, length; uint64_t magic; if (nbd_read(client->ioc, &magic, sizeof(magic), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } magic = be64_to_cpu(magic); trace_nbd_negotiate_options_check_magic(magic); if (magic != NBD_OPTS_MAGIC) { error_setg(errp, "Bad magic received"); return -EINVAL; } if (nbd_read(client->ioc, &option, sizeof(option), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } option = be32_to_cpu(option); if (nbd_read(client->ioc, &length, sizeof(length), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } length = be32_to_cpu(length); trace_nbd_negotiate_options_check_option(option, nbd_opt_lookup(option)); if (client->tlscreds && client->ioc == (QIOChannel *)client->sioc) { QIOChannel *tioc; if (!fixedNewstyle) { error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } switch (option) { case NBD_OPT_STARTTLS: tioc = nbd_negotiate_handle_starttls(client, length, errp); if (!tioc) { return -EIO; } object_unref(OBJECT(client->ioc)); client->ioc = QIO_CHANNEL(tioc); break; case NBD_OPT_EXPORT_NAME: error_setg(errp, "Option 0x%x not permitted before TLS", option); return -EINVAL; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_TLS_REQD, option, errp, "Option 0x%" PRIx32 "not permitted before TLS", option); if (ret < 0) { return ret; } if (option == NBD_OPT_ABORT) { return 1; } break; } } else if (fixedNewstyle) { switch (option) { case NBD_OPT_LIST: ret = nbd_negotiate_handle_list(client, length, errp); if (ret < 0) { return ret; } break; case NBD_OPT_ABORT: nbd_negotiate_send_rep(client->ioc, NBD_REP_ACK, option, NULL); return 1; case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, length, myflags, no_zeroes, errp); case NBD_OPT_INFO: case NBD_OPT_GO: ret = nbd_negotiate_handle_info(client, length, option, myflags, errp); if (ret == 1) { assert(option == NBD_OPT_GO); return 0; } if (ret) { return ret; } break; case NBD_OPT_STARTTLS: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } if (client->tlscreds) { ret = nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_INVALID, option, errp, "TLS already enabled"); } else { ret = nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_POLICY, option, errp, "TLS not configured"); } if (ret < 0) { return ret; } break; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client->ioc, NBD_REP_ERR_UNSUP, option, errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); if (ret < 0) { return ret; } break; } } else { switch (option) { case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, length, myflags, no_zeroes, errp); default: error_setg(errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); return -EINVAL; } } } }
1threat
Using a bearer token for authentication(≠ authorization) : <p>A request using the <code>Authorization: bearer [token]</code> can be used for authentication?</p> <p>or </p> <p>Should we use another method to authenticate a client and issue a token then use the token as a bearer token like OAuth2 does? Why popular web services(e.g. Github, AWS, Google..) uses other method(like AWS does: <code>Authorization: AWS4-HMAC-SHA256 Credential=...</code>) to authenticate a client. The point of the question is: is there any valunerables or violation of standards in the following flow or not.</p> <p>I would like to use the following flow:</p> <p><code>the client</code>: which is like Twitter client.<br> <code>the server</code>: which is like Twitter API.</p> <ol> <li>the client makes the token(encrypted user ID, password, and etc).</li> <li>the client requests a resource to the server with <code>Authorization: bearer [token]</code>.</li> <li>the server decrypts the token and authenticates the client.</li> <li>the server response the resource.</li> </ol> <p>I read the following RFC but I haven't found any reason why I shouldn't or should use the flow above.</p> <p><a href="https://tools.ietf.org/html/rfc7235" rel="noreferrer">https://tools.ietf.org/html/rfc7235</a><br> <a href="https://tools.ietf.org/html/rfc6750" rel="noreferrer">https://tools.ietf.org/html/rfc6750</a></p> <p>Thanks</p>
0debug
numpy frombuffer - AttributeError: 'str' object has no attribute '__buffer__' : <p>Python Version: 3.5.2 Numpy Version : 1.12.1</p> <p>Error:</p> <pre><code>import numpy as np s = 'Hello World' np.frombuffer(s, dtype='S1') AttributeError: 'str' object has no attribute '__buffer__' </code></pre> <p>Things Tried:</p> <blockquote> <ol> <li>Tried Online Ideone compiler, got same error in Python3.xx.</li> <li>Referred <a href="https://www.scipy.org/scipylib/faq.html#do-numpy-and-scipy-support-python-3-x" rel="noreferrer">scipy faqs</a> for numpy and python compatible version, which states "NumPy support the Python 2.x series, (versions 2.6 and 2.7), as well as Python 3.2 and newer. The first release of NumPy to support Python 3 was NumPy 1.5.0."</li> </ol> </blockquote> <p>Can't figure out the issue, tried stackoverflow for same issue but nothing found, may be i had missed it. Any suggestions or leads on why the error and how to resolve it in python3.xx.</p>
0debug
Align elements in bootstrap : <p>How can I get the fa-icon and the text to be vertically aligned in the row (visually)</p> <pre><code>&lt;div class="row first-row"&gt; &lt;div class="d-inline col-xs-12 col-sm-1 col-md-1"&gt; &lt;i class="fa fa-camera-retro fa-2x"&gt;&lt;/i&gt; &lt;/div&gt; &lt;div class="d-inline align-middle col-xs-12 col-sm-6 offset-sm-1 offset-md-0 img-text"&gt;In New York&lt;/div&gt; &lt;div class="d-inline col-sm-2 date-text"&gt;17-08-2010&lt;/div&gt; &lt;div class="media col-sm-8 offset-sm-1"&gt; &lt;img src="images/innewyork.jpg" class="img-fluid rounded" alt="Responsive image"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
0debug
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size) { int pending = size; int done = 0; while (pending > 0) { int res; res = qemu_peek_buffer(f, buf, pending, 0); if (res == 0) { return done; } qemu_file_skip(f, res); buf += res; pending -= res; done += res; } return done; }
1threat