problem
stringlengths
26
131k
labels
class label
2 classes
static int indeo3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, unsigned char *buf, int buf_size) { Indeo3DecodeContext *s=avctx->priv_data; unsigned char *src, *dest; int y; if (buf_size == 0) { return 0; } iv_decode_frame(s, buf, buf_size); if(s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); s->frame.reference = 0; if(avctx->get_buffer(avctx, &s->frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } src = s->cur_frame->Ybuf; dest = s->frame.data[0]; for (y = 0; y < s->height; y++) { memcpy(dest, src, s->cur_frame->y_w); src += s->cur_frame->y_w; dest += s->frame.linesize[0]; } if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { src = s->cur_frame->Ubuf; dest = s->frame.data[1]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[1]; } src = s->cur_frame->Vbuf; dest = s->frame.data[2]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[2]; } } *data_size=sizeof(AVFrame); *(AVFrame*)data= s->frame; return buf_size; }
1threat
int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs) { QEMUSnapshotInfo sn; int err = 0; BlockDriverState *bs; BdrvNextIterator *it = NULL; while (err == 0 && (it = bdrv_next(it, &bs))) { AioContext *ctx = bdrv_get_aio_context(bs); aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { err = bdrv_snapshot_find(bs, &sn, name); } aio_context_release(ctx); } *first_bad_bs = bs; return err; }
1threat
how to display seats image in android like below picture? : [enter image description here][1] Hi i want to display seat images like this in my app.i am new to android.I don't know what layout and methodology should i use.Currently i am planning list view,but i am not sure what method and layout should i use to use.anybody suggest please [1]: https://i.stack.imgur.com/vgwh9.jpg Hi i want to display seat images like this in my app.i am new to android.I don't know what layout and methodology should i use.Currently i am planning list view,but i am not sure what method and layout should i use to use.anybody suggest please
0debug
C++ Cannot instantiate abstract class error : <p>I'm a returning college student and my code is really rusty since its been years. We have a program where he gave us a UML template. Anyways im getting a c2259 error, cannot instantiate abstract classes, when I compile and I cannot find the issue. Any ideas? </p> <pre><code>#ifndef OLISTTYPE_H #define OLISTTYPE_H #include "ListType.h" template &lt;class T&gt; class OListType: public ListType&lt;T&gt; { public: bool insert(const T&amp;); void insertFirst(const T&amp;); void insertLast(const T&amp;); bool find(const T&amp;) const; }; template &lt;class T&gt; bool OListType&lt;T&gt;::find(const T&amp; item) const { NodeType&lt;T&gt;* temp = this-&gt;head; while (temp != NULL &amp;&amp; temp-&gt;info &lt; item) { temp = temp-&gt;link; } return(temp != NULL &amp;&amp; temp-&gt;info == item); } template &lt;class T&gt; bool OListType&lt;T&gt;::insert(const T&amp; newItem) { NodeType&lt;T&gt; *current; NodeType&lt;T&gt; *trailCurrent; NodeType&lt;T&gt; *newNode; bool found; newNode = new NodeType&lt;T&gt;; newNode-&gt;info = newItem; newNode-&gt;link = nullptr; if (first == nullptr) { first = newNode; last = newNode; count++; } else { current = first; found = false; while (current != nullptr &amp;&amp; !found) if (current-&gt;info &gt;= newItem) found = true; else { trailCurrent = current; current = current-&gt;link; } if (current == first) { newNode-&gt;link = first; first = newNode; count++; } else { trailCurrent-&gt;link = newNode; newNode-&gt;link = current; if (current == nullptr) last = newNode; count++; } } } template&lt;class T&gt; void OListType&lt;T&gt;::insertFirst(const T&amp; newItem) { insert(newItem); } template&lt;class T&gt; void OListType&lt;T&gt;::insertLast(const T&amp; newItem) { insert(newItem); } #endif </code></pre> <p>ListType.h </p> <hr> <pre><code>#ifndef LISTTYPE__H #define LISTTYPE__H #include &lt;cstddef&gt; #include "Nodetype.h" #include &lt;iostream&gt; template &lt;class T&gt; class ListType { public: ListType(); ListType(const ListType&lt;T&gt;&amp;); virtual ~ListType(); bool operator=(const ListType&lt;T&gt;&amp; right) const; virtual bool insert(const T&amp;) = 0; virtual bool eraseAll(); virtual bool erase(const T&amp;) = 0; bool find(const T&amp;) const; size_t size() const; bool empty() const; friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp;, const ListType&amp;); protected: int count; NodeType&lt;T&gt; *first; NodeType&lt;T&gt; *last; private: void destroy(); void copy(const ListType&lt;T&gt;&amp;); }; template &lt;class T&gt; ListType&lt;T&gt;::ListType() { first = nullptr; last = nullptr; count = 0; } template &lt;class T&gt; ListType&lt;T&gt;::ListType(const ListType&lt;T&gt;&amp; otherList) { first = nullptr; copyList(otherList); } template &lt;class T&gt; ListType&lt;T&gt;::~ListType() { destroy(); } template&lt;class T&gt; bool ListType&lt;T&gt;::operator=(const ListType&lt;T&gt;&amp; right) const { return (current = right.current); } template &lt;class T&gt; bool ListType&lt;T&gt;::eraseAll() { head = 0; return true; } template &lt;class T&gt; bool ListType&lt;T&gt;::erase(const T&amp; it) { if (head == 0) { return false; } else { struct NodeType&lt;T&gt; *u = head-&gt;next, *p = head; if (head-&gt;item == it) { head = head-&gt;next; return true; } while (u != 0 &amp;&amp; u-&gt;next != 0) { if (u-&gt;item == it) { p-&gt;next = u-&gt;next; return true; } u = u-&gt;next; p = p-&gt;next; } if (u-&gt;next == 0 &amp;&amp; u-&gt;item == it) { p-&gt;next = 0; return true; } return false; } } template &lt;class T&gt; bool ListType&lt;T&gt;::find(const T&amp; it) const { if (head == 0) { return false; } else { struct NodeType&lt;T&gt; *p = head; while (p-&gt;next != 0) { if (p-&gt;item == it) { return true; } p = p-&gt;next; } return false; } } template &lt;class T&gt; size_t ListType&lt;T&gt;::size() const { return count; } template &lt;class T&gt; bool ListType&lt;T&gt;::empty() const { return (first == nullptr); } template &lt;class T&gt; void ListType&lt;T&gt;::destroy() { NodeType&lt;T&gt; *temp; while (first != nullptr) { temp = first; first = first-&gt;link; delete temp; } last = nullptr; count = 0; } template &lt;class T&gt; void ListType&lt;T&gt;::copy(const ListType&lt;T&gt;&amp; otherList) { nodeType&lt;Type&gt; *newNode; nodeType&lt;Type&gt; *current; if (first != nullptr) destroylist(); if (otherList.first = nullptr) { first = nullptr; last = nullptr; count = 0; } else { current = otherList.first; count = otherList.count; first = new NodeType&lt;T&gt;; first-&gt;info = current-&gt;info; first-&gt;link = nullptr last = first; current = current-&gt;link; while (current != nullptr) { newNode = new NodeType&lt;Type&gt;; newNode-&gt;info = current-&gt;info; newNode-&gt;link = nullptr; last-&gt;link = newNode; last = newNode; current = current-&gt;link; } } } template &lt;class T&gt; std::ostream &amp;operator&lt;&lt; (std::ostream &amp;out, const ListType&lt;T&gt; &amp;list) { if (list.head) { NodeType&lt;T&gt; *temp = list.head; out &lt;&lt; list.head-&gt;item; temp = temp-&gt;next; while (temp != 0) { out &lt;&lt; "," &lt;&lt; temp-&gt;item; temp = temp-&gt;next; } } return out; } #endif </code></pre>
0debug
static int pfpu_decode_insn(MilkymistPFPUState *s) { uint32_t pc = s->regs[R_PC]; uint32_t insn = s->microcode[pc]; uint32_t reg_a = (insn >> 18) & 0x7f; uint32_t reg_b = (insn >> 11) & 0x7f; uint32_t op = (insn >> 7) & 0xf; uint32_t reg_d = insn & 0x7f; uint32_t r; int latency = 0; switch (op) { case OP_NOP: break; case OP_FADD: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = a + b; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_FADD; D_EXEC(qemu_log("ADD a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_FSUB: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = a - b; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_FSUB; D_EXEC(qemu_log("SUB a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_FMUL: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = a * b; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_FMUL; D_EXEC(qemu_log("MUL a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_FABS: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float t = fabsf(a); r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_FABS; D_EXEC(qemu_log("ABS a=%f t=%f, r=%08x\n", a, t, r)); } break; case OP_F2I: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); int32_t t = a; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_F2I; D_EXEC(qemu_log("F2I a=%f t=%d, r=%08x\n", a, t, r)); } break; case OP_I2F: { int32_t a = REINTERPRET_CAST(int32_t, s->gp_regs[reg_a]); float t = a; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_I2F; D_EXEC(qemu_log("I2F a=%08x t=%f, r=%08x\n", a, t, r)); } break; case OP_VECTOUT: { uint32_t a = cpu_to_be32(s->gp_regs[reg_a]); uint32_t b = cpu_to_be32(s->gp_regs[reg_b]); target_phys_addr_t dma_ptr = get_dma_address(s->regs[R_MESHBASE], s->gp_regs[GPR_X], s->gp_regs[GPR_Y]); cpu_physical_memory_write(dma_ptr, (uint8_t *)&a, 4); cpu_physical_memory_write(dma_ptr + 4, (uint8_t *)&b, 4); s->regs[R_LASTDMA] = dma_ptr + 4; D_EXEC(qemu_log("VECTOUT a=%08x b=%08x dma=%08x\n", a, b, dma_ptr)); trace_milkymist_pfpu_vectout(a, b, dma_ptr); } break; case OP_SIN: { int32_t a = REINTERPRET_CAST(int32_t, s->gp_regs[reg_a]); float t = sinf(a * (1.0f / (M_PI * 4096.0f))); r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_SIN; D_EXEC(qemu_log("SIN a=%d t=%f, r=%08x\n", a, t, r)); } break; case OP_COS: { int32_t a = REINTERPRET_CAST(int32_t, s->gp_regs[reg_a]); float t = cosf(a * (1.0f / (M_PI * 4096.0f))); r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_COS; D_EXEC(qemu_log("COS a=%d t=%f, r=%08x\n", a, t, r)); } break; case OP_ABOVE: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = (a > b) ? 1.0f : 0.0f; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_ABOVE; D_EXEC(qemu_log("ABOVE a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_EQUAL: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = (a == b) ? 1.0f : 0.0f; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_EQUAL; D_EXEC(qemu_log("EQUAL a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_COPY: { r = s->gp_regs[reg_a]; latency = LATENCY_COPY; D_EXEC(qemu_log("COPY")); } break; case OP_IF: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); uint32_t f = s->gp_regs[GPR_FLAGS]; float t = (f != 0) ? a : b; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_IF; D_EXEC(qemu_log("IF f=%u a=%f b=%f t=%f, r=%08x\n", f, a, b, t, r)); } break; case OP_TSIGN: { float a = REINTERPRET_CAST(float, s->gp_regs[reg_a]); float b = REINTERPRET_CAST(float, s->gp_regs[reg_b]); float t = (b < 0) ? -a : a; r = REINTERPRET_CAST(uint32_t, t); latency = LATENCY_TSIGN; D_EXEC(qemu_log("TSIGN a=%f b=%f t=%f, r=%08x\n", a, b, t, r)); } break; case OP_QUAKE: { uint32_t a = s->gp_regs[reg_a]; r = 0x5f3759df - (a >> 1); latency = LATENCY_QUAKE; D_EXEC(qemu_log("QUAKE a=%d r=%08x\n", a, r)); } break; default: error_report("milkymist_pfpu: unknown opcode %d\n", op); break; } if (!reg_d) { D_EXEC(qemu_log("%04d %8s R%03d, R%03d <L=%d, E=%04d>\n", s->regs[R_PC], opcode_to_str[op], reg_a, reg_b, latency, s->regs[R_PC] + latency)); } else { D_EXEC(qemu_log("%04d %8s R%03d, R%03d <L=%d, E=%04d> -> R%03d\n", s->regs[R_PC], opcode_to_str[op], reg_a, reg_b, latency, s->regs[R_PC] + latency, reg_d)); } if (op == OP_VECTOUT) { return 0; } if (reg_d) { uint32_t val = output_queue_remove(s); D_EXEC(qemu_log("R%03d <- 0x%08x\n", reg_d, val)); s->gp_regs[reg_d] = val; } output_queue_advance(s); if (op != OP_NOP) { output_queue_insert(s, r, latency-1); } s->regs[R_PC]++; return 1; };
1threat
void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) { const char *param = qdict_get_str(qdict, "parameter"); const char *valuestr = qdict_get_str(qdict, "value"); int64_t valuebw = 0; long valueint = 0; Error *err = NULL; bool use_int_value = false; int i; for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) { if (strcmp(param, MigrationParameter_lookup[i]) == 0) { MigrationParameters p = { 0 }; switch (i) { case MIGRATION_PARAMETER_COMPRESS_LEVEL: p.has_compress_level = true; use_int_value = true; break; case MIGRATION_PARAMETER_COMPRESS_THREADS: p.has_compress_threads = true; use_int_value = true; break; case MIGRATION_PARAMETER_DECOMPRESS_THREADS: p.has_decompress_threads = true; use_int_value = true; break; case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL: p.has_cpu_throttle_initial = true; use_int_value = true; break; case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT: p.has_cpu_throttle_increment = true; use_int_value = true; break; case MIGRATION_PARAMETER_TLS_CREDS: p.has_tls_creds = true; p.tls_creds = (char *) valuestr; break; case MIGRATION_PARAMETER_TLS_HOSTNAME: p.has_tls_hostname = true; p.tls_hostname = (char *) valuestr; break; case MIGRATION_PARAMETER_MAX_BANDWIDTH: p.has_max_bandwidth = true; valuebw = qemu_strtosz_MiB(valuestr, NULL); if (valuebw < 0 || (size_t)valuebw != valuebw) { error_setg(&err, "Invalid size %s", valuestr); goto cleanup; } p.max_bandwidth = valuebw; break; case MIGRATION_PARAMETER_DOWNTIME_LIMIT: p.has_downtime_limit = true; use_int_value = true; break; case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY: p.has_x_checkpoint_delay = true; use_int_value = true; break; } if (use_int_value) { if (qemu_strtol(valuestr, NULL, 10, &valueint) < 0) { error_setg(&err, "Unable to parse '%s' as an int", valuestr); goto cleanup; } p.compress_level = valueint; p.compress_threads = valueint; p.decompress_threads = valueint; p.cpu_throttle_initial = valueint; p.cpu_throttle_increment = valueint; p.downtime_limit = valueint; p.x_checkpoint_delay = valueint; } qmp_migrate_set_parameters(&p, &err); break; } } if (i == MIGRATION_PARAMETER__MAX) { error_setg(&err, QERR_INVALID_PARAMETER, param); } cleanup: if (err) { error_report_err(err); } }
1threat
int cpu_exec(CPUState *env) { int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; unsigned long next_tb; if (env->halted) { if (!cpu_has_work(env)) { return EXCP_HALTED; } env->halted = 0; } cpu_single_env = env; if (unlikely(exit_request)) { env->exit_request = 1; } #if defined(TARGET_I386) CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); DF = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #elif defined(TARGET_M68K) env->cc_op = CC_OP_FLAGS; env->cc_dest = env->sr & 0xf; env->cc_x = (env->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif env->exception_index = -1; for(;;) { if (setjmp(env->jmp_env) == 0) { if (env->exception_index >= 0) { if (env->exception_index >= EXCP_INTERRUPT) { ret = env->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(env); } break; #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) do_interrupt(env); #endif ret = env->exception_index; break; #else do_interrupt(env); env->exception_index = -1; #endif } } next_tb = 0; for(;;) { interrupt_request = env->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(env->singlestep_enabled & SSTEP_NOIRQ)) { interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { env->interrupt_request &= ~CPU_INTERRUPT_DEBUG; env->exception_index = EXCP_DEBUG; cpu_loop_exit(env); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \ defined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HALT) { env->interrupt_request &= ~CPU_INTERRUPT_HALT; env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(env); } #endif #if defined(TARGET_I386) if (interrupt_request & CPU_INTERRUPT_INIT) { svm_check_intercept(env, SVM_EXIT_INIT); do_cpu_init(env); env->exception_index = EXCP_HALTED; cpu_loop_exit(env); } else if (interrupt_request & CPU_INTERRUPT_SIPI) { do_cpu_sipi(env); } else if (env->hflags2 & HF2_GIF_MASK) { if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { svm_check_intercept(env, SVM_EXIT_SMI); env->interrupt_request &= ~CPU_INTERRUPT_SMI; do_smm_enter(env); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags2 & HF2_NMI_MASK)) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); next_tb = 0; } else if (interrupt_request & CPU_INTERRUPT_MCE) { env->interrupt_request &= ~CPU_INTERRUPT_MCE; do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; svm_check_intercept(env, SVM_EXIT_INTR); env->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); next_tb = 0; #if !defined(CONFIG_USER_ONLY) } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && (env->eflags & IF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; svm_check_intercept(env, SVM_EXIT_VINTR); intno = ldl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); env->interrupt_request &= ~CPU_INTERRUPT_VIRQ; next_tb = 0; #endif } } #elif defined(TARGET_PPC) #if 0 if ((interrupt_request & CPU_INTERRUPT_RESET)) { cpu_reset(env); } #endif if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) env->interrupt_request &= ~CPU_INTERRUPT_HARD; next_tb = 0; } #elif defined(TARGET_LM32) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MICROBLAZE) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sregs[SR_MSR] & MSR_IE) && !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP)) && !(env->iflags & (D_FLAG | IMM_FLAG))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_MIPS) if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { env->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SPARC) if (interrupt_request & CPU_INTERRUPT_HARD) { if (cpu_interrupts_enabled(env) && env->interrupt_index > 0) { int pil = env->interrupt_index & 0xf; int type = env->interrupt_index & 0xf0; if (((type == TT_EXTINT) && cpu_pil_allowed(env, pil)) || type != TT_EXTINT) { env->exception_index = env->interrupt_index; do_interrupt(env); next_tb = 0; } } } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ && !(env->uncached_cpsr & CPSR_F)) { env->exception_index = EXCP_FIQ; do_interrupt(env); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_HARD && ((IS_M(env) && env->regs[15] < 0xfffffff0) || !(env->uncached_cpsr & CPSR_I))) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HARD && !(env->uncached_asr & ASR_I)) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_SH4) if (interrupt_request & CPU_INTERRUPT_HARD) { do_interrupt(env); next_tb = 0; } #elif defined(TARGET_ALPHA) { int idx = -1; switch (env->pal_mode ? 7 : env->ps & PS_INT_MASK) { case 0 ... 3: if (interrupt_request & CPU_INTERRUPT_HARD) { idx = EXCP_DEV_INTERRUPT; } case 4: if (interrupt_request & CPU_INTERRUPT_TIMER) { idx = EXCP_CLK_INTERRUPT; } case 5: if (interrupt_request & CPU_INTERRUPT_SMP) { idx = EXCP_SMP_INTERRUPT; } case 6: if (interrupt_request & CPU_INTERRUPT_MCHK) { idx = EXCP_MCHK; } } if (idx >= 0) { env->exception_index = idx; env->error_code = 0; do_interrupt(env); next_tb = 0; } } #elif defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HARD && (env->pregs[PR_CCS] & I_FLAG) && !env->locked_irq) { env->exception_index = EXCP_IRQ; do_interrupt(env); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_NMI && (env->pregs[PR_CCS] & M_FLAG)) { env->exception_index = EXCP_NMI; do_interrupt(env); next_tb = 0; } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { env->exception_index = env->pending_vector; do_interrupt_m68k_hardirq(env); next_tb = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->psw.mask & PSW_MASK_EXT)) { do_interrupt(env); next_tb = 0; } #endif if (env->interrupt_request & CPU_INTERRUPT_EXITTB) { env->interrupt_request &= ~CPU_INTERRUPT_EXITTB; next_tb = 0; } } if (unlikely(env->exit_request)) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; cpu_loop_exit(env); } #if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); log_cpu_state(env, X86_DUMP_CCOP); env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); log_cpu_state(env, 0); #else log_cpu_state(env, 0); #endif } #endif spin_lock(&tb_lock); tb = tb_find_fast(env); if (tb_invalidated_flag) { next_tb = 0; tb_invalidated_flag = 0; } #ifdef CONFIG_DEBUG_EXEC qemu_log_mask(CPU_LOG_EXEC, "Trace 0x%08lx [" TARGET_FMT_lx "] %s\n", (long)tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); #endif if (next_tb != 0 && tb->page_addr[1] == -1) { tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); } spin_unlock(&tb_lock); env->current_tb = tb; barrier(); if (likely(!env->exit_request)) { tc_ptr = tb->tc_ptr; next_tb = tcg_qemu_tb_exec(env, tc_ptr); if ((next_tb & 3) == 2) { int insns_left; tb = (TranslationBlock *)(long)(next_tb & ~3); cpu_pc_from_tb(env, tb); insns_left = env->icount_decr.u32; if (env->icount_extra && insns_left >= 0) { env->icount_extra += insns_left; if (env->icount_extra > 0xffff) { insns_left = 0xffff; insns_left = env->icount_extra; } env->icount_extra -= insns_left; env->icount_decr.u16.low = insns_left; if (insns_left > 0) { cpu_exec_nocache(env, insns_left, tb); } env->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(env); } } } env->current_tb = NULL; } } } #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (DF & DF_MASK); #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_SPARC) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #else #error unsupported target CPU #endif cpu_single_env = NULL; return ret; }
1threat
I want to refresh fragment on itemselect in spinner. But unfortunatelly not properly work. My code is given below : overview_spMonth.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { selectedMonth=overview_spMonth.getSelectedItem().toString(); OverviewFragment over = new OverviewFragment(); FragmentManager fragmentManager = getFragmentManager(); // Or: FragmentManager fragmentManager = getSupportFragmentManager() fragmentManager.beginTransaction() .detach(over) .attach(over) .commit(); } @Override public void onNothingSelected(AdapterView<?> parent) { } });
0debug
error: variable veryFar might not have been initialized, (using BigInteger Please help fix this : I am making a converter which will convert numbers to text.I did everything as said in this [website](https://developer360.net/java-program-convert-number-to-words-android-studio/) and edited for using big Integers but it is then showing a variable is not intialized I edited some things to make it compatible with big integers for bigger numbers, but it just shows variable veryFar maybe not initialized.(I edited the variable name to try fix it!) This is my MainActivity.java ```java package com.example.convertnumbertotext; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import java.math.BigInteger; import java.text.DecimalFormat; public class MainActivity extends AppCompatActivity { EditText etnum; Button btncon; TextView tvdisplay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); etnum = (EditText) findViewById(R.id.etnum); btncon = (Button) findViewById(R.id.btncon); tvdisplay = (TextView) findViewById(R.id.tvdisplay); btncon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { BigInteger numberToConvert = new BigInteger(etnum.getText().toString()); String return_val_in_english = EnglishNumberToWords.convert(numberToConvert); Toast.makeText(MainActivity.this,"Ammount "+" "+ return_val_in_english.toString(), Toast.LENGTH_LONG).show(); tvdisplay.setText(return_val_in_english); } }); } } ``` This is my XML file ```xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:padding="15dp" tools:context=".MainActivity"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="Number:" android:textSize="30dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.0" /> <EditText android:id="@+id/etnum" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginRight="8dp" android:layout_marginBottom="8dp" android:inputType="number" android:textSize="37dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.241" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.072" /> <Button android:id="@+id/btncon" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="convert" android:textSize="35dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.229" /> <TextView android:id="@+id/tvdisplay" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:textSize="40dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.793" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.499" /> </android.support.constraint.ConstraintLayout> ``` and this is my separate class (It is the one showing errors ```java package com.example.convertnumbertotext; import java.math.BigInteger; import java.text.DecimalFormat; public class EnglishNumberToWords { private static BigInteger bi = new BigInteger("100"); private static BigInteger bi2 = new BigInteger("20"); private static BigInteger bi3 = new BigInteger("10"); private static final String[] tensNames = { "", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety" }; private static final String[] numNames = { "", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen" }; private static String convertLessThanOneThousand(BigInteger number) { String veryFar; BigInteger[] bii = number.divideAndRemainder(bi); BigInteger[] bii2 = number.divideAndRemainder(bi3); int resut = bii[1].compareTo(bi2); if (resut == -1) { veryFar = numNames[bii[1].intValue()]; number = number.divide(bi); } else if (resut == 1 || resut == 0) { veryFar = numNames[bii2[1].intValue()]; number = number.divide(bi3); veryFar = tensNames[bii2[1].intValue()] + veryFar; number = number.divide(bi3); } if (number.compareTo(BigInteger.valueOf(0)) == 0) return veryFar; return numNames[number.intValue()] + " hundred" + veryFar; } public static String convert (BigInteger number){ // 0 to 999 999 999 999 if (number.compareTo(BigInteger.valueOf(0)) == 0) { return "zero"; } String snumber = number.toString(); // pad with "0" String mask = "000000000000"; DecimalFormat df = new DecimalFormat(mask); snumber = df.format(number); BigInteger trillions = new BigInteger(snumber.substring(0, 3)); // nnnXXXnnnnnnnnn BigInteger billions = new BigInteger(snumber.substring(3, 6)); // nnnnnnXXXnnnnnn BigInteger millions = new BigInteger(snumber.substring(6, 9)); // nnnnnnnnnXXXnnn BigInteger hundredThousands = new BigInteger(snumber.substring(9, 12)); // nnnnnnnnnnnnXXX BigInteger thousands = new BigInteger(snumber.substring(12, 15)); String tradTrillions; if (trillions.compareTo(BigInteger.valueOf(0)) == 0) { tradTrillions = ""; } else if (trillions.compareTo(BigInteger.valueOf(1)) == 0) { tradTrillions = convertLessThanOneThousand(trillions) + " trillion "; } else { tradTrillions = convertLessThanOneThousand(trillions) + " trillion "; } String result = tradTrillions; String tradBillions; if (billions.compareTo(BigInteger.valueOf(0)) == 0) { tradBillions = ""; } else if (billions.compareTo(BigInteger.valueOf(1)) == 0) { tradBillions = convertLessThanOneThousand(billions) + " billion "; } else { tradBillions = convertLessThanOneThousand(billions) + " billion "; } result = result + tradBillions; String tradMillions; if (millions.compareTo(BigInteger.valueOf(0)) == 0) { tradMillions = ""; } else if (millions.compareTo(BigInteger.valueOf(1)) == 0) { tradMillions = convertLessThanOneThousand(millions) + " million "; } else { tradMillions = convertLessThanOneThousand(millions) + " million "; } result = result + tradMillions; String tradHundredThousands; if (hundredThousands.compareTo(BigInteger.valueOf(0)) == 0) { tradHundredThousands = ""; } else if (hundredThousands.compareTo(BigInteger.valueOf(1)) == 0) { tradHundredThousands = "one thousand "; } else { tradHundredThousands = convertLessThanOneThousand(hundredThousands) + " thousand "; } result = result + tradHundredThousands; String tradThousand; tradThousand = convertLessThanOneThousand(thousands); result = result + tradThousand; // remove extra spaces! return result.replaceAll("^\\s+", "").replaceAll("\\b\\s{2,}\\b", " "); } } ``` It shows 2 same error messages- error: variable veryFar might not have been initialized error: variable veryFar might not have been initialized Please Help
0debug
static int read_uncompressed_sgi(unsigned char* out_buf, SgiState *s) { int x, y, z; unsigned int offset = s->height * s->width * s->bytes_per_channel; GetByteContext gp[4]; uint8_t *out_end; if (offset * s->depth > bytestream2_get_bytes_left(&s->g)) return AVERROR_INVALIDDATA; for (z = 0; z < s->depth; z++) { gp[z] = s->g; bytestream2_skip(&gp[z], z * offset); } for (y = s->height - 1; y >= 0; y--) { out_end = out_buf + (y * s->linesize); if (s->bytes_per_channel == 1) { for (x = s->width; x > 0; x--) { bytestream2_get_bufferu(&gp[z], out_end, s->depth); out_end += s->depth; } } else { uint16_t *out16 = (uint16_t *)out_end; for (x = s->width; x > 0; x--) for (z = 0; z < s->depth; z++) *out16++ = bytestream2_get_ne16u(&gp[z]); } } return 0; }
1threat
Styling ionic 2 toast : <p>Is there any way to style the text message within an ionic 2 toast?</p> <p>I have tried this:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> let toast = Toast.create({ message: "Some text on one line. &lt;br /&gt;&lt;br /&gt; Some text on another line.", duration: 15000, showCloseButton: true, closeButtonText: 'Got it!', dismissOnPageChange: true }); toast.onDismiss(() =&gt; { console.log('Dismissed toast'); }); this.nav.present(toast); }</code></pre> </div> </div> </p> <p>But clearly you can't use html in the text so I am guessing the answer to my question is no?</p>
0debug
int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) { if (!(env->cr[0] & CR0_PG_MASK)) { return 0; } if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { target_phys_addr_t pml4e_addr; pml4e_addr = (env->cr[3] & ~0xfff) & env->a20_mask; walk_pml4e(list, pml4e_addr, env->a20_mask); } else #endif { target_phys_addr_t pdpe_addr; pdpe_addr = (env->cr[3] & ~0x1f) & env->a20_mask; walk_pdpe2(list, pdpe_addr, env->a20_mask); } } else { target_phys_addr_t pde_addr; bool pse; pde_addr = (env->cr[3] & ~0xfff) & env->a20_mask; pse = !!(env->cr[4] & CR4_PSE_MASK); walk_pde2(list, pde_addr, env->a20_mask, pse); } return 0; }
1threat
static void internal_snapshot_prepare(BlkTransactionState *common, Error **errp) { Error *local_err = NULL; const char *device; const char *name; BlockBackend *blk; BlockDriverState *bs; QEMUSnapshotInfo old_sn, *sn; bool ret; qemu_timeval tv; BlockdevSnapshotInternal *internal; InternalSnapshotState *state; int ret1; g_assert(common->action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC); internal = common->action->blockdev_snapshot_internal_sync; state = DO_UPCAST(InternalSnapshotState, common, common); device = internal->device; name = internal->name; blk = blk_by_name(device); if (!blk) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", device); return; } state->aio_context = blk_get_aio_context(blk); aio_context_acquire(state->aio_context); if (!blk_is_available(blk)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } bs = blk_bs(blk); state->bs = bs; bdrv_drained_begin(bs); if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, errp)) { return; } if (bdrv_is_read_only(bs)) { error_setg(errp, "Device '%s' is read only", device); return; } if (!bdrv_can_snapshot(bs)) { error_setg(errp, "Block format '%s' used by device '%s' " "does not support internal snapshots", bs->drv->format_name, device); return; } if (!strlen(name)) { error_setg(errp, "Name is empty"); return; } ret = bdrv_snapshot_find_by_id_and_name(bs, NULL, name, &old_sn, &local_err); if (local_err) { error_propagate(errp, local_err); return; } else if (ret) { error_setg(errp, "Snapshot with name '%s' already exists on device '%s'", name, device); return; } sn = &state->sn; pstrcpy(sn->name, sizeof(sn->name), name); qemu_gettimeofday(&tv); sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; sn->vm_clock_nsec = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ret1 = bdrv_snapshot_create(bs, sn); if (ret1 < 0) { error_setg_errno(errp, -ret1, "Failed to create snapshot '%s' on device '%s'", name, device); return; } state->created = true; }
1threat
static void term_hist_add(const char *cmdline) { char *hist_entry, *new_entry; int idx; if (cmdline[0] == '\0') return; new_entry = NULL; if (term_hist_entry != -1) { hist_entry = term_history[term_hist_entry]; idx = term_hist_entry; if (strcmp(hist_entry, cmdline) == 0) { goto same_entry; } } for (idx = 0; idx < TERM_MAX_CMDS; idx++) { hist_entry = term_history[idx]; if (hist_entry == NULL) break; if (strcmp(hist_entry, cmdline) == 0) { same_entry: new_entry = hist_entry; memmove(&term_history[idx], &term_history[idx + 1], &term_history[TERM_MAX_CMDS] - &term_history[idx + 1]); term_history[TERM_MAX_CMDS - 1] = NULL; for (; idx < TERM_MAX_CMDS; idx++) { if (term_history[idx] == NULL) break; } break; } } if (idx == TERM_MAX_CMDS) { free(term_history[0]); memcpy(term_history, &term_history[1], &term_history[TERM_MAX_CMDS] - &term_history[1]); term_history[TERM_MAX_CMDS - 1] = NULL; idx = TERM_MAX_CMDS - 1; } if (new_entry == NULL) new_entry = strdup(cmdline); term_history[idx] = new_entry; term_hist_entry = -1; }
1threat
Unable to convert a series into dictionary : <p>My function takes a data frame as an argument that represent home adverts from the website. I am counting flats by the number of rooms and receive series which I would like to convert into a dictionary. My <code>rooms counter</code> seems to be a series still after applying <code>to_dict()</code>. Tried also with <code>collections</code> but it is the same. </p> <pre><code>def most_common_room_number(dane): rooms = dane['Rooms'] rooms_counter = rooms.value_counts() rooms_counter.to_dict() # rooms_counter.to_dict(OrderedDict) # dd = defaultdict(list) # rooms_counter.to_dict(dd) print(rooms_counter) </code></pre>
0debug
document.write('<script src="evil.js"></script>');
1threat
Combining csv files in R to different columns : <p>I have over 100 csv files, each containing one column of Date and Time (which are the exact same values for every file) and then a second column that is different for every file. I want the file name to be the column name. </p> <p>So essentially I want to add a column to my data frame for each file.</p> <p>What's the most efficient way to do this?</p> <p>So far all I've done is make a list of all of the csv files in my folder because all of the information I have found so far only seems to be telling me how to add the data as more rows, not more columns.</p>
0debug
Java scripts working locally but not on webserver. (Uncaught ReferenceError: jQuery is not defined) : I have a problem for which I have been searching the net for hours, but I can't find the solution. I wrote a webpage with JQuery included. It runs file locally (as a file), but on the webserver, it keeps giving me an error: 'Uncaught ReferenceError: jQuery is not defined'. When I debug the html when loaded in chrome locally I can see the content of the referenced .js files. However when I debug the same files when the page runs on the webserver I can see the .js files in the debugger, but they appear all empty, ergo no content. The paths to the files is correct as the debugger gives no errors on the files not found. Please, help??? Here is my code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <?xml version="1.0" encoding="UTF-8"?> <html><head> <link rel="stylesheet" type="text/css" href="web.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery.treetable.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery.treetable.theme.default.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css"/> </head> <body> <Template>HEADER</Template> <table id="statustable"><tr><th><div><span>Type</span></div></th><th><div><span>Nummer</span></div></th><th><div><span>Beschrijving</span></div></th><th><div><span>Status</span></div></th><th><div><span>SubStatus</span></div></th><th><div><span>Prod. soort</span></div></th><th><div><span>Plaat Best.</span></div></th><th><div><span>Rail spuiter</span></div></th><th><div><span>Hout</span></div></th><th><div><span>Aluminium</span></div></th><th><div><span>Staal</span></div></th><th><div><span>Rubberen</span></div></th><th><div><span>Assemblage</span></div></th><th><div><span>Werknemer</span></div></th></tr><tr data-tt-id="1"><td style="background-color:lightblue;">Project</td><td>BV19073</td><td>Engel</td><td>Order</td><td>Gereed</td></tr><tr data-tt-id="1.1" data-tt-parent-id="1"><td style="background-color:lightblue;">Order</td><td>1900198</td><td>Engel</td><td>Order</td><td>Productie_gereed</td><td style="background-color:green;">PRODUCTIE</td><td style="background-color:green;">Gereed</td><td style="background-color:Red;">Geen</td></tr><tr data-tt-id="1.1.1" data-tt-parent-id="1.1"><td style="background-color:lightblue;">Samenstelling</td><td>01.</td><td>Wand A P90 46/47 dB</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.1" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.01.</td><td>Wall Stanchion Telescopic (WST)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.2" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.02.</td><td>Wall Stanchion Standard (WSS)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.3" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.03.</td><td>Standard Panel (SP)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.4" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.04.</td><td>Telescopic Panel (TP)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.5" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.05.</td><td>extra platen ivm min. best.</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.6" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.06.</td><td>Uren per wand.</td><td>Gereed</td></tr></table><table id="formtable"><tr><td><button type="button" onclick="window.location.href='##BASEURL##/list/orderpost'">Vernieuwen</button></td></tr></table><Template>FOOTER</Template> <script src="jquery/external/jquery/jquery.js"></script> <script src="jquery/jquery-ui.js"></script> <script src="jquery/jquery.treetable.js"></script> <script src="jquery/test.js"></script> <script>(function($){$("#statustable").treetable({ expandable: true })})(jQuery);</script> </body> </html> <!-- end snippet -->
0debug
Not successfully in appending an element to the list (Python) : <p>Not sure why the append function returns 'None" in following code</p> <pre><code>dw=[1,3,5] dw=[0]+dw print(dw,type(dw)) dw=dw.append(12) print(dw) </code></pre> <p>Output is: ([0, 1, 3, 5],'list'), None.</p> <p>Why not [0,1,3,5,12] with append function?</p> <p>Thanks;</p>
0debug
How to append a input value using jquery : I'm trying to change the input value of my text box using jquery here is my input <input id="qty_10" class="input-text qty" name="qty" maxlength="3" value="1" style="display: none;" type="text"> and the jquery code jQuery("#qty_10").val(selectedValue); here i need to change the input like this <input id="qty_10" class="input-text qty" name="qty" maxlength="3" value="10" style="display: none;" type="text"> but the value is not changing can anyone help me.
0debug
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_15mask),"m"(green_15mask)); mm_end = end - 11; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psrlq $3, %%mm0 \n\t" "psrlq $3, %%mm3 \n\t" "pand %2, %%mm0 \n\t" "pand %2, %%mm3 \n\t" "psrlq $6, %%mm1 \n\t" "psrlq $6, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $9, %%mm2 \n\t" "psrlq $9, %%mm5 \n\t" "pand %%mm7, %%mm2 \n\t" "pand %%mm7, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { const int b = *s++; const int g = *s++; const int r = *s++; *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); } }
1threat
static int gen_neon_unzip(int rd, int rm, int size, int q) { TCGv tmp, tmp2; if (size == 3 || (!q && size == 2)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { switch (size) { case 0: gen_helper_neon_qunzip8(tmp, tmp2); break; case 1: gen_helper_neon_qunzip16(tmp, tmp2); break; case 2: gen_helper_neon_qunzip32(tmp, tmp2); break; default: abort(); } } else { switch (size) { case 0: gen_helper_neon_unzip8(tmp, tmp2); break; case 1: gen_helper_neon_unzip16(tmp, tmp2); break; default: abort(); } } tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp2); return 0; }
1threat
def position_max(list1): max_val = max(list1) max_result = [i for i, j in enumerate(list1) if j == max_val] return max_result
0debug
/varible int time won't display the numeric value entered : <pre><code>//varible int time won't display the numeric value entered </code></pre> <p>The Speed of Sound The following table shows the approximate speed of sound in air, water, and steel: Medium Speed Air 1,100 feet per second Water 4,900 feet per second Steel 16,400 feet per second Write a program that asks the user to enter “air”, “water”, or “steel”, and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time 5 Distance / 1,100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time 5 Distance / 4,900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time 5 Distance / 16,400</p> <p><a href="http://i.stack.imgur.com/33T0K.png" rel="nofollow">C:\Users\DeLaCruz\Desktop\j2</a></p> <p><a href="http://i.stack.imgur.com/gELHB.png" rel="nofollow">V:\CSC106-Spring 2016\j3</a></p> <pre><code>import java.util.Scanner; public class ProgramSpeedOfSound{ public static void main(String [] args){ Scanner keyboard = new Scanner(System.in); String input; System.out.println("Enter Air, water or steel "); input = keyboard.nextLine().toUpperCase(); if(input.equals("Air")){ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); int var = 1100; double time = Distance / var; System.out.println("it would take " + time); } else if(input.equals("Water")){ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); double time = (((Distance/ 4900))); System.out.println("it would take " + time); } else{ System.out.println("what is the Distance? "); int Distance = keyboard.nextInt(); double time = Distance/ 16400; System.out.println("it would take " + time); } } } </code></pre>
0debug
Android app UML classes diagram it is useful? : <p>I am now writing my thesis and I am thinking about if it useful to make UML classes diagram for Android App which have about 35 classes. If i make this diagram it will be very big and confusing. I know about plugins which makes this for you but I just thinking it is good for something?</p>
0debug
covariant type A occurs in contravariant position in type A of value a : <p>I have following class:</p> <pre><code>case class Box[+A](value: A) { def set(a: A): Box[A] = Box(a) } </code></pre> <p>And the compiler complain:</p> <pre><code>Error:(4, 11) covariant type A occurs in contravariant position in type A of value a def set(a: A): Box[A] = Box(a) </code></pre> <p>I was searching a lot about the error, but could not find something useful that help me to understand the error.</p> <p>Could someone please explain, why the error occurs? </p>
0debug
AWS : Redshift vs traditional dbms : <p>In traditional DBMS when we try to execute a insert into table and delete from the same table (delete just the data not table) I remember it will result in a deadlock. </p> <p>With Redshift when I delete data and when I insert Data at the same time I’m able to do it. </p> <p>How is this possible is the Redshift architecture different from traditional RDBMS when it comes to this type of Deadlock situations. </p>
0debug
def max_of_nth(test_list, N): res = max([sub[N] for sub in test_list]) return (res)
0debug
def eulerian_num(n, m): if (m >= n or n == 0): return 0 if (m == 0): return 1 return ((n - m) * eulerian_num(n - 1, m - 1) +(m + 1) * eulerian_num(n - 1, m))
0debug
How to check whether a string is equal to + opearator in Java : String value = "+"; if (value.contains("\\+")) { value = value.replaceAll("\\+", " "); } The if clause returns false. Why is it? What method should i use in the if clause for it to return true? Thanks in advance.
0debug
static void buffer_release(void *opaque, uint8_t *data) { *(uint8_t*)opaque = 0; }
1threat
save items of list with thier index in text file using c# : I have created a list in c#, now I need to save the list in text file with the index for each item in the list? please explain with a simple example.
0debug
reCAPTCHA with Content Security Policy : <p>I'm trying to make reCAPTCHA work along with a strict Content Security Policy. This is the basic version I have, which works correctly:</p> <p>HTML</p> <pre><code>&lt;script src='//www.google.com/recaptcha/api.js' async defer&gt;&lt;/script&gt; </code></pre> <p>HTTP Headers</p> <pre><code>Content-Security-Policy: default-src 'self'; script-src 'self' www.google.com www.gstatic.com; style-src 'self' https: 'unsafe-inline'; frame-src www.google.com; </code></pre> <p>However, I would like to get rid of the <code>unsafe-inline</code> in the <code>style-src</code> section. On the <a href="https://developers.google.com/recaptcha/docs/faq#im-using-content-security-policy-csp-on-my-website-how-can-i-configure-it-to-work-with-recaptcha" rel="noreferrer">documentation</a>, it is written that:</p> <blockquote> <p>We recommend using the nonce-based approach documented with CSP3. Make sure to include your nonce in the reCAPTCHA api.js script tag, and we'll handle the rest.</p> </blockquote> <p>But I can't make it work... This is what I tried:</p> <p>HTML</p> <pre><code>&lt;script src='//www.google.com/recaptcha/api.js' nonce="{NONCE}" async defer&gt;&lt;/script&gt; </code></pre> <p>HTTP Headers</p> <pre><code>Content-Security-Policy: default-src 'self'; script-src 'self' https: 'nonce-{NONCE}'; style-src 'self' 'nonce-{NONCE}'; child-src www.google.com; </code></pre> <p>And this is the error I get on Chrome 53:</p> <blockquote> <p>Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' https: 'nonce-{NONCE}'". Either the 'unsafe-inline' keyword, a hash ('sha256-MammJ3J+TGIHdHxYsGLjD6DzRU0ZmxXKZ2DvTePAF0o='), or a nonce ('nonce-...') is required to enable inline execution.</p> </blockquote> <p>What I am missing?</p>
0debug
static int raw_truncate(BlockDriverState *bs, int64_t offset) { BDRVRawState *s = bs->opaque; LONG low, high; low = offset; high = offset >> 32; if (!SetFilePointer(s->hfile, low, &high, FILE_BEGIN)) return -EIO; if (!SetEndOfFile(s->hfile)) return -EIO; return 0; }
1threat
Pod install displaying error in cocoapods version 1.0.0.beta.1 : <p>My podfile was working but after updating to cocoapods version 1.0.0.beta.1</p> <p>pod install displays following error</p> <pre><code>MacBook-Pro:iOS-TuneIn home$ pod install Fully deintegrating due to major version update Deleted 1 'Copy Pods Resources' build phases. Deleted 1 'Check Pods Manifest.lock' build phases. Deleted 1 'Embed Pods Frameworks' build phases. - libPods.a - Pods.debug.xcconfig - Pods.release.xcconfig Deleted 1 'Copy Pods Resources' build phases. Deleted 1 'Check Pods Manifest.lock' build phases. - libPods.a Deleted 1 'Copy Pods Resources' build phases. Deleted 1 'Check Pods Manifest.lock' build phases. - libPods.a Deleted 1 'Copy Pods Resources' build phases. Deleted 1 'Check Pods Manifest.lock' build phases. - libPods.a Deleted 1 'Copy Pods Resources' build phases. Deleted 1 'Check Pods Manifest.lock' build phases. - libPods.a - libPods.a Deleted 1 empty `Pods` groups from project. Removing `Pods` directory. Project has been deintegrated. No traces of CocoaPods left in project. Note: The workspace referencing the Pods project still remains. Updating local specs repositories Analyzing dependencies [!] The dependency `AFNetworking (= 2.6.3)` is not used in any concrete target. The dependency `MBProgressHUD (~&gt; 0.9.1)` is not used in any concrete target. The dependency `PDKeychainBindingsController (~&gt; 0.0.1)` is not used in any concrete target. The dependency `FMDB/SQLCipher` is not used in any concrete target. The dependency `ZXingObjC (~&gt; 3.1.0)` is not used in any concrete target. The dependency `SDWebImage (~&gt; 3.7.2)` is not used in any concrete target. The dependency `SignalR-ObjC (~&gt; 2.0.0.beta3)` is not used in any concrete target. The dependency `CJPAdController (from `https://github.com/nabeelarif100/CJPAdController.git`)` is not used in any concrete target. The dependency `ECSlidingViewController (~&gt; 2.0.3)` is not used in any concrete target. The dependency `VGParallaxHeader` is not used in any concrete target. The dependency `EMString` is not used in any concrete target. The dependency `Google/SignIn` is not used in any concrete target. The dependency `VIPhotoView (~&gt; 0.1)` is not used in any concrete target. The dependency `EncryptedCoreData (from `https://github.com/project-imas/encrypted-core-data.git`)` is not used in any concrete target. MacBook-Pro:iOS-TuneIn home$ </code></pre> <p>Podfile:</p> <pre><code>source 'https://github.com/CocoaPods/Specs.git' platform :ios, '7.0' pod 'AFNetworking', '2.6.3' pod 'MBProgressHUD', '~&gt; 0.9.1' pod 'PDKeychainBindingsController', '~&gt; 0.0.1' pod 'FMDB/SQLCipher' pod 'ZXingObjC', '~&gt; 3.1.0' pod 'SDWebImage', '~&gt;3.7.2' pod 'SignalR-ObjC','~&gt;2.0.0.beta3' pod 'CJPAdController', :git =&gt; 'https://github.com/nabeelarif100/CJPAdController.git' pod 'ECSlidingViewController', '~&gt; 2.0.3' pod 'VGParallaxHeader' pod 'EMString' pod 'Google/SignIn' pod 'VIPhotoView', '~&gt; 0.1' pod 'EncryptedCoreData', :git =&gt; 'https://github.com/project-imas/encrypted-core-data.git' </code></pre>
0debug
Property 'payload' does not exist on type 'Action' when upgrading @ngrx/Store : <p>I have the <code>@ngrx/store</code> package in my angular (4.x) app, and am upgrading from v<strong>2.2.2</strong> -> v<strong>4.0.0</strong>. I can see that the migration notes say:</p> <blockquote> <p>The payload property has been removed from the Action interface.</p> </blockquote> <p>However, the example they give seems completely counter intuitive (in my view...). </p> <p>I have a reducer function which looks like this:</p> <pre><code>export function titleReducer(state = { company: 'MyCo', site: 'London' }, action: Action): ITitle { switch (action.type) { case 'SET_TITLE': return { company: action.payload.company, site: action.payload.site, department: action.payload.department, line: action.payload.line } case 'RESET': return { company: 'MyCo', site: 'London' } default: return state } } </code></pre> <p>Which as expected now throws typescript error:</p> <blockquote> <p>[ts] Property 'payload' does not exist on type 'Action'</p> </blockquote> <p>But I have no idea from the migration guide what this should be changed too. Any ideas?</p>
0debug
How To Sort Date Array In Swift? : I Want To Sort Array That Is Full Of Month with year example : ["Nov 2019","Apr 2020","MAR 2018","Jan 2018","May 2018"](non sorted) to -> ["Jan 2018","Mar 2018","May 2018","Nov 2019","Apr 2020"](sorted) like this... u also give code in any language i convert to swift :) func sortDate( arr : inout [String]) { let months : [String] = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"] for i in 0..<arr.count{ for j in i..<arr.count{ let string1 = arr[i] let string2 = arr[j] let month1 = String(string1[string1.startIndex...string1.index(string1.startIndex, offsetBy: 2)]) let month2 = String(string2[string2.startIndex...string2.index(string2.startIndex, offsetBy: 2)]) if months.index(of: month1.lowercased())! > months.index(of: month2.lowercased())! { let temp = arr[i] arr[i] = arr[j] arr[j] = temp } } } for i in 0..<arr.count{ for j in i..<arr.count{ let string1 = arr[i] let string2 = arr[j] if (string1[string1.index(before: string1.endIndex)..<string1.endIndex] as NSString).intValue < (string2[string2.index(before: string2.endIndex)..<string2.endIndex] as NSString).intValue { let temp = arr[i] arr[i] = arr[j] arr[j] = temp } } } } This is I Tryed.. But Its Not Work Properly.. This is input : ["Jan 2020", "Feb 2018", "Mar 2018", "Apr 2018", "May 2018", "Jun 2018", "Jul 2018", "Aug 2018", "Sep 2018", "Oct 2018", "Nov 2018", "Jun 2019", "Feb 2019", "Jul 2019", "Apr 2019", "Aug 2019", "Sep 2019", "May 2019", "Oct 2019", "Jan 2019", "Mar 2019", "Nov 2019"] Output Is : ["Jan 2019", "Feb 2019", "Mar 2019", "Apr 2019", "May 2019", "Jun 2019", "Jul 2019", "Aug 2019", "Sep 2019", "Oct 2019", "Nov 2019", "Jul 2018", "Mar 2018", "May 2018", "Aug 2018", "Feb 2018", "Sep 2018", "Oct 2018", "Apr 2018", "Nov 2018", "Jun 2018", "Jan 2020"]
0debug
static int scan_for_extensions(AVCodecContext *avctx) { DCAContext *s = avctx->priv_data; int core_ss_end, ret; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) { s->core_ext_mask = FFMAX(s->core_ext_mask, 0); skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); while (core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); int i; switch (bits) { case DCA_SYNCWORD_XCH: { int ext_amode, xch_fsize; s->xch_base_channel = s->prim_channels; xch_fsize = show_bits(&s->gb, 10); if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) continue; skip_bits(&s->gb, 10); s->core_ext_mask |= DCA_EXT_XCH; if ((ext_amode = get_bits(&s->gb, 4)) != 1) { av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not supported!\n", ext_amode); continue; } dca_parse_audio_coding_header(s, s->xch_base_channel); for (i = 0; i < (s->sample_blocks / 8); i++) if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); continue; } s->xch_present = 1; break; } case DCA_SYNCWORD_XXCH: s->core_ext_mask |= DCA_EXT_XXCH; break; case 0x1d95f262: { int fsize96 = show_bits(&s->gb, 12) + 1; if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) continue; av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", get_bits_count(&s->gb)); skip_bits(&s->gb, 12); av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); s->core_ext_mask |= DCA_EXT_X96; break; } } skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } } else { skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); } if (s->core_ext_mask & DCA_EXT_X96) s->profile = FF_PROFILE_DTS_96_24; else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) s->profile = FF_PROFILE_DTS_ES; if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_SYNCWORD_SUBSTREAM) ff_dca_exss_parse_header(s); return ret; }
1threat
Attempted import error: 'addLocaleData' is not exported from 'react-intl' : <p>It's return error when i try this code </p> <p>react-intl version 3.1.6 &amp;&amp; react version 16.9</p> <pre><code>import { IntlProvider, FormattedMessage , addLocaleData} from 'react-intl'; </code></pre>
0debug
void tcg_gen_brcond_i32(TCGCond cond, TCGv_i32 arg1, TCGv_i32 arg2, int label) { if (cond == TCG_COND_ALWAYS) { tcg_gen_br(label); } else if (cond != TCG_COND_NEVER) { tcg_gen_op4ii_i32(INDEX_op_brcond_i32, arg1, arg2, cond, label); } }
1threat
static void avconv_cleanup(int ret) { int i, j; for (i = 0; i < nb_filtergraphs; i++) { FilterGraph *fg = filtergraphs[i]; avfilter_graph_free(&fg->graph); for (j = 0; j < fg->nb_inputs; j++) { while (av_fifo_size(fg->inputs[j]->frame_queue)) { AVFrame *frame; av_fifo_generic_read(fg->inputs[j]->frame_queue, &frame, sizeof(frame), NULL); av_frame_free(&frame); } av_fifo_free(fg->inputs[j]->frame_queue); av_buffer_unref(&fg->inputs[j]->hw_frames_ctx); av_freep(&fg->inputs[j]->name); av_freep(&fg->inputs[j]); } av_freep(&fg->inputs); for (j = 0; j < fg->nb_outputs; j++) { av_freep(&fg->outputs[j]->name); av_freep(&fg->outputs[j]->formats); av_freep(&fg->outputs[j]->channel_layouts); av_freep(&fg->outputs[j]->sample_rates); av_freep(&fg->outputs[j]); } av_freep(&fg->outputs); av_freep(&fg->graph_desc); av_freep(&filtergraphs[i]); } av_freep(&filtergraphs); for (i = 0; i < nb_output_files; i++) { OutputFile *of = output_files[i]; AVFormatContext *s = of->ctx; if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb) avio_close(s->pb); avformat_free_context(s); av_dict_free(&of->opts); av_freep(&output_files[i]); } for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; for (j = 0; j < ost->nb_bitstream_filters; j++) av_bsf_free(&ost->bsf_ctx[j]); av_freep(&ost->bsf_ctx); av_freep(&ost->bitstream_filters); av_frame_free(&ost->filtered_frame); av_parser_close(ost->parser); avcodec_free_context(&ost->parser_avctx); av_freep(&ost->forced_keyframes); av_freep(&ost->avfilter); av_freep(&ost->logfile_prefix); avcodec_free_context(&ost->enc_ctx); while (av_fifo_size(ost->muxing_queue)) { AVPacket pkt; av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL); av_packet_unref(&pkt); } av_fifo_free(ost->muxing_queue); av_freep(&output_streams[i]); } for (i = 0; i < nb_input_files; i++) { avformat_close_input(&input_files[i]->ctx); av_freep(&input_files[i]); } for (i = 0; i < nb_input_streams; i++) { InputStream *ist = input_streams[i]; av_frame_free(&ist->decoded_frame); av_frame_free(&ist->filter_frame); av_dict_free(&ist->decoder_opts); av_freep(&ist->filters); av_freep(&ist->hwaccel_device); avcodec_free_context(&ist->dec_ctx); av_freep(&input_streams[i]); } if (vstats_file) fclose(vstats_file); av_free(vstats_filename); av_freep(&input_streams); av_freep(&input_files); av_freep(&output_streams); av_freep(&output_files); uninit_opts(); avformat_network_deinit(); if (received_sigterm) { av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n", (int) received_sigterm); exit (255); } }
1threat
static int compand_delay(AVFilterContext *ctx, AVFrame *frame) { CompandContext *s = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; const int channels = inlink->channels; const int nb_samples = frame->nb_samples; int chan, i, av_uninit(dindex), oindex, av_uninit(count); AVFrame *out_frame = NULL; av_assert1(channels > 0); for (chan = 0; chan < channels; chan++) { const double *src = (double *)frame->extended_data[chan]; double *dbuf = (double *)s->delayptrs[chan]; ChanParam *cp = &s->channels[chan]; double *dst; count = s->delay_count; dindex = s->delay_index; for (i = 0, oindex = 0; i < nb_samples; i++) { const double in = src[i]; update_volume(cp, fabs(in)); if (count >= s->delay_samples) { if (!out_frame) { out_frame = ff_get_audio_buffer(inlink, nb_samples - i); if (!out_frame) return AVERROR(ENOMEM); av_frame_copy_props(out_frame, frame); out_frame->pts = s->pts; s->pts += av_rescale_q(nb_samples - i, (AVRational){1, inlink->sample_rate}, inlink->time_base); } dst = (double *)out_frame->extended_data[chan]; dst[oindex++] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume), -1, 1); } else { count++; } dbuf[dindex] = in; dindex = MOD(dindex + 1, s->delay_samples); } } s->delay_count = count; s->delay_index = dindex; av_frame_free(&frame); return out_frame ? ff_filter_frame(ctx->outputs[0], out_frame) : 0; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
Will C++ preprocessor deals with the content of a h file which is included by my current h file : <p>For example: In my.h file, I included nest1.h</p> <pre><code>#ifndef MY_H #define MY_H #include nest1.h ... some_function_declaration ... #endif </code></pre> <p>And in nest1.h, I included another h file nest2.h</p> <pre><code>#ifndef NEST1_H #define NEST1_H #include nest2.h ... #endif </code></pre> <p>nest2.h</p> <pre><code>#ifndef NEST2_H #define NEST2_H int foo(); #endif </code></pre> <p>Will preprocessor copy foo() into my.h? Can I use foo() in my.cc file? And if nest2.h included nest3.h, can my.cc use the functions in nest3.h? And why? Please also link the relative articles if someone know the answer. Thank you!</p>
0debug
How to pass/get placeholder value? [PHP] : So I have a form where one entry is: <input type="text" id="ptid" name="ptid" readonly="readonly" placeholder="<?php echo $pid; ?>"> The value of "$pid" is not null, I already got the value from database. Then I would like to get that value and pass to another php file. So I tried this code : <?php $ptid=$_POST['pid']; ?> I tried printing this out, but somehow there's no result. Is there anyway to get the value?
0debug
int ff_dxva2_is_d3d11(const AVCodecContext *avctx) { if (CONFIG_D3D11VA) return avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD; else return 0; }
1threat
void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, int select_error) { }
1threat
check box click on new window on selenium webdrive : [enter image description here][1][enter image description here][2] i try thic check box click but not able to click on check box plese send me the xpath or css [enter image description here][3] i try xpath //div//*[@id='thCheckBox'] .//*[@id='searchOrderModel']/div/div/div[3]/div/button[3] [1]: https://i.stack.imgur.com/5p1TV.png [2]: https://i.stack.imgur.com/Hq6ox.png [3]: https://i.stack.imgur.com/Xz0PV.png
0debug
Building with Intellij 2017.2 /out directory duplicates files in /build directory : <p>After updating to Intellij 2017.2, building my project creates an <code>/out</code> directory that contains generated source files and resource files. These files duplicate files that are already contained in <code>/build</code> and result in <code>duplicate class</code> compiler errors for the generated classes. Any ideas on a fix I need in Gradle or IntelliJ?</p>
0debug
PyCharm: always mark venv directory as excluded : <p>In Python 3, I've moved away from creating virtualenvs in <code>~/.virtualenvs</code> and towards keeping them in the project directory <code>./venv</code></p> <p>However now search results in every PyCharm project include results from <code>venv</code> subdirectories, until you manually right-click and exclude them from the project. </p> <p>How to omit directories named <code>venv</code> from PyCharm indexing/searching, globally?</p>
0debug
static void pop_output_configuration(AACContext *ac) { if (ac->oc[1].status != OC_LOCKED) { if (ac->oc[0].status == OC_LOCKED) { ac->oc[1] = ac->oc[0]; ac->avctx->channels = ac->oc[1].channels; ac->avctx->channel_layout = ac->oc[1].channel_layout; }else{ ac->avctx->channels = 0; ac->avctx->channel_layout = 0; } } }
1threat
i am using visual studio and i have a table, but when i insert it gives me error : ***i am trying to insert data into the table but it is not allowing me it gives me an error and i think the error is from the role i dont know how to fix it so please i need help thank you*** **this is the member table that i am using** <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> CREATE TABLE [dbo].[Member] ( [Member_Username] NVARCHAR (50) NOT NULL, [Password] NVARCHAR (25) NOT NULL, [Role] NVARCHAR (10) NULL, [FirstName] NVARCHAR (50) NOT NULL, [LastName] NVARCHAR (50) NOT NULL, [Gender] NVARCHAR (8) NOT NULL, [Email] NVARCHAR (50) NULL, [DateOfBirth] DATE NOT NULL, PRIMARY KEY CLUSTERED ([Member_Username] ASC) ); <!-- end snippet --> **and this is the error i am getting when inserting the values in the table** <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> System.Data.SqlClient.SqlException: 'The parameterized query '(@memberU nvarchar(1),@pwd nvarchar(1),@role nvarchar(4000),@fna' expects the parameter '@role', which was not supplied.' <!-- end snippet --> **this is the member class that i have for inserting the user in the database table** public void AddMember() { //Open Database connection SqlConnection conn = new SqlConnection(); conn.ConnectionString = Config.GetConnectionStr(); conn.Open(); //Prepare SQL Command with parameter string sql = "Insert into Member values(@memberU,@pwd, @role,@fname,@lname,@gender,@email,@dob)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("memberU", this.Member_Username); cmd.Parameters.AddWithValue("pwd", this.Password); cmd.Parameters.AddWithValue("role", this.Role); cmd.Parameters.AddWithValue("fname", this.FirstName); cmd.Parameters.AddWithValue("lname", this.LastName); cmd.Parameters.AddWithValue("email", this.Email); //handling null values for gender and date of birth column if (this.Gender != null) { cmd.Parameters.AddWithValue("gender", this.Gender); } else { cmd.Parameters.AddWithValue("gender", DBNull.Value); } if (this.DateofBirth != null) { cmd.Parameters.AddWithValue("dob", this.DateofBirth); } else { cmd.Parameters.AddWithValue("dob", DBNull.Value); } //Execute Command cmd.ExecuteNonQuery(); } **and this is the sign up button** protected void btnSignUp_Click(object sender, EventArgs e) { if (Page.IsValid)// assuming you have done validations using validation controls {// c create a new object of type member and set all it's properties to values from controls Members user = new Members(); //reading required values user.FirstName = txtFirstName.Text; user.LastName = txtLastName.Text; user.Member_Username = txtUserName.Text; user.Password = txtPassword.Text; user.Email = txtEmail.Text; user.Gender = rdoGender.SelectedValue; //reading values that allow null in the database (date of birth) if (string.IsNullOrEmpty(txtDOB.Text)) { user.DateofBirth = null; } else { user.DateofBirth = DateTime.Parse(txtDOB.Text); } //call the addMember method user.AddMember(); //redirect the user to homePage Response.Redirect("Login.aspx"); } }
0debug
Expected 'this' to be used by class method : <p>In my class, eslint is complaining "Expected 'this' to be used by class method 'getUrlParams'</p> <p>Here is my class:</p> <pre><code>class PostSearch extends React.Component { constructor(props) { super(props); this.getSearchResults(); } getUrlParams(queryString) { const hashes = queryString.slice(queryString.indexOf('?') + 1).split('&amp;'); const params = {}; hashes.forEach((hash) =&gt; { const [key, val] = hash.split('='); params[key] = decodeURIComponent(val); }); return params; } getSearchResults() { const { terms, category } = this.getUrlParams(this.props.location.search); this.props.dispatch(Actions.fetchPostsSearchResults(terms, category)); } render() { return ( &lt;div&gt; &lt;HorizontalLine /&gt; &lt;div className="container"&gt; &lt;Col md={9} xs={12}&gt; &lt;h1 className="aboutHeader"&gt;Test&lt;/h1&gt; &lt;/Col&gt; &lt;Col md={3} xs={12}&gt; &lt;SideBar /&gt; &lt;/Col&gt; &lt;/div&gt; &lt;/div&gt; ); } } </code></pre> <p>What is the best approach to solve this or refactor this component?</p>
0debug
Change CSS code when div elemet ist clicked : I'm currently trying to make a little photo album for a website. There are some small photo thumbnails on the left side. If you click one of them it should appear on the right side in full resulution. I thought you could solve this by overlapping all pictures and put them in `display: none`. Every time you click on a thumbnail image a little javascript function triggers which changes the css of the specific picture to `display: block` to make it visible. Here's my existing code incl. JSfiddle: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .images{ float: left; margin-right: 10px; border: 1px solid silver; width: 100px; height: 100px; overflow: hidden; margin-bottom: 50px; border: 4px solid transparent;} .images img{ height: 100px; width: auto;} .images:hover, .images:visited, .images:active { border: 4px solid #009EE0;} .table { width: 60%; height: 100%; border-right: 1px solid silver; float: left;} <!-- language: lang-html --> <div class="table"> <div class="images"> <img src="http://mgt.sjp.ac.lk/ent/wp-content/uploads/2015/03/coming-soon-bigger-600x600.jpg" alt="DK_2014_MFK_Radtour_0168.jpg, 241kB" title="DK 2014 MFK Radtour 0168" height="auto" width="300"> </div> <div class="images"> <img src="https://www.drphillipscenter.org/resources/images/default.jpg" alt="DK_2014_MFK_Radtour_0168.jpg, 241kB" title="DK 2014 MFK Radtour 0168" height="auto" width="300"> </div> </div> <p>When clicked, I want the Picture to appear right here but sized bigger.</p> <!-- end snippet --> https://jsfiddle.net/zar2u0v1/1/ Better suggestions as hiding all the images would be nice because the lack of performance would be a problem. Thanks in advance and I hope you can help me!
0debug
static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *matroska, uint32_t id) { int i; MatroskaLevel1Element *elem; if (id == MATROSKA_ID_CLUSTER) if (id != MATROSKA_ID_SEEKHEAD) { for (i = 0; i < matroska->num_level1_elems; i++) { if (matroska->level1_elems[i].id == id) return &matroska->level1_elems[i]; } } if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) { av_log(matroska->ctx, AV_LOG_ERROR, "Too many level1 elements or circular seekheads.\n"); } elem = &matroska->level1_elems[matroska->num_level1_elems++]; *elem = (MatroskaLevel1Element){.id = id}; return elem; }
1threat
When would you use global variables over arguments in a function? : <p>When would you use a global variable instead of an argument, vis versa. Also, why would you do this?</p> <p>99.9% of the time, I use global variables then return a product of those variables. I rarely use Arguments in my functions, but I want to know when the right time to use either one of these is. Am I doing this wrong, or does it really matter?</p>
0debug
static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits) { int bandno, cblkno, ret, nb_code_blocks; if (!(ret = get_bits(s, 1))) { jpeg2000_flush(s); return 0; } else if (ret < 0) return ret; for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; int incl, newpasses, llen; if (cblk->npasses) incl = get_bits(s, 1); else incl = tag_tree_decode(s, prec->cblkincl + cblkno, layno + 1) == layno; if (!incl) continue; else if (incl < 0) return incl; if (!cblk->npasses) cblk->nonzerobits = expn[bandno] + numgbits - 1 - tag_tree_decode(s, prec->zerobits + cblkno, 100); if ((newpasses = getnpasses(s)) < 0) return newpasses; if ((llen = getlblockinc(s)) < 0) return llen; cblk->lblock += llen; if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0) return ret; cblk->lengthinc = ret; cblk->npasses += newpasses; } } jpeg2000_flush(s); if (codsty->csty & JPEG2000_CSTY_EPH) { if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH) bytestream2_skip(&s->g, 2); else av_log(s->avctx, AV_LOG_ERROR, "EPH marker not found.\n"); } for (bandno = 0; bandno < rlevel->nbands; bandno++) { Jpeg2000Band *band = rlevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width; for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; if ( bytestream2_get_bytes_left(&s->g) < cblk->lengthinc || sizeof(cblk->data) < cblk->lengthinc ) return AVERROR(EINVAL); if (cblk->lengthinc > 0) { bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc); } else { cblk->data[0] = 0xFF; cblk->data[1] = 0xFF; } cblk->length += cblk->lengthinc; cblk->lengthinc = 0; } } return 0; }
1threat
def count_Squares(m,n): if(n < m): temp = m m = n n = temp return ((m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2))
0debug
Splitting hashmap key : I'm having a problem where I need to put an abbreviation of a word and its full form into hashmap. Then I need to make a program that asks you the words and then prints the full words from the map for you. I can do it with one word but the problem is when it asks many keys with strings. For example: Give words: tran. all of the wo. f. me // At this point I have put all of the words with the dots to hashmap as key values and their full forms as values. Now it should print Given words as a full version where dotted words are replaced by values. Full version: translate all of the words for me // I think I should use .split to make this work but I'm not sure how it works. Thank you for your help!
0debug
Sort array of objects by a key : <p>I am using mongoose and I want to sort an array of objects by a key "position". In my array the objects "position" is: 0, 1 , 3, 2. I want to sort them by the "position".</p> <pre><code> "images": [ { "_id": { "$oid": "5bcf24f8b639a936d5471b04" }, "position": 0, "name": "1540302062678adidas-fashion-feet-1225136.jpg", "created_at": { "$date": "2018-10-23T13:41:13.000Z" } }, { "_id": { "$oid": "5bcf24f8b639a936d5471b05" }, "position": 1, "name": "1540302064570adult-agency-business-380769.jpg", "created_at": { "$date": "2018-10-23T13:41:13.000Z" } }, { "_id": { "$oid": "5bcf24f8b639a936d5471b07" }, "position": 3, "name": "1540302067059adult-body-businessman-652347.jpg", "created_at": { "$date": "2018-10-23T13:41:13.000Z" } }, { "_id": { "$oid": "5bcf24f8b639a936d5471b06" }, "position": 2, "name": "1540302066875adult-beard-blurred-background-936072.jpg", "created_at": { "$date": "2018-10-23T13:41:12.000Z" } } ] </code></pre>
0debug
How to access User in a service context in web API? : <p>If you are in a controller context, you can access the current authenticated User. Take an article such as <a href="https://stackoverflow.com/questions/21616951/get-the-current-user-within-an-apicontroller-action-without-passing-the-userid">Get the current user, within an ApiController action, without passing the userID as a parameter</a> .</p> <p>However, if my controller calls a service (same assembly), but here I don't have the controller context.</p> <p>What is the best way to actually get the authenticated user?</p>
0debug
Easy ways to separate DATA (Dev-Environments/apps/etc) partition from Linux System minimal sized OS partition? Docker or Overlayfs Overlayroot? Other? : <p>Back when the powers that be didn't squeeze the middle-class as much and there was time to waste "fooling around" etc, I used to compile everything from scratch from .tgz and manually get dependencies and make install to localdir.</p> <p>Sadly, there's no more time for such l(in)uxuries these days so I need a quick lazy way to keep my 16GB Linux Boot OS partition as small as possible and have apps/software/Development Environment and other data on a separate partition. </p> <p>I can deal with mounting my home dir to other partition but my remaining issue is with /var and /usr etc and all the stuff that gets installed there every time I apt-get some packages I end up with a trillion dependencies installed because an author of a 5kb app decided not to include a 3kb parser and wanted me to install another 50MB package to get that 3kb library :) yay! </p> <p>Of course later when I uninstall those packages, all those dependencies that got installed and never really have a need for anymore get left behind. But anyway the point is I don't want to have to manually compile and spend hours chasing down dependencies so I can compile and install to my own paths and then have to tinker with a bunch of configuration files. So after some research this is the best I could come up with, did I miss some easier solution?</p> <ol> <li>Use OVERLAYFS and Overlayroot to do an overlay of my root / partition on my secondary drive or partition so that my Linux OS is never written to anymore but everything will be transparently written to the other partition.</li> </ol> <p>I like the idea of this method and I want to know who uses this method and if its working out well. What I like is that this way I can continue to be lazy and just blindly apt-get install toolchain and everything should work as normal without any special tinkering with each apps config files etc to change paths.</p> <p>Its also nice that dependencies will be easily re-used by the different apps. Any problems I haven't foreseen with this method? Is anyone using this solution?</p> <ol start="2"> <li>DOCKER or Other Application Containers, libvirt/lxc etc?</li> </ol> <p>This might be THE WAY to go? With this method I assume I should install ALL my apps I want to install/try-out inside ONE Docker container otherwise I will be wasting storage space by duplication of dependencies in each container? Or does DOCKER or other app-containers do DEDUPLICATION of files/libs across containers? Does this work fine for graphical/x-windows/etc apps inside docker/containers?</p> <p>If you know of something easier than Overlayfs/overlayroot or Docker/LXC to accomplish what I want and that's not any more hassle to setup please tell me.tx</p>
0debug
Apply CSS :not() and :hover in LESS : I have some elements with a specific class (let's call `.option`), and some of them has an other class in addition (let's call `.selected`). I would like to apply some `:hover` style definition on `.option` elements, but only the ones that has no `.selected` class. I already figured out that I have to use the `:not()` and `:hover` pseudo selectors, but none of their combinations resulted in something that I wanted. And in addition I have to word this all in LESS. I'm not very versed in LESS and CSS. <!-- I'd like to apply :hover only on those options that are not selected --> <div class="option"> option 1 </div> <div class="option selected"> option 2 </div> <div class="option"> option 3 </div> <div class="option"> option 4 </div>
0debug
Regex pattern matching [ ] : <p>I need to match a pattern such as this <code>[1712][***matchhere***]</code> where I just need the text between the second set of [ ]. </p>
0debug
How to remove or exclude an item in an Ansible template list? : <p>I'm writing an Ansible template that needs to produce a list of ip's in a host group, <strong><em>excluding</em></strong> the current hosts IP. I've searched around online and through the documentation but I could not find any filters that allow you to remove an item in a list. I have created the (hacky) for loop below to do this but was wondering if anyone knew a "best practice" way of filtering like this.</p> <pre><code>{% set filtered_list = [] %} {% for host in groups['my_group'] if host != ansible_host %} {{ filtered_list.append(host)}} {% endfor %} </code></pre> <p>Lets say groups['my_group'] has 3 ip's (192.168.1.1, 192.168.1.2 and 192.168.1.3). When the template is generated for 192.168.1.1 it should only print the ip's 192.168.1.2 and 192.168.1.3.</p>
0debug
Can non-type template parameters in c++17 be decltype(auto)? : <p>I discovered that gcc and clang allow to use <code>decltype(auto)</code> in non-type template parameter type clause. E.g.:</p> <pre><code>template &lt;decltype(auto)&gt; struct X {}; int foo ; int main() { X&lt;(foo)&gt; x; static_cast&lt;void&gt;(x); } </code></pre> <p><a href="https://wandbox.org/permlink/WjMznykm1OHne1WP" rel="noreferrer">[live demo gcc]</a> <a href="https://wandbox.org/permlink/MTmKJb5JOmsOfeJx" rel="noreferrer">[live demo clang]</a></p> <p>Is it standard compliant feature or is it some gnu extension?</p>
0debug
Can NodeJs be used on the web just like php : <p>Guys i'm new in Nodejs,</p> <p>please can it be used on the web like php?</p>
0debug
Dealing with non required forms in mysqli : <p>I am attempting to insert variables from a form into a mySQL database using a mysqli prepared statement. The problem I have run into is that one of my variables is not required and so when i don't enter anything for it in the form I get an error. How do I properly deal with this variable? would i need to use a different prepared statement or could I keep the one I have? </p>
0debug
Syntax of read() for file handling in c++ : Eg is Structure Customer and structure variable savac. The syntax to read is **read((char *) &savac,sizeof(customer))** What is the need of type casting to character array here?
0debug
START_TEST(simple_number) { int i; struct { const char *encoded; int64_t decoded; } test_cases[] = { { "0", 0 }, { "1234", 1234 }, { "1", 1 }, { "-32", -32 }, { "-0", 0 }, { }, }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QInt *qint; obj = qobject_from_json(test_cases[i].encoded); fail_unless(obj != NULL); fail_unless(qobject_type(obj) == QTYPE_QINT); qint = qobject_to_qint(obj); fail_unless(qint_get_int(qint) == test_cases[i].decoded); QDECREF(qint); } }
1threat
void *etraxfs_dmac_init(target_phys_addr_t base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; ctrl = g_malloc0(sizeof *ctrl); ctrl->bh = qemu_bh_new(DMA_run, ctrl); ctrl->nr_channels = nr_channels; ctrl->channels = g_malloc0(sizeof ctrl->channels[0] * nr_channels); memory_region_init_io(&ctrl->mmio, &dma_ops, ctrl, "etraxfs-dma", nr_channels * 0x2000); memory_region_add_subregion(get_system_memory(), base, &ctrl->mmio); return ctrl; }
1threat
Customer with multiple loans : I want to know the SQL query for identification of customers who have taken the multiple loan & next availed loan is within 60 days from the purchase of first loan. Data - Customerid, Loan Opening Date , Loan Closing Date, Rank Please help.
0debug
Split String into Array of subarrays : <p>This question is related to my <a href="https://stackoverflow.com/questions/55396179/split-string-into-array-of-arrays">Previous question</a></p> <p>I am writing an iOS App in Swift 4.2</p> <p>Response from server is a string with values separated by pipe character "". It contains many rows of values separated by "$". I want to split it into array of subarrays.</p> <p>Rows are separated by "<strong>$</strong>" and elements are separated by "<strong>|</strong>"</p> <p>Response:</p> <p>Example: <strong>"001|apple|red$002|banana|yellow$003|grapes|purple$"</strong></p> <p><strong>Expected Output:</strong></p> <p>[[001, "apple", "red"], [002, "banana", "yellow"], [003, "grapes", "purple"]]</p>
0debug
Basic of Git explained in a easy to understand terminology : <p>I am using GIT, have been using commands like pull, push, merge, rebase, fetch but really not understanding what they actually do. I tried googling but the over complex terms set me off. Can anybody guide or explain Git in a more lucid way.</p>
0debug
Golang json decoding returns empty : <p>Can some one please explain to me why this code fail to decode json properly: </p> <pre><code>package main import ( "fmt" "os" "log" "encoding/json" ) type Config struct { mongoConnectionString string `json:"database"` Elastic struct{ main string `json:"main"` log string `json:"log"` } `json:"elastic"` logFilePath string `json:"logfile"` } func main(){ loadConfiguration("./config.json") } func loadConfiguration(file string){ var configuration Config configFile, err := os.Open(file); if err != nil { log.Panic("Could not open", file) } defer configFile.Close() if err := json.NewDecoder(configFile).Decode(&amp;configuration); err != nil { log.Panic("./config.json is currupted") } fmt.Print(configuration.logFilePath) } </code></pre> <p>Json data:</p> <pre><code>{ "database": "localhost", "elastic": { "main": "test", "log": "test" }, "logfile": "./logs/log.log" } </code></pre> <p>The execution of this program will result in empty configuration.logFilePath</p> <p>What am i missing? </p> <p>Thanks</p>
0debug
How is multiple User Interface or Views achieved in Chrome App AND How do i connect to MySQL from the Chrome App : I have a web portal developed with Php and MySQL. I want to create a desktop app to work to connect to the Database through the internet. I have two huge challenges 1. Chrome App doesn't navigate from page to page like a website does so HOW DO I ACHIEVE MULTIPKE USER INTERFACES OR VIEWS 2. IndexedDB is not suitable for my app, HOW DO I CONNECT TO MYSQL DATABASE ONLINE NB: I am only a bigginner !
0debug
static void qed_aio_next_io(QEDAIOCB *acb) { BDRVQEDState *s = acb_to_s(acb); uint64_t offset; size_t len; int ret; trace_qed_aio_next_io(s, acb, 0, acb->cur_pos + acb->cur_qiov.size); if (acb->backing_qiov) { qemu_iovec_destroy(acb->backing_qiov); g_free(acb->backing_qiov); acb->backing_qiov = NULL; } acb->qiov_offset += acb->cur_qiov.size; acb->cur_pos += acb->cur_qiov.size; qemu_iovec_reset(&acb->cur_qiov); if (acb->cur_pos >= acb->end_pos) { qed_aio_complete(acb, 0); return; } len = acb->end_pos - acb->cur_pos; ret = qed_find_cluster(s, &acb->request, acb->cur_pos, &len, &offset); if (ret < 0) { qed_aio_complete(acb, ret); return; } if (acb->flags & QED_AIOCB_WRITE) { ret = qed_aio_write_data(acb, ret, offset, len); } else { ret = qed_aio_read_data(acb, ret, offset, len); } if (ret < 0) { if (ret != -EINPROGRESS) { qed_aio_complete(acb, ret); } return; } qed_aio_next_io(acb); }
1threat
static int op_to_movi(int op) { switch (op_bits(op)) { case 32: return INDEX_op_movi_i32; #if TCG_TARGET_REG_BITS == 64 case 64: return INDEX_op_movi_i64; #endif default: fprintf(stderr, "op_to_movi: unexpected return value of " "function op_bits.\n"); tcg_abort(); } }
1threat
How to check if something new appears on a certain web page in Python? : <p>I am scraping a web page using BS4 &amp; Scrapy. Is there a way to check if something new appears? If so, can it be copied and printed out?<br> For example, <a href="http://www.flashscore.com/match/0foYiLmk/#match-summary" rel="nofollow noreferrer">here</a> is a soccer match that is live as I'm writing this post. Each scored goal is indicated by the player's name, it's time, and the soccer ball, which is <code>span</code> with the class <code>icon soccer-ball</code>. How can I check the page, let's say, every 2 minutes, and print out if someone scores a goal?</p>
0debug
Symfony 4 - How to organize my form collection? : <p>In my Symfony 4 project, I have a Validator entity that contains the 'order' and 'user' fields that refer to a user of my User entity.</p> <p>The goal is to allow the site administrator to establish a list of users who can validate certain requests from other users, but with a specific order.</p> <p>For example, the admin would establish the following list:</p> <pre><code>1. Philippe Dupont 2. Julia Robert 3. Joseph Dupuis </code></pre> <p>He would have the possibility on the page to dynamically add elements, or to change the order of the validators as he wishes by passing Joseph Dupuis in 1st position for example.</p> <p>So, it would look a little like what we see on this page using a jQuery plugin <a href="https://symfony-collection.fuz.org/symfony3/" rel="nofollow noreferrer">https://symfony-collection.fuz.org/symfony3/</a></p> <p>(But I'm under Symfony 4 )</p> <p><a href="https://i.stack.imgur.com/QGjMj.png" rel="nofollow noreferrer">Image of what I want</a></p> <p>The goal being the submission of the form to be able to obtain in this case 3 validator objects that will contain the correct order (1,2,3) with the right User elements according to what has been entered. And everything will be spent on the BDD.</p> <p>Except that in addition to being able to do that, it would be necessary that on each fields text, there is an automatic filtering on the complete name of the user with each modification of the field.</p> <p>So I would like to have your help to know how I should go about doing all this. Is this plugin the right solution? Is it easy to set up on Symfony 4? Ability to add a filter effect?</p> <p>Thanks for your help !</p>
0debug
def factorial(start,end): res = 1 for i in range(start,end + 1): res *= i return res def sum_of_square(n): return int(factorial(n + 1, 2 * n) /factorial(1, n))
0debug
What is the median value is decimal? : <p>I'm writing a program to find the median of an array in CPP. I am not sure if I have a clear idea about what a median is. As far as I know, I've written my program to find median but when the array is even-numbered, I'm confused whether I should print the ceiling or ground value of division ofthe decimal output I get when I divide the middle two elements from the array.</p> <pre><code> using namespace std; void findMedian(int sortedArray[], int N); int main() { int ip[4] = {1, 2, 5, 8}; findMedian(ip, 4); } void findMedian(int sortedArray[], int N) { int size = N; int median; if ((size % 2) != 0) { median = sortedArray[(size / 2)]; } else { median = (sortedArray[(size / 2) - 1] + sortedArray[size / 2]) / 2; } cout &lt;&lt; median; } </code></pre> <p>Thanks in advance, also if anyone can give the literal purpose of finding a median, I'd appreciate and it'd help me not ask this question again when I have to deal with Median. Pardon my English.</p>
0debug
static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num) { BDRVVPCState *s = bs->opaque; int64_t bat_offset; uint32_t index, bat_value; int ret; uint8_t bitmap[s->bitmap_size]; if ((sector_num < 0) || (sector_num > bs->total_sectors)) return -1; index = (sector_num * 512) / s->block_size; if (s->pagetable[index] != 0xFFFFFFFF) return -1; s->pagetable[index] = s->free_data_block_offset / 512; memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size); s->free_data_block_offset += s->block_size + s->bitmap_size; ret = rewrite_footer(bs); if (ret < 0) goto fail; bat_offset = s->bat_offset + (4 * index); bat_value = be32_to_cpu(s->pagetable[index]); ret = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4); if (ret < 0) goto fail; return get_sector_offset(bs, sector_num, 0); fail: s->free_data_block_offset -= (s->block_size + s->bitmap_size); return -1; }
1threat
event: "Deprecated symbol used, consult docs for better alternative" : <p>It's been a while that PyCharm (I suppose it's the same with WebStorm and other JetBrains IDEs) raise a weak warning on the <code>event</code> variables I use in my code.</p> <p>For instance in the following code</p> <pre class="lang-html prettyprint-override"><code>&lt;div id="my-div" onclick="event.preventDefault();"&gt;...&lt;/div&gt; </code></pre> <p>PyCharm displays this message "Deprecated symbol used, consult docs for better alternative".</p> <p>The problem seems to be that the <code>event</code> variable refers to <code>Window.event</code>, and according to <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/event" rel="noreferrer">MDN Web Docs</a>:</p> <blockquote> <p>You should avoid using this property in new code, and should instead use the Event passed into the event handler function. This property is not universally supported and even when supported introduces potential fragility to your code.</p> </blockquote> <p>I know that a correct workaround would be to write in a javascript tag:</p> <pre><code>document.getElementById("my-div").addEventListener("click", function(event) { console.log("And use this " + event + " instead"); }); </code></pre> <p>I am just wondering what would be, if it exists, the correct way to use events in the HTML code (<code>onclick</code> attribute).</p> <p>Thank you in advance!</p>
0debug
av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) { int cpu_flags = av_get_cpu_flags(); if (have_vfp(cpu_flags)) { if (!have_vfpv3(cpu_flags)) { c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp; c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp; } } if (have_neon(cpu_flags)) { c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; } }
1threat
How to get selected item from spinner in android : <p>In android I used a spinner to select an item from a list of items. Now I have to use that selected item in java. How can I do that? </p>
0debug
how to make count down timer to disable the button for one day : I am developing a quiz app in it i retrieve one question per day date wise and user has to answer only this retrieved question. I want to disable my button after user submitted his answer and it remain disabled till next day.
0debug
Complete a string base on index of last character : <p>Example Word : String , the returned last index is 5 which is "g". I need to complete the word string base on the space before the word.</p> <p>For example</p> <p>obj string the last index is 5, which is g, "string" word should be completed.</p>
0debug
Read a .dat file in java and compare with Database table result : <p>My Requirement is we get .dat files from developers, We need to verify if the .dat files and database table result are same</p> <p>Sample .dat file looks like</p> <p>3009706~~F18130000010~~R60629572~~0~~936~~1~~PA4~~PA3~~~~~~~~~~~~~~Y~~ 3009712~~F18130000020~~R50160248~~0~~430~~1~~PA4~~PA3~~~~~~~~~~~~~~Y~~ 3009723~~8062229458PM~~R99999999~~0~~439~~1~~PA4~~PA3~~~~~~~~~~~~~~Y~~ 3009728~~8028190839PM~~R57884273~~0~~936~~1~~PA4~~PA3~~~~~~~~~~~~~~Y~~</p> <p>Sample Database table </p> <p><a href="https://i.stack.imgur.com/TMa1r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TMa1r.png" alt="enter image description here"></a></p> <p>I need to read each row from .dat files, query the database with the first value which is primary key and compare the db result with the .dat file result. each column is separated by ~~ symbol. Like wise i need to compare all rows with database results.</p> <p>Like wise i have many files. So one table one .dat file. Manual Comparison is taking hell lot of effort . Need to automate this process Steps i am thinking is</p> <ol> <li>take the count of rows in .dat file and compare with the count of database</li> <li>Read row by row in data file and capture all the values and using primary key query the database table with that primary key to get the result. </li> <li>Compare the result with the .dba file row. If the data is null in db, there is no entry in .dat file, ALso need to verify if ~~ is present for each column separation.</li> </ol> <p>Please provide me any idea or code to start with in java</p> <p>Thanks in Advance</p>
0debug
Need help splitting a string thats being passed into a function in C++ : <p>I'm working on some code right now but am unable to do accomplish this task. The objective is to take a string that is passed through a function. Example function:</p> <pre><code>void function(string line1, string line2, string line3) </code></pre> <p>A string will be entered from the main function and it'll be passed into the first parameter "line1". The job of this function will be to "split the string to the closest whitespace character and put the first part of the string in line2, and the rest in line3.</p> <p>For example if the string passed into line1 was:</p> <pre><code>"Good Job" </code></pre> <p>I have to write some code that will split this string and assign each part to lines 2 and 3 so line2 = Good and line3 = Job.</p>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
Good morning everybody, I would like to ask for your help for python 3. I'm trying to : I'm trying to print all odds values from 1 up to 20 on separates line for h in range(1, 20): if(h % 2) != 0: print("h =", h)
0debug
How to apply global styles with CSS modules in a react app? : <p>I'm currently using CSS Modules with React for my styling. So each of my components is importing in it's component specific css file, like so:</p> <pre><code>import React from 'react'; import styles from './App.css'; const example = () =&gt; ( &lt;div className={styles.content}&gt; Hello World! &lt;/div&gt; ); export default example; </code></pre> <p>This works fine when styling individual components, but how do I apply global styling (html, body, header tags, divs, etc.) that isn't component specific? </p>
0debug
How can I read a json array in PHP : <p>I have this array that I read (using curl) in PHP it returns a string that looks like a json so I convert it into a real json.</p> <p>But what ever I do to read it, does not work:</p> <p>what am I doing wrong and how can I reach those values?</p> <p><strong>This is the result that I get:</strong></p> <pre><code>Array ( [results] =&gt; Array ( [1] =&gt; Array ( [pack_id] =&gt; HUJoUJKK673ED [imre] =&gt; 87687548574 [imrd] =&gt; 87457654764 [cell_id] =&gt; 775443 [firm_vrs] =&gt; 2 [gg_yr] =&gt; 2017 [gg_mn] =&gt; 3 [gg_dy] =&gt; 20 [gg_hr] =&gt; 15 </code></pre> <p><strong>This is my code</strong> </p> <pre><code>&lt;?php $url = $_GET["url"]; $curlSession = curl_init(); curl_setopt($curlSession, CURLOPT_URL, $url); curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true); curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true); $returnVal = curl_exec($curlSession); curl_close($curlSession); //converting the retreived "json lookalike text" in to a json: $decodedText = html_entity_decode($returnVal); $myArray = json_decode($decodedText, true); //this DOES work and shows the json as an array, as described above. echo "&lt;pre&gt;"; print_r($myArray); echo "&lt;/pre&gt;"; //BUT non of the following lines work: $echo = sizeof($myArray-&gt;results); echo "&lt;br /&gt;".$myArray-&gt;results[1]-&gt;imre; echo "&lt;br /&gt;".sizeof($myArray); echo "&lt;br /&gt;".sizeof($myArray-&gt;results); echo "&lt;br /&gt;".sizeof($myArray-&gt;results[1]); echo "&lt;br /&gt;".sizeof($myArray[1][1]); echo "&lt;br /&gt;".sizeof($myArray[0]); echo "&lt;br /&gt;".sizeof($myArray[0]-&gt;results); echo "&lt;br /&gt;".sizeof($myArray-&gt;imre); echo "&lt;br /&gt;".sizeof($myArray[0]-&gt;results); echo "&lt;br /&gt;".$myArray-&gt;results['1']-&gt;imre; echo "&lt;br /&gt;".$myArray[0]-&gt;results[1]-&gt;imre; echo "&lt;br /&gt;".$myArray-&gt;results[1]-&gt;imre; echo "&lt;br /&gt;".sizeof($myArray-&gt;results[1]); ?&gt; </code></pre>
0debug
how to fox an object not to move out of frame in java : Fix this code in such way that rectangle does not move out of frame bounds frame size is (400,400) public void moveRectangle(int dx, int dy) { rect.translate(dx * RECT_WIDTH, dy * RECT_HEIGHT); repaint(); }
0debug
static void spapr_tce_reset(DeviceState *dev) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev); size_t table_size = tcet->nb_table * sizeof(uint64_t); memset(tcet->table, 0, table_size); }
1threat
av_cold int ff_vp56_init_context(AVCodecContext *avctx, VP56Context *s, int flip, int has_alpha) { int i; s->avctx = avctx; avctx->pix_fmt = has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; if (avctx->skip_alpha) avctx->pix_fmt = AV_PIX_FMT_YUV420P; ff_h264chroma_init(&s->h264chroma, 8); ff_hpeldsp_init(&s->hdsp, avctx->flags); ff_videodsp_init(&s->vdsp, 8); ff_vp3dsp_init(&s->vp3dsp, avctx->flags); ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id); for (i = 0; i < 64; i++) { #define TRANSPOSE(x) (x >> 3) | ((x & 7) << 3) s->idct_scantable[i] = TRANSPOSE(ff_zigzag_direct[i]); #undef TRANSPOSE } for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++) { s->frames[i] = av_frame_alloc(); if (!s->frames[i]) { ff_vp56_free(avctx); return AVERROR(ENOMEM); } } s->edge_emu_buffer_alloc = NULL; s->above_blocks = NULL; s->macroblocks = NULL; s->quantizer = -1; s->deblock_filtering = 1; s->golden_frame = 0; s->filter = NULL; s->has_alpha = has_alpha; s->modelp = &s->model; if (flip) { s->flip = -1; s->frbi = 2; s->srbi = 0; } else { s->flip = 1; s->frbi = 0; s->srbi = 2; } return 0; }
1threat
void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *sl) { H264Ref *const ref1 = &sl->ref_list[1][0]; H264Picture *const cur = h->cur_pic_ptr; int list, j, field; int sidx = (h->picture_structure & 1) ^ 1; int ref1sidx = (ref1->reference & 1) ^ 1; for (list = 0; list < sl->list_count; list++) { cur->ref_count[sidx][list] = sl->ref_count[list]; for (j = 0; j < sl->ref_count[list]; j++) cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num + (sl->ref_list[list][j].reference & 3); } if (h->picture_structure == PICT_FRAME) { memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0])); memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0])); } cur->mbaff = FRAME_MBAFF(h); sl->col_fieldoff = 0; if (sl->list_count != 2 || !sl->ref_count[1]) return; if (h->picture_structure == PICT_FRAME) { int cur_poc = h->cur_pic_ptr->poc; int *col_poc = sl->ref_list[1][0].parent->field_poc; sl->col_parity = (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc)); ref1sidx = sidx = sl->col_parity; } else if (!(h->picture_structure & sl->ref_list[1][0].reference) && !sl->ref_list[1][0].parent->mbaff) { sl->col_fieldoff = 2 * sl->ref_list[1][0].reference - 3; } if (sl->slice_type_nos != AV_PICTURE_TYPE_B || sl->direct_spatial_mv_pred) return; for (list = 0; list < 2; list++) { fill_colmap(h, sl, sl->map_col_to_list0, list, sidx, ref1sidx, 0); if (FRAME_MBAFF(h)) for (field = 0; field < 2; field++) fill_colmap(h, sl, sl->map_col_to_list0_field[field], list, field, field, 1); } }
1threat
What * symbol mean in python? : What this mean `np.random.rand(*H1.shape)` ? and what type of output here: ` np.random.rand(*H1.shape) < p ## p= 0.60 60%` I tried Numpy documentation but not get it
0debug
Is it possible to : I have two tables in Big Query Table A: +-------+---------+ | total | date | +-------+---------+ | 1 | 01-01-17| | 3 | 01-02-17| | 2 | 01-03-17| +-------+---------+ Table B: +-------+---------+ | ..... | date | +-------+---------+ | . | 01-01-17| | . | 01-02-17| | . | 01-03-17| | . | 01-04-17| | . | 01-05-17| +-------+---------+ I want to create a query where the results looks like the following table, where it includes all the date from Table B, and any total from Table A if it exists +-------+---------+ | total | date | +-------+---------+ | 1 | 01-01-17| | 3 | 01-02-17| | 2 | 01-03-17| | NULL | 01-04-17| | NULL | 01-05-17| +-------+---------+
0debug