problem
stringlengths
26
131k
labels
class label
2 classes
How can I check if sp package (R software) is installed on my Linux and how can I install it? : <p>I have installed R on my Linux machine. Whenever I type </p> <pre><code>&gt; library(ps) </code></pre> <p>I get </p> <pre><code>Error in library(ps) : there is no package called ‘ps’ </code></pre> <p>How can I check if sp package (R software) is installed on my Linux and how can I install it? </p>
0debug
static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const long chromWidth= width>>1; for(y=0; y<height; y++) { #ifdef HAVE_MMX asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN(4) "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm5, %%mm6 \n\t" "punpcklbw %%mm0, %%mm3 \n\t" "punpckhbw %%mm0, %%mm4 \n\t" "punpcklbw %%mm2, %%mm5 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" MOVNTQ" %%mm3, (%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if defined ARCH_ALPHA && defined HAVE_MVI #define pl2yuy2(n) \ y1 = yc[n]; \ y2 = yc2[n]; \ u = uc[n]; \ v = vc[n]; \ asm("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \ asm("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \ asm("unpkbl %1, %0" : "=r"(u) : "r"(u)); \ asm("unpkbl %1, %0" : "=r"(v) : "r"(v)); \ yuv1 = (u << 8) + (v << 24); \ yuv2 = yuv1 + y2; \ yuv1 += y1; \ qdst[n] = yuv1; \ qdst2[n] = yuv2; int i; uint64_t *qdst = (uint64_t *) dst; uint64_t *qdst2 = (uint64_t *) (dst + dstStride); const uint32_t *yc = (uint32_t *) ysrc; const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride); const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc; for(i = 0; i < chromWidth; i += 8){ uint64_t y1, y2, yuv1, yuv2; uint64_t u, v; asm("ldq $31,64(%0)" :: "r"(yc)); asm("ldq $31,64(%0)" :: "r"(yc2)); asm("ldq $31,64(%0)" :: "r"(uc)); asm("ldq $31,64(%0)" :: "r"(vc)); pl2yuy2(0); pl2yuy2(1); pl2yuy2(2); pl2yuy2(3); yc += 4; yc2 += 4; uc += 4; vc += 4; qdst += 4; qdst2 += 4; } y++; ysrc += lumStride; dst += dstStride; #elif __WORDSIZE >= 64 int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i += 2){ uint64_t k, l; k = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); l = yc[2] + (uc[1] << 8) + (yc[3] << 16) + (vc[1] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i++){ #ifdef WORDS_BIGENDIAN *idst++ = (yc[0] << 24)+ (uc[0] << 16) + (yc[1] << 8) + (vc[0] << 0); #else *idst++ = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
1threat
object of type 'closure' is not subsettable, that doesn't make sense in this situation : <p>I read a few questions that you have already answered however, it doesn't seem to make sense in my situation. you stated in someone else question that they were writing their line as if they were using a function as a dataframe. I get the following error message for the line below:</p> <p>"Error in data[train, ] : object of type 'closure' is not subsettable"</p> <blockquote> <p>booastmodel&lt;- ada(default ~ .,data=data[train,],iter=50,bag.frac=0.5,control=rpart.control(maxdepth=30, + cp=0.01,minsplit=20,xval=10))</p> </blockquote> <p>what am I doing wrong?</p>
0debug
int arm_set_cpu_off(uint64_t cpuid) { CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (target_cpu->powered_off) { qemu_log_mask(LOG_GUEST_ERROR, "[ARM]%s: CPU %" PRId64 " is already off\n", __func__, cpuid); return QEMU_ARM_POWERCTL_IS_OFF; } target_cpu->powered_off = true; target_cpu_state->halted = 1; target_cpu_state->exception_index = EXCP_HLT; cpu_loop_exit(target_cpu_state); return QEMU_ARM_POWERCTL_RET_SUCCESS; }
1threat
how to pass values of stringbuffer to different activities using intent : StringBuffer finalbufferdata = new StringBuffer(); for (int i = 0; i < parentarray.length(); i++) { JSONObject finalobj = parentarray.getJSONObject(i); String id = finalobj.getString("student_id"); String name = finalobj.getString("first_name"); String m_name = finalobj.getString("middle_name"); String l_name = finalobj.getString("last_name"); finalbufferdata.append(id+" "+name+" "+m_name+" "+l_name+"\n"); }
0debug
static int hyperv_handle_properties(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; if (cpu->hyperv_relaxed_timing) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; } if (cpu->hyperv_vapic) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_APIC_ACCESS_AVAILABLE; } if (cpu->hyperv_time && kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV_TIME) > 0) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_HYPERCALL_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_TIME_REF_COUNT_AVAILABLE; env->features[FEAT_HYPERV_EAX] |= 0x200; has_msr_hv_tsc = true; } if (cpu->hyperv_crash && has_msr_hv_crash) { env->features[FEAT_HYPERV_EDX] |= HV_X64_GUEST_CRASH_MSR_AVAILABLE; } env->features[FEAT_HYPERV_EDX] |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE; if (cpu->hyperv_reset && has_msr_hv_reset) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_RESET_AVAILABLE; } if (cpu->hyperv_vpindex && has_msr_hv_vpindex) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_INDEX_AVAILABLE; } if (cpu->hyperv_runtime && has_msr_hv_runtime) { env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { int sint; if (!has_msr_hv_synic || kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNIC_AVAILABLE; env->msr_hv_synic_version = HV_SYNIC_VERSION_1; for (sint = 0; sint < ARRAY_SIZE(env->msr_hv_synic_sint); sint++) { env->msr_hv_synic_sint[sint] = HV_SYNIC_SINT_MASKED; } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { fprintf(stderr, "Hyper-V timers aren't supported by kernel\n"); return -ENOSYS; } env->features[FEAT_HYPERV_EAX] |= HV_X64_MSR_SYNTIMER_AVAILABLE; } return 0; }
1threat
static QObject *parse_escape(JSONParserContext *ctxt, QList **tokens, va_list *ap) { QObject *token = NULL, *obj; QList *working = qlist_copy(*tokens); if (ap == NULL) { goto out; } token = qlist_pop(working); if (token == NULL) { goto out; } if (token_is_escape(token, "%p")) { obj = va_arg(*ap, QObject *); } else if (token_is_escape(token, "%i")) { obj = QOBJECT(qbool_from_int(va_arg(*ap, int))); } else if (token_is_escape(token, "%d")) { obj = QOBJECT(qint_from_int(va_arg(*ap, int))); } else if (token_is_escape(token, "%ld")) { obj = QOBJECT(qint_from_int(va_arg(*ap, long))); } else if (token_is_escape(token, "%lld") || token_is_escape(token, "%I64d")) { obj = QOBJECT(qint_from_int(va_arg(*ap, long long))); } else if (token_is_escape(token, "%s")) { obj = QOBJECT(qstring_from_str(va_arg(*ap, const char *))); } else if (token_is_escape(token, "%f")) { obj = QOBJECT(qfloat_from_double(va_arg(*ap, double))); } else { goto out; } qobject_decref(token); QDECREF(*tokens); *tokens = working; return obj; out: qobject_decref(token); QDECREF(working); return NULL; }
1threat
If ANY element in Array is found in other Array in Python : I have imported by Tweety a timeline of my business oponent. I want to make a research of some keywords imported from file f = open('base.txt','r') with open('base.txt') as f: content = [f.read()] I want to find if he used any words from my keywords list. Can you help me?
0debug
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; int metadata_count; AVCodecContext *enc; int64_t header_offset, cur_pos, hpos; int bit_rate; int64_t duration; ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); tags[0] = av_dict_get(s->metadata, "title" , NULL, 0); tags[1] = av_dict_get(s->metadata, "author" , NULL, 0); tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); tags[3] = av_dict_get(s->metadata, "comment" , NULL, 0); tags[4] = av_dict_get(s->metadata, "rating" , NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; metadata_count = s->metadata ? s->metadata->count : 0; bit_rate = 0; for(n=0;n<s->nb_streams;n++) { enc = s->streams[n]->codec; av_set_pts_info(s->streams[n], 32, 1, 1000); bit_rate += enc->bit_rate; } if (asf->is_streamed) { put_chunk(s, 0x4824, 0, 0xc00); } put_guid(pb, &ff_asf_header); avio_wl64(pb, -1); avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); avio_w8(pb, 1); avio_w8(pb, 2); header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, file_size); file_time = 0; avio_wl64(pb, unix_to_file_time(file_time)); avio_wl64(pb, asf->nb_packets); avio_wl64(pb, duration); avio_wl64(pb, asf->duration); avio_wl64(pb, PREROLL_TIME); avio_wl32(pb, (asf->is_streamed || !pb->seekable ) ? 3 : 2); avio_wl32(pb, s->packet_size); avio_wl32(pb, s->packet_size); avio_wl32(pb, bit_rate); end_header(pb, hpos); hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); avio_wl32(pb, 6); avio_wl16(pb, 0); end_header(pb, hpos); if (has_title) { int len; uint8_t *buf; AVIOContext *dyn_buf; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); hpos = put_header(pb, &ff_asf_comment_header); for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; avio_wl16(pb, len); } len = avio_close_dyn_buf(dyn_buf, &buf); avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, metadata_count); while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); } for(n=0;n<s->nb_streams;n++) { int64_t es_pos; enc = s->streams[n]->codec; asf->streams[n].num = n + 1; asf->streams[n].seq = 0; switch(enc->codec_type) { case AVMEDIA_TYPE_AUDIO: wav_extra_size = 0; extra_size = 18 + wav_extra_size; extra_size2 = 8; break; default: case AVMEDIA_TYPE_VIDEO: wav_extra_size = enc->extradata_size; extra_size = 0x33 + wav_extra_size; extra_size2 = 0; break; } hpos = put_header(pb, &ff_asf_stream_header); if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { put_guid(pb, &ff_asf_audio_stream); put_guid(pb, &ff_asf_audio_conceal_spread); } else { put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); es_pos = avio_tell(pb); avio_wl32(pb, extra_size); avio_wl32(pb, extra_size2); avio_wl16(pb, n + 1); avio_wl32(pb, 0); if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { int wavsize = ff_put_wav_header(pb, enc); if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) { wavsize += 2; avio_wl16(pb, 0); } if (wavsize < 0) return -1; if (wavsize != extra_size) { cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); avio_seek(pb, cur_pos, SEEK_SET); } avio_w8(pb, 0x01); if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){ avio_wl16(pb, 0x0190); avio_wl16(pb, 0x0190); }else{ avio_wl16(pb, enc->block_align); avio_wl16(pb, enc->block_align); } avio_wl16(pb, 0x01); avio_w8(pb, 0x00); } else { avio_wl32(pb, enc->width); avio_wl32(pb, enc->height); avio_w8(pb, 2); avio_wl16(pb, 40 + enc->extradata_size); ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1); } end_header(pb, hpos); } hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); avio_wl32(pb, s->nb_streams); for(n=0;n<s->nb_streams;n++) { AVCodec *p; const char *desc; int len; uint8_t *buf; AVIOContext *dyn_buf; enc = s->streams[n]->codec; p = avcodec_find_encoder(enc->codec_id); if(enc->codec_type == AVMEDIA_TYPE_AUDIO) avio_wl16(pb, 2); else if(enc->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl16(pb, 1); else avio_wl16(pb, -1); if(enc->codec_id == CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; else desc = p ? p->name : enc->codec_name; if ( avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); avio_put_str16le(dyn_buf, desc); len = avio_close_dyn_buf(dyn_buf, &buf); avio_wl16(pb, len / 2); avio_write(pb, buf, len); av_freep(&buf); avio_wl16(pb, 0); if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wl16(pb, 2); avio_wl16(pb, enc->codec_tag); } else { avio_wl16(pb, 4); avio_wl32(pb, enc->codec_tag); } if(!enc->codec_tag) return -1; } end_header(pb, hpos); cur_pos = avio_tell(pb); header_size = cur_pos - header_offset; if (asf->is_streamed) { header_size += 8 + 30 + 50; avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, header_size); avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, header_size); header_size -= 8 + 30 + 50; } header_size += 24 + 6; avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, header_size); avio_seek(pb, cur_pos, SEEK_SET); asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, asf->nb_packets); avio_w8(pb, 1); avio_w8(pb, 1); return 0; }
1threat
static void mirror_start_job(const char *job_id, BlockDriverState *bs, int creation_flags, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base, bool auto_complete, const char *filter_node_name) { MirrorBlockJob *s; BlockDriverState *mirror_top_bs; bool target_graph_mod; bool target_is_backing; Error *local_err = NULL; int ret; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } mirror_top_bs = bdrv_new_open_driver(&bdrv_mirror_top, filter_node_name, BDRV_O_RDWR, errp); if (mirror_top_bs == NULL) { return; } mirror_top_bs->total_sectors = bs->total_sectors; bdrv_ref(mirror_top_bs); bdrv_drained_begin(bs); bdrv_append(mirror_top_bs, bs, &local_err); bdrv_drained_end(bs); if (local_err) { bdrv_unref(mirror_top_bs); error_propagate(errp, local_err); return; } s = block_job_create(job_id, driver, mirror_top_bs, BLK_PERM_CONSISTENT_READ, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD, speed, creation_flags, cb, opaque, errp); bdrv_unref(mirror_top_bs); if (!s) { goto fail; } s->source = bs; s->mirror_top_bs = mirror_top_bs; target_is_backing = bdrv_chain_contains(bs, target); target_graph_mod = (backing_mode != MIRROR_LEAVE_BACKING_CHAIN); s->target = blk_new(BLK_PERM_WRITE | BLK_PERM_RESIZE | (target_graph_mod ? BLK_PERM_GRAPH_MOD : 0), BLK_PERM_WRITE_UNCHANGED | (target_is_backing ? BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD : 0)); ret = blk_insert_bs(s->target, target, errp); if (ret < 0) { goto fail; } s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->is_none_mode = is_none_mode; s->backing_mode = backing_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; if (auto_complete) { s->should_complete = true; } s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { goto fail; } block_job_add_bdrv(&s->common, "target", target, 0, BLK_PERM_ALL, &error_abort); if (target_is_backing) { BlockDriverState *iter; for (iter = backing_bs(bs); iter != target; iter = backing_bs(iter)) { ret = block_job_add_bdrv(&s->common, "intermediate node", iter, 0, BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE, errp); if (ret < 0) { goto fail; } } } trace_mirror_start(bs, s, opaque); block_job_start(&s->common); return; fail: if (s) { g_free(s->replaces); blk_unref(s->target); block_job_unref(&s->common); } bdrv_child_try_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL, &error_abort); bdrv_replace_node(mirror_top_bs, backing_bs(mirror_top_bs), &error_abort); }
1threat
PHP's $_SERVER: QUERY_STRING : <p>on <a href="http://php.net/manual/en/reserved.variables.server.php" rel="nofollow">http://php.net/manual/en/reserved.variables.server.php</a>, it says</p> <p>" 'QUERY_STRING' The query string, if any, via which the page was accessed. "</p> <p>I've been having trouble comprehending that. As I understand it, the query string is simply there as input to the page. The script which the URL addresses uses the query string to do its work and generate whatever appropriate response it is designed to do. </p> <p>I could understand, however, how that response (i.e. the webpage the script sends back) is said to be gotten via the query string, since the values in the query string were used to formulate it.. , but not the initial script that processed it. </p> <p>It's a semantics issue.. appreciate your explanations.</p>
0debug
static void gen_jump(DisasContext *dc, uint32_t imm, uint32_t reg, uint32_t op0) { target_ulong tmp_pc; tmp_pc = sign_extend((imm<<2), 26) + dc->pc; switch (op0) { case 0x00: tcg_gen_movi_tl(jmp_pc, tmp_pc); break; case 0x01: tcg_gen_movi_tl(cpu_R[9], (dc->pc + 8)); tcg_gen_movi_tl(jmp_pc, tmp_pc); break; case 0x03: case 0x04: { int lab = gen_new_label(); TCGv sr_f = tcg_temp_new(); tcg_gen_movi_tl(jmp_pc, dc->pc+8); tcg_gen_andi_tl(sr_f, cpu_sr, SR_F); tcg_gen_brcondi_i32(op0 == 0x03 ? TCG_COND_EQ : TCG_COND_NE, sr_f, SR_F, lab); tcg_gen_movi_tl(jmp_pc, tmp_pc); gen_set_label(lab); tcg_temp_free(sr_f); } break; case 0x11: tcg_gen_mov_tl(jmp_pc, cpu_R[reg]); break; case 0x12: tcg_gen_movi_tl(cpu_R[9], (dc->pc + 8)); tcg_gen_mov_tl(jmp_pc, cpu_R[reg]); break; default: gen_illegal_exception(dc); break; } dc->delayed_branch = 2; dc->tb_flags |= D_FLAG; gen_sync_flags(dc); }
1threat
Div class not applying : My css class is not working Here is the code: html <div class="edubtn" onclick="show()" >ORDER</div> css .edubtn{ background-color: #862165; border: 0; padding: 2 10px; color: rgba(255,255,255,0.7); } .edubtn:hover{ color: #fff; }
0debug
How can I assign a class to a report not on odd, even rows but on the change of a date column? : <p>I have a very simple report in AngularJS:</p> <pre><code>&lt;div class="gridHeader"&gt; &lt;div&gt;User&lt;/div&gt; &lt;div&gt;Date&lt;/div&gt; &lt;div&gt;Count&lt;/div&gt; &lt;/div&gt; &lt;div class="gridBody" &lt;div class="gridRow" ng-repeat="row in rps.reports"&gt; &lt;div&gt;{{row.user}}&lt;/div&gt; &lt;div&gt;{{row.date}}&lt;/div&gt; &lt;div&gt;{{row.count}}&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The report works but it's difficult to notice when the date changes. </p> <p>Is there some way that I could assign a class to the grid row so that one date grid row has one class and the next date the grid row has another class. I think this is already available for odd and even rows with Angular but here I need it to work on every date change. </p>
0debug
net::ERR_INSECURE_RESPONSE in Chrome : <p>I am getting an error net::ERR_INSECURE_RESPONSE in the Chrome console when fetching some data from my API</p> <p>This error usually occurs as a result of an unsigned certificate; however, it is not an issue with this because I have a valid and signed certificate. </p> <p>The error doesn't happen often at all and it goes away if I restart my Chrome browser. It also doesn't occur in any other browser at all (tested on Safari, Mozilla, Opera)</p> <p>Any idea why this is happening? Is this just a browser bug?</p>
0debug
How can i search a String to know if it contains a date? and How can i extract it? : I have a code which reads messages and if the message has a date in it then It should specifically be shown in display.I got stuck at the part where I have to search the entire String for date and to extract it?
0debug
static void tm_get(QEMUFile *f, struct tm *tm) { tm->tm_sec = qemu_get_be16(f); tm->tm_min = qemu_get_be16(f); tm->tm_hour = qemu_get_be16(f); tm->tm_mday = qemu_get_be16(f); tm->tm_min = qemu_get_be16(f); tm->tm_year = qemu_get_be16(f); }
1threat
Uncaught (in promise): Error: Cannot read property of undefined : <p>Component take user from service with params</p> <pre><code>@Component({ selector: 'users', providers: [UserService], template: ` &lt;p&gt;{{user.id}}&lt;/p&gt; ` }) export class UserPageComponent implements OnInit { constructor( private userService: UserService, private route: ActivatedRoute ) {}; ngOnInit(): void { this.route.params.forEach((params: Params) =&gt; { let id = +params['id']; this.userService.getUser(id) .then(user =&gt; {console.log(user.id);this.user = user}) }); } </code></pre> <p>Service :</p> <pre><code>@Injectable() export class UserService { private postUrl = 'http://127.0.0.1:8000/user-detail/'; // URL to web api constructor(private http: Http) { } getUser(id: number): Promise&lt;User&gt; { return this.http.get(this.postUrl+id) .toPromise() .then(response =&gt; response.json() as User) .catch(this.handleError); }; </code></pre> <p>And I get Error <code>Uncaught (in promise): Error: Error in ./UserPageComponent class UserPageComponent - inline template:1:7 caused by: Cannot read property 'id' of undefined</code></p> <p>It looks as if the service does not send the promise, although it should. How to solve this proble?</p>
0debug
static int64_t coroutine_fn bdrv_co_get_block_status_above(BlockDriverState *bs, BlockDriverState *base, int64_t sector_num, int nb_sectors, int *pnum) { BlockDriverState *p; int64_t ret = 0; assert(bs != base); for (p = bs; p != base; p = backing_bs(p)) { ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum); if (ret < 0 || ret & BDRV_BLOCK_ALLOCATED) { break; } nb_sectors = MIN(nb_sectors, *pnum); } return ret; }
1threat
c - strtok() crashing : <p>I got this problem with strtok:</p> <pre><code>void getFile(FILE *fp, TParts *str) { char a[60], *b; int p = 0, m = 0; while(fgets(a, 60, fp) != NULL) { b = strtok(a, '$'); ... </code></pre> <p>The program crashes when strtok is called. Tokens in strings are separated with $. What's wrong?</p>
0debug
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; int metadata_count; AVCodecParameters *par; int64_t header_offset, cur_pos, hpos; int bit_rate; int64_t duration; ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); tags[0] = av_dict_get(s->metadata, "title", NULL, 0); tags[1] = av_dict_get(s->metadata, "author", NULL, 0); tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); tags[3] = av_dict_get(s->metadata, "comment", NULL, 0); tags[4] = av_dict_get(s->metadata, "rating", NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; metadata_count = av_dict_count(s->metadata); bit_rate = 0; for (n = 0; n < s->nb_streams; n++) { par = s->streams[n]->codecpar; avpriv_set_pts_info(s->streams[n], 32, 1, 1000); bit_rate += par->bit_rate; } if (asf->is_streamed) { put_chunk(s, 0x4824, 0, 0xc00); } put_guid(pb, &ff_asf_header); avio_wl64(pb, -1); avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); avio_w8(pb, 1); avio_w8(pb, 2); header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, file_size); file_time = 0; avio_wl64(pb, unix_to_file_time(file_time)); avio_wl64(pb, asf->nb_packets); avio_wl64(pb, duration); avio_wl64(pb, asf->duration); avio_wl64(pb, PREROLL_TIME); avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2); avio_wl32(pb, s->packet_size); avio_wl32(pb, s->packet_size); avio_wl32(pb, bit_rate); end_header(pb, hpos); hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); avio_wl32(pb, 6); avio_wl16(pb, 0); end_header(pb, hpos); if (has_title) { int len; uint8_t *buf; AVIOContext *dyn_buf; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); hpos = put_header(pb, &ff_asf_comment_header); for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; avio_wl16(pb, len); } len = avio_close_dyn_buf(dyn_buf, &buf); avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, metadata_count); while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); } if (!asf->is_streamed && s->nb_chapters) { int ret; if (ret = asf_write_markers(s)) return ret; } for (n = 0; n < s->nb_streams; n++) { int64_t es_pos; par = s->streams[n]->codecpar; asf->streams[n].num = n + 1; asf->streams[n].seq = 0; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: wav_extra_size = 0; extra_size = 18 + wav_extra_size; extra_size2 = 8; break; default: case AVMEDIA_TYPE_VIDEO: wav_extra_size = par->extradata_size; extra_size = 0x33 + wav_extra_size; extra_size2 = 0; break; } hpos = put_header(pb, &ff_asf_stream_header); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { put_guid(pb, &ff_asf_audio_stream); put_guid(pb, &ff_asf_audio_conceal_spread); } else { put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); es_pos = avio_tell(pb); avio_wl32(pb, extra_size); avio_wl32(pb, extra_size2); avio_wl16(pb, n + 1); avio_wl32(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { int wavsize = ff_put_wav_header(s, pb, par); if (wavsize < 0) return -1; if (wavsize != extra_size) { cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); avio_seek(pb, cur_pos, SEEK_SET); } avio_w8(pb, 0x01); if (par->codec_id == AV_CODEC_ID_ADPCM_G726 || !par->block_align) { avio_wl16(pb, 0x0190); avio_wl16(pb, 0x0190); } else { avio_wl16(pb, par->block_align); avio_wl16(pb, par->block_align); } avio_wl16(pb, 0x01); avio_w8(pb, 0x00); } else { avio_wl32(pb, par->width); avio_wl32(pb, par->height); avio_w8(pb, 2); avio_wl16(pb, 40 + par->extradata_size); ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1); } end_header(pb, hpos); } hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); avio_wl32(pb, s->nb_streams); for (n = 0; n < s->nb_streams; n++) { const AVCodecDescriptor *codec_desc; const char *desc; par = s->streams[n]->codecpar; codec_desc = avcodec_descriptor_get(par->codec_id); if (par->codec_type == AVMEDIA_TYPE_AUDIO) avio_wl16(pb, 2); else if (par->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl16(pb, 1); else avio_wl16(pb, -1); if (par->codec_id == AV_CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; else desc = codec_desc ? codec_desc->name : NULL; if (desc) { AVIOContext *dyn_buf; uint8_t *buf; int len; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); avio_put_str16le(dyn_buf, desc); len = avio_close_dyn_buf(dyn_buf, &buf); avio_wl16(pb, len / 2); avio_write(pb, buf, len); av_freep(&buf); } else avio_wl16(pb, 0); avio_wl16(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wl16(pb, 2); avio_wl16(pb, par->codec_tag); } else { avio_wl16(pb, 4); avio_wl32(pb, par->codec_tag); } if (!par->codec_tag) return -1; } end_header(pb, hpos); cur_pos = avio_tell(pb); header_size = cur_pos - header_offset; if (asf->is_streamed) { header_size += 8 + 30 + DATA_HEADER_SIZE; avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, header_size); avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, header_size); header_size -= 8 + 30 + DATA_HEADER_SIZE; } header_size += 24 + 6; avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, header_size); avio_seek(pb, cur_pos, SEEK_SET); asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, asf->nb_packets); avio_w8(pb, 1); avio_w8(pb, 1); return 0; }
1threat
Margin collapse : <p>How can I disable margin collapse and get 200px margin without changing the HTML?</p> <p>code: </p> <pre><code>&lt;style&gt; div{ font-size: 100px; border: 10px solid black; padding: 20px; margin: 100px; &lt;/style&gt; &lt;body&gt; &lt;div&gt;AAAA&lt;/div&gt; &lt;div&gt;AAAA&lt;/div&gt; &lt;/body&gt; </code></pre> <p>Thanks, :D.</p>
0debug
I'm trying to create a formula to work out the number of answers in a single cell. Each line in entered with ALT+Enter : [Sample of the data. Column A is imported data and Column B is the result.][1] [1]: http://i.stack.imgur.com/oJntG.png
0debug
text file reading with dict in python : From bellow text file, read the text file into a python proram and group all the words according to their first letter. Represent the groups in form of dictionary. Where the staring alphabet is the "key" and all the words starting with the alphabets are list of "values". text file is : Among other public buildings in a certain town, which for many reason it will be prudent to refine from mentioning, and to which i will assign no fictitious name, there is one anciently common to most towns, great or small.
0debug
jQuery & Javascript Differences : <p>I understand the difference between jQuery &amp; JavaScript but I don't know which to learn and why to learn it.</p> <p>For example I know jQuery makes a lot of functions &amp; activities much easier than the JavaScript equivalent but that's really all I know in for jQuery's Advantages. But what if I come across something that can only be done in plain JavaScript? But by the time I'm advanced with jQuery, attempting to do the JavaScript equivalent might be overly complexed and maybe hinder completion for whatever reason.</p> <p>And if jQuery makes everything much easier why should I bother learning plain JavaScript? is there an advantage to not using jQuery to complete projects, do more developers use JavaScript, does it hold a job better than a jQuery developer, is there more resources out there for JavaScript over jQuery, is JavaScript more compatible with other languages further down the line, will I be able to do more complex functions and build more complex applications using plain JavaScript?</p> <p>I basically want to become a full stack developer and I've hit the JavaScript section of my personal development and want to make the right decision and in a way to me jQuery feels like you have less control because its easier if that makes sense.</p> <p>All these questions spring to mind but the main question I want answering is why should I learn which and why not the other. I would really appreciate an answer from another developers point of view.</p> <p>Thank you all!</p>
0debug
Python converting from base64 to binary : <p>I have a problem about converting a base64 encoded string into binary. I am collecting the Fingerprint2D in the following link,</p> <pre><code>url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/108770/property/Fingerprint2D/xml" Fingerprint2D=AAADccB6OAAAAAAAAAAAAAAAAAAAAAAAAAA8WIEAAAAAAACxAAAAHgAACAAADAzBmAQwzoMABgCI AiTSSACCCAAhIAAAiAEMTMgMJibMsZuGeijn4BnI+YeQ0OMOKAACAgAKAABQAAQEABQAAAAAAAAA AA== </code></pre> <p>The descriptiong in the Pubchem says that this is 115 byte string, and it should be 920 bits when converted into binary. I try to convert it to the binary with the following,</p> <pre><code> response = requests.get(url) tree = ET.fromstring(response.text) for el in tree[0]: if "Fingerprint2D" in el.tag: fpp = bin(int(el.text, 16)) print(len(fpp)) </code></pre> <p>If I use the code above, I'm getting the following error, "Value error: invalid literal for int() with base16:</p> <p>And if I use the code below, length of fpp (binary) is equal to 1278 which is not what I expected. </p> <pre><code> response = requests.get(url) tree = ET.fromstring(response.text) for el in tree[0]: if "Fingerprint2D" in el.tag: fpp = bin(int(hexlify(el.text), 16)) print(len(fpp)) </code></pre> <p>Thanks a lot already!!</p>
0debug
static void mv88w8618_eth_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { mv88w8618_eth_state *s = opaque; switch (offset) { case MP_ETH_SMIR: s->smir = value; break; case MP_ETH_PCXR: s->vlan_header = ((value >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2; break; case MP_ETH_SDCMR: if (value & MP_ETH_CMD_TXHI) { eth_send(s, 1); } if (value & MP_ETH_CMD_TXLO) { eth_send(s, 0); } if (value & (MP_ETH_CMD_TXHI | MP_ETH_CMD_TXLO) && s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_ICR: s->icr &= value; break; case MP_ETH_IMR: s->imr = value; if (s->icr & s->imr) { qemu_irq_raise(s->irq); } break; case MP_ETH_FRDP0 ... MP_ETH_FRDP3: s->frx_queue[(offset - MP_ETH_FRDP0)/4] = value; break; case MP_ETH_CRDP0 ... MP_ETH_CRDP3: s->rx_queue[(offset - MP_ETH_CRDP0)/4] = s->cur_rx[(offset - MP_ETH_CRDP0)/4] = value; break; case MP_ETH_CTDP0 ... MP_ETH_CTDP3: s->tx_queue[(offset - MP_ETH_CTDP0)/4] = value; break; } }
1threat
void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) { smc91c111_state *s; int iomemtype; qemu_check_nic_model(nd, "smc91c111"); s = (smc91c111_state *)qemu_mallocz(sizeof(smc91c111_state)); iomemtype = cpu_register_io_memory(0, smc91c111_readfn, smc91c111_writefn, s); cpu_register_physical_memory(base, 16, iomemtype); s->irq = irq; memcpy(s->macaddr, nd->macaddr, 6); smc91c111_reset(s); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, smc91c111_receive, smc91c111_can_receive, s); qemu_format_nic_info_str(s->vc, s->macaddr); }
1threat
static int con_initialise(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); int limit; if (xenstore_read_int(con->console, "ring-ref", &con->ring_ref) == -1) return -1; if (xenstore_read_int(con->console, "port", &con->xendev.remote_port) == -1) return -1; if (xenstore_read_int(con->console, "limit", &limit) == 0) con->buffer.max_capacity = limit; if (!xendev->dev) { con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom, XC_PAGE_SIZE, PROT_READ|PROT_WRITE, con->ring_ref); } else { con->sring = xengnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom, con->ring_ref, PROT_READ|PROT_WRITE); } if (!con->sring) return -1; xen_be_bind_evtchn(&con->xendev); if (con->chr) { if (qemu_chr_fe_claim(con->chr) == 0) { qemu_chr_add_handlers(con->chr, xencons_can_receive, xencons_receive, NULL, con); } else { xen_be_printf(xendev, 0, "xen_console_init error chardev %s already used\n", con->chr->label); con->chr = NULL; } } xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", con->ring_ref, con->xendev.remote_port, con->xendev.local_port, con->buffer.max_capacity); return 0; }
1threat
static void msix_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1); int vector = offset / MSIX_ENTRY_SIZE; memcpy(dev->msix_table_page + offset, &val, 4); if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) { msix_clr_pending(dev, vector); msix_notify(dev, vector); } }
1threat
Angular 2 Set focus on first field of form on component load : <p>In my app I want to automatically set focus on first field of form on component load. Can anyone please guide how to achieve this without any repetition as I want this on every form (Reactive Forms) in my app.</p>
0debug
How to get these image in my page in responsive for every device? : <p><a href="https://i.stack.imgur.com/Jz4Wv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jz4Wv.jpg" alt="I want these images in my page to be responsive for every device. Please help wit div col thing. "></a></p> <p>I want these images in my page to be responsive for every device. Please help wit div col thing. </p>
0debug
static int mkv_write_tag_targets(AVFormatContext *s, unsigned int elementid, unsigned int uid, ebml_master *tags, ebml_master* tag) { AVIOContext *pb; MatroskaMuxContext *mkv = s->priv_data; ebml_master targets; int ret; if (!tags->pos) { ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb)); if (ret < 0) return ret; start_ebml_master_crc32(s->pb, &mkv->tags_bc, tags, MATROSKA_ID_TAGS, 0); } pb = mkv->tags_bc; *tag = start_ebml_master(pb, MATROSKA_ID_TAG, 0); targets = start_ebml_master(pb, MATROSKA_ID_TAGTARGETS, 0); if (elementid) put_ebml_uint(pb, elementid, uid); end_ebml_master(pb, targets); return 0; }
1threat
Java comparator sort in reverse order : <p>I would like to sort from highest to lowest.</p> <p>From lowest to highest, you would normally do:</p> <pre><code>@Override public int compare(Person p1, Person p2) { return (p1.getAge() - p2.getAge()); } </code></pre> <p>This would sort people by age from lowest to highest.</p> <p>How do I do the reverse of this?</p>
0debug
static int h264_extradata_to_annexb(AVCodecContext *avctx, const int padding) { uint16_t unit_size; uint64_t total_size = 0; uint8_t *out = NULL, unit_nb, sps_done = 0, sps_seen = 0, pps_seen = 0; const uint8_t *extradata = avctx->extradata + 4; static const uint8_t nalu_header[4] = { 0, 0, 0, 1 }; int length_size = (*extradata++ & 0x3) + 1; unit_nb = *extradata++ & 0x1f; if (!unit_nb) { goto pps; } else { sps_seen = 1; } while (unit_nb--) { void *tmp; unit_size = AV_RB16(extradata); total_size += unit_size + 4; if (total_size > INT_MAX - padding || extradata + 2 + unit_size > avctx->extradata + avctx->extradata_size) { av_free(out); return AVERROR(EINVAL); } tmp = av_realloc(out, total_size + padding); if (!tmp) { av_free(out); return AVERROR(ENOMEM); } out = tmp; memcpy(out + total_size - unit_size - 4, nalu_header, 4); memcpy(out + total_size - unit_size, extradata + 2, unit_size); extradata += 2 + unit_size; pps: if (!unit_nb && !sps_done++) { unit_nb = *extradata++; if (unit_nb) pps_seen = 1; } } if (out) memset(out + total_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); if (!sps_seen) av_log(avctx, AV_LOG_WARNING, "Warning: SPS NALU missing or invalid. " "The resulting stream may not play.\n"); if (!pps_seen) av_log(avctx, AV_LOG_WARNING, "Warning: PPS NALU missing or invalid. " "The resulting stream may not play.\n"); av_free(avctx->extradata); avctx->extradata = out; avctx->extradata_size = total_size; return length_size; }
1threat
iscsi_unmap_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { IscsiAIOCB *acb = opaque; if (acb->canceled != 0) { qemu_aio_release(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; return; } acb->status = 0; if (status < 0) { error_report("Failed to unmap data on iSCSI lun. %s", iscsi_get_error(iscsi)); acb->status = -EIO; } iscsi_schedule_bh(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; }
1threat
over partition by lowest bigger than avg : <p>I have to find the lowest salary of department which is higher than the average salary of the department.</p>
0debug
What is the meaning of the phrase "[this piece of software] is a port of [that piece of software]"? : <p>I gather here "a port of" means "an adaptation of". Am I right? </p>
0debug
Getting "No qmlscene installed." warning in "QT CREATOR" on "Ubuntu" : <p>i added QTStatic to QT Versions, but i cant use this version to build and set in kits tab.</p> <p>i uploaded screenshot below : (plz help)</p> <p><a href="http://i.stack.imgur.com/rpaGB.jpg" rel="noreferrer">Versions Tab Screenshot</a></p> <p><a href="http://i.stack.imgur.com/3TRye.jpg" rel="noreferrer">Kits Tab Screenshot</a></p>
0debug
def remove_matching_tuple(test_list1, test_list2): res = [sub for sub in test_list1 if sub not in test_list2] return (res)
0debug
Android studio - share data between activity : <p>Im making an app/game in android studio. And I have over 10 activities in my app/game and I have f.eks "int HP" I want to share with the others activities. </p>
0debug
how to redirect or call routerlink in ts file in angular2 : <p>This is angular 2 routing code</p> <pre><code> &lt;nav&gt; &lt;ul class="nav nav-tabs"&gt; &lt;li role="presentation" class="active"&gt;&lt;a routerLink="/dashboard" routerLinkActive="active"&gt;Step I&lt;/a&gt;&lt;/li&gt; &lt;li role="presentation"&gt; &lt;a routerLink="/faculty" routerLinkActive="active"&gt;Step II&lt;/a&gt;&lt;/li&gt; &lt;li role="presentation"&gt;&lt;a routerLink="/heroes" routerLinkActive="active"&gt;Step III&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;router-outlet&gt;&lt;/router-outlet&gt; </code></pre> <p>button click event</p> <pre><code>clickFunctionEvent(value: any) { this.dataService.setFacultyAnswer(JSON.stringify(value)).subscribe( tradeshows =&gt; { this.data= tradeshows //if data=success then redirect to next routerLink like "/faculty" }, error =&gt; {console.error('QuestionList:\n\t ' + error);} ); } </code></pre> <p>if <code>data=success</code> then redirect to next routerLink like <code>"/faculty"</code> </p> <p>so how to it in <code>.ts</code> file </p> <p>And <code>how to disable previous routerLink so not allow to go back</code></p> <p>thanks in advance</p>
0debug
how to play/pause video in React without external library? : <p>I have a video tag () in my webpage, and a "play/pause" button that when the user clicks on it, the video starts/stops playing . How can I do so in react if I'm not allowed to use js in order to call "getElementById" and then to use play()/pause() build-in methods. Any idea? </p>
0debug
How to fix show method while using MetroMessageBox : <p>Right now I am exploring the modern metroframework in c# but right now I got stuck with this one thing.</p> <p>If I make a MetroMessageBox by doing the following:</p> <pre><code>MetroMessageBox.Show("", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); </code></pre> <p>I get a red line under my 'show' . The error in the errorlist tells me the following: No overload for method 'Show' takes 4 arguments.</p> <p>I already thank you all for the help</p>
0debug
What is the difference between struct complex (*ptr1)[4] and struct complex *ptr1 ?? which is better to use? : 1. struct complex *ptr1=(struct complex*)malloc(4*sizeof(struct complex)); 2. struct complex (*ptr1)[4]=(struct complex*)malloc(sizeof(struct complex));
0debug
What exactly is Fragmented mp4(fMP4)? How is it different from normal mp4? : <p>Media Source Extension (<strong>MSE</strong>) needs fragmented mp4 for playback in the browser.</p>
0debug
Kentico 9 Email Marketing : <p>Whenever we send out a marketing email campaign, the emails seem to be sent out roughly every 3 minutes:</p> <p><a href="https://i.stack.imgur.com/yYCr5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yYCr5.png" alt="enter image description here"></a></p> <p>Where would I find the admin setting to increase this frequency to say every 5 seconds?</p>
0debug
Strings from index in array - Javascript : <p>If I have an array of strings:</p> <pre><code>array1 = ['mango', 'orange', 'apple','strawberry']; </code></pre> <p>and one array of indexes:</p> <pre><code>array2 = [1,3]; </code></pre> <p>How can I create a new array with the strings in array1, based on the indexes in array2?</p> <p>The new array would in this case look like this:</p> <pre><code>array3 = [orange, strawberry] </code></pre>
0debug
how to get the Total sum for column with joins in sql server : I'm trying to get sum of the packages from this query, but it doesn't give me the correct result. Select sum(i.cdin_NoofPackages),i.cdin_cdindexid as cntdp, coalesce((i.cdin_NoofPackages),0) as sqty,coalesce((i.cdin_WT),0) as swt ,coalesce((i.cdin_volumewt),0) as svwt ,coalesce((i.cdin_MortgageAmount),0) as samt from cdindex i inner join company c on i.cdin_CompanyId =c.Comp_CompanyId inner join Territories t on i.cdin_Secterr =t.Terr_TerritoryID left outer join Performainv p on i.cdin_cdindexid=p.pinv_cdindexid where(cdin_deleted Is null And c.comp_deleted Is null And t.Terr_Deleted Is null and p.pinv_deleted is null and (p.pinv_InvoiceProperty ='01' or p.pinv_InvoiceProperty is null ) and (p.pinv_Status in('Draft','Posted') or p.pinv_status is null) ) and i.cdin_startunstufdate between '2016-07-01' and '2016-07-11' group by i.cdin_cdindexid,i.cdin_NoofPackages,i.cdin_WT,i.cdin_volumewt ,i.cdin_MortgageAmount [This is a screen shot of query result][1] [1]: http://i.stack.imgur.com/3BhuX.jpg
0debug
How to read website content from url in flutter : <p>I need an application that reads the content of a site, given the url it navigates the DOM and extracts the content of the components.</p>
0debug
Firebase Remote Config with Namespace : <p>The Firebase <a href="https://firebase.google.com/docs/reference/android/com/google/firebase/remoteconfig/FirebaseRemoteConfig.html#public-methods" rel="noreferrer">API for RemoteConfig</a> has several methods for assigning config values by namespace, eg (<code>setDefaults(R.xml.rc_defaults, "Namespace")</code>). I've got this to work in terms of separating config values by namespace on Android, but how to do I set those values by namespace on the Firebase Console for remote updating?</p> <p><a href="https://i.stack.imgur.com/l0kT1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/l0kT1.png" alt="Where is the Namespace assigned?"></a></p>
0debug
import math def sum_of_odd_Factors(n): res = 1 while n % 2 == 0: n = n // 2 for i in range(3,int(math.sqrt(n) + 1)): count = 0 curr_sum = 1 curr_term = 1 while n % i == 0: count+=1 n = n // i curr_term *= i curr_sum += curr_term res *= curr_sum if n >= 2: res *= (1 + n) return res
0debug
Does anybody know the keyboard shortcut to open a new terminal tab on Bash on Ubuntu on Windows? : <p>I hope you guys are doing well.</p> <p>Does anybody know the keyboard shortcut to open a new terminal tab on "Bash on Ubuntu on Windows"? I have tried several shortcuts like <code>ctrl + shift + t</code> etc... but without success.</p> <p>I have also tried install <code>xdotool</code>. However, when I type <code>xdotool key ctrl+shift+t</code>, the output I have is:</p> <p><code>Error: Can't open display: (null) Failed creating new xdo instance</code></p> <p>Thank you for helping me!</p>
0debug
How to Dump a .NET Core Application on Linux : <p>I have a .NET application that I have ported to .NET Core. I am testing it on Ubuntu 14.04.</p> <p>I am trying to figure out how to get a .dmp file or the Linux equivalent when the program crashes. I call <code>Environment.FailFast</code> but as far as I can tell this doesn't generate a .dmp file like it does on Windows. Acording to <a href="https://github.com/dotnet/coreclr/issues/1321">this case</a> <code>Environment.FailFast</code> should be creating a dump but if it is I can't find it.</p> <p>In addition I have tried manually creating a dump using <code>gcore</code>. This works however it takes a long time to generate the dump (my application isn't that big) and I am unable to get the correct callstacks in gdb after the fact as when I point gdb to my application dll it doesn't recognize it.</p> <p>What it he best way to get a dump of a .NET Core application on Linux?</p> <p>Thanks!</p>
0debug
Extract all noon data from a timeseries : <p>I am working on hourly electric load data which has 8760 points for the entire year It looks like this</p> <pre><code>Date ... 2017-01-01 00:00:00 ... 2017-01-01 01:00:00 ... 2017-01-01 02:00:00 ... 2017-01-01 03:00:00 ... 2017-01-01 04:00:00 ... </code></pre> <p>My goal is to get all the noon data(values at 12:00 for every day of the year) in a separate dataframe.</p> <p>I tried df.groupby(df.index.hour) but it aggregates the data for every hour </p> <p>Any help on this would be great.</p>
0debug
static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end, vtd_page_walk_hook hook_fn, void *private, bool notify_unmap) { dma_addr_t addr = vtd_ce_get_slpt_base(ce); uint32_t level = vtd_ce_get_level(ce); if (!vtd_iova_range_check(start, ce)) { return -VTD_FR_ADDR_BEYOND_MGAW; } if (!vtd_iova_range_check(end, ce)) { end = vtd_iova_limit(ce); } return vtd_page_walk_level(addr, start, end, hook_fn, private, level, true, true, notify_unmap); }
1threat
Insert data to the controls in one windows application from another application : <p>I am working on a windows application and I want to insert some data to the controls in another windows application from my application. I think it's possible using <strong>spy++</strong> or <strong>AutoIt.</strong> </p> <p>But on searching I found only code like clicking a button in another application from one application. </p> <p>What I need is, </p> <p>I have <strong>3</strong> textboxes in <strong>WindowsApp_1</strong> and I need to fill these from the value sending from <strong>WindowsApp_2</strong>. Could you please give me a sample code to achieve this ?</p>
0debug
regex extract numbers only from string : <p>We got following strings, how can we just extract numbers only from this pls:</p> <pre><code>String 1: 29.Terms &amp; Conditions Output Expected: 29 String 2: 29.1Termination Date or 29.11Termination Date Output Expected: 29.1 or 29.11 (as per above strings) </code></pre> <p>We want to do this in asp.net using regex</p>
0debug
android button switch text with imageButton : <p>I have button1 with text "ohio", button2 with text "alaska", and ImageButton with arrow as background. I want to switch text Button1 to Button2 and vice versa when ImageButton clicked, how do I achieve this? or is there any reference in github that I can try?</p>
0debug
static ExitStatus op_ex(DisasContext *s, DisasOps *o) { TCGv_i64 tmp; update_psw_addr(s); update_cc_op(s); tmp = tcg_const_i64(s->next_pc); gen_helper_ex(cc_op, cpu_env, cc_op, o->in1, o->in2, tmp); tcg_temp_free_i64(tmp); set_cc_static(s); return NO_EXIT; }
1threat
static int get_str(ByteIOContext *bc, char *string, int maxlen){ int len= get_v(bc); if(len && maxlen) get_buffer(bc, string, FFMIN(len, maxlen)); while(len > maxlen){ get_byte(bc); len--; } if(maxlen) string[FFMIN(len, maxlen-1)]= 0; if(maxlen == len) return -1; else return 0; }
1threat
how to get specific value from data base by id : how to get specific value from data base by id. This is my table: [tag:TABLE-RECORDS]-(name of table) and [tag:KEY-ID] , [tag:KEY-PRICE] ... I'm trying to get [tag:KEY-PRICE] by [tag:KEY-ID] and can not. How to do it?
0debug
static void input_linux_event_keyboard(void *opaque) { InputLinux *il = opaque; struct input_event event; int rc; for (;;) { rc = read(il->fd, &event, sizeof(event)); if (rc != sizeof(event)) { if (rc < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); } break; } input_linux_handle_keyboard(il, &event); } }
1threat
static int svq3_decode_slice_header(AVCodecContext *avctx) { SVQ3Context *svq3 = avctx->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; const int mb_xy = h->mb_xy; int i, header; header = get_bits(&s->gb, 8); if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) { av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header); return -1; } else { int length = (header >> 5) & 3; svq3->next_slice_index = get_bits_count(&s->gb) + 8*show_bits(&s->gb, 8*length) + 8*length; if (svq3->next_slice_index > s->gb.size_in_bits) { av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n"); return -1; } s->gb.size_in_bits = svq3->next_slice_index - 8*(length - 1); skip_bits(&s->gb, 8); if (svq3->watermark_key) { uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1]); AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1], header ^ svq3->watermark_key); } if (length > 0) { memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3], &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1)); } skip_bits_long(&s->gb, 0); } if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i); return -1; } h->slice_type = golomb_to_pict_type[i]; if ((header & 0x9F) == 2) { i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1)); s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width)); } else { skip_bits1(&s->gb); s->mb_skip_run = 0; } h->slice_num = get_bits(&s->gb, 8); s->qscale = get_bits(&s->gb, 5); s->adaptive_quant = get_bits1(&s->gb); skip_bits1(&s->gb); if (svq3->unknown_flag) { skip_bits1(&s->gb); } skip_bits1(&s->gb); skip_bits(&s->gb, 2); while (get_bits1(&s->gb)) { skip_bits(&s->gb, 8); } if (s->mb_x > 0) { memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - 1 ]+3, -1, 4*sizeof(int8_t)); memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_x] , -1, 8*sizeof(int8_t)*s->mb_x); } if (s->mb_y > 0) { memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x)); if (s->mb_x > 0) { h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] = -1; } } return 0; }
1threat
static void encode_frame(VC2EncContext *s, const AVFrame *frame, const char *aux_data, int field) { int i; encode_parse_info(s, DIRAC_PCODE_SEQ_HEADER); encode_seq_header(s); if (aux_data) { encode_parse_info(s, DIRAC_PCODE_AUX); avpriv_put_string(&s->pb, aux_data, 1); } encode_parse_info(s, DIRAC_PCODE_PICTURE_HQ); encode_picture_start(s); for (i = 0; i < 3; i++) { s->transform_args[i].ctx = s; s->transform_args[i].field = field; s->transform_args[i].plane = &s->plane[i]; s->transform_args[i].idata = frame->data[i]; s->transform_args[i].istride = frame->linesize[i]; } s->avctx->execute(s->avctx, dwt_plane, s->transform_args, NULL, 3, sizeof(TransformArgs)); calc_slice_sizes(s); encode_slices(s); encode_parse_info(s, DIRAC_PCODE_END_SEQ); }
1threat
void *av_malloc(unsigned int size) { void *ptr = NULL; #if CONFIG_MEMALIGN_HACK long diff; #endif if(size > (INT_MAX-16) ) return NULL; #if CONFIG_MEMALIGN_HACK ptr = malloc(size+16); if(!ptr) return ptr; diff= ((-(long)ptr - 1)&15) + 1; ptr = (char*)ptr + diff; ((char*)ptr)[-1]= diff; #elif HAVE_POSIX_MEMALIGN posix_memalign(&ptr,16,size); #elif HAVE_MEMALIGN ptr = memalign(16,size); #else ptr = malloc(size); #endif return ptr; }
1threat
int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg) { struct kvm_msi msi; KVMMSIRoute *route; if (s->direct_msi) { msi.address_lo = (uint32_t)msg.address; msi.address_hi = msg.address >> 32; msi.data = le32_to_cpu(msg.data); msi.flags = 0; memset(msi.pad, 0, sizeof(msi.pad)); return kvm_vm_ioctl(s, KVM_SIGNAL_MSI, &msi); } route = kvm_lookup_msi_route(s, msg); if (!route) { int virq; virq = kvm_irqchip_get_virq(s); if (virq < 0) { return virq; } route = g_malloc(sizeof(KVMMSIRoute)); route->kroute.gsi = virq; route->kroute.type = KVM_IRQ_ROUTING_MSI; route->kroute.flags = 0; route->kroute.u.msi.address_lo = (uint32_t)msg.address; route->kroute.u.msi.address_hi = msg.address >> 32; route->kroute.u.msi.data = le32_to_cpu(msg.data); kvm_add_routing_entry(s, &route->kroute); kvm_irqchip_commit_routes(s); QTAILQ_INSERT_TAIL(&s->msi_hashtab[kvm_hash_msi(msg.data)], route, entry); } assert(route->kroute.type == KVM_IRQ_ROUTING_MSI); return kvm_set_irq(s, route->kroute.gsi, 1); }
1threat
static int usb_wacom_handle_data(USBDevice *dev, USBPacket *p) { USBWacomState *s = (USBWacomState *) dev; int ret = 0; switch (p->pid) { case USB_TOKEN_IN: if (p->devep == 1) { if (!(s->changed || s->idle)) return USB_RET_NAK; s->changed = 0; if (s->mode == WACOM_MODE_HID) ret = usb_mouse_poll(s, p->data, p->len); else if (s->mode == WACOM_MODE_WACOM) ret = usb_wacom_poll(s, p->data, p->len); break; } case USB_TOKEN_OUT: default: ret = USB_RET_STALL; break; } return ret; }
1threat
npm install doesn't save dependency to package.json : <p>It does add only when I execute: <code>npm install &lt;package_name&gt; --save</code></p> <p>In the documentation though: <a href="https://docs.npmjs.com/cli/install" rel="noreferrer">https://docs.npmjs.com/cli/install</a> is written this: </p> <blockquote> <p>By default, npm install will install all modules listed as dependencies in package.json.</p> </blockquote> <p>Which is misleading. </p>
0debug
static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) { TM2Huff huff; int res = 0; huff.val_bits = get_bits(&ctx->gb, 5); huff.max_bits = get_bits(&ctx->gb, 5); huff.min_bits = get_bits(&ctx->gb, 5); huff.nodes = get_bits_long(&ctx->gb, 17); huff.num = 0; if((huff.val_bits < 1) || (huff.val_bits > 32) || (huff.max_bits < 0) || (huff.max_bits > 32)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n", huff.val_bits, huff.max_bits); return -1; } if((huff.nodes <= 0) || (huff.nodes > 0x10000)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes); return -1; } if(huff.max_bits == 0) huff.max_bits = 1; huff.max_num = (huff.nodes + 1) >> 1; huff.nums = av_mallocz(huff.max_num * sizeof(int)); huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t)); huff.lens = av_mallocz(huff.max_num * sizeof(int)); if(tm2_read_tree(ctx, 0, 0, &huff) == -1) res = -1; if(huff.num != huff.max_num) { av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n", huff.num, huff.max_num); res = -1; } if(res != -1) { int i; res = init_vlc(&code->vlc, huff.max_bits, huff.max_num, huff.lens, sizeof(int), sizeof(int), huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0); if(res < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); res = -1; } else res = 0; if(res != -1) { code->bits = huff.max_bits; code->length = huff.max_num; code->recode = av_malloc(code->length * sizeof(int)); for(i = 0; i < code->length; i++) code->recode[i] = huff.nums[i]; } } av_free(huff.nums); av_free(huff.bits); av_free(huff.lens); return res; }
1threat
what does =! means in javascript : <p>I came across this line while reading source code of an application. </p> <pre><code>$scope.editMode = ! $scope.editMode; </code></pre> <p>I wonder what does this is not the not the not equal to operator. I tried it in this <a href="http://jsfiddle.net/Lvc0u55v/11377/" rel="nofollow">jsfiddle</a> the answer is correct but I still do not understand the logic is this somehow an equal to operator? </p> <p>jsfiddlecode</p> <pre><code> $scope.name = 'Superhero'; $scope.hero = '123' $scope.name = ! $scope.hero </code></pre>
0debug
How to integrate 3rd party Cordova plug-in within IBM MFP (Worklight) Hybrid App : Please assist us by sharing your experience to integrate 3rd party Cordova plug-in within IBM MFP (Worklight) Hybrid App. So far we tried 3 integration options as follows. **IBM MFP version : v 7.1.x Cordova Plug-in version : 6.3.1** 1. Via Eclipse (added 3rd party provided Cordova plug-ins within Eclipse based IBM Worklight Studio). Issue- Resources embedded into AAR files are not reachable from JAR files. Through JAR, tried to invoke class file of Camera activity, which is throwing exception showing R$layout doesn't exist [CameraActivity][1] 2. Via command line as normal Cordova No issue, as a standalone Cordova project the plug-in is working fine 3. Via IBM MFP CLI Issue- Same as option 1 above Additional information about the integration is as follows. Brief background of the Datacap plugin you are using. The Cordova plug-in(s) are used to integrate Hybrid mobile application which is developed using IBM WorkLight(MFP), with IBM Datacap's OCR (optical character recognition). Is this Cordova plugin created by you incorporating the DataCap functionality or is it provided as part of IBM product or is it third party developed plugin that you are trying to integrate. Any link you can provide about this plugin for further readup. This plug-in is developed , leveraging IBM DataCap SDK. Cordova Plug-in version : 6.3.1 **Capture Signature batch.capture(successCallback, errorCallback, pageType, captureConfig) Capture function can be used to recognize text from a document. Calling this method opens the following activities: Camera -> ImageEnhance -> RecognitionProgress On Camera screen users can capture a document. After taking a photo ImageEnhance screen appears where users can modify captured image (Brightness/Contrast, Cropping, Rotate). Saving the edited image a Progress screen appears. When recognition finished Progress screen closes and the proper callback function will be called (success or error). Arguments • pageType: the type of the page. Every capture image must have an unique type. If the method is called twice with the same type, then the previous page will be overwritten. • config: a CaptureConfig object (see below). Callback value A CaptureResult object (see below).** Is this issue specific to any OS such as iOS or Android etc For now we are trying on Android first Please create a pure Cordova application and add the IBM Datacap Cordova plugin and let us know if you encounter the same issues. We have followed the steps given in link below. http://www.ibm.com/support/knowledgecenter/en/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/dev/t_creating_cordova_app_cli.html [1]: https://i.stack.imgur.com/b55QZ.jpg
0debug
Why does this Integer become a string in javascript? : <p>So this little snippet of code takes an array <code>A</code> of integers and makes the integers strings when they become the keys of <code>pairs</code>. Why? Python is happy for them to remain integers, but Javascript seems to only want strings for keys.</p> <pre><code> var pairs = {}; for(var i=0; i &lt; A.length; ++i) { var value = A[i]; if(pairs[value]) { delete pairs[value]; } else { pairs[value] = true; } } console.log(A, pairs) </code></pre> <p>Produces:</p> <pre><code>Example test: [9, 3, 9, 3, 9, 7, 9] Output: [ 9, 3, 9, 3, 9, 7, 9 ] { '7': true } OK Your test case: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9] Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] { '10': true } Returned value: 10 </code></pre> <p>All the keys are integers when they are added to the pairs object, but they become strings when they are used as keys. This is a good bit different from python</p>
0debug
static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory, target_phys_addr_t base, qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup, omap_clk clk) { struct omap_mpuio_s *s = (struct omap_mpuio_s *) g_malloc0(sizeof(struct omap_mpuio_s)); s->irq = gpio_int; s->kbd_irq = kbd_int; s->wakeup = wakeup; s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16); omap_mpuio_reset(s); memory_region_init_io(&s->iomem, &omap_mpuio_ops, s, "omap-mpuio", 0x800); memory_region_add_subregion(memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]); return s; }
1threat
C++ Cast de classes : Galera, estou precisando criar uma variável do tipo object que poderá instanciar outros tipos que à herdam. #include <iostream> #include <cstdlib> class Animal { public: char *nome; Animal (char *nome) { this->nome = nome; } }; class Cachorro : public Animal { public: bool enterraOsso; Cachorro (char* nome, bool enterraOsso) : Animal(nome) { this->enterraOsso = enterraOsso; } }; class Passaro : public Animal { public: bool voar; Passaro (char* nome, bool voar) : Animal(nome) { this->voar = voar; } }; int main() { Animal *animal; animal = new Cachorro("Scooby", true); std::cout << animal->nome << ", " << animal->enterraOsso << std::endl; animal = new Passaro("Piopio", false); std::cout << animal->nome << ", " << animal->voar << std::endl; return 0; } A ideia é que a partir da variável da class super eu poderia acessar os atributos da subclass também. Não sei se isto é cast ou polimorfismo. No java sei que é possível, mas não estou conseguindo fazer em c++. Grato desde já pela ajuda de todos....
0debug
static int libshine_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { SHINEContext *s = avctx->priv_data; MPADecodeHeader hdr; unsigned char *data; long written; int ret, len; if (frame) data = shine_encode_buffer(s->shine, (int16_t **)frame->data, &written); else data = shine_flush(s->shine, &written); if (written < 0) return -1; if (written > 0) { if (s->buffer_index + written > BUFFER_SIZE) { av_log(avctx, AV_LOG_ERROR, "internal buffer too small\n"); return AVERROR_BUG; } memcpy(s->buffer + s->buffer_index, data, written); s->buffer_index += written; } if (frame) { if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } if (s->buffer_index < 4 || !s->afq.frame_count) return 0; if (avpriv_mpegaudio_decode_header(&hdr, AV_RB32(s->buffer))) { av_log(avctx, AV_LOG_ERROR, "free format output not supported\n"); return -1; } len = hdr.frame_size; if (len <= s->buffer_index) { if ((ret = ff_alloc_packet2(avctx, avpkt, len))) return ret; memcpy(avpkt->data, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer + len, s->buffer_index); ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); avpkt->size = len; *got_packet_ptr = 1; } return 0; }
1threat
MemoryRegion *pci_address_space_io(PCIDevice *dev) { return dev->bus->address_space_io; }
1threat
static void decode_tones_amplitude(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[]) { int mode, sb, j, i, diff, maxdiff, fi, delta, pred; Atrac3pWaveParam *wsrc, *wref; int refwaves[48]; Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; Atrac3pWavesData *ref = ctx->channels[0].tones_info; if (ch_num) { for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { if (!band_has_tones[sb] || !dst[sb].num_wavs) continue; wsrc = &ctx->waves_info->waves[dst[sb].start_index]; wref = &ctx->waves_info->waves[ref[sb].start_index]; for (j = 0; j < dst[sb].num_wavs; j++) { for (i = 0, fi = 0, maxdiff = 1024; i < ref[sb].num_wavs; i++) { diff = FFABS(wsrc[j].freq_index - wref[i].freq_index); if (diff < maxdiff) { maxdiff = diff; fi = i; } } if (maxdiff < 8) refwaves[dst[sb].start_index + j] = fi + ref[sb].start_index; else if (j < ref[sb].num_wavs) refwaves[dst[sb].start_index + j] = j + ref[sb].start_index; else refwaves[dst[sb].start_index + j] = -1; } } } mode = get_bits(gb, ch_num + 1); switch (mode) { case 0: for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { if (!band_has_tones[sb] || !dst[sb].num_wavs) continue; if (ctx->waves_info->amplitude_mode) for (i = 0; i < dst[sb].num_wavs; i++) ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = get_bits(gb, 6); else ctx->waves_info->waves[dst[sb].start_index].amp_sf = get_bits(gb, 6); } break; case 1: for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { if (!band_has_tones[sb] || !dst[sb].num_wavs) continue; if (ctx->waves_info->amplitude_mode) for (i = 0; i < dst[sb].num_wavs; i++) ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = get_vlc2(gb, tone_vlc_tabs[3].table, tone_vlc_tabs[3].bits, 1) + 20; else ctx->waves_info->waves[dst[sb].start_index].amp_sf = get_vlc2(gb, tone_vlc_tabs[4].table, tone_vlc_tabs[4].bits, 1) + 24; } break; case 2: for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { if (!band_has_tones[sb] || !dst[sb].num_wavs) continue; for (i = 0; i < dst[sb].num_wavs; i++) { delta = get_vlc2(gb, tone_vlc_tabs[5].table, tone_vlc_tabs[5].bits, 1); delta = sign_extend(delta, 5); pred = refwaves[dst[sb].start_index + i] >= 0 ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf : 34; ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = (pred + delta) & 0x3F; } } break; case 3: for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { if (!band_has_tones[sb]) continue; for (i = 0; i < dst[sb].num_wavs; i++) ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = refwaves[dst[sb].start_index + i] >= 0 ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf : 32; } break; } }
1threat
void MPV_common_init_armv4l(MpegEncContext *s) { int i; const int idct_algo= s->avctx->idct_algo; ff_put_pixels_clamped = s->avctx->dsp.put_pixels_clamped; ff_add_pixels_clamped = s->avctx->dsp.put_pixels_clamped; if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){ s->idct_put= arm_idct_put; s->idct_add= arm_idct_add; s->idct_permutation_type= FF_NO_IDCT_PERM; } }
1threat
Rounding calendar time to nearest 5 mins : <p>The code below works well for rounding java calendar time to the nearest 15mins, however how can I change the code below to allow for rounding to the closest 5mins clock mark.</p> <p>Code:</p> <pre><code>int unroundedMinutes = isha_jamaat_cal.get(Calendar.MINUTE); int mod = unroundedMinutes % 15; System.out.println("#######mod: " + mod); isha_jamaat_cal.add(Calendar.MINUTE, mod &lt; 8 ? -mod : (15-mod)); </code></pre>
0debug
static int xa_probe(AVProbeData *p) { switch(AV_RL32(p->buf)) { case XA00_TAG: case XAI0_TAG: case XAJ0_TAG: return AVPROBE_SCORE_MAX; } return 0; }
1threat
How to install mongodb-clients latest version on Ubuntu? : <p>How do I install latest version of <code>mongodb-clients</code> on Ubuntu using <code>apt-get</code>?</p> <p><code>apt-get install mongodb-clients</code> only installs version <code>2.4.9</code>.</p>
0debug
Manually add legend Items Python matplotlib : <p>I am using matlibplot and I would like to manually add items to the legend that are a color and a label. I am adding data to to the plot to specifying there would lead to a lot of duplicates.</p> <p>My thought was to do:</p> <pre><code> ax2.legend(self.labels,colorList[:len(self.labels)]) plt.legend() </code></pre> <p>Where self.labels is the number of items I want legend lables for that takes a subset of the large color list. However this yields nothing when I run it.</p> <p>Am I missing anything?</p> <p>Thanks</p>
0debug
SQL how can i get list of users and departament with filter by position? : Please help me, how can i get a list of users of the department with a filter by position??? CREATE TABLE COMPANY ( ID INT GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR(255), PRIMARY KEY (ID), UNIQUE KEY COMPANY_NAME (NAME)); create table USER( ID INT GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR(255), LASTNAME VARCHAR(255), DATE_OF_BIRTH DATE , PRIMARY KEY (ID),); CREATE TABLE POSITION( ID INT NOT NULL GENERATED BY DEFAULT AS IDENTITY, POSITION VARCHAR (50), USERID INT NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (USERID) REFERENCES USER(ID)); CREATE TABLE DEPARTMENT ( ID INT GENERATED BY DEFAULT AS IDENTITY, USER_ID INT NOT NULL, COMPANY_ID INT NOT NULL, DEPARTMENT_CATEGORY VARCHAR(50), PRIMARY KEY (ID), FOREIGN KEY (USER_ID) REFERENCES USER(ID), FOREIGN KEY (COMPANY_ID) REFERENCES COMPANY(ID)); CREATE TABLE CATEGORY ( ID INT NOT NULL GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR (50), PRIMARY KEY (ID)); create table DEPARTMENT_CATEGORY( DEPARTMENT_ID INT NOT NULL, CATEGORY_ID INT NOT NULL, FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT(ID), FOREIGN KEY (CATEGORY_ID) REFERENCES CATEGORY(ID) ); Please help me!!
0debug
void net_set_boot_mask(int net_boot_mask) { int i; net_boot_mask = net_boot_mask & 0xF; for (i = 0; i < nb_nics; i++) { if (net_boot_mask & (1 << i)) { net_boot_mask &= ~(1 << i); } } if (net_boot_mask) { fprintf(stderr, "Cannot boot from non-existent NIC\n"); exit(1); } }
1threat
How to use result of socket.on in socket.emit ? : [I want to know how two use the result of socket.on in the server and send that result to the client side with socket.emit][1] [1]: https://i.stack.imgur.com/5vfCO.png
0debug
int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter) { struct kvm_irq_routing_entry kroute; int virq; if (!kvm_gsi_routing_enabled()) { return -ENOSYS; } virq = kvm_irqchip_get_virq(s); if (virq < 0) { return virq; } kroute.gsi = virq; kroute.type = KVM_IRQ_ROUTING_S390_ADAPTER; kroute.flags = 0; kroute.u.adapter.summary_addr = adapter->summary_addr; kroute.u.adapter.ind_addr = adapter->ind_addr; kroute.u.adapter.summary_offset = adapter->summary_offset; kroute.u.adapter.ind_offset = adapter->ind_offset; kroute.u.adapter.adapter_id = adapter->adapter_id; kvm_add_routing_entry(s, &kroute); kvm_irqchip_commit_routes(s); return virq; }
1threat
Vuetify text color variants : <p>I want to use one of the color variants for text, how can I do this? I have tried:</p> <p><code>&lt;h2 class="red--text lighten-1--text"&gt;My Address&lt;/h2&gt;</code></p> <p><code>&lt;h2 class="red--text lighten-1"&gt;My Address&lt;/h2&gt;</code></p> <p><code>&lt;h2 class="red-lighten-1--text"&gt;My Address&lt;/h2&gt;</code></p> <p>and many other variations, but I can only seem to get the text to go the base red color, not the variants listed <a href="https://vuetifyjs.com/en/framework/colors#classes" rel="noreferrer">here</a>. Can anyone help?</p>
0debug
What are the best practices to transform a Wordpress live site to a PWA : <p>What are the best practices to transform a Wordpress live website into a Progressive Web Application, is there a good plugin that is sufficient? How does it work? If not, what is the best way to do this?</p>
0debug
How can I use Regular Expression to match Chinese characters like ,。‘;’ : <p>I'm using javascript to convert string to what I want!! Can I use Regular Expression and use what Regular Expression?? Is there anyone that can help me?</p>
0debug
how to write the list of array values to the txt file (list of file names) : **I have list of values(file names), i just splitted and assigned to the variable now i need to write the 2 set of file names to the individual files.** //Split the Files var Alternated = Files .Select((name, index) => new { name, index }) .GroupBy(item => item.index % 2, item => item.name) .Select(group => group.ToList()) .ToArray(); //Assigning alternate files to the variable var C1 = Alternated[0]; var C2 = Alternated[1]; // Check if file already exists. If yes, delete it. string filepath = FilePath; string filepath2 = FilePath2; if (File.Exists(filepath) || File.Exists(filepath2)) { File.Delete(filepath); File.Delete(filepath2); } using (FileStream fs = File.Create(filepath)) { StreamWriter sw = new StreamWriter(fs); C1.ForEach(r => sw.WriteLine(r)); } using (FileStream fs1 = File.Create(filepath1)) { StreamWriter sw1 = new StreamWriter(fs1); C2.ForEach(r => sw.WriteLine(r)); }
0debug
Is DMARC the end of email forwarding? : <p>I'm using a fair bit of email forwarding on a number of domains and the latest p=reject policy of AOL is causing me some problems and also a lot of confusion. My understanding of DMARC is that it's based on DKIM &amp; SPF with a reporting layer. I understand that SPF is a problem with forwarding but as long as the SPF is set to ~all soft fail then that isn't a show stopper. I also thought DKIM could pass through forwarding without problems as long as you don't mess with the headers much. However I'm finding that certain emails from AOL being forwarded by MailGun are failing DMARC when they land at GMail. MailGun say its due to a sender/from mismatch error. Can anyone elaborate on whether email forwarding is doomed as DMARC takes hold or are MailGun just not forwarding properly?</p>
0debug
Python get for loop result into an array variable : <pre><code>code = [] def getCode(): for data in range(59): code = [] min = 9900 max = 9999 code1 = randint(min, max) code2 = randint(min, max) code = str(code1) + '/' + str(code2) # print(code) return code print(getCode()) dat2 = pd.DataFrame({'code': [getCode()]}) </code></pre> <p>Hi, I'm trying to get a list of the number from the for loop. example result should be <code>[[9900/9910],[9910/9920],.....]</code>. However the code above only return me <code>9900/9910</code> even if I declare the array variable.</p>
0debug
Why did Neo4j change it's name to Neo5j? : <p>They just announced, <a href="https://neo4j.com/blog/upgrading-product-name-exactly-what-you-think/" rel="noreferrer">they changed their name to Neo5j</a>.</p> <p>I always thought that 4j meant for-Java. And as Neo4j is implemented in Java and Scala and the ~4j suffix has been highly popular (in the 90's) it never occurred to me that the <strong>4j</strong> and now <strong>5j</strong> is actually a version denomination. </p> <p><a href="https://i.stack.imgur.com/8PwiB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8PwiB.png" alt="enter image description here"></a></p> <p>But it seems common in database circles to use that number + letter versioning scheme, like Oracle does with <strong>9i, 11g</strong> and <strong>12c</strong>. </p> <p>Now the question is what does the <strong>5j</strong> stand for? The article doesn't answer it. Can anyone help me resolve this?</p>
0debug
sql & pdo syntax error? : <p>i have a pdo statement for select all rows for row count.... i keep getting this error "Call to member function execute() on Boolean" ...i have tripple checked my statement and database table but cant find anything wrong</p> <pre><code>$stmt = $connection-&gt;prepare("SELECT * FROM users_profile WHERE email=:email"); var_dump($connection-&gt;error); $stmt-&gt;execute(":email",$email); $count = $stmt-&gt;rowCount(); </code></pre> <p>Var dump error says there is a syntax error here " :email" ..but i cant seem to see it...and its doing this through out my PDO code </p>
0debug
static int decorrelate(TAKDecContext *s, int c1, int c2, int length) { GetBitContext *gb = &s->gb; int32_t *p1 = s->decoded[c1] + (s->dmode > 5); int32_t *p2 = s->decoded[c2] + (s->dmode > 5); int32_t bp1 = p1[0]; int32_t bp2 = p2[0]; int i; int dshift, dfactor; length += s->dmode < 6; switch (s->dmode) { case 1: s->tdsp.decorrelate_ls(p1, p2, length); break; case 2: s->tdsp.decorrelate_sr(p1, p2, length); break; case 3: s->tdsp.decorrelate_sm(p1, p2, length); break; case 4: FFSWAP(int32_t*, p1, p2); FFSWAP(int32_t, bp1, bp2); case 5: dshift = get_bits_esc4(gb); dfactor = get_sbits(gb, 10); s->tdsp.decorrelate_sf(p1, p2, length, dshift, dfactor); break; case 6: FFSWAP(int32_t*, p1, p2); case 7: { int length2, order_half, filter_order, dval1, dval2; int tmp, x, code_size; if (length < 256) return AVERROR_INVALIDDATA; dshift = get_bits_esc4(gb); filter_order = 8 << get_bits1(gb); dval1 = get_bits1(gb); dval2 = get_bits1(gb); for (i = 0; i < filter_order; i++) { if (!(i & 3)) code_size = 14 - get_bits(gb, 3); s->filter[i] = get_sbits(gb, code_size); } order_half = filter_order / 2; length2 = length - (filter_order - 1); if (dval1) { for (i = 0; i < order_half; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } if (dval2) { for (i = length2 + order_half; i < length; i++) { int32_t a = p1[i]; int32_t b = p2[i]; p1[i] = a + b; } } for (i = 0; i < filter_order; i++) s->residues[i] = *p2++ >> dshift; p1 += order_half; x = FF_ARRAY_ELEMS(s->residues) - filter_order; for (; length2 > 0; length2 -= tmp) { tmp = FFMIN(length2, x); for (i = 0; i < tmp; i++) s->residues[filter_order + i] = *p2++ >> dshift; for (i = 0; i < tmp; i++) { int v = 1 << 9; if (filter_order == 16) { v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter, filter_order); } else { v += s->residues[i + 7] * s->filter[7] + s->residues[i + 6] * s->filter[6] + s->residues[i + 5] * s->filter[5] + s->residues[i + 4] * s->filter[4] + s->residues[i + 3] * s->filter[3] + s->residues[i + 2] * s->filter[2] + s->residues[i + 1] * s->filter[1] + s->residues[i ] * s->filter[0]; } v = (av_clip_intp2(v >> 10, 13) << dshift) - *p1; *p1++ = v; } memmove(s->residues, &s->residues[tmp], 2 * filter_order); } emms_c(); break; } } if (s->dmode > 0 && s->dmode < 6) { p1[0] = bp1; p2[0] = bp2; } return 0; }
1threat
Is SSRS more friendly to SQL users than Crystal Reports? : <p>So our ERP system has fairly limited SQL reporting tools, although it's pure SQL, write a query in a window, execute, and a report pops up. Problem is, it's quite error filled, the exports are hideous and anything over 2,000 records may not display correctly.</p> <p>So we decided to get Crystal Reports and frankly I hate the damn thing. My SQL skills are practically of no use with this thing because everything is done with a report writer and you can't even edit basic SQL statements, you have to go through all these stupid hoops and loops just to make a basic change in your report. I'm used to deleting a column name from my SQL statement, refresh, and boom, column gone. In Crystal, deleting a column seems near impossible in an existing report, I spent like an hour researching and came up with nothing. Every little task in Crystal seems to be ridiculously over complicated.</p> <p>Basically, I just want a blank window where I can type real SQL code and get a damn report. Can SSRS do this simple task? I really don't give a damn about formatting, I just want data</p>
0debug
Struggerling to undersatnd process of nested for loop with alert result : script and recently asked for help on another matter and it was way more useful then what my teacher told me. So if someone has any spare time to explain the process of the following to me it would be gratefully appreciated. Thanks in advance! The alert result is 13 and I'm not sure what the process was to getting it. I understand what the loop does and what += means, however am not sure on their connection or how the second loop effects the result. var v=1; for(i=1;i<5;i++) for(j=2;j<5;j++) v+=1; alert(v);
0debug
How set that,vim number style : I want to set vim with that. but I can't find the way. thanks! [enter image description here][1] [1]: http://i.stack.imgur.com/U2t8R.png
0debug
Testing React: Target Container is not a DOM element : <p>I'm attempting to test a React component with Jest/Enzyme while using Webpack.</p> <p>I have a very simple test @</p> <pre><code>import React from 'react'; import { shallow } from 'enzyme'; import App from './App'; it('App', () =&gt; { const app = shallow(&lt;App /&gt;); expect(1).toEqual(1); }); </code></pre> <p>The relative component it's picking up is :</p> <pre><code>import React, { Component } from 'react'; import { render } from 'react-dom'; // import './styles/normalize.css'; class App extends Component { render() { return ( &lt;div&gt;app&lt;/div&gt; ); } } render(&lt;App /&gt;, document.getElementById('app')); </code></pre> <p>However, running <code>jest</code> causes a failure:</p> <p><code>Invariant Violation: _registerComponent(...): Target container is not a DOM element.</code></p> <p>With errors @ </p> <p><code>at Object.&lt;anonymous&gt; (src/App.js:14:48) at Object.&lt;anonymous&gt; (src/App.test.js:4:38) </code></p> <p>The test files references line 4, which is the import of <code>&lt;App /&gt;</code>, that causes a fail. The stack trace says line 14 of <code>App.js</code> is the reason for the failure -- which is nothing more than the render call from <code>react-dom</code>, something I've never had a challenge with (the app renders properly from my Webpack setup).</p> <p>For those interested (Webpack code):</p> <pre><code>module.exports = { entry: './src/App', output: { filename: 'bundle.js', path: './dist' }, module: { loaders: [ { test: /\.js?$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['react', 'es2015'] } }, { test: /\.css$/, loader: 'style!css-loader?modules&amp;importLoaders=1&amp;localIdentName=[name]__[local]___[hash:base64:5]' }, { test: /\.scss$/, loader: 'style!css-loader?modules&amp;importLoaders=1&amp;localIdentName=[name]__[local]___[hash:base64:5]!sass' } ] } } </code></pre> <p>And my <code>package.json</code>:</p> <pre><code>{ "name": "tic-tac-dux", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "dev": "webpack-dev-server --devtool eval --progress --colors --inline --hot --content-base dist/", "test": "jest" }, "jest": { "moduleNameMapper": { "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "&lt;rootDir&gt;/__mocks__/fileMock.js", "^.+\\.(css|sass)$": "&lt;rootDir&gt;/__mocks__/styleMock.js" } }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.17.0", "babel-jest": "^16.0.0", "babel-loader": "^6.2.5", "babel-polyfill": "^6.16.0", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", "css-loader": "^0.25.0", "enzyme": "^2.4.1", "jest": "^16.0.1", "jest-cli": "^16.0.1", "node-sass": "^3.10.1", "react-addons-test-utils": "^15.3.2", "react-dom": "^15.3.2", "sass-loader": "^4.0.2", "style-loader": "^0.13.1", "webpack": "^1.13.2", "webpack-dev-server": "^1.16.2" }, "dependencies": { "react": "^15.3.2", "react-dom": "^15.3.2" } } </code></pre> <p>Oh, and if anyone is going to say that the div element isn't being loaded before the script, here's my <code>index.html</code>:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;App&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="app"&gt;&lt;/div&gt; &lt;script src="/bundle.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What could be the reason for this peculiar rendering problem? Something to do with a new Jest update to 15.0?</p>
0debug