problem
stringlengths
26
131k
labels
class label
2 classes
static int read_rle_sgi(unsigned char* out_buf, const uint8_t *in_buf, const uint8_t *in_end, SgiState* s) { uint8_t *dest_row; unsigned int len = s->height * s->depth * 4; const uint8_t *start_table = in_buf; unsigned int y, z; unsigned int start_offset; if(len * 2 > in_end - in_buf) { return AVERROR_INVALIDDATA; } in_buf -= SGI_HEADER_SIZE; for (z = 0; z < s->depth; z++) { dest_row = out_buf; for (y = 0; y < s->height; y++) { dest_row -= s->linesize; start_offset = bytestream_get_be32(&start_table); if(start_offset > in_end - in_buf) { return AVERROR_INVALIDDATA; } if (expand_rle_row(in_buf + start_offset, in_end, dest_row + z, dest_row + FFABS(s->linesize), s->depth) != s->width) return AVERROR_INVALIDDATA; } } return 0; }
1threat
void gic_complete_irq(GICState *s, int cpu, int irq) { int update = 0; int cm = 1 << cpu; DPRINTF("EOI %d\n", irq); if (irq >= s->num_irq) { return; } if (s->running_irq[cpu] == 1023) return; if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { if (!GIC_TEST_EDGE_TRIGGER(irq) && GIC_TEST_ENABLED(irq, cm) && GIC_TEST_LEVEL(irq, cm) && (GIC_TARGET(irq) & cm) != 0) { DPRINTF("Set %d pending mask %x\n", irq, cm); GIC_SET_PENDING(irq, cm); update = 1; } } if (irq != s->running_irq[cpu]) { int tmp = s->running_irq[cpu]; while (s->last_active[tmp][cpu] != 1023) { if (s->last_active[tmp][cpu] == irq) { s->last_active[tmp][cpu] = s->last_active[irq][cpu]; break; } tmp = s->last_active[tmp][cpu]; } if (update) { gic_update(s); } } else { gic_set_running_irq(s, cpu, s->last_active[s->running_irq[cpu]][cpu]); } }
1threat
void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp) { do_blockdev_backup(arg, NULL, errp); }
1threat
What i mention as a return Type : Here i'm writing Linq query for Guoup By but what i mention as return type public IEnumerable<Market_Masters> GetMaster() { var x = from n in db.Masters join chil in db.ChildMasterMasters on n.MasterId equals chil.MasterId into t select new { n.MasterId, n.Prod_Name, n.Produ_Adress, n.Price, Hello = t }; return ; } if i write .ToList() its through an Error
0debug
static int m25p80_init(SSISlave *ss) { DriveInfo *dinfo; Flash *s = M25P80(ss); M25P80Class *mc = M25P80_GET_CLASS(s); s->pi = mc->pi; s->size = s->pi->sector_size * s->pi->n_sectors; s->dirty_page = -1; s->storage = qemu_blockalign(s->bdrv, s->size); dinfo = drive_get_next(IF_MTD); if (dinfo) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->bdrv = blk_bs(blk_by_legacy_dinfo(dinfo)); if (bdrv_read(s->bdrv, 0, s->storage, DIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) { fprintf(stderr, "Failed to initialize SPI flash!\n"); return 1; } } else { DB_PRINT_L(0, "No BDRV - binding to RAM\n"); memset(s->storage, 0xFF, s->size); } return 0; }
1threat
Is it possible to use different garbage collection policies for Go? : <p>As the title says, I wonder if it is possible to change the GC policy used by the Go?</p>
0debug
ES6: Find an object in an array by one of its properties : <p>I'm trying to figure out how to do this in ES6...</p> <p>I have this array of objects..</p> <pre><code>const originalData=[ {"investor": "Sue", "value": 5, "investment": "stocks"}, {"investor": "Rob", "value": 15, "investment": "options"}, {"investor": "Sue", "value": 25, "investment": "savings"}, {"investor": "Rob", "value": 15, "investment": "savings"}, {"investor": "Sue", "value": 2, "investment": "stocks"}, {"investor": "Liz", "value": 85, "investment": "options"}, {"investor": "Liz", "value": 16, "investment": "options"} ]; </code></pre> <p>..and this new array of objects where I want to add each person's total value of their investment types (stocks, options, savings)..</p> <pre><code>const newData = [ {"investor":"Sue", "stocks": 0, "options": 0, "savings": 0}, {"investor":"Rob", "stocks": 0, "options": 0, "savings": 0}, {"investor":"Liz", "stocks": 0, "options": 0, "savings": 0} ]; </code></pre> <p>I loop through originalData and save each property of the "current object" in a let..</p> <pre><code>for (let obj of originalData) { let currinvestor = obj.investor; let currinvestment = obj.investment; let currvalue = obj.value; ..but here I want to find the obect in newData that has the property = currinvestor (for the "investor" key) ...then add that investment type's (currinvestment) value (currvalue) } </code></pre>
0debug
calculate Azimuth between tow points given in lat/long with VBA : Please i have to calculate the azimuth between tow points given in lat/long but this function isn't correct please can someone help me !!!!! ---------------------------------------------------- Function azimut(lat1, lat2, lon1, lon2) azimut = WorksheetFunction.Degrees(WorksheetFunction.Atan2(Cos(Application.WorksheetFunction.Radians(lat1)) * Sin(Application.WorksheetFunction.Radians(lat2)) - Sin(Application.WorksheetFunction.Radians(lat1)) * Cos(Application.WorksheetFunction.Radians(lat2)) * Cos(Application.WorksheetFunction.Radians(lon2 - lon1)), Sin(Application.WorksheetFunction.Radians(lon2 - lon1)) * Cos(Application.WorksheetFunction.Radians(lat2)))) End Function
0debug
RXJava2: correct pattern to chain retrofit requests : <p>I am relatively new to RXJava in general (really only started using it with RXJava2), and most documentation I can find tends to be RXJava1; I can usually translate between both now, but the entire Reactive stuff is so big, that it's an overwhelming API with good documentation (when you can find it). I'm trying to streamline my code, an I want to do it with baby steps. The first problem I want to solve is this common pattern I do a lot in my current project: </p> <p>You have a Request that, if successful, you will use to make a second request. </p> <p>If either fails, you need to be able to identify which one failed. (mostly to display custom UI alerts).</p> <p>This is how I usually do it right now: </p> <p>(omitted the <code>.subscribeOn/observeOn</code> for simplicity)</p> <pre><code>Single&lt;FirstResponse&gt; first = retrofitService.getSomething(); first .subscribeWith( new DisposableSingleObserver&lt;FirstResponse&gt;() { @Override public void onSuccess(final FirstResponse firstResponse) { // If FirstResponse is OK… Single&lt;SecondResponse&gt; second = retrofitService .getSecondResponse(firstResponse.id) //value from 1st .subscribeWith( new DisposableSingleObserver&lt;SecondResponse&gt;() { @Override public void onSuccess(final SecondResponse secondResponse) { // we're done with both! } @Override public void onError(final Throwable error) { //2nd request Failed, } }); } @Override public void onError(final Throwable error) { //firstRequest Failed, } }); </code></pre> <p>Is there a better way to deal with this in RXJava2?</p> <p>I've tried <code>flatMap</code> and variations and even a <code>Single.zip</code> or similar, but I'm not sure what the easiest and most common pattern is to deal with this. </p> <p>In case you're wondering FirstRequest will fetch an actual <code>Token</code> I need in the SecondRequest. Can't make second request without the token. </p>
0debug
Angular 2 select option (dropdown) - how to get the value on change so it can be used in a function? : <p>I am trying to build a drop down with a few values.</p> <p>However, on selecting a value, I want to make an API call that takes an id.</p> <p>In my component.ts, I have an array of values:</p> <pre><code>values = [ { id: 3432, name: "Recent" }, { id: 3442, name: "Most Popular" }, { id: 3352, name: "Rating" } ]; </code></pre> <p>In my template, I am using that array as follows:</p> <pre><code>&lt;select&gt; &lt;option *ngFor="let v of values" [value]="v"&gt; {{v.name}} &lt;/option&gt; &lt;/select&gt; </code></pre> <p>However, on picking a value from the drop down, how can I access the <code>id</code> property? I want to use that in my function <code>getPhotosByType(id)</code>.</p> <p>Thanks</p>
0debug
writev_f(int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, qflag = 0; int c, cnt; char *buf; int64_t offset; int total; int nr_iov; int pattern = 0xcd; QEMUIOVector qiov; while ((c = getopt(argc, argv, "CqP:")) != EOF) { switch (c) { case 'C': Cflag = 1; break; case 'q': qflag = 1; break; case 'P': pattern = atoi(optarg); break; default: return command_usage(&writev_cmd); } } if (optind > argc - 2) return command_usage(&writev_cmd); offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %lld is not sector aligned\n", (long long)offset); return 0; } nr_iov = argc - optind; buf = create_iovec(&qiov, &argv[optind], nr_iov, pattern); gettimeofday(&t1, NULL); cnt = do_aio_writev(&qiov, offset, &total); gettimeofday(&t2, NULL); if (cnt < 0) { printf("writev failed: %s\n", strerror(-cnt)); goto out; } if (qflag) goto out; t2 = tsub(t2, t1); print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag); out: qemu_io_free(buf); return 0; }
1threat
C++ is it possible to overload the unary minus operator of an rvalue reference? : <p>is it possible to discern between these two methods? should one not mutate an rvalue when in this case seems perfectly reusable?</p> <pre><code>TYPE a; TYPE b = -a; // unary operator- of a TYPE&amp; aka lvalue ref TYPE c = -(a+b); // unary operator- of a TYPE&amp;&amp; aka rvalue ref </code></pre>
0debug
ReportLab: working with Chinese/Unicode characters : <p>TL;DR: <b>Is there some way of telling ReportLab to use a specific font, and fallback to another if glyphs for some characters are missing?</b> Alternatively, <b>Do you know of a condensed TrueType font which contains the glyphs for all European languages, Hebrew, Russian, Chinese, Japanese and Arabic?</b></p> <p>I've been creating reports with ReportLab, and have encountered problems with rendering strings containing Chinese characters. The font I've been using is DejaVu Sans Condensed, which does not contain the glyphs for Chinese (however, it does contain Cyrillic, Hebrew, Arabic and all sorts of Umlauts for European language support - which makes it pretty versatile, and I need them all from time to time)</p> <p>Chinese, however, is not supported with the font, and I've not been able to find a TrueType font which supports ALL languages, and meets our graphic design requirements. As a temporary workaround, I made it so that reports for Chinese customers use an entirely different font, containing only English and Chinese glyphs, hoping that characters in other languages won't be present in the strings. However this is, for obvious reasons, clunky and breaks the graphic design, since it's not DejaVu Sans, around which the whole look&amp;feel has been designed.</p> <p><b>So the question is</b>, how would you deal with the need to support multiple languages in one document, and maintain usage of a specified font for each language. This is made more complicated due to the fact that sometimes strings contain a mix of languages, so determining which ONE font should be used for each string is not an option.</p> <p>Is there some way of telling ReportLab to use a specific font, and fallback to another if glyphs for some characters are missing? I found vague hints in the docs that it should be possible, although I might understand it incorrectly.</p> <p>Alternatively, Do you know of a condensed TrueType font which contains the glyphs for all European languages, Hebrew, Russian, Chinese, Japanese and Arabic?</p> <p>Thanks.</p>
0debug
static int mxf_parse_structural_metadata(MXFContext *mxf) { MXFPackage *material_package = NULL; MXFPackage *source_package = NULL; MXFPackage *temp_package = NULL; int i, j, k; dprintf("metadata sets count %d\n", mxf->metadata_sets_count); for (i = 0; i < mxf->packages_count; i++) { if (!(temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i]))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve package strong ref\n"); return -1; } if (temp_package->type == MaterialPackage) { material_package = temp_package; break; } } if (!material_package) { av_log(mxf->fc, AV_LOG_ERROR, "no material package found\n"); return -1; } for (i = 0; i < material_package->tracks_count; i++) { MXFTrack *material_track = NULL; MXFTrack *source_track = NULL; MXFTrack *temp_track = NULL; MXFDescriptor *descriptor = NULL; MXFStructuralComponent *component = NULL; const MXFCodecUL *codec_ul = NULL; const MXFCodecUL *container_ul = NULL; AVStream *st; if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i]))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track strong ref\n"); continue; } if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track sequence strong ref\n"); return -1; } for (j = 0; j < material_track->sequence->structural_components_count; j++) { component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j]); if (!component || component->type != SourceClip) continue; for (k = 0; k < mxf->packages_count; k++) { if (!(temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[k]))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); return -1; } if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)) { source_package = temp_package; break; } } if (!source_package) { av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source package found\n", material_track->track_id); break; } for (k = 0; k < source_package->tracks_count; k++) { if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k]))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n"); return -1; } if (temp_track->track_id == component->source_track_id) { source_track = temp_track; break; } } if (!source_track) { av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source track found\n", material_track->track_id); break; } } if (!source_track) continue; st = av_new_stream(mxf->fc, source_track->track_id); st->priv_data = source_track; st->duration = component->duration; if (st->duration == -1) st->duration = AV_NOPTS_VALUE; st->start_time = component->start_position; av_set_pts_info(st, 64, material_track->edit_rate.num, material_track->edit_rate.den); if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref))) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n"); return -1; } #ifdef DEBUG PRINT_KEY("data definition ul", source_track->sequence->data_definition_ul); #endif st->codec->codec_type = mxf_get_codec_type(mxf_data_definition_uls, &source_track->sequence->data_definition_ul); source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref); if (source_package->descriptor) { if (source_package->descriptor->type == MultipleDescriptor) { for (j = 0; j < source_package->descriptor->sub_descriptors_count; j++) { MXFDescriptor *sub_descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor->sub_descriptors_refs[j]); if (!sub_descriptor) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub descriptor strong ref\n"); continue; } if (sub_descriptor->linked_track_id == source_track->track_id) { descriptor = sub_descriptor; break; } } } else descriptor = source_package->descriptor; } if (!descriptor) { av_log(mxf->fc, AV_LOG_INFO, "source track %d: stream %d, no descriptor found\n", source_track->track_id, st->index); continue; } #ifdef DEBUG PRINT_KEY("essence codec ul", descriptor->essence_codec_ul); PRINT_KEY("essence container ul", descriptor->essence_container_ul); #endif codec_ul = mxf_get_codec_ul(mxf_codec_uls, &descriptor->essence_codec_ul); st->codec->codec_id = codec_ul->id; if (descriptor->extradata) { st->codec->extradata = descriptor->extradata; st->codec->extradata_size = descriptor->extradata_size; } if (st->codec->codec_type == CODEC_TYPE_VIDEO) { container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, &descriptor->essence_container_ul); if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = container_ul->id; st->codec->width = descriptor->width; st->codec->height = descriptor->height; st->codec->bits_per_sample = descriptor->bits_per_sample; st->need_parsing = 2; } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, &descriptor->essence_container_ul); if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = container_ul->id; st->codec->channels = descriptor->channels; st->codec->bits_per_sample = descriptor->bits_per_sample; st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; if (st->codec->codec_id == CODEC_ID_PCM_S16LE) { if (descriptor->bits_per_sample == 24) st->codec->codec_id = CODEC_ID_PCM_S24LE; else if (descriptor->bits_per_sample == 32) st->codec->codec_id = CODEC_ID_PCM_S32LE; } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) { if (descriptor->bits_per_sample == 24) st->codec->codec_id = CODEC_ID_PCM_S24BE; else if (descriptor->bits_per_sample == 32) st->codec->codec_id = CODEC_ID_PCM_S32BE; if (descriptor->essence_container_ul[13] == 0x01) st->codec->channels = 8; } else if (st->codec->codec_id == CODEC_ID_MP2) { st->need_parsing = 1; } } if (container_ul && container_ul->wrapping == Clip) { dprintf("stream %d: clip wrapped essence\n", st->index); st->need_parsing = 1; } } return 0; }
1threat
python script for reformatting a txt file into a csv using python : So I have been asked to read in a txt file containing this __________________________________________________ 1. Wicked Stepmother (1989) as Miranda A couple comes home from vacation to find that their grandfather has … 2. Directed By William Wyler (1988) as Herself During the Golden Age of Hollywood, William Wyler was one of the … 3. Whales of August, The (1987) as Libby Strong Drama revolving around five unusual elderly characters, two of whom … 4. As Summers Die (1986) as Hannah Loftin Set in a sleepy Southern Louisiana town in 1959, a lawyer, searches … ________________________________________ and create an .csv output file that looks like this ______________________ 1,Wicked Stepmother ,1989, as Miranda,A couple comes home from vacation … 2,Directed By William Wyler ,1988, as Herself,During the Golden Age of … 3,"Whales of August, The ",1987, as Libby Strong,Drama revolving around five… _________________________ Not only am I pretty new at file handling, since they are all on separate lines in the original file, Im not sure how to splice the strings into the format I want
0debug
StringUtils.isNumeric is undefined method : <p>I have imported that library:</p> <pre><code>import org.apache.commons.codec.binary.StringUtils; </code></pre> <p>And tried to use some of methods, but failed:</p> <pre><code>StringUtils.isNumeric("2398sdf"); </code></pre> <p>IDE keep saying me that, method is undefined. What is wrong here?</p>
0debug
Measuring the irregularity of an object border : I have the image below and would like to measure the border irregularity of the image. That is, to specify if the border (edge) is regular or not. [![enter image description here][1]][1] I have been looking around, and found mostly research papers on the topic. Is there some function I can use in `Python` or `MATLAB`? Thanks. [1]: https://i.stack.imgur.com/stQI5.gif
0debug
How to create a function that returns a byte array in C++? Arduino project. : I am currently starting to learn C++ via Arduino programming. I am programming an 8*8 LED Matrix, and currently have a semi-working code that uses a joystick to control a dot on screen. Only problem is: its nearly 1000 lines long. It's equivalent to writing an 1000 page essay only saying "Pig, blanket, market" over and over again until I get to the actual logic involved. My friend suggested to make it shorter, I could make a function which returns a byte. How does one do this? http://pastebin.com/8ud9ny2U <-- This is my code. !WARNING! Not a pretty code. At all. Help is much appreciated.
0debug
Java Recursion Method That Doubles An Amount : <p>If you work for a month and first day you get paid 1 cent and day two 2 cents. Each day the amount doubles. And the user input a day and it will display how much money you will be paid in that day.</p> <p>How can this be done with recursion.</p> <p>Thank you.</p>
0debug
static int rtp_new_av_stream(HTTPContext *c, int stream_index, struct sockaddr_in *dest_addr, HTTPContext *rtsp_c) { AVFormatContext *ctx; AVStream *st; char *ipaddr; URLContext *h = NULL; uint8_t *dummy_buf; int max_packet_size; ctx = avformat_alloc_context(); if (!ctx) return -1; ctx->oformat = av_guess_format("rtp", NULL, NULL); st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; st->codec= avcodec_alloc_context(); ctx->nb_streams = 1; ctx->streams[0] = st; if (!c->stream->feed || c->stream->feed == c->stream) memcpy(st, c->stream->streams[stream_index], sizeof(AVStream)); else memcpy(st, c->stream->feed->streams[c->stream->feed_streams[stream_index]], sizeof(AVStream)); st->priv_data = NULL; ipaddr = inet_ntoa(dest_addr->sin_addr); switch(c->rtp_protocol) { case RTSP_LOWER_TRANSPORT_UDP: case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: if (c->stream->is_multicast) { int ttl; ttl = c->stream->multicast_ttl; if (!ttl) ttl = 16; snprintf(ctx->filename, sizeof(ctx->filename), "rtp: ipaddr, ntohs(dest_addr->sin_port), ttl); } else { snprintf(ctx->filename, sizeof(ctx->filename), "rtp: } if (url_open(&h, ctx->filename, URL_WRONLY) < 0) goto fail; c->rtp_handles[stream_index] = h; max_packet_size = url_get_max_packet_size(h); break; case RTSP_LOWER_TRANSPORT_TCP: c->rtsp_c = rtsp_c; max_packet_size = RTSP_TCP_MAX_PACKET_SIZE; break; default: goto fail; } http_log("%s:%d - - \"PLAY %s/streamid=%d %s\"\n", ipaddr, ntohs(dest_addr->sin_port), c->stream->filename, stream_index, c->protocol); if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) { goto fail; } av_set_parameters(ctx, NULL); if (av_write_header(ctx) < 0) { fail: if (h) url_close(h); av_free(ctx); return -1; } url_close_dyn_buf(ctx->pb, &dummy_buf); av_free(dummy_buf); c->rtp_ctx[stream_index] = ctx; return 0; }
1threat
static void rv40_loop_filter(RV34DecContext *r, int row) { MpegEncContext *s = &r->s; int mb_pos, mb_x; int i, j, k; uint8_t *Y, *C; int alpha, beta, betaY, betaC; int q; int mbtype[4]; int mb_strong[4]; int clip[4]; int cbp[4]; int uvcbp[4][2]; int mvmasks[4]; mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ int mbtype = s->current_picture_ptr->f.mb_type[mb_pos]; if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype)) r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF; if(IS_INTRA(mbtype)) r->cbp_chroma[mb_pos] = 0xFF; } mb_pos = row * s->mb_stride; for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){ int y_h_deblock, y_v_deblock; int c_v_deblock[2], c_h_deblock[2]; int clip_left; int avail[4]; int y_to_deblock, c_to_deblock[2]; q = s->current_picture_ptr->f.qscale_table[mb_pos]; alpha = rv40_alpha_tab[q]; beta = rv40_beta_tab [q]; betaY = betaC = beta * 3; if(s->width * s->height <= 176*144) betaY += beta; avail[0] = 1; avail[1] = row; avail[2] = mb_x; avail[3] = row < s->mb_height - 1; for(i = 0; i < 4; i++){ if(avail[i]){ int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride; mvmasks[i] = r->deblock_coefs[pos]; mbtype [i] = s->current_picture_ptr->f.mb_type[pos]; cbp [i] = r->cbp_luma[pos]; uvcbp[i][0] = r->cbp_chroma[pos] & 0xF; uvcbp[i][1] = r->cbp_chroma[pos] >> 4; }else{ mvmasks[i] = 0; mbtype [i] = mbtype[0]; cbp [i] = 0; uvcbp[i][0] = uvcbp[i][1] = 0; } mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]); clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q]; } y_to_deblock = mvmasks[POS_CUR] | (mvmasks[POS_BOTTOM] << 16); y_h_deblock = y_to_deblock | ((cbp[POS_CUR] << 4) & ~MASK_Y_TOP_ROW) | ((cbp[POS_TOP] & MASK_Y_LAST_ROW) >> 12); y_v_deblock = y_to_deblock | ((cbp[POS_CUR] << 1) & ~MASK_Y_LEFT_COL) | ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3); if(!mb_x) y_v_deblock &= ~MASK_Y_LEFT_COL; if(!row) y_h_deblock &= ~MASK_Y_TOP_ROW; if(row == s->mb_height - 1 || (mb_strong[POS_CUR] || mb_strong[POS_BOTTOM])) y_h_deblock &= ~(MASK_Y_TOP_ROW << 16); for(i = 0; i < 2; i++){ c_to_deblock[i] = (uvcbp[POS_BOTTOM][i] << 4) | uvcbp[POS_CUR][i]; c_v_deblock[i] = c_to_deblock[i] | ((uvcbp[POS_CUR] [i] << 1) & ~MASK_C_LEFT_COL) | ((uvcbp[POS_LEFT][i] & MASK_C_RIGHT_COL) >> 1); c_h_deblock[i] = c_to_deblock[i] | ((uvcbp[POS_TOP][i] & MASK_C_LAST_ROW) >> 2) | (uvcbp[POS_CUR][i] << 2); if(!mb_x) c_v_deblock[i] &= ~MASK_C_LEFT_COL; if(!row) c_h_deblock[i] &= ~MASK_C_TOP_ROW; if(row == s->mb_height - 1 || mb_strong[POS_CUR] || mb_strong[POS_BOTTOM]) c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4); } for(j = 0; j < 16; j += 4){ Y = s->current_picture_ptr->f.data[0] + mb_x*16 + (row*16 + j) * s->linesize; for(i = 0; i < 4; i++, Y += 4){ int ij = i + j; int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0; int dither = j ? ij : i*4; if(y_h_deblock & (MASK_BOTTOM << ij)){ r->rdsp.rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither, y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0, clip_cur, alpha, beta, betaY, 0, 0); } if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){ if(!i) clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0; else clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0; r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither, clip_cur, clip_left, alpha, beta, betaY, 0, 0); } if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){ r->rdsp.rv40_h_loop_filter(Y, s->linesize, dither, clip_cur, mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0, alpha, beta, betaY, 0, 1); } if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){ clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0; r->rdsp.rv40_v_loop_filter(Y, s->linesize, dither, clip_cur, clip_left, alpha, beta, betaY, 0, 1); } } } for(k = 0; k < 2; k++){ for(j = 0; j < 2; j++){ C = s->current_picture_ptr->f.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize; for(i = 0; i < 2; i++, C += 4){ int ij = i + j*2; int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0; if(c_h_deblock[k] & (MASK_CUR << (ij+2))){ int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0; r->rdsp.rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8, clip_bot, clip_cur, alpha, beta, betaC, 1, 0); } if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){ if(!i) clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0; else clip_left = c_to_deblock[k] & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0; r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8, clip_cur, clip_left, alpha, beta, betaC, 1, 0); } if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){ int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0; r->rdsp.rv40_h_loop_filter(C, s->uvlinesize, i*8, clip_cur, clip_top, alpha, beta, betaC, 1, 1); } if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){ clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0; r->rdsp.rv40_v_loop_filter(C, s->uvlinesize, j*8, clip_cur, clip_left, alpha, beta, betaC, 1, 1); } } } } } }
1threat
How to set the logging level for the elasticsearch library differently to my own logging? : <p>How can I set the logging level for the elasticsearch library differently to my own logging? To illustrate the issue, I describe the module scenario. I have a module <code>lookup.py</code> which uses <code>elasticsearch</code> like this:</p> <pre><code>import logging logger = logging.getLogger(__name__) import elasticsearch def get_docs(): logger.debug("search elastic") es = elasticsearch.Elasticsearch('http://my-es-server:9200/') res = es.search(index='myindex', body='myquery') logger.debug("elastic returns %s hits" % res['hits']['total']) . . . </code></pre> <p>Then in my main file I do</p> <pre><code>import logging import lookup.py logging.root.setLevel(loglevel(args)) get_docs() . . . </code></pre> <p>I get lots of debug messages from <em>inside</em> the Elasticsearch object. How can I suppress them with some code in <code>lookup.py</code> without suppressing the debug messages in <code>lookup.py</code> itself? The <code>Elasticsearch</code> class seems to have a <code>logger</code> object; I I tried to set it to <code>None</code>, but this didn't change anything.</p>
0debug
What is significant of cascading in Hibernate? : <p>Why we are using cascading in Java?? What is its importance. Here i am using for save and update</p> <pre><code>Stock stock = new Stock(); StockDailyRecord stockDailyRecords = new StockDailyRecord(); //set the stock and stockDailyRecords data stockDailyRecords.setStock(stock); stock.getStockDailyRecords().add(stockDailyRecords); session.save(stock); session.save(stockDailyRecords); </code></pre> <p>Is there any alternate way for cascading.?</p>
0debug
How to convert a type-erased list to an array in Kotlin? : <p>A function <code>toArray</code> should convert type-erased list to <code>T</code> that is <code>Array&lt;String&gt;</code> now.</p> <pre><code>inline fun &lt;reified T&gt; toArray(list: List&lt;*&gt;): T { return list.toTypedArray() as T } toArray&lt;Array&lt;String&gt;&gt;(listOf("a", "b", "c")) // should be arrayOf("a", "b", "c") </code></pre> <p>However, <code>toArray</code> throws this error.</p> <blockquote> <p>java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;</p> </blockquote> <p>Do you have any ideas?</p>
0debug
C++ MFC, Custom Grid with CheckBox, RadioButton : <p>I want to create Custom Grid which shall have inline edit feature, Checkbox, Radio button and Images.</p> <p>I came across very good article &lt;&lt; <a href="http://www.codeproject.com/Articles/8/MFC-Grid-control" rel="nofollow">http://www.codeproject.com/Articles/8/MFC-Grid-control</a>; Here DrawFrameControl is used to draw Check box and Radio Button</p> <p>I have a requirement to customize the look and feel of check box. Is it possible to customize DrawFrameControl's or is a good idea to create custom control (check box and radio button)? Will there be any performance issue in case of custom controls?</p> <p>Regards, Sanjay</p>
0debug
Hadoop Developer : I have MacOs when I install Hadoop I used this Command Sudo apt install hadoop-yarn-resourcemanager I got this error Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/apt"
0debug
Can I do dispatch from getters in Vuex : <p>Fiddle : <a href="https://jsfiddle.net/9a6Lg2vd/6/" rel="noreferrer">here</a></p> <p>I am creating a webapp with Vue 2 with Vuex. I have a store, where I want to fetch state data from a getter, What I want is if getter finds out data is not yet populated, it calls dispatch and fetches the data.</p> <p>Following is my Vuex store:</p> <pre><code>const state = { pets: [] }; const mutations = { SET_PETS (state, response) { state.pets = response; } }; const actions = { FETCH_PETS: (state) =&gt; { setTimeout(function() { state.commit('SET_PETS', ['t7m12qbvb/apple_9', '6pat9znxz/1448127928_kiwi']) }, 1000) } } const getters = { pets(state){ if(!state.pets.length){ state.dispatch("FETCH_PETS") } return state.pets } } const store = new Vuex.Store({ state, mutations, actions, getters }); </code></pre> <p>But I am getting following error:</p> <blockquote> <p>Uncaught TypeError: state.dispatch is not a function(…)</p> </blockquote> <p>I know I can do this, from <code>beforeMount</code> of Vue component, but I have multiple components which uses same Vuex store, so I have to do it in one of the components, which one should that be and how will it impact other components.</p>
0debug
How can I do two text blocks in the listView which the first in the left alignment and the second in the right use Android Studio? : How can I set two text blocks in the listView, of which the first is on the left, the other on the right? I am tried to create a new layout with two textViews. But I don't know how I can connect tetViews with listView and how I can set texts on textViews. May anybody help me? [I would like to have a list like this screen][1] [1]: https://i.stack.imgur.com/k4rGG.png
0debug
Check if the string contains all the characters from a to z : <p>I have to write a C# code to check if a string contains all the alphabets from a to z ."this is a test" (without quotes). It doesn't contain all alphabets from a to z so the output is no. "abcdefghijklmnopqrstuvwxyz". It contains all alphabets from a to z so the output is yes.</p>
0debug
How to use MemoryCache in C# Core Console app? : <p>I would like to use the Microsoft.Extensions.Caching.Memory.MemoryCache in a .NET Core 2.0 console app (Actually, in a library that is either used in a console or in a asp.net app)</p> <p>I've created a test app:</p> <pre><code>using System; namespace ConsoleTest { class Program { static void Main(string[] args) { var cache = new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions()); int count = cache.Count; cache.CreateEntry("item1").Value = 1; int count2 = cache.Count; cache.TryGetValue("item1", out object item1); int count3 = cache.Count; cache.TryGetValue("item2", out object item2); int count4 = cache.Count; Console.WriteLine("Hello World!"); } } } </code></pre> <p>Unfortunately, this is not working. The items are not added to the cache and they can not be retrieved. </p> <p>I suspect I need to use DependencyInjection, doing something like this:</p> <pre><code>using System; using Microsoft.Extensions.DependencyInjection; namespace ConsoleTest { class Program { static void Main(string[] args) { var provider = new Microsoft.Extensions.DependencyInjection.ServiceCollection() .AddMemoryCache() .BuildServiceProvider(); //And now? var cache = new Microsoft.Extensions.Caching.Memory.MemoryCache(new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions()); var xxx = PSP.Helpers.DependencyInjection.ServiceProvider; int count = cache.Count; cache.CreateEntry("item1").Value = 1; int count2 = cache.Count; cache.TryGetValue("item1", out object item1); int count3 = cache.Count; cache.TryGetValue("item2", out object item2); int count4 = cache.Count; Console.WriteLine("Hello World!"); } } } </code></pre> <p>Unfortunately, this is also not working, I suspect I shouldn't create a new memory cache, but get it from the service provider, but haven't been able to do that.</p> <p>Any ideas?</p>
0debug
static int mace6_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { int16_t *samples = data; MACEContext *ctx = avctx->priv_data; int i, j; for(i = 0; i < avctx->channels; i++) { int16_t *output = samples + i; for (j = 0; j < buf_size / avctx->channels; j++) { uint8_t pkt = buf[i + j*avctx->channels]; chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2, 8, avctx->channels); output += avctx->channels << 1; chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4, 4, avctx->channels); output += avctx->channels << 1; chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2, 8, avctx->channels); output += avctx->channels << 1; } } *data_size = 2 * 6 * buf_size; return buf_size; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, bool has_id, const char *id, bool has_name, const char *name, Error **errp) { BlockDriverState *bs = bdrv_find(device); QEMUSnapshotInfo sn; Error *local_err = NULL; SnapshotInfo *info = NULL; int ret; if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return NULL; } if (!has_id) { id = NULL; } if (!has_name) { name = NULL; } if (!id && !name) { error_setg(errp, "Name or id must be provided"); return NULL; } ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } if (!ret) { error_setg(errp, "Snapshot with id '%s' and name '%s' does not exist on " "device '%s'", STR_OR_NULL(id), STR_OR_NULL(name), device); return NULL; } bdrv_snapshot_delete(bs, id, name, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } info = g_malloc0(sizeof(SnapshotInfo)); info->id = g_strdup(sn.id_str); info->name = g_strdup(sn.name); info->date_nsec = sn.date_nsec; info->date_sec = sn.date_sec; info->vm_state_size = sn.vm_state_size; info->vm_clock_nsec = sn.vm_clock_nsec % 1000000000; info->vm_clock_sec = sn.vm_clock_nsec / 1000000000; return info; }
1threat
How to make a date vector be ordered so it starts with the earliist date first? : <p>I'm pretty new to r but picking it up gradually. My question is, I want to make my date vector start from the earliest date rather from the newest. I have about 50 odd rows and want it in order of earliest first. </p> <p>head(dates1) [1] "2016-03-04" "2016-02-26" "2016-02-19" "2016-02-12" "2016-02-05" "2016-01-29"</p> <p>I've tried order() but it gives back numeric values, I want to keep them as dates. </p> <p>Thanks if you can help.</p>
0debug
Passing vuex module state into vue-router during beforeEach : <p>I am using VueJS in conjunction with <code>vuex</code> and <code>vue-router</code>. I have a <code>vuex</code> module that is making a mutation to its store, and trying to use that to determine whether or not a user is authenticated.</p> <p>Here is what my code looks like in relevant part.</p> <p><strong>main.js</strong></p> <pre><code>import Vue from 'vue' import App from './App.vue' import store from './store' import router from './router' router.beforeEach((to, from, next) =&gt; { console.log(router.app) // prints a Vue$2 object console.log(router.app.$store) // undefined console.log(store.getters.isAuthenticated) // false ... } const app = new Vue({ store, router, ...App }) app.$mount('#app') </code></pre> <p><strong>/store/index.js</strong></p> <pre><code>import Vue from 'vue' import Vuex from 'vuex' import core from './modules/core' Vue.use(Vuex) const store = new Vuex.Store({ modules: { core: core } }) export default store </code></pre> <p><strong>/store/modules/core.js</strong></p> <pre><code>import * as types from '../types' import api from '../../api' import router from '../../router' const state = { token: null, user: null, authenticated: false } const mutations = { [types.LOGIN_SUCCESS] (state, payload) { console.log('mutate') state.token = payload.token state.user = payload.user state.authenticated = true router.go('/') } } const getters = { isAuthenticated: state =&gt; { return state.authenticated } } const actions = { [types.LOGIN] (context, payload) { api.getToken(payload).then(response =&gt; { context.commit(types.LOGIN_SUCCESS, response) }) } } export default { state, mutations, actions, getters } </code></pre> <p>When I go thru my logic to trigger the <code>LOGIN</code> action, I can see that the mutation executed properly, and when I use the Chrome extension to view the vuex state for my <code>core</code> module, the state for <code>user</code> and <code>authenticated</code> have been properly mutated.</p> <p><strong>QUESTION</strong></p> <p>It seems like this module just simply has not been loaded by the time the router is running in the <code>.beforeEach</code> loop. Is this true?</p> <p>If yes, what are some other suggestions on how to handle this situation? If no, what am I doing incorrect?</p>
0debug
Ncurses 6.0 Compilation Error - error: expected ')' before 'int' : <h1>Problem description</h1> <p>Trying to install ncurses 6.0 on Ubuntu 16.04 LTS is failing with a compilation error:</p> <pre><code>In file included from ./curses.priv.h:325:0, from ../ncurses/lib_gen.c:19: _24273.c:843:15: error: expected ‘)’ before ‘int’ ../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’ #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) ^ Makefile:962: recipe for target '../objects/lib_gen.o' failed make[1]: *** [../objects/lib_gen.o] Error 1 make[1]: Leaving directory '/home/netsamir/Sofware/Tmux/ncurses-6.0/ncurses' Makefile:113: recipe for target 'all' failed make: *** [all] Error 2 </code></pre> <h1>Configuration</h1> <pre><code>netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04 LTS Release: 16.04 Codename: xenial netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ gcc --version gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ cpp --version cpp (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. </code></pre>
0debug
How does importing maven dependencies impact plugin management? : <p>Maven allows one to <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies" rel="noreferrer">import dependencies</a>, for example importing Spring Boot dependencies, into a project that has a different parent using import scope. How does this impact plugin management? </p> <p>I want to use the plugin versions defined in the <code>&lt;pluginManagement&gt;</code> section of the imported dependency (<code>&lt;spring-boot-dependencies&gt;</code> in this case), but I notice different versions of plugins, like surefire, used in different environments, like on TeamCity and locally.</p>
0debug
The server cannot started because one or more of the ports are invalid [TomCat in Eclipse] : <p>When i open my file list-student.jsp. I experienced the following error: "Starting Tomcat v9.0 Server at localhost has encountered a problem. The server cannot be started because one or more of the ports are invalid. Open the server editor and correct invalid ports."</p> <p>I tried to go server tab and change the port from 8080 to different number, but it doesnt work. I had the same problem before and i changed 8080 to another number liked 8181 and it worked, but today, even i tried to change port number and the problem cant be fixed. Please see some pictures below for your reference <a href="https://i.stack.imgur.com/NTmYW.png" rel="noreferrer">Changing port number</a></p>
0debug
How to use ConfigurationManager? (Microsoft.IdentityModel.Protocols) : <p>I was recently forced to update my System.IdentityModel.Tokens.Jwt NuGet package to 5.1.4 because of another NuGet package. Most of the code after changes seem easy enough to solve, but now <code>ConfigurationManager&lt;OpenIdConnectConfiguration&gt;()</code> takes two arguments instead of one! I can not find any example of how to use this new version of the Configuration manager!</p> <p>I use it as part of this code:</p> <pre><code>string stsDiscoveryEndpoint = string.Format("{0}/.well-known/openid-configuration", authority); ConfigurationManager&lt;OpenIdConnectConfiguration&gt; configManager = new ConfigurationManager&lt;OpenIdConnectConfiguration&gt;(stsDiscoveryEndpoint, IConfigurationRetriever&lt;&gt;); OpenIdConnectConfiguration config = await configManager.GetConfigurationAsync(); _issuer = config.Issuer; _signingTokens = config.SigningTokens.ToList(); _stsMetadataRetrievalTime = DateTime.UtcNow; </code></pre> <p>Can anyone let me know what arguments <code>ConfigurationManager</code> expects</p>
0debug
Firebase Android: Get data inserted custom listview : [enter image description here][1] [1]: https://i.stack.imgur.com/C0Nyo.png I want to display the user on the custom listview, each line listview has 2 textview and social network url, when click on the listview will lead to social networking site. I tried but failed, can you suggest me? Thank you very much.
0debug
Which string(in query) are empty? : <p>So how to detect which string are empty in the query? I mean: I have few WHERE clause in one query</p> <pre><code>$query = SELECT var FROM table WHERE var = '$y'; </code></pre> <p>and how can I detect which "$y" has no result? </p> <p>I know I can use <code>if($y)</code>, but how can I detect which was empty?</p>
0debug
Class inside Echo : Managed to get this code working (I'm not into php). Is there anyway this can be simplified ? Many thanks ! <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <?php $menu = JSite::getMenu(); $arr = (array)$menu->getActive(); $alias = $arr['alias']; if ($alias == "accueil") {echo('<h2 class="moduletitle"><span>title 1</h2></span>');} else if ($alias == "welcome") {echo('<h2 class="moduletitle"><span>title 2</h2></span>');} else { echo "<h1 class='moduletitle'><span>"; echo $this->escape($this->params->get('page_title')); echo "</span></h1>"; } ?> <!-- end snippet -->
0debug
Flexible monitoring tool wanted : <p>I'm looking for a flexible monitoring tool, which should be able to:</p> <ol> <li>Monitor public web endpoint and: <ul> <li>Validate REST API response body.</li> <li>Validate response codes.</li> </ul></li> <li>Monitor Azure resources: Cloud Services, Web Apps, SQL servers, VMs etc (Optional)</li> <li>Support of custom monitoring scripts. For example, there is a PowerShell script which performs some checks and returns response if service healthy or not.</li> <li>Provide availability/performance metrics based on monitoring statistics.</li> <li>Raise alerts and send notifications</li> </ol> <p>Tool should have a modern UI and support of multiple monitoring projects, each project should have own isolated settings.</p> <p>Currently we are using MS application SCOM (System Center Operations Manager), but it's a very old tool and has a poor documentation and UI. But a very flexible and can monitor a lot of thing out of the box.</p> <p><strong>Basically, is there something better and modern than SCOM?</strong></p>
0debug
get the begging of a string until a given char - c : I know that is a simple question but I couldn't find the answer, I have this string: M1[r2][r3] I want to get only the M1, I'm looking for something like ```strchr()``` a function that get the string and a char to stop at. Thanks.
0debug
what does this expression do for(d=0;d<n-c-1;d++) : I was trying to figure out how this inner loop work In This below code but I couldn't understand, the part that I really struggle to understand is (d<n-c-1)// inner for loop// include <stdio.h> int main() { int array[100], n, c, d, swap; printf("Enter number of elements\n"); scanf("%d", &n); printf("Enter %d integers\n", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); for (c = 0; c < (n - 1); c++) { for (d = 0; d < n - c - 1; d++) { if (array[d] > array[d + 1]) /* For decreasing order use < */ { swap = array[d]; array[d] = array[d + 1]; array[d + 1] = swap; } } } printf("Sorted list in ascending order:\n"); for (c = 0; c < n; c++) printf("%d\n", array[c]); return 0;
0debug
Fill html element with text bassed on input with javascript : The code right now works only to fill another input field. But I need it to fill regular paragraph and not another input field. How can I do it? # here is html <input type="text" class="first" placeholder="type here"> <input type="text" class="second" placeholder="here it is the reuslt"> # here is js $(".first").on('keydown',function(){ $(".second").val($(this).val()); });
0debug
Kubernetes unknown field "volumes" : <p>I am trying to deploy a simple nginx in kubernetes using hostvolumes. I use the next <strong>yaml</strong>:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: webserver spec: replicas: 1 template: metadata: labels: app: webserver spec: containers: - name: webserver image: nginx:alpine ports: - containerPort: 80 volumeMounts: - name: hostvol mountPath: /usr/share/nginx/html volumes: - name: hostvol hostPath: path: /home/docker/vol </code></pre> <p>When I deploy it <code>kubectl create -f webserver.yaml</code>, it throws the next error:</p> <pre><code>error: error validating "webserver.yaml": error validating data: ValidationError(Deployment.spec.template): unknown field "volumes" in io.k8s.api.core.v1.PodTemplateSpec; if you choose to ignore these errors, turn validation off with --validate=false </code></pre>
0debug
How do I return words from string (1) which starts with char and ends with space and (2) starts with space and ends with space? : <pre>(1) which starts with char and ends with space ? and (2) starts with space and ends with space ? For example: $string = "I am using php regular expressions"; Output: $out = {"I", "am", "using", "php", "regular"}; #expected output Any suggesions. </pre>
0debug
How to add auto play next song option in my android apps? : I want to add automatically play next song option when previous is finished in my android apps. I am trying many code but fail. Plase, give full code, not hints. Here is onClick, LoadSong, StartSong and StopSong Method ---------- public void loadSongs() { JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(URL_SONGS, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { nivAlbumArt.setImageUrl(URL_ALBUM_ART_BIG, imageLoader); Glide.with(AlbumPlayActivity.this).load(URL_ALBUM_ART_BLUR).asBitmap().into(new SimpleTarget<Bitmap>(700,300) { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { Drawable drawable = new BitmapDrawable(resource); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { llList.setBackground(drawable); } } }); for (int i = 0; i < response.length(); i++) { try { JSONObject jObj = response.getJSONObject(i); SongListModel songModel = new SongListModel(); Log.i(">>REQ", jObj.toString()); songModel.setAlbum_id(jObj.getString("album_id")); songModel.setCategory_id(jObj.getString("category_id")); songModel.setId(jObj.getString("id")); songModel.setSinger_id(jObj.getString("singer_id")); songModel.setSong(jObj.getString("song")); songs.add(songModel); startPlaying("http://demo1.zapbd.com/apps/content/mp3/" + songs.get(songID).getSong().replace(" ", "%20")); songs.get(songID).setVisible(true); } catch (JSONException e) { e.printStackTrace(); } } songAdapter.notifyDataSetChanged(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); jsonArrayRequest.setRetryPolicy(new DefaultRetryPolicy( (int) TimeUnit.SECONDS.toMillis(20), DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); // Adding request to request queue AppController.getInstance().addToRequestQueue(jsonArrayRequest); }
0debug
How to run Jupyter notebook on Debian 9 from conda via terminal? (jupyter notebook doesn't work) : <p>I've installed Anaconda2 and now want to run Jupyter. But when I type</p> <pre><code>jupyther notebook </code></pre> <p>it doesn't work (command not found)</p> <p>How to run Jupyther?</p>
0debug
Getting ArrayIndexOutOfBounds error with Java program that tries to guess your next choice (heads or tails) based on previous decisions : <p>I'm making a program that tries to guess if you're going to choose heads(h) or tails(t) based on previous decisions. The program guesses "h" for the first 3 times and after that it looks for the last two choices of the player, goes through the previous choices to find the same combo of decisions and calculates which decision (h or t) has followed this same combo the most times and then chooses that as it's guess. If it guesses your input right it gets a win, if it doesn't the player gets a win. First one to get 25 wins, wins the whole game.</p> <p>The program works fine for the first 3 guesses but when it enters the second while-loop it gives "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -2"</p> <pre><code>import java.util.ArrayList; import java.util.Scanner; public class Guesser { public static void main(String[] args) { Scanner reader = new Scanner(System.in); ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); int last = (list.size() - 1); int secondToLast = (list.size() - 2); int index = 2; int wins = 0; int h = 0; int t = 0; while (wins &lt; 25 &amp;&amp; list.size() - wins &lt; 25) { System.out.println("Type h or t: "); String letter = reader.nextLine(); list.add(letter); String guess = "h"; </code></pre> <p>When the program enters this while-loop below this text, it stops working (this is where the program is supposed to try and compare the last two decisions with all of the previous decisions to try and find same combo of decisions and to figure out which decision (h or t) follows the combo most of the time): </p> <pre><code> while (list.size() &gt; 3 &amp;&amp; index &lt; list.size()) { if (list.get(index - 2).equals(list.get(secondToLast)) &amp;&amp; list.get(index - 1).equals(list.get(last))) { String nextGuess = list.get(index); if (nextGuess.equals("t")) { t++; } else { h++; } } index++; } </code></pre> <p>Everything below here works:</p> <pre><code> if (t &gt; h) { guess = "t"; } System.out.println("You typed " + letter + ", I guessed " + guess +"."); if (guess.equals(letter)) { wins++; } System.out.println("Computer wins: " + wins); System.out.println("Player wins: " + (list.size() - wins)); System.out.println(""); } } } </code></pre>
0debug
static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; int64_t sector_num; unsigned int nb_sectors; if (drv->bdrv_co_preadv) { return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags); } sector_num = offset >> BDRV_SECTOR_BITS; nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS); if (drv->bdrv_co_readv) { return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors, bdrv_co_io_em_complete, &co); if (acb == NULL) { return -EIO; } else { qemu_coroutine_yield(); return co.ret; } } }
1threat
static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof) { int ret = 0, i; int repeating = 0; int eof_reached = 0; AVPacket avpkt; if (!ist->saw_first_ts) { ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; ist->pts = 0; if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); ist->pts = ist->dts; } ist->saw_first_ts = 1; } if (ist->next_dts == AV_NOPTS_VALUE) ist->next_dts = ist->dts; if (ist->next_pts == AV_NOPTS_VALUE) ist->next_pts = ist->pts; if (!pkt) { av_init_packet(&avpkt); avpkt.data = NULL; avpkt.size = 0; } else { avpkt = *pkt; } if (pkt && pkt->dts != AV_NOPTS_VALUE) { ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) ist->next_pts = ist->pts = ist->dts; } while (ist->decoding_needed) { int duration = 0; int got_output = 0; ist->pts = ist->next_pts; ist->dts = ist->next_dts; switch (ist->dec_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: ret = decode_audio (ist, repeating ? NULL : &avpkt, &got_output); break; case AVMEDIA_TYPE_VIDEO: ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, !pkt); if (!repeating || !pkt || got_output) { if (pkt && pkt->duration) { duration = av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0 && ist->dec_ctx->framerate.den != 0) { int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict+1 : ist->dec_ctx->ticks_per_frame; duration = ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; } if(ist->dts != AV_NOPTS_VALUE && duration) { ist->next_dts += duration; }else ist->next_dts = AV_NOPTS_VALUE; } if (got_output) ist->next_pts += duration; break; case AVMEDIA_TYPE_SUBTITLE: if (repeating) break; ret = transcode_subtitles(ist, &avpkt, &got_output); if (!pkt && ret >= 0) ret = AVERROR_EOF; break; default: return -1; } if (ret == AVERROR_EOF) { eof_reached = 1; break; } if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d: %s\n", ist->file_index, ist->st->index, av_err2str(ret)); if (exit_on_error) exit_program(1); if (!pkt) eof_reached = 1; break; } if (got_output) ist->got_output = 1; if (!got_output) break; if (!pkt) break; repeating = 1; } if (!pkt && ist->decoding_needed && eof_reached && !no_eof) { int ret = send_filter_eof(ist); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\n"); exit_program(1); } } if (!ist->decoding_needed) { ist->dts = ist->next_dts; switch (ist->dec_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) / ist->dec_ctx->sample_rate; break; case AVMEDIA_TYPE_VIDEO: if (ist->framerate.num) { AVRational time_base_q = AV_TIME_BASE_Q; int64_t next_dts = av_rescale_q(ist->next_dts, time_base_q, av_inv_q(ist->framerate)); ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q); } else if (pkt->duration) { ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0) { int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame; ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->framerate.den * ticks) / ist->dec_ctx->framerate.num / ist->dec_ctx->ticks_per_frame; } break; } ist->pts = ist->dts; ist->next_pts = ist->next_dts; } for (i = 0; pkt && i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || ost->encoding_needed) continue; do_streamcopy(ist, ost, pkt); } return !eof_reached; }
1threat
Which type can i use in mysql : <p>I am trying to store a number (12,000) in mysql.This number is to be displayed on a webpage and as well be used in calculations.is there any data type that can be used to achieve this.Currently i am using an int data type and it can't showcase commas.i have tried other types but it isn't possible</p>
0debug
How to run python program by bypassing compiled stage : <p>Just curious to know that is it possible to run python program in fully interpreted way where compilation can be skipped</p>
0debug
combining select statements with dates : Please help me, I want my sql Select statement combine in one query <?php Total Assigned = SELECT date(DATE_DISTRIBUTE) , COUNT(DATE_DISTRIBUTE) AS TotalAssigned FROM ata_report_extracted WHERE STATUS ='DISTRIBUTED' GROUP BY date(DATE_DISTRIBUTE) "; Total Handled = "SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalHandled FROM ata_report_extracted WHERE PROS_DESCRIPTION NOT IN ('Open', 'Acknowledged', 'Fallout', 'Cleared') AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; Total Resolved ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalResolved FROM ata_report_extracted WHERE PROS_DESCRIPTION = 'Closed' AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; TotalDispatch ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalDispatch FROM ata_report_extracted WHERE PROS_DESCRIPTION ='Dispatch' AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; TotalPending ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalPending FROM ata_report_extracted WHERE PROS_DESCRIPTION IN ('TOKUNDEROB', 'CALLNOANSWER') AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; ?> <?php Total Assigned = SELECT date(DATE_DISTRIBUTE) , COUNT(DATE_DISTRIBUTE) AS TotalAssigned FROM ata_report_extracted WHERE STATUS ='DISTRIBUTED' GROUP BY date(DATE_DISTRIBUTE) "; Total Handled = "SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalHandled FROM ata_report_extracted WHERE PROS_DESCRIPTION NOT IN ('Open', 'Acknowledged', 'Fallout', 'Cleared') AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; Total Resolved ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalResolved FROM ata_report_extracted WHERE PROS_DESCRIPTION = 'Closed' AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; TotalDispatch ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalDispatch FROM ata_report_extracted WHERE PROS_DESCRIPTION ='Dispatch' AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; TotalPending ="SELECT date(DATE_HANDLED) , COUNT(DATE_HANDLED) AS TotalPending FROM ata_report_extracted WHERE PROS_DESCRIPTION IN ('TOKUNDEROB', 'CALLNOANSWER') AND STATUS ='DISTRIBUTED' GROUP BY date(DATE_HANDLED) "; ?> Display total reports daily in one query
0debug
vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int ret; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, false); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file->bs, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
1threat
progress bar appear before that i click on button to create PDF : why progress bar appear before that i click on button to create PDF? I hope that you can help me! I want that progress bar appear during creation PDF file... THANKS IN ADVANCED EVERYBODY! @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_two, container, false); pdfProgress = (ProgressBar)rootView.findViewById(R.id.progressbar); Button mButton = (Button) rootView.findViewById(R.id.newbutton); mButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //sendemail(); pdfProgress.setVisibility(View.VISIBLE); createPDF(); pdfProgress.setVisibility(View.GONE); viewPDF(); } }); TextView titolo3 = (TextView)rootView.findViewById(R.id.result); TextView titolo2 = (TextView)rootView.findViewById(R.id.result2); TextView titolo4 = (TextView)rootView.findViewById(R.id.resultpizze);
0debug
static void pc_dimm_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { PCMachineState *pcms = PC_MACHINE(hotplug_dev); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); HotplugHandlerClass *hhc; Error *local_err = NULL; hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); if (local_err) { goto out; } pc_dimm_memory_unplug(dev, &pcms->hotplug_memory, mr); object_unparent(OBJECT(dev)); out: error_propagate(errp, local_err); }
1threat
this is a java program to display odd and even characters of a array that shows no output :( : public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan = new Scanner(System.in); int n=scan.nextInt(); String[] inp=new String[10000]; char[][] imArray=new char[10][]; for(int j=0; j<n ; j++) { inp [j]= scan.nextLine(); imArray[j] = inp[j].toCharArray(); } for(int j=0; j<n ; j++) { for(int i=0; i<inp[j].length() ;i=i+2) System.out.println(imArray[i]); for(int k=0; k<inp[j].length() ;k=k+2) System.out.println("\t"+imArray[k]); System.out.println("\n"); } } }
0debug
How can I access a controller's data in another controller in Angular js? : <pre><code>var app = angular.module("myApp",[]); app.controller("CTRL1", function($scope){ $scope.data = [{'name':'Prateek'},{'name':'Agarwal'},{'name': 'Ketan'}]; }) app.controller("CTRL2", function($scope){ $scope.data = [{'name':'Hari'}]; }) </code></pre> <p>I have two controllers - CTRL1 and CTRL2. How can I access data from one controller in another?</p>
0debug
static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val) { SerialState *s = opaque; unsigned char ch; addr &= 7; #ifdef DEBUG_SERIAL printf("serial: write addr=0x%02x val=0x%02x\n", addr, val); #endif switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { s->divider = (s->divider & 0xff00) | val; serial_update_parameters(s); } else { s->thr_ipending = 0; s->lsr &= ~UART_LSR_THRE; serial_update_irq(s); ch = val; if (!(s->mcr & UART_MCR_LOOP)) { qemu_chr_write(s->chr, &ch, 1); } else { serial_receive_byte(s, ch); } if (s->tx_burst > 0) { s->tx_burst--; serial_tx_done(s); } else if (s->tx_burst == 0) { s->tx_burst--; qemu_mod_timer(s->tx_timer, qemu_get_clock(vm_clock) + ticks_per_sec * THROTTLE_TX_INTERVAL / 1000); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { s->divider = (s->divider & 0x00ff) | (val << 8); serial_update_parameters(s); } else { s->ier = val & 0x0f; if (s->lsr & UART_LSR_THRE) { s->thr_ipending = 1; } serial_update_irq(s); } break; case 2: break; case 3: { int break_enable; s->lcr = val; serial_update_parameters(s); break_enable = (val >> 6) & 1; if (break_enable != s->last_break_enable) { s->last_break_enable = break_enable; qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK, &break_enable); } } break; case 4: s->mcr = val & 0x1f; break; case 5: break; case 6: break; case 7: s->scr = val; break; } }
1threat
Avoid scrolling top when validate condition is not meet : <p>I am using jquery-steps for a long form with manu required field. My concern is that each time a condition fails, the page scrolls to the top.</p> <p>It is particularly annoying on the "terms &amp; conditions" pages which is very long, if the user doesn't check the "I agree" checkbox, it has to go to the bottom to retry.</p> <p>Here is my simple code:</p> <pre><code>var form = $("#myform"); form.validate({ errorPlacement: function errorPlacement(error, element) { if (element.attr("name") == "type") { error.appendTo($('#errorbox')); } else { element.before(error); } }, rules: { cgu: { required: true } }, messages: { cgu: { required: 'Vous devez accepter les C.G.U pour poursuivre' } }, focusInvalid: true, onfocusout: function (element) { $(element).valid(); }, }); </code></pre> <p>Even with "focusInvalid: true", the page still scrolls top.</p>
0debug
I want to achieve something like multiple circularimageview's overlapping each other, just like the google plus community page : <p><a href="https://i.stack.imgur.com/phtxB.png" rel="nofollow noreferrer">something like this!</a></p> <p>I want to achieve something like multiple circularimageview's overlapping each other, just like the google plus community page</p>
0debug
How to generate access token for an AWS Cognito user? : <p>I' using Cognito user pool for securing my API gateway . Now I would like to make requests to my API using postman but I need to pass in Authorization token as the API is secured. Is there any AWS CLI command or REST API to generate auth tokens(by passing username/password)? I have searched documentation but couldn't find any examples. Thanks for your help.</p>
0debug
Take Coordinates from json and search on Google map (Android) : <p>I am developing a map application on Android which is about finding best roads. The problem is not all roads name are on Google API so i have it on one JSon file. Which is the best way to get coordinates from JSon file and show it to Android App with lines from position A to B. </p> <pre><code> { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { "Name": "po", "description": "", "timestamp": null, "begin": null, "end": null, "altitudeMode": null, "tessellate": -1, "extrude": 0, "visibility": -1, "drawOrder": null, "icon": null, "description_1": null, "Number": "10", "RoadNameCo": "03_10234", "RoadNameAL": "MEHDI HOXHA" }, "geometry": { "type": "Point", "coordinates": [ 20.853835, 42.601668, 0 ] } }, { "type": "Feature", "properties": { "Name": "po", "description": "", "timestamp": null, "begin": null, "end": null, "altitudeMode": null, "tessellate": -1, "extrude": 0, "visibility": -1, "drawOrder": null, "icon": null, "description_1": null, "Number": "16", "RoadNameCo": "03_10234", "RoadNameAL": "MEHDI HOXHA" }, "geometry": { "type": "Point", "coordinates": [ 20.854006, 42.60127, 0 ] } } ] } </code></pre>
0debug
Get href attribute in pupeteer Node.js : <p>I know the common methods such as <code>evaluate</code> for capturing the elements in <code>puppeteer</code>, but I am curious why I cannot get the <code>href</code> attribute in a JavaScript-like approach as</p> <pre><code>const page = await browser.newPage(); await page.goto('https://www.example.com'); let links = await page.$$('a'); for (let i = 0; i &lt; links.length; i++) { console.log(links[i].getAttribute('href')); console.log(links[i].href); } </code></pre>
0debug
how can i get my session id working : if (mysqli_num_rows($result) == 1) { $_SESSION['id'] = $id; $_SESSION['success'] = "You are now logged in"; header('location: index.php'); }else { array_push($errors, "Wrong username/password combination"); } } help me that how can i echo that my session is working or not and how my session is working
0debug
long do_rt_sigreturn(CPUARMState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr = env->xregs[31]; if (frame_addr & 15) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } if (target_restore_sigframe(env, frame)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return env->xregs[0]; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
1threat
vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; int ret; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_pwritev(bs->file, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, true); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { image_offset = alloc_block(bs, offset); if (image_offset < 0) { ret = image_offset; goto fail; } } qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_pwritev(bs->file, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
1threat
static inline void set_txint(ChannelState *s) { s->txint = 1; if (!s->rxint_under_svc) { s->txint_under_svc = 1; if (s->chn == chn_a) { s->rregs[R_INTR] |= INTR_TXINTA; if (s->wregs[W_MINTR] & MINTR_STATUSHI) s->otherchn->rregs[R_IVEC] = IVEC_HITXINTA; else s->otherchn->rregs[R_IVEC] = IVEC_LOTXINTA; } else { s->rregs[R_IVEC] = IVEC_TXINTB; s->otherchn->rregs[R_INTR] |= INTR_TXINTB; } escc_update_irq(s); } }
1threat
scrollTo is undefined on animated ScrollView : <p>When using <code>Animated.createAnimatedComponent(ScrollView)</code> to create an animated <code>ScrollView</code> it's not longer possible to use <code>scrollTo</code>.</p> <pre><code>const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView); &lt;AnimatedScrollView ref={(ref) =&gt; this.list = ref}&gt; &lt;View style={{height: 1000}} /&gt; &lt;/AnimatedScrollView&gt; </code></pre> <p>Calling <code>this.list.scrollTo({x: 0, y: 0})</code> gives the following error:</p> <p><code>_this.list.scrollTo is not a function</code></p> <p>It works fine on a normal ScrollView. Is there any way to solve this?</p>
0debug
static inline void decode_hrd_parameters(H264Context *h, SPS *sps){ MpegEncContext * const s = &h->s; int cpb_count, i; cpb_count = get_ue_golomb(&s->gb) + 1; get_bits(&s->gb, 4); get_bits(&s->gb, 4); for(i=0; i<cpb_count; i++){ get_ue_golomb(&s->gb); get_ue_golomb(&s->gb); get_bits1(&s->gb); } get_bits(&s->gb, 5); sps->cpb_removal_delay_length = get_bits(&s->gb, 5) + 1; sps->dpb_output_delay_length = get_bits(&s->gb, 5) + 1; sps->time_offset_length = get_bits(&s->gb, 5); }
1threat
void ff_aac_encode_tns_info(AACEncContext *s, SingleChannelElement *sce) { int i, w, filt, coef_len, coef_compress; const int coef_res = MAX_LPC_PRECISION == 4 ? 1 : 0; const int is8 = sce->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE; put_bits(&s->pb, 1, !!sce->tns.present); if (!sce->tns.present) return; for (i = 0; i < sce->ics.num_windows; i++) { put_bits(&s->pb, 2 - is8, sce->tns.n_filt[i]); if (sce->tns.n_filt[i]) { put_bits(&s->pb, 1, !!coef_res); for (filt = 0; filt < sce->tns.n_filt[i]; filt++) { put_bits(&s->pb, 6 - 2 * is8, sce->tns.length[i][filt]); put_bits(&s->pb, 5 - 2 * is8, sce->tns.order[i][filt]); if (sce->tns.order[i][filt]) { coef_compress = compress_coef(sce->tns.coef_idx[i][filt], sce->tns.order[i][filt]); put_bits(&s->pb, 1, !!sce->tns.direction[i][filt]); put_bits(&s->pb, 1, !!coef_compress); coef_len = coef_res + 3 - coef_compress; for (w = 0; w < sce->tns.order[i][filt]; w++) put_bits(&s->pb, coef_len, sce->tns.coef_idx[i][filt][w]); } } } } }
1threat
Angular UI - set active tab programmatically : <p>I using AngularUI with this code:</p> <pre><code>&lt;uib-tabset type="pills"&gt; &lt;uib-tab heading="Tab 1"&gt;Tab 1 content&lt;/uib-tab&gt; &lt;uib-tab heading="Tab 2"&gt;Tab 2 content&lt;/uib-tab&gt; &lt;/uib-tabset&gt; </code></pre> <p>I want to programmatically change the current active tag from my angular-controller code. For example, select tab "2" to be the active. </p> <p>How this can be done?</p>
0debug
static int pbm_pci_host_init(PCIDevice *d) { pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_SUN); pci_config_set_device_id(d->config, PCI_DEVICE_ID_SUN_SABRE); pci_set_word(d->config + PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); pci_set_word(d->config + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); return 0; }
1threat
Unrecognized font family on iOS simulator with React Native : <p>I've added Linux Biolinum fonts (<a href="http://www.dafont.com/linux-biolinum.font" rel="noreferrer">http://www.dafont.com/linux-biolinum.font</a>, LinBiolinum_R.ttf, LinBiolinum_RB.ttf) to my React Native project. Android version is OK. But on iOS I always see error <em>"Unrecognized font family LinBiolinum_R"</em>.</p> <p><a href="https://i.stack.imgur.com/MRD8Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MRD8Y.png" alt="enter image description here"></a></p> <p>My style is:</p> <pre><code>customFontRegular: { fontFamily: 'LinBiolinum_R', }, </code></pre> <p>I've tryied to rename font file and font family to "MyFont", but the error appears again on iOS.</p> <p>Any ideas?</p>
0debug
Why do GetParent(hwnd) and (HWND)::GetWindowLongPtr(hwnd, GW_OWNER) for top level windows give different results? : I've been looking into how the Window hierarchy works and have found an inconsistency. The values returned by the two function calls `GetParent(hwnd)` and `(HWND)::GetWindowLongPtr(hwnd, GW_OWNER)` though, mostly agree, don't always. `GetParent(hwnd)` would return a `HWND` of `GetDesktopWindow()`, but `(HWND)::GetWindowLongPtr(hwnd, GW_OWNER)` would return `nullptr`. I've seen this in window class `#32770` in `AVGUI.exe` and window class `ComboLBox` in `explorer.exe` and `notepad++.exe`. Is this an error in the code that made/interact with those windows?
0debug
how to run a long VBA macro with multiple opned workbooks : I got a use case which I can't figure out a solution to implement and handle it. My application (first workbook file) code processes a long file. It takes a longtime (say 15 min) and bore the user to wait for the end. The user switches to another workbook (second workbook file) while the process is running. When the process ends, the application uses a reference to a sheet in the first workbook and miserably fails. How can I handle this situation without hard coding the first file name?
0debug
PHP SHA1 function in Java : <p>I was wondering if there is any way to get the PHP SHA1 with raw returning in Java. Just like this in PHP: sha1("abc123", true) Anyone got an idea? It would be appreciated very much.</p>
0debug
Woocommerce extra cost based on total number of items in the car : I am looking for some code which can make an extra charge based on the number of items in the cart. Eg:- If number of items in cart is > 6 => extra cost=5 If number of items in cart is > 12 => extra cost=10 Like That.Please note that this extra cost has nothing to do with the shipping charge.
0debug
static void vmsvga_init(struct vmsvga_state_s *s, MemoryRegion *address_space, MemoryRegion *io) { s->scratch_size = SVGA_SCRATCH_SIZE; s->scratch = g_malloc(s->scratch_size * 4); s->vga.con = graphic_console_init(vmsvga_update_display, vmsvga_invalidate_display, vmsvga_screen_dump, vmsvga_text_update, s); s->fifo_size = SVGA_FIFO_SIZE; memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size); vmstate_register_ram_global(&s->fifo_ram); s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram); vga_common_init(&s->vga); vga_init(&s->vga, address_space, io, true); vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga); s->new_depth = 32; }
1threat
static void do_key_event(VncState *vs, int down, int keycode, int sym) { switch(keycode) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: if (down) vs->modifiers_state[keycode] = 1; else vs->modifiers_state[keycode] = 0; break; case 0x02 ... 0x0a: if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) { reset_keys(vs); console_select(keycode - 0x02); return; break; case 0x3a: case 0x45: if (!down) vs->modifiers_state[keycode] ^= 1; break; if (keycode_is_keypad(vs->vd->kbd_layout, keycode)) { if (down) { int numlock = vs->modifiers_state[0x45]; switch (keycode) { case 0x2a: case 0x36: case 0x1d: case 0x9d: case 0x38: case 0xb8: break; case 0xc8: kbd_put_keysym(QEMU_KEY_UP); break; case 0xd0: kbd_put_keysym(QEMU_KEY_DOWN); break; case 0xcb: kbd_put_keysym(QEMU_KEY_LEFT); break; case 0xcd: kbd_put_keysym(QEMU_KEY_RIGHT); break; case 0xd3: kbd_put_keysym(QEMU_KEY_DELETE); break; case 0xc7: kbd_put_keysym(QEMU_KEY_HOME); break; case 0xcf: kbd_put_keysym(QEMU_KEY_END); break; case 0xc9: kbd_put_keysym(QEMU_KEY_PAGEUP); break; case 0xd1: kbd_put_keysym(QEMU_KEY_PAGEDOWN); break; case 0x47: kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME); break; case 0x48: kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP); break; case 0x49: kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP); break; case 0x4b: kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT); break; case 0x4c: kbd_put_keysym('5'); break; case 0x4d: kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT); break; case 0x4f: kbd_put_keysym(numlock ? '1' : QEMU_KEY_END); break; case 0x50: kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN); break; case 0x51: kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN); break; case 0x52: kbd_put_keysym('0'); break; case 0x53: kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE); break; case 0xb5: kbd_put_keysym('/'); break; case 0x37: kbd_put_keysym('*'); break; case 0x4a: kbd_put_keysym('-'); break; case 0x4e: kbd_put_keysym('+'); break; case 0x9c: kbd_put_keysym('\n'); break; default: kbd_put_keysym(sym); break;
1threat
int ff_socket(int af, int type, int proto) { int fd; #ifdef SOCK_CLOEXEC fd = socket(af, type | SOCK_CLOEXEC, proto); if (fd == -1 && errno == EINVAL) #endif { fd = socket(af, type, proto); #if HAVE_FCNTL if (fd != -1) fcntl(fd, F_SETFD, FD_CLOEXEC); #endif } return fd; }
1threat
Aml *aml_local(int num) { Aml *var; uint8_t op = 0x60 + num; assert(num <= 7); var = aml_opcode(op); return var; }
1threat
Need to Update EF Core Tools : <p>When I use the dotnet ef tools in the VS 2017 Package Manager Console I get a warning message about needing to update EF Core tools:</p> <pre><code>PM&gt; dotnet ef migrations list -s ../RideMonitorSite The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.2-rtm-30932'. Update the tools for the latest features and bug fixes. 20180831043252_Initial </code></pre> <p>But my csproj file has this entry:</p> <pre><code> &lt;ItemGroup&gt; &lt;DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.2" /&gt; &lt;/ItemGroup&gt; </code></pre> <p>I've confirmed that the version installed is, in fact, out of date:</p> <pre><code>PM&gt; dotnet ef --version Entity Framework Core .NET Command-line Tools 2.1.1-rtm-30846 </code></pre> <p>So what do I do to update the tools? BTW, I've seen in other answers that an out of date global.json file can cause this problem. But I don't have a global.json file anywhere in the solution.</p>
0debug
void qmp_guest_suspend_disk(Error **errp) { Error *local_err = NULL; GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_DISK; check_suspend_mode(*mode, &local_err); acquire_privilege(SE_SHUTDOWN_NAME, &local_err); execute_async(do_suspend, mode, &local_err); if (local_err) { error_propagate(errp, local_err); g_free(mode); } }
1threat
How do i Filter a four levels array? : I have an object like this: let accessArray = [ { id: 1, restrictions: [ canAccess: true, users: [ name: 'user' accessLevel: [ 10, 20, 30 ] ] ] }, { id: 2, restrictions: [ canAccess: true, users: [ name: 'user2' accessLevel: [ 10, 20 ] ] ] } ] I would like to know how I filter to get only the `accessArray` items that contains the `accessLevel` **30** which in the example is the item with `id = 1`.Thanks.
0debug
int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { int len, nb_components, i, width, height, bits, pix_fmt_id, ret; int h_count[MAX_COMPONENTS]; int v_count[MAX_COMPONENTS]; s->cur_scan = 0; s->upscale_h = s->upscale_v = 0; len = get_bits(&s->gb, 16); s->avctx->bits_per_raw_sample = bits = get_bits(&s->gb, 8); if (s->pegasus_rct) bits = 9; if (bits == 9 && !s->pegasus_rct) s->rct = 1; if(s->lossless && s->avctx->lowres){ av_log(s->avctx, AV_LOG_ERROR, "lowres is not possible with lossless jpeg\n"); return -1; height = get_bits(&s->gb, 16); width = get_bits(&s->gb, 16); if (s->avctx->codec_id == AV_CODEC_ID_AMV && (height&15)) avpriv_request_sample(s->avctx, "non mod 16 height AMV\n"); if (s->interlaced && s->width == width && s->height == height + 1) height= s->height; av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height); if (av_image_check_size(width, height, 0, s->avctx)) nb_components = get_bits(&s->gb, 8); if (nb_components <= 0 || nb_components > MAX_COMPONENTS) return -1; if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (nb_components != s->nb_components) { av_log(s->avctx, AV_LOG_ERROR, "nb_components changing in interlaced picture\n"); if (s->ls && !(bits <= 8 || nb_components == 1)) { avpriv_report_missing_feature(s->avctx, "JPEG-LS that is not <= 8 " "bits/component or 16-bit gray"); return AVERROR_PATCHWELCOME; s->nb_components = nb_components; s->h_max = 1; s->v_max = 1; memset(h_count, 0, sizeof(h_count)); memset(v_count, 0, sizeof(v_count)); for (i = 0; i < nb_components; i++) { s->component_id[i] = get_bits(&s->gb, 8) - 1; h_count[i] = get_bits(&s->gb, 4); v_count[i] = get_bits(&s->gb, 4); if (h_count[i] > s->h_max) s->h_max = h_count[i]; if (v_count[i] > s->v_max) s->v_max = v_count[i]; s->quant_index[i] = get_bits(&s->gb, 8); if (s->quant_index[i] >= 4) { av_log(s->avctx, AV_LOG_ERROR, "quant_index is invalid\n"); if (!h_count[i] || !v_count[i]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid sampling factor in component %d %d:%d\n", i, h_count[i], v_count[i]); av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", i, h_count[i], v_count[i], s->component_id[i], s->quant_index[i]); if (s->ls && (s->h_max > 1 || s->v_max > 1)) { avpriv_report_missing_feature(s->avctx, "Subsampling in JPEG-LS"); return AVERROR_PATCHWELCOME; if ( width != s->width || height != s->height || bits != s->bits || memcmp(s->h_count, h_count, sizeof(h_count)) || memcmp(s->v_count, v_count, sizeof(v_count))) { s->width = width; s->height = height; s->bits = bits; memcpy(s->h_count, h_count, sizeof(h_count)); memcpy(s->v_count, v_count, sizeof(v_count)); s->interlaced = 0; s->got_picture = 0; if (s->first_picture && s->org_height != 0 && s->height < ((s->org_height * 3) / 4)) { s->interlaced = 1; s->bottom_field = s->interlace_polarity; s->picture_ptr->interlaced_frame = 1; s->picture_ptr->top_field_first = !s->interlace_polarity; height *= 2; ret = ff_set_dimensions(s->avctx, width, height); if (ret < 0) return ret; s->first_picture = 0; if (s->got_picture && s->interlaced && (s->bottom_field == !s->interlace_polarity)) { if (s->progressive) { avpriv_request_sample(s->avctx, "progressively coded interlaced picture"); } else{ if (s->v_max == 1 && s->h_max == 1 && s->lossless==1 && (nb_components==3 || nb_components==4)) s->rgb = 1; else if (!s->lossless) s->rgb = 0; pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) | (s->h_count[1] << 20) | (s->v_count[1] << 16) | (s->h_count[2] << 12) | (s->v_count[2] << 8) | (s->h_count[3] << 4) | s->v_count[3]; av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id); if (!(pix_fmt_id & 0xD0D0D0D0)) pix_fmt_id -= (pix_fmt_id & 0xF0F0F0F0) >> 1; if (!(pix_fmt_id & 0x0D0D0D0D)) pix_fmt_id -= (pix_fmt_id & 0x0F0F0F0F) >> 1; for (i = 0; i < 8; i++) { int j = 6 + (i&1) - (i&6); int is = (pix_fmt_id >> (4*i)) & 0xF; int js = (pix_fmt_id >> (4*j)) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> ( 8 + 4*(i&1))) & 0xF; if (is == 1 && js != 2 && (i < 2 || i > 5)) js = (pix_fmt_id >> (16 + 4*(i&1))) & 0xF; if (is == 1 && js == 2) { if (i & 1) s->upscale_h |= 1 << (j/2); else s->upscale_v |= 1 << (j/2); switch (pix_fmt_id) { case 0x11111100: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_BGR48; else { if (s->component_id[0] == 'Q' && s->component_id[1] == 'F' && s->component_id[2] == 'A') { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_GBRP : AV_PIX_FMT_GBRP16; } else { if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 3); break; case 0x11111111: if (s->rgb) s->avctx->pix_fmt = s->bits <= 9 ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA64; else { if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; } else { s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x22111122: if (s->adobe_transform == 0 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; } else if (s->adobe_transform == 2 && s->bits <= 8) { s->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; s->upscale_v = 6; s->upscale_h = 6; s->chroma_height = s->height; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; } else { if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUVA420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; av_assert0(s->nb_components == 4); break; case 0x12121100: case 0x22122100: case 0x21211100: case 0x22211200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = s->height; break; case 0x22221100: case 0x22112200: case 0x11222200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x11000000: case 0x13000000: case 0x14000000: case 0x31000000: case 0x33000000: case 0x34000000: case 0x41000000: case 0x43000000: case 0x44000000: if(s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; break; case 0x12111100: case 0x14121200: case 0x22211100: case 0x22112100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; s->chroma_height = (s->height + 1) / 2; break; case 0x21111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV422P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22121100: case 0x22111200: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; case 0x22111100: case 0x42111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P; else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; if (pix_fmt_id == 0x42111100) { s->upscale_h = 6; s->chroma_height = (s->height + 1) / 2; break; case 0x41111100: if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV411P : AV_PIX_FMT_YUVJ411P; else goto unk_pixfmt; s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; break; default: unk_pixfmt: av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id); s->upscale_h = s->upscale_v = 0; return AVERROR_PATCHWELCOME; if ((s->upscale_h || s->upscale_v) && s->avctx->lowres) { av_log(s->avctx, AV_LOG_ERROR, "lowres not supported for weird subsampling\n"); return AVERROR_PATCHWELCOME; if (s->ls) { s->upscale_h = s->upscale_v = 0; if (s->nb_components > 1) s->avctx->pix_fmt = AV_PIX_FMT_RGB24; else if (s->palette_index && s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_PAL8; else if (s->bits <= 8) s->avctx->pix_fmt = AV_PIX_FMT_GRAY8; else s->avctx->pix_fmt = AV_PIX_FMT_GRAY16; s->pix_desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); if (!s->pix_desc) { av_log(s->avctx, AV_LOG_ERROR, "Could not get a pixel format descriptor.\n"); return AVERROR_BUG; av_frame_unref(s->picture_ptr); if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) return -1; s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; s->got_picture = 1; for (i = 0; i < 4; i++) s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced; av_dlog(s->avctx, "%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height); if (len != (8 + (3 * nb_components))) av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); if (s->rgb && !s->lossless && !s->ls) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n"); return AVERROR_PATCHWELCOME; if (s->progressive) { int bw = (width + s->h_max * 8 - 1) / (s->h_max * 8); int bh = (height + s->v_max * 8 - 1) / (s->v_max * 8); for (i = 0; i < s->nb_components; i++) { int size = bw * bh * s->h_count[i] * s->v_count[i]; av_freep(&s->blocks[i]); av_freep(&s->last_nnz[i]); s->blocks[i] = av_mallocz_array(size, sizeof(**s->blocks)); s->last_nnz[i] = av_mallocz_array(size, sizeof(**s->last_nnz)); if (!s->blocks[i] || !s->last_nnz[i]) return AVERROR(ENOMEM); s->block_stride[i] = bw * s->h_count[i]; memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); return 0;
1threat
Why am I getting 'name is not defined' - beginner : I'm very new at coding and struggling to understand why this gives me name 'month' is not defined I'm trying to convert input(10, 5, 2017) to October 5, 2017 for example def problem3_3(month, day, year): months_tuple = ('January', 'February', 'March','April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') A = months_tuple[month-1] B = str(day) C = str(year) print("A", +"B,"+"C")
0debug
React JS: What means: "this.setState(defaultDogs);" in this code? : I'm evaluating a React application (see the code below). I know what is the meaning of setState props etc. and the overall working of it but I miss the meaning of the following: "this.setState(defaultDogs);" I wondered if that is a shorthand of the standard state update. I'm unsure if that update the Dogs state or add a new one instead. React 16 Here's the code where is that statement that is followed by // <<<<<<<<<<: import React, { Component } from 'react'; import Dogs from './components/Dogs'; import DogItem from './components/DogItem'; import AddDog from './components/AddDog'; import './App.css'; class App extends Component { constructor() { super(); this.state = { dogs: [] }; } getDogs() { var defaultDogs = {dogs: [ { name: 'Princess', breed: 'Corgi', image: 'https://s-media-cache-ak0.pinimg.com/originals/51/ae/30/51ae30b78696b33a64661fa3ac205b3b.jpg' }, { name: 'Riley', breed: 'Husky', image: 'http://portland.ohsohandy.com/images/uploads/93796/m/nice-and-sweet-siberian-husky-puppies-for-free-adoption.jpg' }, ]}; this.setState(defaultDogs); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } componentWillMount() { this.getDogs(); } handleAddDog(dog) { let dogs = this.state.dogs; dogs.push(dog); this.setState({dogs:dogs}); } handleDeleteDog(name) { let dogs = this.state.dogs; let index = dogs.findIndex(x => x.name === name); dogs.splice(index, 1); this.setState({dogs:dogs}); } render() { return ( <div className="App"> <Dogs dogs={this.state.dogs} onDelete={this.handleDeleteDog.bind(this)} /> <AddDog addDog={this.handleAddDog.bind(this)} /> <hr /> </div> ); } } export default App;
0debug
Linking GitHub to project : <p>On my Cmd interface, i input the command git init in the directory of my folder to link but the cmd return Git is not recognized as an internal or external command</p> <p>Please what should i try next?</p>
0debug
does not conform to protocol Decodable / Codable : <p>I'm using the following struct:</p> <pre><code>struct Item : Codable { var category:String var birthDate:Date var switch:Bool var weightNew: [Weight] var weightOld: Array&lt;Double&gt; var createdAt:Date var itemIdentifier:UUID var completed:Bool func saveItem() { DataManager.save(self, with: itemIdentifier.uuidString) } func deleteItem() { DataManager.delete(itemIdentifier.uuidString) } mutating func markAsCompleted() { self.completed = true DataManager.save(self, with: itemIdentifier.uuidString) } } </code></pre> <p>And for weight:</p> <pre><code>struct Weight { var day:Int var weight:Double var type:Bool } </code></pre> <p>After changing weightOld to weightNew I get two errors: - Type 'Item' does not conform to protocol 'Decodable' - Type 'Item' does not conform to protocol 'Codable'</p> <p>If I leave out 'var weightNew: [Weight]' it works. Don't know what is happening and how to solve it... Help is appreciated. </p>
0debug
Microsoft visual stdio 2012 in ubuntu : lately I shift my work from windows to Ubuntu, the problem is I was use a Microsoft visual stdio 2012 now I don't know how to install in Ubuntu.
0debug
Make custom button on Tab Bar rounded : <p>Here is what I am trying to do: <a href="https://i.stack.imgur.com/abwu9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/abwu9.png" alt="enter image description here"></a></p> <p>Note: The screenshot is taken from an earlier version of iOS</p> <p>What I have been able to achieve: <a href="https://i.stack.imgur.com/N8LtN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N8LtN.png" alt="enter image description here"></a></p> <p>Code:</p> <pre><code> override func viewWillAppear(animated: Bool) { // Creates image of the Button let imageCameraButton: UIImage! = UIImage(named: "cameraIcon") // Creates a Button let cameraButton = UIButton(type: .Custom) // Sets width and height to the Button cameraButton.frame = CGRectMake(0.0, 0.0, imageCameraButton.size.width, imageCameraButton.size.height); // Sets image to the Button cameraButton.setBackgroundImage(imageCameraButton, forState: .Normal) // Sets the center of the Button to the center of the TabBar cameraButton.center = self.tabBar.center // Sets an action to the Button cameraButton.addTarget(self, action: "doSomething", forControlEvents: .TouchUpInside) // Adds the Button to the view self.view.addSubview(cameraButton) } </code></pre> <p>I did try to create a rounded button in the normal way, but this was the result:</p> <p><a href="https://i.stack.imgur.com/HR104.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HR104.png" alt="enter image description here"></a></p> <p>Code Snippet for rounded button:</p> <pre><code>//Creation of Ronded Button cameraButton.layer.cornerRadius = cameraButton.frame.size.width/2 cameraButton.clipsToBounds = true </code></pre>
0debug
static uint64_t megasas_mmio_read(void *opaque, target_phys_addr_t addr, unsigned size) { MegasasState *s = opaque; uint32_t retval = 0; switch (addr) { case MFI_IDB: retval = 0; break; case MFI_OMSG0: case MFI_OSP0: retval = (megasas_use_msix(s) ? MFI_FWSTATE_MSIX_SUPPORTED : 0) | (s->fw_state & MFI_FWSTATE_MASK) | ((s->fw_sge & 0xff) << 16) | (s->fw_cmds & 0xFFFF); break; case MFI_OSTS: if (megasas_intr_enabled(s) && s->doorbell) { retval = MFI_1078_RM | 1; } break; case MFI_OMSK: retval = s->intr_mask; break; case MFI_ODCR0: retval = s->doorbell; break; default: trace_megasas_mmio_invalid_readl(addr); break; } trace_megasas_mmio_readl(addr, retval); return retval; }
1threat
In the following javascript code, why variable that is not accessible to func function? : <pre><code>var func=function(){console.log(that)} var obj = { foo(){ var that=this; var a=func; a(); } } obj.foo(); </code></pre> <p><strong>Result :</strong> </p> <p><em>Uncaught ReferenceError: that is not defined</em></p>
0debug
List of apps and services? : <p>I was looking for a list of apps and services. I need this so I can search through a database of reviews and see what apps and services people mention so I can keep track of them. For example "The app does not work with netflix on" I need a word list that has things like "netflix, craigslist, amazon, etc" so i can keep track. I searched and couldn't find anything.</p>
0debug
static int add_crc_to_array(uint32_t crc, int64_t pts) { if (size_of_array <= number_of_elements) { if (size_of_array == 0) size_of_array = 10; size_of_array *= 2; crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t)); pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t)); if ((crc_array == NULL) || (pts_array == NULL)) { av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n"); return AVERROR(ENOMEM); } } crc_array[number_of_elements] = crc; pts_array[number_of_elements] = pts; number_of_elements++; return 0; }
1threat
C++ Makeshift Uber Application : <p>As the title says, this is supposed to be a makeshift Uber-esque application that asks the user for their name, where they're going, how far away it is, and calculates the cost of the trip. I've been stuck with the last two functions for the last hour and I'm not quite sure what my professor is asking me to do. That, and I'm also not sure if I'm on the right track at all. For the last two functions, "double calc_fare" and "void share_fare_info", these are my instructions:</p> <blockquote> <p>In main(), ask the user to enter their full name. Use code as shown below to accept a string with spaces. getline() is a function available to you from iostream. You do not need–should not try–to create it. In main(), ask the user to enter their destination. Destination will be entered as the full street name. Since street address will include spaces, use code similar to what was given in step 1</p> <p>In main(), ask the user if their destination is within city limits. (In a real scenario, the GPS mapping software would be able to determine this based on the destination address. Since we don’t have that ability, we will simply ask the user).</p> <p>In main(), ask the user to enter the distance of the fare. (In a real scenario, the GPS mapping software would be able to determine this based on the destination address. Since we don’t have that ability, we will simply ask the user).</p> <p>Create a function calc_fare(double distance). This function will calculate the fare as follows: A fixed amount of $10 for distances up to 2 miles. $2.50 per mile for distances over 2 miles and up to 5 miles plus a fixed amount of $5.00. Anything over 5 miles will be charged at $3.50 per mile. Return the amount of the fare based on the above rate table.</p> <p>Create a function calc_fare(double distance, double surcharge). This function calls the calc_fare() function in step 5 and returns a value adding the surcharge to the resulting fare.</p> <p>Create a function calc_fare(double distance, bool local). When local is true, it means that the fare is within city limits. When local is false, it means that the fare goes outside city limits, in which case, an additional $50 surcharge will be added to the fare. Call calc_fare() from Step 5 and calc_fare() from Step 6 within this function, depending on the value of local. Note that the functions given in steps 5-7 are overloaded versions of the calc_fare() function.</p> <p>Essentially, what we are doing in this exercise is creating the calc_fare() functions and calling them with driver calls. Drivers-no pun intended since this is a driving simulation-are basically the execution of functions manually to test that they are working, or calculating correctly. The input values of the calc_fare() functions are being entered manually by the user to test them. In a real use case of the functions, they will be called with distances determined by GPS mapping library calls.</p> <p>Create a function called show_fare_info(string name, string destination, double fare, bool local = true). This function will display the information to the user based on the previous user input. This function shows information; what return type is best to use for this function? Call this function from main() to display the final output. This function gives a different message based on the local variable.</p> </blockquote> <p>Sorry for the wall of text, but the instructions are more clear than I can be.</p> <p><strong>My Code so far:</strong> </p> <pre><code> double calc_fare(double distance); double calc_fare(double distance, double surcharge); double calc_fare(double distance, bool local); void show_fare_info(string fullname, string destination, double fare, bool local = true); int main() { string fullname, destination; double distance; char local; cout &lt;&lt; "Please enter your full name: "; getline(cin, fullname); cout &lt;&lt; "Please enter your desired destination: "; getline(cin, destination); cout &lt;&lt; "How far away is this destination from you? "; getline(cin, distance); cout &lt;&lt; "Is your location within city limits (y/n)? :"; cin &gt;&gt; local; if(local == 'y' || local == 'Y') { fare = calc_fare(distance, true); show_fare_info(fullname, destination, fare); } else if(local == 'n' || local == 'N') { fare = calc_fare(distance, false); show_fare_info(fullname, destination, fare, false); } return 0; } double calc_fare(double distance) { int fare; if (distance &lt;= 2) { fare = 10; } else if (distance &lt;= 5 &amp;&amp; distance &gt;= 2) { fare = (distance * 2.50) + 10; } else if (distance &gt; 5) { fare = (distance * 3.50) + 10; } return fare; } double calc_fare(double distance, double surcharge) { surcharge = 50; if (distance == false) { fare = fare + surcharge; } return fare; } double calc_fare(double distance, bool local) { } void show_fare_info(string fullname, string destination, double fare, bool local = true) { } </code></pre> <p>Any help/suggestion is appreciated. As you can probably tell, I'm quite new to this. </p>
0debug