problem
stringlengths
26
131k
labels
class label
2 classes
Why is my program saying that the length function is not in my std library? : <p>My program is saying that the function length() is not in the standard library and is producing an error that does not let me run my code</p> <p>I have tried to place two different libraries into the #include statements. I then tried to place the length function on different variables but the same error occurs.</p> <pre><code>int main() { string line; ifstream out_file_DOI("declaration_of_independence.txt"); if (out_file_DOI.is_open()) { int i = 0; while (getline(cout, out_file_DOI, i)) { cout &lt;&lt; line &lt;&lt; endl; cout &lt;&lt; line.length(); //error is on this line... i++; } out_file_DOI.close(); } } else { cout &lt;&lt; "Unable to open file..."; } //creates the declaration file out_file_DOI.open("declaration_of_independence.txt"); } </code></pre> <p>I expect the code to run and show the proper results (proper results being the program encrypting the file (Declaration of Independence).</p>
0debug
static void host_signal_handler(int host_signum, siginfo_t *info, void *puc) { CPUArchState *env = thread_cpu->env_ptr; CPUState *cpu = ENV_GET_CPU(env); TaskState *ts = cpu->opaque; int sig; target_siginfo_t tinfo; ucontext_t *uc = puc; struct emulated_sigtable *k; if ((host_signum == SIGSEGV || host_signum == SIGBUS) && info->si_code > 0) { if (cpu_signal_handler(host_signum, info, puc)) return; } sig = host_to_target_signal(host_signum); if (sig < 1 || sig > TARGET_NSIG) return; trace_user_host_signal(env, host_signum, sig); rewind_if_in_safe_syscall(puc); host_to_target_siginfo_noswap(&tinfo, info); k = &ts->sigtab[sig - 1]; k->info = tinfo; k->pending = sig; ts->signal_pending = 1; sigfillset(&uc->uc_sigmask); sigdelset(&uc->uc_sigmask, SIGSEGV); sigdelset(&uc->uc_sigmask, SIGBUS); cpu_exit(thread_cpu); }
1threat
static int decode_mb_i(AVSContext *h, int cbp_code) { GetBitContext *gb = &h->s.gb; int block, pred_mode_uv; uint8_t top[18]; uint8_t *left = NULL; uint8_t *d; ff_cavs_init_mb(h); for(block=0;block<4;block++) { int nA,nB,predpred; int pos = ff_cavs_scan3x3[block]; nA = h->pred_mode_Y[pos-1]; nB = h->pred_mode_Y[pos-3]; predpred = FFMIN(nA,nB); if(predpred == NOT_AVAIL) predpred = INTRA_L_LP; if(!get_bits1(gb)){ int rem_mode= get_bits(gb, 2); predpred = rem_mode + (rem_mode >= predpred); } h->pred_mode_Y[pos] = predpred; } pred_mode_uv = get_ue_golomb(gb); if(pred_mode_uv > 6) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n"); return -1; } ff_cavs_modify_mb_i(h, &pred_mode_uv); if(h->pic_type == AV_PICTURE_TYPE_I) cbp_code = get_ue_golomb(gb); if(cbp_code > 63){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n"); return -1; } h->cbp = cbp_tab[cbp_code][0]; if(h->cbp && !h->qp_fixed) h->qp = (h->qp + get_se_golomb(gb)) & 63; for(block=0;block<4;block++) { d = h->cy + h->luma_scan[block]; ff_cavs_load_intra_pred_luma(h, top, &left, block); h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]] (d, top, left, h->l_stride); if(h->cbp & (1<<block)) decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride); } ff_cavs_load_intra_pred_chroma(h); h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10], h->left_border_u, h->c_stride); h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], h->left_border_v, h->c_stride); decode_residual_chroma(h); ff_cavs_filter(h,I_8X8); set_mv_intra(h); return 0; }
1threat
static void init_proc_970FX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, POWERPC970_HID5_INIT); gen_low_BATs(env); spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_hior, &spr_write_hior, 0x00000000); spr_register(env, SPR_CTRL, "SPR_CTRL", SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, &spr_write_generic, 0x00000000); spr_register(env, SPR_UCTRL, "SPR_UCTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_VRSAVE, "SPR_VRSAVE", &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 64; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; ppc970_irq_init(env); vscr_init(env, 0x00010000); }
1threat
static void write_header(FFV1Context *f) { uint8_t state[CONTEXT_SIZE]; int i, j; RangeCoder *const c = &f->slice_context[0]->c; memset(state, 128, sizeof(state)); if (f->version < 2) { put_symbol(c, state, f->version, 0); put_symbol(c, state, f->ac, 0); if (f->ac > 1) { for (i = 1; i < 256; i++) put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1); } put_symbol(c, state, f->colorspace, 0); if (f->version > 0) put_symbol(c, state, f->bits_per_raw_sample, 0); put_rac(c, state, f->chroma_planes); put_symbol(c, state, f->chroma_h_shift, 0); put_symbol(c, state, f->chroma_v_shift, 0); put_rac(c, state, f->transparency); write_quant_tables(c, f->quant_table); } else if (f->version < 3) { put_symbol(c, state, f->slice_count, 0); for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; put_symbol(c, state, (fs->slice_x + 1) * f->num_h_slices / f->width, 0); put_symbol(c, state, (fs->slice_y + 1) * f->num_v_slices / f->height, 0); put_symbol(c, state, (fs->slice_width + 1) * f->num_h_slices / f->width - 1, 0); put_symbol(c, state, (fs->slice_height + 1) * f->num_v_slices / f->height - 1, 0); for (j = 0; j < f->plane_count; j++) { put_symbol(c, state, f->plane[j].quant_table_index, 0); av_assert0(f->plane[j].quant_table_index == f->avctx->context_model); } } } }
1threat
please help me i'm getting the following error.....so please its urgent : please tell me about the error in android..guide me to solve this please.. Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\android\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
0debug
CORS request blocked in locally opened html : <p>I've started to write a HTML file which displays data with JavaScript. Since it shall be done as easy as possible I don't want to run nodejs oder any other local http server. I've just opened the HTML file in a browser (url is file:///home/visu/index.htm).</p> <p>Everything is fine, till a jquery ajax request to a online API is done in the index.htm. The browser blocks the request with the message: </p> <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://x.x.x.x. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)." </code></pre> <p>How can I get rid of the problem without starting a local http server?</p> <p>A possible solution is to start the browser with some "no security flags" or disable CORS with plugins, but this I've to do manually all the time so I don't like it.</p>
0debug
void qemu_system_reset(void) { QEMUResetEntry *re, *nre; TAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) { re->func(re->opaque); } }
1threat
build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) { Aml *scope, *dsdt; const MemMapEntry *memmap = guest_info->memmap; const int *irqmap = guest_info->irqmap; dsdt = init_aml_allocator(); acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader)); scope = aml_scope("\\_SB"); acpi_dsdt_add_cpus(scope, guest_info->smp_cpus); acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS); acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE), guest_info->use_highmem); acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO], (irqmap[VIRT_GPIO] + ARM_SPI_BASE)); acpi_dsdt_add_power_button(scope); aml_append(dsdt, scope); g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len); build_header(linker, table_data, (void *)(table_data->data + table_data->len - dsdt->buf->len), "DSDT", dsdt->buf->len, 2, NULL); free_aml_allocator(); }
1threat
int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { return bdrv_rw_co(bs, sector_num, (uint8_t *)buf, nb_sectors, true, 0); }
1threat
static int read_packet(AVFormatContext *s, AVPacket *pkt) { PAFDemuxContext *p = s->priv_data; AVIOContext *pb = s->pb; uint32_t count, offset; int size, i; if (p->current_frame >= p->nb_frames) return AVERROR_EOF; if (url_feof(pb)) return AVERROR_EOF; if (p->got_audio) { if (av_new_packet(pkt, p->audio_size) < 0) return AVERROR(ENOMEM); memcpy(pkt->data, p->temp_audio_frame, p->audio_size); pkt->duration = PAF_SOUND_SAMPLES * (p->audio_size / PAF_SOUND_FRAME_SIZE); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = 1; p->got_audio = 0; return pkt->size; } count = (p->current_frame == 0) ? p->preload_count : p->blocks_count_table[p->current_frame - 1]; for (i = 0; i < count; i++) { if (p->current_frame_block >= p->frame_blks) return AVERROR_INVALIDDATA; offset = p->blocks_offset_table[p->current_frame_block] & ~(1U << 31); if (p->blocks_offset_table[p->current_frame_block] & (1U << 31)) { if (offset > p->audio_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->audio_frame + offset, p->buffer_size); if (offset == (p->max_audio_blks - 2) * p->buffer_size) { memcpy(p->temp_audio_frame, p->audio_frame, p->audio_size); p->got_audio = 1; } } else { if (offset > p->video_size - p->buffer_size) return AVERROR_INVALIDDATA; avio_read(pb, p->video_frame + offset, p->buffer_size); } p->current_frame_block++; } size = p->video_size - p->frames_offset_table[p->current_frame]; if (size < 1) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); pkt->stream_index = 0; pkt->duration = 1; memcpy(pkt->data, p->video_frame + p->frames_offset_table[p->current_frame], size); if (pkt->data[0] & 0x20) pkt->flags |= AV_PKT_FLAG_KEY; p->current_frame++; return pkt->size; }
1threat
static void dma_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { DMAState *s = opaque; uint32_t saddr; saddr = (addr & DMA_MASK) >> 2; DPRINTF("write dmareg " TARGET_FMT_plx ": 0x%8.8x -> 0x%8.8x\n", addr, s->dmaregs[saddr], val); switch (saddr) { case 0: if (val & DMA_INTREN) { if (val & DMA_INTR) { DPRINTF("Raise IRQ\n"); qemu_irq_raise(s->irq); } } else { if (s->dmaregs[0] & (DMA_INTR | DMA_INTREN)) { DPRINTF("Lower IRQ\n"); qemu_irq_lower(s->irq); } } if (val & DMA_RESET) { qemu_irq_raise(s->dev_reset); qemu_irq_lower(s->dev_reset); } else if (val & DMA_DRAIN_FIFO) { val &= ~DMA_DRAIN_FIFO; } else if (val == 0) val = DMA_DRAIN_FIFO; val &= 0x0fffffff; val |= DMA_VER; break; case 1: s->dmaregs[0] |= DMA_LOADED; break; default: break; } s->dmaregs[saddr] = val; }
1threat
Node Js Unite Testing Framework : <p>I am working on Node Js web application and I want to unit test my application. Can anyone know about unit testing framework in Node Js which developer mostly used...</p>
0debug
int qcow2_get_refcount(BlockDriverState *bs, int64_t cluster_index, uint64_t *refcount) { BDRVQcowState *s = bs->opaque; uint64_t refcount_table_index, block_index; int64_t refcount_block_offset; int ret; uint16_t *refcount_block; refcount_table_index = cluster_index >> s->refcount_block_bits; if (refcount_table_index >= s->refcount_table_size) { *refcount = 0; return 0; } refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (!refcount_block_offset) { *refcount = 0; return 0; } if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: %#" PRIx64 ")", refcount_block_offset, refcount_table_index); return -EIO; } ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset, (void**) &refcount_block); if (ret < 0) { return ret; } block_index = cluster_index & (s->refcount_block_size - 1); *refcount = be16_to_cpu(refcount_block[block_index]); ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) &refcount_block); if (ret < 0) { return ret; } return 0; }
1threat
c - compile main file with source files and header : <p>I'm trying to compile a main file that uses a header. I have all of the files in my directory: card.c, deck.c header.h, and main.c <a href="https://i.stack.imgur.com/q9qBe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q9qBe.png" alt="enter image description here"></a></p> <p>The issue is that when i do gcc main.c I get this: <a href="https://i.stack.imgur.com/jJUq4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jJUq4.png" alt="enter image description here"></a></p> <p>It seems like it's not recognizing the source and header files so my compiling commands are missing something. Thanks</p>
0debug
av_cold void ff_schro_queue_init(FFSchroQueue *queue) { queue->p_head = queue->p_tail = NULL; queue->size = 0; }
1threat
NSURLConnection finished with error - code -1002 : <p>Friends i have simple audio player (MPMoviePlayerController) which can play audio stream. On iOS 11 i have very interessing trouble, thousand time i have error and my stream was stopped:</p> <pre><code>NSURLConnection finished with error - code -1002 </code></pre> <p>I paste this code (this code i saw on stackowerflow) but it's not help to me:</p> <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSExceptionDomains&lt;/key&gt; &lt;dict&gt; &lt;key&gt;cast.mysite.com&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSExceptionAllowsInsecureHTTPLoads&lt;/key&gt; &lt;true/&gt; &lt;key&gt;NSIncludesSubdomains&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/dict&gt; </code></pre> <p>Maybe you know best solution?</p>
0debug
Getting Stream from System.Windows.Input.Cursor : <p>How do I get the Stream of the cursor defined inside <code>System.Windows.Input.Cursor</code>?</p> <p>Thanks.</p>
0debug
static int png_decode_idat(PNGDecContext *s, int length) { int ret; s->zstream.avail_in = FFMIN(length, bytestream2_get_bytes_left(&s->gb)); s->zstream.next_in = (unsigned char *)s->gb.buffer; bytestream2_skip(&s->gb, length); while (s->zstream.avail_in > 0) { ret = inflate(&s->zstream, Z_PARTIAL_FLUSH); if (ret != Z_OK && ret != Z_STREAM_END) { av_log(s->avctx, AV_LOG_ERROR, "inflate returned error %d\n", ret); return AVERROR_EXTERNAL; } if (s->zstream.avail_out == 0) { if (!(s->state & PNG_ALLIMAGE)) { png_handle_row(s); } s->zstream.avail_out = s->crow_size; s->zstream.next_out = s->crow_buf; } if (ret == Z_STREAM_END && s->zstream.avail_in > 0) { av_log(NULL, AV_LOG_WARNING, "%d undecompressed bytes left in buffer\n", s->zstream.avail_in); return 0; } } return 0; }
1threat
How to initialize OnClickListener on included layout inside fragment? : this is representation of my app layout:<br><br> [![layout][2]][2] Where should I create onclicklisteners for included layouts? I tried inside the fragment but I could not get through with findViewById. So I tried from Main Activity but Im not sure how to get to included layouts from there. I also tried this inside the fragment: public class MainMenu extends Fragment implements View.OnClickListener{ View button_call; @Override public View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedinstanceState) { View myView = inflater.inflate(R.layout.fragment_main_menu, container, false); button_call = myView.findViewById(R.id.btn_call); button_call.setOnClickListener(this); return myView; } @Override public void onClick(View v) { // implements your things } public MainMenu() { } } But then Fragment seems to be empty [2]: https://i.stack.imgur.com/0OUDG.png
0debug
cos/sin/tan function gives different result than my calculator : <p>If I enter </p> <pre><code>cos(90) </code></pre> <p>I get</p> <pre><code>-0.4480736 </code></pre> <p>But my calculator gives</p> <pre><code>0 </code></pre> <p>I don't get it.</p> <pre><code>?cos These functions give the obvious trigonometric functions. They respectively compute the cosine, sine, tangent, arc-cosine, arc-sine, arc-tangent, and the two-argument arc-tangent. </code></pre> <p>Obvious?</p>
0debug
Should we put all css inside HTML document? : <p>I'm trying to make a Site enhancement. The Bootstrap.min.css took 0.5 second to load complete to our website.</p> <p>I thinks solve the 0.5 by place all minified CSS in my HTML Document (In production mode). It's a good idea for run-time enhancement ? Does it make HTML Engine slow to load the CSS ?</p>
0debug
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h) { HEVCLocalContext *lc = &s->HEVClc; uint8_t *src1 = ref->data[1]; uint8_t *src2 = ref->data[2]; ptrdiff_t src1stride = ref->linesize[1]; ptrdiff_t src2stride = ref->linesize[2]; int pic_width = s->ps.sps->width >> 1; int pic_height = s->ps.sps->height >> 1; int mx = mv->x & 7; int my = mv->y & 7; x_off += mv->x >> 3; y_off += mv->y >> 3; src1 += y_off * src1stride + (x_off << s->ps.sps->pixel_shift); src2 += y_off * src2stride + (x_off << s->ps.sps->pixel_shift); if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER || x_off >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); int offset2 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->ps.sps->pixel_shift)); int buf_offset2 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1, edge_emu_stride, src1stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src1 = lc->edge_emu_buffer + buf_offset1; src1stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2, edge_emu_stride, src2stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src2 = lc->edge_emu_buffer + buf_offset2; src2stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } else { s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } }
1threat
Remove assigned users from database table : <p>I have a table:</p> <pre><code>| staff_id | leader_id | team_role | importance | + + + + + | 1001037 | 1000321 | HOD | 1 | | 1001037 | 1000322 | HOD | 1 | | 1001037 | 1001037 | Supervisor | 2 | | 1001094 | 1001037 | Checker | 3 | | 1001075 | 1001037 | Checker | 3 | | 1001096 | 1001075 | Squad Leader | 4 | | 1000393 | 1001094 | Squad Leader | 4 | | 1000465 | 1001094 | Squad Leader | 4 | | 1000585 | 1001075 | Squad Leader | 4 | | 1000664 | 1000585 | Team Member | 5 | | 1000583 | 1000585 | Team Member | 5 | | 1000570 | 1000465 | Team Member | 5 | | 1000316 | 1000465 | Team Member | 5 | </code></pre> <p>In php it look like this:</p> <p><a href="https://i.stack.imgur.com/KPkZ9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KPkZ9.jpg" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/dOhSl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dOhSl.jpg" alt="enter image description here"></a></p> <p>If I want to remove user with <code>staff_id = 1001075</code> I need to remove all assigned to this user ids. So it will be ids where <code>1001075</code> is <code>leader_id</code>. I am able to this but I also need to remove users going down to the tree so where <code>leader_id= 1001075</code> is will be <code>1000585</code> Then I need to remove users where <code>leader_id= 1000585</code></p> <p>In the end I need to delete these users with <code>staff_id</code>:</p> <pre><code>1001075 1001096 1000585 1000664 1000583 </code></pre> <p>How can I do that?</p>
0debug
What do i have to learn/use to achieve the folding animation on this site? : <p>I am currently trying to make a website for my art director father, and <a href="http://www.creaktif.com/" rel="nofollow">this</a> animation(scroll down to see) on the site is close to what i'm trying to create. I know html and css but my research led me to believe that i need to use javascript and/or animation apis. It would be amazing if someone directs me to the right direction. Thanks on advance to everyone.</p>
0debug
How to append an int to the end of a string argument for getElementByID() : <p>I need to know how to append an integer to the end of an argument of type string for the getElementByID method... in this example latest==2. And i want to search for the id "number2". </p> <pre><code>number=document.getElementById("number"&amp;latest); </code></pre> <p>This current syntax is giving me issues.</p> <p>Additionally, if i want to dynamically insert HTML, how would one go about inserting that value into the data field for a label</p> <pre><code>cell1 = row.insertAdjacentHTML('beforeend',&lt;span&gt;&lt;label for="2" id="label2"&gt;2&lt;/label&gt;&lt;/span&gt; </code></pre> <p>All the "2"'s here should be dynamic, like if i were to reference a global counter n... </p>
0debug
What does += %w mean in the line used to precompile assets in assets.rb? : <p>I'm looking at the default file placed in <code>/config/initializers/assets.rb</code> in a Rails 5 app.</p> <p>To precompile code, Rails inside the comments, gives a pre-existing code to precompile assets together.</p> <pre><code>Rails.application.config.assets.precompile += %w( search.js ) </code></pre> <p>I am curious what the last part means: <code>+= %w( search.js )</code>, as I have never seen the expression (<code>+= %w</code>) used in Ruby or Rails. I know that the entire line is calling the Rails class, chaining some methods together to create the end output. But I am curious, what does the += %w do, and how is it affecting what I presume to be the argument (<code>search.js</code>)?</p>
0debug
static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int entries, i; print_atom("stsz", atom); get_byte(pb); get_byte(pb); get_byte(pb); get_byte(pb); sc->sample_size = get_be32(pb); entries = get_be32(pb); sc->sample_count = entries; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "sample_size = %ld sample_count = %ld\n", sc->sample_size, sc->sample_count); #endif if(sc->sample_size) return 0; sc->sample_sizes = (long*) av_malloc(entries * sizeof(long)); if (!sc->sample_sizes) return -1; for(i=0; i<entries; i++) { sc->sample_sizes[i] = get_be32(pb); #ifdef DEBUG #endif } return 0; }
1threat
How to hide JavaScript code when i do inspect element using angular js : <p>when I do inspect element I want my javascript code to be shown on the minified way. How to do it using angular?</p>
0debug
Can't find module cPickle using Python 3.5 and Anaconda : <p>I am trying to use cPickle on a windows box, using Anaconda. I am using python 3.5. I am not using a virtualenv (though probably should be).</p> <p>When I try to import cPickle I get <em>"ImportError: No module named 'cPickle'"</em></p> <pre><code>Python 3.5.0 |Anaconda custom (64-bit)| (default, Dec 1 2015, 11:46:22) [MSC v. 1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import cPickle Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; ImportError: No module named 'cPickle' </code></pre> <p>My understanding is that cPickle comes built in with Python 3.5, so I can't understand why cPickle is not found. Any idea what has gone wrong/how I can clean things up/how to troubleshoot the issue.</p>
0debug
static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory, hwaddr base, omap_clk clk) { struct omap_lpg_s *s = (struct omap_lpg_s *) g_malloc0(sizeof(struct omap_lpg_s)); s->tm = timer_new_ms(QEMU_CLOCK_VIRTUAL, omap_lpg_tick, s); omap_lpg_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_lpg_ops, s, "omap-lpg", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]); return s; }
1threat
How to shift list indexes by a certain value in Python : <p>I need to create a python function that right shifts values in a list by a given value. </p> <p>For example if the list is [1,2,3,4] and the shift is 2 it will become [2,3,4,1]. the shift value must be a non negative integer. I can only use the len and range functions. </p> <p>This is what I have so far</p> <pre><code>def shift(array, value): if value &lt; 0: return for i in range(len(array)): arr[i] = arr[(i + shift_amount) % len(arr)] </code></pre>
0debug
static void piix3_write_config(PCIDevice *dev, uint32_t address, uint32_t val, int len) { pci_default_write_config(dev, address, val, len); if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev); int pic_irq; pci_bus_fire_intx_routing_notifier(piix3->dev.bus); piix3_update_irq_levels(piix3); for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } }
1threat
Display an image using two random arrays using javascipt and html : im trying to display an image using two arrays that will randomly select a number and suit type for a card game. The files for the cards are saved for example like '2Clubs.png' heres my code: javascript crand=Math.ceil(Math.random()*12); crand1=Math.ceil(Math.random()*12); crand2=Math.ceil(Math.random()*12); srand=Math.floor(Math.random()*4); srand1=Math.floor(Math.random()*4); srand2=Math.floor(Math.random()*4); Hcrand=Math.ceil(Math.random()*12); Hcrand1=Math.ceil(Math.random()*12); Hcrand2=Math.ceil(Math.random()*12); Hsrand=Math.floor(Math.random()*4); Hsrand1=Math.floor(Math.random()*4); Hsrand2=Math.floor(Math.random()*4); cards=new Array(13); cards[0]='2'; cards[1]='3'; cards[2]='4'; cards[3]='5'; cards[4]='6'; cards[5]='7'; cards[6]='8'; cards[7]='9'; cards[8]='10'; cards[9]='Jack'; cards[10]='Queen'; cards[11]='King'; cards[12]='Ace'; suit=new Array(4); suit[0]='Hearts'; suit[1]='Spades'; suit[2]='Clubs'; suit[3]='Diamonds'; img = document.getElementById('img1'); img.src=cards[crand]+suit[srand]+'.png'; HTML <img id="img1" src="" width="100" height="100"></img>
0debug
Speed up the process for creating the performance report : Using ADB top command i fetch cpu logs in command prompt mode. txt file automatically saved in SD card path.i get that logs and split the values Using Excel i split those values using text to columns options. Is there any automation script (or) macro is there to speed up the process?
0debug
ValidationError Stack:arn aws cloudformation stack is in ROLLBACK_COMPLETE state and can not be updated : <p>When I deploy using cloudformation <code>aws cloudformation deploy --region $region --stack-name ABC</code></p> <p>Got error: </p> <blockquote> <p>An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack:arn:aws:cloudformation:stack/service/7e1d8c70-d60f-11e9-9728-0a4501e4ce4c is in ROLLBACK_COMPLETE state and can not be updated.</p> </blockquote> <p>Please help me !</p>
0debug
How to get Timezone offset from moment Object? : <p>I have <code>moment</code> Object defined as:</p> <pre><code>var moment = require('moment'); moment('2015-12-20T12:00:00+02:00'); </code></pre> <p>When I print it, I get:</p> <pre><code>_d: Sun Dec 20 2015 12:00:00 GMT+0200 (EET) _f: "YYYY-MM-DDTHH:mm:ssZ" _i: "2015-12-20T12:00:00+02:00" _isAMomentObject: true _isUTC: false _locale: r _pf: Object _tzm: 120 </code></pre> <p>How to fetch by right way <code>_tzm</code>? (suppose its offset in minutes)</p> <p>Thanks,</p>
0debug
Angular 2 Date deserialization : <p>I have an Angular 2 application. A service is requests data from an api that returns the results like the following:</p> <pre><code>{ "data":[ {"id":1,"timestamp":"2016-04-17T19:52:53.4510935+01:00","sourceDatabaseServer":"127.0.0.1","sourceDatabaseName":"Database1","targetDatabaseServer":"192.168.99.101","targetDatabaseName":"Database2"}, {"id":2,"timestamp":"2016-04-17T19:52:53.4510935+01:00","sourceDatabaseServer":"127.0.0.2","sourceDatabaseName":"Database3","targetDatabaseServer":"192.168.99.102","targetDatabaseName":"Database4"}, {"id":3,"timestamp":"2016-04-17T19:52:53.4510935+01:00","sourceDatabaseServer":"127.0.0.3","sourceDatabaseName":"Database5","targetDatabaseServer":"192.168.99.103","targetDatabaseName":"Database6"} ] } </code></pre> <p>My Angular 2 service looks like this (I've cut the error handling for brevity as we're on the happy path here):</p> <pre><code>getList() : Observable&lt;SomeModel[]&gt; { return this._http.get(this._getListUrl).map(this.extractData); } private extractData(res: Response) { return res.json().data || {}; } </code></pre> <p>and my component like this:</p> <pre><code>results: SomeModel[]; errorMessage: string; ngOnInit() { this._someService.getList() .subscribe( results =&gt; this.results = results, error =&gt; this.errorMessage = &lt;any&gt;error); } </code></pre> <p>and my model like this:</p> <pre><code>export class SomeModel { constructor( public id: number, public timestamp: Date, public sourceDatabaseServer: string, public sourceDatabaseName: string, public targetDatabaseServer: string, public targetDatabaseName: string ) { } } </code></pre> <p>Everything looked like it was working however when I tried to display timestamp using the DatePipe like so <code>{{item.timestamp | date:'short'}}</code> the application blows up with the following error message:</p> <pre><code>Invalid argument '2016-04-17T19:40:38.2424240+01:00' for pipe 'DatePipe' in [{{result.timestamp | date:'short'}} </code></pre> <p>After some investigation I believe that timestamp is not actually being converted to the <code>Date</code> type but is instead just being set a <code>string</code>. I'm guessing this is becuase the <code>Date</code> type isn't known at the time <code>Response.json()</code> is called? or am I missing something else entirely? Is there a fix or work around for this? </p>
0debug
static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_sti_s *s = (struct omap_sti_s *) opaque; int ch = addr >> 6; uint8_t byte = value; if (size != 1) { return omap_badwidth_write8(opaque, addr, size); } if (ch == STI_TRACE_CONTROL_CHANNEL) { qemu_chr_fe_write(s->chr, (const uint8_t *) "\r", 1); } else if (ch == STI_TRACE_CONSOLE_CHANNEL || 1) { if (value == 0xc0 || value == 0xc3) { } else if (value == 0x00) qemu_chr_fe_write(s->chr, (const uint8_t *) "\n", 1); else qemu_chr_fe_write(s->chr, &byte, 1); } }
1threat
How to create a simple button using Javascript : <p>I just want to create a simple button in Javascript that, upon being clicked, it runs a simple alert. I understand you have to make the button in html, and then assign a function to it in Javascript, I just don't know how to.</p>
0debug
NPM install resulting in 401 Unauthorized for private repo : <p>I have the following line in my dependencies in <code>package.json</code>:</p> <pre><code>"log": "https://git.mydomain.com/myproject/myrepo/repository/archive.tar.gz?ref=0.1.0", </code></pre> <p>I get the following:</p> <pre><code>km@Karls-MBP ~/dev/vertica (km/ref) $ npm install npm ERR! code E401 npm ERR! 404 401 Unauthorized: log@https://git.mydomain.com/myproject/myrepo/repository/archive.tar.gz?ref=0.5.0 npm ERR! A complete log of this run can be found in: npm ERR! /Users/km/.npm/_logs/2018-02-16T08_49_38_669Y-debug.log </code></pre> <p>I don't know if the issue is GitLab (where the repo exists) or NPM.</p> <ul> <li>Node v8.9.4</li> <li>NPM v5.6.0</li> </ul>
0debug
static coroutine_fn int qcow2_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVQcow2State *s = bs->opaque; int offset_in_cluster, n1; int ret; unsigned int cur_bytes; uint64_t cluster_offset = 0; uint64_t bytes_done = 0; QEMUIOVector hd_qiov; uint8_t *cluster_data = NULL; qemu_iovec_init(&hd_qiov, qiov->niov); qemu_co_mutex_lock(&s->lock); while (bytes != 0) { cur_bytes = MIN(bytes, INT_MAX); if (s->cipher) { cur_bytes = MIN(cur_bytes, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size); } ret = qcow2_get_cluster_offset(bs, offset, &cur_bytes, &cluster_offset); if (ret < 0) { goto fail; } offset_in_cluster = offset_into_cluster(s, offset); qemu_iovec_reset(&hd_qiov); qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes); switch (ret) { case QCOW2_CLUSTER_UNALLOCATED: if (bs->backing) { n1 = qcow2_backing_read1(bs->backing->bs, &hd_qiov, offset, cur_bytes); if (n1 > 0) { QEMUIOVector local_qiov; qemu_iovec_init(&local_qiov, hd_qiov.niov); qemu_iovec_concat(&local_qiov, &hd_qiov, 0, n1); BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_preadv(bs->backing, offset, n1, &local_qiov, 0); qemu_co_mutex_lock(&s->lock); qemu_iovec_destroy(&local_qiov); if (ret < 0) { goto fail; } } } else { qemu_iovec_memset(&hd_qiov, 0, 0, cur_bytes); } break; case QCOW2_CLUSTER_ZERO: qemu_iovec_memset(&hd_qiov, 0, 0, cur_bytes); break; case QCOW2_CLUSTER_COMPRESSED: ret = qcow2_decompress_cluster(bs, cluster_offset); if (ret < 0) { goto fail; } qemu_iovec_from_buf(&hd_qiov, 0, s->cluster_cache + offset_in_cluster, cur_bytes); break; case QCOW2_CLUSTER_NORMAL: if ((cluster_offset & 511) != 0) { ret = -EIO; goto fail; } if (bs->encrypted) { assert(s->cipher); if (!cluster_data) { cluster_data = qemu_try_blockalign(bs->file->bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size); if (cluster_data == NULL) { ret = -ENOMEM; goto fail; } } assert(cur_bytes <= QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size); qemu_iovec_reset(&hd_qiov); qemu_iovec_add(&hd_qiov, cluster_data, cur_bytes); } BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster, cur_bytes, &hd_qiov, 0); qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } if (bs->encrypted) { assert(s->cipher); assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((cur_bytes & (BDRV_SECTOR_SIZE - 1)) == 0); Error *err = NULL; if (qcow2_encrypt_sectors(s, offset >> BDRV_SECTOR_BITS, cluster_data, cluster_data, cur_bytes >> BDRV_SECTOR_BITS, false, &err) < 0) { error_free(err); ret = -EIO; goto fail; } qemu_iovec_from_buf(qiov, bytes_done, cluster_data, cur_bytes); } break; default: g_assert_not_reached(); ret = -EIO; goto fail; } bytes -= cur_bytes; offset += cur_bytes; bytes_done += cur_bytes; } ret = 0; fail: qemu_co_mutex_unlock(&s->lock); qemu_iovec_destroy(&hd_qiov); qemu_vfree(cluster_data); return ret; }
1threat
static av_always_inline void h264_filter_mb_fast_internal(H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int chroma = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); int mb_xy = h->mb_xy; int left_type = sl->left_type[LTOP]; int top_type = sl->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = 52 + h->slice_alpha_c0_offset - qp_bd_offset; int b = 52 + h->slice_beta_offset - qp_bd_offset; int mb_type = h->cur_pic.mb_type[mb_xy]; int qp = h->cur_pic.qscale_table[mb_xy]; int qp0 = h->cur_pic.qscale_table[mb_xy - 1]; int qp1 = h->cur_pic.qscale_table[sl->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE(h) ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (sl->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); int step = 1+(mb_type>>24); edges = 4 - 3*((mb_type>>3) & !(sl->cbp & 15)); h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache, sl->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h)); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
1threat
get a line until | in iostream : <p>Currently I'm using the code below to read some variable from a text file like this:</p> <blockquote> <p>12345|54321|TAN Ah Kow |M|12 Jalan 3/45 KL |Wilayah P|012-3456789|5000.00</p> </blockquote> <p>The code is</p> <pre><code>getline(infile,id,'|'); getline(infile,pw,'|'); getline(infile,name,'|'); getline(infile,gender,'|'); getline(infile,address,'|'); getline(infile,state,'|'); getline(infile,phone,'|'); getline(infile,balance,'|'); </code></pre> <p>is there any better way to do this?</p>
0debug
Character is letter at java : <pre><code>public boolean isAnagram(ArrayList&lt;Character&gt; arr1, ArrayList&lt;Character&gt; arr2) { if( arr1 == null || arr2 == null || arr1.isEmpty() || arr2.isEmpty()){ return false;// TODO } for( int i = 0; i &lt; arr1.size(); i++){ if(arr1.get(i) == Character.isLetter()){ Character.toLowerCase(arr1.get(i)); return true; } </code></pre> <p>Thats a Part of my Code, and i do not understand what I should write into Character.isLetter(DONT KNOW)) --> ps. also do not know, wheater that Code works I want that he Returns true, when i is a Letter. </p>
0debug
static int udp_read_packet(AVFormatContext *s, AVPacket *pkt) { AVFormatContext *ic; AVStream *st; RTSPStream *rtsp_st; fd_set rfds; int fd1, fd2, fd_max, n, i, ret; char buf[RTP_MAX_PACKET_LENGTH]; struct timeval tv; for(;;) { if (rtsp_abort_req) return -EIO; FD_ZERO(&rfds); fd_max = -1; for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; rtsp_st = st->priv_data; ic = rtsp_st->ic; rtp_get_file_handles(url_fileno(&ic->pb), &fd1, &fd2); if (fd1 > fd_max) fd_max = fd1; FD_SET(fd1, &rfds); } tv.tv_sec = 0; tv.tv_usec = 500000; n = select(fd_max + 1, &rfds, NULL, NULL, &tv); if (n > 0) { for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; rtsp_st = st->priv_data; ic = rtsp_st->ic; rtp_get_file_handles(url_fileno(&ic->pb), &fd1, &fd2); if (FD_ISSET(fd1, &rfds)) { ret = url_read(url_fileno(&ic->pb), buf, sizeof(buf)); if (ret >= 0 && rtp_parse_packet(ic, pkt, buf, ret) == 0) { pkt->stream_index = i; return ret; } } } } } }
1threat
void check_audio_video_inputs(int *has_video_ptr, int *has_audio_ptr) { int has_video, has_audio, i, j; AVFormatContext *ic; has_video = 0; has_audio = 0; for(j=0;j<nb_input_files;j++) { ic = input_files[j]; for(i=0;i<ic->nb_streams;i++) { AVCodecContext *enc = &ic->streams[i]->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: has_audio = 1; break; case CODEC_TYPE_VIDEO: has_video = 1; break; default: abort(); } } } *has_video_ptr = has_video; *has_audio_ptr = has_audio; }
1threat
static PXBDev *convert_to_pxb(PCIDevice *dev) { return pci_bus_is_express(dev->bus) ? PXB_PCIE_DEV(dev) : PXB_DEV(dev); }
1threat
Java Linkedlist recursion methods : so i couldnt understand the linkedlist Data structur and how the recursion works in it , it doesnt make sense to me at all , i mean i understand normal recursion but with linkedLists not at all i've seen many things on the net but they just don't explain how it exactly works so i would really apperciate if anyone could help me , the code is below is about a linkedList class with A elements it has a head as A element and the rest of the list(tail) as another linkedList import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; public class LL<A> { private final A hd; private final LL<A> tl; public boolean isEmpty(){ return hd==null&&tl==null; } public LL(A hd, LL<A> tl) { this.hd = hd; this.tl = tl; } public LL() { this(null,null); } public int size() { if (isEmpty()) return 0; return 1 + tl.size(); } public A get(int i) { return i==0?hd:tl.get(i-1); } LL<A> drop(int i){ if(i==0) return this; if(i<0) return new LL<>(); if(isEmpty()) return new LL<A>(); return this.tl.drop(i-1); } } so for example this drop method creates a new LinkedList with the elements other than the first i Elements and i actually don't get how it works lets say if i make drop(1) on a linkedList what will it step by step do . Thanks in advance :) sorry to bother
0debug
How do I make a function in Scheme? : <p>I need to create a function in Scheme using drRacket that gets a list of numbers as an argument and returns the largest number. I've never coded using Scheme before so I really need help! The testcase is something like this: (maximEl '(3 5 7 9 1 3)) 9</p>
0debug
static void init_quantization(Jpeg2000EncoderContext *s) { int compno, reslevelno, bandno; Jpeg2000QuantStyle *qntsty = &s->qntsty; Jpeg2000CodingStyle *codsty = &s->codsty; for (compno = 0; compno < s->ncomponents; compno++){ int gbandno = 0; for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){ int nbands, lev = codsty->nreslevels - reslevelno - 1; nbands = reslevelno ? 3 : 1; for (bandno = 0; bandno < nbands; bandno++, gbandno++){ int expn, mant; if (codsty->transform == FF_DWT97){ int bandpos = bandno + (reslevelno>0), ss = 81920000 / dwt_norms[0][bandpos][lev], log = av_log2(ss); mant = (11 - log < 0 ? ss >> log - 11 : ss << 11 - log) & 0x7ff; expn = s->cbps[compno] - log + 13; } else expn = ((bandno&2)>>1) + (reslevelno>0) + s->cbps[compno]; qntsty->expn[gbandno] = expn; qntsty->mant[gbandno] = mant; } } } }
1threat
static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder, uint32_t *sums, int n, int pred_order) { int i; int k, cnt, part; uint32_t all_bits; part = (1 << porder); all_bits = 0; cnt = (n >> porder) - pred_order; for(i=0; i<part; i++) { if(i == 1) cnt = (n >> porder); k = find_optimal_param(sums[i], cnt); rc->params[i] = k; all_bits += rice_encode_count(sums[i], cnt, k); } all_bits += (4 * part); rc->porder = porder; return all_bits; }
1threat
C# Quantifier {x,y} following nothing : I have exception like this when i try to validate email and phone number on my Program : Error: The regex was wrote correctly and I don't know where is problem. I read the last post but any work in my case. Message: System.ArgumentException : parsing '{2}[0-9]-{3}[0-9]' - Quantifier {x,y} following nothing. public class Order { public string EmailValidationPattern = "{2}[0-9]-{3}[0-9]"; public int OrderId { get; set; } public string FullName { get; set; } public string AddressLine { get; set; } public string ZipCode { get; set; } public string City { get; set; } public string PhoneNumber { get; set; } public decimal OrderTotal { get; set; } public DateTime OrderCreate { get; set; } public User user { get; set; } Order details { get; set; } public Order(int orderId, User user, string adress, string fullname, string zip_code, string city, string phonenumber, Pizza_ pizza) { OrderId = orderId; OrderCreate = DateTime.UtcNow; user = this.user; SetZipCode(zip_code); AddressLine = adress; FullName = fullname; City = city; } private void SetZipCode(string zipCode) { if (Regex.Match(zipCode, EmailValidationPattern).Success) { ZipCode = zipCode; } else { return; } } private void SetPhoneNumber(string number) { if (Regex.Match(number, @"^(\+[0-9]{9})$").Success) { PhoneNumber = number; } else { return; } } private float TotalOrderPrice(List<Pizza_> pizza) { float totalprice = 0; for(int i = 0; i < pizza.Count; i++) { totalprice += pizza.ElementAt(i).Price; } return totalprice; } }
0debug
Error run on IOS emulator after update to IOS 11 - Ionic 3 : <p>After update to IOS 11, command </p> <blockquote> <p>ionic cordova run ios -lc --target="iPhone-6"</p> </blockquote> <p>I have error</p> <blockquote> <p>** BUILD SUCCEEDED **</p> <p>No available runtimes could be found for "iPhone 6". [ERROR] An error occurred while running cordova run ios --target iPhone-6 (exit code 1).</p> </blockquote> <p>Simulators list after command </p> <blockquote> <p>ios-sim showdevicetypes</p> </blockquote> <pre><code>Apple-TV-1080p, tvOS 11.0 Apple-TV-4K-4K, tvOS 11.0 Apple-TV-4K-1080p, tvOS 11.0 Apple-Watch-38mm, watchOS 4.0 Apple-Watch-42mm, watchOS 4.0 Apple-Watch-Series-2-38mm, watchOS 4.0 Apple-Watch-Series-2-42mm, watchOS 4.0 Apple-Watch-Series-3-38mm, watchOS 4.0 Apple-Watch-Series-3-42mm, watchOS 4.0 iPhone-5s, 11.0 iPhone-6, 11.0 iPhone-6-Plus, 11.0 iPhone-6s, 11.0 iPhone-6s-Plus, 11.0 iPhone-7, 11.0 iPhone-7-Plus, 11.0 iPhone-SE, 11.0 iPhone-8, 11.0 iPhone-8-Plus, 11.0 iPhone-X, 11.0 iPad-Air, 11.0 iPad-Air-2, 11.0 iPad--5th-generation-, 11.0 iPad-Pro--9-7-inch-, 11.0 iPad-Pro, 11.0 iPad-Pro--12-9-inch---2nd-generation-, 11.0 iPad-Pro--10-5-inch-, 11.0 </code></pre> <p>BUT after command </p> <blockquote> <p>cordova emulate ios --list</p> </blockquote> <p>Simulators list is empty</p> <pre><code>Available iOS Simulators: MacBook-Air-apple:Snaptofix2 apple$ </code></pre> <p>Help, please. </p>
0debug
sort the rows of a dataframe and get the column values in pandas dataframe : My dataframe looks like this: COLUMN NAMES |5 |1 |2 |4 |3 |0 |pred_val|true_value|rank| ___________________________________________ 0 |0.3|0.2|0.1|0.5|0.25|0.4| 4 | 2 | 6 1 |0.36|0.24|0.12|0.5|0.45|0.4| 4 | 3 |2 I want to predict the values of rank column based on my true value. Like above true value is 2 for 0th row then I want to predict the rank of this row as 6 since according to all true values from 0-5, which are column names here, in their corresponding row values true_value 2 in column has 0.1 which is the lowest in all, hence at rank 6. Likewise, for 2nd row, true_value is 3 and according to all column values, it's value is 2nd highest , so 2nd rank. How can I do this ? Pls help.
0debug
Replace repetitive code and create variables in a for loop : <p>I have this chunk of code that predicts on a model and I feel that there is a way to write a for loop to shorten it. However, I am not too sure how to do so as I would have to create variables within the for loop. Would it be possible to shorten this code to a for loop:</p> <pre><code> #remainder1 through model _remainder1FV, _remainder1Out, _remainder1OutID = _detector.get_fv(_deFV, _deMeta['_remainID1']) _remainder1PredOut = _detector.classifer_prediction(_remainder1FV, _deMeta) _remainder1Result = _detector.result_calculation(_remainder1Out, _remainder1PredOut, _deMeta, tag='_remainID1') #remainder2 through model _remainder2FV, _remainder2Out, _remainder2OutID = _detector.get_fv(_deFV, _deMeta['_remainID2']) _remainder2PredOut = _detector.classifer_prediction(_remainder2FV, _deMeta) _remainder2Result = _detector.result_calculation(_remainder2Out, _remainder2PredOut, _deMeta, tag='_remainID2') #remainder3 through model _remainder3FV, _remainder3Out, _remainder3OutID = _detector.get_fv(_deFV, _deMeta['_remainID3']) _remainder3PredOut = _detector.classifer_prediction(_remainder3FV, _deMeta) _remainder3Result = _detector.result_calculation(_remainder3Out, _remainder3PredOut, _deMeta, tag='_remainID3') #remainder4 through model _remainder4FV, _remainder4Out, _remainder4OutID = _detector.get_fv(_deFV, _deMeta['_remainID4']) _remainder4PredOut = _detector.classifer_prediction(_remainder4FV, _deMeta) _remainder4Result = _detector.result_calculation(_remainder4Out, _remainder4PredOut, _deMeta, tag='_remainID4') </code></pre>
0debug
One Websites with Many Database ASP.net : <p>I want to seperate all the different data for all the companies. Is it possible for one ASP.net Websites with more than 1 database? If yes , how can I do it? Any help is much appreciated ! Thanks</p>
0debug
How to stop/relaunch docker container without losing the changes? : <p>I did the following and lost all the changed data in my Docker container.</p> <ol> <li><code>docker build -t &lt;name:tag&gt; .</code></li> <li><code>docker run *-p 8080:80* --name &lt;container_name&gt; &lt;name:tag&gt;</code></li> <li><code>docker exec</code> (import and process some files, launch a server to host them)</li> </ol> <p>Then I wanted to run it on a different port. <code>docker stop</code> &amp; <code>docker run</code> does not work. Instead I did</p> <ol start="4"> <li><code>docker stop</code></li> <li><code>docker rm &lt;container_name&gt;</code></li> <li><code>docker run</code> (same parameters as before)</li> </ol> <p>After the restart I saw the changes that happened in the container at 1-3 had disappeared, and had to re-run the import.</p> <p>How do I do this correctly next time?</p>
0debug
static int coroutine_fn blkreplay_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_pwritev(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
1threat
get month,date and year from given date : <p>I want to get the month and date from the given date.I get server time . <code>date="Wed Jul 26 2017 11:39:44 GMT+0530 (India Standard Time)"</code>; I want to get mm/dd/yyyy from the given date</p> <pre><code> var xmlHttp; function srvTime(){ try { //FF, Opera, Safari, Chrome xmlHttp = new XMLHttpRequest(); } catch (err1) { //IE try { xmlHttp = new ActiveXObject('Msxml2.XMLHTTP'); } catch (err2) { try { xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); } catch (eerr3) { //AJAX not supported, use CPU time. alert("AJAX not supported"); } } } xmlHttp.open('HEAD',window.location.href.toString(),false); xmlHttp.setRequestHeader("Content-Type", "text/html"); xmlHttp.send(''); return xmlHttp.getResponseHeader("Date"); } var st = srvTime(); var date = new Date(st); console.log(date); //Wed Jul 26 2017 11:39:44 GMT+0530 (India Standard Time) </code></pre>
0debug
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c, vexop, rexw = 0; #if TCG_TARGET_REG_BITS == 64 # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i64): \ rexw = P_REXW; \ case glue(glue(INDEX_op_, x), _i32) #else # define OP_32_64(x) \ case glue(glue(INDEX_op_, x), _i32) #endif switch(opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_EAX, args[0]); tcg_out_jmp(s, tb_ret_addr); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { tcg_out8(s, OPC_JMP_long); s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); tcg_out32(s, 0); } else { tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, -1, (intptr_t)(s->tb_next + args[0])); } s->tb_next_offset[args[0]] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, args[0], 0); break; OP_32_64(ld8u): tcg_out_modrm_offset(s, OPC_MOVZBL, args[0], args[1], args[2]); break; OP_32_64(ld8s): tcg_out_modrm_offset(s, OPC_MOVSBL + rexw, args[0], args[1], args[2]); break; OP_32_64(ld16u): tcg_out_modrm_offset(s, OPC_MOVZWL, args[0], args[1], args[2]); break; OP_32_64(ld16s): tcg_out_modrm_offset(s, OPC_MOVSWL + rexw, args[0], args[1], args[2]); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_ld32u_i64: #endif case INDEX_op_ld_i32: tcg_out_ld(s, TCG_TYPE_I32, args[0], args[1], args[2]); break; OP_32_64(st8): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVB_EvIz, 0, args[1], args[2]); tcg_out8(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVB_EvGv | P_REXB_R, args[0], args[1], args[2]); } break; OP_32_64(st16): if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_DATA16, 0, args[1], args[2]); tcg_out16(s, args[0]); } else { tcg_out_modrm_offset(s, OPC_MOVL_EvGv | P_DATA16, args[0], args[1], args[2]); } break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_st32_i64: #endif case INDEX_op_st_i32: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I32, args[0], args[1], args[2]); } break; OP_32_64(add): if (args[0] != args[1]) { TCGArg a0 = args[0], a1 = args[1], a2 = args[2], c3 = 0; if (const_args[2]) { c3 = a2, a2 = -1; } else if (a0 == a2) { tgen_arithr(s, ARITH_ADD + rexw, a0, a1); break; } tcg_out_modrm_sib_offset(s, OPC_LEA + rexw, a0, a1, a2, 0, c3); break; } c = ARITH_ADD; goto gen_arith; OP_32_64(sub): c = ARITH_SUB; goto gen_arith; OP_32_64(and): c = ARITH_AND; goto gen_arith; OP_32_64(or): c = ARITH_OR; goto gen_arith; OP_32_64(xor): c = ARITH_XOR; goto gen_arith; gen_arith: if (const_args[2]) { tgen_arithi(s, c + rexw, args[0], args[2], 0); } else { tgen_arithr(s, c + rexw, args[0], args[2]); } break; OP_32_64(andc): if (const_args[2]) { tcg_out_mov(s, rexw ? TCG_TYPE_I64 : TCG_TYPE_I32, args[0], args[1]); tgen_arithi(s, ARITH_AND + rexw, args[0], ~args[2], 0); } else { tcg_out_vex_modrm(s, OPC_ANDN + rexw, args[0], args[2], args[1]); } break; OP_32_64(mul): if (const_args[2]) { int32_t val; val = args[2]; if (val == (int8_t)val) { tcg_out_modrm(s, OPC_IMUL_GvEvIb + rexw, args[0], args[0]); tcg_out8(s, val); } else { tcg_out_modrm(s, OPC_IMUL_GvEvIz + rexw, args[0], args[0]); tcg_out32(s, val); } } else { tcg_out_modrm(s, OPC_IMUL_GvEv + rexw, args[0], args[2]); } break; OP_32_64(div2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IDIV, args[4]); break; OP_32_64(divu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_DIV, args[4]); break; OP_32_64(shl): c = SHIFT_SHL; vexop = OPC_SHLX; goto gen_shift_maybe_vex; OP_32_64(shr): c = SHIFT_SHR; vexop = OPC_SHRX; goto gen_shift_maybe_vex; OP_32_64(sar): c = SHIFT_SAR; vexop = OPC_SARX; goto gen_shift_maybe_vex; OP_32_64(rotl): c = SHIFT_ROL; goto gen_shift; OP_32_64(rotr): c = SHIFT_ROR; goto gen_shift; gen_shift_maybe_vex: if (have_bmi2 && !const_args[2]) { tcg_out_vex_modrm(s, vexop + rexw, args[0], args[2], args[1]); break; } gen_shift: if (const_args[2]) { tcg_out_shifti(s, c + rexw, args[0], args[2]); } else { tcg_out_modrm(s, OPC_SHIFT_cl + rexw, c, args[0]); } break; case INDEX_op_brcond_i32: tcg_out_brcond32(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i32: tcg_out_setcond32(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i32: tcg_out_movcond32(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; OP_32_64(bswap16): tcg_out_rolw_8(s, args[0]); break; OP_32_64(bswap32): tcg_out_bswap32(s, args[0]); break; OP_32_64(neg): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NEG, args[0]); break; OP_32_64(not): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, args[0]); break; OP_32_64(ext8s): tcg_out_ext8s(s, args[0], args[1], rexw); break; OP_32_64(ext16s): tcg_out_ext16s(s, args[0], args[1], rexw); break; OP_32_64(ext8u): tcg_out_ext8u(s, args[0], args[1]); break; OP_32_64(ext16u): tcg_out_ext16u(s, args[0], args[1]); break; case INDEX_op_qemu_ld_i32: tcg_out_qemu_ld(s, args, 0); break; case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, args, 1); break; case INDEX_op_qemu_st_i32: tcg_out_qemu_st(s, args, 0); break; case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, args, 1); break; OP_32_64(mulu2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_MUL, args[3]); break; OP_32_64(muls2): tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_IMUL, args[3]); break; OP_32_64(add2): if (const_args[4]) { tgen_arithi(s, ARITH_ADD + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_ADD + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_ADC + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_ADC + rexw, args[1], args[5]); } break; OP_32_64(sub2): if (const_args[4]) { tgen_arithi(s, ARITH_SUB + rexw, args[0], args[4], 1); } else { tgen_arithr(s, ARITH_SUB + rexw, args[0], args[4]); } if (const_args[5]) { tgen_arithi(s, ARITH_SBB + rexw, args[1], args[5], 1); } else { tgen_arithr(s, ARITH_SBB + rexw, args[1], args[5]); } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_brcond2_i32: tcg_out_brcond2(s, args, const_args, 0); break; case INDEX_op_setcond2_i32: tcg_out_setcond2(s, args, const_args); break; #else case INDEX_op_ld32s_i64: tcg_out_modrm_offset(s, OPC_MOVSLQ, args[0], args[1], args[2]); break; case INDEX_op_ld_i64: tcg_out_ld(s, TCG_TYPE_I64, args[0], args[1], args[2]); break; case INDEX_op_st_i64: if (const_args[0]) { tcg_out_modrm_offset(s, OPC_MOVL_EvIz | P_REXW, 0, args[1], args[2]); tcg_out32(s, args[0]); } else { tcg_out_st(s, TCG_TYPE_I64, args[0], args[1], args[2]); } break; case INDEX_op_brcond_i64: tcg_out_brcond64(s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_setcond_i64: tcg_out_setcond64(s, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_movcond_i64: tcg_out_movcond64(s, args[5], args[0], args[1], args[2], const_args[2], args[3]); break; case INDEX_op_bswap64_i64: tcg_out_bswap64(s, args[0]); break; case INDEX_op_ext32u_i64: tcg_out_ext32u(s, args[0], args[1]); break; case INDEX_op_ext32s_i64: tcg_out_ext32s(s, args[0], args[1]); break; #endif OP_32_64(deposit): if (args[3] == 0 && args[4] == 8) { tcg_out_modrm(s, OPC_MOVB_EvGv | P_REXB_R | P_REXB_RM, args[2], args[0]); } else if (args[3] == 8 && args[4] == 8) { tcg_out_modrm(s, OPC_MOVB_EvGv, args[2], args[0] + 4); } else if (args[3] == 0 && args[4] == 16) { tcg_out_modrm(s, OPC_MOVL_EvGv | P_DATA16, args[2], args[0]); } else { tcg_abort(); } break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef OP_32_64 }
1threat
bash - filter folders by name with "@" at beggining : I do have folder with folders my_folders @folder1 @next_one some_folder_without_at @third some_file.txt I got so far adding all folders for /d %%i in ("C:\my\path\to\my_folders\*") do ( call :setfolders %%i ) Goal: I want to filter result and add **only folders with @ at beggining**
0debug
document.getElementById replacement in angular4 / typescript? : <p>So, im working with angular4 in my practice work and this is new for me. Luckyly, in order to get html elements and its values i used <code>&lt;HTMLInputElement&gt; document.getElementById</code> or <code>&lt;HTMLSelectElement&gt; document.getElementById</code></p> <p>Im wondering if there is any replacement for this in angular</p>
0debug
static int flac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { FLACContext *s = avctx->priv_data; int tmp = 0, i, j = 0, input_buf_size = 0; int16_t *samples_16 = data; int32_t *samples_32 = data; int alloc_data_size= *data_size; *data_size=0; if (s->max_framesize == 0) { s->max_framesize= FFMAX(4, buf_size); s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); } if (1 && s->max_framesize) { if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); input_buf_size= buf_size; if (s->bitstream_size + buf_size < buf_size || s->bitstream_index + s->bitstream_size + buf_size < s->bitstream_index) return -1; if (s->allocated_bitstream_size < s->bitstream_size + buf_size) s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->bitstream_size + buf_size); if (s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index=0; } memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size); buf= &s->bitstream[s->bitstream_index]; buf_size += s->bitstream_size; s->bitstream_size= buf_size; if (buf_size < s->max_framesize && input_buf_size) { return input_buf_size; } } init_get_bits(&s->gb, buf, buf_size*8); if (metadata_parse(s)) goto end; tmp = show_bits(&s->gb, 16); if ((tmp & 0xFFFE) != 0xFFF8) { av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n"); while (get_bits_count(&s->gb)/8+2 < buf_size && (show_bits(&s->gb, 16) & 0xFFFE) != 0xFFF8) skip_bits(&s->gb, 8); goto end; } skip_bits(&s->gb, 16); if (decode_frame(s, alloc_data_size) < 0) { av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); s->bitstream_size=0; s->bitstream_index=0; return -1; } #define DECORRELATE(left, right)\ assert(s->channels == 2);\ for (i = 0; i < s->blocksize; i++) {\ int a= s->decoded[0][i];\ int b= s->decoded[1][i];\ if (s->is32) {\ *samples_32++ = (left) << s->sample_shift;\ *samples_32++ = (right) << s->sample_shift;\ } else {\ *samples_16++ = (left) << s->sample_shift;\ *samples_16++ = (right) << s->sample_shift;\ }\ }\ break; switch (s->decorrelation) { case INDEPENDENT: for (j = 0; j < s->blocksize; j++) { for (i = 0; i < s->channels; i++) { if (s->is32) *samples_32++ = s->decoded[i][j] << s->sample_shift; else *samples_16++ = s->decoded[i][j] << s->sample_shift; } } break; case LEFT_SIDE: DECORRELATE(a,a-b) case RIGHT_SIDE: DECORRELATE(a+b,b) case MID_SIDE: DECORRELATE( (a-=b>>1) + b, a) } *data_size = s->blocksize * s->channels * (s->is32 ? 4 : 2); end: i= (get_bits_count(&s->gb)+7)/8; if (i > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); s->bitstream_size=0; s->bitstream_index=0; return -1; } if (s->bitstream_size) { s->bitstream_index += i; s->bitstream_size -= i; return input_buf_size; } else return i; }
1threat
static int stream_component_open(VideoState *is, int stream_index) { AVFormatContext *ic = is->ic; AVCodecContext *enc; AVCodec *codec; SDL_AudioSpec wanted_spec, spec; if (stream_index < 0 || stream_index >= ic->nb_streams) return -1; enc = ic->streams[stream_index]->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { if (enc->channels > 0) { enc->request_channels = FFMIN(2, enc->channels); } else { enc->request_channels = 2; } } codec = avcodec_find_decoder(enc->codec_id); enc->debug_mv = debug_mv; enc->debug = debug; enc->workaround_bugs = workaround_bugs; enc->lowres = lowres; if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; enc->idct_algo= idct; if(fast) enc->flags2 |= CODEC_FLAG2_FAST; enc->skip_frame= skip_frame; enc->skip_idct= skip_idct; enc->skip_loop_filter= skip_loop_filter; enc->error_recognition= error_recognition; enc->error_concealment= error_concealment; set_context_opts(enc, avcodec_opts[enc->codec_type], 0); if (!codec || avcodec_open(enc, codec) < 0) return -1; if (enc->codec_type == CODEC_TYPE_AUDIO) { wanted_spec.freq = enc->sample_rate; wanted_spec.format = AUDIO_S16SYS; wanted_spec.channels = enc->channels; wanted_spec.silence = 0; wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; wanted_spec.callback = sdl_audio_callback; wanted_spec.userdata = is; if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); return -1; } is->audio_hw_buf_size = spec.size; is->audio_src_fmt= SAMPLE_FMT_S16; } if(thread_count>1) avcodec_thread_init(enc, thread_count); enc->thread_count= thread_count; ic->streams[stream_index]->discard = AVDISCARD_DEFAULT; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: is->audio_stream = stream_index; is->audio_st = ic->streams[stream_index]; is->audio_buf_size = 0; is->audio_buf_index = 0; is->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB); is->audio_diff_avg_count = 0; is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / enc->sample_rate; memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); packet_queue_init(&is->audioq); SDL_PauseAudio(0); break; case CODEC_TYPE_VIDEO: is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; is->frame_last_delay = 40e-3; is->frame_timer = (double)av_gettime() / 1000000.0; is->video_current_pts_time = av_gettime(); packet_queue_init(&is->videoq); is->video_tid = SDL_CreateThread(video_thread, is); break; case CODEC_TYPE_SUBTITLE: is->subtitle_stream = stream_index; is->subtitle_st = ic->streams[stream_index]; packet_queue_init(&is->subtitleq); is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); break; default: break; } return 0; }
1threat
Sending a MVC project to someone : <p>The company I've applied for internship wanted me to do some mvc project. I've finished the project but I really don't know how to send it to them via email.The project includes a small database. I know I can't compress the solution folder and send it. Do I have to upload the project to a hosting service? If I deploy it to a hosting service and send them a website url then can they evaluate my work?</p>
0debug
How to prevent iOS keyboard from pushing the view off screen with CSS or JS : <p>I have a responsive web page that opens a modal when you tap a button. When the modal opens, it is set to take up the full width and height of the page using fixed positioning. The modal also has an input field in it.</p> <p>On iOS devices, when the input field is focused, the keyboard opens. However, when it opens, it actually pushes the full document up out of the way such that half of my page goes above the top of the viewport. I can confirm that the actual <code>html</code> tag itself has been pushed up to compensate for the keyboard and that it has not happened via CSS or JavaScript.</p> <p>Has anyone seen this before and, if so, is there a way to prevent it, or reposition things after the keyboard has opened? It's a problem because I need users to be able to see content at the top of the modal while, simultaneously, I'd like to auto-focus the input field.</p>
0debug
static inline void decode_block_intra(MadContext *s, int16_t * block) { int level, i, j, run; RLTable *rl = &ff_rl_mpeg1; const uint8_t *scantable = s->scantable.permutated; int16_t *quant_matrix = s->quant_matrix; block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0]; i = 0; { OPEN_READER(re, &s->gb); for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (level == 127) { break; } else if (level != 0) { i += run; j = scantable[i]; level = (level*quant_matrix[j]) >> 4; level = (level-1)|1; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); } else { UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 10); SKIP_BITS(re, &s->gb, 10); UPDATE_CACHE(re, &s->gb); run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6); i += run; j = scantable[i]; if (level < 0) { level = -level; level = (level*quant_matrix[j]) >> 4; level = (level-1)|1; level = -level; } else { level = (level*quant_matrix[j]) >> 4; level = (level-1)|1; } } if (i > 63) { av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); return; } block[j] = level; } CLOSE_READER(re, &s->gb); } }
1threat
How can i compare if a text line starts with a word in Python? : <p>I have a key text "Outros" and a text file im reading and enumerating. I need to print only the lines that starts with that key. Is it possible?</p> <p>Im alreadying printing lines, but it prints every line that has this key inside the line, not only the start. I really have no idea of how i can do this.</p> <pre><code>for index, line in enumerate(lines): if a in line: print(line.rstrip()) if b in line: print(line.rstrip()) </code></pre>
0debug
Correct function using Math.random() to get 50/50 chance : <p>Which is the correct function for getting a precise 50/50 chance:</p> <pre><code>return Math.random() &lt; 0.5; </code></pre> <p>Vs</p> <pre><code>return Math.random() &lt;= 0.5; </code></pre>
0debug
How is HttpContext TraceIdentifier generated in .net core? : <p>How is HttpContext TraceIdentifier, aka Correlation-Id is generated?</p> <p>I request a page through controller which gives me the following TraceId: <code>0HLEACIU86PT6:0000000D</code></p> <p>The page fires an ajax call which has the following TraceId: <code>0HLEACIU86PT7:00000005</code></p> <p>as you can see they are very similar. is it based on time? </p> <p>Why didnt I get the same TraceIdentifier?</p> <p>How can I ensure the same TraceIdentifier?</p>
0debug
static void test_native_list(TestOutputVisitorData *data, const void *unused, UserDefNativeListUnionKind kind) { UserDefNativeListUnion *cvalue = g_new0(UserDefNativeListUnion, 1); QObject *obj; cvalue->type = kind; init_native_list(cvalue); visit_type_UserDefNativeListUnion(data->ov, NULL, &cvalue, &error_abort); obj = visitor_get(data); check_native_list(obj, cvalue->type); qapi_free_UserDefNativeListUnion(cvalue); }
1threat
How to intialize the arrayList when creating a new method : I am creating a program to find the sum of any two array element equal to the given value i required. When checking for appropriate patches ex., if (a[0] == givenValue){ arrayList = new ArrayList<>(); arrayList.add(a[0]); return arrayList; } else if (a[n] == givenValue){ arrayList = new ArrayList<>(); arrayList.add(a[0]); return arrayList; } I have keep initialize the array every time I am doing it and adding it manually. I have try to create a method public static ArrayList<Integer> sum(ArrayList<Integer> arr,int[] a,int i){ arr = new ArrayList<>(); arr.add(a[i]); return arr; } but when I declare it in the if else statement it says the ArrayList variable is not initialized which is correct. Is there any way I could initialize it in the method only so that I might not have to initialize it over and over again.
0debug
Need help fixing my c++ fighting game with Run-Time Check Error : I have been receiving an issue that I do not understand. The issue is "Run-Time Check Failure #3 - The variable 'win' is being used without being initialized.". I am struggling to comprehend where my error is within the code. May someone please explain to me where it is? From what I understand the run time error comes from win not being initialized meaning it hasn't been used or set, however, it clearly is set in the fightScene() function. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include "Character.h" #include "Item.h" #include "Blacksmith.h" using namespace std; void startup(); void createCharacter(); void existCharacter(); void secondFighter(); void fightScene(); int fightMoves(int att, int sp, int num); void roundWon(); void characterLost(); void use_bar(); void newlines(); void changeCase(string &convert); void bSmith(); Character existingCharacter[4] = { Character("Shabu", 10, 10, 10, 0, "Empty"), Character("Calil", 15, 15, 15, 0, "Empty"), Character("Goltero", 20, 20, 20, 0, "Empty"), Character("Balrogg", 30, 30, 30, 0, "Empty") }; Character cCharacter[2] = { Character(), Character() }; Character cCharacterSave("Empty", 20, 0, 0, 100, "Empty"); Item bars(0, 0, 0); int timesWon = 0; int purposeIgnore = 0; char repeat = 'y'; int main() { startup(); while (repeat == 'y' || repeat == 'Y') { fightScene(); if (repeat == 'y' || repeat == 'Y') secondFighter(); } return 0; } void startup() { int playerChoice; cout << "**************************" << endl; cout << "* Loading Game *" << endl; cout << "**************************" << endl; cout << "Which Would You Prefer?" << endl; cout << "1: New Character..." << endl; cout << "2: Load Character..." << endl; do { cout << "Enter Selection: "; cin >> playerChoice; } while (playerChoice <= 0 || playerChoice >= 3); if (playerChoice == 1) createCharacter(); else if (playerChoice == 2) existCharacter(); return; } void createCharacter() { string Name; string inventory; int h, att, sp, gc; cout << "***************************" << endl; cout << "* Creating New Player *" << endl; cout << "***************************" << endl; cout << "What Shall We Call You?" << endl; cout << "Enter Name Here: "; cin >> Name; changeCase(Name); cout << Name << ", let's set your stats!" << endl; cout << "Set your ATTACK between 1 - 10" << endl; do { cout << "Enter Attack Here: "; cin >> att; } while (att <= 0 || att >= 11); cout << "Set your SPEED between 1 - 10" << endl; do { cout << "Enter Speed Here: "; cin >> sp; } while (sp <= 0 || sp >= 11); h = 20; gc = 100; cout << "The HEALTH stat wil increase over time, but as of now, " << Name << ", has " << h << " health!" << endl; cout << Name << " you have been granted " << gc << " gold!" << endl; cCharacter[0] = Character(Name, h, att, sp, gc, inventory); cin.ignore(); return; } void existCharacter() { string characterChoice; cout << "***********************" << endl; cout << "* Existing Player *" << endl; cout << "***********************" << endl; for (int i = 0, j = 1; i >= 0 && i <= 3; i++, j++) { cout << j << ": " << existingCharacter[i].getName(); cout << "\t" << "Health: " << existingCharacter[i].getHealth(); cout << "\t" << "Attack: " << existingCharacter[i].getAttack(); cout << "\t" << "Speed: " << existingCharacter[i].getSpeed(); } cout << "Enter Selection: "; cin.ignore(); getline(cin, characterChoice); changeCase(characterChoice); if (characterChoice == "1" || characterChoice == "Shabu") { cCharacter[0] = existingCharacter[0]; cCharacterSave.setHealth(existingCharacter[0].getHealth()); } else if (characterChoice == "2" || characterChoice == "Calil") { cCharacter[0] = existingCharacter[1]; cCharacterSave.setHealth(existingCharacter[1].getHealth()); } else if (characterChoice == "3" || characterChoice == "Goltero") { cCharacter[0] = existingCharacter[2]; cCharacterSave.setHealth(existingCharacter[2].getHealth()); } else if (characterChoice == "4" || characterChoice == "Balrogg") { cCharacter[0] = existingCharacter[3]; cCharacterSave.setHealth(existingCharacter[3].getHealth()); } else { cout << "Program Failure....Invaid Input!" << endl; } secondFighter(); return; } void secondFighter() { string cFighter; cout << "***************" << endl; cout << "* Fighter *" << endl; cout << "***************" << endl; cout << "Choose Who To Fight!" << endl; for (int i = 0, j = 1; i >= 0 && i <= 3; i++, j++) { cout << j << ": " << existingCharacter[i].getName(); cout << "\t" << "Health: " << existingCharacter[i].getHealth(); cout << "\t" << "Strength: " << existingCharacter[i].getAttack(); cout << "\t" << "Speed: " << existingCharacter[i].getSpeed(); cout << endl; } cout << "Enter Selection: "; if (purposeIgnore >= 1) cin.ignore(); getline(cin, cFighter); changeCase(cFighter); if (cFighter == "1" || cFighter == "Shabu") cCharacter[1] = existingCharacter[0]; else if (cFighter == "2" || cFighter == "Calil") cCharacter[1] = existingCharacter[1]; else if (cFighter == "3" || cFighter == "Goltero") cCharacter[1] = existingCharacter[2]; else if (cFighter == "4" || cFighter == "Balrogg") cCharacter[1] = existingCharacter[3]; else { cout << "Invalid Input! Program Failure....Please Close and Restart" << endl; } return; } void fightScene() { int fight_choice; int i = 0; int j = 5; bool win; if (timesWon >= 1) j = 6; while (cCharacter[0].getHealth() > 0 && cCharacter[1].getHealth() > 0) { newlines(); cout << "\t\t" << cCharacter[0].getName() << " choose "; if (i == 0) cout << "an attack."; else cout << "another attack."; do { cout << "\n\n\t\t<1. Punch / 2. Kick>\n\t\t<3. Slam / 4. Drop kick>"; if (j == 6) cout << "\n\t\t<5. Items>"; cout << endl << "\t\t"; cin >> fight_choice; } while (fight_choice <= 0 || fight_choice >= j); if (fight_choice == 1) { cCharacter[1].setHealth(cCharacter[1].getHealth() - fightMoves(cCharacter[0].getAttack(), cCharacter[0].getSpeed(), 1)); cout << "\n\t\tYou Punched " << cCharacter[1].getName() << ", his health is now: "; if (cCharacter[1].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[1].setHealth(-1); } else cout << cCharacter[1].getHealth() << endl << endl; } else if (fight_choice == 2) { cCharacter[1].setHealth(cCharacter[1].getHealth() - fightMoves(cCharacter[0].getAttack(), cCharacter[0].getSpeed(), 2)); cout << "\n\t\tYou Kicked " << cCharacter[1].getName() << ", his health is now: "; if (cCharacter[1].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[1].setHealth(-1); } else cout << cCharacter[1].getHealth() << endl << endl; } else if (fight_choice == 3) { cCharacter[1].setHealth(cCharacter[1].getHealth() - fightMoves(cCharacter[0].getAttack(), cCharacter[0].getSpeed(), 3)); cout << "\n\t\tYou Slamed " << cCharacter[1].getName() << " on the ground, his health is now: "; if (cCharacter[1].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[1].setHealth(-1); } else cout << cCharacter[1].getHealth() << endl << endl; } else if (fight_choice == 4) { cCharacter[1].setHealth(cCharacter[1].getHealth() - fightMoves(cCharacter[0].getAttack(), cCharacter[0].getSpeed(), 4)); cout << "\n\t\tYou Drop Kicked " << cCharacter[1].getName() << ", his health is now: "; if (cCharacter[1].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[1].setHealth(-1); } else cout << cCharacter[1].getHealth() << endl << endl; } else if (timesWon >= 1 && fight_choice == 5) { // Bars use_bar(); } // Second fighter attack srand(time(NULL)); int ran_pick = rand() % 5 + 1; if (cCharacter[1].getHealth() < 0) { ran_pick = 0; win = 1; } else if (cCharacter[1].getHealth() > 0) { cout << "\n\t\t<" << cCharacter[1].getName() << "'s turn>" << endl; win = 0; } if (ran_pick == 0) continue; else if (ran_pick == 1) { cCharacter[0].setHealth(cCharacter[0].getHealth() - fightMoves(cCharacter[1].getAttack(), cCharacter[1].getSpeed(), 1)); cout << "\n\t\t" << cCharacter[1].getName() << " punched you! Your health is now: "; if (cCharacter[0].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[0].setHealth(-1); } else cout << cCharacter[0].getHealth() << endl << endl; } else if (ran_pick == 2) { cCharacter[0].setHealth(cCharacter[0].getHealth() - fightMoves(cCharacter[1].getAttack(), cCharacter[1].getSpeed(), 2)); cout << "\n\t\t" << cCharacter[1].getName() << " kicked you! Your health is now: "; if (cCharacter[0].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[0].setHealth(-1); } else cout << cCharacter[0].getHealth() << endl << endl; } else if (ran_pick == 3) { cCharacter[0].setHealth(cCharacter[0].getHealth() - fightMoves(cCharacter[1].getAttack(), cCharacter[1].getSpeed(), 3)); cout << "\n\t\t" << cCharacter[1].getName() << " slammed you on the ground! Your health is now: "; if (cCharacter[0].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[0].setHealth(-1); } else cout << cCharacter[0].getHealth() << endl << endl; } else if (ran_pick == 4) { cCharacter[0].setHealth(cCharacter[0].getHealth() - fightMoves(cCharacter[1].getAttack(), cCharacter[1].getSpeed(), 4)); cout << "\n\t\t" << cCharacter[1].getName() << " drop kicked you! Your health is now: "; if (cCharacter[0].getHealth() <= 0) { cout << "0" << endl << endl; cCharacter[0].setHealth(-1); } else cout << cCharacter[0].getHealth() << endl << endl; } else if (ran_pick == 5) cout << "\t\t" << cCharacter[1].getName() << " missed you! Your health is still: " << cCharacter[0].getHealth() << endl << endl; if (cCharacter[0].getHealth() > 0) { cout << "\n\t\t"; system("PAUSE"); // Lets them read the attacks } i++; // Increases i to change some wording } if (win == 1) roundWon(); else characterLost(); return; } int fightMoves(int st, int sp, int num) { srand(time(NULL)); int rand_num; int addition; switch (num) { case 1: { rand_num = rand() % 40 + 1; addition = (st + sp) / rand_num; cout << "\n\t\tDamage inflicted: " << addition; return addition; break; } case 2: { rand_num = rand() % 20 + 1; addition = (st + sp) / rand_num; cout << "\n\t\tDamage inflicted: " << addition; return addition; break; } case 3: { rand_num = rand() % 30 + 1; addition = (st + sp) / rand_num; cout << "\n\t\tDamage inflicted: " << addition; return addition; break; } case 4: { rand_num = rand() % 30 + 1; addition = (st + sp) / rand_num; cout << "\n\t\tDamage inflicted: " << addition; return addition; break; } } } int start() { while (repeat == 'y' || repeat == 'Y') { fightScene(); if (repeat == 'y' || repeat == 'Y') secondFighter(); } return 0; } void roundWon() { srand(time(NULL)); timesWon++; purposeIgnore++; cCharacter[0].setHealth(cCharacterSave.getHealth()); cCharacter[1].setHealth(100); int item_won = rand() % 3 + 1; cout << "\t\tYou won!"; cout << "\n\n\t\tYou have been rewarded "; if (item_won == 1) { cout << "a small protein bar! (+20 health)"; bars.bar_small++; } else if (item_won == 2) { cout << "a medium protein bar! (+30 health)"; bars.bar_medium++; } else if (item_won == 3) { cout << "a large protein bar! (+40 health)"; bars.bar_large++; } cout << "\n\n\t\tItems can be used in game at the cost of a turn."; cout << "\n\n\t\t"; system("PAUSE"); // Lets them read int ability_gain[3] = { rand() % 10 + 1, rand() % 10 + 1, rand() % 10 + 1 }; cCharacter[0].setHealth(ability_gain[0] += cCharacter[0].getHealth()); cCharacterSave.setHealth(cCharacter[0].getHealth()); cCharacter[0].setAttack(ability_gain[1] += cCharacter[0].getAttack()); cCharacter[0].setSpeed(ability_gain[2] += cCharacter[0].getSpeed()); cout << "\n\t\tYour health is now: " << cCharacter[0].getHealth(); cout << "\n\t\tYour strength is now: " << cCharacter[0].getAttack(); cout << "\n\t\tYour speed is now: " << cCharacter[0].getSpeed(); cout << "\n\n\t\tWould you like to fight another person? (y/n) "; cin >> repeat; return; } void characterLost() { cCharacter[0].setHealth(cCharacterSave.getHealth()); cCharacter[1].setHealth(100); purposeIgnore++; cout << "\n\n\t\tYou have lost."; cout << "\n\t\tWould you like to fight another person? (y/n) "; cin >> repeat; return; } void use_bar() { int choose_bar; char another_bar; do { cout << "\n\n\t\tWhich bar would you like to use? "; cout << "\n\t\t 1: Small Bar: " << bars.bar_small; cout << "\n\t\t 2: Medium Bar: " << bars.bar_medium; cout << "\n\t\t 3: Large bar: " << bars.bar_large; do { cout << "\n\n\t\tI choose: "; cin >> choose_bar; } while (choose_bar <= 0 || choose_bar >= 4); if (choose_bar == 1 && bars.bar_small >= 1) { cCharacter[0].setHealth(cCharacter[0].getHealth() + 20); bars.bar_small--; cout << "\n\n\t\tYour health is now: " << cCharacter[0].getHealth(); } else if (choose_bar == 2 && bars.bar_medium >= 1) { cCharacter[0].setHealth(cCharacter[0].getHealth() + 30); bars.bar_medium--; cout << "\n\n\t\tYour health is now: " << cCharacter[0].getHealth(); } else if (choose_bar == 3 && bars.bar_large >= 1) { cCharacter[0].setHealth(cCharacter[0].getHealth() + 40); bars.bar_large--; cout << "\n\n\t\tYour health is now: " << cCharacter[0].getHealth(); } else cout << "\n\t\tNot enough bars!"; cout << "\n\n\t\tWould you like to use another bar? (y/n) "; cin >> another_bar; } while (another_bar == 'y' || another_bar == 'Y'); return; } void newlines() { cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; } void changeCase(string &convert) { for (int i = 0; convert[i]; i++) { if (isupper(convert[i])) convert[i] = tolower(convert[i]); else continue; } convert.at(0) = toupper(convert.at(0)); return; } void bSmith() { Blacksmith shopKeeper; //The shop keeper int responce; //Menu navigation cout << "*******************************" << endl; cout << "* Welcome to the Blacksmith *" << endl; cout << "*******************************" << "\n" << endl; cout << "*****************************" << endl; cout << "* 1: Purchase Items *\n"; cout << "* 2: Sell Items *\n"; cout << "* 3: List Your Items *\n"; cout << "* 4: Currency *\n"; cout << "* 5: Exit *\n"; cout << "*****************************" << endl; do { cout << "Enter Option Here: "; cin >> responce; switch (responce) { case 1: shopKeeper.buyItem(cCharacter[0]); cout << endl; break; case 2: cout << "*****************************" << endl; cout << "* Items To Sell *" << endl; cout << "*****************************" << endl; shopKeeper.sellItem(cCharacter[0]); cout << endl; break; case 3: cout << "*****************************" << endl; cout << "* Character Inventory *" << endl; cout << "*****************************" << endl; cCharacter[0].listInv(); cout << endl; break; case 4: cout << "*****************************" << endl; cout << "* Current Gold Currency *" << endl; cout << "*****************************" << endl; cout << "\t" << cCharacter[0].getCurrency() << endl; cout << endl; break; case 5: cout << "*****************************" << endl; cout << "* Thanks for shopping *" << endl; cout << "*****************************" << endl; return; default: cout << "Please enter valid data." << "\n"; break; } cout << "*****************************" << endl; cout << "* 1: Purchase Items *\n"; cout << "* 2: Sell Items *\n"; cout << "* 3: List Your Items *\n"; cout << "* 4: Currency *\n"; cout << "* 5: Exit *\n"; cout << "*****************************" << endl; } while (responce != 5); return; } <!-- end snippet -->
0debug
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head = NULL; MigrationCapabilityStatusList *caps; MigrationState *s = migrate_get_current(); int i; for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { if (head == NULL) { head = g_malloc0(sizeof(*caps)); caps = head; } else { caps->next = g_malloc0(sizeof(*caps)); caps = caps->next; } caps->value = g_malloc(sizeof(*caps->value)); caps->value->capability = i; caps->value->state = s->enabled_capabilities[i]; } return head; }
1threat
void do_interrupt(CPUState *env) { int intno = env->exception_index; #ifdef DEBUG_PCALL if (qemu_loglevel_mask(CPU_LOG_INT)) { static int count; const char *name; if (intno < 0 || intno >= 0x180) name = "Unknown"; else if (intno >= 0x100) name = "Trap Instruction"; else if (intno >= 0xc0) name = "Window Fill"; else if (intno >= 0x80) name = "Window Spill"; else { name = excp_names[intno]; if (!name) name = "Unknown"; } qemu_log("%6d: %s (v=%04x) pc=%016" PRIx64 " npc=%016" PRIx64 " SP=%016" PRIx64 "\n", count, name, intno, env->pc, env->npc, env->regwptr[6]); log_cpu_state(env, 0); #if 0 { int i; uint8_t *ptr; qemu_log(" code="); ptr = (uint8_t *)env->pc; for(i = 0; i < 16; i++) { qemu_log(" %02x", ldub(ptr + i)); } qemu_log("\n"); } #endif count++; } #endif #if !defined(CONFIG_USER_ONLY) if (env->tl >= env->maxtl) { cpu_abort(env, "Trap 0x%04x while trap level (%d) >= MAXTL (%d)," " Error state", env->exception_index, env->tl, env->maxtl); return; } #endif if (env->tl < env->maxtl - 1) { env->tl++; } else { env->pstate |= PS_RED; if (env->tl < env->maxtl) env->tl++; } env->tsptr = &env->ts[env->tl & MAXTL_MASK]; env->tsptr->tstate = ((uint64_t)GET_CCR(env) << 32) | ((env->asi & 0xff) << 24) | ((env->pstate & 0xf3f) << 8) | GET_CWP64(env); env->tsptr->tpc = env->pc; env->tsptr->tnpc = env->npc; env->tsptr->tt = intno; if (!(env->def->features & CPU_FEATURE_GL)) { switch (intno) { case TT_IVEC: change_pstate(PS_PEF | PS_PRIV | PS_IG); break; case TT_TFAULT: case TT_TMISS: case TT_DFAULT: case TT_DMISS: case TT_DPROT: change_pstate(PS_PEF | PS_PRIV | PS_MG); break; default: change_pstate(PS_PEF | PS_PRIV | PS_AG); break; } } if (intno == TT_CLRWIN) cpu_set_cwp(env, cpu_cwp_dec(env, env->cwp - 1)); else if ((intno & 0x1c0) == TT_SPILL) cpu_set_cwp(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2)); else if ((intno & 0x1c0) == TT_FILL) cpu_set_cwp(env, cpu_cwp_inc(env, env->cwp + 1)); env->tbr &= ~0x7fffULL; env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5); env->pc = env->tbr; env->npc = env->pc + 4; env->exception_index = 0; }
1threat
Merging two list to create a third one in python : Let say I have the following: {u'result': {u'status': True, u'queried': 3, u'value': [{u'username': u'firstuser', u'userid': u'1'}, {u'username': u'seconduser', u'userid': u'2'}, {u'username': u'thirduser', u'userid': u'3'}]} and this one: {u'result': {u'status': True, u'queried': 2, u'value': [{u'username': u'firstuser', u'userid': u'101'}, {u'username': u'seconduser', u'userid': u'102'}]} How can I obtain a third one like this: {u'result': {u'status': True, u'queried': 3, u'value': [{u'username': u'firstuser', u'userid_one': u'1', u'userid_two': u'101'}, {u'username': u'seconduser', u'userid_one': u'2', u'userid_two': u'102'}, {u'username': u'thirduser', u'userid_one': u'3', u'userid_two': u''}]}
0debug
static int ssd0323_init(SSISlave *dev) { ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev); s->col_end = 63; s->row_end = 79; s->con = graphic_console_init(ssd0323_update_display, ssd0323_invalidate_display, NULL, NULL, s); qemu_console_resize(s->con, 128 * MAGNIFY, 64 * MAGNIFY); qdev_init_gpio_in(&dev->qdev, ssd0323_cd, 1); register_savevm(&dev->qdev, "ssd0323_oled", -1, 1, ssd0323_save, ssd0323_load, s); return 0; }
1threat
Sort Descriptor based on ordered to-many relationship : <p>Description of my core data model:</p> <ul> <li>Project and Issues entities</li> <li>Project has an <strong>ordered one-to-many relationship</strong> to Issues named issues</li> <li>Issue has one-to-one relationship with Project named parentProject</li> </ul> <p>Here is my code to obtain issues:</p> <pre><code>let fetchRequest = NSFetchRequest(entityName: "Issue") fetchRequest.predicate = NSPredicate(format: "parentProject CONTAINS[cd] %@", argumentArray: [project]) fetchRequest.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)] let frc = NSFetchedResultsController( fetchRequest: fetchRequest, managedObjectContext: dataManager.context, sectionNameKeyPath: nil, cacheName: nil) return arc </code></pre> <p>Even though I have all issues from the project object, I prefer to obtain issues using fetched results controller, so they will always be updated and I like the integration with tables. I also like that in navigation controller screen before the projects are displayed using FRC as well.</p> <p>As you see in the code the Issues are sorted by the name parameter. </p> <p><strong>However I'd like them to be sorted by the order I keep them in the NSMutableOrderedSet of project.</strong></p> <p>AFAIK I cannot use NSSortDescriptor with comparator/selector when it's used to Core Data.</p> <p>Do you know how to do it? Thanks in advance.</p>
0debug
static void pci_bridge_update_mappings(PCIBridge *br) { memory_region_transaction_begin(); pci_bridge_region_cleanup(br); pci_bridge_region_init(br); memory_region_transaction_commit(); }
1threat
static void h264_free_context(PayloadContext *data) { #ifdef DEBUG int ii; for (ii = 0; ii < 32; ii++) { if (data->packet_types_received[ii]) av_log(NULL, AV_LOG_DEBUG, "Received %d packets of type %d\n", data->packet_types_received[ii], ii); } #endif assert(data); assert(data->cookie == MAGIC_COOKIE); data->cookie = DEAD_COOKIE; av_free(data); }
1threat
Does the join query works differently on hive? : I have a join query (that joins 4 table) on mysql returns 2 rows while on Hive returns OK results. So i checked table individually on hive and mysql side. Records on each table on both side matches but results doesn't match. Is the OK results on hive an issue. Below is the part of the result: Stage-Stage-6: Map: 2 Reduce: 1 Cumulative CPU: 22.22 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS Stage-Stage-7: Map: 2 Reduce: 1 Cumulative CPU: 24.94 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS Stage-Stage-8: Map: 2 Reduce: 1 Cumulative CPU: 22.25 sec MAPRFS Read: 0 MAPRFS Write: 0 SUCCESS Total MapReduce CPU Time Spent: 2 minutes 36 seconds 110 msec OK Time taken: 411.225 seconds hive>
0debug
static void omap_rtc_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_rtc_s *s = (struct omap_rtc_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; struct tm new_tm; time_t ti[2]; if (size != 1) { return omap_badwidth_write8(opaque, addr, value); } switch (offset) { case 0x00: #ifdef ALMDEBUG printf("RTC SEC_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_sec; s->ti += from_bcd(value); return; case 0x04: #ifdef ALMDEBUG printf("RTC MIN_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_min * 60; s->ti += from_bcd(value) * 60; return; case 0x08: #ifdef ALMDEBUG printf("RTC HRS_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_hour * 3600; if (s->pm_am) { s->ti += (from_bcd(value & 0x3f) & 12) * 3600; s->ti += ((value >> 7) & 1) * 43200; } else s->ti += from_bcd(value & 0x3f) * 3600; return; case 0x0c: #ifdef ALMDEBUG printf("RTC DAY_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_mday * 86400; s->ti += from_bcd(value) * 86400; return; case 0x10: #ifdef ALMDEBUG printf("RTC MTH_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); new_tm.tm_mon = from_bcd(value); ti[0] = mktimegm(&s->current_tm); ti[1] = mktimegm(&new_tm); if (ti[0] != -1 && ti[1] != -1) { s->ti -= ti[0]; s->ti += ti[1]; } else { s->ti -= s->current_tm.tm_mon * 2592000; s->ti += from_bcd(value) * 2592000; } return; case 0x14: #ifdef ALMDEBUG printf("RTC YRS_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); new_tm.tm_year += from_bcd(value) - (new_tm.tm_year % 100); ti[0] = mktimegm(&s->current_tm); ti[1] = mktimegm(&new_tm); if (ti[0] != -1 && ti[1] != -1) { s->ti -= ti[0]; s->ti += ti[1]; } else { s->ti -= (s->current_tm.tm_year % 100) * 31536000; s->ti += from_bcd(value) * 31536000; } return; case 0x18: return; case 0x20: #ifdef ALMDEBUG printf("ALM SEC_REG <-- %02x\n", value); #endif s->alarm_tm.tm_sec = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x24: #ifdef ALMDEBUG printf("ALM MIN_REG <-- %02x\n", value); #endif s->alarm_tm.tm_min = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x28: #ifdef ALMDEBUG printf("ALM HRS_REG <-- %02x\n", value); #endif if (s->pm_am) s->alarm_tm.tm_hour = ((from_bcd(value & 0x3f)) % 12) + ((value >> 7) & 1) * 12; else s->alarm_tm.tm_hour = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x2c: #ifdef ALMDEBUG printf("ALM DAY_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mday = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x30: #ifdef ALMDEBUG printf("ALM MON_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mon = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x34: #ifdef ALMDEBUG printf("ALM YRS_REG <-- %02x\n", value); #endif s->alarm_tm.tm_year = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x40: #ifdef ALMDEBUG printf("RTC CONTROL <-- %02x\n", value); #endif s->pm_am = (value >> 3) & 1; s->auto_comp = (value >> 2) & 1; s->round = (value >> 1) & 1; s->running = value & 1; s->status &= 0xfd; s->status |= s->running << 1; return; case 0x44: #ifdef ALMDEBUG printf("RTC STATUSL <-- %02x\n", value); #endif s->status &= ~((value & 0xc0) ^ 0x80); omap_rtc_interrupts_update(s); return; case 0x48: #ifdef ALMDEBUG printf("RTC INTRS <-- %02x\n", value); #endif s->interrupts = value; return; case 0x4c: #ifdef ALMDEBUG printf("RTC COMPLSB <-- %02x\n", value); #endif s->comp_reg &= 0xff00; s->comp_reg |= 0x00ff & value; return; case 0x50: #ifdef ALMDEBUG printf("RTC COMPMSB <-- %02x\n", value); #endif s->comp_reg &= 0x00ff; s->comp_reg |= 0xff00 & (value << 8); return; default: OMAP_BAD_REG(addr); return; } }
1threat
static void parse_mb_skip(Wmv2Context *w) { int mb_x, mb_y; MpegEncContext *const s = &w->s; uint32_t *const mb_type = s->current_picture_ptr->mb_type; w->skip_type = get_bits(&s->gb, 2); switch (w->skip_type) { case SKIP_TYPE_NONE: for (mb_y = 0; mb_y < s->mb_height; mb_y++) for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = MB_TYPE_16x16 | MB_TYPE_L0; break; case SKIP_TYPE_MPEG: for (mb_y = 0; mb_y < s->mb_height; mb_y++) for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; break; case SKIP_TYPE_ROW: for (mb_y = 0; mb_y < s->mb_height; mb_y++) { if (get_bits1(&s->gb)) { for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; } else { for (mb_x = 0; mb_x < s->mb_width; mb_x++) mb_type[mb_y * s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; } } break; case SKIP_TYPE_COL: for (mb_x = 0; mb_x < s->mb_width; mb_x++) { if (get_bits1(&s->gb)) { for (mb_y = 0; mb_y < s->mb_height; mb_y++) mb_type[mb_y * s->mb_stride + mb_x] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; } else { for (mb_y = 0; mb_y < s->mb_height; mb_y++) mb_type[mb_y * s->mb_stride + mb_x] = (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0; } } break; } }
1threat
Concept of vptr and vtable in C++ : <p>Why only default constructor only able to create vptr(Virtual Table Pointer) and vtable(Virtual Table)? Why parameter constructor not able to</p>
0debug
Firebase Storage exception and Crashlytics exception does not match? : <p>I'm using Firebase to download files on Android. Here is my code:</p> <pre><code>try { //.. Try to download file from Firebase } catch(StorageException e) { if(e.getErrorCode() == StorageException.ERROR_RETRY_LIMIT_EXCEEDED) { //Ignore! Exception has occurred due to no Internet availability } else { //Other genuine failure, log it Crashlytics.logException(e); } } </code></pre> <p>Now, this code does not send "The operation retry limit has been exceeded." exception. However, in Crashlytics I'm still able to see this exception being reported.</p> <pre><code>Non-fatal Exception: com.google.firebase.storage.StorageException The operation retry limit has been exceeded. Caused by javax.net.ssl.SSLException Read error: ssl=0x7188e1fe08: I/O error during system call, Software caused connection abort </code></pre> <p>How is this possible? Am I missing anything?</p> <p>Firebase version: 16.0.1</p>
0debug
Best way to copy file from one location to another in Linux Server by java : <p>Best way to copy file from one location to another in Linux Server by java</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size) { int ret; uint8_t *data; if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return NULL; data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!data) return NULL; ret = av_packet_add_side_data(pkt, type, data, size); if (ret < 0) { av_freep(&data); return NULL; } return data; }
1threat
void imx_timerg_create(const target_phys_addr_t addr, qemu_irq irq, DeviceState *ccm) { IMXTimerGState *pp; DeviceState *dev; dev = sysbus_create_simple("imx_timerg", addr, irq); pp = container_of(dev, IMXTimerGState, busdev.qdev); pp->ccm = ccm; }
1threat
Is it possible to use .NET Native without UWP? : <p>Can a C#/.NET application be compiled to native binaries using .NET Native without being a UWP application? For example, a 4.5 console app? I've watched over 2 hours of video on .NET Native and also read docs but they did not clearly answer this question.</p>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){ const int w2= (width+1)>>1; IDWTELEM temp[width >> 1]; const int w_l= (width>>1); const int w_r= w2 - 1; int i; { IDWTELEM * const ref = b + w2 - 1; i = 1; b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS); asm volatile( "pcmpeqw %%mm7, %%mm7 \n\t" "psllw $15, %%mm7 \n\t" "psrlw $14, %%mm7 \n\t" ::); for(; i<w_l-7; i+=8){ asm volatile( "movq (%1), %%mm2 \n\t" "movq 8(%1), %%mm6 \n\t" "paddw 2(%1), %%mm2 \n\t" "paddw 10(%1), %%mm6 \n\t" "movq %%mm2, %%mm0 \n\t" "movq %%mm6, %%mm4 \n\t" "psraw $1, %%mm2 \n\t" "psraw $1, %%mm6 \n\t" "paddw %%mm0, %%mm2 \n\t" "paddw %%mm4, %%mm6 \n\t" "paddw %%mm7, %%mm2 \n\t" "paddw %%mm7, %%mm6 \n\t" "psraw $2, %%mm2 \n\t" "psraw $2, %%mm6 \n\t" "movq (%0), %%mm0 \n\t" "movq 8(%0), %%mm4 \n\t" "psubw %%mm2, %%mm0 \n\t" "psubw %%mm6, %%mm4 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm4, 8(%0) \n\t" :: "r"(&b[i]), "r"(&ref[i]) : "memory" ); } snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS); } { IDWTELEM * const dst = b+w2; i = 0; for(; i<w_r-7; i+=8){ asm volatile( "movq (%1), %%mm2 \n\t" "movq 8(%1), %%mm6 \n\t" "paddw 2(%1), %%mm2 \n\t" "paddw 10(%1), %%mm6 \n\t" "movq (%0), %%mm0 \n\t" "movq 8(%0), %%mm4 \n\t" "psubw %%mm2, %%mm0 \n\t" "psubw %%mm6, %%mm4 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm4, 8(%0) \n\t" :: "r"(&dst[i]), "r"(&b[i]) : "memory" ); } snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS); } { IDWTELEM * const ref = b+w2 - 1; i = 1; b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS); asm volatile( "psllw $2, %%mm7 \n\t" ::); for(; i<w_l-7; i+=8){ asm volatile( "movq (%1), %%mm0 \n\t" "movq 8(%1), %%mm4 \n\t" "paddw 2(%1), %%mm0 \n\t" "paddw 10(%1), %%mm4 \n\t" "paddw %%mm7, %%mm0 \n\t" "paddw %%mm7, %%mm4 \n\t" "psraw $2, %%mm0 \n\t" "psraw $2, %%mm4 \n\t" "movq (%0), %%mm1 \n\t" "movq 8(%0), %%mm5 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm5, %%mm4 \n\t" "psraw $2, %%mm0 \n\t" "psraw $2, %%mm4 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm5, %%mm4 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm4, 8(%0) \n\t" :: "r"(&b[i]), "r"(&ref[i]) : "memory" ); } snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l); } { IDWTELEM * const src = b+w2; i = 0; for(; i<w_r-7; i+=8){ asm volatile( "movq 2(%1), %%mm2 \n\t" "movq 10(%1), %%mm6 \n\t" "paddw (%1), %%mm2 \n\t" "paddw 8(%1), %%mm6 \n\t" "movq (%0), %%mm0 \n\t" "movq 8(%0), %%mm4 \n\t" "paddw %%mm2, %%mm0 \n\t" "paddw %%mm6, %%mm4 \n\t" "psraw $1, %%mm2 \n\t" "psraw $1, %%mm6 \n\t" "paddw %%mm0, %%mm2 \n\t" "paddw %%mm4, %%mm6 \n\t" "movq %%mm2, (%2) \n\t" "movq %%mm6, 8(%2) \n\t" :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i]) : "memory" ); } snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS); } { snow_interleave_line_header(&i, width, b, temp); for (; (i & 0x1E) != 0x1E; i-=2){ b[i+1] = temp[i>>1]; b[i] = b[i>>1]; } for (i-=30; i>=0; i-=32){ asm volatile( "movq (%1), %%mm0 \n\t" "movq 8(%1), %%mm2 \n\t" "movq 16(%1), %%mm4 \n\t" "movq 24(%1), %%mm6 \n\t" "movq (%1), %%mm1 \n\t" "movq 8(%1), %%mm3 \n\t" "movq 16(%1), %%mm5 \n\t" "movq 24(%1), %%mm7 \n\t" "punpcklwd (%2), %%mm0 \n\t" "punpcklwd 8(%2), %%mm2 \n\t" "punpcklwd 16(%2), %%mm4 \n\t" "punpcklwd 24(%2), %%mm6 \n\t" "movq %%mm0, (%0) \n\t" "movq %%mm2, 16(%0) \n\t" "movq %%mm4, 32(%0) \n\t" "movq %%mm6, 48(%0) \n\t" "punpckhwd (%2), %%mm1 \n\t" "punpckhwd 8(%2), %%mm3 \n\t" "punpckhwd 16(%2), %%mm5 \n\t" "punpckhwd 24(%2), %%mm7 \n\t" "movq %%mm1, 8(%0) \n\t" "movq %%mm3, 24(%0) \n\t" "movq %%mm5, 40(%0) \n\t" "movq %%mm7, 56(%0) \n\t" :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1]) : "memory" ); } } }
1threat
static av_cold int encode_init(AVCodecContext* avc_context) { theora_info t_info; theora_comment t_comment; ogg_packet o_packet; unsigned int offset; TheoraContext *h = avc_context->priv_data; theora_info_init( &t_info ); t_info.width = FFALIGN(avc_context->width, 16); t_info.height = FFALIGN(avc_context->height, 16); t_info.frame_width = avc_context->width; t_info.frame_height = avc_context->height; t_info.offset_x = 0; t_info.offset_y = avc_context->height & 0xf; t_info.fps_numerator = avc_context->time_base.den; t_info.fps_denominator = avc_context->time_base.num; if (avc_context->sample_aspect_ratio.num != 0) { t_info.aspect_numerator = avc_context->sample_aspect_ratio.num; t_info.aspect_denominator = avc_context->sample_aspect_ratio.den; } else { t_info.aspect_numerator = 1; t_info.aspect_denominator = 1; } t_info.colorspace = OC_CS_UNSPECIFIED; t_info.pixelformat = OC_PF_420; t_info.target_bitrate = avc_context->bit_rate; t_info.keyframe_frequency = avc_context->gop_size; t_info.keyframe_frequency_force = avc_context->gop_size; t_info.keyframe_mindistance = avc_context->keyint_min; t_info.quality = 0; t_info.quick_p = 1; t_info.dropframes_p = 0; t_info.keyframe_auto_p = 1; t_info.keyframe_data_target_bitrate = t_info.target_bitrate * 1.5; t_info.keyframe_auto_threshold = 80; t_info.noise_sensitivity = 1; t_info.sharpness = 0; if (theora_encode_init( &(h->t_state), &t_info ) != 0) { av_log(avc_context, AV_LOG_ERROR, "theora_encode_init failed\n"); return -1; } theora_info_clear( &t_info ); offset = 0; theora_encode_header( &(h->t_state), &o_packet ); if (concatenate_packet( &offset, avc_context, &o_packet ) != 0) { return -1; } theora_comment_init( &t_comment ); theora_encode_comment( &t_comment, &o_packet ); if (concatenate_packet( &offset, avc_context, &o_packet ) != 0) { return -1; } theora_encode_tables( &(h->t_state), &o_packet ); if (concatenate_packet( &offset, avc_context, &o_packet ) != 0) { return -1; } theora_comment_clear( &t_comment ); avc_context->coded_frame= avcodec_alloc_frame(); return 0; }
1threat
Turn output of command into valid json? : <p>How can I use bash commands to convert the output of 'kubectl cluster-info dump' into valid json?</p> <p>As is, right now, it comes out like this (extremely abbreviated):</p> <pre><code>{ "selfLink": "/api/v1/nodes", "resourceVersion": "24393", "Items": [tons of json] } { "selfLink": "/api/v1/namespaces/default/events", "resourceVersion": "24393", "Items": [tons of json] } ... { "selfLink": "/api/v1/namespaces/default/pods", "resourceVersion": "24393", "Items": [tons of json] } </code></pre> <p>I would like to pipe the output of this command through sed or awk to translate this output into valid json, something like:</p> <pre><code>[{"k","v","k2","v2"}, {"k","v","k2","v2"}, ... {"k","v","k2","v2"}] </code></pre> <p>which I can then easily parse with json parsers like jq</p>
0debug
need to move a variable folder based on date -VBScript : this is what i have. stSourceFolder = "C:\Users\HIRENS\Admin\" & Replace(CStr(Date()),"/",".") stTargetFolder = "C:\Users\HIRENS\Admin\HIRENS\Admin\backup\"& Replace(CStr(),"DDMMYY") Set objFSO = CreateObject("Scripting.FileSystemObject") Set fso = CreateObject("Scripting.FileSystemObject") ' The script will error out if it tries to create a directory that already exist ' so it is better to check for it first and only attempt to create it if it does ' not exist. if not fso.FolderExists(strDirectory) then ' If it gets here then the folder for the current date does not yet exist and ' therefore is created. Set objFolder = fso.CreateFolder(stTargetFolder) end if ' This copies the files and overwrites them if they exist. fso.CopyFolder stSourceFolder, destinationDir, OverwriteExisting ' If you entend to automate this script you should remove or rem out this next line. wscript.echo "Done" 'If the target-folder does not exist then it will be created. objFSO.CopyFolder stSourceFolder, stTargetFolder MsgBox "Folder copied" Set fsoObj = Nothing
0debug
static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { GetByteContext gb; const uint8_t *bs_hdr; uint32_t frame_num, word2, check_sum, data_size; uint32_t y_offset, u_offset, v_offset, starts[3], ends[3]; uint16_t height, width; int i, j; bytestream2_init(&gb, buf, buf_size); frame_num = bytestream2_get_le32(&gb); word2 = bytestream2_get_le32(&gb); check_sum = bytestream2_get_le32(&gb); data_size = bytestream2_get_le32(&gb); if ((frame_num ^ word2 ^ data_size ^ OS_HDR_ID) != check_sum) { av_log(avctx, AV_LOG_ERROR, "OS header checksum mismatch!\n"); return AVERROR_INVALIDDATA; } bs_hdr = gb.buffer; if (bytestream2_get_le16(&gb) != 32) { av_log(avctx, AV_LOG_ERROR, "Unsupported codec version!\n"); return AVERROR_INVALIDDATA; } ctx->frame_num = frame_num; ctx->frame_flags = bytestream2_get_le16(&gb); ctx->data_size = (bytestream2_get_le32(&gb) + 7) >> 3; ctx->cb_offset = bytestream2_get_byte(&gb); if (ctx->data_size == 16) return 4; if (ctx->data_size > buf_size) ctx->data_size = buf_size; bytestream2_skip(&gb, 3); height = bytestream2_get_le16(&gb); width = bytestream2_get_le16(&gb); if (av_image_check_size(width, height, 0, avctx)) return AVERROR_INVALIDDATA; if (width != ctx->width || height != ctx->height) { int res; av_dlog(avctx, "Frame dimensions changed!\n"); if (width < 16 || width > 640 || height < 16 || height > 480 || width & 3 || height & 3) { av_log(avctx, AV_LOG_ERROR, "Invalid picture dimensions: %d x %d!\n", width, height); return AVERROR_INVALIDDATA; } ctx->width = width; ctx->height = height; free_frame_buffers(ctx); if ((res = allocate_frame_buffers(ctx, avctx)) < 0) return res; avcodec_set_dimensions(avctx, width, height); } y_offset = bytestream2_get_le32(&gb); v_offset = bytestream2_get_le32(&gb); u_offset = bytestream2_get_le32(&gb); bytestream2_skip(&gb, 4); starts[0] = y_offset; starts[1] = v_offset; starts[2] = u_offset; for (j = 0; j < 3; j++) { ends[j] = ctx->data_size; for (i = 2; i >= 0; i--) if (starts[i] < ends[j] && starts[i] > starts[j]) ends[j] = starts[i]; } ctx->y_data_size = ends[0] - starts[0]; ctx->v_data_size = ends[1] - starts[1]; ctx->u_data_size = ends[2] - starts[2]; if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 || FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 || FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) { av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n"); return AVERROR_INVALIDDATA; } ctx->y_data_ptr = bs_hdr + y_offset; ctx->v_data_ptr = bs_hdr + v_offset; ctx->u_data_ptr = bs_hdr + u_offset; ctx->alt_quant = gb.buffer; if (ctx->data_size == 16) { av_log(avctx, AV_LOG_DEBUG, "Sync frame encountered!\n"); return 16; } if (ctx->frame_flags & BS_8BIT_PEL) { avpriv_request_sample(avctx, "8-bit pixel format"); return AVERROR_PATCHWELCOME; } if (ctx->frame_flags & BS_MV_X_HALF || ctx->frame_flags & BS_MV_Y_HALF) { avpriv_request_sample(avctx, "Halfpel motion vectors"); return AVERROR_PATCHWELCOME; } return 0; }
1threat
Python regular expression matching liquid code : I'm building a website using Jekyll and for reasons too tedious to specify here I would like to automatically remove liquid code (and **only** liquid code) from a given .html file. I'm doing it in python using regular expressions, and so far I have this one: \{.*?\}|\{\{.*?\}\} As I am not too familiar with liquid (and .html), could someone confirm that this will suffice for my goal?
0debug
ValueError: 0 is not in list - Index of max number in list : I need to find the index of the biggest number in the list (bitonic list) i wrote func that find the number (and correct i think) and then try to find the index using index method but i get Error when i try to debug it, i can see why it's going wrong, but i dont know how to fix it Thanks! def find_maximum(n): b = find_max_number(n) return n.index(b) def find_max_number(n): middle = len(n)//2 if len(n) == 1 : return (n[0]) if len(n)>2: if n[middle] > n[middle-1] and n[middle] > n[middle+1] : return (n[middle]) if (n[middle-1] < n[middle]): return find_maximum(n[middle:]) else : return find_maximum(n[:middle])
0debug
Configured ObjectMapper not used in spring-boot-webflux : <p>I have mixins configured in my objectmapperbuilder config, using the regular spring web controller, the data outputted according to the mixins. However using webflux, a controller with a method returning a Flow or Mono have the data serialized like if the objectmapper a default one.</p> <p>How to get webflux to enforce an objectmapper configuration to be used ?</p> <p>sample config:</p> <pre><code>@Bean JavaTimeModule javatimeModule(){ return new JavaTimeModule(); } @Bean Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(){ return jacksonObjectMapperBuilder -&gt; jacksonObjectMapperBuilder.featuresToEnable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .mixIn(MyClass.class, MyClassMixin.class); } </code></pre>
0debug