problem
stringlengths
26
131k
labels
class label
2 classes
Some of the Entris in Sql are Empty I dont want to print them . Can someone Help ? its urgent : i want to print only those entries that are not empty for example amv=video1 and vs=video2 and vidbull is empty and vl is empty to print only amv and vs and if vidbull and vl is not empty they should also print automatically Can Some one help .. please its urgent [Check This Image my coding][1] [1]: http://i.stack.imgur.com/AMXnt.png
0debug
How to create customize plot (Figure) in MATLAB? : <p>I want to create plots based on similar values as attached below.</p> <p><a href="https://i.stack.imgur.com/Y2bQw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y2bQw.jpg" alt="Table"></a></p> <p>The figure should look like as shown below. Here, whenever the weight is 1, the index value should be in color, or bold fonts. </p> <p>Though I am good in plotting graphs in MATLAB, this seems quite tricky.</p> <p>How to do this, a little hint will serve the purpose.</p> <p><a href="https://i.stack.imgur.com/LCpdA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCpdA.jpg" alt="enter image description here"></a></p>
0debug
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { AACAC3ParseContext *s = s1->priv_data; const uint8_t *buf_ptr; int len, sample_rate, bit_rate, channels, samples; *poutbuf = NULL; *poutbuf_size = 0; buf_ptr = buf; while (buf_size > 0) { int size_needed= s->frame_size ? s->frame_size : s->header_size; len = s->inbuf_ptr - s->inbuf; if(len<size_needed){ len = FFMIN(size_needed - len, buf_size); memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; s->inbuf_ptr += len; buf_size -= len; } if (s->frame_size == 0) { if ((s->inbuf_ptr - s->inbuf) == s->header_size) { len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate, &samples); if (len == 0) { memmove(s->inbuf, s->inbuf + 1, s->header_size - 1); s->inbuf_ptr--; } else { s->frame_size = len; avctx->sample_rate = sample_rate; avctx->channels = channels; if(avctx->request_channels > 0 && avctx->request_channels < channels && avctx->request_channels <= 2 && avctx->codec_id == CODEC_ID_AC3) { avctx->channels = avctx->request_channels; } avctx->bit_rate = bit_rate; avctx->frame_size = samples; } } } else { if(s->inbuf_ptr - s->inbuf == s->frame_size){ *poutbuf = s->inbuf; *poutbuf_size = s->frame_size; s->inbuf_ptr = s->inbuf; s->frame_size = 0; break; } } } return buf_ptr - buf; }
1threat
AWS EC2, command line display instance type : <p>Do you guys know if we can display the EC2 instance type using command line?</p> <p>Currently, I only have access to the command line of an EC2 instance. Is there a command line that I can type to display the type of instance. eg, <code>p2.8xLarge</code> or <code>g.16x</code> etc. </p>
0debug
How to make Xcode automatically conform to a protocol : <p>When I use a prototype table view, I always have to conform to the protocol <code>TableViewDataSource</code>. I always forget what methods I need to implement, so I have to look at the source of the protocol every time. This is really time consuming.</p> <p>I think Xcode must have a feature that automatically implements the needed methods for you, right? Just like IntelliJ IDEA, Eclipse, and Visual Studio.</p> <p>I want to know where can I find this feature. If there's isn't, is there a workaround for this? At least I don't have to open the source code of the protocol each time I conform to it.</p> <p>If you don't understand what I mean, here's some code:</p> <p>I have a protocol</p> <pre><code>protocol Hello { func doStuff () } </code></pre> <p>When I conform to it,</p> <pre><code>class MyClass: Hello { } </code></pre> <p>I often don't remember the names of the methods that I need to implement. If Xcode has a feature that turns the above code, into this:</p> <pre><code>class MyClass: Hello { func doStuff () { code } } </code></pre> <p>Now you understand what I mean? I just want to ask where to find such a feature.</p>
0debug
clone and multiply select tag based : i want to show the select tag with its data based on the value of an input number <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> select{ display: block; margin-top: 15px; } <!-- language: lang-html --> <input type="number"> <select> <option> test 1 </option> <option> test 2 </option> <option> test 3 </option> </select> <!-- end snippet -->
0debug
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) { const char *codec_name; AVCodec *p; char buf1[32]; int bitrate; AVRational display_aspect_ratio; if (encode) p = avcodec_find_encoder(enc->codec_id); else p = avcodec_find_decoder(enc->codec_id); if (p) { codec_name = p->name; if (!encode && enc->codec_id == CODEC_ID_MP3) { if (enc->sub_id == 2) codec_name = "mp2"; else if (enc->sub_id == 1) codec_name = "mp1"; } } else if (enc->codec_id == CODEC_ID_MPEG2TS) { codec_name = "mpeg2ts"; } else if (enc->codec_name[0] != '\0') { codec_name = enc->codec_name; } else { if( isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF) && isprint((enc->codec_tag>>16)&0xFF) && isprint((enc->codec_tag>>24)&0xFF)){ snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X", enc->codec_tag & 0xff, (enc->codec_tag >> 8) & 0xff, (enc->codec_tag >> 16) & 0xff, (enc->codec_tag >> 24) & 0xff, enc->codec_tag); } else { snprintf(buf1, sizeof(buf1), "0x%04x", enc->codec_tag); } codec_name = buf1; } switch(enc->codec_type) { case CODEC_TYPE_VIDEO: snprintf(buf, buf_size, "Video: %s%s", codec_name, enc->mb_decision ? " (hq)" : ""); if (enc->pix_fmt != PIX_FMT_NONE) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %s", avcodec_get_pix_fmt_name(enc->pix_fmt)); } if (enc->width) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %dx%d", enc->width, enc->height); if (enc->sample_aspect_ratio.num) { av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, enc->width*enc->sample_aspect_ratio.num, enc->height*enc->sample_aspect_ratio.den, 1024*1024); snprintf(buf + strlen(buf), buf_size - strlen(buf), " [PAR %d:%d DAR %d:%d]", enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); } if(av_log_get_level() >= AV_LOG_DEBUG){ int g= ff_gcd(enc->time_base.num, enc->time_base.den); snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %d/%d", enc->time_base.num/g, enc->time_base.den/g); } } if (encode) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", q=%d-%d", enc->qmin, enc->qmax); } bitrate = enc->bit_rate; break; case CODEC_TYPE_AUDIO: snprintf(buf, buf_size, "Audio: %s", codec_name); if (enc->sample_rate) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %d Hz", enc->sample_rate); } av_strlcat(buf, ", ", buf_size); avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); if (enc->sample_fmt != SAMPLE_FMT_NONE) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt)); } switch(enc->codec_id) { case CODEC_ID_PCM_F64BE: case CODEC_ID_PCM_F64LE: bitrate = enc->sample_rate * enc->channels * 64; break; case CODEC_ID_PCM_S32LE: case CODEC_ID_PCM_S32BE: case CODEC_ID_PCM_U32LE: case CODEC_ID_PCM_U32BE: case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_F32LE: bitrate = enc->sample_rate * enc->channels * 32; break; case CODEC_ID_PCM_S24LE: case CODEC_ID_PCM_S24BE: case CODEC_ID_PCM_U24LE: case CODEC_ID_PCM_U24BE: case CODEC_ID_PCM_S24DAUD: bitrate = enc->sample_rate * enc->channels * 24; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_S16LE_PLANAR: case CODEC_ID_PCM_U16LE: case CODEC_ID_PCM_U16BE: bitrate = enc->sample_rate * enc->channels * 16; break; case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_ZORK: bitrate = enc->sample_rate * enc->channels * 8; break; default: bitrate = enc->bit_rate; break; } break; case CODEC_TYPE_DATA: snprintf(buf, buf_size, "Data: %s", codec_name); bitrate = enc->bit_rate; break; case CODEC_TYPE_SUBTITLE: snprintf(buf, buf_size, "Subtitle: %s", codec_name); bitrate = enc->bit_rate; break; case CODEC_TYPE_ATTACHMENT: snprintf(buf, buf_size, "Attachment: %s", codec_name); bitrate = enc->bit_rate; break; default: snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type); return; } if (encode) { if (enc->flags & CODEC_FLAG_PASS1) snprintf(buf + strlen(buf), buf_size - strlen(buf), ", pass 1"); if (enc->flags & CODEC_FLAG_PASS2) snprintf(buf + strlen(buf), buf_size - strlen(buf), ", pass 2"); } if (bitrate != 0) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %d kb/s", bitrate / 1000); } }
1threat
void dct_unquantize_h263_altivec(MpegEncContext *s, DCTELEM *block, int n, int qscale) { POWERPC_TBL_DECLARE(altivec_dct_unquantize_h263_num, 1); int i, level, qmul, qadd; int nCoeffs; assert(s->block_last_index[n]>=0); POWERPC_TBL_START_COUNT(altivec_dct_unquantize_h263_num, 1); qadd = (qscale - 1) | 1; qmul = qscale << 1; if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; }else qadd = 0; i = 1; nCoeffs= 63; } else { i = 0; nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]; } #ifdef ALTIVEC_USE_REFERENCE_C_CODE for(;i<=nCoeffs;i++) { level = block[i]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[i] = level; } } #else { register const vector short vczero = (const vector short)vec_splat_s16(0); short __attribute__ ((aligned(16))) qmul8[] = { qmul, qmul, qmul, qmul, qmul, qmul, qmul, qmul }; short __attribute__ ((aligned(16))) qadd8[] = { qadd, qadd, qadd, qadd, qadd, qadd, qadd, qadd }; short __attribute__ ((aligned(16))) nqadd8[] = { -qadd, -qadd, -qadd, -qadd, -qadd, -qadd, -qadd, -qadd }; register vector short blockv, qmulv, qaddv, nqaddv, temp1; register vector bool short blockv_null, blockv_neg; register short backup_0 = block[0]; register int j = 0; qmulv = vec_ld(0, qmul8); qaddv = vec_ld(0, qadd8); nqaddv = vec_ld(0, nqadd8); #if 0 for(j = 0; (j <= nCoeffs) && ((((unsigned long)block) + (j << 1)) & 0x0000000F) ; j++) { level = block[j]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[j] = level; } } #endif for(; (j + 7) <= nCoeffs ; j+=8) { blockv = vec_ld(j << 1, block); blockv_neg = vec_cmplt(blockv, vczero); blockv_null = vec_cmpeq(blockv, vczero); temp1 = vec_sel(qaddv, nqaddv, blockv_neg); temp1 = vec_mladd(blockv, qmulv, temp1); blockv = vec_sel(temp1, blockv, blockv_null); vec_st(blockv, j << 1, block); } for(; j <= nCoeffs ; j++) { level = block[j]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[j] = level; } } if (i == 1) { block[0] = backup_0; } } #endif POWERPC_TBL_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63); }
1threat
file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend); if (!backend->size) { error_setg(errp, "can't create backend with size 0"); return; } if (!fb->mem_path) { error_setg(errp, "mem-path property not set"); return; } #ifndef CONFIG_LINUX error_setg(errp, "-mem-path not supported on this host"); #else if (!memory_region_size(&backend->mr)) { backend->force_prealloc = mem_prealloc; memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), object_get_canonical_path(OBJECT(backend)), backend->size, fb->share, fb->mem_path, errp); } #endif }
1threat
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; QtrleContext *s = avctx->priv_data; int header, start_line; int stream_ptr, height, row_ptr; int has_palette = 0; s->buf = buf; s->size = buf_size; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE; if (avctx->reget_buffer(avctx, &s->frame)) { av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } if (s->size < 8) goto done; stream_ptr = 4; header = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 2; if (header & 0x0008) { if(s->size < 14) goto done; start_line = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; height = AV_RB16(&s->buf[stream_ptr]); stream_ptr += 4; } else { start_line = 0; height = s->avctx->height; } row_ptr = s->frame.linesize[0] * start_line; switch (avctx->bits_per_coded_sample) { case 1: case 33: qtrle_decode_1bpp(s, stream_ptr, row_ptr, height); break; case 2: case 34: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2); has_palette = 1; break; case 4: case 36: qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4); has_palette = 1; break; case 8: case 40: qtrle_decode_8bpp(s, stream_ptr, row_ptr, height); has_palette = 1; break; case 16: qtrle_decode_16bpp(s, stream_ptr, row_ptr, height); break; case 24: qtrle_decode_24bpp(s, stream_ptr, row_ptr, height); break; case 32: qtrle_decode_32bpp(s, stream_ptr, row_ptr, height); break; default: av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", avctx->bits_per_coded_sample); break; } if(has_palette) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame.palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } done: *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return buf_size; }
1threat
static void increase_dynamic_storage(IVShmemState *s, int new_min_size) { int j, old_nb_alloc; old_nb_alloc = s->nb_peers; while (new_min_size >= s->nb_peers) s->nb_peers = s->nb_peers * 2; IVSHMEM_DPRINTF("bumping storage to %d guests\n", s->nb_peers); s->peers = g_realloc(s->peers, s->nb_peers * sizeof(Peer)); for (j = old_nb_alloc; j < s->nb_peers; j++) { s->peers[j].eventfds = NULL; s->peers[j].nb_eventfds = 0; } }
1threat
how to remove deleted branch in the result of branch -a? : <p>Even if I run delete branch both locally and remotely, inevitably I still see all those deleted branch whenever I run command 'git branch -a'</p> <p>I want to delete all those branches forever. How could I achieve this?</p>
0debug
dictionary does not contain a definition for contains : <p>I have such code</p> <pre><code>Dictionary&lt;string, Object&gt; dollarSignConvertedVals = TryToConvertAllDollarSigns(TryToConvertAllEnvVar(values)); </code></pre> <p>When I am trying to find out if there contains a value by key like this</p> <pre><code>if (!dollarSignConvertedVals.Contains(JSON_KEYS.CONNECTION_CONFIG)){} </code></pre> <p>I am getting such weird issue</p> <blockquote> <p>Dictionary does not contain a fedination for Contains and the best extension method overload Queryalbe.Contais(IQuerable, string) requeres of type IQueryable</p> </blockquote> <p><a href="https://i.stack.imgur.com/7WIDo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WIDo.png" alt="enter image description here"></a></p> <p>What is the problem here?</p>
0debug
static int usb_wacom_initfn(USBDevice *dev) { USBWacomState *s = DO_UPCAST(USBWacomState, dev, dev); s->dev.speed = USB_SPEED_FULL; s->changed = 1; return 0; }
1threat
static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd) { int i, j; uint8_t tmp[8*11], *tptr; int m, r; m = (mode & 3); r = rnd; src -= stride; tptr = tmp; for(j = 0; j < 11; j++) { for(i = 0; i < 8; i++) tptr[i] = vc1_mspel_filter(src + i, 1, m, r); src += stride; tptr += 8; } r = 1 - rnd; m = (mode >> 2) & 3; tptr = tmp + 8; for(j = 0; j < 8; j++) { for(i = 0; i < 8; i++) dst[i] = vc1_mspel_filter(tptr + i, 8, m, r); dst += stride; tptr += 8; } }
1threat
regex - get last occurrence before match : <p>With regex, from the following sentence</p> <pre><code>my name is oscar my name is oscar my name is oscar my name is david my name is oscar </code></pre> <p>I would like to get the "oscar" immediately previous to david (in this case would be the 3rd "oscar")</p> <p>I've tried many things but none of them have worked.</p> <p>Any ideas? Thanks</p>
0debug
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n"); return AVERROR(EINVAL); } if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); } if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); ret = ff_lock_avcodec(avctx); if (ret < 0) return ret; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; } avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); if (!avctx->internal->pool) { ret = AVERROR(ENOMEM); goto free_and_end; } if (codec->priv_data_size > 0) { if (!avctx->priv_data) { avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_class) { *(const AVClass **)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; if (!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == AV_CODEC_ID_H264)){ if (avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if (avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); } if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); if (avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == AV_CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; } if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n"); ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; AVCodec *codec2; av_log(NULL, AV_LOG_ERROR, "The %s '%s' is experimental but experimental codecs are not enabled, " "add '-strict %d' if you want to use it.\n", codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL)) av_log(NULL, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", codec_string, codec2->name); ret = AVERROR_EXPERIMENTAL; goto free_and_end; } if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS) { ff_unlock_avcodec(); ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); ff_lock_avcodec(avctx); if (ret < 0) goto free_and_end; } if (HAVE_THREADS && !avctx->thread_opaque && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { ret = ff_thread_init(avctx); if (ret < 0) { goto free_and_end; } } if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); goto free_and_end; } if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->channels == 1 && av_get_planar_sample_fmt(avctx->sample_fmt) == av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { avctx->sample_fmt = avctx->codec->sample_fmts[i]; break; } } if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt); av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG) && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { char buf[128]; snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt); av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n", (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf)); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n", avctx->sample_rate); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); ret = AVERROR(EINVAL); goto free_and_end; } } } if (avctx->channel_layout && avctx->channels) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_ERROR, "Channel layout '%s' with %d channels does not match number of specified channels %d\n", buf, channels, avctx->channels); ret = AVERROR(EINVAL); goto free_and_end; } } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec_id != AV_CODEC_ID_PNG ) { if (avctx->width <= 0 || avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "dimensions not set\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) && avctx->bit_rate>0 && avctx->bit_rate<1000) { av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); } if (!avctx->rc_initial_buffer_occupancy) avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; } avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) || avctx->internal->frame_thread_encoder)) { ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; } } ret=0; if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); if (avctx->channel_layout) { int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); if (!avctx->channels) avctx->channels = channels; else if (channels != avctx->channels) { char buf[512]; av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); av_log(avctx, AV_LOG_WARNING, "Channel layout '%s' with %d channels does not match specified number of channels %d: " "ignoring specified channel layout\n", buf, channels, avctx->channels); avctx->channel_layout = 0; } } if (avctx->channels && avctx->channels < 0 || avctx->channels > FF_SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->sub_charenc) { if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { av_log(avctx, AV_LOG_ERROR, "Character encoding is only " "supported with subtitles codecs\n"); ret = AVERROR(EINVAL); goto free_and_end; } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) { av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, " "subtitles character encoding will be ignored\n", avctx->codec_descriptor->name); avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING; } else { if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC) avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER; if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) { #if CONFIG_ICONV iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc); if (cd == (iconv_t)-1) { av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context " "with input character encoding \"%s\"\n", avctx->sub_charenc); ret = AVERROR(errno); goto free_and_end; } iconv_close(cd); #else av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles " "conversion needs a libavcodec built with iconv support " "for this codec\n"); ret = AVERROR(ENOSYS); goto free_and_end; #endif } } } } end: ff_unlock_avcodec(); if (options) { av_dict_free(options); *options = tmp; } return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); if (avctx->internal) av_freep(&avctx->internal->pool); av_freep(&avctx->internal); avctx->codec = NULL; goto end; }
1threat
how to convert a list into a 2d matrix in python? : i have my data in form of list but for easy access i need them to be in matrix of 11rows known as p0-p10 and 4 columns as a,b,c,d. this is my data [[0.078125, 0.328125, 0.328125, 0.265625], [0.171875, 0.390625, 0.140625, 0.296875], [0.109375, 0.015625, 0.015625, 0.859375], [0.859375, 0.015625, 0.109375, 0.015625], [0.953125, 0.015625, 0.015625, 0.015625], [0.015625, 0.015625, 0.234375, 0.734375], [0.046875, 0.921875, 0.015625, 0.015625], [0.109375, 0.421875, 0.109375, 0.359375], [0.140625, 0.484375, 0.359375, 0.015625], [0.078125, 0.296875, 0.421875, 0.203125]] ive tried with numpy but its not working is there any other method???
0debug
static av_cold int pcx_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; return 0; }
1threat
What is the difference between [ ] and ( ) brackets in Racket (lisp programming language)? : <p>It seems to me that technically both are interchangeable but have different conventional meanings.</p>
0debug
Custom mailchimp signup form in React : <p>I have a react app that I would like to add mailchimp signup form to. I am building a custom signup form and have user sign up by entering their first and last name and email. I am not dealing with any campaign stuff. All I am trying to achieve is that once they sign up, they get an email to confirm subscription.</p> <p>I have done what's in the mailchimp guide <a href="http://kb.mailchimp.com/lists/signup-forms/host-your-own-signup-forms" rel="noreferrer">http://kb.mailchimp.com/lists/signup-forms/host-your-own-signup-forms</a> but it's always giving me error 500.</p> <p>Here's the code for the send event</p> <pre><code>subscribe(event) { event.preventDefault(); axios({ url: 'https://xxxxxx.us15.list-manage.com/subscribe/post', method: 'post', data: this.state, dataType: 'json' }) .then(() =&gt; { console.log('success'); }); } </code></pre> <p>and here's the form</p> <pre><code>&lt;form onSubmit={this.subscribe.bind(this)}&gt; &lt;input type="hidden" name="u" value="xxxxxxxxxxx" /&gt; &lt;input type="hidden" name="id" value="xxxxxxxxxxx" /&gt; &lt;label&gt;First Name&lt;/label&gt; &lt;input name="FNAME" type="text" onChange={this.handler.bind(this, 'FNAME')} required="true"/&gt; &lt;label&gt;Last Name&lt;/label&gt; &lt;input name="LNAME" type="text" onChange={this.handler.bind(this, 'LNAME')} required="true"/&gt; &lt;label&gt;Email&lt;/label&gt; &lt;input name="EMAIL" type="email" onChange={this.handler.bind(this, 'EMAIL')} required="true"/&gt; &lt;button type="submit" name="submit"&gt;Subscribe&lt;/button&gt; &lt;/form&gt; </code></pre> <p>I have also tried the suggestion in this link <a href="https://stackoverflow.com/questions/8425701/ajax-mailchimp-signup-form-integration">AJAX Mailchimp signup form integration</a></p> <p>basically passing the u and id along with the url instead of input in the form. but that didn't work either.</p> <p>Anyone has idea on how to make this work? Thanks!!</p>
0debug
What's the correct way to implement login page in Xamarin Shell? : <p>My app has structure like this.</p> <p>Splash page => Login page => Main page</p> <p>After login, user cannot go back to login/splash page. There are several pages in flyout menu that user can go to. However, login/splash items should not be showed in these flyout menu items.</p> <p>Some project may try to load main page first before show login page as a modal page. I think this way doesn't work because it should take so much time to load complex main page before send user back to login.</p>
0debug
static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next) { FrameRateContext *s = ctx->priv; double ret = 0; ff_dlog(ctx, "get_scene_score()\n"); if (crnt->height == next->height && crnt->width == next->width) { int64_t sad; double mafd, diff; ff_dlog(ctx, "get_scene_score() process\n"); if (s->bitdepth == 8) sad = scene_sad8(s, crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->height); else sad = scene_sad16(s, (const uint16_t*)crnt->data[0], crnt->linesize[0] >> 1, (const uint16_t*)next->data[0], next->linesize[0] >> 1, crnt->height); mafd = (double)sad * 100.0 / (crnt->height * crnt->width) / (1 << s->bitdepth); diff = fabs(mafd - s->prev_mafd); ret = av_clipf(FFMIN(mafd, diff), 0, 100.0); s->prev_mafd = mafd; } ff_dlog(ctx, "get_scene_score() result is:%f\n", ret); return ret; }
1threat
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t* filter_coeffs, const int16_t* in, int buffer_length, int filter_length, int stop_on_overflow, int rounder) { int i,n; filter_length++; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i < filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = (sum >> 12) + in[n]; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }
1threat
inline static void RENAME(hcscale)(uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_RGB32) { RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_BGR24) { RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_BGR565) { RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_BGR555) { RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_BGR32) { RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_RGB24) { RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_RGB565) { RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (srcFormat==PIX_FMT_RGB555) { RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if (isGray(srcFormat)) { return; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal); src1= formatConvBuffer; src2= formatConvBuffer+2048; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $4096, %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { dst[i] = src1[srcW-1]*128; dst[i+2048] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, 4096(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc; } #endif } }
1threat
Homebrew PHP appears not to be linked. - Valet : <p>I had a problem which appeared all of the sudden saying: <code>Unable to determine linked PHP.</code> which I could not solve so I uninstalled valet, php and dependencies. Then I installed fresh <code>php7.1</code> but when I run <code>valet install</code> I get quiet slightly similar error: <code>Homebrew PHP appears not to be linked.</code></p>
0debug
static void nam_writew (void *opaque, uint32_t addr, uint32_t val) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; uint32_t index = addr - s->base[0]; s->cas = 0; switch (index) { case AC97_Reset: mixer_reset (s); break; case AC97_Powerdown_Ctrl_Stat: val &= ~0xf; val |= mixer_load (s, index) & 0xf; mixer_store (s, index, val); break; #ifdef USE_MIXER case AC97_Master_Volume_Mute: set_volume (s, index, AUD_MIXER_VOLUME, val); break; case AC97_PCM_Out_Volume_Mute: set_volume (s, index, AUD_MIXER_PCM, val); break; case AC97_Line_In_Volume_Mute: set_volume (s, index, AUD_MIXER_LINE_IN, val); break; case AC97_Record_Select: record_select (s, val); break; #endif case AC97_Vendor_ID1: case AC97_Vendor_ID2: dolog ("Attempt to write vendor ID to %#x\n", val); break; case AC97_Extended_Audio_ID: dolog ("Attempt to write extended audio ID to %#x\n", val); break; case AC97_Extended_Audio_Ctrl_Stat: if (!(val & EACS_VRA)) { mixer_store (s, AC97_PCM_Front_DAC_Rate, 0xbb80); mixer_store (s, AC97_PCM_LR_ADC_Rate, 0xbb80); open_voice (s, PI_INDEX, 48000); open_voice (s, PO_INDEX, 48000); } if (!(val & EACS_VRM)) { mixer_store (s, AC97_MIC_ADC_Rate, 0xbb80); open_voice (s, MC_INDEX, 48000); } dolog ("Setting extended audio control to %#x\n", val); mixer_store (s, AC97_Extended_Audio_Ctrl_Stat, val); break; case AC97_PCM_Front_DAC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front DAC rate to %d\n", val); open_voice (s, PO_INDEX, val); } else { dolog ("Attempt to set front DAC rate to %d, " "but VRA is not set\n", val); } break; case AC97_MIC_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM) { mixer_store (s, index, val); dolog ("Set MIC ADC rate to %d\n", val); open_voice (s, MC_INDEX, val); } else { dolog ("Attempt to set MIC ADC rate to %d, " "but VRM is not set\n", val); } break; case AC97_PCM_LR_ADC_Rate: if (mixer_load (s, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA) { mixer_store (s, index, val); dolog ("Set front LR ADC rate to %d\n", val); open_voice (s, PI_INDEX, val); } else { dolog ("Attempt to set LR ADC rate to %d, but VRA is not set\n", val); } break; default: dolog ("U nam writew %#x <- %#x\n", addr, val); mixer_store (s, index, val); break; } }
1threat
Regular expression : I have this context free grammar : S -> aSb S -> aSa S -> bSa S -> bSb S -> epsilon I want to show that this grammar describes a regular language ( namely can be represented as a regular expression) but I'm not sure how to do that and get the confident I'm not missing any pattern. I did not see this exact question and that why I don't think it is duplicate. I'd like an explanation on this relative simple example. It was hard for me to follow more complicated examples.
0debug
Python: Savefig cuts off title : <p>Hey I try to savefig my plot, but it allways cuts off my title. I think it is because of y=1.05 (to set a distance to the title). I can not fix it. Is there a way to save the entire graph?</p> <pre><code>time=round(t[time_period],0) most_sensitive=sorted(most_sensitive) plt.figure(figsize=(10, 5)) plt.suptitle("Scatterplot "+str(name)+" , "+r'$\Delta$'+"Output , Zeit= "+str(time)+" s",fontsize=20,y=1.05) figure_colour=["bo","ro","go","yo"] for i in [1,2,3,4]: ax=plt.subplot(2,2,i) plt.plot(parm_value[:,most_sensitive[i-1]], Outputdiff[:,most_sensitive[i-1]],figure_colour[i-1]) ax.set_xlabel(name+"["+str(most_sensitive[i-1])+"] in "+str(unit)) ax.set_ylabel(r'$\Delta$'+"Output") lb, ub = ax.get_xlim( ) ax.set_xticks( np.linspace(lb, ub, 4 ) ) lb, ub = ax.get_ylim( ) ax.set_yticks( np.linspace(lb, ub, 8 ) ) ax.grid(True) plt.tight_layout() newpath = r'C:/Users/Tim_s/Desktop/Daten/'+str(name)+'/'+str(time)+'/'+'scatterplot'+'/' if not os.path.exists(newpath): os.makedirs(newpath) savefig(newpath+str(name)+'.png') </code></pre>
0debug
Current URL string parser is deprecated : <p>when I run the code by "node app.js" command this error is showing</p> <p>(node:2509) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.</p>
0debug
android button design for fan and dilmmer contol : [enter image description here][1]How to design button which works like fan regulator pot [1]: https://i.stack.imgur.com/Eezr7.png
0debug
java program that compute the average salary of 20 workers : I've been stuck on this a while, a java program to compute average salary of 20 workers and this what i came up with. please help ............................................................................................................................................................. import java.util.Scanner; class Employee { int age; String name, address, gender; Scanner get = new Scanner(System.in); Employee() { System.out.println("Enter Name of the Employee:"); name = get.nextLine(); System.out.println("Enter Gender of the Employee:"); gender = get.nextLine(); System.out.println("Enter Address of the Employee:"); address = get.nextLine(); System.out.println("Enter Age:"); age = get.nextInt(); } void display() { System.out.println("Employee Name: "+name); System.out.println("Age: "+age); System.out.println("Gender: "+gender); System.out.println("Address: "+address); } } class fullTimeEmployees extends Employee { float salary; int des; fullTimeEmployee() { System.out.println("Enter Designation:"); des = get.nextInt(); System.out.println("Enter Salary:"); salary = get.nextFloat(); } void display() { System.out.println("=============================="+"\n"+"Full Time Employee Details"+"\n"+"=============================="+"\n"); super.display(); System.out.println("Salary: "+salary); System.out.println("Designation: "+des); } } class partTimeEmployees extends Employee { int workinghrs, rate; partTimeEmployees() { System.out.println("Enter Number of Working Hours:"); workinghrs = get.nextInt(); } void calculatepay() { rate = 8 * workinghrs; } void display() { System.out.println("=============================="+"\n"+"Part Time Employee Details"+"\n"+"=============================="+"\n"); super.display(); System.out.println("Number of Working Hours: "+workinghrs); System.out.println("Salary for "+workinghrs+" working hours is: $"+rate); } } class Employees { public static void main(String args[]) { System.out.println("================================"+"\n"+"Enter Full Time Employee Details"+"\n"+"================================"+"\n"); fullTimeEmployees ob1 = new fullTimeEmployees(); partTimeEmployees ob = new partTimeEmployees(); System.out.println("================================"+"\n"+"Enter Part Time Employee Details"+"\n"+"================================"+"\n"); ob1.display(); ob.calculatepay(); ob.display(); } } Please help guys
0debug
Send attachment from Android Device to another automatically - Android studio : I have Android Studio code that creates a new wav file every 30 seconds, I need to send these wav files to another device ( As some sort of notification) as they are made. I can't use the traditional andorid studio default/built-in app for this as I need to send the email automatically without user input. I found a way to send the email automatically in background, from the source below, but I cannot get it to send the wav file attachment: http://www.wisdomitsol.com/blog/android/sending-email-in-android-without-using-the-default-built-in-application Any advice about the best way to achieve this would be greatly appreciated.
0debug
static int kvm_put_vcpu_events(X86CPU *cpu, int level) { CPUX86State *env = &cpu->env; struct kvm_vcpu_events events; if (!kvm_has_vcpu_events()) { return 0; } events.exception.injected = (env->exception_injected >= 0); events.exception.nr = env->exception_injected; events.exception.has_error_code = env->has_error_code; events.exception.error_code = env->error_code; events.exception.pad = 0; events.interrupt.injected = (env->interrupt_injected >= 0); events.interrupt.nr = env->interrupt_injected; events.interrupt.soft = env->soft_interrupt; events.nmi.injected = env->nmi_injected; events.nmi.pending = env->nmi_pending; events.nmi.masked = !!(env->hflags2 & HF2_NMI_MASK); events.nmi.pad = 0; events.sipi_vector = env->sipi_vector; events.flags = 0; if (level >= KVM_PUT_RESET_STATE) { events.flags |= KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VECTOR; } return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_VCPU_EVENTS, &events); }
1threat
void tcg_optimize(TCGContext *s) { int oi, oi_next, nb_temps, nb_globals; TCGOp *prev_mb = NULL; struct tcg_temp_info *infos; TCGTempSet temps_used; nb_temps = s->nb_temps; nb_globals = s->nb_globals; bitmap_zero(temps_used.l, nb_temps); infos = tcg_malloc(sizeof(struct tcg_temp_info) * nb_temps); for (oi = s->gen_op_buf[0].next; oi != 0; oi = oi_next) { tcg_target_ulong mask, partmask, affected; int nb_oargs, nb_iargs, i; TCGArg tmp; TCGOp * const op = &s->gen_op_buf[oi]; TCGOpcode opc = op->opc; const TCGOpDef *def = &tcg_op_defs[opc]; oi_next = op->next; if (opc == INDEX_op_call) { nb_oargs = op->callo; nb_iargs = op->calli; for (i = 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts) { init_ts_info(infos, &temps_used, ts); } } } else { nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; for (i = 0; i < nb_oargs + nb_iargs; i++) { init_arg_info(infos, &temps_used, op->args[i]); } } for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts && ts_is_copy(ts)) { op->args[i] = temp_arg(find_better_copy(s, ts)); } } switch (opc) { CASE_OP_32_64(add): CASE_OP_32_64(mul): CASE_OP_32_64(and): CASE_OP_32_64(or): CASE_OP_32_64(xor): CASE_OP_32_64(eqv): CASE_OP_32_64(nand): CASE_OP_32_64(nor): CASE_OP_32_64(muluh): CASE_OP_32_64(mulsh): swap_commutative(op->args[0], &op->args[1], &op->args[2]); break; CASE_OP_32_64(brcond): if (swap_commutative(-1, &op->args[0], &op->args[1])) { op->args[2] = tcg_swap_cond(op->args[2]); } break; CASE_OP_32_64(setcond): if (swap_commutative(op->args[0], &op->args[1], &op->args[2])) { op->args[3] = tcg_swap_cond(op->args[3]); } break; CASE_OP_32_64(movcond): if (swap_commutative(-1, &op->args[1], &op->args[2])) { op->args[5] = tcg_swap_cond(op->args[5]); } if (swap_commutative(op->args[0], &op->args[4], &op->args[3])) { op->args[5] = tcg_invert_cond(op->args[5]); } break; CASE_OP_32_64(add2): swap_commutative(op->args[0], &op->args[2], &op->args[4]); swap_commutative(op->args[1], &op->args[3], &op->args[5]); break; CASE_OP_32_64(mulu2): CASE_OP_32_64(muls2): swap_commutative(op->args[0], &op->args[2], &op->args[3]); break; case INDEX_op_brcond2_i32: if (swap_commutative2(&op->args[0], &op->args[2])) { op->args[4] = tcg_swap_cond(op->args[4]); } break; case INDEX_op_setcond2_i32: if (swap_commutative2(&op->args[1], &op->args[3])) { op->args[5] = tcg_swap_cond(op->args[5]); } break; default: break; } switch (opc) { CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): if (arg_is_const(op->args[1]) && arg_info(op->args[1])->val == 0) { tcg_opt_gen_movi(s, op, op->args[0], 0); continue; } break; CASE_OP_32_64(sub): { TCGOpcode neg_op; bool have_neg; if (arg_is_const(op->args[2])) { break; } if (opc == INDEX_op_sub_i32) { neg_op = INDEX_op_neg_i32; have_neg = TCG_TARGET_HAS_neg_i32; } else { neg_op = INDEX_op_neg_i64; have_neg = TCG_TARGET_HAS_neg_i64; } if (!have_neg) { break; } if (arg_is_const(op->args[1]) && arg_info(op->args[1])->val == 0) { op->opc = neg_op; reset_temp(op->args[0]); op->args[1] = op->args[2]; continue; } } break; CASE_OP_32_64(xor): CASE_OP_32_64(nand): if (!arg_is_const(op->args[1]) && arg_is_const(op->args[2]) && arg_info(op->args[2])->val == -1) { i = 1; goto try_not; } break; CASE_OP_32_64(nor): if (!arg_is_const(op->args[1]) && arg_is_const(op->args[2]) && arg_info(op->args[2])->val == 0) { i = 1; goto try_not; } break; CASE_OP_32_64(andc): if (!arg_is_const(op->args[2]) && arg_is_const(op->args[1]) && arg_info(op->args[1])->val == -1) { i = 2; goto try_not; } break; CASE_OP_32_64(orc): CASE_OP_32_64(eqv): if (!arg_is_const(op->args[2]) && arg_is_const(op->args[1]) && arg_info(op->args[1])->val == 0) { i = 2; goto try_not; } break; try_not: { TCGOpcode not_op; bool have_not; if (def->flags & TCG_OPF_64BIT) { not_op = INDEX_op_not_i64; have_not = TCG_TARGET_HAS_not_i64; } else { not_op = INDEX_op_not_i32; have_not = TCG_TARGET_HAS_not_i32; } if (!have_not) { break; } op->opc = not_op; reset_temp(op->args[0]); op->args[1] = op->args[i]; continue; } default: break; } switch (opc) { CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): CASE_OP_32_64(or): CASE_OP_32_64(xor): CASE_OP_32_64(andc): if (!arg_is_const(op->args[1]) && arg_is_const(op->args[2]) && arg_info(op->args[2])->val == 0) { tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); continue; } break; CASE_OP_32_64(and): CASE_OP_32_64(orc): CASE_OP_32_64(eqv): if (!arg_is_const(op->args[1]) && arg_is_const(op->args[2]) && arg_info(op->args[2])->val == -1) { tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); continue; } break; default: break; } mask = -1; affected = -1; switch (opc) { CASE_OP_32_64(ext8s): if ((arg_info(op->args[1])->mask & 0x80) != 0) { break; } CASE_OP_32_64(ext8u): mask = 0xff; goto and_const; CASE_OP_32_64(ext16s): if ((arg_info(op->args[1])->mask & 0x8000) != 0) { break; } CASE_OP_32_64(ext16u): mask = 0xffff; goto and_const; case INDEX_op_ext32s_i64: if ((arg_info(op->args[1])->mask & 0x80000000) != 0) { break; } case INDEX_op_ext32u_i64: mask = 0xffffffffU; goto and_const; CASE_OP_32_64(and): mask = arg_info(op->args[2])->mask; if (arg_is_const(op->args[2])) { and_const: affected = arg_info(op->args[1])->mask & ~mask; } mask = arg_info(op->args[1])->mask & mask; break; case INDEX_op_ext_i32_i64: if ((arg_info(op->args[1])->mask & 0x80000000) != 0) { break; } case INDEX_op_extu_i32_i64: mask = (uint32_t)arg_info(op->args[1])->mask; break; CASE_OP_32_64(andc): if (arg_is_const(op->args[2])) { mask = ~arg_info(op->args[2])->mask; goto and_const; } mask = arg_info(op->args[1])->mask; break; case INDEX_op_sar_i32: if (arg_is_const(op->args[2])) { tmp = arg_info(op->args[2])->val & 31; mask = (int32_t)arg_info(op->args[1])->mask >> tmp; } break; case INDEX_op_sar_i64: if (arg_is_const(op->args[2])) { tmp = arg_info(op->args[2])->val & 63; mask = (int64_t)arg_info(op->args[1])->mask >> tmp; } break; case INDEX_op_shr_i32: if (arg_is_const(op->args[2])) { tmp = arg_info(op->args[2])->val & 31; mask = (uint32_t)arg_info(op->args[1])->mask >> tmp; } break; case INDEX_op_shr_i64: if (arg_is_const(op->args[2])) { tmp = arg_info(op->args[2])->val & 63; mask = (uint64_t)arg_info(op->args[1])->mask >> tmp; } break; case INDEX_op_extrl_i64_i32: mask = (uint32_t)arg_info(op->args[1])->mask; break; case INDEX_op_extrh_i64_i32: mask = (uint64_t)arg_info(op->args[1])->mask >> 32; break; CASE_OP_32_64(shl): if (arg_is_const(op->args[2])) { tmp = arg_info(op->args[2])->val & (TCG_TARGET_REG_BITS - 1); mask = arg_info(op->args[1])->mask << tmp; } break; CASE_OP_32_64(neg): mask = -(arg_info(op->args[1])->mask & -arg_info(op->args[1])->mask); break; CASE_OP_32_64(deposit): mask = deposit64(arg_info(op->args[1])->mask, op->args[3], op->args[4], arg_info(op->args[2])->mask); break; CASE_OP_32_64(extract): mask = extract64(arg_info(op->args[1])->mask, op->args[2], op->args[3]); if (op->args[2] == 0) { affected = arg_info(op->args[1])->mask & ~mask; } break; CASE_OP_32_64(sextract): mask = sextract64(arg_info(op->args[1])->mask, op->args[2], op->args[3]); if (op->args[2] == 0 && (tcg_target_long)mask >= 0) { affected = arg_info(op->args[1])->mask & ~mask; } break; CASE_OP_32_64(or): CASE_OP_32_64(xor): mask = arg_info(op->args[1])->mask | arg_info(op->args[2])->mask; break; case INDEX_op_clz_i32: case INDEX_op_ctz_i32: mask = arg_info(op->args[2])->mask | 31; break; case INDEX_op_clz_i64: case INDEX_op_ctz_i64: mask = arg_info(op->args[2])->mask | 63; break; case INDEX_op_ctpop_i32: mask = 32 | 31; break; case INDEX_op_ctpop_i64: mask = 64 | 63; break; CASE_OP_32_64(setcond): case INDEX_op_setcond2_i32: mask = 1; break; CASE_OP_32_64(movcond): mask = arg_info(op->args[3])->mask | arg_info(op->args[4])->mask; break; CASE_OP_32_64(ld8u): mask = 0xff; break; CASE_OP_32_64(ld16u): mask = 0xffff; break; case INDEX_op_ld32u_i64: mask = 0xffffffffu; break; CASE_OP_32_64(qemu_ld): { TCGMemOpIdx oi = op->args[nb_oargs + nb_iargs]; TCGMemOp mop = get_memop(oi); if (!(mop & MO_SIGN)) { mask = (2ULL << ((8 << (mop & MO_SIZE)) - 1)) - 1; } } break; default: break; } partmask = mask; if (!(def->flags & TCG_OPF_64BIT)) { mask |= ~(tcg_target_ulong)0xffffffffu; partmask &= 0xffffffffu; affected &= 0xffffffffu; } if (partmask == 0) { tcg_debug_assert(nb_oargs == 1); tcg_opt_gen_movi(s, op, op->args[0], 0); continue; } if (affected == 0) { tcg_debug_assert(nb_oargs == 1); tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); continue; } switch (opc) { CASE_OP_32_64(and): CASE_OP_32_64(mul): CASE_OP_32_64(muluh): CASE_OP_32_64(mulsh): if (arg_is_const(op->args[2]) && arg_info(op->args[2])->val == 0) { tcg_opt_gen_movi(s, op, op->args[0], 0); continue; } break; default: break; } switch (opc) { CASE_OP_32_64(or): CASE_OP_32_64(and): if (args_are_copies(op->args[1], op->args[2])) { tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); continue; } break; default: break; } switch (opc) { CASE_OP_32_64(andc): CASE_OP_32_64(sub): CASE_OP_32_64(xor): if (args_are_copies(op->args[1], op->args[2])) { tcg_opt_gen_movi(s, op, op->args[0], 0); continue; } break; default: break; } switch (opc) { CASE_OP_32_64(mov): tcg_opt_gen_mov(s, op, op->args[0], op->args[1]); break; CASE_OP_32_64(movi): tcg_opt_gen_movi(s, op, op->args[0], op->args[1]); break; CASE_OP_32_64(not): CASE_OP_32_64(neg): CASE_OP_32_64(ext8s): CASE_OP_32_64(ext8u): CASE_OP_32_64(ext16s): CASE_OP_32_64(ext16u): CASE_OP_32_64(ctpop): case INDEX_op_ext32s_i64: case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: case INDEX_op_extu_i32_i64: case INDEX_op_extrl_i64_i32: case INDEX_op_extrh_i64_i32: if (arg_is_const(op->args[1])) { tmp = do_constant_folding(opc, arg_info(op->args[1])->val, 0); tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(mul): CASE_OP_32_64(or): CASE_OP_32_64(and): CASE_OP_32_64(xor): CASE_OP_32_64(shl): CASE_OP_32_64(shr): CASE_OP_32_64(sar): CASE_OP_32_64(rotl): CASE_OP_32_64(rotr): CASE_OP_32_64(andc): CASE_OP_32_64(orc): CASE_OP_32_64(eqv): CASE_OP_32_64(nand): CASE_OP_32_64(nor): CASE_OP_32_64(muluh): CASE_OP_32_64(mulsh): CASE_OP_32_64(div): CASE_OP_32_64(divu): CASE_OP_32_64(rem): CASE_OP_32_64(remu): if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp = do_constant_folding(opc, arg_info(op->args[1])->val, arg_info(op->args[2])->val); tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(clz): CASE_OP_32_64(ctz): if (arg_is_const(op->args[1])) { TCGArg v = arg_info(op->args[1])->val; if (v != 0) { tmp = do_constant_folding(opc, v, 0); tcg_opt_gen_movi(s, op, op->args[0], tmp); } else { tcg_opt_gen_mov(s, op, op->args[0], op->args[2]); } break; } goto do_default; CASE_OP_32_64(deposit): if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { tmp = deposit64(arg_info(op->args[1])->val, op->args[3], op->args[4], arg_info(op->args[2])->val); tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(extract): if (arg_is_const(op->args[1])) { tmp = extract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(sextract): if (arg_is_const(op->args[1])) { tmp = sextract64(arg_info(op->args[1])->val, op->args[2], op->args[3]); tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(setcond): tmp = do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[3]); if (tmp != 2) { tcg_opt_gen_movi(s, op, op->args[0], tmp); break; } goto do_default; CASE_OP_32_64(brcond): tmp = do_constant_folding_cond(opc, op->args[0], op->args[1], op->args[2]); if (tmp != 2) { if (tmp) { bitmap_zero(temps_used.l, nb_temps); op->opc = INDEX_op_br; op->args[0] = op->args[3]; } else { tcg_op_remove(s, op); } break; } goto do_default; CASE_OP_32_64(movcond): tmp = do_constant_folding_cond(opc, op->args[1], op->args[2], op->args[5]); if (tmp != 2) { tcg_opt_gen_mov(s, op, op->args[0], op->args[4-tmp]); break; } if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) { tcg_target_ulong tv = arg_info(op->args[3])->val; tcg_target_ulong fv = arg_info(op->args[4])->val; TCGCond cond = op->args[5]; if (fv == 1 && tv == 0) { cond = tcg_invert_cond(cond); } else if (!(tv == 1 && fv == 0)) { goto do_default; } op->args[3] = cond; op->opc = opc = (opc == INDEX_op_movcond_i32 ? INDEX_op_setcond_i32 : INDEX_op_setcond_i64); nb_iargs = 2; } goto do_default; case INDEX_op_add2_i32: case INDEX_op_sub2_i32: if (arg_is_const(op->args[2]) && arg_is_const(op->args[3]) && arg_is_const(op->args[4]) && arg_is_const(op->args[5])) { uint32_t al = arg_info(op->args[2])->val; uint32_t ah = arg_info(op->args[3])->val; uint32_t bl = arg_info(op->args[4])->val; uint32_t bh = arg_info(op->args[5])->val; uint64_t a = ((uint64_t)ah << 32) | al; uint64_t b = ((uint64_t)bh << 32) | bl; TCGArg rl, rh; TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32, 2); if (opc == INDEX_op_add2_i32) { a += b; } else { a -= b; } rl = op->args[0]; rh = op->args[1]; tcg_opt_gen_movi(s, op, rl, (int32_t)a); tcg_opt_gen_movi(s, op2, rh, (int32_t)(a >> 32)); oi_next = op2->next; break; } goto do_default; case INDEX_op_mulu2_i32: if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { uint32_t a = arg_info(op->args[2])->val; uint32_t b = arg_info(op->args[3])->val; uint64_t r = (uint64_t)a * b; TCGArg rl, rh; TCGOp *op2 = tcg_op_insert_before(s, op, INDEX_op_movi_i32, 2); rl = op->args[0]; rh = op->args[1]; tcg_opt_gen_movi(s, op, rl, (int32_t)r); tcg_opt_gen_movi(s, op2, rh, (int32_t)(r >> 32)); oi_next = op2->next; break; } goto do_default; case INDEX_op_brcond2_i32: tmp = do_constant_folding_cond2(&op->args[0], &op->args[2], op->args[4]); if (tmp != 2) { if (tmp) { do_brcond_true: bitmap_zero(temps_used.l, nb_temps); op->opc = INDEX_op_br; op->args[0] = op->args[5]; } else { do_brcond_false: tcg_op_remove(s, op); } } else if ((op->args[4] == TCG_COND_LT || op->args[4] == TCG_COND_GE) && arg_is_const(op->args[2]) && arg_info(op->args[2])->val == 0 && arg_is_const(op->args[3]) && arg_info(op->args[3])->val == 0) { do_brcond_high: bitmap_zero(temps_used.l, nb_temps); op->opc = INDEX_op_brcond_i32; op->args[0] = op->args[1]; op->args[1] = op->args[3]; op->args[2] = op->args[4]; op->args[3] = op->args[5]; } else if (op->args[4] == TCG_COND_EQ) { tmp = do_constant_folding_cond(INDEX_op_brcond_i32, op->args[0], op->args[2], TCG_COND_EQ); if (tmp == 0) { goto do_brcond_false; } else if (tmp == 1) { goto do_brcond_high; } tmp = do_constant_folding_cond(INDEX_op_brcond_i32, op->args[1], op->args[3], TCG_COND_EQ); if (tmp == 0) { goto do_brcond_false; } else if (tmp != 1) { goto do_default; } do_brcond_low: bitmap_zero(temps_used.l, nb_temps); op->opc = INDEX_op_brcond_i32; op->args[1] = op->args[2]; op->args[2] = op->args[4]; op->args[3] = op->args[5]; } else if (op->args[4] == TCG_COND_NE) { tmp = do_constant_folding_cond(INDEX_op_brcond_i32, op->args[0], op->args[2], TCG_COND_NE); if (tmp == 0) { goto do_brcond_high; } else if (tmp == 1) { goto do_brcond_true; } tmp = do_constant_folding_cond(INDEX_op_brcond_i32, op->args[1], op->args[3], TCG_COND_NE); if (tmp == 0) { goto do_brcond_low; } else if (tmp == 1) { goto do_brcond_true; } goto do_default; } else { goto do_default; } break; case INDEX_op_setcond2_i32: tmp = do_constant_folding_cond2(&op->args[1], &op->args[3], op->args[5]); if (tmp != 2) { do_setcond_const: tcg_opt_gen_movi(s, op, op->args[0], tmp); } else if ((op->args[5] == TCG_COND_LT || op->args[5] == TCG_COND_GE) && arg_is_const(op->args[3]) && arg_info(op->args[3])->val == 0 && arg_is_const(op->args[4]) && arg_info(op->args[4])->val == 0) { do_setcond_high: reset_temp(op->args[0]); arg_info(op->args[0])->mask = 1; op->opc = INDEX_op_setcond_i32; op->args[1] = op->args[2]; op->args[2] = op->args[4]; op->args[3] = op->args[5]; } else if (op->args[5] == TCG_COND_EQ) { tmp = do_constant_folding_cond(INDEX_op_setcond_i32, op->args[1], op->args[3], TCG_COND_EQ); if (tmp == 0) { goto do_setcond_const; } else if (tmp == 1) { goto do_setcond_high; } tmp = do_constant_folding_cond(INDEX_op_setcond_i32, op->args[2], op->args[4], TCG_COND_EQ); if (tmp == 0) { goto do_setcond_high; } else if (tmp != 1) { goto do_default; } do_setcond_low: reset_temp(op->args[0]); arg_info(op->args[0])->mask = 1; op->opc = INDEX_op_setcond_i32; op->args[2] = op->args[3]; op->args[3] = op->args[5]; } else if (op->args[5] == TCG_COND_NE) { tmp = do_constant_folding_cond(INDEX_op_setcond_i32, op->args[1], op->args[3], TCG_COND_NE); if (tmp == 0) { goto do_setcond_high; } else if (tmp == 1) { goto do_setcond_const; } tmp = do_constant_folding_cond(INDEX_op_setcond_i32, op->args[2], op->args[4], TCG_COND_NE); if (tmp == 0) { goto do_setcond_low; } else if (tmp == 1) { goto do_setcond_const; } goto do_default; } else { goto do_default; } break; case INDEX_op_call: if (!(op->args[nb_oargs + nb_iargs + 1] & (TCG_CALL_NO_READ_GLOBALS | TCG_CALL_NO_WRITE_GLOBALS))) { for (i = 0; i < nb_globals; i++) { if (test_bit(i, temps_used.l)) { reset_ts(&s->temps[i]); } } } goto do_reset_output; default: do_default: if (def->flags & TCG_OPF_BB_END) { bitmap_zero(temps_used.l, nb_temps); } else { do_reset_output: for (i = 0; i < nb_oargs; i++) { reset_temp(op->args[i]); if (i == 0) { arg_info(op->args[i])->mask = mask; } } } break; } if (prev_mb) { switch (opc) { case INDEX_op_mb: prev_mb->args[0] |= op->args[0]; tcg_op_remove(s, op); break; default: if ((def->flags & TCG_OPF_BB_END) == 0) { break; } case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i32: case INDEX_op_qemu_st_i64: case INDEX_op_call: prev_mb = NULL; break; } } else if (opc == INDEX_op_mb) { prev_mb = op; } } }
1threat
.ansible/tmp/ansible-tmp-* Permission denied : <p>Remote host throws error while running Ansible playbook despite a user being sudo user.</p> <pre><code>"/usr/bin/python: can't open file '/home/ludd/.ansible/tmp/ansible-tmp-1466162346.37-16304304631529/zypper' </code></pre>
0debug
av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens, const uint8_t **bands, const int* num_bands, int num_groups, const uint8_t *group_map) { int i, j, k = 0; ctx->avctx = avctx; ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) { ff_psy_end(ctx); return AVERROR(ENOMEM); } memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); for (i = 0; i < num_groups; i++) { ctx->group[i].num_ch = group_map[i] + 1; for (j = 0; j < ctx->group[i].num_ch * 2; j++) ctx->group[i].ch[j] = &ctx->ch[k++]; } switch (ctx->avctx->codec_id) { case AV_CODEC_ID_AAC: ctx->model = &ff_aac_psy_model; break; } if (ctx->model->init) return ctx->model->init(ctx); return 0; }
1threat
Minecraft 1.12.2 ping von Spieler Ermitteln : ich wollte von einem Spieler die Ping ermitteln. In der Version 1.8.8 hat auch alles super Funktioniert, aber wenn ich den Code auf der 1.12.2 anwende, kommen da unlogische ergebnisse raus. Ich bekomme auf meinem localhost eine Ping von 200 oder so zurück, obwohl ich auf dem 1.8er server einen 0er ping habe. Ist ja auch klar, weil Localhost... Ich habe es auf meinem Root server und auf meinem Localhost getestet. Ich habe gegoogled aber immer nur tutorials für die 1.8 gefunden ```Java package de.n1ck145.ping.main; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin{ private String prefix; private String message; private ConsoleCommandSender console; @Override public void onEnable() { console = Bukkit.getConsoleSender(); getConfig().options().copyDefaults(true); saveConfig(); prefix = getConfig().getString("prefix"); prefix = ChatColor.translateAlternateColorCodes('&', prefix); message = getConfig().getString("pingMessage"); message = ChatColor.translateAlternateColorCodes('&', message); console.sendMessage(prefix + "§aPlugin ready!"); } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(command.getName().equalsIgnoreCase("ping")) { if(!(sender instanceof Player)) { sender.sendMessage(prefix + "§cYou must be a player!"); return false; } if(sender.hasPermission("cmd.ping")) { sender.sendMessage(message.replace("%ping%", getPing((Player) sender) + "")); }else sender.sendMessage(prefix + "§cYou don't have permission to do this!"); } return true; } private int getPing(Player p) { return ((CraftPlayer) p).getHandle().ping; } } ```
0debug
embled if condition in html code and continue with privious div : $custom_column = '<div class="display: table-cell">'; if(Auth::user()->role_id !==3){ '<div class="checkInfo green"> <label class="chkcontainer"> <input id="internalCheck'. $entery->id . '" onchange="internalOkFunction(this,' . $entery->id . ');return false;" type="checkbox" ' . $kycinternalok . ' > <input id="hiddenId" type="hidden" value="'.$entery->id.'"> <span class="checkmark"></span> </label> </div>'; } `<div class="display: table-cell">` not reconganize when i set if statement after this. how can i run both `<div class="display: table-cell">` and `if()`?
0debug
Eslint determine globals from another file : <p>I'm trying to set up ESLint in such a way that it parses a globals declaration file before linting the actual target file, so that I don't have to declare as globals all the functions and variables that are indeed globals, but letting the parser figure that out:</p> <p>In <strong>some_module.js</strong>:</p> <pre><code>function do_something() { if (glob_action("foobar")) { ... something something ... } } </code></pre> <p>While in <strong>globals.js</strong> I have a set of utilities and global variables:</p> <pre><code>function glob_action(x) { ... something something ... } </code></pre> <p>So how can I tell to ESlint to include global.js in determining the fact that:</p> <pre><code>76:3 error 'glob_action' is not defined no-undef </code></pre> <p>is not actually undefined, but I do NOT want to list it as global:</p> <pre><code>/*global glob_action*/ </code></pre> <p>I would like to do something like:</p> <pre><code>/*eslint include "../globa.js"*/ </code></pre> <p>Is it possible? How?</p>
0debug
Deleting multiple items based on global secondary index in DynamoDB : <p>I have an existing table which has two fields - primary key and a global secondary index:</p> <pre><code>---------------------------- primary key | attributeA(GSI) ---------------------------- 1 | id1 2 | id1 3 | id2 4 | id2 5 | id1 </code></pre> <p>Since having the attributeA as a global secondary index, can I delete all items by specifying a value for the global secondary index? i.e I want to delete all records with the attributeA being id1 - Is this possible in Dynamo? </p> <p>Dynamo provides documentation about deleting the index itself, but not specifically if we can use the GSI to delete multiple items </p>
0debug
Getting error while excuting the below code = Exception in thread "main" java.lang.NullPointerException : <p>/* 1538254052650 Marionette DEBUG [6442450945] Received DOM event pageshow for <a href="http://www.demo.guru99.com/v4/index.php" rel="nofollow noreferrer">http://www.demo.guru99.com/v4/index.php</a> Exception in thread "main" java.lang.NullPointerException*/</p> <p>public static void setUp() throws Exception {</p> <pre><code>System.setProperty("webdriver.gecko.driver","D:\\\\Selenium\\\\New\\\\Driver('s)\\\\geckodriver.exe"); File pathBinary = new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe"); FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary); DesiredCapabilities desired = DesiredCapabilities.firefox(); FirefoxOptions options = new FirefoxOptions(); desired.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options.setBinary(firefoxBinary)); WebDriver driver = new FirefoxDriver(options); driver.navigate().to("http://www.demo.guru99.com/v4/index.php"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } public static void main(String args[]) throws Exception { setUp(); driver.findElement(By.name("uid")).sendKeys("mngr152686"); driver.findElement(By.name("password")).sendKeys("YgabAzy"); driver.findElement(By.name("btnLogin")).click(); Thread.sleep(3000); System.out.println("Login Succsful"); } </code></pre>
0debug
static hwaddr ppc_hash64_htab_lookup(CPUPPCState *env, ppc_slb_t *slb, target_ulong eaddr, ppc_hash_pte64_t *pte) { hwaddr pteg_off, pte_offset; hwaddr hash; uint64_t vsid, epnshift, epnmask, epn, ptem; epnshift = (slb->vsid & SLB_VSID_L) ? TARGET_PAGE_BITS_16M : TARGET_PAGE_BITS; epnmask = ~((1ULL << epnshift) - 1); if (slb->vsid & SLB_VSID_B) { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask; hash = vsid ^ (vsid << 25) ^ (epn >> epnshift); } else { vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask; hash = vsid ^ (epn >> epnshift); } ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN); LOG_MMU("htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); LOG_MMU("0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, hash); pteg_off = (hash * HASH_PTEG_SIZE_64) & env->htab_mask; pte_offset = ppc_hash64_pteg_search(env, pteg_off, 0, ptem, pte); if (pte_offset == -1) { LOG_MMU("1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ptem, ~hash); pteg_off = (~hash * HASH_PTEG_SIZE_64) & env->htab_mask; pte_offset = ppc_hash64_pteg_search(env, pteg_off, 1, ptem, pte); } return pte_offset; }
1threat
error class interface or enum expected - Adding 2 numbers from android : This code is to add 2 numbers from android. Please help me. public void onButtonclick(View v) { EditText e1 = (EditText) findViewById(R.id.editText); EditText e2 = (EditText) findViewById(R.id.editText2); TextView t1 = (TextView) findViewById(R.id.textView); int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); int sum = num1 + num2; t1.setText(Integer.toString(sum)); }
0debug
static int avr_probe(AVProbeData *p) { if (AV_RL32(p->buf) == MKTAG('2', 'B', 'I', 'T')) return AVPROBE_SCORE_EXTENSION; return 0; }
1threat
static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) { MpegTSContext *ts = filter->u.section_filter.opaque; MpegTSSectionFilter *tssf = &filter->u.section_filter; SectionHeader h; const uint8_t *p, *p_end; AVIOContext pb; int mp4_descr_count = 0; Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } }; int i, pid; AVFormatContext *s = ts->stream; p_end = section + section_len - 4; p = section; if (parse_section_header(&h, &p, p_end) < 0) return; if (h.tid != M4OD_TID) return; if (h.version == tssf->last_ver) return; tssf->last_ver = h.version; mp4_read_od(s, p, (unsigned) (p_end - p), mp4_descr, &mp4_descr_count, MAX_MP4_DESCR_COUNT); for (pid = 0; pid < NB_PID_MAX; pid++) { if (!ts->pids[pid]) continue; for (i = 0; i < mp4_descr_count; i++) { PESContext *pes; AVStream *st; if (ts->pids[pid]->es_id != mp4_descr[i].es_id) continue; if (ts->pids[pid]->type != MPEGTS_PES) { av_log(s, AV_LOG_ERROR, "pid %x is not PES\n", pid); continue; } pes = ts->pids[pid]->u.pes_filter.opaque; st = pes->st; if (!st) continue; pes->sl = mp4_descr[i].sl; ffio_init_context(&pb, mp4_descr[i].dec_config_descr, mp4_descr[i].dec_config_descr_len, 0, NULL, NULL, NULL, NULL); ff_mp4_read_dec_config_descr(s, st, &pb); if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size > 0) st->need_parsing = 0; if (st->codec->codec_id == AV_CODEC_ID_H264 && st->codec->extradata_size > 0) st->need_parsing = 0; if (st->codec->codec_id <= AV_CODEC_ID_NONE) { } else if (st->codec->codec_id < AV_CODEC_ID_FIRST_AUDIO) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; else if (st->codec->codec_id < AV_CODEC_ID_FIRST_SUBTITLE) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; else if (st->codec->codec_id < AV_CODEC_ID_FIRST_UNKNOWN) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; } } for (i = 0; i < mp4_descr_count; i++) av_free(mp4_descr[i].dec_config_descr); }
1threat
static int encode_init(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; int i, j, width, height; s->avctx= avctx; s->flags= avctx->flags; dsputil_init(&s->dsp, avctx); width= s->width= avctx->width; height= s->height= avctx->height; assert(width && height); avctx->extradata= av_mallocz(1024*30); avctx->stats_out= av_mallocz(1024*30); s->version=2; avctx->coded_frame= &s->picture; switch(avctx->pix_fmt){ case PIX_FMT_YUV420P: s->bitstream_bpp= 12; break; case PIX_FMT_YUV422P: s->bitstream_bpp= 16; break; default: av_log(avctx, AV_LOG_ERROR, "format not supported\n"); return -1; } avctx->bits_per_sample= s->bitstream_bpp; s->decorrelate= s->bitstream_bpp >= 24; s->predictor= avctx->prediction_method; s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0; if(avctx->context_model==1){ s->context= avctx->context_model; if(s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with 2 pass huffyuv encoding\n"); return -1; } }else s->context= 0; if(avctx->codec->id==CODEC_ID_HUFFYUV){ if(avctx->pix_fmt==PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n"); return -1; } if(avctx->context_model){ av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported by huffyuv; use vcodec=ffvhuff\n"); return -1; } if(s->interlaced != ( height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); }else if(avctx->strict_std_compliance>=0){ av_log(avctx, AV_LOG_ERROR, "This codec is under development; files encoded with it may not be decodeable with future versions!!! Set vstrict=-1 to use it anyway.\n"); return -1; } ((uint8_t*)avctx->extradata)[0]= s->predictor; ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp; ((uint8_t*)avctx->extradata)[2]= s->interlaced ? 0x10 : 0x20; if(s->context) ((uint8_t*)avctx->extradata)[2]|= 0x40; ((uint8_t*)avctx->extradata)[3]= 0; s->avctx->extradata_size= 4; if(avctx->stats_in){ char *p= avctx->stats_in; for(i=0; i<3; i++) for(j=0; j<256; j++) s->stats[i][j]= 1; for(;;){ for(i=0; i<3; i++){ char *next; for(j=0; j<256; j++){ s->stats[i][j]+= strtol(p, &next, 0); if(next==p) return -1; p=next; } } if(p[0]==0 || p[1]==0 || p[2]==0) break; } }else{ for(i=0; i<3; i++) for(j=0; j<256; j++){ int d= FFMIN(j, 256-j); s->stats[i][j]= 100000000/(d+1); } } for(i=0; i<3; i++){ generate_len_table(s->len[i], s->stats[i], 256); if(generate_bits_table(s->bits[i], s->len[i])<0){ return -1; } s->avctx->extradata_size+= store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]); } if(s->context){ for(i=0; i<3; i++){ int pels = width*height / (i?40:10); for(j=0; j<256; j++){ int d= FFMIN(j, 256-j); s->stats[i][j]= pels/(d+1); } } }else{ for(i=0; i<3; i++) for(j=0; j<256; j++) s->stats[i][j]= 0; } s->picture_number=0; return 0; }
1threat
static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride){ int i; pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); const pixel4 a= ((pixel4*)(src-stride))[0]; const pixel4 b= ((pixel4*)(src-stride))[1]; for(i=0; i<8; i++){ ((pixel4*)(src+i*stride))[0]= a; ((pixel4*)(src+i*stride))[1]= b; } }
1threat
General understanding of OOP Languages : <p>Why a language has to be object oriented in order to define local variables?</p> <p>For example Cobol allowed the definition of local variable only since 2002 because only then the language became object oriented</p>
0debug
void av_register_all(void) { static int initialized; if (initialized) return; initialized = 1; avcodec_init(); avcodec_register_all(); REGISTER_DEMUXER (AAC, aac); REGISTER_MUXDEMUX (AC3, ac3); REGISTER_MUXER (ADTS, adts); REGISTER_MUXDEMUX (AIFF, aiff); REGISTER_MUXDEMUX (AMR, amr); REGISTER_DEMUXER (APC, apc); REGISTER_DEMUXER (APE, ape); REGISTER_MUXDEMUX (ASF, asf); REGISTER_MUXER (ASF_STREAM, asf_stream); REGISTER_MUXDEMUX (AU, au); REGISTER_MUXDEMUX (AVI, avi); REGISTER_DEMUXER (AVISYNTH, avisynth); REGISTER_MUXER (AVM2, avm2); REGISTER_DEMUXER (AVS, avs); REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid); REGISTER_DEMUXER (BFI, bfi); REGISTER_DEMUXER (C93, c93); REGISTER_MUXER (CRC, crc); REGISTER_DEMUXER (DAUD, daud); REGISTER_MUXDEMUX (DIRAC, dirac); REGISTER_DEMUXER (DSICIN, dsicin); REGISTER_MUXDEMUX (DTS, dts); REGISTER_MUXDEMUX (DV, dv); REGISTER_DEMUXER (DXA, dxa); REGISTER_DEMUXER (EA, ea); REGISTER_DEMUXER (EA_CDATA, ea_cdata); REGISTER_MUXDEMUX (FFM, ffm); REGISTER_MUXDEMUX (FLAC, flac); REGISTER_DEMUXER (FLIC, flic); REGISTER_MUXDEMUX (FLV, flv); REGISTER_DEMUXER (FOURXM, fourxm); REGISTER_MUXER (FRAMECRC, framecrc); REGISTER_MUXDEMUX (GIF, gif); REGISTER_DEMUXER (GSM, gsm); REGISTER_MUXDEMUX (GXF, gxf); REGISTER_MUXDEMUX (H261, h261); REGISTER_MUXDEMUX (H263, h263); REGISTER_MUXDEMUX (H264, h264); REGISTER_DEMUXER (IDCIN, idcin); REGISTER_DEMUXER (IFF, iff); REGISTER_MUXDEMUX (IMAGE2, image2); REGISTER_MUXDEMUX (IMAGE2PIPE, image2pipe); REGISTER_DEMUXER (INGENIENT, ingenient); REGISTER_DEMUXER (IPMOVIE, ipmovie); REGISTER_MUXER (IPOD, ipod); REGISTER_DEMUXER (LMLM4, lmlm4); REGISTER_MUXDEMUX (M4V, m4v); REGISTER_MUXDEMUX (MATROSKA, matroska); REGISTER_MUXER (MATROSKA_AUDIO, matroska_audio); REGISTER_MUXDEMUX (MJPEG, mjpeg); REGISTER_DEMUXER (MLP, mlp); REGISTER_DEMUXER (MM, mm); REGISTER_MUXDEMUX (MMF, mmf); REGISTER_MUXDEMUX (MOV, mov); REGISTER_MUXER (MP2, mp2); REGISTER_MUXDEMUX (MP3, mp3); REGISTER_MUXER (MP4, mp4); REGISTER_DEMUXER (MPC, mpc); REGISTER_DEMUXER (MPC8, mpc8); REGISTER_MUXER (MPEG1SYSTEM, mpeg1system); REGISTER_MUXER (MPEG1VCD, mpeg1vcd); REGISTER_MUXER (MPEG1VIDEO, mpeg1video); REGISTER_MUXER (MPEG2DVD, mpeg2dvd); REGISTER_MUXER (MPEG2SVCD, mpeg2svcd); REGISTER_MUXER (MPEG2VIDEO, mpeg2video); REGISTER_MUXER (MPEG2VOB, mpeg2vob); REGISTER_DEMUXER (MPEGPS, mpegps); REGISTER_MUXDEMUX (MPEGTS, mpegts); REGISTER_DEMUXER (MPEGTSRAW, mpegtsraw); REGISTER_DEMUXER (MPEGVIDEO, mpegvideo); REGISTER_MUXER (MPJPEG, mpjpeg); REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); REGISTER_DEMUXER (MTV, mtv); REGISTER_DEMUXER (MVI, mvi); REGISTER_DEMUXER (MXF, mxf); REGISTER_DEMUXER (NSV, nsv); REGISTER_MUXER (NULL, null); REGISTER_MUXDEMUX (NUT, nut); REGISTER_DEMUXER (NUV, nuv); REGISTER_MUXDEMUX (OGG, ogg); REGISTER_DEMUXER (OMA, oma); REGISTER_MUXDEMUX (PCM_ALAW, pcm_alaw); REGISTER_MUXDEMUX (PCM_MULAW, pcm_mulaw); REGISTER_MUXDEMUX (PCM_S16BE, pcm_s16be); REGISTER_MUXDEMUX (PCM_S16LE, pcm_s16le); REGISTER_MUXDEMUX (PCM_S8, pcm_s8); REGISTER_MUXDEMUX (PCM_U16BE, pcm_u16be); REGISTER_MUXDEMUX (PCM_U16LE, pcm_u16le); REGISTER_MUXDEMUX (PCM_U8, pcm_u8); REGISTER_MUXER (PSP, psp); REGISTER_DEMUXER (PVA, pva); REGISTER_MUXDEMUX (RAWVIDEO, rawvideo); REGISTER_DEMUXER (REDIR, redir); REGISTER_DEMUXER (RL2, rl2); REGISTER_MUXDEMUX (RM, rm); REGISTER_MUXDEMUX (ROQ, roq); REGISTER_DEMUXER (RPL, rpl); REGISTER_MUXER (RTP, rtp); REGISTER_DEMUXER (RTSP, rtsp); REGISTER_DEMUXER (SDP, sdp); #ifdef CONFIG_SDP_DEMUXER av_register_rtp_dynamic_payload_handlers(); #endif REGISTER_DEMUXER (SEGAFILM, segafilm); REGISTER_DEMUXER (SHORTEN, shorten); REGISTER_DEMUXER (SIFF, siff); REGISTER_DEMUXER (SMACKER, smacker); REGISTER_DEMUXER (SOL, sol); REGISTER_DEMUXER (STR, str); REGISTER_MUXDEMUX (SWF, swf); REGISTER_MUXER (TG2, tg2); REGISTER_MUXER (TGP, tgp); REGISTER_DEMUXER (THP, thp); REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq); REGISTER_DEMUXER (TTA, tta); REGISTER_DEMUXER (TXD, txd); REGISTER_DEMUXER (VC1, vc1); REGISTER_DEMUXER (VC1T, vc1t); REGISTER_DEMUXER (VMD, vmd); REGISTER_MUXDEMUX (VOC, voc); REGISTER_MUXDEMUX (WAV, wav); REGISTER_DEMUXER (WC3, wc3); REGISTER_DEMUXER (WSAUD, wsaud); REGISTER_DEMUXER (WSVQA, wsvqa); REGISTER_DEMUXER (WV, wv); REGISTER_DEMUXER (XA, xa); REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe); REGISTER_MUXDEMUX (LIBNUT, libnut); REGISTER_PROTOCOL (FILE, file); REGISTER_PROTOCOL (HTTP, http); REGISTER_PROTOCOL (PIPE, pipe); REGISTER_PROTOCOL (RTP, rtp); REGISTER_PROTOCOL (TCP, tcp); REGISTER_PROTOCOL (UDP, udp); }
1threat
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
Comparing only dates of DateTimes in Dart : <p>I need to store and compare dates (without times) in my app, without caring about time zones.<br> I can see three solutions to this:</p> <ol> <li><p><code>(date1.year == date2.year &amp;&amp; date1.month == date2.month &amp;&amp; date1.day == date2.day)</code><br> This is what I'm doing now, but it's horrible verbose.</p></li> <li><p><code>date1.format("YYYYMMDD") == date2.format("YYYYMMDD")</code><br> This is still rather verbose (though not as bad), but just seems inefficient to me...</p></li> <li><p>Create a new Date class myself, perhaps storing the date as a "YYYYMMDD" string, or number of days since Jan 1 1980. But this means re-implementing a whole bunch of complex logic like different month lengths, adding/subtracting and leap years.</p></li> </ol> <p>Creating a new class also avoids an edge case I'm worried about, where adding <code>Duration(days: 1)</code> ends up with the same date due to daylight saving changes. But there are probably edge cases with this method I'm not thinking of...</p> <p>Which is the best of these solutions, or is there an even better solution I haven't thought of?</p>
0debug
static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, const float *v2) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul_reverse(cdst, v1, v2, LEN); fdsp->vector_fmul_reverse(odst, v1, v2, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul_reverse failed\n"); return ret; }
1threat
Redirect from PHP file to HTML file? : <p>So i have a contact form on my website. However when i submit it redirects me from my html page to the PHP page, id like to automatically redirect back. I have tried using HTACCESS but it redirects straight away and the PHP script doesnt run.</p> <p><strong>HTML FORM</strong></p> <pre><code>&lt;form action="action.php" method="post" class="contactForm" target="_top"&gt; &lt;input type="name" name="field1" placeholder="Enter your name..."&gt;&lt;br&gt; &lt;input type="email" name="field2" placeholder="Enter your email address..."&gt;&lt;br&gt; &lt;input type="text" name="field3" placeholder="Enter your message..."&gt;&lt;br&gt; &lt;input type="submit" value="Submit" id="button"&gt; &lt;/form&gt; </code></pre> <p><strong>action.php</strong></p> <pre><code>&lt;?php $path = 'data.txt'; if (isset($_POST['field1']) &amp;&amp; isset($_POST['field2'])&amp;&amp; isset($_POST['field3'])) { $fh = fopen($path,"a+"); $string = $_POST['field1'].' - '.$_POST['field2'].' - '.$_POST['field3']; fwrite($fh,$string); fclose($fh); }?&gt; </code></pre> <p>If i am going about this the wrong way please let me know, i am a complete beginner to PHP so i know very little.</p> <p>Thanks.</p>
0debug
int avformat_network_init(void) { #if CONFIG_NETWORK int ret; ff_network_inited_globally = 1; if ((ret = ff_network_init()) < 0) return ret; if ((ret = ff_tls_init()) < 0) return ret; #endif return 0; }
1threat
How to convert String attribute into a numeric attribute using Weka API in Java : I have a dataset (weka3 Instances object) uploaded in weka API. I need to convert an attribute type from String into Nominal. Any one know how to do this ? Thanks
0debug
How resize image in vb.net : <p>My code resize Image, but it only can reduce size.</p> <pre><code> For Each oFile In My.Computer.FileSystem.GetFiles(parm_strTargetPath) If oFile.ToString.ToLower.Contains(".png") Or oFile.ToString.ToLower.Contains(".jpg") Or oFile.ToString.ToLower.Contains(".jpeg") Then Dim strFileName = System.IO.Path.GetFileName(oFile) Try Dim original As Image = Image.FromFile(oFile) Dim resized As Image = ResizeImage(original, New Size(h, w)) Dim memStream As MemoryStream = New MemoryStream() resized.Save(memStream, ImageFormat.Jpeg) Dim file As New FileStream(result &amp; "/" &amp; strFileName , FileMode.Create, FileAccess.Write) memStream.WriteTo(file) file.Close() memStream.Close() Catch ex As Exception End Try End If Next </code></pre> <p>My image size: <code>1028x 172</code>, i want resize to <code>500 x 500</code> But result is a image size : <code>500x84</code> How Resize image from <code>1028x 172</code> to <code>500 x 500</code> ? Thanks all.</p>
0debug
A Framework to remind the user that their login is about to expire : <p>Is there a framework that I can implement on a MVC website which will hook into my session and provide a reminder that their login is about to time out? </p> <p>Ideally I would like to provide a view which would have the popup message on which can be configured.</p> <p>Also how would it work across browser tabs? If there were two tabs and you logged out on one then the session would be finished on the second tab. Is there a way of gracefully redirecting the second tab to the login page. For example if on second tab and fire some AJAX to a secured action I then get a fail. Could that redirect to login?</p> <p>I written something like this in the past but can be time consuming to test etc. and the multi tab issue was tricky.</p> <p>Ideally I am wanting something to plug in and use and configure.</p>
0debug
static inline void comp_block(MadContext *t, int mb_x, int mb_y, int j, int mv_x, int mv_y, int add) { MpegEncContext *s = &t->s; if (j < 4) { comp(t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3), t->frame.linesize[0], t->last_frame.data[0] + (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame.linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x, t->last_frame.linesize[0], add); } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { int index = j - 3; comp(t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x * 8, t->frame.linesize[index], t->last_frame.data[index] + (mb_y * 8 + (mv_y/2))*t->last_frame.linesize[index] + mb_x * 8 + (mv_x/2), t->last_frame.linesize[index], add); } }
1threat
int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header) { uint8_t rps_predict = 0; int delta_poc; int k0 = 0; int k1 = 0; int k = 0; int i; if (rps != sps->st_rps && sps->nb_st_rps) rps_predict = get_bits1(gb); if (rps_predict) { const ShortTermRPS *rps_ridx; int delta_rps; unsigned abs_delta_rps; uint8_t use_delta_flag = 0; uint8_t delta_rps_sign; if (is_slice_header) { unsigned int delta_idx = get_ue_golomb_long(gb) + 1; if (delta_idx > sps->nb_st_rps) { "Invalid value of delta_idx in slice header RPS: %d > %d.\n", delta_idx, sps->nb_st_rps); rps_ridx = &sps->st_rps[sps->nb_st_rps - delta_idx]; rps->rps_idx_num_delta_pocs = rps_ridx->num_delta_pocs; } else rps_ridx = &sps->st_rps[rps - sps->st_rps - 1]; delta_rps_sign = get_bits1(gb); abs_delta_rps = get_ue_golomb_long(gb) + 1; if (abs_delta_rps < 1 || abs_delta_rps > 32768) { "Invalid value of abs_delta_rps: %d\n", abs_delta_rps); delta_rps = (1 - (delta_rps_sign << 1)) * abs_delta_rps; for (i = 0; i <= rps_ridx->num_delta_pocs; i++) { int used = rps->used[k] = get_bits1(gb); if (!used) use_delta_flag = get_bits1(gb); if (used || use_delta_flag) { if (i < rps_ridx->num_delta_pocs) delta_poc = delta_rps + rps_ridx->delta_poc[i]; else delta_poc = delta_rps; rps->delta_poc[k] = delta_poc; if (delta_poc < 0) k0++; else k1++; k++; if (k >= FF_ARRAY_ELEMS(rps->used)) { "Invalid num_delta_pocs: %d\n", k); rps->num_delta_pocs = k; rps->num_negative_pics = k0; if (rps->num_delta_pocs != 0) { int used, tmp; for (i = 1; i < rps->num_delta_pocs; i++) { delta_poc = rps->delta_poc[i]; used = rps->used[i]; for (k = i - 1; k >= 0; k--) { tmp = rps->delta_poc[k]; if (delta_poc < tmp) { rps->delta_poc[k + 1] = tmp; rps->used[k + 1] = rps->used[k]; rps->delta_poc[k] = delta_poc; rps->used[k] = used; if ((rps->num_negative_pics >> 1) != 0) { int used; k = rps->num_negative_pics - 1; for (i = 0; i < rps->num_negative_pics >> 1; i++) { delta_poc = rps->delta_poc[i]; used = rps->used[i]; rps->delta_poc[i] = rps->delta_poc[k]; rps->used[i] = rps->used[k]; rps->delta_poc[k] = delta_poc; rps->used[k] = used; k--; } else { unsigned int prev, nb_positive_pics; rps->num_negative_pics = get_ue_golomb_long(gb); nb_positive_pics = get_ue_golomb_long(gb); if (rps->num_negative_pics >= HEVC_MAX_REFS || nb_positive_pics >= HEVC_MAX_REFS) { av_log(avctx, AV_LOG_ERROR, "Too many refs in a short term RPS.\n"); rps->num_delta_pocs = rps->num_negative_pics + nb_positive_pics; if (rps->num_delta_pocs) { prev = 0; for (i = 0; i < rps->num_negative_pics; i++) { delta_poc = get_ue_golomb_long(gb) + 1; prev -= delta_poc; rps->delta_poc[i] = prev; rps->used[i] = get_bits1(gb); prev = 0; for (i = 0; i < nb_positive_pics; i++) { delta_poc = get_ue_golomb_long(gb) + 1; prev += delta_poc; rps->delta_poc[rps->num_negative_pics + i] = prev; rps->used[rps->num_negative_pics + i] = get_bits1(gb); return 0;
1threat
Does a postgres foreign key imply an index? : <p>I have a postgres table (lets call this table <code>Events</code>) with a composite foreign key to another table (lets call this table <code>Logs</code>). The Events table looks like this:</p> <pre><code>CREATE TABLE Events ( ColPrimary UUID, ColA VARCHAR(50), ColB VARCHAR(50), ColC VARCHAR(50), PRIMARY KEY (ColPrimary), FOREIGN KEY (ColA, ColB, ColC) REFERENCES Logs(ColA, ColB, ColC) ); </code></pre> <p>In this case, I know that I can efficiently search for Events by the primary key, and join to Logs.</p> <p>What I am interested in is if this foreign key creates an index on the Events table which can be useful even without joining. For example, would the following query benefit from the FK?</p> <pre><code>SELECT * FROM Events WHERE ColA='foo' AND ColB='bar' </code></pre> <p>Note: I have run the POSTGRES EXPLAIN for a very similar case to this, and see that the query will result in a full table scan. I am not sure if this is because the FK is not helpful for this query, or if my data size is small and a scan is more efficient at my current scale.</p>
0debug
glVertexAttribPointer and glVertexAttribFormat: What's the difference? : <p>OpenGL 4.3 and OpenGL ES 3.1 added several alternative functions for specifying vertex arrays: <code>glVertexAttribFormat</code>, <code>glBindVertexBuffers</code>, etc. But we already had functions for specifying vertex arrays. Namely <code>glVertexAttribPointer</code>.</p> <ol> <li><p>Why add new APIs that do the same thing as the old ones?</p></li> <li><p>How do the new APIs work?</p></li> </ol>
0debug
Why are packages installed rather than just linked to a specific environment? : <p>I've noticed that normally when packages are installed using various package managers (for python), they are installed in <code>/home/user/anaconda3/envs/env_name/</code> on conda and in <code>/home/user/anaconda3/envs/env_name/lib/python3.6/lib-packages/</code> using pip on conda. </p> <p>But conda caches all the recently downloaded packages too.</p> <p>So, my question is: Why doesn't conda install all the packages on a central location and then when installed in a specific environment create a link to the directory rather than installing it there?</p> <p>I've noticed that environments grow quite big and that this method would probably be able to save a bit of space.</p>
0debug
Correct way to retrieve token for FCM - iOS 10 Swift 3 : <p>i had implement Firebase with FirebaseAuth/FCM etc and did sent notification successfully through Firebase Console. </p> <p>However i would need to push the notification from my own app server.</p> <p>i am wondering below which way is correct way to retrieve the registration id for the device:-</p> <p><strong>1) retrieve registration id token from didRegisterForRemoteNotificationWithDeviceToken</strong></p> <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { var token = "" for i in 0..&lt;deviceToken.count { token += String(format: "%02.2hhx", arguments: [deviceToken[i]]) } print("Registration succeeded!") print("Token: ", token) Callquery(token) } </code></pre> <p><strong>2) Retrieve Registration token from firebase</strong> (Based on Firebase document which retrieve the current registration token)</p> <pre><code>let token = FIRInstanceID.instanceID().token()! </code></pre> <p>i was using the first way, the push notification is not being received even the registration id is stored on my app server database accordingly and i get this CURL session result :-</p> <pre><code>{"multicast_id":6074293608087656831,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]} </code></pre> <p>i had also tried the second way and get fatal error while running the app as below:- <a href="https://i.stack.imgur.com/ZeQ9U.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZeQ9U.png" alt="enter image description here"></a></p> <p>appreciated if anyone could point me the right way, thanks!</p>
0debug
Spring validation for list of accepted string values : <p>Is there a <strong>validation annotation</strong> for <strong>Spring</strong> that will do something like:</p> <pre><code>@ValidString({"US", "GB", "CA"}) final String country; </code></pre> <p>and validate that the string is one of the supported values in the array?</p>
0debug
static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp, const float *v1, float scale) { LOCAL_ALIGNED(32, float, cdst, [LEN]); LOCAL_ALIGNED(32, float, odst, [LEN]); int ret; cdsp->vector_fmul_scalar(cdst, v1, scale, LEN); fdsp->vector_fmul_scalar(odst, v1, scale, LEN); if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON)) av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n"); return ret; }
1threat
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) { AVFilterContext *ctx = inlink->dst; Stereo3DContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out, *oleft, *oright, *ileft, *iright; int out_off_left[4], out_off_right[4]; int i; if (s->in.format == s->out.format) return ff_filter_frame(outlink, inpicref); switch (s->in.format) { case ALTERNATING_LR: case ALTERNATING_RL: if (!s->prev) { s->prev = inpicref; return 0; } ileft = s->prev; iright = inpicref; if (s->in.format == ALTERNATING_RL) FFSWAP(AVFrame *, ileft, iright); break; default: ileft = iright = inpicref; }; if ((s->out.format == ALTERNATING_LR || s->out.format == ALTERNATING_RL) && (s->in.format == SIDE_BY_SIDE_LR || s->in.format == SIDE_BY_SIDE_RL || s->in.format == SIDE_BY_SIDE_2_LR || s->in.format == SIDE_BY_SIDE_2_RL || s->in.format == ABOVE_BELOW_LR || s->in.format == ABOVE_BELOW_RL || s->in.format == ABOVE_BELOW_2_LR || s->in.format == ABOVE_BELOW_2_RL)) { oright = av_frame_clone(inpicref); oleft = av_frame_clone(inpicref); if (!oright || !oleft) { av_frame_free(&oright); av_frame_free(&oleft); av_frame_free(&s->prev); av_frame_free(&inpicref); return AVERROR(ENOMEM); } } else if ((s->out.format == MONO_L || s->out.format == MONO_R) && (s->in.format == SIDE_BY_SIDE_LR || s->in.format == SIDE_BY_SIDE_RL || s->in.format == SIDE_BY_SIDE_2_LR || s->in.format == SIDE_BY_SIDE_2_RL || s->in.format == ABOVE_BELOW_LR || s->in.format == ABOVE_BELOW_RL || s->in.format == ABOVE_BELOW_2_LR || s->in.format == ABOVE_BELOW_2_RL)) { out = oleft = oright = av_frame_clone(inpicref); if (!out) { av_frame_free(&s->prev); av_frame_free(&inpicref); return AVERROR(ENOMEM); } } else { out = oleft = oright = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { av_frame_free(&s->prev); av_frame_free(&inpicref); return AVERROR(ENOMEM); } av_frame_copy_props(out, inpicref); if (s->out.format == ALTERNATING_LR || s->out.format == ALTERNATING_RL) { oright = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!oright) { av_frame_free(&oleft); av_frame_free(&s->prev); av_frame_free(&inpicref); return AVERROR(ENOMEM); } av_frame_copy_props(oright, inpicref); } } for (i = 0; i < 4; i++) { int hsub = i == 1 || i == 2 ? s->hsub : 0; int vsub = i == 1 || i == 2 ? s->vsub : 0; s->in_off_left[i] = (FF_CEIL_RSHIFT(s->in.row_left, vsub) + s->in.off_lstep) * ileft->linesize[i] + FF_CEIL_RSHIFT(s->in.off_left * s->pixstep[i], hsub); s->in_off_right[i] = (FF_CEIL_RSHIFT(s->in.row_right, vsub) + s->in.off_rstep) * iright->linesize[i] + FF_CEIL_RSHIFT(s->in.off_right * s->pixstep[i], hsub); out_off_left[i] = (FF_CEIL_RSHIFT(s->out.row_left, vsub) + s->out.off_lstep) * oleft->linesize[i] + FF_CEIL_RSHIFT(s->out.off_left * s->pixstep[i], hsub); out_off_right[i] = (FF_CEIL_RSHIFT(s->out.row_right, vsub) + s->out.off_rstep) * oright->linesize[i] + FF_CEIL_RSHIFT(s->out.off_right * s->pixstep[i], hsub); } switch (s->out.format) { case ALTERNATING_LR: case ALTERNATING_RL: switch (s->in.format) { case ABOVE_BELOW_LR: case ABOVE_BELOW_RL: case ABOVE_BELOW_2_LR: case ABOVE_BELOW_2_RL: case SIDE_BY_SIDE_LR: case SIDE_BY_SIDE_RL: case SIDE_BY_SIDE_2_LR: case SIDE_BY_SIDE_2_RL: oleft->width = outlink->w; oright->width = outlink->w; oleft->height = outlink->h; oright->height = outlink->h; for (i = 0; i < s->nb_planes; i++) { oleft->data[i] += s->in_off_left[i]; oright->data[i] += s->in_off_right[i]; } break; default: goto copy; break; } break; case HDMI: for (i = 0; i < s->nb_planes; i++) { int j, h = s->height >> ((i == 1 || i == 2) ? s->vsub : 0); int b = (s->blanks) >> ((i == 1 || i == 2) ? s->vsub : 0); for (j = h; j < h + b; j++) memset(oleft->data[i] + j * s->linesize[i], 0, s->linesize[i]); } case SIDE_BY_SIDE_LR: case SIDE_BY_SIDE_RL: case SIDE_BY_SIDE_2_LR: case SIDE_BY_SIDE_2_RL: case ABOVE_BELOW_LR: case ABOVE_BELOW_RL: case ABOVE_BELOW_2_LR: case ABOVE_BELOW_2_RL: case INTERLEAVE_ROWS_LR: case INTERLEAVE_ROWS_RL: copy: for (i = 0; i < s->nb_planes; i++) { av_image_copy_plane(oleft->data[i] + out_off_left[i], oleft->linesize[i] * s->out.row_step, ileft->data[i] + s->in_off_left[i], ileft->linesize[i] * s->in.row_step, s->linesize[i], s->pheight[i]); av_image_copy_plane(oright->data[i] + out_off_right[i], oright->linesize[i] * s->out.row_step, iright->data[i] + s->in_off_right[i], iright->linesize[i] * s->in.row_step, s->linesize[i], s->pheight[i]); } break; case MONO_L: iright = ileft; case MONO_R: switch (s->in.format) { case ABOVE_BELOW_LR: case ABOVE_BELOW_RL: case ABOVE_BELOW_2_LR: case ABOVE_BELOW_2_RL: case SIDE_BY_SIDE_LR: case SIDE_BY_SIDE_RL: case SIDE_BY_SIDE_2_LR: case SIDE_BY_SIDE_2_RL: out->width = outlink->w; out->height = outlink->h; for (i = 0; i < s->nb_planes; i++) { out->data[i] += s->in_off_left[i]; } break; default: for (i = 0; i < s->nb_planes; i++) { av_image_copy_plane(out->data[i], out->linesize[i], iright->data[i] + s->in_off_left[i], iright->linesize[i] * s->in.row_step, s->linesize[i], s->pheight[i]); } break; } break; case ANAGLYPH_RB_GRAY: case ANAGLYPH_RG_GRAY: case ANAGLYPH_RC_GRAY: case ANAGLYPH_RC_HALF: case ANAGLYPH_RC_COLOR: case ANAGLYPH_RC_DUBOIS: case ANAGLYPH_GM_GRAY: case ANAGLYPH_GM_HALF: case ANAGLYPH_GM_COLOR: case ANAGLYPH_GM_DUBOIS: case ANAGLYPH_YB_GRAY: case ANAGLYPH_YB_HALF: case ANAGLYPH_YB_COLOR: case ANAGLYPH_YB_DUBOIS: { ThreadData td; td.ileft = ileft; td.iright = iright; td.out = out; ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(s->out.height, ctx->graph->nb_threads)); break; } case CHECKERBOARD_RL: case CHECKERBOARD_LR: for (i = 0; i < s->nb_planes; i++) { int x, y; for (y = 0; y < s->pheight[i]; y++) { uint8_t *dst = out->data[i] + out->linesize[i] * y; uint8_t *left = ileft->data[i] + ileft->linesize[i] * y + s->in_off_left[i]; uint8_t *right = iright->data[i] + iright->linesize[i] * y + s->in_off_right[i]; int p, b; if (s->out.format == CHECKERBOARD_RL) FFSWAP(uint8_t*, left, right); switch (s->pixstep[i]) { case 1: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b++) { dst[x ] = (b&1) == (y&1) ? left[p] : right[p]; dst[x+1] = (b&1) != (y&1) ? left[p] : right[p]; } break; case 2: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b++) { AV_WN16(&dst[x ], (b&1) == (y&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p])); AV_WN16(&dst[x+2], (b&1) != (y&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p])); } break; case 3: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b++) { AV_WB24(&dst[x ], (b&1) == (y&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p])); AV_WB24(&dst[x+3], (b&1) != (y&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p])); } break; case 4: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b++) { AV_WN32(&dst[x ], (b&1) == (y&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p])); AV_WN32(&dst[x+4], (b&1) != (y&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p])); } break; case 6: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b++) { AV_WB48(&dst[x ], (b&1) == (y&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p])); AV_WB48(&dst[x+6], (b&1) != (y&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p])); } break; case 8: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b++) { AV_WN64(&dst[x ], (b&1) == (y&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p])); AV_WN64(&dst[x+8], (b&1) != (y&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p])); } break; } } } break; case INTERLEAVE_COLS_LR: case INTERLEAVE_COLS_RL: for (i = 0; i < s->nb_planes; i++) { int x, y; for (y = 0; y < s->pheight[i]; y++) { uint8_t *dst = out->data[i] + out->linesize[i] * y; uint8_t *left = ileft->data[i] + ileft->linesize[i] * y * s->in.row_step + s->in_off_left[i]; uint8_t *right = iright->data[i] + iright->linesize[i] * y * s->in.row_step + s->in_off_right[i]; int p, b; if (s->out.format == INTERLEAVE_COLS_LR) FFSWAP(uint8_t*, left, right); switch (s->pixstep[i]) { case 1: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=2, p++, b++) { dst[x ] = b&1 ? left[p] : right[p]; dst[x+1] = !(b&1) ? left[p] : right[p]; } break; case 2: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=4, p+=2, b++) { AV_WN16(&dst[x ], b&1 ? AV_RN16(&left[p]) : AV_RN16(&right[p])); AV_WN16(&dst[x+2], !(b&1) ? AV_RN16(&left[p]) : AV_RN16(&right[p])); } break; case 3: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=6, p+=3, b++) { AV_WB24(&dst[x ], b&1 ? AV_RB24(&left[p]) : AV_RB24(&right[p])); AV_WB24(&dst[x+3], !(b&1) ? AV_RB24(&left[p]) : AV_RB24(&right[p])); } break; case 4: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=8, p+=4, b++) { AV_WN32(&dst[x ], b&1 ? AV_RN32(&left[p]) : AV_RN32(&right[p])); AV_WN32(&dst[x+4], !(b&1) ? AV_RN32(&left[p]) : AV_RN32(&right[p])); } break; case 6: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=12, p+=6, b++) { AV_WB48(&dst[x ], b&1 ? AV_RB48(&left[p]) : AV_RB48(&right[p])); AV_WB48(&dst[x+6], !(b&1) ? AV_RB48(&left[p]) : AV_RB48(&right[p])); } break; case 8: for (x = 0, b = 0, p = 0; x < s->linesize[i] * 2; x+=16, p+=8, b++) { AV_WN64(&dst[x ], b&1 ? AV_RN64(&left[p]) : AV_RN64(&right[p])); AV_WN64(&dst[x+8], !(b&1) ? AV_RN64(&left[p]) : AV_RN64(&right[p])); } break; } } } break; default: av_assert0(0); } av_frame_free(&inpicref); av_frame_free(&s->prev); if (oright != oleft) { if (s->out.format == ALTERNATING_LR) FFSWAP(AVFrame *, oleft, oright); oright->pts = outlink->frame_count * s->ts_unit; ff_filter_frame(outlink, oright); out = oleft; oleft->pts = outlink->frame_count * s->ts_unit; } else if (s->in.format == ALTERNATING_LR || s->in.format == ALTERNATING_RL) { out->pts = outlink->frame_count * s->ts_unit; } return ff_filter_frame(outlink, out); }
1threat
static always_inline target_ulong MASK (uint32_t start, uint32_t end) { target_ulong ret; #if defined(TARGET_PPC64) if (likely(start == 0)) { ret = (uint64_t)(-1ULL) << (63 - end); } else if (likely(end == 63)) { ret = (uint64_t)(-1ULL) >> start; } #else if (likely(start == 0)) { ret = (uint32_t)(-1ULL) << (31 - end); } else if (likely(end == 31)) { ret = (uint32_t)(-1ULL) >> start; } #endif else { ret = (((target_ulong)(-1ULL)) >> (start)) ^ (((target_ulong)(-1ULL) >> (end)) >> 1); if (unlikely(start > end)) return ~ret; } return ret; }
1threat
R - How to make a plot with two variables on the horizontal axis? : <p>I'm a rookie in R.</p> <p>This is my date frame:</p> <pre><code> I UserID | hour | min | velocity #1 1 0 0 12 #2 1 0 30 20 #3 1 1 0 19 #4 1 1 30 11 #5 1 2 0 12 #6 1 2 30 7 .. ... ... ... .... #10 2 0 0 142 #11 2 0 30 201 #12 2 1 0 129 #13 2 1 30 111 .. ... ... ... .... </code></pre> <p>I put the Userid column as a factor.</p> <p>My question is how can I make a linear graph using as the horizontal axis the hour and minute column and velocity as the vertical axis?</p>
0debug
How do i find a "\n" in a string? : <p>I try to find a "\n" in a string. My code here is not working. What would be the right way? Thanks</p> <pre><code> string text = "hello\nworld"; for(int i=1; i&lt;text.Length ;i++) { if ( text[i-1]== '\\' &amp;&amp; text[i]== 'n' ) { Debug.Log("break at: "+i); } } </code></pre>
0debug
Change colour of div, that contains label + input, when checkbox is not :checked - without JS? : <p>First of all, thanks for reading. I'm not english-native speaking, but I will try to express clearly.</p> <p>I have three ckeckboxes in a form, every checkbox with their label inside a div. The last of them is :required, when not :checked it's possible to change background of div without using JS? Only CSS, and without having to use Pure or Bootstrap.</p> <pre><code>&lt;form&gt; &lt;div class="checkbox"&gt; &lt;input id="com1" type="checkbox" required&gt; &lt;label for="com1"&gt;Bla Bla (...)&lt;/label&gt; &lt;/div&gt; &lt;button type="submit"&gt;SEND&lt;/button&gt; &lt;/form&gt; </code></pre>
0debug
static void selfTest(uint8_t *src[4], int stride[4], int w, int h){ enum PixelFormat srcFormat, dstFormat; int srcW, srcH, dstW, dstH; int flags; for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { printf("%s -> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); fflush(stdout); srcW= w; srcH= h; for (dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){ for (dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){ for (flags=1; flags<33; flags*=2) { int res; res = doTest(src, stride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags); if (res < 0) { dstW = 4 * w / 3; dstH = 4 * h / 3; flags = 33; } } } } } } }
1threat
static int qcow_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVQcowState *s = bs->opaque; int ret, index_in_cluster, n; uint64_t cluster_offset; int n_end; while (nb_sectors > 0) { index_in_cluster = sector_num & (s->cluster_sectors - 1); n_end = index_in_cluster + nb_sectors; if (s->crypt_method && n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; cluster_offset = alloc_cluster_offset(bs, sector_num << 9, index_in_cluster, n_end, &n); if (!cluster_offset) return -1; if (s->crypt_method) { encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, &s->aes_encrypt_key); ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, s->cluster_data, n * 512); } else { ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); } if (ret != n * 512) return -1; nb_sectors -= n; sector_num += n; buf += n * 512; } s->cluster_cache_offset = -1; return 0; }
1threat
Okay so I'm coding a roll the die game on java : This is the code I have, but I want it to be able roll the die based on the number of trials the user inputs and then display the frequencies of each face. This code isn't working at I would want it to. Also I would like to change the switch cases to if and else if statements, if anybody could help me out with that would be amazing, I've been working on this for a while now. import java.util.Random; import java.util.Scanner; public class DieRoll { public static void main(String[] args) { // TODO Auto-generated method stub Random randomNumbers = new Random(); int one=0; int two=0; int three=0; int four=0; int five=0; int six=0; int trials; int face; System.out.println("Please enter the number of trials"); Scanner scan= new Scanner (System.in); trials= scan.nextInt(); for(int rolls= 1; rolls==trials; rolls++);{ face= randomNumbers.nextInt(6) + 1; // determine roll value 1-6 and increment appropriate counter switch ( face ) { case 1: ++one; // increment the 1s counter break; case 2: ++two; // increment the 2s counter break; case 3: ++three; // increment the 3s counter break; case 4: ++four; // increment the 4s counter break; case 5: ++five; // increment the 5s counter break; case 6: ++six; // increment the 6s counter break; // optional at end of switch } } System.out.println( "Face\tFrequency" ); // output headers System.out.printf( "1\t%d\n2\t%d\n3\t%d\n4\t%d\n5\t%d\n6\t%d\n", one, two, three, four, five, six ); scan.close(); } }
0debug
Try deserialize to object : <p>I have serializaed objects of different types as strings in sql table.</p> <p>Now need to deserialize them without knowing what type is the object. </p> <p>I am looking for sth like TryDeserializeToObject trying with different types.</p> <p>Offcourse I could use try catch, is there any better way ? </p>
0debug
Difference between @Mock, @MockBean and Mockito.mock() : <p>When creating tests and mocking dependencies, what is the difference between these three approaches?</p> <ol> <li><p>@MockBean:</p> <pre><code>@MockBean MyService myservice; </code></pre></li> <li><p>@Mock:</p> <pre><code>@Mock MyService myservice; </code></pre></li> <li><p>Mockito.mock()</p> <pre><code>MyService myservice = Mockito.mock(MyService.class); </code></pre></li> </ol>
0debug
static void decode(Real288_internal *glob, float gain, int cb_coef) { unsigned int x, y; float f; double sum, sumsum; float *p1, *p2; float buffer[5]; for (x=36; x--; glob->sb[x+5] = glob->sb[x]); for (x=5; x--;) { p1 = glob->sb+x; p2 = glob->pr1; for (sum=0, y=36; y--; sum -= (*(++p1))*(*(p2++))); glob->sb[x] = sum; } for (sum=32, x=10; x--; sum -= glob->pr2[x] * glob->lhist[x]); if (sum < 0) sum = 0; else if (sum > 60) sum = 60; sumsum = exp(sum * 0.1151292546497) * gain; for (sum=0, x=5; x--;) { buffer[x] = codetable[cb_coef][x] * sumsum; sum += buffer[x] * buffer[x]; } if ((sum /= 5) < 1) sum = 1; for (x=10; --x; glob->lhist[x] = glob->lhist[x-1]); *glob->lhist = glob->history[glob->phase] = 10 * log10(sum) - 32; for (x=1; x < 5; x++) for (y=x; y--; buffer[x] -= glob->pr1[x-y-1] * buffer[y]); for (x=0; x < 5; x++) { f = glob->sb[4-x] + buffer[x]; if (f > 4095) f = 4095; else if (f < -4095) f = -4095; glob->output[glob->phasep+x] = glob->sb[4-x] = f; } }
1threat
getting dublicate terms in list in java : what's wrong in code? am not getting any values in output. but it should print duplicate values. (a is a Arraylist) HashSet<Integer> hs=new HashSet(); hs.addAll(a); List<Integer> b=new ArrayList(); a.removeAll(hs); System.out.println(a);
0debug
phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) : <p>I am unable to connect to my MySQL in xampp I have this error:</p> <blockquote> <p>MySQL said: Documentation</p> <h1>1045 - Access denied for user 'root'@'localhost' (using password: NO)</h1> <p>mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.</p> </blockquote> <p>CONFIG.INC.PHP file</p> <pre><code>&lt;?php /* * This is needed for cookie based authentication to encrypt password in * cookie */ $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */ /* * Servers configuration */ $i = 0; /* * First server */ $i++; /* Authentication type and info */ $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true; $cfg['Lang'] = ''; /* Bind to the localhost ipv4 address and tcp */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; /* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = ''; /* Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; $cfg['Servers'][$i]['relation'] = 'pma__relation'; $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; $cfg['Servers'][$i]['history'] = 'pma__history'; $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords'; $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; $cfg['Servers'][$i]['recent'] = 'pma__recent'; $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; $cfg['Servers'][$i]['users'] = 'pma__users'; $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; /* * End of servers configuration */ </code></pre> <p>?></p>
0debug
Run parts of bash script : <p>So I want to have an automated Bash script that checks for java and if its not there or super old version (lower than 7) it installs it.</p> <p>I have something that works, but it runs all part of the bash script yielding odd results.</p> <p>Code:</p> <pre><code>#!/bin/bash # This file will call versions and install if necessary version_call_java = $(java -version) java_call_len = ${#version_call_java} if [[ $version_call_java == *"not found"* ]]; then echo "It's not there!" sudo apt-get install java echo "Installing Java" elif [[ $version_call_java == *"version*" ]] echo "Its there!" fi date </code></pre> <p>The results of the code: </p> <p><a href="https://i.stack.imgur.com/B6olV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B6olV.png" alt="Results"></a></p> <p>Lines 5, 6, and 13 shouldn't run.</p> <p>Also is my logic correct? I look for the words "not found" for if the machine doesn't have java. Maybe "recognized" is better but not sure if there is a boolean for if a software program exists or not on a machine.</p>
0debug
Having trouble getting my PDO query to display on another page : <p>I have been working on learning PDO. Basically what I am trying to do is display names that are off work on any given day of the year. </p> <p>I created a prepared statement that gives me the names, based on a date set in a variable. It's working as expected.</p> <p>The problem I am having is displaying that on a seperate page. Lets say my page with the PDO statement is called vacationnames.php</p> <p>Depending on the date I need to display those names on 1 of 4 different pages called calendar1.php or calendar2.php...etc.</p> <p>Here is the code I have: vacationnames.php</p> <pre><code>$dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $opt = [ PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES =&gt; false, ]; $db = new PDO($dsn, $user, $pass, $opt); $sth = $db-&gt;prepare(" SELECT (employee.name)Name , vacation_picks._date1 as Date FROM employee LEFT OUTER JOIN vacation_picks on employee.employee_id = vacation_picks.employee_id WHERE vacation_picks._date1 = :day "); </code></pre> <p>This is on one of the calendar.php pages </p> <pre><code>$myVariable = ('2017-1-1'); // This executes the SQL query, binding the parameter as we go. $sth-&gt;execute(array( ':day' =&gt; $myVariable )); // echo $myVariable; foreach($sth as $row) { echo $row['Name']; } </code></pre> <p>Even putting the 'Day One' php on calendar.php with vacationnames.php required_once gives me no result. I would prefer to have it referenced with even less code on calendar.php if possible.</p> <p>Thanks for looking.</p>
0debug
Unable to resolve dependencies for Android SDK Tools : <p>I can't install Android SDK Tools on Android Studio (version 2.3).</p> <p>I got the following error, <img src="https://i.imgur.com/1pWEdzr.png" alt="Unable to resolve dependencies for Android SDK Tools"></p> <p>Is there anyway I can solve this error?</p>
0debug
How to output whole information when using group_by and summarize : <p>My data has continent, country and dif(number).I am now trying to find the maximum of dif by each continent, and following is my code. How can I get the countries name at the same time?</p> <pre><code>dt_dif %&gt;% group_by(continent)%&gt;% summarize(max_dif = max(dif)) </code></pre>
0debug
How can I get IOBluetoothDevice's battery level, using Swift and AppKit (Xcode for MacOS) : <p>I am using <strong>Xcode</strong> to develop a <strong>MacOS app</strong>, based on <strong>Cocoa</strong> &amp; <strong>AppKit</strong>, written in <strong>Swift</strong>.</p> <p>I am using <a href="https://developer.apple.com/documentation/iobluetooth/iobluetoothdevice" rel="noreferrer">IOBluetoothDevice</a> objects throughout my app, and I want to be able to display the devices' battery levels, if accessible.</p> <p>I expect that devices which battery levels are visible on the OS's Bluetooth settings (see image below), to be also accessible programmatically (e.g., AirPods, Magic Keyboard, etc.). However, I could not find this anywhere.</p> <p>I have also thought about executing a terminal command and found <a href="https://apple.stackexchange.com/questions/215256/check-the-battery-level-of-connected-bluetooth-headphones-from-the-command-line">this thread</a>, but it did also not work.</p> <p>Thanks</p> <p><a href="https://i.stack.imgur.com/TzlCd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TzlCd.png" alt="Bluetooth device battery level available to the OS"></a></p>
0debug
Python 3.4 - Text.get() on Tkinter returns Attribute Error : <p>Im using Python3.4 </p> <p>I was trying to run a simple program that reads the Input from the Text Box Widget of Tkinter. </p> <p>Im New to Tkinter, from the TkDocs i saw its a simple get command that would read the content of Text Box and store in a Variable.</p> <p>In My case neither Insert nor Get is working; both of them gives as Unknown Attribute Get &amp; Insert.</p> <p>I was facing difficulty to add the code, please check the image<a href="https://i.stack.imgur.com/UtX7z.jpg" rel="nofollow">Containd the sample Code</a></p>
0debug
How to store tokens in react native? : <p>I used to develop in android previously and i used to used SharePreference for storing user tokens. Is there anything such available in react native for both ios and android? </p>
0debug
Evaluate expression in parentheses, in String : <p>In Java, if I have a string like <code>"(3+5)x + x^(6/2)"</code>, how could I replace all expressions in parentheses with their evaluations, to get the string <code>"8x + x^3"</code>?</p>
0debug
How to write Python not in logical in java? : I used to write something like this in Python` if name not in data: do something else: print("that name is already taken")` and now im learning java and i have no idea to write the "not in" logical in java, please help XD
0debug
static void piix4_reset(void *opaque) { PIIX4PMState *s = opaque; uint8_t *pci_conf = s->dev.config; pci_conf[0x58] = 0; pci_conf[0x59] = 0; pci_conf[0x5a] = 0; pci_conf[0x5b] = 0; }
1threat
static int vorbis_decode_frame(AVCodecContext *avccontext, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; vorbis_context *vc = avccontext->priv_data ; GetBitContext *gb = &(vc->gb); const float *channel_ptrs[255]; int i, len; if (!buf_size) return 0; av_dlog(NULL, "packet length %d \n", buf_size); init_get_bits(gb, buf, buf_size*8); len = vorbis_parse_audio_packet(vc); if (len <= 0) { *data_size = 0; return buf_size; } if (!vc->first_frame) { vc->first_frame = 1; *data_size = 0; return buf_size ; } av_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb) / 8, get_bits_count(gb) % 8, len); if (vc->audio_channels > 8) { for (i = 0; i < vc->audio_channels; i++) channel_ptrs[i] = vc->channel_floors + i * len; } else { for (i = 0; i < vc->audio_channels; i++) channel_ptrs[i] = vc->channel_floors + len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i]; } if (avccontext->sample_fmt == AV_SAMPLE_FMT_FLT) vc->fmt_conv.float_interleave(data, channel_ptrs, len, vc->audio_channels); else vc->fmt_conv.float_to_int16_interleave(data, channel_ptrs, len, vc->audio_channels); *data_size = len * vc->audio_channels * av_get_bytes_per_sample(avccontext->sample_fmt); return buf_size ; }
1threat
static void coroutine_fn v9fs_walk(void *opaque) { int name_idx; V9fsQID *qids = NULL; int i, err = 0; V9fsPath dpath, path; uint16_t nwnames; struct stat stbuf; size_t offset = 7; int32_t fid, newfid; V9fsString *wnames = NULL; V9fsFidState *fidp; V9fsFidState *newfidp = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; V9fsQID qid; err = pdu_unmarshal(pdu, offset, "ddw", &fid, &newfid, &nwnames); if (err < 0) { pdu_complete(pdu, err); return ; } offset += err; trace_v9fs_walk(pdu->tag, pdu->id, fid, newfid, nwnames); if (nwnames && nwnames <= P9_MAXWELEM) { wnames = g_malloc0(sizeof(wnames[0]) * nwnames); qids = g_malloc0(sizeof(qids[0]) * nwnames); for (i = 0; i < nwnames; i++) { err = pdu_unmarshal(pdu, offset, "s", &wnames[i]); if (err < 0) { goto out_nofid; } if (name_is_illegal(wnames[i].data)) { err = -ENOENT; goto out_nofid; } offset += err; } } else if (nwnames > P9_MAXWELEM) { err = -EINVAL; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } v9fs_path_init(&dpath); v9fs_path_init(&path); err = fid_to_qid(pdu, fidp, &qid); if (err < 0) { goto out; } v9fs_path_copy(&dpath, &fidp->path); v9fs_path_copy(&path, &fidp->path); for (name_idx = 0; name_idx < nwnames; name_idx++) { if (not_same_qid(&pdu->s->root_qid, &qid) || strcmp("..", wnames[name_idx].data)) { err = v9fs_co_name_to_path(pdu, &dpath, wnames[name_idx].data, &path); if (err < 0) { goto out; } err = v9fs_co_lstat(pdu, &path, &stbuf); if (err < 0) { goto out; } stat_to_qid(&stbuf, &qid); v9fs_path_copy(&dpath, &path); } memcpy(&qids[name_idx], &qid, sizeof(qid)); } if (fid == newfid) { BUG_ON(fidp->fid_type != P9_FID_NONE); v9fs_path_copy(&fidp->path, &path); } else { newfidp = alloc_fid(s, newfid); if (newfidp == NULL) { err = -EINVAL; goto out; } newfidp->uid = fidp->uid; v9fs_path_copy(&newfidp->path, &path); } err = v9fs_walk_marshal(pdu, nwnames, qids); trace_v9fs_walk_return(pdu->tag, pdu->id, nwnames, qids); out: put_fid(pdu, fidp); if (newfidp) { put_fid(pdu, newfidp); } v9fs_path_free(&dpath); v9fs_path_free(&path); out_nofid: pdu_complete(pdu, err); if (nwnames && nwnames <= P9_MAXWELEM) { for (name_idx = 0; name_idx < nwnames; name_idx++) { v9fs_string_free(&wnames[name_idx]); } g_free(wnames); g_free(qids); } }
1threat
int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset, const void *buf, int count) { int ret; ret = bdrv_pwrite(bs, offset, buf, count); if (ret < 0) { return ret; } if ((bs->open_flags & BDRV_O_CACHE_MASK) != 0) { bdrv_flush(bs); } return 0; }
1threat
static int get_buffer(AVCodecContext *avctx, AVFrame *pic) { pic->type = FF_BUFFER_TYPE_USER; pic->data[0] = (void *)1; return 0; }
1threat
def search(arr,n) : XOR = 0 for i in range(n) : XOR = XOR ^ arr[i] return (XOR)
0debug
CSS Grid custom layout creation : <p>After hours of spending time trying to configure this thing, I couldn't get to correct answer about making these 'custom' grid layouts. I tried on my own but didn't get even close to it.</p> <p>I am trying to make a layout provided in the picture. If someone could help me I would appreciate it a lot!</p> <p><a href="https://i.stack.imgur.com/zaShX.jpg" rel="nofollow noreferrer">GRID LAYOUT IMAGE</a></p>
0debug
Adding two big numbers in javascript : <p>I've been trying to add the following numbers using javascript; <code>76561197960265728</code> + <code>912447736</code></p> <p>Sadly, because of rounding in javascript it will not get the correct number, I need the number as a string.</p> <p>I've tried removing the last few digits using substr and then adding the two numbers together and then putting the two strings together, sadly this doesn't work if the first of the number is a 1.</p> <pre><code>function steamid(tradelink){ var numbers = parseInt(tradelink.split('?partner=')[1].split('&amp;')[0]), base = '76561197960265728'; var number = parseInt(base.substr(-(numbers.toString().length + 1))) + numbers; steamid = //put back together } steamid('https://steamcommunity.com/tradeoffer/new/?partner=912447736&amp;token=qJD0Oui2'); </code></pre> <p>Expected: <code>76561198872713464</code></p>
0debug
Format date string to german string representation : <p>I have a string <code>Fri, 16 Aug 2019 07:04:12 +0000</code> and I want to convert it to german string representation <code>16.8.2019 07:04:12</code></p> <p>How can I do that in Swift 4?</p> <p>Thanks a lot</p>
0debug
Changing letters in a string dependant on case in python : <p>I'm a beginner at Python and I'm trying to self-teach. There's a task where I need to create a program that takes a string from the user and changes all uppercase letters to 'U' and all lowercase letters to 'l'.</p> <p>I'm completely stuck with this, how is it possible to do this? From searching I've found about regular expressions, however this hasn't been covered yet and so I'm unsure that I'd be expected to use them.</p>
0debug
static void test_primitives(gconstpointer opaque) { TestArgs *args = (TestArgs *) opaque; const SerializeOps *ops = args->ops; PrimitiveType *pt = args->test_data; PrimitiveType *pt_copy = g_malloc0(sizeof(*pt_copy)); Error *err = NULL; void *serialize_data; pt_copy->type = pt->type; ops->serialize(pt, &serialize_data, visit_primitive_type, &err); ops->deserialize((void **)&pt_copy, serialize_data, visit_primitive_type, &err); g_assert(err == NULL); g_assert(pt_copy != NULL); if (pt->type == PTYPE_STRING) { g_assert_cmpstr(pt->value.string, ==, pt_copy->value.string); g_free((char *)pt_copy->value.string); } else if (pt->type == PTYPE_NUMBER) { GString *double_expected = g_string_new(""); GString *double_actual = g_string_new(""); g_string_printf(double_expected, "%.6f", pt->value.number); g_string_printf(double_actual, "%.6f", pt_copy->value.number); g_assert_cmpstr(double_actual->str, ==, double_expected->str); g_string_free(double_expected, true); g_string_free(double_actual, true); } else if (pt->type == PTYPE_BOOLEAN) { g_assert_cmpint(!!pt->value.max, ==, !!pt->value.max); } else { g_assert_cmpint(pt->value.max, ==, pt_copy->value.max); } ops->cleanup(serialize_data); g_free(args); g_free(pt_copy); }
1threat
I can't make this JavaSctipt count working : A couldn't figure out what is the problem with my code, basically I want to make a button (out of divs) and a paragraph (or any text field) below the divs that counts the clicks. I know there is plenty of topics about this, but I couldn't do it, so any help would be appreciated. HTML: <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <!-- Latest compiled and minified CSS --> <link type="text/css" rel="stylesheet" href="CSS.css"/> </head> <body> <form name="ButtonForm"> <div id="container"> <div id="pushed" ></div> <div id="butt"></div> </div> <div id="showCount"></div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" type="text/javascript"></script> <script src="Untitled-1.js" type="text/javascript"></script> </form> </body> </html> JavaScript: $(document).ready(function(){ $('#butt').mousedown(function(){ $("#butt").hide(); }); $("#pushed").mouseup(function(){ $("#butt").show(); }); $("#butt").click(function(){ button_click(); }); }); var clicks=0; function button_click(){ clicks=parseInt(clicks)+parseInt(1); var divData=document.getElementById("showCount"); divData.innerHTML="Clicks:"+clicks; }
0debug