problem
stringlengths
26
131k
labels
class label
2 classes
static int wmavoice_decode_packet(AVCodecContext *ctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { WMAVoiceContext *s = ctx->priv_data; GetBitContext *gb = &s->gb; int size, res, pos; for (size = avpkt->size; size > ctx->block_align; size -= ctx->block_align); if (!size) { *got_frame_ptr = 0; return 0; } init_get_bits(&s->gb, avpkt->data, size << 3); if (size == ctx->block_align) { if ((res = parse_packet_header(s)) < 0) return res; if (s->spillover_nbits > 0) { if (s->sframe_cache_size > 0) { int cnt = get_bits_count(gb); copy_bits(&s->pb, avpkt->data, size, gb, s->spillover_nbits); flush_put_bits(&s->pb); s->sframe_cache_size += s->spillover_nbits; if ((res = synth_superframe(ctx, data, got_frame_ptr)) == 0 && *got_frame_ptr) { cnt += s->spillover_nbits; s->skip_bits_next = cnt & 7; return cnt >> 3; } else skip_bits_long (gb, s->spillover_nbits - cnt + get_bits_count(gb)); } else skip_bits_long(gb, s->spillover_nbits); } } else if (s->skip_bits_next) skip_bits(gb, s->skip_bits_next); s->sframe_cache_size = 0; s->skip_bits_next = 0; pos = get_bits_left(gb); if ((res = synth_superframe(ctx, data, got_frame_ptr)) < 0) { return res; } else if (*got_frame_ptr) { int cnt = get_bits_count(gb); s->skip_bits_next = cnt & 7; return cnt >> 3; } else if ((s->sframe_cache_size = pos) > 0) { init_get_bits(gb, avpkt->data, size << 3); skip_bits_long(gb, (size << 3) - pos); av_assert1(get_bits_left(gb) == pos); init_put_bits(&s->pb, s->sframe_cache, SFRAME_CACHE_MAXSIZE); copy_bits(&s->pb, avpkt->data, size, gb, s->sframe_cache_size); } return size; }
1threat
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; APEContext *s = avctx->priv_data; uint8_t *sample8; int16_t *sample16; int32_t *sample24; int i, ch, ret; int blockstodecode; av_assert0(s->samples >= 0); if(!s->samples){ uint32_t nblocks, offset; int buf_size; if (!avpkt->size) { *got_frame_ptr = 0; return 0; } if (avpkt->size < 8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } buf_size = avpkt->size & ~3; if (buf_size != avpkt->size) { av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. " "extra bytes at the end will be skipped.\n"); } if (s->fileversion < 3950) buf_size += 2; av_fast_padded_malloc(&s->data, &s->data_size, buf_size); if (!s->data) return AVERROR(ENOMEM); s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf, buf_size >> 2); memset(s->data + (buf_size & ~3), 0, buf_size & 3); s->ptr = s->data; s->data_end = s->data + buf_size; nblocks = bytestream_get_be32(&s->ptr); offset = bytestream_get_be32(&s->ptr); if (s->fileversion >= 3900) { if (offset > 3) { av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } if (s->data_end - s->ptr < offset) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } s->ptr += offset; } else { if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) return ret; if (s->fileversion > 3800) skip_bits_long(&s->gb, offset * 8); else skip_bits_long(&s->gb, offset); } if (!nblocks || nblocks > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %"PRIu32".\n", nblocks); return AVERROR_INVALIDDATA; } s->samples = nblocks; if (init_frame_decoder(s) < 0) { av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n"); return AVERROR_INVALIDDATA; } } if (!s->data) { *got_frame_ptr = 0; return avpkt->size; } blockstodecode = FFMIN(s->blocks_per_loop, s->samples); if (s->fileversion < 3930) blockstodecode = s->samples; av_fast_malloc(&s->decoded_buffer, &s->decoded_size, 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)); if (!s->decoded_buffer) return AVERROR(ENOMEM); memset(s->decoded_buffer, 0, s->decoded_size); s->decoded[0] = s->decoded_buffer; s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8); frame->nb_samples = blockstodecode; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if (s->error) { s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } switch (s->bps) { case 8: for (ch = 0; ch < s->channels; ch++) { sample8 = (uint8_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; } break; case 16: for (ch = 0; ch < s->channels; ch++) { sample16 = (int16_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample16++ = s->decoded[ch][i]; } break; case 24: for (ch = 0; ch < s->channels; ch++) { sample24 = (int32_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample24++ = s->decoded[ch][i] << 8; } break; } s->samples -= blockstodecode; *got_frame_ptr = 1; return !s->samples ? avpkt->size : 0; }
1threat
static int coroutine_fn nfs_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov) { NFSClient *client = bs->opaque; NFSRPC task; char *buf = NULL; nfs_co_init_task(client, &task); buf = g_try_malloc(nb_sectors * BDRV_SECTOR_SIZE); if (nb_sectors && buf == NULL) { return -ENOMEM; } qemu_iovec_to_buf(iov, 0, buf, nb_sectors * BDRV_SECTOR_SIZE); if (nfs_pwrite_async(client->context, client->fh, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, buf, nfs_co_generic_cb, &task) != 0) { g_free(buf); return -ENOMEM; } while (!task.complete) { nfs_set_events(client); qemu_coroutine_yield(); } g_free(buf); if (task.ret != nb_sectors * BDRV_SECTOR_SIZE) { return task.ret < 0 ? task.ret : -EIO; } return 0; }
1threat
GoogleMaps API KEY for testing : <p>I'd like to add an API_KEY for <code>GoogleMaps</code> for testing and in documentation I've read this : </p> <blockquote> <p>Tip: During development and testing, you can register a project for testing purposes in the Google Cloud Platform Console and use a generic, unrestricted API key. When you are ready to move your app into production, register a separate project for production, create an Android-restricted API key, and add the key to your application.</p> </blockquote> <p>My question is, do I have to put my Credit card even if it's a testing API_KEY? I do not get the purpose to put my Creadit card to use Google Maps, isn't it free?</p>
0debug
Chagne the width of the dropdownlist : Goal: Change the width of the select dropdownlist that use bootstrap v2. Problem: I don't know how to change the width of it in relation to bootstrap. Info: Please remember that I have three dropdownlist in the same page and it is one of them that I want to change the width. http://jsbin.com/roriyododa/edit?html,css,output Thanks! <!-- begin snippet: js hide: false --> <!-- language: lang-html --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script> <select style="display: none;" class="selectpicker" id="fromContent" name="From"><option value="122344">122344</option> <option value="46731233320">46731233320</option> <option value="abbb">abbb</option> <option value="asd">asd</option> <option value="d">d</option> <option value="test">test</option> <option value="testtest">testtest</option> <option value="11">11</option> <option value="24">24</option> <option value="ddd">ddd</option> <option value="gd">gd</option> <option value="hn2">hn2</option> <option value="jippo">jippo</option> <option value="sdf">sdf</option> <option value="sdfsdf">sdfsdf</option> </select> <div class="btn-group bootstrap-select"><button title="122344" data-id="fromContent" type="button" class="btn dropdown-toggle form-control selectpicker btn-default" data-toggle="dropdown"><span class="filter-option pull-left">122344</span>&nbsp;<span class="caret"></span></button><div class="dropdown-menu open"><ul class="dropdown-menu inner selectpicker" role="menu"><li class="selected" data-original-index="0"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>122344</span>"><span class="text">122344</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="1"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>46731233320</span>"><span class="text">46731233320</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="2"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>abbb</span>"><span class="text">abbb</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="3"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>asd</span>"><span class="text">asd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="4"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>Feedex</span>"><span class="text">Feedex</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="5"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>test</span>"><span class="text">test</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="6"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>testtest</span>"><span class="text">testtest</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="7"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>11</span>"><span class="text">11</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="8"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>24</span>"><span class="text">24</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="9"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>ddd</span>"><span class="text">ddd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="10"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>gd</span>"><span class="text">gd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="11"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>hn2</span>"><span class="text">hn2</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="12"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>jippo</span>"><span class="text">jippo</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="13"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>sdf</span>"><span class="text">sdf</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li><li data-original-index="14"><a tabindex="0" class="" data-normalized-text="<span class=&quot;text&quot;>sdfsdf</span>"><span class="text">sdfsdf</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li></ul></div></div> <!-- end snippet -->
0debug
Google App Engine - automatic-scaling with always on instance? : <p>One of the most irritating things about using GAE for a brand new app is having to deal with instances being fired back up if no one has hit your servers in 15 minutes. Since the app is new, or just has few users, there will be periods of great latency for some users who have no clue that instances are being "spun up"</p> <p>As far as I see it you have these options based on the <a href="https://cloud.google.com/appengine/docs/java/config/appref#scaling_elements">docs</a>:</p> <p><strong>Use <code>manual-scaling</code> and set the number of instances to <code>1</code>.</strong></p> <p>When you use <code>manual-scaling</code>, whatever number of instances you set it to is what you will have - no more, no less. This is clearly inefficient as you may be paying for unused instances and instances are not automatically added/removed as traffic increases/decreases</p> <p><strong>Use <code>basic-scaling</code> and set <code>idle-timeout</code> to something like 24hrs or 48hrs.</strong></p> <p>This would keep your instance running as long as someone queries your API at least once within that time period.</p> <p><strong>Use <code>automatic-scaling</code> with <code>min-idle-instances</code> and warm-up requests enabled.</strong></p> <p>This does not work as intended. According to these <a href="https://cloud.google.com/appengine/docs/java/warmup-requests/">docs</a>:</p> <blockquote> <p>if your app is serving no traffic, the first request to the app will always be a loading request, not a warmup request.</p> </blockquote> <p>This does not solve our problem because if zero instances are running, then there is nothing to warm-up in the first place. Thus you still get latency on the first request.</p> <hr> <p><strong>The desired effect I would like to have is</strong> to always have an instance running and then scale up from there if traffic is increased (and of course scale down but never go below one instance). It would be like automatic-scaling but with 1 instance always running.</p> <p>Is this possible in GAE? Or am I missing something?</p> <p>For now, my temporary solution is to set my app to <code>manual-scaling</code> with 1 instance so at least my app is useable to new users.</p>
0debug
void kvm_mips_reset_vcpu(MIPSCPU *cpu) { CPUMIPSState *env = &cpu->env; if (env->CP0_Config1 & (1 << CP0C1_FP)) { fprintf(stderr, "Warning: FPU not supported with KVM, disabling\n"); env->CP0_Config1 &= ~(1 << CP0C1_FP); } DPRINTF("%s\n", __func__); }
1threat
static void test_none(void) { struct qdist dist; char *pr; qdist_init(&dist); g_assert(isnan(qdist_avg(&dist))); g_assert(isnan(qdist_xmin(&dist))); g_assert(isnan(qdist_xmax(&dist))); pr = qdist_pr_plain(&dist, 0); g_assert(pr == NULL); pr = qdist_pr_plain(&dist, 2); g_assert(pr == NULL); qdist_destroy(&dist); }
1threat
SVG animation on IE : <p>I am creating an animation with SVG images and JS, but I've realised that the SVG animations doesn't work in IE... Do you know if there's a way to make it work in IE? If not, is it possible to do it with JS?</p> <p>You can see the working code <a href="https://codepen.io/anon/pen/ddgQzw" rel="nofollow noreferrer">here</a></p> <pre><code>&lt;div id="drone-parent"&gt; &lt;svg width="300" height="200" viewBox="0 0 500 350"&gt; &lt;path id="motionPath" fill="none" stroke-miterlimit="10" d="M72.7,14.1c16.7,6.1,27.7,26.6,45.5,26.1,13.9-.4,23.4-13.7,35.5-20.6s27.6-7.3,42-6.9c3.8,0.1,8,.4,10.9,2.9,4.5,3.9,3.7,11.1,6,16.6,3.9,9.4,16.3,12.4,26.2,10.2s18.6-8.1,28.2-11.7c34.1-12.7,76.6,12.1,82.5,48,1.5,9,.7,18.8-4.3,26.4-15.7,23.4-54.7,8.9-78.4,24.2-7.1,4.6-12.3,11.7-19.1,16.9-20.4,15.7-49.2,10.9-74.3,5.4-7.9-1.7-16.6-4-21.2-10.7-2.2-3.3-3.3-7.5-6.2-10.2s-5.9-3.3-9.2-3.9c-16.8-2.9-33.8,1.7-50.3,5.9s-33.9,8-50.3,3.5S5.2,116,7.9,99.2,23.5,81.9,31.3,70.9s3.4-10.5,3.2-21.8C34,27.9,46.3,4.5,72.7,14.1Z" /&gt; &lt;image id="drone" x="0" y="0" width="130" height="70" xlink:href="https://d30y9cdsu7xlg0.cloudfront.net/png/375033-200.png"&gt;&lt;/image&gt; &lt;animateMotion xlink:href="#drone" dur="10s" begin="0s" fill="freeze" repeatCount="indefinite"&gt; &lt;mpath xlink:href="#motionPath" /&gt; &lt;/animateMotion&gt; &lt;/svg&gt; &lt;/div&gt; </code></pre>
0debug
Multiple pipelines that merge within a sklearn Pipeline? : <p>Sometimes I design machine learning pipelines that look something like this:</p> <p><a href="https://i.stack.imgur.com/2mw5F.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2mw5F.png" alt="Example pipeline"></a></p> <p>Normally I have to hack these "split" pipelines together using my own "Combine Features" function. However, it'd be great if I could fit this into a sklearn Pipeline object. How would I go about doing that? (Pseudo-code is fine.)</p>
0debug
static void v9fs_wstat_post_chown(V9fsState *s, V9fsWstatState *vs, int err) { V9fsFidState *fidp; if (err < 0) { goto out; } if (vs->v9stat.name.size != 0) { char *old_name, *new_name; char *end; old_name = vs->fidp->path.data; end = strrchr(old_name, '/'); if (end) { end++; } else { end = old_name; } new_name = qemu_mallocz(end - old_name + vs->v9stat.name.size + 1); memcpy(new_name, old_name, end - old_name); memcpy(new_name + (end - old_name), vs->v9stat.name.data, vs->v9stat.name.size); vs->nname.data = new_name; vs->nname.size = strlen(new_name); if (strcmp(new_name, vs->fidp->path.data) != 0) { if (v9fs_do_rename(s, &vs->fidp->path, &vs->nname)) { err = -errno; } else { for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (vs->fidp == fidp) { continue; } if (!strncmp(vs->fidp->path.data, fidp->path.data, strlen(vs->fidp->path.data))) { v9fs_fix_path(&fidp->path, &vs->nname, strlen(vs->fidp->path.data)); } } v9fs_string_copy(&vs->fidp->path, &vs->nname); } } } v9fs_wstat_post_rename(s, vs, err); return; out: v9fs_stat_free(&vs->v9stat); complete_pdu(s, vs->pdu, err); qemu_free(vs); }
1threat
Explain "export =" and "export as namespace" syntax in TypeScript : <p>I am trying to make use of the type declarations files in the <a href="https://github.com/DefinitelyTyped/DefinitelyTyped" rel="noreferrer">DefinitelyTyped</a> repository. Many of these files use the following pattern:</p> <pre><code>export = React; export as namespace React; </code></pre> <p>Googling around, I've found references to this being used to make a declaration file usable in both module-based and non-module-based systems. However, I'm struggling to find a clear explanation of (a) what each of these lines exactly does individually and (b) how exactly this combination works to support both types of consumers.</p>
0debug
static int transcode(OutputFile *output_files, int nb_output_files, InputFile *input_files, int nb_input_files) { int ret, i; AVFormatContext *is, *os; OutputStream *ost; InputStream *ist; uint8_t *no_packet; int no_packet_count=0; int64_t timer_start; int key; if (!(no_packet = av_mallocz(nb_input_files))) exit_program(1); ret = transcode_init(output_files, nb_output_files, input_files, nb_input_files); if (ret < 0) goto fail; if (!using_stdin) { if(verbose >= 0) fprintf(stderr, "Press [q] to stop, [?] for help\n"); avio_set_interrupt_cb(decode_interrupt_cb); } term_init(); timer_start = av_gettime(); for(; received_sigterm == 0;) { int file_index, ist_index; AVPacket pkt; int64_t ipts_min; double opts_min; redo: ipts_min= INT64_MAX; opts_min= 1e100; if (!using_stdin) { if (q_pressed) break; key = read_key(); if (key == 'q') break; if (key == '+') verbose++; if (key == '-') verbose--; if (key == 's') qp_hist ^= 1; if (key == 'h'){ if (do_hex_dump){ do_hex_dump = do_pkt_dump = 0; } else if(do_pkt_dump){ do_hex_dump = 1; } else do_pkt_dump = 1; av_log_set_level(AV_LOG_DEBUG); } if (key == 'c' || key == 'C'){ char ret[4096], target[64], cmd[256], arg[256]={0}; double ts; fprintf(stderr, "\nEnter command: <target> <time> <command>[ <argument>]\n"); if(scanf("%4095[^\n\r]%*c", ret) == 1 && sscanf(ret, "%63[^ ] %lf %255[^ ] %255[^\n]", target, &ts, cmd, arg) >= 3){ for(i=0;i<nb_output_streams;i++) { int r; ost = &output_streams[i]; if(ost->graph){ if(ts<0){ r= avfilter_graph_send_command(ost->graph, target, cmd, arg, ret, sizeof(ret), key == 'c' ? AVFILTER_CMD_FLAG_ONE : 0); fprintf(stderr, "Command reply for %d: %d, %s\n", i, r, ret); }else{ r= avfilter_graph_queue_command(ost->graph, target, cmd, arg, 0, ts); } } } }else{ fprintf(stderr, "Parse error\n"); } } if (key == 'd' || key == 'D'){ int debug=0; if(key == 'D') { debug = input_streams[0].st->codec->debug<<1; if(!debug) debug = 1; while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) debug += debug; }else scanf("%d", &debug); for(i=0;i<nb_input_streams;i++) { input_streams[i].st->codec->debug = debug; } for(i=0;i<nb_output_streams;i++) { ost = &output_streams[i]; ost->st->codec->debug = debug; } if(debug) av_log_set_level(AV_LOG_DEBUG); fprintf(stderr,"debug=%d\n", debug); } if (key == '?'){ fprintf(stderr, "key function\n" "? show this help\n" "+ increase verbosity\n" "- decrease verbosity\n" "c Send command to filtergraph\n" "D cycle through available debug modes\n" "h dump packets/hex press to cycle through the 3 states\n" "q quit\n" "s Show QP histogram\n" ); } } file_index = -1; for (i = 0; i < nb_output_streams; i++) { OutputFile *of; int64_t ipts; double opts; ost = &output_streams[i]; of = &output_files[ost->file_index]; os = output_files[ost->file_index].ctx; ist = &input_streams[ost->source_index]; if (ost->is_past_recording_time || no_packet[ist->file_index] || (os->pb && avio_tell(os->pb) >= of->limit_filesize)) continue; opts = ost->st->pts.val * av_q2d(ost->st->time_base); ipts = ist->pts; if (!input_files[ist->file_index].eof_reached){ if(ipts < ipts_min) { ipts_min = ipts; if(input_sync ) file_index = ist->file_index; } if(opts < opts_min) { opts_min = opts; if(!input_sync) file_index = ist->file_index; } } if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){ file_index= -1; break; } } if (file_index < 0) { if(no_packet_count){ no_packet_count=0; memset(no_packet, 0, nb_input_files); usleep(10000); continue; } break; } is = input_files[file_index].ctx; ret= av_read_frame(is, &pkt); if(ret == AVERROR(EAGAIN)){ no_packet[file_index]=1; no_packet_count++; continue; } if (ret < 0) { input_files[file_index].eof_reached = 1; if (opt_shortest) break; else continue; } no_packet_count=0; memset(no_packet, 0, nb_input_files); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= input_files[file_index].nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; if (ist->discard) goto discard_packet; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (ist->ts_scale) { if(pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if(pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; } if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); int64_t delta= pkt_dts - ist->next_pts; if((delta < -1LL*dts_delta_threshold*AV_TIME_BASE || (delta > 1LL*dts_delta_threshold*AV_TIME_BASE && ist->st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) || pkt_dts+1<ist->pts)&& !copy_ts){ input_files[ist->file_index].ts_offset -= delta; if (verbose > 2) fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files[ist->file_index].ts_offset); pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if(pkt.pts != AV_NOPTS_VALUE) pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } if (output_packet(ist, ist_index, output_streams, nb_output_streams, &pkt) < 0) { if (verbose >= 0) fprintf(stderr, "Error while decoding stream #%d.%d\n", ist->file_index, ist->st->index); if (exit_on_error) exit_program(1); av_free_packet(&pkt); goto redo; } discard_packet: av_free_packet(&pkt); print_report(output_files, output_streams, nb_output_streams, 0, timer_start); } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { output_packet(ist, i, output_streams, nb_output_streams, NULL); } } flush_encoders(output_streams, nb_output_streams); term_exit(); for(i=0;i<nb_output_files;i++) { os = output_files[i].ctx; av_write_trailer(os); } print_report(output_files, output_streams, nb_output_streams, 1, timer_start); for (i = 0; i < nb_output_streams; i++) { ost = &output_streams[i]; if (ost->encoding_needed) { av_freep(&ost->st->codec->stats_in); avcodec_close(ost->st->codec); } #if CONFIG_AVFILTER avfilter_graph_free(&ost->graph); #endif } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { avcodec_close(ist->st->codec); } } ret = 0; fail: av_freep(&bit_buffer); av_freep(&no_packet); if (output_streams) { for (i = 0; i < nb_output_streams; i++) { ost = &output_streams[i]; if (ost) { if (ost->st->stream_copy) av_freep(&ost->st->codec->extradata); if (ost->logfile) { fclose(ost->logfile); ost->logfile = NULL; } av_fifo_free(ost->fifo); av_freep(&ost->st->codec->subtitle_header); av_free(ost->resample_frame.data[0]); av_free(ost->forced_kf_pts); if (ost->video_resample) sws_freeContext(ost->img_resample_ctx); if (ost->resample) audio_resample_close(ost->resample); if (ost->reformat_ctx) av_audio_convert_free(ost->reformat_ctx); av_dict_free(&ost->opts); } } } return ret; }
1threat
java regex split multiple separators : I have a string that contains urls separate by | like this: (http://...|http://...|http://...) but inside some urls I may have the caracheter **|**, so I could split it with .split("|http://") but the problem is that inside some urls contains another urls like this (http://...|http://..=http://...=http://...|http://...=http%25253A%25252F%25252F...). So how can I split by ( |http:// or =http:// or =http%25253A%25252F%25252F) using regex? Thanks Jon
0debug
I got a PHP syntax error and I don't know what I did wrong? : <p>I was trying to make a page so I put a post on a specific page on Wordpress and I ended up getting a syntax error. Below is the code I used.</p> <pre><code> &lt;?php /* Template Name: blog */ global $more; $more = 0; query_posts('cat=29'); if(have_posts()) : while(have_posts()) : the_post(); ?&gt; &lt;/p&gt; &lt;p&gt; &lt;a href=&amp;amp;quot;&lt;?php the_permalink(); ?&gt;&amp;amp;quot;&gt;&lt;?php the_title( '&lt;/p&gt; &lt;h3&gt;', &lt;/h3&gt; &lt;p&gt;' ); ?&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt; &lt;?php endwhile; &lt;endif; wp_reset_query(); ?&gt; </code></pre>
0debug
UVA.112 Tree Summing and Runtime Error : For a couple of weeks ago, I got some homeworks from my university and the thing is that, though other problems are accepted on the uva, I cannot figure out what is going wrong with this problem. I've already run the input from udebug website and there was no problem. I double-checked the result and now, I'm sick and tired of solving this issue. Here are details about what has happeded. First of all, I increase the BUFSIZE to 2^20 in order to avoid any memory overflow. The result? Failed. Second, I downsized the size of the element in the stack I made. The result? Failed. Lastly, I removed an eol character of the result just in case. The result? Failed. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #define BUFSIZE 16384 typedef struct node { int element[BUFSIZE]; int size; int current; }Stack; static Stack *stack; static int level; static int integer; bool initialize(void) { if (stack == NULL) stack = (Stack *)malloc(sizeof(Stack)); stack->size = BUFSIZE; stack->current = 0; return true; } bool push(int number) { if (stack == NULL) return false; if ((stack->current + 1) > stack->size) return false; stack->element[stack->current] = number; stack->current++; return true; } int pop() { if (stack->current <= 0) return 0xFFFFFFFF; stack->current--; return stack->element[stack->current]; } int sum() { int result = 0; int i; if (stack == NULL) return 0xFFFFFFFF; if (stack->current == 0) return 0xFFFFFFFF; for (i = 0; i < stack->current; i++) result += stack->element[i]; return result; } void replace(char * o_string, char * s_string, char * r_string) { char *buffer = (char *)calloc(BUFSIZE, sizeof(char)); char * ch; if (!(ch = strstr(o_string, s_string))) return; strncpy(buffer, o_string, ch - o_string); buffer[ch - o_string] = 0; sprintf(buffer + (ch - o_string), "%s%s", r_string, ch + strlen(s_string)); o_string[0] = 0; strcpy(o_string, buffer); free(buffer); return replace(o_string, s_string, r_string); } int main(void) { char *buffer; char *line; char *restOfTheString; char *token; bool checked = false, found = false; int i = 0, j = 0, scannedInteger, result = 0, array[4096]; buffer = (char *)calloc(BUFSIZE, sizeof(char)); restOfTheString = (char *)calloc(BUFSIZE, sizeof(char)); line = (char *)calloc(BUFSIZE, sizeof(char)); memset(buffer, 0, BUFSIZE); for (i = 0; i < 4096; i++) { array[i] = -1; } level = 0; integer = 0; while (fgets(line, sizeof(line), stdin) != NULL) { if (line[0] != '\n') { token = strtok(line, "\n"); if (strlen(line) >= 1) { strcat(buffer, token); } } } replace(buffer, " ", ""); replace(buffer, "()()", "K"); strcpy(restOfTheString, buffer); i = 0; while (restOfTheString[i] != 0) { if (level == 0 && !checked) { initialize(); sscanf(&restOfTheString[i], "%d%s", &integer, &restOfTheString[0]); i = -1; checked = true; } if (restOfTheString[i] == '(') { checked = false; level++; } else if (restOfTheString[i] == ')') { if (restOfTheString[i - 1] != '(') if (pop() == 0xFFFFFFFF) return 0; level--; if (!found && level == 0) { array[j] = 0; j++; free(stack); stack = NULL; } else if (found && level == 0) { array[j] = 1; j++; free(stack); stack = NULL; found = false; } } else if (restOfTheString[i] == '-' && !checked) { if (sscanf(&restOfTheString[i], "%d%s", &scannedInteger, &restOfTheString[0]) == 2) { if (push(scannedInteger) == false) return 0; i = -1; } } else if (restOfTheString[i] >= 48 && restOfTheString[i] <= 57 && !checked) { if (sscanf(&restOfTheString[i], "%d%s", &scannedInteger, &restOfTheString[0]) == 2) { if (push(scannedInteger) == false) return 0; i = -1; } } else if (restOfTheString[i] == 'K') { if ((result = sum()) == 0xFFFFFFFF) return 0; if (result == integer) { found = true; } } i++; } i = 0; while (array[i] != -1) { if (array[i] == 1) printf("yes\n"); else if (array[i] == 0) printf("no\n"); i++; } return 0; } Though it is cleary suspicious about the memory usage, I don't know how to track the stack on my system. So if you guys have any idea about this problem, please help me cause I'm stuck and the deadline of this homework is within the next 18 hous. Thanks
0debug
static void spr_write_tbu(DisasContext *ctx, int sprn, int gprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_store_tbu(cpu_env, cpu_gpr[gprn]); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
1threat
Delete file if another file does not exist : <p>I've searched quite a bit on this topic but can only find "delete if file or another file exists" which is not what I need...</p> <p>Windows 7 from a batch file or command prompt:</p> <p>Search a specific directory and if any .edl files exist, delete them only if an indenticaly named .ts file does not exist.</p> <p>The files themselves need no special consideration (not hidden, not in use, have no odd permissions etc), and don't care about size etc</p> <p>Cheers, RLW</p>
0debug
static void mcf5208evb_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; M68kCPU *cpu; CPUM68KState *env; int kernel_size; uint64_t elf_entry; hwaddr entry; qemu_irq *pic; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); if (!cpu_model) { cpu_model = "m5208"; } cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model)); env = &cpu->env; env->vbr = 0; memory_region_allocate_system_memory(ram, NULL, "mcf5208.ram", ram_size); memory_region_add_subregion(address_space_mem, 0x40000000, ram); memory_region_init_ram(sram, NULL, "mcf5208.sram", 16384, &error_fatal); memory_region_add_subregion(address_space_mem, 0x80000000, sram); pic = mcf_intc_init(address_space_mem, 0xfc048000, cpu); mcf_uart_mm_init(0xfc060000, pic[26], serial_hds[0]); mcf_uart_mm_init(0xfc064000, pic[27], serial_hds[1]); mcf_uart_mm_init(0xfc068000, pic[28], serial_hds[2]); mcf5208_sys_init(address_space_mem, pic); if (nb_nics > 1) { fprintf(stderr, "Too many NICs\n"); exit(1); } if (nd_table[0].used) { mcf_fec_init(address_space_mem, &nd_table[0], 0xfc030000, pic + 36); } if (!kernel_filename) { if (qtest_enabled()) { return; } fprintf(stderr, "Kernel image must be specified\n"); exit(1); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, NULL, NULL, 1, EM_68K, 0, 0); entry = elf_entry; if (kernel_size < 0) { kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL, NULL, NULL); } if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, 0x40000000, ram_size); entry = 0x40000000; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } env->pc = entry; }
1threat
Changing the results of a complex query or altering the results after they are returned : I have an extremely complex and long query that I did not write and that spans over 14 lines that returns something like this |data| fromDateTime | toDateTime | ------------------------------------------------ | 2 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 2 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 2 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 3 | 2017-09-08 11:30:00 | 2017-09-08 17:00:00 | | 3 | 2017-09-08 11:30:00 | 2017-09-08 17:00:00 | | 4 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | | 4 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | | 4 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | And I need something like this |data| fromdatetime | toDateTime | ------------------------------------------------ | 2 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 0 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 0 | 2017-09-08 08:00:00 | 2017-09-08 11:00:00 | | 3 | 2017-09-08 11:30:00 | 2017-09-08 17:00:00 | | 0 | 2017-09-08 11:30:00 | 2017-09-08 17:00:00 | | 4 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | | 0 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | | 0 | 2017-09-08 17:00:00 | 2017-09-08 19:00:00 | The moral of the story is that the data in the "data" column contains duplicate information that gets summed in a report resulting in bad info I NEED THAT ROW THOUGH I cannot get rid of the row with distinct
0debug
static int vdpau_alloc(AVCodecContext *s) { InputStream *ist = s->opaque; int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR; AVVDPAUContext *vdpau_ctx; VDPAUContext *ctx; const char *display, *vendor; VdpStatus err; int i; ctx = av_mallocz(sizeof(*ctx)); if (!ctx) return AVERROR(ENOMEM); ist->hwaccel_ctx = ctx; ist->hwaccel_uninit = vdpau_uninit; ist->hwaccel_get_buffer = vdpau_get_buffer; ist->hwaccel_retrieve_data = vdpau_retrieve_data; ctx->tmp_frame = av_frame_alloc(); if (!ctx->tmp_frame) goto fail; ctx->dpy = XOpenDisplay(ist->hwaccel_device); if (!ctx->dpy) { av_log(NULL, loglevel, "Cannot open the X11 display %s.\n", XDisplayName(ist->hwaccel_device)); goto fail; } display = XDisplayString(ctx->dpy); err = vdp_device_create_x11(ctx->dpy, XDefaultScreen(ctx->dpy), &ctx->device, &ctx->get_proc_address); if (err != VDP_STATUS_OK) { av_log(NULL, loglevel, "VDPAU device creation on X11 display %s failed.\n", display); goto fail; } #define GET_CALLBACK(id, result) \ do { \ void *tmp; \ err = ctx->get_proc_address(ctx->device, id, &tmp); \ if (err != VDP_STATUS_OK) { \ av_log(NULL, loglevel, "Error getting the " #id " callback.\n"); \ goto fail; \ } \ ctx->result = tmp; \ } while (0) GET_CALLBACK(VDP_FUNC_ID_GET_ERROR_STRING, get_error_string); GET_CALLBACK(VDP_FUNC_ID_GET_INFORMATION_STRING, get_information_string); GET_CALLBACK(VDP_FUNC_ID_DEVICE_DESTROY, device_destroy); if (vdpau_api_ver == 1) { GET_CALLBACK(VDP_FUNC_ID_DECODER_CREATE, decoder_create); GET_CALLBACK(VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy); GET_CALLBACK(VDP_FUNC_ID_DECODER_RENDER, decoder_render); } GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters); GET_CALLBACK(VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES, video_surface_query); for (i = 0; i < FF_ARRAY_ELEMS(vdpau_formats); i++) { VdpBool supported; err = ctx->video_surface_query(ctx->device, VDP_CHROMA_TYPE_420, vdpau_formats[i][0], &supported); if (err != VDP_STATUS_OK) { av_log(NULL, loglevel, "Error querying VDPAU surface capabilities: %s\n", ctx->get_error_string(err)); goto fail; } if (supported) break; } if (i == FF_ARRAY_ELEMS(vdpau_formats)) { av_log(NULL, loglevel, "No supported VDPAU format for retrieving the data.\n"); return AVERROR(EINVAL); } ctx->vdpau_format = vdpau_formats[i][0]; ctx->pix_fmt = vdpau_formats[i][1]; if (vdpau_api_ver == 1) { vdpau_ctx = av_vdpau_alloc_context(); if (!vdpau_ctx) goto fail; vdpau_ctx->render = ctx->decoder_render; s->hwaccel_context = vdpau_ctx; } else if (av_vdpau_bind_context(s, ctx->device, ctx->get_proc_address, 0)) goto fail; ctx->get_information_string(&vendor); av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, " "to decode input stream #%d:%d.\n", vendor, display, ist->file_index, ist->st->index); return 0; fail: av_log(NULL, loglevel, "VDPAU init failed for stream #%d:%d.\n", ist->file_index, ist->st->index); vdpau_uninit(s); return AVERROR(EINVAL); }
1threat
STORING MULTIPLE DATA TYPE IN AN ARRAY - C#? : I want to store multiple data type in an array of c# . I researched on this and found one answer i.e to use object type , the code for which goes like this object[] array = new object[2]; Is there any other way to achieve this?? Please help me out
0debug
Laravel 5 How to configure the Queue database driver to connect to a non-default database? : <p>In Laravel 5.1, we can set the Queue connection configurations in <code>config/queue.php</code>.</p> <pre><code>QUEUE_DRIVER=database </code></pre> <hr> <pre><code> 'database' =&gt; [ 'driver' =&gt; 'database', 'table' =&gt; 'jobs', 'queue' =&gt; 'default', 'expire' =&gt; 60, ], </code></pre> <hr> <p>However, it will only use the default database connection in <code>config/database.php</code>.</p> <p>If I have 2 database, 1 default database <code>mysql1</code> in localhost, and 1 database <code>mysql2</code> in a remote server, and the Queue <code>jobs</code> table is in the remote database <code>mysql2</code>, how can I configure the Queue database driver to use the remote <code>mysql2</code> database? Please note that the main App is using the default database in localhost.</p>
0debug
static int load_sofa(AVFilterContext *ctx, char *filename, int *samplingrate) { struct SOFAlizerContext *s = ctx->priv; int ncid, n_dims, n_vars, n_gatts, n_unlim_dim_id, status; char data_delay_dim_name[NC_MAX_NAME]; float *sp_a, *sp_e, *sp_r, *data_ir; char *sofa_conventions; char dim_name[NC_MAX_NAME]; size_t *dim_length; char *text; unsigned int sample_rate; int data_delay_dim_id[2]; int samplingrate_id; int data_delay_id; int n_samples; int m_dim_id = -1; int n_dim_id = -1; int data_ir_id; size_t att_len; int m_dim; int *data_delay; int sp_id; int i, ret; s->sofa.ncid = 0; status = nc_open(filename, NC_NOWRITE, &ncid); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Can't find SOFA-file '%s'\n", filename); return AVERROR(EINVAL); } nc_inq(ncid, &n_dims, &n_vars, &n_gatts, &n_unlim_dim_id); dim_length = av_malloc_array(n_dims, sizeof(*dim_length)); if (!dim_length) { nc_close(ncid); return AVERROR(ENOMEM); } for (i = 0; i < n_dims; i++) { nc_inq_dim(ncid, i, (char *)&dim_name, &dim_length[i]); if (!strncmp("M", (const char *)&dim_name, 1)) m_dim_id = i; if (!strncmp("N", (const char *)&dim_name, 1)) n_dim_id = i; } if ((m_dim_id == -1) || (n_dim_id == -1)) { av_log(ctx, AV_LOG_ERROR, "Can't find required dimensions in SOFA file.\n"); av_freep(&dim_length); nc_close(ncid); return AVERROR(EINVAL); } n_samples = dim_length[n_dim_id]; m_dim = dim_length[m_dim_id]; av_freep(&dim_length); status = nc_inq_attlen(ncid, NC_GLOBAL, "Conventions", &att_len); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Can't get length of attribute \"Conventions\".\n"); nc_close(ncid); return AVERROR_INVALIDDATA; } text = av_malloc(att_len + 1); if (!text) { nc_close(ncid); return AVERROR(ENOMEM); } nc_get_att_text(ncid, NC_GLOBAL, "Conventions", text); *(text + att_len) = 0; if (strncmp("SOFA", text, 4)) { av_log(ctx, AV_LOG_ERROR, "Not a SOFA file!\n"); av_freep(&text); nc_close(ncid); return AVERROR(EINVAL); } av_freep(&text); status = nc_inq_attlen(ncid, NC_GLOBAL, "License", &att_len); if (status == NC_NOERR) { text = av_malloc(att_len + 1); if (text) { nc_get_att_text(ncid, NC_GLOBAL, "License", text); *(text + att_len) = 0; av_log(ctx, AV_LOG_INFO, "SOFA file License: %s\n", text); av_freep(&text); } } status = nc_inq_attlen(ncid, NC_GLOBAL, "SourceDescription", &att_len); if (status == NC_NOERR) { text = av_malloc(att_len + 1); if (text) { nc_get_att_text(ncid, NC_GLOBAL, "SourceDescription", text); *(text + att_len) = 0; av_log(ctx, AV_LOG_INFO, "SOFA file SourceDescription: %s\n", text); av_freep(&text); } } status = nc_inq_attlen(ncid, NC_GLOBAL, "Comment", &att_len); if (status == NC_NOERR) { text = av_malloc(att_len + 1); if (text) { nc_get_att_text(ncid, NC_GLOBAL, "Comment", text); *(text + att_len) = 0; av_log(ctx, AV_LOG_INFO, "SOFA file Comment: %s\n", text); av_freep(&text); } } status = nc_inq_attlen(ncid, NC_GLOBAL, "SOFAConventions", &att_len); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Can't get length of attribute \"SOFAConventions\".\n"); nc_close(ncid); return AVERROR_INVALIDDATA; } sofa_conventions = av_malloc(att_len + 1); if (!sofa_conventions) { nc_close(ncid); return AVERROR(ENOMEM); } nc_get_att_text(ncid, NC_GLOBAL, "SOFAConventions", sofa_conventions); *(sofa_conventions + att_len) = 0; if (strncmp("SimpleFreeFieldHRIR", sofa_conventions, att_len)) { av_log(ctx, AV_LOG_ERROR, "Not a SimpleFreeFieldHRIR file!\n"); av_freep(&sofa_conventions); nc_close(ncid); return AVERROR(EINVAL); } av_freep(&sofa_conventions); status = nc_inq_varid(ncid, "Data.SamplingRate", &samplingrate_id); status += nc_get_var_uint(ncid, samplingrate_id, &sample_rate); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read Data.SamplingRate.\n"); nc_close(ncid); return AVERROR(EINVAL); } *samplingrate = sample_rate; sp_a = s->sofa.sp_a = av_malloc_array(m_dim, sizeof(float)); sp_e = s->sofa.sp_e = av_malloc_array(m_dim, sizeof(float)); sp_r = s->sofa.sp_r = av_malloc_array(m_dim, sizeof(float)); data_delay = s->sofa.data_delay = av_calloc(m_dim, 2 * sizeof(int)); data_ir = s->sofa.data_ir = av_malloc_array(m_dim * n_samples, sizeof(float) * 2); if (!data_delay || !sp_a || !sp_e || !sp_r || !data_ir) { close_sofa(&s->sofa); return AVERROR(ENOMEM); } status = nc_inq_varid(ncid, "Data.IR", &data_ir_id); status += nc_get_var_float(ncid, data_ir_id, data_ir); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read Data.IR!\n"); ret = AVERROR(EINVAL); goto error; } status = nc_inq_varid(ncid, "SourcePosition", &sp_id); status += nc_get_vara_float(ncid, sp_id, (size_t[2]){ 0, 0 } , (size_t[2]){ m_dim, 1}, sp_a); status += nc_get_vara_float(ncid, sp_id, (size_t[2]){ 0, 1 } , (size_t[2]){ m_dim, 1}, sp_e); status += nc_get_vara_float(ncid, sp_id, (size_t[2]){ 0, 2 } , (size_t[2]){ m_dim, 1}, sp_r); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read SourcePosition.\n"); ret = AVERROR(EINVAL); goto error; } status = nc_inq_varid(ncid, "Data.Delay", &data_delay_id); status += nc_inq_vardimid(ncid, data_delay_id, &data_delay_dim_id[0]); status += nc_inq_dimname(ncid, data_delay_dim_id[0], data_delay_dim_name); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read Data.Delay.\n"); ret = AVERROR(EINVAL); goto error; } if (!strncmp(data_delay_dim_name, "I", 2)) { int delay[2]; av_log(ctx, AV_LOG_DEBUG, "Data.Delay has dimension [I R]\n"); status = nc_get_var_int(ncid, data_delay_id, &delay[0]); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read Data.Delay\n"); ret = AVERROR(EINVAL); goto error; } int *data_delay_r = data_delay + m_dim; for (i = 0; i < m_dim; i++) { data_delay[i] = delay[0]; data_delay_r[i] = delay[1]; } } else if (!strncmp(data_delay_dim_name, "M", 2)) { av_log(ctx, AV_LOG_ERROR, "Data.Delay in dimension [M R]\n"); status = nc_get_var_int(ncid, data_delay_id, data_delay); if (status != NC_NOERR) { av_log(ctx, AV_LOG_ERROR, "Couldn't read Data.Delay\n"); ret = AVERROR(EINVAL); goto error; } } else { av_log(ctx, AV_LOG_ERROR, "Data.Delay does not have the required dimensions [I R] or [M R].\n"); ret = AVERROR(EINVAL); goto error; } s->sofa.m_dim = m_dim; s->sofa.n_samples = n_samples; s->sofa.ncid = ncid; nc_close(ncid); return 0; error: close_sofa(&s->sofa); return ret; }
1threat
void qemu_cpu_kick(CPUState *cpu) { qemu_cond_broadcast(cpu->halt_cond); if (tcg_enabled()) { cpu_exit(cpu); qemu_cpu_kick_rr_cpu(); } else { if (hax_enabled()) { cpu->exit_request = 1; } qemu_cpu_kick_thread(cpu); } }
1threat
How to calculate date and change format date : How to calculate date and change format date. I can't compare date code below. I want to know why help me please i want example compare date or calculate day results of different days <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> <script> var d = new Date(); var curr_date = d.getDate(); var curr_month = d.getMonth() + 1; var curr_year = d.getFullYear(); var d1 = curr_date + "/" + curr_month + "/" + curr_year; //alert(d1); change format date completed 12/04/2019 var date2 = new Date("04/12/2018"); var curr_date2 = date2.getDate(); var curr_month2 = date2.getMonth() + 1; var curr_year2 = date2.getFullYear(); var d2 = curr_date2 + "/" + curr_month2 + "/" + curr_year2; //alert(d2); // change format date completed 12/04/2018 if(d1 > d2) { console.log("aaa"); }else{ console.log("bbb"); } </script> <!-- end snippet -->
0debug
how to download attachments from multiple emails on a specific range date and specific subject using Perl? : <p>I need to download attachments from multiple emails on a specific range date and specific subject.</p> <p>In specific range date, i.e. 01/10/2016 to 02/02/2017 and subject "Cambridge".</p> <p>I use imap gmail account. How do I do it using Perl?</p>
0debug
How to display exactly 6 previous month's by their name from the current date in a select drop down list? : <p>The project i am working on needs to display 6 previous months by name in a select drop down list which will then be sent to service units . Is there a way to do it using JavaScript?</p>
0debug
static void test_rtas_get_time_of_day(void) { QOSState *qs; struct tm tm; uint32_t ns; uint64_t ret; time_t t1, t2; qs = qtest_spapr_boot("-machine pseries"); g_assert(qs != NULL); t1 = time(NULL); ret = qrtas_get_time_of_day(qs->alloc, &tm, &ns); g_assert_cmpint(ret, ==, 0); t2 = mktimegm(&tm); g_assert(t2 - t1 < 5); qtest_shutdown(qs); }
1threat
Trying to calculate retention rate in R, how to divide one row by another with the same date and then apply same logic across entire data frame? : <p>I am attempting to calculate retention rate of an Instagram story (# of viewers on the last frame divided by # viewers on first frame) within the same date. I have this data within a data frame in R where each frame is listed as a a row and any frame with the same date makes up the entire story for that date. I am having a hard time figuring out how to obtain the index of the first and last frame within the same date and then dividing them and then applying this to the rest of the data frame? Any help would be greatly appreciated!</p>
0debug
Add User in my andiod app : Hi I Implemented an android app. 1. A Splash screen 2. Then MainActivity - GetSharedPerf - if(sharedpref == empty or null) { * Open activity --> Login Activity - } 3. else { Stay on MainActivity } My Question is After Successful login i need to add new user --> add new user User Id in Shared pref & Switch between Users in MainActivity Note: Simply I need gmail app model for add multiple user ac and switch between users inbox...
0debug
static void nbd_coroutine_start(NBDClientSession *s, NBDRequest *request) { if (s->in_flight == MAX_NBD_REQUESTS) { qemu_co_queue_wait(&s->free_sema, NULL); assert(s->in_flight < MAX_NBD_REQUESTS); } s->in_flight++; }
1threat
(Java)Why is my array not working as intended? : I have been unable to submit my assignment because of one final discrepancy in my code. I've spent several hours trying to resolve it. My code takes 20 test answers that can either be 'A', 'B', 'C', or 'D', and then tells you whether you passed (>=15 correct) or failed, how many you got right, and how many you got wrong. Afterwards, it tells you the question numbers of the ones you got wrong. However, only the first few numbers are actually recorded to the array I am using, and the last 5 are not (it is always the last 5, regardless of how many you got wrong). What's strange is, I'm using a `for` loop to read the values INTO the array, so there should not be discrepancies. If there was, it would most likely give me an `arrayIndexOutOfBoundsExeption`! Here's the code, there is a comment for the method with the problem (starts at line 81): import java.util.Scanner; public class ch7 { private static char[] correctAns = {'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A'}; public static void main(String[] args) { Scanner kb = new Scanner(System.in); boolean pass; char[] answers = new char[20]; for(int x = 0; x < answers.length; x++) { do { System.out.printf("Enter your answer for question %d:", x + 1); answers[x] = kb.next().charAt(0); } while(answers[x] != 'A' && answers[x] != 'B' && answers[x] != 'C' && answers[x] != 'D' && answers[x] != 'a' && answers[x] != 'b' && answers[x] != 'c' && answers[x] != 'd'); } for(int x = 0; x < answers.length; x++) { answers[x] = Character.toUpperCase(answers[x]); } pass = passed(answers); if(pass == true) System.out.println("You Passed!"); else System.out.println("You did not pass."); System.out.printf("You got %d answers correct out of 20.\n", totalCorrect(answers)); System.out.printf("You answered %d questions incorrectly.\n", totalIncorrect(answers)); int[] qMissed = questionsMissed(answers); if(qMissed.length != 0) { System.out.print("You got questions "); for(int x = 0; x < qMissed.length; x++) { if(x == qMissed.length - 1) System.out.printf("and #%d ", qMissed[x]); else System.out.printf("#%d, ", qMissed[x]); } System.out.println("wrong."); } } public static boolean passed(char[] ans) { int correct = 0; int incorrect = 0; for(int x = 0; x < ans.length; x++) { if(ans[x] == correctAns[x]) { correct++; } else incorrect++; } return correct > incorrect ? true: false; } public static int totalCorrect(char[] ans) { int correct = 0; for(int x = 0; x < ans.length; x++) { if(ans[x] == correctAns[x]) { correct++; } } return correct; } public static int totalIncorrect(char[] ans) { int incorrect = 0; for(int x = 0; x < ans.length; x++) { if(ans[x] != correctAns[x]) { incorrect++; } } return incorrect; } public static int[] questionsMissed(char[] ans) { // problem somewhere in this method int nMissed = totalIncorrect(ans); int[] missedQuestions = new int[nMissed]; int i = 0; for(int x = 0; x < totalIncorrect(ans); x++) { if(ans[x] != correctAns[x]) { missedQuestions[i] = x + 1; i++; } } return missedQuestions; } }
0debug
static int v410_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data) { AVFrame *pic = data; uint8_t *dst = buf; uint16_t *y, *u, *v; uint32_t val; int i, j; int output_size = 0; if (buf_size < avctx->width * avctx->height * 3) { av_log(avctx, AV_LOG_ERROR, "Out buffer is too small.\n"); return AVERROR(ENOMEM); } avctx->coded_frame->reference = 0; avctx->coded_frame->key_frame = 1; avctx->coded_frame->pict_type = FF_I_TYPE; y = (uint16_t *)pic->data[0]; u = (uint16_t *)pic->data[1]; v = (uint16_t *)pic->data[2]; for (i = 0; i < avctx->height; i++) { for (j = 0; j < avctx->width; j++) { val = u[j] << 2; val |= y[j] << 12; val |= v[j] << 22; AV_WL32(dst, val); dst += 4; output_size += 4; } y += pic->linesize[0] >> 1; u += pic->linesize[1] >> 1; v += pic->linesize[2] >> 1; } return output_size; }
1threat
static void sunkbd_event(void *opaque, int ch) { ChannelState *s = opaque; int release = ch & 0x80; trace_escc_sunkbd_event_in(ch); switch (ch) { case 58: s->caps_lock_mode ^= 1; if (s->caps_lock_mode == 2) return; break; case 69: s->num_lock_mode ^= 1; if (s->num_lock_mode == 2) return; break; case 186: s->caps_lock_mode ^= 2; if (s->caps_lock_mode == 3) return; break; case 197: s->num_lock_mode ^= 2; if (s->num_lock_mode == 3) return; break; case 0xe0: s->e0_mode = 1; return; default: break; } if (s->e0_mode) { s->e0_mode = 0; ch = e0_keycodes[ch & 0x7f]; } else { ch = keycodes[ch & 0x7f]; } trace_escc_sunkbd_event_out(ch); put_queue(s, ch | release); }
1threat
window.location.href = 'http://attack.com?user=' + user_input;
1threat
void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) { int ist1, ist2; int64_t pos_delta = 0; const char *proto = avio_find_protocol_name(s->filename); if (!(strcmp(proto, "file") && strcmp(proto, "pipe") && strcmp(proto, "cache"))) return; for (ist1 = 0; ist1 < s->nb_streams; ist1++) { AVStream *st1 = s->streams[ist1]; for (ist2 = 0; ist2 < s->nb_streams; ist2++) { AVStream *st2 = s->streams[ist2]; int i1, i2; if (ist1 == ist2) continue; for (i1 = i2 = 0; i1 < st1->nb_index_entries; i1++) { AVIndexEntry *e1 = &st1->index_entries[i1]; int64_t e1_pts = av_rescale_q(e1->timestamp, st1->time_base, AV_TIME_BASE_Q); for (; i2 < st2->nb_index_entries; i2++) { AVIndexEntry *e2 = &st2->index_entries[i2]; int64_t e2_pts = av_rescale_q(e2->timestamp, st2->time_base, AV_TIME_BASE_Q); if (e2_pts - e1_pts < time_tolerance) continue; pos_delta = FFMAX(pos_delta, e1->pos - e2->pos); break; } } } } pos_delta *= 2; if (s->pb->buffer_size < pos_delta && pos_delta < (1<<24)) { av_log(s, AV_LOG_VERBOSE, "Reconfiguring buffers to size %"PRId64"\n", pos_delta); ffio_set_buf_size(s->pb, pos_delta); s->pb->short_seek_threshold = FFMAX(s->pb->short_seek_threshold, pos_delta/2); } }
1threat
How to turn off telemetry for SQL 2016 : <p>Installing SQL 2016 automatically turns on all of the "CEIP", or Customer Experience Improvement Program elements. These elements report back to Microsoft about various aspects of your installation experience as well as your feature usage. I want to turn it off, because it's all blocked by our firewalls anyway and I don't need the headache.</p>
0debug
Using InfluxDB subquery to subtract values : <p>I have a Influx database that is getting filled with values. These values are presented by Grafana. What I need is to get the actual values depending on the selected time interval.</p> <p>Currently I have the following query for a single metric:</p> <pre><code>SELECT mean("value") FROM "table" WHERE $timeFilter GROUP BY time($interval) fill(null) </code></pre> <p>What I want is to subtract the lowest value from that interval, so it only counts the values from within that interval. So the graph needs to start at zero. To get the lowest value from that interval I use:</p> <pre><code>SELECT min("value") FROM "table" WHERE $timeFilter </code></pre> <p>So I thought combining those two (with a subquery) like this should work:</p> <pre><code>SELECT mean("value") - (SELECT min("value") FROM "table" WHERE $timeFilter) FROM "table" WHERE $timeFilter GROUP BY time($interval) fill(null) </code></pre> <p>Unfortunately this doesnt work. The query is not accepted as a subquery.</p>
0debug
pytest run only the changed file? : <p>I'm fairly new to Python, trying to learn the toolsets.</p> <p>I've figured out how to get <code>py.test -f</code> to watch my tests as I code. One thing I haven't been able to figure out is if there's a way to do a smarter watcher, that works like Ruby's Guard library.</p> <p>Using guard + minitest the behavior I get is if I save a file like <code>my_class.rb</code> then <code>my_class_test.rb</code> is executed, and if I hit <code>enter</code> in the cli it runs all tests.</p> <p>With pytest so far I haven't been able to figure out a way to only run the test file corresponding to the last touched file, thus avoiding the wait for the entire test suite to run until I've got the current file passing.</p> <p>How would you pythonistas go about that?</p> <p>Thanks!</p>
0debug
How to create a new laravel project without internet connectivity? : <p>I have composer installed and can use the</p> <pre><code>laravel new ProjectName </code></pre> <p>command to create a new project. However this requires an active internet connection. I need to be able to do the same thing offline as well. Will it work if I just copy the files from one project and then paste them in another folder with the required name?</p> <p>For example. if I already have a project called 'blog' and I just created a new directory 'blog1' and pasted all the files in "blog" folder there, would that give me a new project blog1?</p>
0debug
I Cant Get My Tkinter Checkbutton Variable Using .get() : So ive been working on a project and recently encountered an issue with my check button, As whenever I try to do variablenname.get() it never works as it says int value has no attribute get(), I did use variablename = IntVar() too, what I am tring to do is to make if statements dependant on the value of the checkbutton def BusTramScreen(): global timea global clock global Tickets global BusTicketPrice global price var = IntVar() BTR = Tk() BTR.attributes("-fullscreen", True) BTR.configure(bg = "#252538") d=datetime.datetime.utcnow() if d.hour < 9 and d.hour >7 or d.hour <19 and d.hour > 16: price = "Peak" else: price = "Off-Peak" clock = Label(BTR, font=("times", 20, "bold"), bg="#252538",fg= "white") clock.place(x= 850, y = 10) title = Label(BTR, text = "Purchase Bus or Tram Tickets", font=("times", 50), bg="#252538", fg= "white") title.place(x= 470, y = 50) pricerange = Label(BTR, text=(price), font = ("times", 35, "bold"), bg="#252538", fg= "white") pricerange.place(x=0, y= 10) Discounts = Checkbutton(BTR, text="Discount (Students, Under 18s, 65+ and Disability Badge Holders)", font = ("times", 30), bg="#252538", fg = "#99FFFF", variable = var) Discounts.place(x=120, y=300) Quan=Label(BTR, text = "QUANTITY", font = ("times", 22), bg="#252538", fg= "white") Quan.place(x=120, y=450) PriceTag=Label(BTR, text =("£", Cost), font = ("times", 50), fg = "White", bg = "#252538") PriceTag.place(x=1000, y= 450) val=Label(BTR, text = Tickets, font = ("times", 22), height = 5, width = 15, bg= "White") val.place(x=175, y=550) add=Button(BTR, text = "+", font = ("times", 22), height = 5, width = 10, bg = "#B266FF", command = lambda: UpdateAdd(val, BTR, PriceTag, BusTicketPrice, price, var)) add.place(x=420, y=550) sub=Button(BTR, text = "-", font = ("times", 22), height = 5, width = 10, bg = "#B266FF", command = lambda: UpdateSub(val, BTR, PriceTag, BusTicketPrice, price, var)) sub.place(x=6, y=550) tick() BTR.mainloop( ) clock.after(200, tick) def UpdateAdd(val, BTR, PriceTag, BusTicketPrice, price, var): global Tickets global Cost var = var.get() print(price) print(var.get()) Tickets = Tickets + 1 val.destroy() val = Label(BTR, text = Tickets, font = ("times", 22), height = 5, width = 15, bg= "White") val.place(x=175, y=550) PriceTag.destroy() if price == "Peak" and (not var.get()) : BusTicketPrice=BusTicketPrice*1.25 elif (var.get()) and price == "Peak": BusTicketPrice=BusTicketPrice elif (var.get()) and price == "Off-Peak": BusTicketPrice=BusTicketPrice*0.75 elif price == "Off-Peak" and (not var.get()): BusTicketPrice=BusTicketPrice Cost = BusTicketPrice * Tickets Cost = round(Cost, 3) PriceTag=Label(BTR, text =("£", str(Cost), "0"), font = ("times", 50), fg = "White", bg = "#252538") PriceTag.place(x=1000, y= 450)
0debug
static int caca_write_trailer(AVFormatContext *s) { CACAContext *c = s->priv_data; av_freep(&c->window_title); caca_free_dither(c->dither); caca_free_display(c->display); caca_free_canvas(c->canvas); return 0; }
1threat
Ruby Exception: Get Object information that caused the exception : Below is the piece of code that I have written to handle my exception. Class Business < ExceptionController def work(arg1,arg2) #####some business logic that cause exception end end class ExceptionController < ApplicationController rescue_from Exception, :with => :render_error_response def render_error_response(e) p e.message p e.backtrace end end So, I log the message and backtrace in the render_error_response defined in exception controller. What I want is to print the arguments of the function i.e. arg1,arg2 of work function that caused the exception. So basically, along with exception backtrace, I need the object trace as well.
0debug
static int posix_aio_process_queue(void *opaque) { PosixAioState *s = opaque; struct qemu_paiocb *acb, **pacb; int ret; int result = 0; for(;;) { pacb = &s->first_aio; for(;;) { acb = *pacb; if (!acb) return result; ret = qemu_paio_error(acb); if (ret == ECANCELED) { *pacb = acb->next; qemu_aio_release(acb); result = 1; } else if (ret != EINPROGRESS) { if (ret == 0) { ret = qemu_paio_return(acb); if (ret == acb->aio_nbytes) ret = 0; else ret = -EINVAL; } else { ret = -ret; } trace_paio_complete(acb, acb->common.opaque, ret); *pacb = acb->next; acb->common.cb(acb->common.opaque, ret); qemu_aio_release(acb); result = 1; break; } else { pacb = &acb->next; } } } return result; }
1threat
Javascript ajax global variable undefined : <p>I try to get some info from external php with ajax and use the data but my global var return undefined.I try with async false but is deprecated.If i console in success function it has value outside is undefined.</p> <pre><code> var pkz; $(function(){ $.ajax({ type:'GET', url: '/user/cred', success: function (data){ pkz=data; } }); console.log(pkz); </code></pre>
0debug
Should changes in a package.json file be commited to a repository as well? : <p>I am not sure that if it is correct to commit and push the changes in the package.JSON file into a repository. as far as I understood, the others in the git can install new dependencies by executing this command: npm install and accordingly, their package.JSON will be updated too.OR, this files actually says what are the new dependencies and needs to be pushed as well. It would be great if some could clarify me. :)</p>
0debug
In C++,why reference can't change when it is Initialize? : <p>In c++ primer,the book says the concept that when reference is initialized,it can't change .But I found a problem,here is the coding:</p> <pre><code>int a[]={1,2,3,4}; for(auto &amp;c:a)cout&lt;&lt;c; </code></pre> <p>Then,the output is the element of a.But c is a reference here,why it can bind with different element of the array?I don't understand that.</p>
0debug
Swift 4 JSON Decoding Error with Collection View Cell : I am trying to build an iOS app in Xcode 9.2, Swift 4 that uses a Collection View Cell to display each of the categories in the JSON file. I was working through this tutorial as an example - https://www.youtube.com/watch?v=hPJaQ2Fh7Ao, but I am getting an error: typeMismatch(Swift.Array<Any>, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array<Any> but found a dictionary instead.", underlyingError: nil)) I have tried several different things, but I am stuck (and new to this). Any suggestions as to what I am missing or doing wrong would be great. Thanks! JSON API: { "category": [ { "id": 216, "title": "Spring" }, { "id": 219, "title": "Earth Day" }, { "id": 114, "title": "Admin. Professionals' Day" } ] } ViewController.swift: import UIKit struct Category: Codable { let category: [CategoryItem] } struct CategoryItem: Codable { let id: Int let title: String enum CodingKeys: String, CodingKey { case id, title } } class ViewController: UIViewController, UICollectionViewDataSource { var categories = [Category]() @IBOutlet weak var collectionView: UICollectionView! override func viewDidLoad() { super.viewDidLoad() collectionView.dataSource = self let jsonUrlString = "https://apis.*************/***/****/********" guard let url = URL(string: jsonUrlString) else { return } URLSession.shared.dataTask(with: url) { (data, response, err) in guard let data = data else { return } if err == nil { do { let decoder = JSONDecoder() let ecardcategory = try decoder.decode([Category].self, from: data) self.categories = ecardcategory } catch let err { print("Err", err) } DispatchQueue.main.async { //print(self.categories.count) self.collectionView.reloadData() } } }.resume() } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return categories.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "customCell", for: indexPath) as? CustomCollectionViewCell //cell?.nameLbl.text = categories[indexPath.row].title return cell! } }
0debug
No provider for ChildrenOutletContexts (injectionError) : <p>I am getting the following error when using Angular CLI to generate a routing module for my application:</p> <pre><code>ERROR Error: No provider for ChildrenOutletContexts! at injectionError (core.es5.js:1169) at noProviderError (core.es5.js:1207) at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649) at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKeyDefault (core.es5.js:2688) at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._getByKey (core.es5.js:2620) at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_.get (core.es5.js:2489) at resolveNgModuleDep (core.es5.js:9481) at NgModuleRef_.webpackJsonp.../../../core/@angular/core.es5.js.NgModuleRef_.get (core.es5.js:10569) at resolveDep (core.es5.js:11072) at createClass (core.es5.js:10936) </code></pre> <p>I generated the routing module with Angular CLI like this:</p> <pre><code>ng generate module --routing App </code></pre> <p>This is the contents of the routing module:</p> <pre><code>import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { MyComponent } from './my/my.component'; const routes: Routes = [ { path: '', component: MyComponent, }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], declarations: [] }) export class AppRoutingModule { } </code></pre> <p>And this is what I have in my <code>app.component.html</code>:</p> <pre><code>&lt;div class="container" role="main"&gt; &lt;router-outlet&gt;&lt;/router-outlet&gt; &lt;/div&gt; </code></pre> <p>What can be the reason of this error?</p>
0debug
React-Native: Get current page in FlatList when using pagingEnabled : <p>I have a FlastList that looks like this:</p> <pre><code>&lt;FlatList pagingEnabled={true} horizontal={true} showsHorizontalScrollIndicator={false} data={[ {key:"A"}, {key:"B"} ]} renderItem={ ({item, index}) =&gt; &lt;MyComponent /&gt; } /&gt; </code></pre> <p>I have the width of the component set so that only one page shows up on screen at a time. How do I determine what the current page is (or alternatively, the current component being shown)?</p>
0debug
Distant work for designer : <p><br> I have django project with some additional libs (like geo and etc.) on my pc, and git. And I've a friend, who don't know nothing about programming and development. <br> And my question is: <strong> How can she make design for my project on distant? </strong> <br> She will be a distant designer, and I don't know how to manage her work.</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
IE doesn't display some images : <p>I have a few ".jpg" images on my website. They all are displayed correctly in every browser... except Internet Explorer. In IE, most of them are displayed, but there are also images that aren't displayed and there's a black-white cross instead of them. It's not a problem with wrong path because, as I said, other browsers are able to display the images.</p>
0debug
ObservableCollection does not update UI : <p>On startup i bind an ObservableCollection to a menu:</p> <pre><code>Menu.ItemsSource = _manager.Selection; </code></pre> <p>This menu correctly displays all objects from the collection.</p> <p>Now i want to update the collection and add/remove some of the items in it:</p> <pre><code>private void OnBoxClick(object sender, RoutedEventArgs e) { _manager.Selection = _manager.GetNewSelection(); PropertyChanged?.Invoke(this, new CollectionChangeEventArgs(CollectionChangeAction.Refresh, _manager.Selection)); } public event CollectionChangeEventHandler PropertyChanged; </code></pre> <p>But the ui is still displaying how it was before..</p> <p>What is missing?</p>
0debug
Image size taken from Flutter Image_Picker plugin is way too big : <p>I want to use auto-focus on the camera, which is available on the image_picker plugin. However, when I call:</p> <pre><code>var bytes = new File(imagePath); var enc = await bytes.readAsBytes(); print(enc.length); </code></pre> <p>I got: 5121126</p> <p>which takes at least 10 seconds when I want to encode into json to send to an API server:</p> <pre><code>var body = json.encode({ 'image' : enc }) </code></pre> <p>In contrast, with the camera plugin, my byte array is only 420685, which is 10 times smaller, but it doesn't have the auto-focus feature. </p> <p>Can I get some advice on how to reduce the size of the byte array from image_picker? Thank you.</p>
0debug
static int alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index, uint16_t **refcount_block) { BDRVQcowState *s = bs->opaque; unsigned int refcount_table_index; int ret; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT); if (refcount_table_index < s->refcount_table_size) { uint64_t refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (refcount_block_offset) { return load_refcount_block(bs, refcount_block_offset, (void**) refcount_block); *refcount_block = NULL; ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; int64_t new_block = alloc_clusters_noref(bs, s->cluster_size); if (new_block < 0) { return new_block; #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64 " at %" PRIx64 "\n", refcount_table_index, cluster_index << s->cluster_bits, new_block); #endif if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) { ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, (void**) refcount_block); if (ret < 0) { goto fail_block; memset(*refcount_block, 0, s->cluster_size); int block_index = (new_block >> s->cluster_bits) & ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1); (*refcount_block)[block_index] = cpu_to_be16(1); } else { ret = update_refcount(bs, new_block, s->cluster_size, 1, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail_block; ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail_block; ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, (void**) refcount_block); if (ret < 0) { goto fail_block; memset(*refcount_block, 0, s->cluster_size); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(s->refcount_block_cache, *refcount_block); ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail_block; if (refcount_table_index < s->refcount_table_size) { uint64_t data64 = cpu_to_be64(new_block); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); ret = bdrv_pwrite_sync(bs->file, s->refcount_table_offset + refcount_table_index * sizeof(uint64_t), &data64, sizeof(data64)); if (ret < 0) { goto fail_block; s->refcount_table[refcount_table_index] = new_block; return -EAGAIN; ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block); if (ret < 0) { goto fail_block; BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); uint64_t refcount_block_clusters = 1 << (s->cluster_bits - REFCOUNT_SHIFT); uint64_t blocks_used = DIV_ROUND_UP(cluster_index, refcount_block_clusters); uint64_t table_size = next_refcount_table_size(s, blocks_used + 1); uint64_t last_table_size; uint64_t blocks_clusters; do { uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t)); blocks_clusters = 1 + ((table_clusters + refcount_block_clusters - 1) / refcount_block_clusters); uint64_t meta_clusters = table_clusters + blocks_clusters; last_table_size = table_size; table_size = next_refcount_table_size(s, blocks_used + ((meta_clusters + refcount_block_clusters - 1) / refcount_block_clusters)); } while (last_table_size != table_size); #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Grow refcount table %" PRId32 " => %" PRId64 "\n", s->refcount_table_size, table_size); #endif uint64_t meta_offset = (blocks_used * refcount_block_clusters) * s->cluster_size; uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size; uint16_t *new_blocks = g_malloc0(blocks_clusters * s->cluster_size); uint64_t *new_table = g_malloc0(table_size * sizeof(uint64_t)); memcpy(new_table, s->refcount_table, s->refcount_table_size * sizeof(uint64_t)); new_table[refcount_table_index] = new_block; int i; for (i = 0; i < blocks_clusters; i++) { new_table[blocks_used + i] = meta_offset + (i * s->cluster_size); uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t)); int block = 0; for (i = 0; i < table_clusters + blocks_clusters; i++) { new_blocks[block++] = cpu_to_be16(1); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS); ret = bdrv_pwrite_sync(bs->file, meta_offset, new_blocks, blocks_clusters * s->cluster_size); g_free(new_blocks); if (ret < 0) { goto fail_table; for(i = 0; i < table_size; i++) { cpu_to_be64s(&new_table[i]); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_TABLE); ret = bdrv_pwrite_sync(bs->file, table_offset, new_table, table_size * sizeof(uint64_t)); if (ret < 0) { goto fail_table; for(i = 0; i < table_size; i++) { be64_to_cpus(&new_table[i]); uint8_t data[12]; cpu_to_be64w((uint64_t*)data, table_offset); cpu_to_be32w((uint32_t*)(data + 8), table_clusters); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, refcount_table_offset), data, sizeof(data)); if (ret < 0) { goto fail_table; uint64_t old_table_offset = s->refcount_table_offset; uint64_t old_table_size = s->refcount_table_size; g_free(s->refcount_table); s->refcount_table = new_table; s->refcount_table_size = table_size; s->refcount_table_offset = table_offset; qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t), QCOW2_DISCARD_OTHER); ret = load_refcount_block(bs, new_block, (void**) refcount_block); if (ret < 0) { return ret; return -EAGAIN; fail_table: g_free(new_table); fail_block: if (*refcount_block != NULL) { qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block); return ret;
1threat
Androidx modules, android:attr/ttcIndex & android:attr/fontVariationSettings not found : <p>I'm migrating all my support/appcompat libraries to androidx. After all updates I can't build my project because of this error</p> <pre><code>:app:processDebugManifest UP-TO-DATE AGPBI: {"kind":"error","text":"error: resource android:attr/fontVariationSettings not found.","sources":[{"file":"/Users/xxx/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/7cae290a69b05f5ffc25283e26a7eb4a/res/values/values.xml","position":{"startLine":250,"startColumn":4,"startOffset":27058,"endColumn":68,"endOffset":27122}}],"original":"","tool":"AAPT"} AGPBI: {"kind":"error","text":"error: resource android:attr/ttcIndex not found.","sources":[{"file":"/Users/xxx/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/7cae290a69b05f5ffc25283e26a7eb4a/res/values/values.xml","position":{"startLine":250,"startColumn":4,"startOffset":27058,"endColumn":68,"endOffset":27122}}],"original":"","tool":"AAPT"} :app:processDebugResources </code></pre> <p>I tried to include one by one all my dependencies to identify which one is causing the issue. I was able to build only if I remove the Room library ¯\_(ツ)_/¯</p> <p><a href="https://developer.android.com/topic/libraries/architecture/adding-components#room" rel="noreferrer">https://developer.android.com/topic/libraries/architecture/adding-components#room</a></p> <p>It's weird because issue seems to come from styling-ish resources, but room is just a database library.</p> <p><strong>Is anyone have any ideas or solution to include room without breaking everything ?</strong></p> <p>===============================</p> <p>my conf:</p> <pre><code>compileSdkVersion 27 buildToolsVersion 27.0.3 defaultConfig { minSdkVersion 16 targetSdkVersion 27 } dependencies { // ROOM implementation ('androidx.room:room-runtime:' + androidxRoomVersion) implementation ('androidx.room:room-rxjava2:' + androidxRoomVersion) implementation ('androidx.room:room-guava:' + androidxRoomVersion) kapt ('androidx.room:room-compiler:' + androidxRoomVersion) } </code></pre> <p>with: androidxRoomVersion = 2.0.0-alpha1</p>
0debug
Share a URL that is sharable on Facebook on LinkedIN : I've worked on sharing dynamic content to be sharable on Facebok populating OpenGraph tags, I know LinkedIn uses OpenGraph tags. To my surprise when I've tried sharing the same url on LinkedIn nothing shows up. did anyone have such expericne? I;ve used https://www.linkedin.com/post-inspector/ But no luck, I get '503 Failure' exception. Is this the new way to share something on LinkedIn? (Below url) https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin I've tried inspecting the url with https://www.linkedin.com/post-inspector/ also https://developers.facebook.com/tools/debug/ Here in facebook I got response for all the og:tags
0debug
Uninitialized C structure field : <p>Is trying to access an uninitialized struct field in C considered undefined behavior?</p> <pre><code>struct s { int i; }; struct s a; printf("%d", a.i); </code></pre>
0debug
anguar 1.5 access data in http.get without scope : i'm new here. And that's a pleasure to be with you. I use Angular 1.5. I can't access to my data, from the http.get, out the http.get. Let me explain: I have my component: (function(){ 'use strict'; class myComponent { constructor( $http, $scope) { var self = this; self.test="this is a test"; $http.get(MYAPI).then(function(response){ self.MYDATA = response.data; console.log(self.MYDATA) }); console.log(self.test) console.log(self.MYDATA) } } angular.module('myApp') .component('myApp.test', { templateUrl: 'myTemplate.html', controller: myComponent, controllerAs:'vm', }); })(); The console.Log give me: *this is a test* --> for the test *undefined* --> out the http.get *Object {id: 1…}* --> in the http.get So i can't access to my data out the http.get and this is what i want. Have Anyone an idee? Thank you.
0debug
static inline int _find_pte (mmu_ctx_t *ctx, int is_64b, int h, int rw) { target_ulong base, pte0, pte1; int i, good = -1; int ret, r; ret = -1; base = ctx->pg_addr[h]; for (i = 0; i < 8; i++) { #if defined(TARGET_PPC64) if (is_64b) { pte0 = ldq_phys(base + (i * 16)); pte1 = ldq_phys(base + (i * 16) + 8); r = pte64_check(ctx, pte0, pte1, h, rw); } else #endif { pte0 = ldl_phys(base + (i * 8)); pte1 = ldl_phys(base + (i * 8) + 4); r = pte32_check(ctx, pte0, pte1, h, rw); } #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Load pte from 0x" ADDRX " => 0x" ADDRX " 0x" ADDRX " %d %d %d 0x" ADDRX "\n", base + (i * 8), pte0, pte1, (int)(pte0 >> 31), h, (int)((pte0 >> 6) & 1), ctx->ptem); } #endif switch (r) { case -3: return -1; case -2: ret = -2; good = i; break; case -1: default: break; case 0: ret = 0; good = i; goto done; } } if (good != -1) { done: #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "found PTE at addr 0x" PADDRX " prot=0x%01x " "ret=%d\n", ctx->raddr, ctx->prot, ret); } #endif pte1 = ctx->raddr; if (pte_update_flags(ctx, &pte1, ret, rw) == 1) { #if defined(TARGET_PPC64) if (is_64b) { stq_phys_notdirty(base + (good * 16) + 8, pte1); } else #endif { stl_phys_notdirty(base + (good * 8) + 4, pte1); } } } return ret; }
1threat
Django 1.9 - JSONField in Models : <p>I'm trying to set up a models file in Django 1.9 using the new JSONField. I have found examples using postgres but none with MySql. In the examples with postgres they do a </p> <pre><code>from django.contrib.postgres.fields import JSONField </code></pre> <p>How do I go about importing it for MySql? Thanks</p>
0debug
Is it safe to store a logged_in option as a SESSION? : <p>Is it safe to set the session <code>logged_in</code> as <code>true</code> if the login is correct? Will the user be able to edit this, or set their own session? </p>
0debug
Graphics lags after suspend. Ubuntu 16.04 NVIDIA GeForce GTX 950M : <p>After suspend ubuntu 16.04 this weird stuff on borders of every window. I have tried four of this drivers but it not helps. Drivers:<a href="https://i.stack.imgur.com/fYZjx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fYZjx.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/fYZjx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MOwOM.png" alt="enter image description here"></a></p>
0debug
Apply a function to each element of a pandas serie : I am trying to tokenize each sentence of my pandas serie. I try to do as I see in documentation, using apply, but didn't work: x.apply(nltk.word_tokenize) If I just use nltk.word_tokenize(x) didn't works too, because x is not a string. Someone have any idea?
0debug
what's the difference between google.appengine.ext.ndb and gcloud.datastore? : <p>ndb: (from google.appengine.ext import ndb)</p> <p>datastore: (from gcloud import datastore)</p> <p>What's the difference? I've seen both of them used, and hints they both save data to google datastore. Why are there two different implementations?</p>
0debug
Cannot implicitly convert System.xml.linq.xdocument to string[] : i have an x m l file which pretty much looks like this: " <?x m l version="1.0" en co n ding ="u t f-8"?> <Hangman><string>سال</string><string>کل</string><string>منٹ</string><string>بجے</string></Hangman> " i want to store it's contents to an Array of string string[] words = X Document. Load(Hangman Urdu. Properties. Resources.Hangman Urdu) " it's showing me an error :( i' v e added libraries like using system. x ml and x ml . l i n q
0debug
How do I hide the shadow under react-navigation headers? : <p>How do I hide the shadow under react-navigation headers?<br> They look like this.<br> <a href="https://i.stack.imgur.com/c763q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/c763q.png" alt="enter image description here"></a></p>
0debug
Contents are not being displayed from the databse because of if else misplaced : so this is the code to in which depending on the categories suppose a user clicks on a button of the category then all the events under that category have to be dislayed so this is what i have given as an code for that there are no errors or anything but the data is not being displayed on the page please suggest where i have gone wrong or where i have to change <?php global $row2; if(isset($_POST['category'])) { if($_POST['category']== 'Healthcare') { $query = "select *from event where category = 'Healthcare';"; $result=mysqli_query($conn,$query)or die(mysqli_error($conn)); while($row2= mysqli_fetch_array($result)) { ?> <div class="events events-full event-list"> <div class="container"> <div class="row"> <div class="col-md-9 col-sm-8"> <!--Blog Post Start--> <div class="blog-post"> <div class="post-thumb"> <div class="link-wrap"> <a href="#"><i class="fa fa-search"></i></a> <a href="#"><i class="fa fa-link"></i></a> </div> <img src="images/gallery/<?php echo $row2['event_image']?>" alt='user'></div> <div class="event-text"> <div class="event-counter"></div> <h4> <a href="#"><?php echo($row2['title']); ?></a> </h4> <p><?php echo($row2['descrption']); ?></p> <p><span class="glyphicon glyphicon-map-marker"><?php echo($row2['location']); ?></span></p> <p><span class="glyphicon glyphicon-grain"><?php echo($row2['organizer']); ?></span></p> <a class="nd" href=""> <form action="eventdetail.php" method="post"> <input type='hidden' value="<?php echo $row2['id']; ?>" name='id'/> <button type="submit" class="btn btn-primary" name="detail" value=”detail”>Event Detail</button> </div> </a> </div> </div> </form> <!--Blog Post End--> <?php } } else if($_POST['category']== 'Finance') { $query = "select *from event where category = 'Finance';"; $result=mysqli_query($conn,$query)or die(mysqli_error($conn)); while($row2= mysqli_fetch_array($result)) { ?> <div class="events events-full event-list"> <div class="container"> <div class="row"> <div class="col-md-9 col-sm-8"> <!--Blog Post Start--> <div class="blog-post"> <div class="post-thumb"> <div class="link-wrap"> <a href="#"><i class="fa fa-search"></i></a> <a href="#"><i class="fa fa-link"></i></a> </div> <img src="images/gallery/<?php echo $row2['event_image']?>" alt='user'></div> <div class="event-text"> <div class="event-counter"></div> <h4> <a href="#"><?php echo($row2['title']); ?></a> </h4> <p><?php echo($row2['descrption']); ?></p> <p><span class="glyphicon glyphicon-map-marker"><?php echo($row2['location']); ?></span></p> <p><span class="glyphicon glyphicon-grain"><?php echo($row2['organizer']); ?></span></p> <a class="nd" href=""> <form action="eventdetail.php" method="post"> <input type='hidden' value="<?php echo $row2['id']; ?>" name='id'/> <button type="submit" class="btn btn-primary" name="detail" value=”detail”>Event Detail</button> </div> </a> </div> </div> </form> <?php } } } else { global $row2; $query = "select *from event;" ; $result=mysqli_query($conn,$query)or die(mysqli_error($conn)); while($row2= mysqli_fetch_array($result)) { ?> <div class="events events-full event-list"> <div class="container"> <div class="row"> <div class="col-md-9 col-sm-8"> <!--Blog Post Start--> <div class="blog-post"> <div class="post-thumb"> <div class="link-wrap"> <a href="#"><i class="fa fa-search"></i></a> <a href="#"><i class="fa fa-link"></i></a> </div> <img src="images/gallery/<?php echo $row2['event_image']?>" alt='user'></div> <div class="event-text"> <div class="event-counter"></div> <h4> <a href="#"><?php echo($row2['title']); ?></a> </h4> <p><?php echo($row2['descrption']); ?></p> <p><span class="glyphicon glyphicon-map-marker"><?php echo($row2['location']); ?></span></p> <p><span class="glyphicon glyphicon-grain"><?php echo($row2['organizer']); ?></span></p> <a class="nd" href=""> <form action="eventdetail.php" method="post"> <input type='hidden' value="<?php echo $row2['id']; ?>" name='id'/> <button type="submit" class="btn btn-primary" name="detail" value=”detail”>Event Detail</button> </div> </a> </div> </div> </form> <!--Blog Post End--> <?php } } ?>
0debug
i have json object and i want to fetch it by ajax call ,i wrote ajax but im getting error : i have one json object and i want to fetch it by calling ajax [ { "color":"black", "productid":"1", "price":"1000" }, { "color":"blue", "productid":"2", "price":"2000" }, { "color":"green", "productid":"3", "price":"3000" }, { "color":"grey", "productid":"4", "price":"4000" }, { "color":"orange", "productid":"5", "price":"5000" }, { "color":"purple", "productid":"6", "price":"6000" }, { "color":"red", "productid":"7", "price":"7000" }, { "color":"violet", "productid":"8", "price":"8000" }, { "color":"white", "productid":"9", "price":"9000" }, { "color":"yellow", "productid":"10", "price":"10000" }, ] this is json file and i wrote ajax as below for this $.ajax({ url: 'products.json', dataType: 'json', data: 'data', success: function(data, status, xhr) { alert(data); }, error: function(xhr, status, error) { alert(status); } }); anyone can help me please ,thank you in advace
0debug
woocommerce plugin to add database content to product page : <p>my problem is that i want to build a price comparison site based on woocommerceand that is exactly my problem. i want to develop a plugin, which makes it possible to post a database entry to my product page. i tried to add the content with normal sql query with a shortcode, but the content was shown on top of the site. the content should be loaded by the SKU number. by adding the php functions with shortcode, the content will be shown on top of the site..</p> <p>do you have any solutions how i can display custom database content to my product description?</p>
0debug
av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { int i; int usesVFilter, usesHFilter; int unscaled; SwsFilter dummyFilter = { NULL, NULL, NULL, NULL }; int srcW = c->srcW; int srcH = c->srcH; int dstW = c->dstW; int dstH = c->dstH; int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 16, 16); int dst_stride_px = dst_stride >> 1; int flags, cpu_flags; enum PixelFormat srcFormat = c->srcFormat; enum PixelFormat dstFormat = c->dstFormat; cpu_flags = av_get_cpu_flags(); flags = c->flags; emms_c(); if (!rgb15to16) sws_rgb2rgb_init(); unscaled = (srcW == dstW && srcH == dstH); if (!sws_isSupportedInput(srcFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", sws_format_name(srcFormat)); return AVERROR(EINVAL); } if (!sws_isSupportedOutput(dstFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", sws_format_name(dstFormat)); return AVERROR(EINVAL); } i = flags & (SWS_POINT | SWS_AREA | SWS_BILINEAR | SWS_FAST_BILINEAR | SWS_BICUBIC | SWS_X | SWS_GAUSS | SWS_LANCZOS | SWS_SINC | SWS_SPLINE | SWS_BICUBLIN); if (!i || (i & (i - 1))) { av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); return AVERROR(EINVAL); } if (srcW < 4 || srcH < 1 || dstW < 8 || dstH < 1) { av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n", srcW, srcH, dstW, dstH); return AVERROR(EINVAL); } if (!dstFilter) dstFilter = &dummyFilter; if (!srcFilter) srcFilter = &dummyFilter; c->lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW; c->lumYInc = (((int64_t)srcH << 16) + (dstH >> 1)) / dstH; c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]); c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]); c->vRounder = 4 * 0x0001000100010001ULL; usesVFilter = (srcFilter->lumV && srcFilter->lumV->length > 1) || (srcFilter->chrV && srcFilter->chrV->length > 1) || (dstFilter->lumV && dstFilter->lumV->length > 1) || (dstFilter->chrV && dstFilter->chrV->length > 1); usesHFilter = (srcFilter->lumH && srcFilter->lumH->length > 1) || (srcFilter->chrH && srcFilter->chrH->length > 1) || (dstFilter->lumH && dstFilter->lumH->length > 1) || (dstFilter->chrH && dstFilter->chrH->length > 1); getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat); getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat); if (flags & SWS_FULL_CHR_H_INT && isAnyRGB(dstFormat) && dstFormat != PIX_FMT_RGBA && dstFormat != PIX_FMT_ARGB && dstFormat != PIX_FMT_BGRA && dstFormat != PIX_FMT_ABGR && dstFormat != PIX_FMT_RGB24 && dstFormat != PIX_FMT_BGR24) { av_log(c, AV_LOG_ERROR, "full chroma interpolation for destination format '%s' not yet implemented\n", sws_format_name(dstFormat)); flags &= ~SWS_FULL_CHR_H_INT; c->flags = flags; } if (isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT)) c->chrDstHSubSample = 1; c->vChrDrop = (flags & SWS_SRC_V_CHR_DROP_MASK) >> SWS_SRC_V_CHR_DROP_SHIFT; c->chrSrcVSubSample += c->vChrDrop; if (isAnyRGB(srcFormat) && !(flags & SWS_FULL_CHR_H_INP) && srcFormat != PIX_FMT_RGB8 && srcFormat != PIX_FMT_BGR8 && srcFormat != PIX_FMT_RGB4 && srcFormat != PIX_FMT_BGR4 && srcFormat != PIX_FMT_RGB4_BYTE && srcFormat != PIX_FMT_BGR4_BYTE && ((dstW >> c->chrDstHSubSample) <= (srcW >> 1) || (flags & SWS_FAST_BILINEAR))) c->chrSrcHSubSample = 1; c->chrSrcW = -((-srcW) >> c->chrSrcHSubSample); c->chrSrcH = -((-srcH) >> c->chrSrcVSubSample); c->chrDstW = -((-dstW) >> c->chrDstHSubSample); c->chrDstH = -((-dstH) >> c->chrDstVSubSample); if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { ff_get_unscaled_swscale(c); if (c->swScale) { if (flags & SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); return 0; } } c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; if (c->dstBpc < 8) c->dstBpc = 8; if (c->dstBpc == 16) dst_stride <<= 1; FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, (FFALIGN(srcW, 16) * 2 * FFALIGN(c->srcBpc, 8) >> 3) + 16, fail); if (HAVE_MMXEXT && HAVE_INLINE_ASM && cpu_flags & AV_CPU_FLAG_MMXEXT && c->srcBpc == 8 && c->dstBpc <= 10) { c->canMMX2BeUsed = (dstW >= srcW && (dstW & 31) == 0 && (srcW & 15) == 0) ? 1 : 0; if (!c->canMMX2BeUsed && dstW >= srcW && (srcW & 15) == 0 && (flags & SWS_FAST_BILINEAR)) { if (flags & SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); } if (usesHFilter) c->canMMX2BeUsed = 0; } else c->canMMX2BeUsed = 0; c->chrXInc = (((int64_t)c->chrSrcW << 16) + (c->chrDstW >> 1)) / c->chrDstW; c->chrYInc = (((int64_t)c->chrSrcH << 16) + (c->chrDstH >> 1)) / c->chrDstH; if (flags & SWS_FAST_BILINEAR) { if (c->canMMX2BeUsed) { c->lumXInc += 20; c->chrXInc += 20; } else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) { c->lumXInc = ((int64_t)(srcW - 2) << 16) / (dstW - 2) - 20; c->chrXInc = ((int64_t)(c->chrSrcW - 2) << 16) / (c->chrDstW - 2) - 20; } } { #if HAVE_MMXEXT_INLINE if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { c->lumMmx2FilterCodeSize = initMMX2HScaler(dstW, c->lumXInc, NULL, NULL, NULL, 8); c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4); #ifdef MAP_ANONYMOUS c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif HAVE_VIRTUALALLOC c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize); c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize); #endif if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode) return AVERROR(ENOMEM); FF_ALLOCZ_OR_GOTO(c, c->hLumFilter, (dstW / 8 + 8) * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilter, (c->chrDstW / 4 + 8) * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW / 2 / 8 + 8) * sizeof(int32_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW / 2 / 4 + 8) * sizeof(int32_t), fail); initMMX2HScaler(dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8); initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4); #ifdef MAP_ANONYMOUS mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ); mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ); #endif } else #endif { const int filterAlign = (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW, dstW, filterAlign, 1 << 14, (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumH, dstFilter->lumH, c->param, 1) < 0) goto fail; if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, c->chrSrcW, c->chrDstW, filterAlign, 1 << 14, (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrH, dstFilter->chrH, c->param, 1) < 0) goto fail; } } { const int filterAlign = (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH, dstH, filterAlign, (1 << 12), (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumV, dstFilter->lumV, c->param, 0) < 0) goto fail; if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, c->chrSrcH, c->chrDstH, filterAlign, (1 << 12), (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrV, dstFilter->chrV, c->param, 0) < 0) goto fail; #if HAVE_ALTIVEC FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof(vector signed short) * c->vLumFilterSize * c->dstH, fail); FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof(vector signed short) * c->vChrFilterSize * c->chrDstH, fail); for (i = 0; i < c->vLumFilterSize * c->dstH; i++) { int j; short *p = (short *)&c->vYCoeffsBank[i]; for (j = 0; j < 8; j++) p[j] = c->vLumFilter[i]; } for (i = 0; i < c->vChrFilterSize * c->chrDstH; i++) { int j; short *p = (short *)&c->vCCoeffsBank[i]; for (j = 0; j < 8; j++) p[j] = c->vChrFilter[i]; } #endif } c->vLumBufSize = c->vLumFilterSize; c->vChrBufSize = c->vChrFilterSize; for (i = 0; i < dstH; i++) { int chrI = (int64_t)i * c->chrDstH / dstH; int nextSlice = FFMAX(c->vLumFilterPos[i] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1) << c->chrSrcVSubSample)); nextSlice >>= c->chrSrcVSubSample; nextSlice <<= c->chrSrcVSubSample; if (c->vLumFilterPos[i] + c->vLumBufSize < nextSlice) c->vLumBufSize = nextSlice - c->vLumFilterPos[i]; if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice >> c->chrSrcVSubSample)) c->vChrBufSize = (nextSlice >> c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; } FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail); FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail); FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail); if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail); for (i = 0; i < c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i + c->vLumBufSize], dst_stride + 16, fail); c->lumPixBuf[i] = c->lumPixBuf[i + c->vLumBufSize]; } c->uv_off_px = dst_stride_px + 64 / (c->dstBpc & ~7); c->uv_off_byte = dst_stride + 16; for (i = 0; i < c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i + c->vChrBufSize], dst_stride * 2 + 32, fail); c->chrUPixBuf[i] = c->chrUPixBuf[i + c->vChrBufSize]; c->chrVPixBuf[i] = c->chrVPixBuf[i + c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8; } if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) for (i = 0; i < c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i + c->vLumBufSize], dst_stride + 16, fail); c->alpPixBuf[i] = c->alpPixBuf[i + c->vLumBufSize]; } for (i = 0; i < c->vChrBufSize; i++) memset(c->chrUPixBuf[i], 64, dst_stride * 2 + 1); assert(c->chrDstH <= dstH); if (flags & SWS_PRINT_INFO) { if (flags & SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, "); else if (flags & SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, "); else if (flags & SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, "); else if (flags & SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, "); else if (flags & SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, "); else if (flags & SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, "); else if (flags & SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, "); else if (flags & SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, "); else if (flags & SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, "); else if (flags & SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, "); else if (flags & SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, "); else av_log(c, AV_LOG_INFO, "ehh flags invalid?! "); av_log(c, AV_LOG_INFO, "from %s to %s%s ", sws_format_name(srcFormat), #ifdef DITHER1XBPP dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 || dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE || dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "", #else "", #endif sws_format_name(dstFormat)); if (HAVE_MMXEXT && cpu_flags & AV_CPU_FLAG_MMXEXT) av_log(c, AV_LOG_INFO, "using MMX2\n"); else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n"); else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n"); else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n"); else av_log(c, AV_LOG_INFO, "using C\n"); av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } c->swScale = ff_getSwsFunc(c); return 0; fail: return -1; }
1threat
SocketAddress *socket_remote_address(int fd, Error **errp) { struct sockaddr_storage ss; socklen_t sslen = sizeof(ss); if (getpeername(fd, (struct sockaddr *)&ss, &sslen) < 0) { error_setg_errno(errp, errno, "%s", "Unable to query remote socket address"); return NULL; } return socket_sockaddr_to_address(&ss, sslen, errp); }
1threat
Hi! Kindly refer to the image attached : I am unable to run this javascript code in terminal even though the code is correct! I am using visual studio. and it runs perfectly when i click on run code but doesn't run in terminal [error][1] [1]: https://i.stack.imgur.com/VSPPG.jpg
0debug
Delphi - How to correctly register a graphic class since XE8? : <p>I'm writing a Delphi package, which provides a new custom TGraphic object, allowing to read a new image format in VCL components like TImage.</p> <p>I originally developed this package with RAD Studio XE7, and it worked well. However I migrated recently to a newer RAD Studio compiler version, and although my package continues to work properly on that new version, I noticed a strange bug that never appeared before. </p> <p>I have a form with several components, some of them are TImage components. Immediately after opening the IDE, the first time I open my project in design time, all the TImage components containing my custom TGraphic component loose their content. If I close then reopen the project, the images reappear, and the bug no longer happen until I close and reopen my IDE.</p> <p>I dug in my code to understand what may cause the issue. To register my custom TGraphic component, I use the class initialization section, in which I wrote the following code:</p> <pre class="lang-pascal prettyprint-override"><code>initialization begin Vcl.Graphics.TPicture.RegisterFileFormat('svg', 'Scalable Vector Graphics', TWSVGGraphic); end; </code></pre> <p>However I found that, since the XE8 compiler version, the TImage constructor is called before my initialization section, causing thus apparently the above mentioned issue. All the compiler versions since XE8 are affected, but this bug never happened on XE7 or earlier. So something changed since XE8.</p> <p>Here are my questions:</p> <ul> <li>Is the way I use for register my custom graphic class correct?</li> <li>If not, what is the correct way to do that?</li> <li>As something seems different since XE8, what it the new correct manner to register my graphic component?</li> <li>Did anyone else faced the same issue? How he resolved it?</li> <li>Is this may be a new RAD Studio bug, or the issue is rather on my side?</li> </ul>
0debug
How to rate-limit upload from docker container? : <p>I need to prevent a long-running multiterabyte upload from eating all of my network's bandwidth, but I can only constrain its bandwidth usage on a process level (meaning that slowing down the whole machine's network interface or slowing down this user's network traffic won't work). Fortunately, the upload is containerized with Docker. What can I do to slow down the docker container's outbound traffic?</p>
0debug
Using XPATH to select specific input element when text is on another child's grandchild : [Screenshot link][1] [1]: https://i.stack.imgur.com/zoC7T.png I'm trying to target this specific input element while using the textfile name "timmy.txt". I'm not entirely sure why `//div//a[contains(text(), "timmy.txt")]//input` does not work in this situation. Can someone please assist me with why this xpath doesn't work and also provide a solution I can use that will allow me to target this input element by using the textfile's name (ie: timmy.txt)?
0debug
static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) { union { float f; uint32_t u; } value; int sign; int exp = s->float_max_exp; if (s->got_extra_bits) { const int max_bits = 1 + 23 + 8 + 1; const int left_bits = get_bits_left(&s->gb_extra_bits); if (left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits) return 0.0; } if (S) { S <<= s->float_shift; sign = S < 0; if (sign) S = -S; if (S >= 0x1000000) { if (s->got_extra_bits && get_bits1(&s->gb_extra_bits)) S = get_bits(&s->gb_extra_bits, 23); else S = 0; exp = 255; } else if (exp) { int shift = 23 - av_log2(S); exp = s->float_max_exp; if (exp <= shift) shift = --exp; exp -= shift; if (shift) { S <<= shift; if ((s->float_flag & WV_FLT_SHIFT_ONES) || (s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SAME) && get_bits1(&s->gb_extra_bits))) { S |= (1 << shift) - 1; } else if (s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SENT)) { S |= get_bits(&s->gb_extra_bits, shift); } } } else { exp = s->float_max_exp; } S &= 0x7fffff; } else { sign = 0; exp = 0; if (s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)) { if (get_bits1(&s->gb_extra_bits)) { S = get_bits(&s->gb_extra_bits, 23); if (s->float_max_exp >= 25) exp = get_bits(&s->gb_extra_bits, 8); sign = get_bits1(&s->gb_extra_bits); } else { if (s->float_flag & WV_FLT_ZERO_SIGN) sign = get_bits1(&s->gb_extra_bits); } } } *crc = *crc * 27 + S * 9 + exp * 3 + sign; value.u = (sign << 31) | (exp << 23) | S; return value.f; }
1threat
BlockBackend *blk_new_open(const char *filename, const char *reference, QDict *options, int flags, Error **errp) { BlockBackend *blk; BlockDriverState *bs; uint64_t perm; perm = BLK_PERM_CONSISTENT_READ; if (flags & BDRV_O_RDWR) { perm |= BLK_PERM_WRITE; } if (flags & BDRV_O_RESIZE) { perm |= BLK_PERM_RESIZE; } blk = blk_new(perm, BLK_PERM_ALL); bs = bdrv_open(filename, reference, options, flags, errp); if (!bs) { blk_unref(blk); return NULL; } blk->root = bdrv_root_attach_child(bs, "root", &child_root, perm, BLK_PERM_ALL, blk, &error_abort); return blk; }
1threat
static int send_palette_rect(VncState *vs, int w, int h, struct QDict *palette) { int stream = 2; int level = tight_conf[vs->tight_compression].idx_zlib_level; int colors; size_t bytes; colors = qdict_size(palette); vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4); vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE); vnc_write_u8(vs, colors - 1); switch(vs->clientds.pf.bytes_per_pixel) { case 4: { size_t old_offset, offset; uint32_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; old_offset = vs->output.offset; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); if (vs->tight_pixel24) { tight_pack24(vs, vs->output.buffer + old_offset, colors, &offset); vs->output.offset = old_offset + offset; } tight_encode_indexed_rect32(vs->tight.buffer, w * h, palette); break; } case 2: { uint16_t header[qdict_size(palette)]; struct palette_cb_priv priv = { vs, (uint8_t *)header }; qdict_iter(palette, write_palette, &priv); vnc_write(vs, header, sizeof(header)); tight_encode_indexed_rect16(vs->tight.buffer, w * h, palette); break; } default: return -1; break; } bytes = w * h; vs->tight.offset = bytes; bytes = tight_compress_data(vs, stream, bytes, level, Z_DEFAULT_STRATEGY); return (bytes >= 0); }
1threat
rmarkdown error "attempt to use zero-length variable name" : <p>When i generate a new rmarkdown file (or open existing rmarkdown-files) and try to run a rmarkdown chunk, i get this error: "Error: attempt to use zero-length variable name". I have Win10 and did a fresh install of R and Rstudio yesterday. What did i miss? Where does this error come from?</p> <pre><code>```{r cars} summary(cars) ``` </code></pre> <blockquote> <p>```{r cars} Error: attempt to use zero-length variable name</p> </blockquote> <p><a href="https://i.stack.imgur.com/FqebP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FqebP.png" alt="enter image description here"></a></p>
0debug
static inline int asym_quant(int c, int e, int qbits) { int m; c = (((c << e) >> (24 - qbits)) + 1) >> 1; m = (1 << (qbits-1)); if (c >= m) c = m - 1; av_assert2(c >= -m); return c; }
1threat
How to check anaconda's version on mac? : <p>I installed <code>anaconda</code> a while ago, and I want to know if I need to re-install it to catch up the new updates.</p> <p>However, i don't know how to check the current version of <code>anaconda</code></p> <p>In command line, I type <code>anaconda -V</code> it gives</p> <pre><code>anaconda Command line client (version 1.2.2) </code></pre> <p>For <code>anaconda -v</code> it returns</p> <pre><code>anaconda: error: too few arguments </code></pre>
0debug
template and derived class definition : error: 'myClass' is not a class, namespace, or enumeration : <p>I'm trying to learn templates in C++ and I have the following code :</p> <pre><code>#include &lt;stack&gt; template&lt;typename T&gt; class myClass : public std::stack&lt;T&gt;{ public: myClass(void); myClass(myClass const &amp; src); virtual ~myClass(void); myClass &amp; operator=(myClass const &amp; rhs); }; template&lt;typename T&gt; myClass::myClass(void) : std::stack&lt;T&gt;(){ } </code></pre> <p>But I can't figure out why I get the following when I try to compile :</p> <pre><code>test.cpp:17:1: error: 'myClass' is not a class, namespace, or enumeration myClass::myClass(void) : std::stack&lt;T&gt;(){ ^ test.cpp:8:9: note: 'myClass' declared here class myClass : public std::stack&lt;T&gt;{ ^ 1 error generated. </code></pre> <p>It looks like the definition of the function causes the error, but I don't know why I get this error, it looks OK to me (even if I guess it's not really OK), just a syntax error perhaps?..</p> <p>I compile with <strong>clang++ -Wall -Werror -Wextra -c</strong>.</p> <p>What could cause this error?</p>
0debug
static void via_ide_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = vt82c686b_ide_initfn; k->exit = vt82c686b_ide_exitfn; k->vendor_id = PCI_VENDOR_ID_VIA; k->device_id = PCI_DEVICE_ID_VIA_IDE; k->revision = 0x06; k->class_id = PCI_CLASS_STORAGE_IDE; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->no_user = 1; }
1threat
void tcg_profile_snapshot(TCGProfile *prof, bool counters, bool table) { unsigned int i; for (i = 0; i < n_tcg_ctxs; i++) { const TCGProfile *orig = &tcg_ctxs[i]->prof; if (counters) { PROF_ADD(prof, orig, tb_count1); PROF_ADD(prof, orig, tb_count); PROF_ADD(prof, orig, op_count); PROF_MAX(prof, orig, op_count_max); PROF_ADD(prof, orig, temp_count); PROF_MAX(prof, orig, temp_count_max); PROF_ADD(prof, orig, del_op_count); PROF_ADD(prof, orig, code_in_len); PROF_ADD(prof, orig, code_out_len); PROF_ADD(prof, orig, search_out_len); PROF_ADD(prof, orig, interm_time); PROF_ADD(prof, orig, code_time); PROF_ADD(prof, orig, la_time); PROF_ADD(prof, orig, opt_time); PROF_ADD(prof, orig, restore_count); PROF_ADD(prof, orig, restore_time); } if (table) { int i; for (i = 0; i < NB_OPS; i++) { PROF_ADD(prof, orig, table_op_count[i]); } } } }
1threat
static int msix_is_masked(PCIDevice *dev, int vector) { unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL; return dev->msix_function_masked || dev->msix_table_page[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT; }
1threat
static int decode_slice_chroma(AVCodecContext *avctx, SliceContext *slice, uint16_t *dst, int dst_stride, const uint8_t *buf, unsigned buf_size, const int16_t *qmat, int log2_blocks_per_mb) { ProresContext *ctx = avctx->priv_data; LOCAL_ALIGNED_16(int16_t, blocks, [8*4*64]); int16_t *block; GetBitContext gb; int i, j, blocks_per_slice = slice->mb_count << log2_blocks_per_mb; int ret; for (i = 0; i < blocks_per_slice; i++) ctx->bdsp.clear_block(blocks+(i<<6)); init_get_bits(&gb, buf, buf_size << 3); decode_dc_coeffs(&gb, blocks, blocks_per_slice); if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0) return ret; block = blocks; for (i = 0; i < slice->mb_count; i++) { for (j = 0; j < log2_blocks_per_mb; j++) { ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat); ctx->prodsp.idct_put(dst+4*dst_stride, dst_stride, block+(1<<6), qmat); block += 2*64; dst += 8; } } return 0; }
1threat
static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx) { uint16_t num_heads = vring_avail_idx(vq) - idx; if (num_heads > vq->vring.num) { error_report("Guest moved used index from %u to %u", idx, vring_avail_idx(vq)); exit(1); return num_heads;
1threat
umur = thnsaiki - thnlahir TypeError: unsupported operand type(s) for -: 'int' and 'str' : <pre><code>from datetime import datetime import time print ("######## $$ ########") print ("# #") print ("# WELCOME. #") print ("# #") print ("####################") print ("") #input your name print ("Halo ...! ^_^") name = input("Silahkan masukkan nama Anda : ") print ("") print ("Halo, "+name) print ("") #showing today date saiki = datetime.now() tglsaiki = saiki.day blnsaiki = saiki.month thnsaiki = saiki.year print ("Sekarang tanggal : ") print ("{}/{}/{}".format(tglsaiki, blnsaiki, thnsaiki)) #input Date of Birth from user print ("") print ("Kami memerlukan informasi tanggal lahirmu!") tgllahir = input("Masukkan tanggal lahir : ") blnlahir = input("Masukkan bulan lahir (format angka) : ") thnlahir = input("Masukkan tahun lahir : ") print ("") print ("Tanggal lahir ") , name , ":" print ("{}/{}/{}".format(tgllahir, blnlahir, thnlahir)) print ("") #Can or not make a driver's license SIM by age/umur umur = thnsaiki - thnlahir if umur &gt;=17: #menggunakan pengurangan tahunnya aku print ("Selamat, Anda dapat membuat SIM") elif umur &lt;=17: print ("Mohon maaf, Anda belum dapat membuat SIM") #delay setelah selesai, biar gk auto close time.sleep(5) #delay 5seconds </code></pre> <p>Im created program that receives input in the form of date of birth with format dd / mm / yyyy. If the age of 17 years or more then the output is a message of 'You can create a SIM'. But if the age is less than 17 years old then the outgoing message 'Sorry, you are not old enough to create a driver'. can anyone help? im new in python thanks</p>
0debug
int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz) { uint8_t *compressed_data = NULL; uint8_t *data = NULL; gsize len; ssize_t bytes; int ret = -1; if (!g_file_get_contents(filename, (char **) &compressed_data, &len, NULL)) { goto out; } if (len < 2 || compressed_data[0] != 0x1f || compressed_data[1] != 0x8b) { goto out; } if (max_sz > LOAD_IMAGE_MAX_GUNZIP_BYTES) { max_sz = LOAD_IMAGE_MAX_GUNZIP_BYTES; } data = g_malloc(max_sz); bytes = gunzip(data, max_sz, compressed_data, len); if (bytes < 0) { fprintf(stderr, "%s: unable to decompress gzipped kernel file\n", filename); goto out; } rom_add_blob_fixed(filename, data, bytes, addr); ret = bytes; out: g_free(compressed_data); g_free(data); return ret; }
1threat
What does it mean for a Service to be of type NodePort, and have both port and targetPort specified? : <p>I am becoming more familiar with Kubernetes by the day, but am still at a basic level. I am also not a networking guy.</p> <p>I am staring at the following snippet of a Service definition, and I can't form the right picture in my mind of what is being declared:</p> <pre><code>spec: type: NodePort ports: - port: 27018 targetPort: 27017 protocol: TCP </code></pre> <p>Referencing the <a href="https://kubernetes.io/docs/resources-reference/v1.5/#serviceport-v1" rel="noreferrer">ServicePort documentation</a>, which reads in part:</p> <pre><code>nodePort The port on each node on which this service is exposed when type=NodePort or LoadBalancer. Usually integer assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one. More info: http://kubernetes.io/docs/user-guide/services#type--nodeport port The port that will be exposed by this service. integer targetPort Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 IntOrString to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: http://kubernetes.io/docs/user-guide/services#defining-a-service </code></pre> <p>My understanding is that the port that a client outside of the cluster will "see" will be the dynamically assigned one in the range of <code>30000</code>-<code>32767</code>, as defined <a href="https://kubernetes.io/docs/user-guide/services/#type-nodeport" rel="noreferrer">in the documentation</a>. This will, using some black magic that I do not yet understand, flow to the <code>targetPort</code> on a given node (<code>27017</code> in this case).</p> <p>So what is the <code>port</code> used for here? </p>
0debug
Not work Convert Number into Word in C# window : I try to Convert Number into Word in C# windows. I apply Code is ::- namespace Num2Text { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { textBox2.Text = changeToWords(textBox1.Text, false); } public String changeNumericToWords(double numb) { String num = numb.ToString(); return changeToWords(num, false); } public String changeCurrencyToWords(String numb) { return changeToWords(numb, true); } public String changeNumericToWords(String numb) { return changeToWords(numb, false); } public String changeCurrencyToWords(double numb) { return changeToWords(numb.ToString(), true); } private String changeToWords(String numb, bool isCurrency) { String val = "", wholeNo = numb, points = "", andStr = "", pointStr = ""; String endStr = (isCurrency) ? ("Only") : ("Only"); //-- Only-- try { int decimalPlace = numb.IndexOf("."); if (decimalPlace > 0) { wholeNo = numb.Substring(0, decimalPlace); points = numb.Substring(decimalPlace + 1); if (Convert.ToInt32(points) > 0) { andStr = (isCurrency) ? ("and") : ("Point");// just to separate whole numbers from points/cents endStr = (isCurrency) ? ("Cents " + endStr) : ("Only"); //--Paisa Only-- pointStr = translateCents(points); } } val = String.Format("{0} {1}{2} {3}", translateWholeNumber(wholeNo).Trim(), andStr, pointStr, endStr); } catch { ;} return val; } private String translateWholeNumber(String number) { string word = " "; //--Taka-- try { bool beginsZero = false;//tests for 0XX bool isDone = false;//test if already translated double dblAmt = (Convert.ToDouble(number)); //if ((dblAmt > 0) && number.StartsWith("0")) if (dblAmt > 0) {//test for zero or digit zero in a nuemric beginsZero = number.StartsWith("0"); int numDigits = number.Length; int pos = 0;//store digit grouping String place = " ";//digit grouping name:hundres,thousand,etc... switch (numDigits) { case 1://ones' range word = ones(number); isDone = true; break; case 2://tens' range word = tens(number); isDone = true; break; case 3://hundreds' range pos = (numDigits % 3) + 1; place = " Hundred "; break; case 4://thousands' range case 5: case 6: pos = (numDigits % 4) + 1;// place = " Thousand "; break; case 7://millions' range case 8: case 9: pos = (numDigits % 7) + 1; place = " Million "; break; case 10://Billions's range case 11: case 12: pos = (numDigits % 10) + 1; place = " Billion "; break; //add extra case options for anything above Billion... default: isDone = true; break; } if (!isDone) {//if transalation is not done, continue...(Recursion comes in now!!) word = translateWholeNumber(number.Substring(0, pos)) + place + translateWholeNumber(number.Substring(pos)); //check for trailing zeros if (beginsZero) word = " " + word.Trim();//-----"and"--- } //ignore digit grouping names if (word.Trim().Equals(place.Trim())) word = ""; } } catch { ;} return word.Trim(); } private String tens(String digit) { int digt = Convert.ToInt32(digit); String name = null; switch (digt) { case 10: name = "Ten"; break; case 11: name = "Eleven"; break; case 12: name = "Twelve"; break; case 13: name = "Thirteen"; break; case 14: name = "Fourteen"; break; case 15: name = "Fifteen"; break; case 16: name = "Sixteen"; break; case 17: name = "Seventeen"; break; case 18: name = "Eighteen"; break; case 19: name = "Nineteen"; break; case 20: name = "Twenty"; break; case 30: name = "Thirty"; break; case 40: name = "Fourty"; break; case 50: name = "Fifty"; break; case 60: name = "Sixty"; break; case 70: name = "Seventy"; break; case 80: name = "Eighty"; break; case 90: name = "Ninety"; break; default: if (digt > 0) { name = tens(digit.Substring(0, 1) + "0") + " " + ones(digit.Substring(1)); } break; } return name; } private String ones(String digit) { int digt = Convert.ToInt32(digit); String name = ""; switch (digt) { case 1: name = "One"; break; case 2: name = "Two"; break; case 3: name = "Three"; break; case 4: name = "Four"; break; case 5: name = "Five"; break; case 6: name = "Six"; break; case 7: name = "Seven"; break; case 8: name = "Eight"; break; case 9: name = "Nine"; break; } return name; } private String translateCents(String cents) { String cts = "", digit = "", engOne = ""; for (int i = 0; i < cents.Length; i++) { digit = cents[i].ToString(); if (digit.Equals("0")) { engOne = "Zero"; } else { engOne = ones(digit); } cts += " " + engOne; } return cts; } [enter image description here][1] It working to convert (from One to Billion). But there is a error ,when Hundred Position is null. <<<Like as Skin Shot >>> [1]: https://i.stack.imgur.com/AT8j0.jpg what is the right code ?
0debug
static void r2d_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; SuperHCPU *cpu; CPUSH4State *env; ResetData *reset_info; struct SH7750State *s; MemoryRegion *sdram = g_new(MemoryRegion, 1); qemu_irq *irq; DriveInfo *dinfo; int i; DeviceState *dev; SysBusDevice *busdev; MemoryRegion *address_space_mem = get_system_memory(); PCIBus *pci_bus; if (cpu_model == NULL) { cpu_model = "SH7751R"; } cpu = cpu_sh4_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; reset_info = g_malloc0(sizeof(ResetData)); reset_info->cpu = cpu; reset_info->vector = env->pc; qemu_register_reset(main_cpu_reset, reset_info); memory_region_init_ram(sdram, NULL, "r2d.sdram", SDRAM_SIZE, &error_abort); vmstate_register_ram_global(sdram); memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram); s = sh7750_init(cpu, address_space_mem); irq = r2d_fpga_init(address_space_mem, 0x04000000, sh7750_irl(s)); dev = qdev_create(NULL, "sh_pci"); busdev = SYS_BUS_DEVICE(dev); qdev_init_nofail(dev); pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); sysbus_mmio_map(busdev, 0, P4ADDR(0x1e200000)); sysbus_mmio_map(busdev, 1, A7ADDR(0x1e200000)); sysbus_connect_irq(busdev, 0, irq[PCI_INTA]); sysbus_connect_irq(busdev, 1, irq[PCI_INTB]); sysbus_connect_irq(busdev, 2, irq[PCI_INTC]); sysbus_connect_irq(busdev, 3, irq[PCI_INTD]); sm501_init(address_space_mem, 0x10000000, SM501_VRAM_SIZE, irq[SM501], serial_hds[2]); dinfo = drive_get(IF_IDE, 0, 0); dev = qdev_create(NULL, "mmio-ide"); busdev = SYS_BUS_DEVICE(dev); sysbus_connect_irq(busdev, 0, irq[CF_IDE]); qdev_prop_set_uint32(dev, "shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(busdev, 0, 0x14001000); sysbus_mmio_map(busdev, 1, 0x1400080c); mmio_ide_init_drives(dev, dinfo, NULL); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (16 * 1024), FLASH_SIZE >> 16, 1, 4, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa, 0); for (i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], pci_bus, "rtl8139", i==0 ? "2" : NULL); usbdevice_create("keyboard"); memset(&boot_params, 0, sizeof(boot_params)); if (kernel_filename) { int kernel_size; kernel_size = load_image_targphys(kernel_filename, SDRAM_BASE + LINUX_LOAD_OFFSET, INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } stl_phys(&address_space_memory, SH7750_BCR1, 1<<3); stw_phys(&address_space_memory, SH7750_BCR2, 3<<(3*2)); reset_info->vector = (SDRAM_BASE + LINUX_LOAD_OFFSET) | 0xa0000000; } if (initrd_filename) { int initrd_size; initrd_size = load_image_targphys(initrd_filename, SDRAM_BASE + INITRD_LOAD_OFFSET, SDRAM_SIZE - INITRD_LOAD_OFFSET); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initrd '%s'\n", initrd_filename); exit(1); } boot_params.loader_type = 1; boot_params.initrd_start = INITRD_LOAD_OFFSET; boot_params.initrd_size = initrd_size; } if (kernel_cmdline) { strncpy(boot_params.kernel_cmdline, kernel_cmdline, sizeof(boot_params.kernel_cmdline)); } rom_add_blob_fixed("boot_params", &boot_params, sizeof(boot_params), SDRAM_BASE + BOOT_PARAMS_OFFSET); }
1threat
Unable to swap the variables using perl? : <hr> <p>Here by i tried to swap the variables using perl.</p> <pre><code>#!/usr/local/bin/perl use strict; use warnings; my $v1=23; my $v2=43; $v1,$v2)=($v2,$v1) print $v1,$v2; </code></pre> <p>Error:</p> <pre><code>syntax error at exchange.pl line 7, near ") print" Execution of exchange.pl aborted due to compilation errors. </code></pre> <p>Excepted output:</p> <pre><code>43,23 </code></pre>
0debug
Aligning collection view cells to fit exactly 3 per row : <p>I am trying to make a collection view of images, so that there are 3 per row, with no spacing in between.</p> <p>My collection view data sources are:</p> <pre><code>func numberOfSections(in collectionView: UICollectionView) -&gt; Int { return 1 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int { return posts.count } </code></pre> <p>and this is how it's set up in my storyboard (imageView width is 125, a third of the 375 screen width):</p> <p><a href="https://i.stack.imgur.com/4689X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4689X.png" alt="enter image description here"></a></p> <p>However when I run the app and add some photos, it looks like this:</p> <p><a href="https://i.stack.imgur.com/0M1Nt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0M1Nt.png" alt="enter image description here"></a></p> <p>How can I fix this so that I see 3 images per row? Thanks for any help!</p>
0debug
Just starting looking into python, Want to as about beautiful soup : So I was trying to get the web crawling element in Google drive. What I want is the date the file was modified. And I use F12 to find the elements, got the following selector body > div.ndfHFb-c4YZDc.ndfHFb-c4YZDc-AHmuwe-Hr88gd-OWB6Me.ndfHFb-c4YZDc-vyDMJf-aZ2wEe.ndfHFb-c4YZDc-i5oIFb.ndfHFb-c4YZDc-TSZdd > div.ndfHFb-c4YZDc-MZArnb-b0t70b.ndfHFb-c4YZDc-MZArnb-b0t70b-L6cTce > div.ndfHFb-c4YZDc-MZArnb-bN97Pc.ndfHFb-c4YZDc-s2gQvd > div.ndfHFb-c4YZDc-MZArnb-Tswv1b-nUpftc > div:nth-child(1) > div.ndfHFb-c4YZDc-MZArnb-BKwaUc-bN97Pc > div > div:nth-child(6) > div.ndfHFb-c4YZDc-MZArnb-BKwaUc-V67aGc.ndfHFb-c4YZDc-MZArnb-Tswv1b-V67aGc In order to do so I created following code using BS4. from bs4 import BeautifulSoup as bs import requests req= requests.get ('https://drive.google.com/file/d/12_Lu1VHQI-yjvCPEwUhjonRyGHEczpRc/view') base= req.text print(base) Find_ver=Sr.select('body > div.ndfHFb-c4YZDc.ndfHFb-c4YZDc-AHmuwe-Hr88gd-OWB6Me.ndfHFb-c4YZDc-vyDMJf-aZ2wEe.ndfHFb-c4YZDc-i5oIFb.ndfHFb-c4YZDc-TSZdd > div.ndfHFb-c4YZDc-MZArnb-b0t70b.ndfHFb-c4YZDc-MZArnb-b0t70b-L6cTce > div.ndfHFb-c4YZDc-MZArnb-bN97Pc.ndfHFb-c4YZDc-s2gQvd > div.ndfHFb-c4YZDc-MZArnb-Tswv1b-nUpftc > div:nth-child(1) > div.ndfHFb-c4YZDc-MZArnb-BKwaUc-bN97Pc > div > div:nth-child(6) > div.ndfHFb-c4YZDc-MZArnb-BKwaUc-V67aGc.ndfHFb-c4YZDc-MZArnb-Tswv1b-V67aGc' ) print (Find_ver) But this keeps printing [] null dict, any help?
0debug
static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport, void *data, size_t len) { struct VncState *vs = (struct VncState *)transport; int ret; retry: ret = recv(vs->csock, data, len, 0); if (ret < 0) { if (errno == EINTR) goto retry; return -1; } return ret; }
1threat
Does pytest have an assertItemsEqual / assertCountEqual equivalent : <p><code>unittest.TestCase</code> has an <a href="https://docs.python.org/3.6/library/unittest.html#unittest.TestCase.assertCountEqual" rel="noreferrer"><code>assertCountEqual</code> method</a> (<code>assertItemsEqual</code> in Python 2, which is arguably a better name), which compares two iterables and checks that they contain the same number of the same objects, without regard for their order.</p> <p>Does pytest provide something similar? All of the obvious alternatives (e.g. calling <code>set(x)</code>, <code>sorted(x)</code> or <code>Counter(list(x))</code> on each side as mentioned in the documentation) don't work, because the things I'm comparing are lists of dictionaries, and dictionaries aren't hashable.</p>
0debug