problem
stringlengths
26
131k
labels
class label
2 classes
static int iszero(const int16_t *c, int sz) { int n; for (n = 0; n < sz; n += 4) if (AV_RN32A(&c[n])) return 0; return 1; }
1threat
PPC_OP(mulli) { T0 = (Ts0 * SPARAM(1)); RETURN(); }
1threat
why need to change url when we are working with ajax : <p>why it's need to change URL when we are working with AJAX ? as example when google translate start translate phrase or word change URL? whereas all information are sending and receiving using AJAX.</p>
0debug
how to fix "<variable> not defined" : so i am making a alert system where if someone deletes a channel it sends a message with the name of the channel that was deleted and the Deleter, so i tried making it by coding *this* : ``` client.on('channelDelete', channel => { var channelDeleteAuthor = channelDelete.action.author const lChannel = message.channels.find(ch => ch.name === 'bot-logs') if (!channel) return; channel.send(`Channel Deleted by ${channelDeleteAuthor}`) .then(message => console.log(`Channel Deleted by ${channelDeleteAuthor}`)) .catch(console.error) }) ``` and it didn't work, how do i achieve that action?
0debug
int vfio_region_mmap(VFIORegion *region) { int i, prot = 0; char *name; if (!region->mem) { return 0; } prot |= region->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0; prot |= region->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0; for (i = 0; i < region->nr_mmaps; i++) { region->mmaps[i].mmap = mmap(NULL, region->mmaps[i].size, prot, MAP_SHARED, region->vbasedev->fd, region->fd_offset + region->mmaps[i].offset); if (region->mmaps[i].mmap == MAP_FAILED) { int ret = -errno; trace_vfio_region_mmap_fault(memory_region_name(region->mem), i, region->fd_offset + region->mmaps[i].offset, region->fd_offset + region->mmaps[i].offset + region->mmaps[i].size - 1, ret); region->mmaps[i].mmap = NULL; for (i--; i >= 0; i--) { memory_region_del_subregion(region->mem, &region->mmaps[i].mem); munmap(region->mmaps[i].mmap, region->mmaps[i].size); object_unparent(OBJECT(&region->mmaps[i].mem)); region->mmaps[i].mmap = NULL; } return ret; } name = g_strdup_printf("%s mmaps[%d]", memory_region_name(region->mem), i); memory_region_init_ram_ptr(&region->mmaps[i].mem, memory_region_owner(region->mem), name, region->mmaps[i].size, region->mmaps[i].mmap); g_free(name); memory_region_set_skip_dump(&region->mmaps[i].mem); memory_region_add_subregion(region->mem, region->mmaps[i].offset, &region->mmaps[i].mem); trace_vfio_region_mmap(memory_region_name(&region->mmaps[i].mem), region->mmaps[i].offset, region->mmaps[i].offset + region->mmaps[i].size - 1); } return 0; }
1threat
How can I see the full expanded contract of a Typescript type? : <p>If I have a collection of types that looks a bit like this, only more verbose:</p> <pre><code>type ValidValues = string | number | null type ValidTypes = "text" | "time" | "unknown" type Decorated = { name?: string | null type?: ValidTypes value?: ValidValues title: string start: number } type Injected = { extras: object } // overriding the types from Decorated type Text = Decorated &amp; Injected &amp; { name: string type: "text" value: string } </code></pre> <p>My actual code has more going on, but this shows the core idea. I don't want to have to trust myself to get the relationships between types just right. I want tooling to show me what the type definition for <code>Text</code> "evaluates" to, after all the type algebra.</p> <p>So for the above example, I'm hoping the fields specified in <code>Text</code> will override the previous declarations made in the <code>Decorated</code> type, and the output of my hypothetical tooltip would (I hope) show me something like this:</p> <pre><code>{ name: string type: "text" value: string title: string start: number extras: object } </code></pre> <p>Is there any convenient way to get this information?</p>
0debug
How can I make a theme-able Angular Material NPM module? : <p>Is it possible to build an npm module that uses <a href="https://material.angular.io/" rel="noreferrer">Angular Material</a> and allows the components it defines to be styled by the consuming app's custom theme?</p> <p>As an example, say I create an npm module that includes a component with the following template:</p> <pre><code>&lt;button mat-raised-button color="accent"&gt;Click me!&lt;/button&gt; </code></pre> <p>Is it possible to import this component into two different apps, each of which defines <a href="https://material.angular.io/guide/theming" rel="noreferrer">a custom Angular Material theme</a>, and have the button take on the "accent" color of the current app's theme?</p> <p>Currently, I'm using <a href="https://github.com/dherges/ng-packagr" rel="noreferrer">ng-packagr</a> to build Angular-friendly npm modules. However, as far as I can tell, this module includes a <code>.scss</code> compilation stage as part of the packaging process, which means any styles defined in the module lose their ability to be customized by a theme in an app that uses the module.</p>
0debug
static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) { AVBitStreamFilterContext *bsfc = ost->bitstream_filters; AVCodecContext *avctx = ost->encoding_needed ? ost->enc_ctx : ost->st->codec; int ret; if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) { ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (ost->st->codec->extradata) { memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size); ost->st->codec->extradata_size = ost->enc_ctx->extradata_size; } } if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) pkt->pts = pkt->dts = AV_NOPTS_VALUE; if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) { if (ost->frame_number >= ost->max_frames) { av_free_packet(pkt); return; } ost->frame_number++; } if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { int i; uint8_t *sd = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, NULL); ost->quality = sd ? AV_RL32(sd) : -1; ost->pict_type = sd ? sd[4] : AV_PICTURE_TYPE_NONE; for (i = 0; i<FF_ARRAY_ELEMS(ost->error); i++) { if (sd && i < sd[5]) ost->error[i] = AV_RL64(sd + 8 + 8*i); else ost->error[i] = -1; } } if (bsfc) av_packet_split_side_data(pkt); while (bsfc) { AVPacket new_pkt = *pkt; AVDictionaryEntry *bsf_arg = av_dict_get(ost->bsf_args, bsfc->filter->name, NULL, 0); int a = av_bitstream_filter_filter(bsfc, avctx, bsf_arg ? bsf_arg->value : NULL, &new_pkt.data, &new_pkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY); if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) { uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); if(t) { memcpy(t, new_pkt.data, new_pkt.size); memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); new_pkt.data = t; new_pkt.buf = NULL; a = 1; } else a = AVERROR(ENOMEM); } if (a > 0) { pkt->side_data = NULL; pkt->side_data_elems = 0; av_free_packet(pkt); new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, av_buffer_default_free, NULL, 0); if (!new_pkt.buf) exit_program(1); } else if (a < 0) { new_pkt = *pkt; av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", bsfc->filter->name, pkt->stream_index, avctx->codec ? avctx->codec->name : "copy"); print_error("", a); if (exit_on_error) exit_program(1); } *pkt = new_pkt; bsfc = bsfc->next; } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->dts > pkt->pts) { av_log(s, AV_LOG_WARNING, "Invalid DTS: %"PRId64" PTS: %"PRId64" in output stream %d:%d, replacing by guess\n", pkt->dts, pkt->pts, ost->file_index, ost->st->index); pkt->pts = pkt->dts = pkt->pts + pkt->dts + ost->last_mux_dts + 1 - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1) - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1); } if( (avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) && pkt->dts != AV_NOPTS_VALUE && ost->last_mux_dts != AV_NOPTS_VALUE) { int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); if (pkt->dts < max) { int loglevel = max - pkt->dts > 2 || avctx->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; av_log(s, loglevel, "Non-monotonous DTS in output stream " "%d:%d; previous: %"PRId64", current: %"PRId64"; ", ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); if (exit_on_error) { av_log(NULL, AV_LOG_FATAL, "aborting.\n"); exit_program(1); } av_log(s, loglevel, "changing to %"PRId64". This may result " "in incorrect timestamps in the output file.\n", max); if(pkt->pts >= pkt->dts) pkt->pts = FFMAX(pkt->pts, max); pkt->dts = max; } } } ost->last_mux_dts = pkt->dts; ost->data_size += pkt->size; ost->packets_written++; pkt->stream_index = ost->index; if (debug_ts) { av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n", av_get_media_type_string(ost->enc_ctx->codec_type), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base), pkt->size ); } ret = av_interleaved_write_frame(s, pkt); if (ret < 0) { print_error("av_interleaved_write_frame()", ret); main_return_code = 1; close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); } av_free_packet(pkt); }
1threat
How critical is dumb-init for Docker? : <p><em>I hope that this question will not be marked as <code>primarily opinion-based</code>, but that there is an objective answer to it.</em></p> <p>I have read <a href="https://engineeringblog.yelp.com/2016/01/dumb-init-an-init-for-docker.html">Introducing dumb-init, an init system for Docker containers</a>, which extensively describes why and how to use <code>dumb-init</code>. To be honest, for someone not too experienced with how the Linux process structure works, this sounds pretty dramatic - and it feels as if you are doing things entirely wrong if you don't use <code>dumb-init</code>.</p> <p>This is why I'm thinking about using it within my very own Docker images… what keeps me from doing this is the fact that I have not yet found an official Docker image that uses it.</p> <ul> <li>Take <a href="https://github.com/docker-library/mongo/blob/b5c66be72b21c54526b05c3ad99270ad8a0e3bcf/3.3/Dockerfile">mongo</a> as an example: They call <code>mongod</code> directly.</li> <li>Take <a href="https://github.com/docker-library/postgres/blob/b1831ce069d10b14be05b9ddf6823e3d18c62cee/9.6/Dockerfile">postgres</a> as an example: They call <code>postgres</code> directly.</li> <li>Take <a href="https://github.com/nodejs/docker-node/blob/9a4e5a31df1e7d1df8b3a2d74f23f340d5210ada/6.2/Dockerfile">node</a> as an example: They call <code>node</code> directly.</li> <li>…</li> </ul> <p>If <code>dumb-init</code> is <strong>so</strong> important - why is apparently nobody using it? What am I missing here?</p>
0debug
Change Flutter Drawer Background Color : <p>How can I change the background color of a flutter nav drawer? There doesn't seem to be a color or background-color property.</p>
0debug
hi, i want to format sql result in to givin format using sql server : sql result ----> id student_name class 1 abc 1A 2 xyz 1A 3 dsk 1A 4 uij 1A ................. ................. ................. ................. ................. up 1000 results and i want to format data in my specific format id1 student_name1 class1 id2 student_name2 class2 id3 student_name3 class3 1 abc 1A 2 abc 1A 3 abc 1A 4 abc 1A 5 abc 1A 6 abc 1A 7 abc 1A please help ........ as soon as posible thanks & regards ravi kumar
0debug
jQuery if statement with more conditions : <p>I want to disable css when going through the if statement. But when I add another condition to the if statement the functions is not working.</p> <p>Here is the function:</p> <pre><code>$(document).ready(function(){ $("#exampleSelect1").change(function (){ $('#form-zonwering').css('display','block'); if($("#exampleSelect1 option:selected").val()!= "Greenline_Veranda" || "Profiline_Veranda"){ $('#form-zonwering').css('display','none');} }); }); </code></pre> <p>Thanks for your time!</p>
0debug
static inline void conv_to_float(float *arr, int32_t *cof, int num) { int i; for (i = 0; i < num; i++) arr[i] = (float)cof[i]/INT32_MAX; }
1threat
void ff_avg_h264_qpel8_mc31_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_8x8_msa(src - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride); }
1threat
PostMessage, how to send CTRL BUTTON? : <p>I'm using C#.</p> <p>I have process file and I can send via PostMessage for example button 'W'.</p> <p>I have idea how to make shortcut -> I want to spam each milisecond button "CTRL" (works for button "S" cuz I checked it) and then send "W" button.</p> <p>But my problem is I don't know how to send 'CTRL" via PostMessage</p> <p>Any suggestions?</p>
0debug
Flutter: how to force an application restart (in production mode)? : <p>In <em>production mode</em>, is there a way to force a full restart of the application (I am <strong>not</strong> talking about a hot reload at development time!).</p> <p>Practical use cases:</p> <ul> <li><p>At initialization process the application detects that there is no network connection. The lack of network connectivity might have prevented a correct start up (e.g. loading of external resource such as JSON files...).</p></li> <li><p>During the initial handshaking, new versions of some important resources need to be downloaded (kind of update).</p></li> </ul> <p>In both use cases, I would like the application to proceed with a full restart, rather than having to build a complex logic at the ApplicationState level.</p> <p>Many thanks for your hints.</p>
0debug
void vfio_pci_write_config(PCIDevice *pdev, uint32_t addr, uint32_t val, int len) { VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev); uint32_t val_le = cpu_to_le32(val); trace_vfio_pci_write_config(vdev->vbasedev.name, addr, val, len); if (pwrite(vdev->vbasedev.fd, &val_le, len, vdev->config_offset + addr) != len) { error_report("%s(%04x:%02x:%02x.%x, 0x%x, 0x%x, 0x%x) failed: %m", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, addr, val, len); } if (pdev->cap_present & QEMU_PCI_CAP_MSI && ranges_overlap(addr, len, pdev->msi_cap, vdev->msi_cap_size)) { int is_enabled, was_enabled = msi_enabled(pdev); pci_default_write_config(pdev, addr, val, len); is_enabled = msi_enabled(pdev); if (!was_enabled) { if (is_enabled) { vfio_msi_enable(vdev); } } else { if (!is_enabled) { vfio_msi_disable(vdev); } else { vfio_update_msi(vdev); } } } else if (pdev->cap_present & QEMU_PCI_CAP_MSIX && ranges_overlap(addr, len, pdev->msix_cap, MSIX_CAP_LENGTH)) { int is_enabled, was_enabled = msix_enabled(pdev); pci_default_write_config(pdev, addr, val, len); is_enabled = msix_enabled(pdev); if (!was_enabled && is_enabled) { vfio_msix_enable(vdev); } else if (was_enabled && !is_enabled) { vfio_msix_disable(vdev); } } else { pci_default_write_config(pdev, addr, val, len); } }
1threat
Angular - how to find if an element in an array that matches a certain condition exists? : Typescript newb question, but I need the fastest way to find if an element with certain condition exists. Is there something like `exists(e=>{e.....bla bla bla})` in typescript?
0debug
int ff_wma_init(AVCodecContext * avctx, int flags2) { WMACodecContext *s = avctx->priv_data; int i; float *window; float bps1, high_freq; volatile float bps; int sample_rate1; int coef_vlc_table; s->sample_rate = avctx->sample_rate; s->nb_channels = avctx->channels; s->bit_rate = avctx->bit_rate; s->block_align = avctx->block_align; dsputil_init(&s->dsp, avctx); if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; } else { s->version = 2; } if (s->sample_rate <= 16000) { s->frame_len_bits = 9; } else if (s->sample_rate <= 22050 || (s->sample_rate <= 32000 && s->version == 1)) { s->frame_len_bits = 10; } else { s->frame_len_bits = 11; } s->frame_len = 1 << s->frame_len_bits; if (s->use_variable_block_len) { int nb_max, nb; nb = ((flags2 >> 3) & 3) + 1; if ((s->bit_rate / s->nb_channels) >= 32000) nb += 2; nb_max = s->frame_len_bits - BLOCK_MIN_BITS; if (nb > nb_max) nb = nb_max; s->nb_block_sizes = nb + 1; } else { s->nb_block_sizes = 1; } s->use_noise_coding = 1; high_freq = s->sample_rate * 0.5; sample_rate1 = s->sample_rate; if (s->version == 2) { if (sample_rate1 >= 44100) sample_rate1 = 44100; else if (sample_rate1 >= 22050) sample_rate1 = 22050; else if (sample_rate1 >= 16000) sample_rate1 = 16000; else if (sample_rate1 >= 11025) sample_rate1 = 11025; else if (sample_rate1 >= 8000) sample_rate1 = 8000; } bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate); s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2; bps1 = bps; if (s->nb_channels == 2) bps1 = bps * 1.6; if (sample_rate1 == 44100) { if (bps1 >= 0.61) s->use_noise_coding = 0; else high_freq = high_freq * 0.4; } else if (sample_rate1 == 22050) { if (bps1 >= 1.16) s->use_noise_coding = 0; else if (bps1 >= 0.72) high_freq = high_freq * 0.7; else high_freq = high_freq * 0.6; } else if (sample_rate1 == 16000) { if (bps > 0.5) high_freq = high_freq * 0.5; else high_freq = high_freq * 0.3; } else if (sample_rate1 == 11025) { high_freq = high_freq * 0.7; } else if (sample_rate1 == 8000) { if (bps <= 0.625) { high_freq = high_freq * 0.5; } else if (bps > 0.75) { s->use_noise_coding = 0; } else { high_freq = high_freq * 0.65; } } else { if (bps >= 0.8) { high_freq = high_freq * 0.75; } else if (bps >= 0.6) { high_freq = high_freq * 0.6; } else { high_freq = high_freq * 0.5; } } dprintf(s->avctx, "flags2=0x%x\n", flags2); dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", s->version, s->nb_channels, s->sample_rate, s->bit_rate, s->block_align); dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); { int a, b, pos, lpos, k, block_len, i, j, n; const uint8_t *table; if (s->version == 1) { s->coefs_start = 3; } else { s->coefs_start = 0; } for(k = 0; k < s->nb_block_sizes; k++) { block_len = s->frame_len >> k; if (s->version == 1) { lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b >> 1)) / b; if (pos > block_len) pos = block_len; s->exponent_bands[0][i] = pos - lpos; if (pos >= block_len) { i++; break; } lpos = pos; } s->exponent_sizes[0] = i; } else { table = NULL; a = s->frame_len_bits - BLOCK_MIN_BITS - k; if (a < 3) { if (s->sample_rate >= 44100) table = exponent_band_44100[a]; else if (s->sample_rate >= 32000) table = exponent_band_32000[a]; else if (s->sample_rate >= 22050) table = exponent_band_22050[a]; } if (table) { n = *table++; for(i=0;i<n;i++) s->exponent_bands[k][i] = table[i]; s->exponent_sizes[k] = n; } else { j = 0; lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b << 1)) / (4 * b); pos <<= 2; if (pos > block_len) pos = block_len; if (pos > lpos) s->exponent_bands[k][j++] = pos - lpos; if (pos >= block_len) break; lpos = pos; } s->exponent_sizes[k] = j; } } s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; s->high_band_start[k] = (int)((block_len * 2 * high_freq) / s->sample_rate + 0.5); n = s->exponent_sizes[k]; j = 0; pos = 0; for(i=0;i<n;i++) { int start, end; start = pos; pos += s->exponent_bands[k][i]; end = pos; if (start < s->high_band_start[k]) start = s->high_band_start[k]; if (end > s->coefs_end[k]) end = s->coefs_end[k]; if (end > start) s->exponent_high_bands[k][j++] = end - start; } s->exponent_high_sizes[k] = j; #if 0 tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", s->frame_len >> k, s->coefs_end[k], s->high_band_start[k], s->exponent_high_sizes[k]); for(j=0;j<s->exponent_high_sizes[k];j++) tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]); tprintf(s->avctx, "\n"); #endif } } #ifdef TRACE { int i, j; for(i = 0; i < s->nb_block_sizes; i++) { tprintf(s->avctx, "%5d: n=%2d:", s->frame_len >> i, s->exponent_sizes[i]); for(j=0;j<s->exponent_sizes[i];j++) tprintf(s->avctx, " %d", s->exponent_bands[i][j]); tprintf(s->avctx, "\n"); } } #endif for(i = 0; i < s->nb_block_sizes; i++) { int n, j; float alpha; n = 1 << (s->frame_len_bits - i); window = av_malloc(sizeof(float) * n); alpha = M_PI / (2.0 * n); for(j=0;j<n;j++) { window[j] = sin((j + 0.5) * alpha); } s->windows[i] = window; } s->reset_block_lengths = 1; if (s->use_noise_coding) { if (s->use_exp_vlc) s->noise_mult = 0.02; else s->noise_mult = 0.04; #ifdef TRACE for(i=0;i<NOISE_TAB_SIZE;i++) s->noise_table[i] = 1.0 * s->noise_mult; #else { unsigned int seed; float norm; seed = 1; norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult; for(i=0;i<NOISE_TAB_SIZE;i++) { seed = seed * 314159 + 1; s->noise_table[i] = (float)((int)seed) * norm; } } #endif } coef_vlc_table = 2; if (s->sample_rate >= 32000) { if (bps1 < 0.72) coef_vlc_table = 0; else if (bps1 < 1.16) coef_vlc_table = 1; } s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2 ]; s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1]; init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0], s->coef_vlcs[0]); init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1], s->coef_vlcs[1]); return 0; }
1threat
pycharm environment - really new, what is wrong with my code? : <p>really new, what is wrong with my code? i want that if i'm putting list that there is words that make the conditions i will get the numbers of words that make the conditions.</p> <pre><code>def ret(List): list = input("enter your list: ") num_of_string_match = 0 for element in List: if (len(element) &gt;= 2) and element[0]== element[len(element)-1]: num_of_string_match = num_of_string_match + 1 return ('num_of_string_match') #program code: list = ["aba", "mom", "bomb","gal"] myList = ret(list) </code></pre>
0debug
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) { if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){ AVDictionaryEntry *tag=NULL; av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); while((tag=av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) { if(strcmp("language", tag->key)){ const char *p = tag->value; av_log(ctx, AV_LOG_INFO, "%s %-16s: ", indent, tag->key); while(*p) { char tmp[256]; size_t len = strcspn(p, "\xd\xa"); av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1)); av_log(ctx, AV_LOG_INFO, "%s", tmp); p += len; if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " "); if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, ""); if (*p) p++; } av_log(ctx, AV_LOG_INFO, "\n"); } } } }
1threat
How to parse my JSON String in Android? : <p>[{"id":"1","name":"Nurullah","surname":"xxxxxx","il":"eskisehir"},{"id":"2","name":"Ozgur","surname":"yyyyyy","il":"istanbul"},{"id":"3","name":"Emre","surname":"zzzzzz","il":"ankara"}]</p> <p>I showed my JSON above. I dont know that how can i parse my string in android? thank yo for answers.</p>
0debug
How to get all the text that can be visible in html code using any gem in ruby : <p>I need to get all the text which will be visible to user if the given html page is shown in browser using any ruby gem. Now I am using Mechanize and Nokogiri to scrap the data from website but I need the words or text that are visible to user. Please state any gem or method which I can use to achieve this task.</p>
0debug
Displaying JSON data in Chartjs : <p>I am trying to use <a href="http://www.chartjs.org/" rel="noreferrer">Chart JS</a> to create a table with dynamically generated data points coming from my JSON file. The logic of my code looks like so:</p> <pre><code>var datapart; for (i = 0; i &lt; jsonfile.jsonarray.length; i++){ datapart += { label: jsonfile.jsonarray[i].name, data: [jsonfile.jsonarray[i].age] }; } var config = { type: 'line', data: { labels: ["Graph Line"], datasets: [datapart] } } </code></pre> <p>My JSON file meanwhile looks something like so: </p> <pre><code>{ "jsonarray": [ { "name": "Joe", "age": 12 }, { "name": "Tom", "age": 14 } ] } </code></pre> <p>The <code>config</code> variable houses the configuration settings for ChartJS, including setting datapoints. When loaded into ChartJS, <code>config</code> provides information needed to display my chart. </p> <p>Anyhow, my thinking was to use the variable <code>datapart</code> as a means of appending the datasets using my for loop. Unfortunately the code produces no results. I understand that my method for appending variables is faulty, but am unsure how to proceed. </p> <p>How might I go about adding these JSON values to Chart.js?</p>
0debug
static void cris_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); ccc->parent_realize = dc->realize; dc->realize = cris_cpu_realizefn; ccc->parent_reset = cc->reset; cc->reset = cris_cpu_reset; cc->class_by_name = cris_cpu_class_by_name; cc->has_work = cris_cpu_has_work; cc->do_interrupt = cris_cpu_do_interrupt; cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; cc->dump_state = cris_cpu_dump_state; cc->set_pc = cris_cpu_set_pc; cc->gdb_read_register = cris_cpu_gdb_read_register; cc->gdb_write_register = cris_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = cris_cpu_handle_mmu_fault; #else cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; dc->vmsd = &vmstate_cris_cpu; #endif cc->gdb_num_core_regs = 49; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = cris_disas_set_info; dc->cannot_destroy_with_object_finalize_yet = true; }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
.NET Core 2.2 Can't be Selected In Visual Studio Build Framework : <p>Previously, I was able to select the .NET Core 2.2 Framework in the properties section of the .NET Core project, but after the latest visual studio updates I haven't been able to. </p> <p><a href="https://i.stack.imgur.com/qKU8w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qKU8w.png" alt="Framework Selection"></a></p> <p>Things I've tried:</p> <ul> <li>Repairing the .NET Core 2.2 SDK installation</li> <li>Uninstalling and Reinstalling the .NET Core 2.2 SDK</li> <li>Restarting Visual Studio</li> <li>Restarting my machine</li> <li>Making a fresh .NET Core project</li> </ul> <p>Nothing has been able to work. From the fact that it was working before I installed the latest updates, could it just be a bug? Or is there something that I'm missing? </p> <p>For some more clarity, I'm running in Windows 10 Professional x64 on the latest version of windows. </p> <p>I installed this version of .NET Core 2.2 <a href="https://www.microsoft.com/net/download/dotnet-core/2.2" rel="noreferrer">from here</a> </p> <p><a href="https://i.stack.imgur.com/TIhxO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TIhxO.png" alt="enter image description here"></a></p> <p>Any help is appreciated. Thanks!</p>
0debug
void cpu_ppc_reset (void *opaque) { CPUPPCState *env; target_ulong msr; env = opaque; msr = (target_ulong)0; if (0) { msr |= (target_ulong)MSR_HVB; } msr |= (target_ulong)0 << MSR_AP; msr |= (target_ulong)0 << MSR_SA; msr |= (target_ulong)1 << MSR_EP; #if defined (DO_SINGLE_STEP) && 0 msr |= (target_ulong)1 << MSR_SE; msr |= (target_ulong)1 << MSR_BE; #endif #if defined(CONFIG_USER_ONLY) msr |= (target_ulong)1 << MSR_FP; msr |= (target_ulong)1 << MSR_PR; #else env->nip = env->hreset_vector | env->excp_prefix; if (env->mmu_model != POWERPC_MMU_REAL) ppc_tlb_invalidate_all(env); #endif env->msr = msr; hreg_compute_hflags(env); env->reserve = (target_ulong)-1ULL; env->pending_interrupts = 0; env->exception_index = POWERPC_EXCP_NONE; env->error_code = 0; tlb_flush(env, 1); }
1threat
static uint32_t virtio_net_bad_features(VirtIODevice *vdev) { uint32_t features = 0; features |= (1 << VIRTIO_NET_F_MAC); features |= (1 << VIRTIO_NET_F_CSUM); features |= (1 << VIRTIO_NET_F_HOST_TSO4); features |= (1 << VIRTIO_NET_F_HOST_TSO6); features |= (1 << VIRTIO_NET_F_HOST_ECN); return features; }
1threat
WebView WebRTC not working : <p>I'm trying to show <code>WebRTC</code> chat in <code>WebView</code>. Related to <a href="https://developer.chrome.com/multidevice/webview/overview" rel="noreferrer"> this documentation</a> <code>WebView v36</code> supports <code>WebRTC</code>. For my test i'm using device with <code>Chrome/39.0.0.0</code> and added permissins to manifest:</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt; &lt;user-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /&gt; </code></pre> <p>but when entered into chat see chromium error in the log <em>(device doesn't show \ translate anything, only 'loading' progress bar)</em>:</p> <pre><code>W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO W/AudioManagerAndroid: No audio device will be available for recording E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO W/AudioManagerAndroid: No audio device will be available for recording D/ChromiumCameraInfo: Camera enumerated: front </code></pre> <p>tested on real device, Android 5.1.1</p>
0debug
int bdrv_has_zero_init_1(BlockDriverState *bs) { return 1; }
1threat
static void show_chapters(WriterContext *w, AVFormatContext *fmt_ctx) { int i; writer_print_section_header(w, SECTION_ID_CHAPTERS); for (i = 0; i < fmt_ctx->nb_chapters; i++) { AVChapter *chapter = fmt_ctx->chapters[i]; writer_print_section_header(w, SECTION_ID_CHAPTER); print_int("id", chapter->id); print_q ("time_base", chapter->time_base, '/'); print_int("start", chapter->start); print_time("start_time", chapter->start, &chapter->time_base); print_int("end", chapter->end); print_time("end_time", chapter->end, &chapter->time_base); show_tags(w, chapter->metadata, SECTION_ID_CHAPTER_TAGS); writer_print_section_footer(w); } writer_print_section_footer(w); }
1threat
Parameters in class name : <p>How can I pass parameters to a class name from a function?</p> <pre><code> funcName = (param) =&gt; { return (&lt;div className='param'&gt; .............. &lt;/div&gt;) } </code></pre>
0debug
static void test_validate_fail_struct(TestInputVisitorData *data, const void *unused) { TestStruct *p = NULL; Error *err = NULL; Visitor *v; v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }"); visit_type_TestStruct(v, &p, NULL, &err); g_assert(err); error_free(err); if (p) { g_free(p->string); } g_free(p); }
1threat
Nvm node install checksums do not match because of a forward slash : <p>I'm learning to use nvm to manage node versions, but all my installations fail with the error: checksums do not match.</p> <p>The only difference is the '\' in the found checksum:</p> <blockquote> <p>Computing checksum with shasum -a 256 Checksums do not match: '\0bdd8d1305777cc8cd206129ea494d6c6ce56001868dd80147aff531d6df0729' found, '0bdd8d1305777cc8cd206129ea494d6c6ce56001868dd80147aff531d6df0729' expected. nvm: install v6.9.1 failed!</p> </blockquote>
0debug
void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, int fdt_start_offset, bool coldplug, Error **errp) { trace_spapr_drc_attach(spapr_drc_index(drc)); if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(errp, "an attached device is still awaiting release"); return; } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); } g_assert(fdt || coldplug); drc->dr_indicator = SPAPR_DR_INDICATOR_ACTIVE; drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; drc->configured = coldplug; drc->signalled = (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) ? true : coldplug; if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->awaiting_allocation = true; } object_property_add_link(OBJECT(drc), "device", object_get_typename(OBJECT(drc->dev)), (Object **)(&drc->dev), NULL, 0, NULL); }
1threat
fetch api returns `function text() { [native code] }` : <p>im new with fetch api and i've got a tiny problem.</p> <pre><code>document.getElementById('getText').addEventListener('click',function(){ fetch('text.txt') .then(function(res){ return res.text }).then(function(data){ document.body.innerHTML += `&lt;br&gt;&lt;br&gt;${data}` }) .catch(function(err){ console.log(err) }) }) </code></pre> <p>this is my code. it returns this: <code>function text() { [native code] }</code> i want it to returns the content not this. i dont know what should i do !? sorry for asking a dumb question. thanks</p>
0debug
uint64_t ptimer_get_count(ptimer_state *s) { int64_t now; uint64_t counter; if (s->enabled) { now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (now - s->next_event > 0 || s->period == 0) { counter = 0; } else { uint64_t rem; uint64_t div; int clz1, clz2; int shift; rem = s->next_event - now; div = s->period; clz1 = clz64(rem); clz2 = clz64(div); shift = clz1 < clz2 ? clz1 : clz2; rem <<= shift; div <<= shift; if (shift >= 32) { div |= ((uint64_t)s->period_frac << (shift - 32)); } else { if (shift != 0) div |= (s->period_frac >> (32 - shift)); if ((uint32_t)(s->period_frac << shift)) div += 1; } counter = rem / div; } } else { counter = s->delta; } return counter; }
1threat
Android EditText android:text not working and its editable , visible : In this code i have make it as to visibility gone, editable false ( i.e inputtype none) and given android:text . none of them is working, below is my code. <EditText android:textSize="18.0sp" android:textColor="@color/red" android:id="@id/et_server_url" android:background="@drawable/background_editext" android:paddingLeft="20.0dip" android:paddingRight="20.0dip" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_marginLeft="50.0dip" android:layout_marginTop="10.0dip" android:layout_marginRight="50.0dip" android:text="@string/serverurl" android:layout_weight="0.8" android:layout_toRightOf="@id/iv_logo" android:layout_below="@id/et_email" android:layout_centerHorizontal="true" android:inputType="none" android:fontFamily="sans-serif" /> i need text in the edittext box, it must be hidden and it should not be editable Note: I have to change this only in layout. i didn't have any java files.so please help me
0debug
How to get second saturday of a month using shell/perl script? : <p>Please provide me the scripting code to find out the second saturday in a month</p>
0debug
nvm uninstall doesn't actually uninstall the node version : <p>So I'm trying to clear out older versions of node.js.</p> <p>I start with:</p> <pre><code>$ nvm ls v0.10.30 v4.2.3 -&gt; v6.6.0 system </code></pre> <p>I don't want the older versions, so I then do:</p> <pre><code>$ nvm uninstall 4.2.3 Uninstalled node v4.2.3 </code></pre> <p>I then verify that it's done what I wanted, but it gives the <em>same</em> list of installed versions as before:</p> <pre><code>$ nvm ls v0.10.30 v4.2.3 -&gt; v6.6.0 system </code></pre> <p>Specifically, <code>v4.2.3</code> is still there.</p> <p>Any ideas what I might be doing wrong? Any other way to force the uninstall? I'm using the Cloud 9 IDE.</p>
0debug
RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class org.keycloak.representations.AccessTokenResponse : <p>I'm trying to test Keycloak REST API. Instaled the version 2.1.0.Final. I can access the admin through browser with SSL without problems.</p> <p>I'm using the code above:</p> <pre><code>Keycloak keycloakClient = KeycloakBuilder.builder() .serverUrl("https://keycloak.intra.rps.com.br/auth") .realm("testrealm") .username("development") .password("development") .clientId("admin-cli") .resteasyClient(new ResteasyClientBuilder().connectionPoolSize(10).build()) .build(); List&lt;RealmRepresentation&gt; rr = keycloakClient.realms().findAll(); </code></pre> <p>And got the error:</p> <pre><code>javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class org.keycloak.representations.AccessTokenResponse javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class org.keycloak.representations.AccessTokenResponse at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:141) at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:60) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76) at com.sun.proxy.$Proxy20.grantToken(Unknown Source) at org.keycloak.admin.client.token.TokenManager.grantToken(TokenManager.java:85) at org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:65) at org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:60) at org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:52) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:413) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:102) at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76) at com.sun.proxy.$Proxy22.findAll(Unknown Source) at br.com.rps.itsm.sd.SgpKeycloakClient.doGet(SgpKeycloakClient.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class org.keycloak.representations.AccessTokenResponse at org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:42) at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:75) at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:52) at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59) at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:55) at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:251) at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:181) at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:213) at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:105) </code></pre> <p>I added the dependencies above, but do not solve my problem:</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt; &lt;artifactId&gt;resteasy-client&lt;/artifactId&gt; &lt;version&gt;3.0.19.Final&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt; &lt;artifactId&gt;resteasy-jackson-provider&lt;/artifactId&gt; &lt;version&gt;3.0.19.Final&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>Any clues?</p>
0debug
How to parse huge JSON file as stream in Json.NET? : <p>I have a very, very large JSON file (1000+ MB) of identical JSON objects. For example:</p> <pre><code>[ { "id": 1, "value": "hello", "another_value": "world", "value_obj": { "name": "obj1" }, "value_list": [ 1, 2, 3 ] }, { "id": 2, "value": "foo", "another_value": "bar", "value_obj": { "name": "obj2" }, "value_list": [ 4, 5, 6 ] }, { "id": 3, "value": "a", "another_value": "b", "value_obj": { "name": "obj3" }, "value_list": [ 7, 8, 9 ] }, ... ] </code></pre> <p>Every single item in the root JSON list follows the same structure and thus would be individually deserializable. I already have the C# classes written to receive this data, and deserializing a JSON file containing a single object without the list works as expected.</p> <p>At first, I tried to just directly deserialize my objects in a loop:</p> <pre><code>JsonSerializer serializer = new JsonSerializer(); MyObject o; using (FileStream s = File.Open("bigfile.json", FileMode.Open)) using (StreamReader sr = new StreamReader(s)) using (JsonReader reader = new JsonTextReader(sr)) { while (!sr.EndOfStream) { o = serializer.Deserialize&lt;MyObject&gt;(reader); } } </code></pre> <p>This didn't work, threw an exception clearly stating that an object is expected, not a list. My understanding is that this command would just read a single object contained at the root level of the JSON file, but since we have a <em>list</em> of objects, this is an invalid request.</p> <p>My next idea was to deserialize as a C# List of objects:</p> <pre><code>JsonSerializer serializer = new JsonSerializer(); List&lt;MyObject&gt; o; using (FileStream s = File.Open("bigfile.json", FileMode.Open)) using (StreamReader sr = new StreamReader(s)) using (JsonReader reader = new JsonTextReader(sr)) { while (!sr.EndOfStream) { o = serializer.Deserialize&lt;List&lt;MyObject&gt;&gt;(reader); } } </code></pre> <p>This does succeed. However, it only somewhat reduces the issue of high RAM usage. In this case it does look like the application is deserializing items one at a time, and so is not reading the entire JSON file into RAM, but we still end up with a lot of RAM usage because the C# List object now contains all of the data from the JSON file in RAM. This has only displaced the problem.</p> <p>I then decided to simply try taking a single character off the beginning of the stream (to eliminate the <code>[</code>) by doing <code>sr.Read()</code> before going into the loop. The first object then does read successfully, but subsequent ones do not, with an exception of "unexpected token". My guess is this is the comma and space between the objects throwing the reader off.</p> <p>Simply removing square brackets won't work since the objects do contain a primitive list of their own, as you can see in the sample. Even trying to use <code>},</code> as a separator won't work since, as you can see, there are sub-objects within the objects.</p> <p>What my goal is, is to be able to read the objects from the stream one at a time. Read an object, do something with it, then discard it from RAM, and read the next object, and so on. This would eliminate the need to load either the entire JSON string or the entire contents of the data into RAM as C# objects. </p> <p>What am I missing?</p>
0debug
x:bind nullreferenceexception when using the controltemplate : When i'm writing a myButton,which is inherit from button, i set the ControlTemplate using an image,the source is x:bind to a string property in codebehind,like the screenshot below: [1]: https://i.stack.imgur.com/YN0DX.png why there is an error "Object reference not set to an instance of an object ", i can't build project,how to fix it ,thanks! forgive my bad English.
0debug
Simple change handler not working : I am completely new to JQuery and am having trouble getting a simple HTML page containing JQuery (that I gleaned from another Stack Overflow thread, which unfortunately wasn't complete enough for a JQuery newbie like me, apparently!) to work properly. Here is my HTML: <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> </script> <script> $(document).ready(function(){ $('#myfile').bind('change', function() { var fileName = ''; fileName = $(this).val(); $('#mytext').html(fileName); }); }); </script> </head> <body> <form> <input type="text" id="mytext" name="mytext"> <input type="file" id="myfile" name="myfile"> </form> </body> </html> When I choose a filename, I expect the "mytext" text input field to contain the name of the file I uploaded, but this does not happen. Any advice would be greatly appreciated!
0debug
How to generate series in BigQuery Standard SQL : <p>I need to generate table with <em>say</em> 600 consecutive numbers (starting with 51) in each row<br> How I do this with BigQuery Standard SQL? </p>
0debug
Cant have matrix multiplication work properly : <p>I have been trying to use homogeneous transformations on C++ but i cant get the matrix multiplication to work. Am I doing something wrong in the code?</p> <p>I checked doing it by hand and it doesnt seem to be wrong. Did i miss something?</p> <pre><code>#include "stdafx.h" using namespace std; float point[3][1]; float point_trans[3][1] = {0,0,0}; float rot[3][3] = { {1,2,3},{4,5,6},{7,8,9} }; float d[3][1] = {0,0,0}; float x,y,z; float transform (float x1, float y1, float z1) { point[0][0] = x1; point[1][0] = y1; point[2][0] = z1; for(int i=0; i&lt;3; ++i) { for(int j=0; j&lt;1; ++j) { for(int k=0; k&lt;3; ++k) { point_trans[i][j]+=rot[i][k]*point[k][j]; } } } x1 = point_trans[0][0] + d[0][0]; y1 = point_trans[1][0] + d[1][0]; z1 = point_trans[2][0] + d[2][0]; return(x1,y1,z1); } int main() { x = 6; y = 7; z = 8; for(int i=0;i&lt;3;i++) { for(int j=0;j&lt;3;j++) { cout &lt;&lt; rot[i][j] &lt;&lt; " "; } cout &lt;&lt; endl; } (x,y,z) = transform(x,y,z); cout &lt;&lt; "X:" &lt;&lt; x &lt;&lt; " " &lt;&lt; "Y:"&lt;&lt;y&lt;&lt;" "&lt;&lt;"Z:"&lt;&lt;z&lt;&lt;endl; system("pause"); return 0; } </code></pre>
0debug
JavaScript function to run at an interval on Firebase : <p>I am trying to run a function on Firebase at an interval automatically. The references I found are either HTTP triggered or database triggered. </p> <p>Please help and point me in the right direction.</p> <p>thank you,</p> <p>Jerry</p>
0debug
AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec) { AVStream *fst; fst = av_mallocz(sizeof(AVStream)); if (!fst) return NULL; fst->priv_data = av_mallocz(sizeof(FeedData)); memcpy(&fst->codec, codec, sizeof(AVCodecContext)); stream->streams[stream->nb_streams++] = fst; return fst; }
1threat
static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int version = get_byte(pb); char language[4] = {0}; unsigned lang; if (version > 1) return -1; get_be24(pb); if (version == 1) { get_be64(pb); get_be64(pb); } else { get_be32(pb); get_be32(pb); } sc->time_scale = get_be32(pb); st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); lang = get_be16(pb); if (ff_mov_lang_to_iso639(lang, language)) av_metadata_set(&st->metadata, "language", language); get_be16(pb); return 0; }
1threat
def unique_Characters(str): for i in range(len(str)): for j in range(i + 1,len(str)): if (str[i] == str[j]): return False; return True;
0debug
static int celt_header(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; struct oggcelt_private *priv = os->private; uint8_t *p = os->buf + os->pstart; if (os->psize == 60 && !memcmp(p, ff_celt_codec.magic, ff_celt_codec.magicsize)) { uint32_t version, sample_rate, nb_channels; uint32_t overlap, extra_headers; priv = av_malloc(sizeof(struct oggcelt_private)); if (!priv) return AVERROR(ENOMEM); if (ff_alloc_extradata(st->codecpar, 2 * sizeof(uint32_t)) < 0) { av_free(priv); return AVERROR(ENOMEM); } version = AV_RL32(p + 28); sample_rate = AV_RL32(p + 36); nb_channels = AV_RL32(p + 40); overlap = AV_RL32(p + 48); extra_headers = AV_RL32(p + 56); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_CELT; st->codecpar->sample_rate = sample_rate; st->codecpar->channels = nb_channels; if (sample_rate) avpriv_set_pts_info(st, 64, 1, sample_rate); priv->extra_headers_left = 1 + extra_headers; av_free(os->private); os->private = priv; AV_WL32(st->codecpar->extradata + 0, overlap); AV_WL32(st->codecpar->extradata + 4, version); return 1; } else if (priv && priv->extra_headers_left) { ff_vorbis_stream_comment(s, st, p, os->psize); priv->extra_headers_left--; return 1; } else { return 0; } }
1threat
Why do I need to use async/await twice to make this Non-blocking? : <p>I have two functions, the first is the main function which has switch statement calling the second which is async. If my second function is async isn't that non-blocking? Would I still have to make the first one async in order for it to be non-blocking, if so why?</p> <p><strong>Example</strong></p> <pre><code>exports.funcOne = async (theParam) =&gt; { // async ?? switch (theParam) { case 'hey': return await funcTwo() default: ... } } const funcTwo = async () =&gt; { await axios.get... } </code></pre>
0debug
C: How to detect a re-entry of a char character? : <blockquote> <p>I am creating a program whereby; the first input e.g. 'a' will give a "no duplicate" result, and upon re-entry of 'a' it should would give me a "duplicate has found" result.</p> </blockquote> <pre><code>I am having a hard time finding the logic to this program. Help would be much appreciated. Thanks. </code></pre> <blockquote> <p>I am working on lines 127-129 btw. <a href="https://pastebin.com/wQKH3iZE" rel="nofollow noreferrer">https://pastebin.com/wQKH3iZE</a></p> </blockquote>
0debug
How to update a struct property in a map : <p>Currently trying to learn Go.</p> <p>I have the following function, but it only works when the team doesn't exist in the map already and it creates a new record in the map. It will not update the values if the team already has a struct in the map.</p> <pre><code>func AddLoss(teamMap map[string]TeamRow, teamName string) { if val, ok := teamMap[teamName]; ok { val.Wins++ val.GamesPlayed++ } else { newTeamRow := TeamRow{Losses: 1} teamMap[teamName] = newTeamRow } } </code></pre> <p>I have updated the function to just replace the existing record with a brand new struct with the values I want, but that seems odd that I can't update the values in a map.</p> <p>Can someone explain this to me, or point me in the right direction?</p>
0debug
static void gen_mfsr_64b(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_const_tl(SR(ctx->opcode)); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
1threat
static int rd_strip(CinepakEncContext *s, int y, int h, int keyframe, AVPicture *last_pict, AVPicture *pict, AVPicture *scratch_pict, unsigned char *buf, int64_t *best_score) { int64_t score = 0; int best_size = 0, v1_size, v4_size, v4, mb_count = s->w * h / MB_AREA; strip_info info; CinepakMode best_mode; int v4_codebooks[CODEBOOK_NUM][CODEBOOK_MAX*VECTOR_MAX]; if(!keyframe) calculate_skip_errors(s, h, last_pict, pict, &info); for(v4_size = 1, v4 = 0; v4_size <= 256; v4_size <<= 2, v4++) { info.v4_codebook = v4_codebooks[v4]; quantize(s, h, pict, 0, v4_size, v4, &info); } for(v1_size = 1; v1_size <= 256; v1_size <<= 2) { quantize(s, h, pict, 1, v1_size, -1, &info); for(v4_size = 0, v4 = -1; v4_size <= v1_size; v4_size = v4_size ? v4_size << 2 : v1_size >= 4 ? v1_size >> 2 : 1, v4++) { for(CinepakMode mode = 0; mode < MODE_COUNT; mode++) { if(keyframe && mode == MODE_MC) continue; if(!v4_size && mode != MODE_V1_ONLY) continue; info.v4_codebook = v4 >= 0 ? v4_codebooks[v4] : NULL; score = calculate_mode_score(s, mode, h, v1_size, v4_size, v4, &info); if(best_size == 0 || score < *best_score) { *best_score = score; best_size = encode_mode(s, mode, h, v1_size, v4_size, v4, scratch_pict, &info, s->strip_buf + STRIP_HEADER_SIZE); best_mode = mode; av_log(s->avctx, AV_LOG_INFO, "mode %i, %3i, %3i: %18li %i B\n", mode, v1_size, v4_size, score, best_size); #ifdef CINEPAKENC_DEBUG memcpy(s->best_mb, s->mb, mb_count*sizeof(mb_info)); #endif write_strip_header(s, y, h, keyframe, s->strip_buf, best_size); } } } } #ifdef CINEPAKENC_DEBUG if(best_mode == MODE_V1_ONLY) { s->num_v1_mode++; s->num_v1_encs += s->w*h/MB_AREA; } else { if(best_mode == MODE_V1_V4) s->num_v4_mode++; else s->num_mc_mode++; int x; for(x = 0; x < s->w*h/MB_AREA; x++) if(s->best_mb[x].best_encoding == ENC_V1) s->num_v1_encs++; else if(s->best_mb[x].best_encoding == ENC_V4) s->num_v4_encs++; else s->num_skips++; } #endif best_size += STRIP_HEADER_SIZE; memcpy(buf, s->strip_buf, best_size); return best_size; }
1threat
I want to parse json object from firebase realtime database into arraylist (android) : I want to parse json object from firebase realtime database into arraylist<br> <br> ArrayList<String> username = new ArrayList<String>();<br> ArrayList<String> password= new ArrayList<String>();<br> ArrayList<String> picture_profile= new ArrayList<String>();<br> <br> -----------------------------------json object--------------------<br> {<br> "testuser1": {<br> "password": "123456",<br> "picture_profile": "default"<br> },<br> "testuser2": {<br> "password": "123456",<br> "picture_profile": "default"<br> }<br> }
0debug
Square Brackets at the beginning of postman Json Array : <p>I have an api that expects a Json Array body like so: </p> <pre><code>{ "rrr":"123456788", "channel":"BRANCH", "amount":5500.00, "transactiondate":"12/04/2017", "debitdate":"12/04/2017", "bank":"050", "branch":"48794389", "serviceTypeId":"346346342", "dateRequested":"12/04/2017", "orderRef":"", "payerName":"Amira Oluwatobi ", "payerPhoneNumber":"+23443846434", "payerEmail":"seunfapo1@yahoo.com", "agencyCode": "834873463", "revenueCode": "49384983", "customFieldData": [ { "DESCRIPTION": "GPRR", "COLVAL": "48374387" } ] } </code></pre> <p>It works as expected on postman, but my supervisor wants a Json array with angle brackets at the beginning and end like so:</p> <pre><code>[ { "rrr":"123456788", "channel":"BRANCH", "amount":5500.00, "transactiondate":"12/04/2017", "debitdate":"12/04/2017", "bank":"050", "branch":"48794389", "serviceTypeId":"346346342", "dateRequested":"12/04/2017", "orderRef":"", "payerName":"Amira Oluwatobi ", "payerPhoneNumber":"+23443846434", "payerEmail":"seunfapo1@yahoo.com", "agencyCode": "834873463", "revenueCode": "49384983", "customFieldData": [ { "DESCRIPTION": "GPRR", "COLVAL": "48374387" } ] } ] </code></pre> <p>This does not work in postman, it sends an empty json array object. is there a way to make it work like this? or does the angle bracket even matter at all?</p>
0debug
simple code needs to convert into loop from recursive function help needed urgent : Please can anybody convert this into iteration? BEGIN SEQ(n) IF (n EQUALS 1) THEN RETURN 3 ELSEID (n EQUALS 2) THEN RETURN 2 ELSE RETURN SEQ(n – 2) + SEQ(n – 1) ENDIF END
0debug
type_init(pflash_cfi02_register_types) pflash_t *pflash_cfi02_register(hwaddr base, DeviceState *qdev, const char *name, hwaddr size, BlockDriverState *bs, uint32_t sector_len, int nb_blocs, int nb_mappings, int width, uint16_t id0, uint16_t id1, uint16_t id2, uint16_t id3, uint16_t unlock_addr0, uint16_t unlock_addr1, int be) { DeviceState *dev = qdev_create(NULL, TYPE_CFI_PFLASH02); if (bs && qdev_prop_set_drive(dev, "drive", bs)) { abort(); } qdev_prop_set_uint32(dev, "num-blocks", nb_blocs); qdev_prop_set_uint32(dev, "sector-length", sector_len); qdev_prop_set_uint8(dev, "width", width); qdev_prop_set_uint8(dev, "mappings", nb_mappings); qdev_prop_set_uint8(dev, "big-endian", !!be); qdev_prop_set_uint16(dev, "id0", id0); qdev_prop_set_uint16(dev, "id1", id1); qdev_prop_set_uint16(dev, "id2", id2); qdev_prop_set_uint16(dev, "id3", id3); qdev_prop_set_uint16(dev, "unlock-addr0", unlock_addr0); qdev_prop_set_uint16(dev, "unlock-addr1", unlock_addr1); qdev_prop_set_string(dev, "name", name); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); return CFI_PFLASH02(dev); }
1threat
void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp) { trace_spapr_drc_detach(spapr_drc_index(drc)); if (!drc->signalled && !drc->configured) { drc->isolation_state = SPAPR_DR_ISOLATION_STATE_ISOLATED; } if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { trace_spapr_drc_awaiting_isolated(spapr_drc_index(drc)); drc->awaiting_release = true; return; } if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI && drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { trace_spapr_drc_awaiting_unusable(spapr_drc_index(drc)); drc->awaiting_release = true; return; } if (drc->awaiting_allocation) { drc->awaiting_release = true; trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc)); return; } drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE; switch (spapr_drc_type(drc)) { case SPAPR_DR_CONNECTOR_TYPE_CPU: spapr_core_release(drc->dev); break; case SPAPR_DR_CONNECTOR_TYPE_PCI: spapr_phb_remove_pci_device_cb(drc->dev); break; case SPAPR_DR_CONNECTOR_TYPE_LMB: spapr_lmb_release(drc->dev); break; case SPAPR_DR_CONNECTOR_TYPE_PHB: case SPAPR_DR_CONNECTOR_TYPE_VIO: default: g_assert(false); } drc->awaiting_release = false; g_free(drc->fdt); drc->fdt = NULL; drc->fdt_start_offset = 0; object_property_del(OBJECT(drc), "device", NULL); drc->dev = NULL; }
1threat
static void draw_slice(HYuvContext *s, AVFrame *frame, int y) { int h, cy, i; int offset[AV_NUM_DATA_POINTERS]; if (s->avctx->draw_horiz_band == NULL) return; h = y - s->last_slice_end; y -= h; if (s->bitstream_bpp == 12) cy = y >> 1; else cy = y; offset[0] = frame->linesize[0] * y; offset[1] = frame->linesize[1] * cy; offset[2] = frame->linesize[2] * cy; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; emms_c(); s->avctx->draw_horiz_band(s->avctx, frame, offset, y, 3, h); s->last_slice_end = y + h; }
1threat
C# How to remove refference between two enitities using Entity Framework? : I have to models: Student = (... List<Course> CourseList); Course = (... List<Student> StudentList); I add students to few different Courses and using Entity Framework add everything to database. Please help me remove student from specific course using EF?
0debug
Python: about arrays : [![Array question][1]][1] [1]: https://i.stack.imgur.com/k1SOG.jpg I don't understand this question. Actually just this part; "Given two vectors of length n that are represented with one-dimensional arrays" I use two vectors but I don't know what value they have. for example, vector can be a = [1,2,3] but I don't know exactly what are they? what do they have? maybe it is a = [3,4,5]
0debug
array and file handling in c how i use i am bignner in programming any one can help me to become ma logics strong : array and file handling in c how I use I am new in programming any one can help me to become ma logics strong I want to know about c please help me out of this. I want to learn programming please help me to make my logics even stronger.
0debug
Is it possible to write a python program that will enable you to sort the content of a text file in python : <p>I have been writing a maths quiz and the program asks the students questions and then saves their score like so:</p> <pre><code>class_number = prompt_int_big("Before your score is saved ,are you in class 1, 2 or 3? Press the matching number") filename = (str(class_number) + "txt") with open(filename, 'a') as f: f.write("\n" + str(name) + " scored " + str(score) + " on difficulty level " + str(level_of_difficulty) + "\n") with open(filename) as f: lines = [line for line in f if line.strip()] lines.sort() if prompt_bool("Do you wish to view previous results for your class"): for line in lines: print (line) else: sys.exit("Thanks for taking part in the quiz, your teacher should discuss your score with you later") </code></pre> <p>However I have been instructed to save the last three scores to a students name and then display an average of these last three scores. This requires scores to be saved to students name. I am thinking about outsourcing this to excel however I don't know how to do this using a test file or whether a text file will even open in excel.</p> <p>Here is the rest of code:</p> <pre><code>import random import sys def get_input_or_quit(prompt, quit="Q"): prompt += " (Press '{}' to exit) : ".format(quit) val = input(prompt).strip() if val.upper() == quit: sys.exit("Goodbye") return val def prompt_bool(prompt): while True: val = get_input_or_quit(prompt).lower() if val == 'yes': return True elif val == 'no': return False else: print ("Invalid input '{}', please try again".format(val)) def prompt_int_small(prompt='', choices=(1,2)): while True: val = get_input_or_quit(prompt) try: val = int(val) if choices and val not in choices: raise ValueError("{} is not in {}".format(val, choices)) return val except (TypeError, ValueError) as e: print( "Not a valid number ({}), please try again".format(e) ) def prompt_int_big(prompt='', choices=(1,2,3)): while True: val = get_input_or_quit(prompt) try: val = int(val) if choices and val not in choices: raise ValueError("{} is not in {}".format(val, choices)) return val except (TypeError, ValueError) as e: print( "Not a valid number ({}), please try again".format(e) ) role = prompt_int_small("Are you a teacher or student? Press 1 if you are a student or 2 if you are a teacher") if role == 1: score=0 name=input("What is your name?") print ("Alright",name,"welcome to your maths quiz." " Remember to round all answers to 5 decimal places.") level_of_difficulty = prompt_int_big("What level of difficulty are you working at?\n" "Press 1 for low, 2 for intermediate " "or 3 for high\n") if level_of_difficulty == 3: ops = ['+', '-', '*', '/'] else: ops = ['+', '-', '*'] for question_num in range(1, 11): if level_of_difficulty == 1: max_number = 10 else: max_number = 20 number_1 = random.randrange(1, max_number) number_2 = random.randrange(1, max_number) operation = random.choice(ops) maths = round(eval(str(number_1) + operation + str(number_2)),5) print('\nQuestion number: {}'.format(question_num)) print ("The question is",number_1,operation,number_2) answer = float(input("What is your answer: ")) if answer == maths: print("Correct") score = score + 1 else: print ("Incorrect. The actual answer is",maths) if score &gt;5: print("Well done you scored",score,"out of 10") else: print("Unfortunately you only scored",score,"out of 10. Better luck next time") class_number = prompt_int_big("Before your score is saved ,are you in class 1, 2 or 3? Press the matching number") filename = (str(class_number) + 'txt') with open(filename, 'a') as f: f.write("\n" + str(name) + " scored " + str(score) + " on difficulty level " + str(level_of_difficulty) + "\n") with open(filename) as f: lines = [line for line in f if line.strip()] lines.sort() if prompt_bool("Do you wish to view previous results for your class"): for line in lines: print (line) else: sys.exit("Thanks for taking part in the quiz, your teacher should discuss your score with you later") </code></pre>
0debug
Code Blocks Error 1073741819 : I am new to programming. I typed this simple code and I keep getting this error message. Does anyone know the reason why the compiler stops working? I have checked the compiler settings and clicked auto detect. It still does not work though. Any suggestion is appreciated. Btw I am new to programming so break it down if explaining something. Thanks [enter image description here][1] [1]: http://i.stack.imgur.com/8KYUk.png
0debug
void do_addzeo (void) { T1 = T0; T0 += xer_ca; if (likely(!((T1 ^ (-1)) & (T1 ^ T0) & (1 << 31)))) { xer_ov = 0; } else { xer_so = 1; xer_ov = 1; } if (likely(T0 >= T1)) { xer_ca = 0; } else { xer_ca = 1; } }
1threat
what is @ sign as a css selector? : <p>I saw this in a css file:</p> <pre><code>@-webkit-keyframes loading-spinner-anim { 0% { opacity: 1} 100% {opacity: 0} } @keyframes loading-spinner-anim { 0% { opacity: 1} 100% {opacity: 0} } </code></pre> <p>what do these selectors mean?</p> <p><code>@keyframes</code> it's not a class or id selector.</p> <p><code>loading-spinner-anim</code> - the space means it's a child element of the first selector. But it's not a class or id selector.</p>
0debug
Jquery Posting Parameter Through Clickable Row : I'm new to Javascript and Jquery i want to post some data through a clickable row. I did write a code, it works, but it didn not redirect to another page. How can i redirect to another page? Thanx. $(document).ready(function () { $('#clickableRow tr').click(function (event) { var advertentieId = $(this).attr('id'); $.post("Advertentie", {advertentieId: advertentieId}); }); });
0debug
My vb class and my html file content in visual studio 2015 has been destroyed. Please help me : I have worked on my project in visual studio about about one html file and one vb file content are encrypted after closing solution. I have check previews version of file and Visual Studio backup directory. Both of above are empty. and my files are coded. My anti virus is NOD32 and it is updated recently. [This is preview of encrypted file by Notepad++][1] Please help me. [1]: https://i.stack.imgur.com/3DSGE.png
0debug
I need to write Macro in c for assembly language commads : I have written macro to add assembly language commands in C TEST_ASM(asm_command) asm( #asm_Command ) which works perfectly for single commands like TEST_ASM("nop") TEST_ASM("write 0") But it gives error : macro "TEST_ASM" passed 2 arguments, but takes just 1 for TEST_ASM("e_li r3, 0x201") This error is due to the comma in asm command, Which looks for next argument. Could it be possible that Macro take comma as string. I don't want to use variable argument macro as it will give warnings in Static analysis tools
0debug
static int mpsub_probe(AVProbeData *p) { const char *ptr = p->buf; const char *ptr_end = p->buf + p->buf_size; while (ptr < ptr_end) { if (!memcmp(ptr, "FORMAT=TIME", 11)) return AVPROBE_SCORE_EXTENSION; if (!memcmp(ptr, "FORMAT=", 7)) return AVPROBE_SCORE_EXTENSION / 3; ptr += strcspn(ptr, "\n") + 1; } return 0; }
1threat
Python OOP programming trouble : im coding a universal controller that controls all smart devices in the house my script runs correctly but show's nothing` ##this is a universal controler #1_controling LG Webos smart tv import os from pylgtv import WebOsClient import sys import logging class Device: counter=0 def __init__(self,ip,name): self.ip=(ip) self.name=(name) Device.counter += 1 smarttv=Device('192.168.0.105','Smart') class tv(Device): #launching an application def launch_app(self): logging.basicConfig(stream=sys.stdout, level=logging.INFO) try: webos_client = WebOsClient(self) webos_client.launch_app('com.webos.app.music') for app in webos_client.get_apps(): print(app) except: print("Error connecting to TV")
0debug
How to call a value that does not equal X as integer : I have an array of numbers: array = [1,2,3] and would like to call a random integer, k, that does not equal x I've tried: x = 2 k = (i for i in array if i !=x) but this returns a generator object instead of an integer. Is there a way to fix this? Thanks in advance!
0debug
How to construct matrices/vectors from a table in R? : <p>I'm quite new to R, and if I imported a .csv file and if rows represent </p> <p>time and columns represent n variables of interest, how could I construct a </p> <p>function that returns any given 1xn vector from the table? </p> <p>P.S. I'm not just interested in constructing a vector, but I will perform matrix algebra with iterative calculations to estimate parameters, which means I will need to use a for-loop. </p>
0debug
PPC_OP(subfic) { T0 = PARAM(1) + ~T0 + 1; if (T0 <= PARAM(1)) { xer_ca = 1; } else { xer_ca = 0; } RETURN(); }
1threat
ERROR in Cannot find module 'node-sass' : <p>Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error:</p> <pre><code>ERROR in Cannot find module 'node-sass' </code></pre> <p>After this I run:</p> <pre><code>npm i node-sass </code></pre> <p>Now I get this error:</p> <pre><code>gyp: No Xcode or CLT version detected! gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1 </code></pre> <p>Why won't npm install node-sass? How can I install node-sass?</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
static int aer915_init(I2CSlave *i2c) { return 0; }
1threat
How to Create optimal database design by looking at below image i.e invoice : <p>How to Create optimal database design by looking at below invoice of XYZ Ltd. stationary store, also show all possible tables including relationships.</p> <p><a href="https://i.stack.imgur.com/idx2Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/idx2Z.png" alt="enter image description here"></a></p>
0debug
How to ROUND Decimal in JQUERY : <pre><code>$(document).ready(function() { $('select').on('change', function() { $('.total_result').text( $('select[name=attendance]').val() * 0.25 + $('select[name=tardiness]').val() * 0.10 + $('select[name=rules]').val() * 0.05 + $('select[name=case]').val() * 0.05 + $('select[name=productivity]').val() * 0.15 + $('select[name=qa]').val() * 0.15 + $('select[name=utilization]').val() * 0.05 + $('select[name=schedule]').val() * 0.05 + $('select[name=fcr]').val() * 0.10 + $('select[name=aht]').val() * 0.05) ; }); }); </code></pre> <p>I have an issue with my final code. I need to round the decimal. I'm using onchange that will auto calculate. Much appreciated. TIA</p>
0debug
How do you sort a list of objects based on there properties? : #I'm trying to sort a list of objects based on their Ids. When I create a funtion that compares the Id of to objects in a list, It gets the error: Severity Code Description Project File Line Suppression State Error C3867 'BobControl::compareId': non-standard syntax; use '&' to create a pointer to member list.sort c:\users\wil\documents\visual studio 2015\projects\list.sort\list.sort\source.cpp 32 This code was used to test the issue. #include <iostream> #include <list> #include <string> using namespace std; class Bob { public: Bob::Bob(int id) { _id = id; } int getId() const { return _id; } private: int _id = 0; }; //testing lists class BobControl { public: bool compareId(const Bob& first, const Bob& second) { return (first.getId() < second.getId()); } void testCompar() { bobs.sort(compareId); } void controlBobs() { list<Bob>::iterator lit; bobs.push_back(Bob(0)); bobs.push_back(Bob(1)); bobs.push_back(Bob(5)); bobs.push_back(Bob(3)); testCompar(); for (lit = bobs.begin(); lit != bobs.end(); lit++) { cout << (*lit).getId() << endl; } } private: list<Bob> bobs; }; int main() { BobControl bobc; bobc.controlBobs(); system("PAUSE"); return 0; }
0debug
java exception with scanner : i have a problem with scanner. When i compile it, there is no problems. but when i want to run this program, i get exception. Can any of you explain me reason of this problem? import java.util.Scanner; public class CiagArytmetyczny { public static void main(String[] args) { Scanner s = new Scanner("System.in"); System.out.println("Podaj dlugosc ciagu: "); int dl = s.nextInt(); int element =2; for(int i=1; i<=dl; i++) { element=element+3; System.out.println(element); } } } Podaj dlugosc ciagu: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:864) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at CiagArytmetyczny.main(CiagArytmetyczny.java:8) Process completed.
0debug
Spring Boot @EnableScheduling conditionally : <p>Is there a way to make @EnableScheduling conditional based on an application property? also is it possible to disable controllers based on properties too?</p> <p>What I'm trying to achieve is to have the same spring boot application used to serve web requests (but not run scheduled tasks on the same machine), and also install the same app on backend servers to run only scheduled tasks.</p> <p>My app looks like this</p> <pre><code>@SpringBootApplication @EnableScheduling @EnableTransactionManagement public class MyApp { public static void main(String[] args) { SpringApplication.run(MyApp.class, args); } } </code></pre> <p>And a sample scheduled job looks like this</p> <pre><code>@Component public class MyTask { @Scheduled(fixedRate = 60000) public void doSomeBackendJob() { /* job implementation here */ } } </code></pre>
0debug
static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc, int offset) { uint8_t *start = pc->buffer + offset; uint8_t *end = pc->buffer + pc->index; if (start < pc->buffer || (start + 13 > end)) return 0; pu->pu_type = start[4]; pu->next_pu_offset = AV_RB32(start + 5); pu->prev_pu_offset = AV_RB32(start + 9); if (pu->pu_type == 0x10 && pu->next_pu_offset == 0) pu->next_pu_offset = 13; return 1; }
1threat
Making detail button always visible in IOS MapView : I have a map view on my IOS app and i want to make detail button that when user press the pin icon visible without interaction.It should be visible when user open the map.Is it possible to make it ? I use the code for showing annotation, i need it for button. https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/Art/modified_callout_2x.png self.mapView.showAnnotations([destinationAnnotation], animated: true )
0debug
list possition replacement with if statement : i am new to python and i have a question to ask about list in python. my question is can we perform replace on python list ? i have list that came from csv file like this : > 1, 0, 1, 0, 1, 0, 1, 0, 1 the aim is to replace value from [0][1] until n with categorize 0 mean "bad included list order" eg=(bad 1) the and 1 mean "good include list order" eg=(good 2) and just keep the [0][0] as it is. i have try used panda and not work, and i not sure how to used if statement inside for.i have used rappid minner and they replaced column by column and they included the [0][0] to be replaced. is there any other solution beside python? this is my code: import csv csvfile = open("tran.csv", 'r') reader = csv.reader(csvfile, delimiter=',') my_list = list(reader) a = len(my_list[1]) b = (my_list) x=0 y=0 for name in my_list: print ("costummer", my_list[0][0], "buy", my_list[n][g])
0debug
Nodemailer using gmail, Cannot create property 'mailer' on string 'SMTP' : <p>I am trying to send the data from the form I created to my gmail account, when clicking the sumbit button I always get the same error. I found a lot of issues about nodemailer, but none of them seem to be the same issue as I am experiencing. </p> <p>Ofcourse I have stated my clientId but just deleted for this post.</p> <pre><code>TypeError: Cannot create property 'mailer' on string 'SMTP' at Mail (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\nodemailer\lib\mailer\index.js:45:33) at Object.module.exports.createTransport (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\nodemailer\lib\nodemailer.js:46:14) at C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\src\app.js:39:26 at Layer.handle [as handle_request] (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\route.js:131:13) at Route.dispatch (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\layer.js:95:5) at C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:277:22 at Function.process_params (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:330:12) at next (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:271:10) at serveStatic (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\node_modules\serve-static\index.js:75:16) at Layer.handle [as handle_request] (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:312:13) at C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:280:7 at Function.process_params (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:330:12) at next (C:\Users\snowr\Documents\dev\zorgkaartnl\zorgkaartnl\node_modules\express\lib\router\index.js:271:10) </code></pre> <p>this is my app.js: </p> <pre><code>// require modules const express = require('express'); const app = express(); const pug = require('pug'); const fs = require('fs') const bodyParser = require('body-parser'); const pg = require('pg'); const nodemailer = require('nodemailer'); const xoauth2 = require('xoauth2'); //set view engine and views app.set('views', 'src/views'); app.set('view engine', 'pug'); app.use(bodyParser.urlencoded({extended: false})); app.use(express.static('./resources/')); //display index page app.get('/', function ( req, res ){ console.log('Index is displayed on localhost'); res.render('index'); }); app.post('/zorginstelling/ziekenhuis-olvg-locatie-west-voorheen-sint-lucas-andreas-ziekenhuis-amsterdam-109428/waardeer', function (req, res) { var mailOpts, smtpTrans; console.log('form word gepost') //Setup Nodemailer transport, I chose gmail. smtpTrans = nodemailer.createTransport('SMTP', { service: 'Gmail', auth: { xoauth2: xoauth2.createXOAuth2Generator({ user: 'kylevantil14@gmail.com', clientId: '-' , clientSecret: '-' , refreshToken: '-' }) } }); //Mail options mailOpts = { from: req.body.rating[name] + ' &amp;lt;' + req.body.rating[email][first] + '&amp;gt;', to: 'kylevantil14@gmail.com', subject: 'Test', text: req.body.rating[comment] + req.body.rating[questions][behandeling] + req.body.rating[name] }; smtpTrans.sendMail(mailOpts, function (error, response) { //Email not sent if (error) { console.log('There was a problem') } //Yay!! Email sent else { console.log('Email sent!') } }); }); var server = app.listen(4000, function () { console.log('Example app listening on port: ' + server.address().port); }); </code></pre>
0debug
Why the variable (line 6) get a space in white ? ( Nivel : Begginer Workflow Runestone ) : 1.''' x = 1 ''' # initialize x print(x) 2. ''' x = x + 1 # update x ''' 3. ''' print(x) for n in range(4): ''' 4. ''' n= n+1 ''' 5. ''' print("nmap -n -Pe 10.0.2 ",n) ''' # Why the variable get a space in white ? 6. ''' print("nmap -n -PE 10.0.2.",n) ''' Why this line is equal than previous line ''' 7. print("Range imprime :", x,"el número exacto") #con respecto al anterior lista ''' ***Thanks All!*** > Don´t exist bad questions. Only bad answers > ( Anybody told it )
0debug
Overview of differences between Form Controls and ActiveX Controls in Excel : <p>Why are there <strong>2 types of controls</strong> available in Excel? <em>(2 buttons, 2 combo boxes, 2 check box, etc...)</em></p> <p>What's the difference between <strong>Forms Controls</strong> and <strong>ActiveX Controls</strong>? Which one should I use?</p> <p><img src="https://i.stack.imgur.com/0vdDK.png" height="225"/></p> <p>Some code samples I find online work with my controls, but others do not. How come? </p> <p>How do I work with each type, and how can I tell the difference? </p>
0debug
void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2, uint32_t ipb) { uint8_t mbk; int update; int dct; CPUS390XState *env = &cpu->env; trace_ioinst("schm"); if (SCHM_REG1_RES(reg1)) { program_interrupt(env, PGM_OPERAND, 2); return; } mbk = SCHM_REG1_MBK(reg1); update = SCHM_REG1_UPD(reg1); dct = SCHM_REG1_DCT(reg1); if (update && (reg2 & 0x000000000000001f)) { program_interrupt(env, PGM_OPERAND, 2); return; } css_do_schm(mbk, update, dct, update ? reg2 : 0); }
1threat
Method witch iterates object's property : I have a question about method witch iterates object's property (JS). I have two objects. First Object is main. Second Object is clone. And how can I replace value of each property of clone to main Object. There are a lot of nesting. I don't have time to write for, for in , forEach cycles, because there are a lot of nesting. Such method exists?
0debug
How to use a .json file generated by a discord bot as a database file for a c# program? : <p>So I have a bot that generates this file:</p> <pre><code>"223800261297176576" : { "129592273850597376" : { "balance" : 750, "created_at" : "2016-10-08 18:00:53", "name" : "Nathiri" }, "180444644650385409" : { "balance" : 950, "created_at" : "2016-11-01 14:55:11", "name" : "WAC" }, "180456532083867650" : { "balance" : 1150, "created_at" : "2016-10-08 18:12:24", "name" : "WiNDOGE_Master" }, "194634355820199936" : { "balance" : 0, "created_at" : "2016-10-16 15:07:55", "name" : "DogeBot" }, "195889991073660929" : { "balance" : 750, "created_at" : "2016-10-24 18:47:25", "name" : "Mikey" }, "218499966652383232" : { "balance" : 1250, "created_at" : "2016-10-02 17:29:18", "name" : "[CDHG]PhoenixDeFalco" }, "223084038846545920" : { "balance" : 300, "created_at" : "2016-10-11 19:24:36", "name" : "spyty06" }, "228987707571830784" : { "balance" : 700, "created_at" : "2016-10-11 16:06:13", "name" : "[CDHG]CarrieDeFalco" }, "229026428706881537" : { "balance" : 500, "created_at" : "2016-10-02 17:40:16", "name" : "[CDHG] commander spyty06" }, "229347464065449984" : { "balance" : 750, "created_at" : "2016-10-29 20:24:44", "name" : "FaZe King" }, "238783223965024273" : { "balance" : 750, "created_at" : "2016-10-25 18:40:11", "name" : "[CDHG]JacenDeFalco" }, "242017771200708609" : { "balance" : 1845, "created_at" : "2016-10-29 20:21:27", "name" : "StarRoseDeFalco" } } </code></pre> <p>My question is, how do I get a C# Windows Forms Application in Visual Studio 2015 to read this file and use the information in it to alter the various fields in the form automatically? <a href="https://i.stack.imgur.com/A9VKe.jpg" rel="nofollow noreferrer">This</a> is what the form looks like.</p> <p>If anyone could help me make the program read the .json and use it as data to put into the boxes on the form, I would be very grateful...Thanks so much!</p>
0debug
.Net Core 3.1 not yet supported in Azure Pipelines hosted agents? Getting NETSDK1045 : <p>It's great that <a href="https://devblogs.microsoft.com/dotnet/announcing-net-core-3-1/" rel="noreferrer">.Net Core 3.1 is out</a>, but I'm not sure the Azure Pipelines hosted agents have caught up.</p> <p>My YAML pipeline specifies:</p> <pre><code>pool: vmImage: 'windows-latest' </code></pre> <p>and the <code>dotnet restore</code> step does this:</p> <blockquote> <p>(_CheckForUnsupportedNETCoreVersion target) -> C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(127,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\a\1\s\StatsNZ.BESt.DataService\StatsNZ.BESt.DataService.csproj]</p> </blockquote> <p>works fine in .Net Core 3.0.</p> <p>Are there any work-arounds, or do we have to wait for Azure DevOps to catch up?</p>
0debug
Change default test class name suffix in Intellij IDEA : <p>By default when I generate test class in IDEA it has "Test" suffix. As I usually use Spock I want to change it to be "Spec" by default. Is it somehow possible?</p>
0debug
html+input type text with regex not taking underscore(_) and special characters : <p>am working for an html input type text which i dont want to take underscore and special characters. I dont want to have an change function which will do the same..if there is a regex which wont take mainly underscore and special characters will be awesome.</p> <p>Any fiddle will be highly helpful</p>
0debug
How to remove repeating characters from a text sentence? : <p>I have a list of text sentences and there are many words such as aaaaa, zzzzz, eeer, qqqqqqq...</p> <p>I am looking for a way to remove these from my text sentence.</p> <pre><code>text = I'm a really good aaaaaa eeeeer jjjjj llll bb </code></pre> <p>I couldn't figure out what regex I could use so I can remove these words completely. There are some edge cases like </p> <pre><code>1) aaaaae (you will have one another character at the end) 2) brrrrrr (another character at the beginning) </code></pre> <p>I'm looking for a output like this,</p> <pre><code>text = I'm really good </code></pre> <p>I just couldn't figure out how to do it.</p>
0debug
static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_stream_id) { MpegMuxContext *s = ctx->priv_data; int size, i, private_stream_coded, id; PutBitContext pb; init_put_bits(&pb, buf, 128); put_bits(&pb, 32, SYSTEM_HEADER_START_CODE); put_bits(&pb, 16, 0); put_bits(&pb, 1, 1); put_bits(&pb, 22, s->mux_rate); put_bits(&pb, 1, 1); if (s->is_vcd && only_for_stream_id==VIDEO_ID) { put_bits(&pb, 6, 0); } else put_bits(&pb, 6, s->audio_bound); if (s->is_vcd) { put_bits(&pb, 1, 0); put_bits(&pb, 1, 1); } else { put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); } if (s->is_vcd || s->is_dvd) { put_bits(&pb, 1, 1); put_bits(&pb, 1, 1); } else { put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); } put_bits(&pb, 1, 1); if (s->is_vcd && only_for_stream_id==AUDIO_ID) { put_bits(&pb, 5, 0); } else put_bits(&pb, 5, s->video_bound); if (s->is_dvd) { put_bits(&pb, 1, 0); put_bits(&pb, 7, 0x7f); } else put_bits(&pb, 8, 0xff); if (s->is_dvd) { int P_STD_max_video = 0; int P_STD_max_mpeg_audio = 0; int P_STD_max_mpeg_PS1 = 0; for(i=0;i<ctx->nb_streams;i++) { StreamInfo *stream = ctx->streams[i]->priv_data; id = stream->id; if (id == 0xbd && stream->max_buffer_size > P_STD_max_mpeg_PS1) { P_STD_max_mpeg_PS1 = stream->max_buffer_size; } else if (id >= 0xc0 && id <= 0xc7 && stream->max_buffer_size > P_STD_max_mpeg_audio) { P_STD_max_mpeg_audio = stream->max_buffer_size; } else if (id == 0xe0 && stream->max_buffer_size > P_STD_max_video) { P_STD_max_video = stream->max_buffer_size; } } put_bits(&pb, 8, 0xb9); put_bits(&pb, 2, 3); put_bits(&pb, 1, 1); put_bits(&pb, 13, P_STD_max_video / 1024); if (P_STD_max_mpeg_audio == 0) P_STD_max_mpeg_audio = 4096; put_bits(&pb, 8, 0xb8); put_bits(&pb, 2, 3); put_bits(&pb, 1, 0); put_bits(&pb, 13, P_STD_max_mpeg_audio / 128); put_bits(&pb, 8, 0xbd); put_bits(&pb, 2, 3); put_bits(&pb, 1, 0); put_bits(&pb, 13, P_STD_max_mpeg_PS1 / 128); put_bits(&pb, 8, 0xbf); put_bits(&pb, 2, 3); put_bits(&pb, 1, 1); put_bits(&pb, 13, 2); } else { private_stream_coded = 0; for(i=0;i<ctx->nb_streams;i++) { StreamInfo *stream = ctx->streams[i]->priv_data; if ( !s->is_vcd || stream->id==only_for_stream_id || only_for_stream_id==0) { id = stream->id; if (id < 0xc0) { if (private_stream_coded) continue; private_stream_coded = 1; id = 0xbd; } put_bits(&pb, 8, id); put_bits(&pb, 2, 3); if (id < 0xe0) { put_bits(&pb, 1, 0); put_bits(&pb, 13, stream->max_buffer_size / 128); } else { put_bits(&pb, 1, 1); put_bits(&pb, 13, stream->max_buffer_size / 1024); } } } } flush_put_bits(&pb); size = put_bits_ptr(&pb) - pb.buf; buf[4] = (size - 6) >> 8; buf[5] = (size - 6) & 0xff; return size; }
1threat