problem
stringlengths
26
131k
labels
class label
2 classes
static int omap_validate_tipb_mpui_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return range_covers_byte(0xe1010000, 0xe1020004 - 0xe1010000, addr); }
1threat
static int dump_cleanup(DumpState *s) { int ret = 0; guest_phys_blocks_free(&s->guest_phys_blocks); memory_mapping_list_free(&s->list); if (s->fd != -1) { close(s->fd); } if (s->resume) { vm_start(); } return ret; }
1threat
static inline void range_dec_normalize(APEContext * ctx) { while (ctx->rc.range <= BOTTOM_VALUE) { ctx->rc.buffer = (ctx->rc.buffer << 8) | bytestream_get_byte(&ctx->ptr); ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF); ctx->rc.range <<= 8; } }
1threat
What does this line means in JAVA : if (number < 0) number = (number* -1); What does this line means, especially " number* ", I've never seen before statement like this in java, I'm new.
0debug
static void close_unused_images(BlockDriverState *top, BlockDriverState *base, const char *base_id) { BlockDriverState *intermediate; intermediate = top->backing_hd; while (intermediate) { BlockDriverState *unused; if (intermediate == base) { break; } unused = intermediate; intermediate = intermediate->backing_hd; unused->backing_hd = NULL; bdrv_delete(unused); } top->backing_hd = base; }
1threat
static int opt_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(99); debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); return 0; }
1threat
Display viewmodal data from controler t view in asp.net core : Salam to All. i want to Display query result to Razor View. i got desired output by controller but need help to show on view. Class **Fuel** public class Fuel { public int FuelId { get; set; } public int FMonth{ get; set; } public int Year { get; set; } } Class **Location** public class Location { public int LocationId { get; set; } public string Name { get; set; } public string Address { get; set; } } Now i join both table using **ViewModel** **FuelLocation** public class FuelLocation { public Fuel Fuels { get; set; } public Location Locations { get; set; } } here is **ActionResult** Controller. public ActionResult EmpDetails() { var res = (from loc in _context.Locations join Fl in _context.Fuels on loc.Name equals Fl.Locationn select new FuelLocation { Fuels = Fl, Locations = loc }).GroupBy(c => c.Fuels.Locationn) .Select(g => new { Location = g.Key, Jan = g.Where(c => c.Fuels.FMonth == 1).Sum(c => c.Fuels.Sale), Feb = g.Where(c => c.Fuels.FMonth == 2).Sum(c => c.Fuels.Sale), March = g.Where(c => c.Fuels.FMonth == 3).Sum(c => c.Fuels.Sale) }).ToList(); } the result of this query is [Output][1] [1]: https://i.stack.imgur.com/tkJcL.png and i want to show like this Name | Jan | Feb | Mar | Total 1 | 100 | 350 | 250 | 700 2 | 200 | 220 | 2150 | 2170 **My Razor View** @model IList<COSAuthNew.Services.Generic.FuelLocation> <h2>Index</h2> <table class="table"> <tr> <th>LocationName</th> <th>Jan</th> <th>Feb</th> <th>March</th> <th>Total</th> </tr> @foreach (var item in Model) { //Plz enter your solution } but i did not get a proper result which i want. ... tahnks
0debug
static int rtp_write(URLContext *h, const uint8_t *buf, int size) { RTPContext *s = h->priv_data; int ret; URLContext *hd; if (RTP_PT_IS_RTCP(buf[1])) { hd = s->rtcp_hd; } else { hd = s->rtp_hd; } ret = ffurl_write(hd, buf, size); return ret; }
1threat
NEED: An intersect for 2 Arraylists : I've got 2 arraylists and i want to find common elements from those 2. Example: Arraylist 1 contains: "Cat", "Dog", "Phone", "Watch", "Monkey". Arraylist 2 contains: "Dog", "Phone", "Chair". As a result i want to have a method which returns : "Dog" and "Phone". I've used an Array before and the intersect worked with the array, but im using an arraylist now. Can anyone help me? Kind regards, Niels
0debug
void do_srad (void) { int64_t ret; if (likely(!(T1 & 0x40UL))) { if (likely((uint64_t)T1 != 0)) { ret = (int64_t)T0 >> (T1 & 0x3FUL); if (likely(ret >= 0 || ((int64_t)T0 & ((1 << T1) - 1)) == 0)) { xer_ca = 0; } else { xer_ca = 1; } } else { ret = T0; xer_ca = 0; } } else { ret = (-1) * ((uint64_t)T0 >> 63); if (likely(ret >= 0 || ((uint64_t)T0 & ~0x8000000000000000ULL) == 0)) { xer_ca = 0; } else { xer_ca = 1; } } T0 = ret; }
1threat
How to rename a rails 5 application? : <p>Is the <code>rename</code> gem the best way to rename my rails 5 app?</p> <p>Also, is there any notes I have to keep in mind when renaming my app?</p>
0debug
can anyone solve it for me : <hr> <p>IndexError Traceback (most recent call last) in ----> 1 print('the {2} {1} {3}'.format('brown', 'fat', 'fox',))</p> <p>IndexError: tuple index out of range<strong>strong text</strong></p>
0debug
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) { AVFrame *src = srcp->f; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format); int i; int ret = av_frame_ref(dst, src); if (ret < 0) return ret; av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(h), 0); if (srcp->sei_recovery_frame_cnt == 0) dst->key_frame = 1; if (!srcp->crop) return 0; for (i = 0; i < desc->nb_components; i++) { int hshift = (i > 0) ? desc->log2_chroma_w : 0; int vshift = (i > 0) ? desc->log2_chroma_h : 0; int off = ((srcp->crop_left >> hshift) << h->pixel_shift) + (srcp->crop_top >> vshift) * dst->linesize[i]; dst->data[i] += off; } return 0; }
1threat
maven-site plugins 3.3 java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent : <p>Since this night, maven site 3.3 plugins stop to work.</p> <p>Try to delete local repository, but no change. Maven 3.3.9 java 1.8</p> <p>No config or dependencies defined in pom for site plugins</p> <pre><code>[WARNING] Error injecting: org.apache.maven.report.projectinfo.CiManagementReport java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent </code></pre>
0debug
static int scsi_handle_rw_error(SCSIDiskReq *r, int error) { bool is_read = (r->req.cmd.xfer == SCSI_XFER_FROM_DEV); SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); BlockErrorAction action = bdrv_get_error_action(s->qdev.conf.bs, is_read, error); if (action == BLOCK_ERROR_ACTION_REPORT) { switch (error) { case ENOMEDIUM: scsi_check_condition(r, SENSE_CODE(NO_MEDIUM)); break; case ENOMEM: scsi_check_condition(r, SENSE_CODE(TARGET_FAILURE)); break; case EINVAL: scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); break; case ENOSPC: scsi_check_condition(r, SENSE_CODE(SPACE_ALLOC_FAILED)); break; default: scsi_check_condition(r, SENSE_CODE(IO_ERROR)); break; } } bdrv_error_action(s->qdev.conf.bs, action, is_read, error); if (action == BLOCK_ERROR_ACTION_STOP) { scsi_req_retry(&r->req); } return action != BLOCK_ERROR_ACTION_IGNORE; }
1threat
Codename one - lib install in NetBeans : <p>I have downloaded the library for including Toasts in CN1, but I am not sure how to install/add it to NetBeans.</p> <p>Could you guide me?</p>
0debug
Angular scope doesn't update even with apply() : <p>I have a problem with Angular's scope:</p> <p>Init Angular:</p> <pre><code>&lt;html lang="en" ng-app="ant101App" ng-controller="regFormController as reg"&gt; </code></pre> <p>Script:</p> <pre><code>script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"&gt;&lt;/script&gt; &lt;script&gt; var app = angular.module('ant101App',[]); app.controller('regFormController', function() { this.message = null; if ((''+this.fname).length &gt; 15) { this.message = 'First name should be less than 16 characters!'; } }); &lt;/script&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;p&gt;{{reg.message}}&lt;/p&gt; &lt;input ng-model="reg.fname" type="text" name="firstname" class="afirst-name-box" placeholder="First name" required&gt; </code></pre> <p>When I enter first name, reg.message doesnt update. When I use aplly(), it even caused error, and just displayed {{reg.message}} in html page</p> <pre><code>&lt;script&gt; var app = angular.module('ant101App',[]); app.controller('regFormController', function() { this.message = null; this.$apply(function(){ if ((''+this.fname).length &gt; 15) { this.message = 'First name should be less than 16 characters!'; } }); }); &lt;/script&gt; </code></pre> <p>So how can I update reg.message when reg.fname changed?</p>
0debug
static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) { int x = 0, y = 0; while (bytestream2_get_bytes_left(&s->gb) > 0) { int run_length, color; if (y >= s->avctx->height) return 0; color = bytestream2_get_byte(&s->gb); if (color & 0x80) { run_length = 1; }else{ run_length = (color & 0x7f) + 2; color = bytestream2_get_byte(&s->gb); } if (half_horiz) run_length *=2; if (run_length > s->avctx->width - x) return AVERROR_INVALIDDATA; if (color) { memset(s->frame->data[0] + y*s->frame->linesize[0] + x, color, run_length); if (half_vert) memset(s->frame->data[0] + (y+1)*s->frame->linesize[0] + x, color, run_length); } x+= run_length; if (x >= s->avctx->width) { x=0; y += 1 + half_vert; } } return 0; }
1threat
static int dv_extract_audio(uint8_t *frame, uint8_t *ppcm[4], const DVprofile *sys) { int size, chan, i, j, d, of, smpls, freq, quant, half_ch; uint16_t lc, rc; const uint8_t *as_pack; uint8_t *pcm, ipcm; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack) return 0; smpls = as_pack[1] & 0x3f; freq = as_pack[4] >> 3 & 0x07; quant = as_pack[4] & 0x07; if (quant > 1) return -1; if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) return AVERROR_INVALIDDATA; size = (sys->audio_min_samples[freq] + smpls) * 4; half_ch = sys->difseg_size / 2; ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0; for (chan = 0; chan < sys->n_difchan; chan++) { pcm = ppcm[ipcm++]; if (!pcm) break; for (i = 0; i < sys->difseg_size; i++) { frame += 6 * 80; if (quant == 1 && i == half_ch) { pcm = ppcm[ipcm++]; if (!pcm) break; } for (j = 0; j < 9; j++) { for (d = 8; d < 80; d += 2) { if (quant == 0) { of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride; if (of * 2 >= size) continue; pcm[of * 2] = frame[d + 1]; pcm[of * 2 + 1] = frame[d]; if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00) pcm[of * 2 + 1] = 0; } else { lc = ((uint16_t)frame[d] << 4) | ((uint16_t)frame[d + 2] >> 4); rc = ((uint16_t)frame[d + 1] << 4) | ((uint16_t)frame[d + 2] & 0x0f); lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); of = sys->audio_shuffle[i % half_ch][j] + (d - 8) / 3 * sys->audio_stride; if (of * 2 >= size) continue; pcm[of * 2] = lc & 0xff; pcm[of * 2 + 1] = lc >> 8; of = sys->audio_shuffle[i % half_ch + half_ch][j] + (d - 8) / 3 * sys->audio_stride; pcm[of * 2] = rc & 0xff; pcm[of * 2 + 1] = rc >> 8; ++d; } } frame += 16 * 80; } } } return size; }
1threat
How to get local time from web server? : I set up an ajax server with this settings ``` let express = require('express'); let server = express(); server.use('/MyWebApp', express.static(__dirname + '/public')); server.get('/MyWebApp/dateService', function(request, response){ response.send({'dateTime' : new Date()}); }); server.listen(2019); console.log('server running on port 2019 ...') ```` I want to get the local time and have this function in my html ``` function getDateTime(){ $.get({ url: "http://localhost:2019/MyWebApp/dateService", dataType: "json", success: function(result){ document.getElementById("timer").innerHTML = result; } }); } ``` But when I click the button, it doesn't work and I don't know why? ``` <div id="timer">Random Text</div> <input type="button" value="Server-Request" onclick="getDateTime()"/> ```
0debug
static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { static const uint8_t sizes[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4}; static const uint8_t bit_sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; RA144Context *ractx = avctx->priv_data; PutBitContext pb; int32_t lpc_data[NBLOCKS * BLOCKSIZE]; int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER]; int shift[LPC_ORDER]; int16_t block_coefs[NBLOCKS][LPC_ORDER]; int lpc_refl[LPC_ORDER]; unsigned int refl_rms[NBLOCKS]; const int16_t *samples = frame ? (const int16_t *)frame->data[0] : NULL; int energy = 0; int i, idx, ret; if (ractx->last_frame) return 0; if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) return ret; for (i = 0; i < (2 * BLOCKSIZE + BLOCKSIZE / 2); i++) { lpc_data[i] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + i]; energy += (lpc_data[i] * lpc_data[i]) >> 4; } if (frame) { int j; for (j = 0; j < frame->nb_samples && i < NBLOCKS * BLOCKSIZE; i++, j++) { lpc_data[i] = samples[j] >> 2; energy += (lpc_data[i] * lpc_data[i]) >> 4; } } if (i < NBLOCKS * BLOCKSIZE) memset(&lpc_data[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*lpc_data)); energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab, 32)]; ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, 0, ORDER_METHOD_EST, 12, 0); for (i = 0; i < LPC_ORDER; i++) block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << (12 - shift[LPC_ORDER - 1])); if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[1]); if (ff_eval_refl(lpc_refl, block_coefs[NBLOCKS - 1], avctx)) { memset(lpc_refl, 0, sizeof(lpc_refl)); } } init_put_bits(&pb, avpkt->data, avpkt->size); for (i = 0; i < LPC_ORDER; i++) { idx = quantize(lpc_refl[i], ff_lpc_refl_cb[i], sizes[i]); put_bits(&pb, bit_sizes[i], idx); lpc_refl[i] = ff_lpc_refl_cb[i][idx]; } ractx->lpc_refl_rms[0] = ff_rms(lpc_refl); ff_eval_coefs(ractx->lpc_coef[0], lpc_refl); refl_rms[0] = ff_interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = ff_interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, ff_t_sqrt(energy * ractx->old_energy) >> 12); refl_rms[2] = ff_interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = ff_rescale_rms(ractx->lpc_refl_rms[0], energy); ff_int_to_int16(block_coefs[NBLOCKS - 1], ractx->lpc_coef[0]); put_bits(&pb, 5, quantize(energy, ff_energy_tab, 32)); for (i = 0; i < NBLOCKS; i++) ra144_encode_subblock(ractx, ractx->curr_block + i * BLOCKSIZE, block_coefs[i], refl_rms[i], &pb); flush_put_bits(&pb); ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); i = 0; if (frame) { for (; i < frame->nb_samples; i++) ractx->curr_block[i] = samples[i] >> 2; if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0) return ret; } else ractx->last_frame = 1; memset(&ractx->curr_block[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*ractx->curr_block)); ff_af_queue_remove(&ractx->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); avpkt->size = FRAMESIZE; *got_packet_ptr = 1; return 0; }
1threat
IndexOutOffRangeException Was Unhandled warning : i have implemented some codes in order to make changes to my csv file. however every time i was the program i the the "IndexOutOfRangeException error. Any Help would be appreciated as i do not know the solution to this class Program { static void Main(string[] args) { var filePath = Path.Combine(Directory.GetCurrentDirectory(), "kaviaReport 02_08_2016.csv"); var fileContents = ReadFile(filePath); foreach (var line in fileContents) { Console.WriteLine(line); } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } public static IList<string> ReadFile(string fileName) { var results = new List<string>(); int lineCounter = 0; string currentLine = string.Empty; var target = File .ReadAllLines(fileName); //.Skip(1) // Skip the line with column names while ((currentLine = fileName) != null)//while there are lines to read { if (lineCounter != 0) { //If it's not the first line var lineElements = currentLine.Split(',');//split your fields into an array lineElements[4] = lineElements[4].Replace(' ', ',');//replace the space in position 4(field 5) of your array //target.WriteAllLines(string.Join(",", fielded));//write the line in the new file File.WriteAllLines(fileName, target); } lineCounter++; } return results; } } }
0debug
static bool is_zero_cluster_top_locked(BlockDriverState *bs, int64_t start) { BDRVQcow2State *s = bs->opaque; int nr = s->cluster_sectors; uint64_t off; int ret; ret = qcow2_get_cluster_offset(bs, start << BDRV_SECTOR_BITS, &nr, &off); assert(nr == s->cluster_sectors); return ret == QCOW2_CLUSTER_UNALLOCATED || ret == QCOW2_CLUSTER_ZERO; }
1threat
int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) { CPUState *cpu = ENV_GET_CPU(env); TaskState *ts = cpu->opaque; struct emulated_sigtable *k; struct sigqueue *q, **pq; abi_ulong handler; int queue; trace_user_queue_signal(env, sig); k = &ts->sigtab[sig - 1]; queue = gdb_queuesig (); handler = sigact_table[sig - 1]._sa_handler; if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { handler = TARGET_SIG_DFL; } if (!queue && handler == TARGET_SIG_DFL) { if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); return 0; } else if (sig != TARGET_SIGCHLD && sig != TARGET_SIGURG && sig != TARGET_SIGWINCH && sig != TARGET_SIGCONT) { force_sig(sig); } else { return 0; } } else if (!queue && handler == TARGET_SIG_IGN) { return 0; } else if (!queue && handler == TARGET_SIG_ERR) { force_sig(sig); } else { pq = &k->first; if (sig < TARGET_SIGRTMIN) { if (!k->pending) q = &k->info; else return 0; } else { if (!k->pending) { q = &k->info; } else { q = alloc_sigqueue(env); if (!q) return -EAGAIN; while (*pq != NULL) pq = &(*pq)->next; } } *pq = q; q->info = *info; q->next = NULL; k->pending = 1; atomic_set(&ts->signal_pending, 1); return 1; } }
1threat
static void vhdx_parse_header(BlockDriverState *bs, BDRVVHDXState *s, Error **errp) { int ret; VHDXHeader *header1; VHDXHeader *header2; bool h1_valid = false; bool h2_valid = false; uint64_t h1_seq = 0; uint64_t h2_seq = 0; uint8_t *buffer; header1 = qemu_blockalign(bs, sizeof(VHDXHeader)); header2 = qemu_blockalign(bs, sizeof(VHDXHeader)); buffer = qemu_blockalign(bs, VHDX_HEADER_SIZE); s->headers[0] = header1; s->headers[1] = header2; ret = bdrv_pread(bs->file, VHDX_HEADER1_OFFSET, buffer, VHDX_HEADER_SIZE); if (ret < 0) { goto fail; } memcpy(header1, buffer, sizeof(VHDXHeader)); vhdx_header_le_import(header1); if (vhdx_checksum_is_valid(buffer, VHDX_HEADER_SIZE, 4) && !memcmp(&header1->signature, "head", 4) && header1->version == 1) { h1_seq = header1->sequence_number; h1_valid = true; } ret = bdrv_pread(bs->file, VHDX_HEADER2_OFFSET, buffer, VHDX_HEADER_SIZE); if (ret < 0) { goto fail; } memcpy(header2, buffer, sizeof(VHDXHeader)); vhdx_header_le_import(header2); if (vhdx_checksum_is_valid(buffer, VHDX_HEADER_SIZE, 4) && !memcmp(&header2->signature, "head", 4) && header2->version == 1) { h2_seq = header2->sequence_number; h2_valid = true; } if (h1_valid && !h2_valid) { s->curr_header = 0; } else if (!h1_valid && h2_valid) { s->curr_header = 1; } else if (!h1_valid && !h2_valid) { goto fail; } else { if (h1_seq > h2_seq) { s->curr_header = 0; } else if (h2_seq > h1_seq) { s->curr_header = 1; } else { goto fail; } } vhdx_region_register(s, s->headers[s->curr_header]->log_offset, s->headers[s->curr_header]->log_length); goto exit; fail: error_setg_errno(errp, -ret, "No valid VHDX header found"); qemu_vfree(header1); qemu_vfree(header2); s->headers[0] = NULL; s->headers[1] = NULL; exit: qemu_vfree(buffer); }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
ram_addr_t migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb, ram_addr_t start, ram_addr_t *ram_addr_abs) { unsigned long base = rb->offset >> TARGET_PAGE_BITS; unsigned long nr = base + (start >> TARGET_PAGE_BITS); uint64_t rb_size = rb->used_length; unsigned long size = base + (rb_size >> TARGET_PAGE_BITS); unsigned long *bitmap; unsigned long next; bitmap = atomic_rcu_read(&rs->ram_bitmap)->bmap; if (rs->ram_bulk_stage && nr > base) { next = nr + 1; } else { next = find_next_bit(bitmap, size, nr); } *ram_addr_abs = next << TARGET_PAGE_BITS; return (next - base) << TARGET_PAGE_BITS; }
1threat
int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw, int mmu_idx, int is_softmmu) { #if !defined(CONFIG_USER_ONLY) target_phys_addr_t physical; int prot; #endif int access_type; int ret = 0; #if 0 log_cpu_state(env, 0); #endif qemu_log("%s pc " TARGET_FMT_lx " ad " TARGET_FMT_lx " rw %d mmu_idx %d smmu %d\n", __func__, env->active_tc.PC, address, rw, mmu_idx, is_softmmu); rw &= 1; access_type = ACCESS_INT; #if defined(CONFIG_USER_ONLY) ret = TLBRET_NOMATCH; #else ret = get_physical_address(env, &physical, &prot, address, rw, access_type); qemu_log("%s address=" TARGET_FMT_lx " ret %d physical " TARGET_FMT_plx " prot %d\n", __func__, address, ret, physical, prot); if (ret == TLBRET_MATCH) { ret = tlb_set_page(env, address & TARGET_PAGE_MASK, physical & TARGET_PAGE_MASK, prot, mmu_idx, is_softmmu); } else if (ret < 0) #endif { raise_mmu_exception(env, address, rw, ret); ret = 1; } return ret; }
1threat
how to insert into table asp.net c# : I am trygin to insert values from registration page into a table login_tbl SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString); conn.Open(); string insertQ = "INSERT INTO login_tbl (empid,first_name,last_name,team_name,pwd,email_id,extension) VALUES('" + empbox.Text + "','" + fnamebox.Text + "','" + lnamebox.Text + "','" + teamnamebox.SelectedItem.Text + "','" + passwordbox.Text + "','" + emailbox.Text + "','" + extensionbox.Text + "')"; SqlCommand com = new SqlCommand(insertQ, conn); com.ExecuteNonQuery(); Response.Write("registration done"); I am getting error at "com.executenonquery();" line..it is going into exception
0debug
static int arm_gic_init(SysBusDevice *dev) { int i; GICState *s = FROM_SYSBUS(GICState, dev); ARMGICClass *agc = ARM_GIC_GET_CLASS(s); agc->parent_init(dev); gic_init_irqs_and_distributor(s, s->num_irq); memory_region_init_io(&s->cpuiomem[0], &gic_thiscpu_ops, s, "gic_cpu", 0x100); for (i = 0; i < NUM_CPU(s); i++) { s->backref[i] = s; memory_region_init_io(&s->cpuiomem[i+1], &gic_cpu_ops, &s->backref[i], "gic_cpu", 0x100); } sysbus_init_mmio(dev, &s->iomem); for (i = 0; i <= NUM_CPU(s); i++) { sysbus_init_mmio(dev, &s->cpuiomem[i]); } return 0; }
1threat
Spring MVC (async) vs Spring WebFlux : <p>I'm trying to understand Spring WebFlux. The things I've found so far are reactive at the core, no Servlet API, no thread per request, HTTP 2, server pushes, application/stream+json. </p> <p>But what is the difference between asynchronous calls in Spring MVC? I mean in Spring MVC when you return Future, DefferedResult and etc you get logic in the request handler (controller method) executed in a separate thread, so you can benefit from saving thread pool resources for dispatching requests as well. </p> <p>So could you please highlight differences related to that? Why WebFlux is better here? </p> <p>Thank you for your time very much!</p>
0debug
Java android parse response from server to object or get a Value : <p>Parse response from server to Object, I post to server a JSON and this is a answer :</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;login_result&gt;&lt;sctoken&gt;a1fc912a-5c7a352b-8edf-4a54-a396-c6c5aea58c8b&lt;/sctoken&gt;&lt;user_descr&gt;Jan Nowak&lt;/user_descr&gt;&lt;maps&gt;&lt;tms&gt;&lt;name&gt;** MapCenterCache&lt;/name&gt;&lt;url&gt;http://cache2.smok.net.pl/cache_2015/element?s=%zoom%&amp;amp;x=%x%&amp;amp;y=%y%&lt;/url&gt;&lt;/tms&gt;&lt;tms&gt;&lt;name&gt;OSM Mapnik&lt;/name&gt;&lt;url&gt;http://tile.openstreetmap.org/%zoom%/%x%/%y%.png&lt;/url&gt;&lt;/tms&gt;&lt;tms&gt;&lt;name&gt;OSM****1&lt;/name&gt;&lt;url&gt;http://51.254.61.18:8104/tile/tilecache.cgi/1.0.0/osm_server_elte/%zoom%/%x%/%y%.png&lt;/url&gt;&lt;/tms&gt;&lt;tms&gt;&lt;name&gt;*****&lt;/name&gt;&lt;url&gt;http://mapa.***.net.pl/tms/%zoom%/%x%/%y%.png&lt;/url&gt;&lt;/tms&gt;&lt;/maps&gt;&lt;/login_result&gt; </code></pre>
0debug
static av_cold void dump_enc_cfg(AVCodecContext *avctx, const struct vpx_codec_enc_cfg *cfg) { int width = -30; int level = AV_LOG_DEBUG; av_log(avctx, level, "vpx_codec_enc_cfg\n"); av_log(avctx, level, "generic settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n %*s%u\n" #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) " %*s%u\n %*s%u\n" #endif " %*s{%u/%u}\n %*s%u\n %*s%d\n %*s%u\n", width, "g_usage:", cfg->g_usage, width, "g_threads:", cfg->g_threads, width, "g_profile:", cfg->g_profile, width, "g_w:", cfg->g_w, width, "g_h:", cfg->g_h, #if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH) width, "g_bit_depth:", cfg->g_bit_depth, width, "g_input_bit_depth:", cfg->g_input_bit_depth, #endif width, "g_timebase:", cfg->g_timebase.num, cfg->g_timebase.den, width, "g_error_resilient:", cfg->g_error_resilient, width, "g_pass:", cfg->g_pass, width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_resize_allowed:", cfg->rc_resize_allowed, width, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, width, "rc_resize_down_thresh:", cfg->rc_resize_down_thresh, width, "rc_end_usage:", cfg->rc_end_usage, width, "rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz, width, "rc_target_bitrate:", cfg->rc_target_bitrate); av_log(avctx, level, "quantizer settings\n" " %*s%u\n %*s%u\n", width, "rc_min_quantizer:", cfg->rc_min_quantizer, width, "rc_max_quantizer:", cfg->rc_max_quantizer); av_log(avctx, level, "bitrate tolerance\n" " %*s%u\n %*s%u\n", width, "rc_undershoot_pct:", cfg->rc_undershoot_pct, width, "rc_overshoot_pct:", cfg->rc_overshoot_pct); av_log(avctx, level, "decoder buffer model\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_buf_sz:", cfg->rc_buf_sz, width, "rc_buf_initial_sz:", cfg->rc_buf_initial_sz, width, "rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz); av_log(avctx, level, "2 pass rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_2pass_vbr_bias_pct:", cfg->rc_2pass_vbr_bias_pct, width, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct, width, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct); av_log(avctx, level, "keyframing settings\n" " %*s%d\n %*s%u\n %*s%u\n", width, "kf_mode:", cfg->kf_mode, width, "kf_min_dist:", cfg->kf_min_dist, width, "kf_max_dist:", cfg->kf_max_dist); av_log(avctx, level, "\n"); }
1threat
Checkbox inside Custom ListVIew is not workinf : When i use textview instead of checkbox, it works perfectly. But with checkbox it doesnt work. What is wrong here? I want to update Menuitem with every checkboxevent. So how can i make this working? This is custom made listview, so i dont have listview in my xml file. I only have textview and checkbox in xml file. package com.example.chaps.pizzaorder; import android.content.Intent; import android.content.res.TypedArray; import android.graphics.Paint; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.HashMap; /** * Created by chaps on 17/04/2017. */ public class veggies extends ListFragment { ArrayList<HashMap<String, String>> data=new ArrayList<HashMap<String,String>>(); SimpleAdapter adapter; String st; double value; double new_value; //TextView txt; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); } public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { String[] menuItem= getResources().getStringArray(R.array.veggie_topping); String[] menuPrice=getResources().getStringArray(R.array.topping_price_veggie); HashMap<String, String> map=new HashMap<String, String>();//custom adapter for image and text in list View for(int i=0;i<menuItem.length;i++) { map=new HashMap<String, String>(); map.put("Pizza",menuItem[i]); map.put("Price",menuPrice[i]); data.add(map); } String[] from={"Pizza","Price"}; int[] to={R.id.textView5,R.id.checkBox}; adapter=new SimpleAdapter(getActivity(),data,R.layout.veggies,from,to); setListAdapter(adapter); return super.onCreateView(inflater,container,savedInstanceState); } public void onStart() { super.onStart(); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { /* orders fragment = new orders(); Bundle bundle = new Bundle(); bundle.putString(String.valueOf(R.string.MD01), data.get(position).get("Pizza")); fragment.setArguments(bundle); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.main_content,fragment).commit(); */ // st=data.get(position).get("Price"); st=data.get(position).get("Price").substring(1); value=Double.parseDouble(st); new_value=new_value+value; Toast.makeText(getContext(),st,Toast.LENGTH_SHORT).show(); } }); } public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_pizza_details, menu); } public void onPrepareOptionsMenu(Menu menu) { MenuItem green = menu.findItem(R.id.actnprice); if(green.getTitle() != String.valueOf(R.string.actnShow)){ // If green menu item title not updated then update/change it green.setTitle("€"+new_value); //Toast.makeText(getContext(),"Green MenuItem Edited",Toast.LENGTH_SHORT).show(); } super.onPrepareOptionsMenu(menu); getActivity().supportInvalidateOptionsMenu(); } }
0debug
What is AST in graphql? : <p>What is AST in graphql ? I am using graphql-js. How does it help with anything?</p> <p>Nothing in any documentation seems to explain what AST is</p>
0debug
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { int ret; AVStream *st; ff_read_frame_flush(s); if(flags & AVSEEK_FLAG_BYTE) return seek_frame_byte(s, stream_index, timestamp, flags); if(stream_index < 0){ stream_index= av_find_default_stream_index(s); if(stream_index < 0) return -1; st= s->streams[stream_index]; timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num); } if (s->iformat->read_seek) ret = s->iformat->read_seek(s, stream_index, timestamp, flags); else ret = -1; if (ret >= 0) { return 0; } if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) return av_seek_frame_binary(s, stream_index, timestamp, flags); else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) return seek_frame_generic(s, stream_index, timestamp, flags); else return -1; }
1threat
Loop back to program after an execution is thrown : public void runMenu() { int x = 1; Scanner Option = new Scanner (System.in); int Choice = 0; do{ try{ System.out.println("Choose Option"); System.out.println(""); System.out.println("1: Create Account"); System.out.println("2: Check Account"); System.out.println("3: Take Action"); System.out.println("4: Exit"); System.out.println("Please choose"); Choice= Option.nextInt(); switch (Choice) //used switch statement instead of If else because more effective { case 1: CreateAccount(); break; //breaks iteration case 2: selectAccount(); break; case 3: Menu(); int choice = UserInput(); performAction(choice); break; case 4: System.out.println("Thanks for using the application"); System.exit(0); default: System.out.println("Invalid Entry"); throw new Exception(); } } catch (Exception e){ System.err.println("Enter Correct Input"); return; } } while (true); } I am trying to make it when users enter incorrect input type like a letter , the exception is caught and then returns back to the menus, right now it catches the exception but it doesnt stop running I have to force stop the program. So I added a return but that just displays the exception error and stops, how can I make it return back to the menus?
0debug
Why am I getting undefined error? : <p>the syntax seems to be correct, I dont get it, here is error: app.js:73 Uncaught ReferenceError: getBirthyear is not defined Code: </p> <pre><code>const person = { name: 'Tommy', age: 32, location: { state: 'Missouri', city: 'louisisana', street: '1 marcia drive', job: 'web dev' }, getBirthyear: function() { return 2018 - this.age; } } let val; val = getBirthyear(); document.write(val); </code></pre>
0debug
void helper_lswx(CPUPPCState *env, target_ulong addr, uint32_t reg, uint32_t ra, uint32_t rb) { if (likely(xer_bc != 0)) { if (unlikely((ra != 0 && reg < ra && (reg + xer_bc) > ra) || (reg < rb && (reg + xer_bc) > rb))) { helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_LSWX); } else { helper_lsw(env, addr, xer_bc, reg); } } }
1threat
static int decode_residual_block(AVSContext *h, GetBitContext *gb, const struct dec_2dvlc *r, int esc_golomb_order, int qp, uint8_t *dst, int stride) { int i, level_code, esc_code, level, run, mask; DCTELEM level_buf[65]; uint8_t run_buf[65]; DCTELEM *block = h->block; for(i=0;i<65;i++) { level_code = get_ue_code(gb,r->golomb_order); if(level_code >= ESCAPE_CODE) { run = ((level_code - ESCAPE_CODE) >> 1) + 1; esc_code = get_ue_code(gb,esc_golomb_order); level = esc_code + (run > r->max_run ? 1 : r->level_add[run]); while(level > r->inc_limit) r++; mask = -(level_code & 1); level = (level^mask) - mask; } else { level = r->rltab[level_code][0]; if(!level) break; run = r->rltab[level_code][1]; r += r->rltab[level_code][2]; } level_buf[i] = level; run_buf[i] = run; } if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp], ff_cavs_dequant_shift[qp], i)) return -1; h->cdsp.cavs_idct8_add(dst,block,stride); h->s.dsp.clear_block(block); return 0; }
1threat
static uint64_t timer_read(void *opaque, target_phys_addr_t addr, unsigned size) { LM32TimerState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_SR: case R_CR: case R_PERIOD: r = s->regs[addr]; break; case R_SNAPSHOT: r = (uint32_t)ptimer_get_count(s->ptimer); break; default: error_report("lm32_timer: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_lm32_timer_memory_read(addr << 2, r); return r; }
1threat
Android Studio 2.2 : I keep seeing "GPU tools not installed, install now" : <p>I've just downloaded the latest Android Studio 2.2 and I'm trying to use the GPU profiling tools. On my LG G4 phone I've enabled up USB debugging &amp; Profile GPU rendering (In adb shell dumpsys gfxinfo).</p> <p>When using the Android Monitor (GPU) launching a GFX Trace gives me the message "GPU tools not installed, install now?". If I go to the Configuration and enable 'Capture GPU Commands' it asks me the same.</p> <p>I've checked in the SDK Manager and I have the Tools installed (3.1.0 &amp; 1.3.0).</p> <p>I've tried uninstalling, and reinstalling Android Studio. I've tried a couple of different phones. I've tried different combinations of settings on the phones. </p> <p>I'm out of ideas. Does anyone know what situation might mean GPU Tools are not recognised as installed?</p>
0debug
How do I retrieve the public IP for a fargate task using the CLI? : <p>I have a cluster running with services and am also able to launch fargate tasks from the command line. I can get the taskArn as a response to launching the task and I can wait for the task to be in the running state by using "aws ecs wait". I'm stuck figuring out how to get the the public IP of the task. I can find it via the web page easily enough and can access the machine via it's public IP...</p> <p>How do I get the public IP of a fargate task using the CLI interface?</p> <p>I'm using the following commands to launch the task, wait for it to run and retrieve the task description:</p> <pre><code>$ aws ecs run-task --launch-type FARGATE --cluster xxxx --task-definition xxxx --network-configuration xxxx $ aws ecs wait &lt;taskArn&gt; $ aws ecs describe-tasks --cluster xxxx --task &lt;taskArn&gt; | grep -i ipv4 </code></pre> <p>The last command only gives me the private IP...</p> <pre><code>"privateIpv4Address": "10.0.1.252", "name": "privateIPv4Address" </code></pre> <p>I've also tried using:</p> <pre><code>$ ecs-cli ps --cluster xxxx </code></pre> <p>But the Ports column is blank.</p> <pre><code>Name State Ports TaskDefinition xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxx RUNNING xxxx:1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxx RUNNING xxxx:1 </code></pre>
0debug
How to create numpy array with every alternative number starting from 5 to 55 : <p><strong>please help</strong> *I've just started python and I'm lost here * *kindly just tell me the way I'll do it *</p>
0debug
How to parse JSON to MySql : I have a JSON string from a http request I need to store in a MySql table, columns and rows I need to do it in Node.js. It's not a problem to get the JSON string via the http request. http://lonobox.com/api/index.php?id=100004854 The problem is to convert it to columns and rows and store it in MySql. Alternative postgre
0debug
Cannot concatenate 'str' and 'list' objects (Basic list indexing Python 2) : I have a program that asks for the user how many names they have and then prints them depending on the category the fall in (first, middle, and last). names = int(input("Number of names: ")) name_list = [] for i in range(names): name_list.append(input("Name: ")) print "First name: " + name_list[0] print "Middle names: " + name_list[0:len(name_list) - 1] print "Last name: " + name_list[-1] But I'm getting a TypeError: cannot concatenate 'str' and 'list' objects on line 9 and I'm not really sure why. I look for the error but I only found way more complex programs and I didn't really get the explanation
0debug
How to convert any type into String in Julia : <p>Using Julia, I'd like to reliably convert any type into type <code>String</code>. There seems to be two ways to do the conversion in v0.5, either the <code>string</code> function or <code>String</code> constructor. The problem is that you need to choose the right one depending upon the input type.</p> <p>For example, <code>typeof(string(1))</code> evaluates to <code>String</code>, but <code>String(1)</code> throws an error. On the other hand, <code>typeof(string(SubString{String}("a")))</code> evaluates to <code>Substring{String}</code>, which is not a subtype of <code>String</code>. We instead need to do <code>String(SubString{String}("a"))</code>.</p> <p>So it seems the only reliable way to convert any input <code>x</code> to type <code>String</code> is via the construct:</p> <pre><code>String(string(x)) </code></pre> <p>which feels a bit cumbersome.</p> <p>Am I missing something here? </p>
0debug
UIImageView getting attached to _UIBarBackground : <p>Following is the screenshot of the issue:-</p> <p>Not sure why is uiimageview getting added , and what is <code>_UIBarBackGround</code> ? <a href="https://i.stack.imgur.com/qlFhq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qlFhq.png" alt="enter image description here"></a></p> <p>Any help is appreciated.</p> <p>Complete Flow screenshot:-</p> <p><a href="https://i.stack.imgur.com/mXwIE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mXwIE.png" alt="enter image description here"></a></p>
0debug
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; AVStream *st; int i, len, res, seq = 1; int64_t timestamp, pos; int flags; for (;;) { if (rm->audio_pkt_cnt) { st = s->streams[rm->audio_stream_num]; ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt); flags = 0; } else { if (rm->old_format) { RMStream *ast; st = s->streams[0]; ast = st->priv_data; timestamp = AV_NOPTS_VALUE; len = !ast->audio_framesize ? RAW_PACKET_SIZE : ast->coded_framesize * ast->sub_packet_h / 2; flags = (seq++ == 1) ? 2 : 0; pos = avio_tell(s->pb); } else { len=sync(s, &timestamp, &flags, &i, &pos); if (len > 0) st = s->streams[i]; } if(len<0 || s->pb->eof_reached) return AVERROR(EIO); res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt, &seq, flags, timestamp); if((flags&2) && (seq&0x7F) == 1) av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME); if (res) continue; } if( (st->discard >= AVDISCARD_NONKEY && !(flags&2)) || st->discard >= AVDISCARD_ALL){ av_free_packet(pkt); } else break; } return 0; }
1threat
static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp) { PowerPCCPU *cpu = POWERPC_CPU(dev); CPUPPCState *env = &cpu->env; opc_handler_t **table; int i, j; cpu_exec_exit(CPU(dev)); for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) { if (env->opcodes[i] == &invalid_handler) { continue; } if (is_indirect_opcode(env->opcodes[i])) { table = ind_table(env->opcodes[i]); for (j = 0; j < PPC_CPU_INDIRECT_OPCODES_LEN; j++) { if (table[j] != &invalid_handler && is_indirect_opcode(table[j])) { g_free((opc_handler_t *)((uintptr_t)table[j] & ~PPC_INDIRECT)); } } g_free((opc_handler_t *)((uintptr_t)env->opcodes[i] & ~PPC_INDIRECT)); } } }
1threat
static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries) { assert(entries < (UINT64_C(1) << (64 - 9))); return DIV_ROUND_UP(entries << s->refcount_order, 8); }
1threat
static inline void RENAME(yuv2nv12X)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat) { yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, dstW, chrDstW, dstFormat); }
1threat
cannot create aws lamda function due to some cryptic error message : <p>I am trying to create an aws lambda function but when I click deploy I get this error message:</p> <blockquote> <p>Correct the errors below and try again. Your function's execution role must be assumable by the edgelambda.amazonaws.com service principal.</p> </blockquote> <p><a href="https://i.stack.imgur.com/LOZJW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LOZJW.png" alt="enter image description here"></a></p> <p>I have absolutely no idea what this means.</p>
0debug
Swashbuckle Swagger - How to annotate content types? : <p>How do I annotate my ASP.NET WebAPI actions so that the swagger metadata includes the content-types that my resources support?</p> <p>Specifically, I want the documentation to show that one of my resources can return the 'original' <code>application/json</code> and <code>application/xml</code> but also now returns a new format, <code>application/vnd.blah+json</code> or <code>+xml</code>.</p>
0debug
static gboolean pty_chr_timer(gpointer opaque) { struct CharDriverState *chr = opaque; PtyCharDriver *s = chr->opaque; if (s->connected) { goto out; } if (s->polling) { pty_chr_state(chr, 1); goto out; } pty_chr_update_read_handler(chr); out: return FALSE; }
1threat
sql query to dulicate each row 12 times : I have a table which has columns site,year and sales . this table is unique on site+year eg <br/> site year sales a 2012 50 b 2013 100 a 2006 35 Now what i wanted to do is make this table unique on site+year+month. thus each row gets duplicated 12 times,a month column is added which is labelled from 1-12 and the sales values get divided by 12 thus site year month sales a 2012 1 50/12 a 2012 2 50/12 ... a 2012 12 50/12 ... b 2013 1 100/12 ... a 2006 12 35/12 i am doing this on python currently and it works like a charm ,but i need to do this on SQL(ideally postgre SQL since i will be using this as a datasource for tableau) it would be very helpful,if someone can provide the explanations with the solution as well,since i am a novice at this
0debug
static int config_input_ref(AVFilterLink *inlink) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); AVFilterContext *ctx = inlink->dst; PSNRContext *s = ctx->priv; unsigned sum; int j; s->nb_components = desc->nb_components; if (ctx->inputs[0]->w != ctx->inputs[1]->w || ctx->inputs[0]->h != ctx->inputs[1]->h) { av_log(ctx, AV_LOG_ERROR, "Width and height of input videos must be same.\n"); return AVERROR(EINVAL); } if (ctx->inputs[0]->format != ctx->inputs[1]->format) { av_log(ctx, AV_LOG_ERROR, "Inputs must be of same pixel format.\n"); return AVERROR(EINVAL); } s->max[0] = (1 << (desc->comp[0].depth_minus1 + 1)) - 1; s->max[1] = (1 << (desc->comp[1].depth_minus1 + 1)) - 1; s->max[2] = (1 << (desc->comp[2].depth_minus1 + 1)) - 1; s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1; s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0; s->comps[0] = s->is_rgb ? 'r' : 'y' ; s->comps[1] = s->is_rgb ? 'g' : 'u' ; s->comps[2] = s->is_rgb ? 'b' : 'v' ; s->comps[3] = 'a'; s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h); s->planeheight[0] = s->planeheight[3] = inlink->h; s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; sum = 0; for (j = 0; j < s->nb_components; j++) sum += s->planeheight[j] * s->planewidth[j]; for (j = 0; j < s->nb_components; j++) { s->planeweight[j] = (double) s->planeheight[j] * s->planewidth[j] / sum; s->average_max += s->max[j] * s->planeweight[j]; } s->compute_mse = desc->comp[0].depth_minus1 > 7 ? compute_images_mse_16bit : compute_images_mse; return 0; }
1threat
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBDevice *dev; if (class_id == 9) return 0; for (f = usb_auto_filter; f; f = f->next) { if (f->bus_num >= 0 && f->bus_num != bus_num) continue; if (f->addr >= 0 && f->addr != addr) continue; if (f->vendor_id >= 0 && f->vendor_id != vendor_id) continue; if (f->product_id >= 0 && f->product_id != product_id) continue; if (hostdev_find(bus_num, addr)) return 0; dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr); dev = usb_host_device_open_addr(bus_num, addr, product_name); } return 0; }
1threat
Why would I ever use unowned self? : <p>The following pattern happens a lot in iOS apps: </p> <pre><code>class MyViewController: UIViewController { let myModel = MyModel() override func viewDidLoad() { super.viewDidLoad() myModel.foo() { [***] in // use self here } } } class MyModel { public func foo(complete: () -&gt; Void) { // do something complete() } } </code></pre> <p>The consensus is to use either <code>[unowned self]</code> or <code>[weak self]</code> in place of the <code>[***]</code>, unowned when you can guarantee that self will not be nil at the time of completion and weak when you're not sure the reference will still be valid.<br> What I don't understand is why I would ever risk using unowned, maybe I'm sure that right now the reference will never be nil, but that can change in the future. I could also have overlooked an edge-case, mistakes happen. I could just as easily always use weak, and put a guard at the top of the closure to be able to use self without a ! or ?.<br> What is the use of unowned? Is it faster than weak+guard? Is it syntactic sugar? It seems to go against Swift's philosophy of protecting the developer against common mistakes that can cause crashes.</p>
0debug
Exclude elements of Array based on index (Julia) : <p>What is the most natural way to filter an array by index in Julia? The simplest example would be to leave off the kth element:</p> <pre><code>A = [1,2,3,4,5,6,7,8] k = 4 [getindex(A, i) for i = 1:8 if i != k] </code></pre> <p>The above works but seems verbose compared to the simple <code>A[-k]</code> available in <code>R</code>. What's the cleanest way to perform this simple task?</p>
0debug
Date field in where clause - if date in feild is >= 67 : I am trying to pull up records based on a DATETIME field. In the where clause I want the query to look at the date in the DATETIME field and if its greater than or equal to 67 days, I want the records to show up. How do I do this? I have used the sysdate in the where clause before but this one has me stumped. Thanks
0debug
Says hashed password is incorrect but they are the same : <p>Trying to learn a secure login so i was looking up tutorials. I found <a href="https://www.tutorialrepublic.com/php-tutorial/php-mysql-login-system.php" rel="nofollow noreferrer">this</a> tutorial useful and got a registration page working perfectly but the login keeps returning wrong password. This means its getting the username but is going wrong somewhere.</p> <p>Any idea how i can fix this, whether you see the error or know of a way i can fix it?</p> <p>Any help is appreciated </p> <pre><code>// Check if username is empty if(empty(trim($_POST["username"]))){ $username_err = 'Please enter username.'; } else{ $username = trim($_POST["username"]); } // Check if password is empty if(empty(trim($_POST['password']))){ $password_err = 'Please enter your password.'; } else{ $password = trim($_POST['password']); } // Validate credentials if(empty($username_err) &amp;&amp; empty($password_err)){ // Prepare a select statement $sql = "SELECT username, password FROM users WHERE username = ?"; if($stmt = mysqli_prepare($link, $sql)){ // Bind variables to the prepared statement as parameters mysqli_stmt_bind_param($stmt, "s", $param_username); // Set parameters $param_username = $username; // Attempt to execute the prepared statement if(mysqli_stmt_execute($stmt)){ // Store result mysqli_stmt_store_result($stmt); // Check if username exists, if yes then verify password if(mysqli_stmt_num_rows($stmt) == 1){ // Bind result variables mysqli_stmt_bind_result($stmt, $username, $hashed_password); if(mysqli_stmt_fetch($stmt)){ if(password_verify($password, $hashed_password)){ /* Password is correct, so start a new session and save the username to the session */ session_start(); $_SESSION['username'] = $username; header("location: welcome.php"); } else{ // Display an error message if password is not valid $password_err = 'The password you entered was not valid.'; } } } else{ // Display an error message if username doesn't exist $username_err = 'No account found with that username.'; } } else{ echo "Oops! Something went wrong. Please try again later."; } } // Close statement mysqli_stmt_close($stmt); } // Close connection mysqli_close($link); </code></pre>
0debug
cannot resolve constructor 'class_name(java.lang.String)' : <p>I'm trying to store data in database when clicking add button but an error appears when I created an object in MainActivity.java class with database class as shown <a href="http://i.stack.imgur.com/FTJt0.jpg" rel="nofollow">enter image description here</a> </p>
0debug
Import a specific worksheet from a single excel (CSV) file : <p>I am currently using lumenworks to import data stored within an excel file to my program. It only grabs the information from the first worksheet in the excel document. Would I be able to modify this code in order to import data from a second worksheet, or even all the worksheets at once? Below is what I currently have (imports variables form the main worksheet page):</p> <pre><code>IWebDriver driver; string MyUsername; string MyPassword; string MySecurityQuestion; public LoginPage(IWebDriver driver) { this.driver = driver; string nameColumnName = "Key"; string valueColumnName = "Username"; string rowName = "LoginTest"; //DataTable.Rows[0][0].ToString(); using (CsvReader csvReader = new CsvReader(new StreamReader("C:/Users/User1/source/repos/DDTesting/DDTesting/TestData.csv"), hasHeaders: true)) { int nameColumnIndex = csvReader.GetFieldIndex(nameColumnName); int valueColumnIndex = csvReader.GetFieldIndex(valueColumnName); while (csvReader.ReadNextRecord()) { if (csvReader[nameColumnIndex] == rowName) { string value = csvReader[valueColumnIndex]; // username MyUsername = value; value = csvReader[valueColumnIndex + 1]; MyPassword = value; value = csvReader[valueColumnIndex + 2]; MySecurityQuestion = value; break; } } } } By username = By.Name("username"); By password = By.Name("password"); By loginButton = By.ClassName("button-primary"); By securityQuestion = By.Name("answer"); public void TypeUsername() { driver.FindElement(username).Clear(); driver.FindElement(username).SendKeys(MyUsername); } </code></pre>
0debug
Apple.com Hero/Front Page Banner Area CSS : <p>I am building a home page that has similar to the apple.com home page, </p> <p>A hero banner with 4 promos at the bottom and when you scale the promos are set to the bottom and the hero banner seems like it has a max height.</p> <p>I have tried to copy the code and mimic it with no luck. </p> <p>Anyone know if theres a hero banner framework/library similar to this?</p> <p>I know that this question may get downvotes but I cannot find a similar simple example.</p> <p>Cheers</p>
0debug
Javascript to jquery convertion : So I'm trying to convert this javascript DOM into jquery, and my code isn't running for some reason. This is the DOM I am using. document.getElementById("forma").onsubmit = function () { var ime = document.getElementById("ime").value; var priimek = document.getElementById("priimek").value; var stranka = document.getElementById("stranka").value; try { var kandidat = Kandidat(ime, priimek, stranka); DodajKandidataNaPolje(kandidat); document.getElementById("seznam").innerHTML = OblikujIzpis(PridobiPolje()); document.getElementById("obvestila").innerHTML = "Uspešen Vnos!"; document.getElementById("obvestila").className = "bg-success"; } catch (napaka) { document.getElementById("obvestila").innerHTML = napaka.message; document.getElementById("obvestila").className = "bg-danger"; } document.getElementById("forma").reset(); } document.getElementById("forma_isci").onsubmit = function () { var iskani_niz = document.getElementById("iskalniNiz").value; document.getElementById("seznam").innerHTML = OblikujIzpis(Isci(iskani_niz)); document.getElementById("obvestila").innerHTML = "Rezultat iskanja po iskalnem nizu " + iskani_niz; document.getElementById("obvestila").className = "bg-info"; } document.getElementById("pobrisi").onclick = function () { IzbrisiPolje(); document.getElementById("obvestila").innerHTML = "Polje je bilo izbrisano!"; document.getElementById("obvestila").className = "bg-success"; document.getElementById("seznam").innerHTML = ""; document.getElementById("forma").reset(); } This is what I tried writing in jquery. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("forma").submit(function(){ var ime=$("ime").val(); var priimek=$("priimek").val(); var stranka=$("stranka").val(); try{ var kandidat= Kandidat(ime, priimek, stranka); DodajKandidataNaPolje(kandidat); $("seznam").html(OblikujIzpis(PridobiPolje()); $("obvestila").html("Uspešen Vnos!"); $("obvestila").addClass("bg-success"); } catch(napaka){ $("obvestila").html(napaka.message); $("obvestila").addClass("bg-danger"); } $("forma").reset(); $("forma_isci").submit=function(){ var iskani_niz=$("iskaniNiz").val(); $("seznam").html(OblikujIzpis(iskani_niz)); $("obvestila").html("Rezultat iskanja po iskalnem nizu " + iskani_niz); $("obvestila").addClass("bg-info"); } $("pobrisi".click=function(){ IzbrisiPolje(); $("obvestila").html("Polje je bilo izbrisano!"); $("obvestila").addClass("bg-success"); $("seznam").html(""); $("forma").reset(); } } }); }); </script> here is my HTML file <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> <script src="funkcije.js"></script> <script src="dom.js"></script> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <title>JavaScript - DOM</title> </head> <body> <div class="container"> <h1>Seznam predsedniških kandidatov!</h1> <form action="#" id="forma_isci" class="form-inline"> <div class="form-group"> <input type="text" class="form-control" id="iskalniNiz" placeholder="Iskalni niz"> </div> <button type="submit" class="btn btn-info">Išči</button> </form> <br /> <br /> <h3>Vnos novih kandidatov</h3> <form action="#" id="forma" class="form-group"> <table class="table"> <tr> <td>Ime:</td> <td> <input type="text" id="ime" placeholder="Ime kandidata" class="form-control" /> </td> </tr> <tr> <td>Priimek:</td> <td> <input type="text" id="priimek" placeholder="Priimek kandidata" class="form-control" /> </td> </tr> <tr> <td>Stranka:</td> <td> <select id="stranka" class="form-control" > <option>Demokratska</option> <option>Republikanska</option> <option>Neodvisna</option> </select> </td> </tr> <tr> <td> <input type="submit" value="Dodaj" class="btn btn-info" /> </td> <td> <input type="reset" value="Ponastavi" class="btn btn-info" /> </td> </tr> </table> </form> <br /> <br /> <p id="obvestila"></p> <br /> <br /> <h3>Seznam obstoječih kandidatov</h3> <ul id="seznam" class="list"></ul> <button class="btn" id="pobrisi">Pobriši seznam</button> </div> </body> </html> So anyway, I'm not going to post the functions here since they're not needed to be seen here. The javascript code works, the site works then and the elements get added normally. But I would like to have the same effect but written in Jquery. I think some of the issues are in .className, which I replaced with .Addclass from jquery and .innerHTML where I write .html(function). If someone could convert this for me it would be great, since I am kinda new to jquery I'm having some issues.
0debug
python incorrectly calculates number : <p>So, this was in my exam paper and I was really confused</p> <pre><code>def num_input(): num1 = input("num1: ") num2 = input("num2: ") num1 = int(num2)*2.5 num2 = int(num1)*1.5 print("num1:", num1, "num2:", num2) num_input() </code></pre> <p>say that num1 = 60, and num2 = 18, shouldn't the new numbers be:</p> <pre><code>num1: 45 num2: 90 </code></pre> <p>but why is the output:</p> <pre><code>num1: 45 num2: 67.5 </code></pre> <p>?</p>
0debug
static void test_visitor_in_enum(TestInputVisitorData *data, const void *unused) { Error *err = NULL; Visitor *v; EnumOne i; for (i = 0; EnumOne_lookup[i]; i++) { EnumOne res = -1; v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]); visit_type_EnumOne(v, &res, NULL, &err); g_assert(!err); g_assert_cmpint(i, ==, res); } }
1threat
How to ssh into the services create using docker-compose : <p>This is my docker compose file</p> <pre><code>version: '2' # based off compose-sample-2, only we build nginx.conf into image # uses sample site from https://startbootstrap.com/template-overviews/agency/ services: proxy: build: context: . dockerfile: nginx.Dockerfile ports: - '80:80' web: image: httpd volumes: - ./html:/usr/local/apache2/htdocs/ </code></pre> <p>Now can I ssh into any of the services which gets creats when I run docker-compose up</p>
0debug
Handling Enter Key in Vue.js : <p>I'm learning Vue.js. In my Vue, I have a text field and a button. By default, this button submits a form when someone presses the Enter key on their keyboard. When someone is typing in the text field, I want to capture each key pressed. If the key is an '@' symbol, I want to do something special. If the key pressed is the "Enter" key, I want to do something special as well. The latter is the one giving me challenges. Currently, I have this <a href="https://jsfiddle.net/ffgvw3yr/2/" rel="noreferrer">Fiddle</a>, which includes this code:</p> <pre><code>new Vue({ el: '#myApp', data: { emailAddress: '', log: '' }, methods: { validateEmailAddress: function(e) { if (e.keyCode === 13) { alert('Enter was pressed'); } else if (e.keyCode === 50) { alert('@ was pressed'); } this.log += e.key; }, postEmailAddress: function() { this.log += '\n\nPosting'; } }); </code></pre> <p>In my example, I can't seem to press the "Enter" key without it submitting the form. Yet, I would expect the <code>validateEmailAddress</code> function to at least fire first so that I could capture it. But, that does not seem to be happening. What am I doing wrong?</p>
0debug
def find_Max_Len_Even(str): n = len(str) i = 0 currlen = 0 maxlen = 0 st = -1 while (i < n): if (str[i] == ' '): if (currlen % 2 == 0): if (maxlen < currlen): maxlen = currlen st = i - currlen currlen = 0 else : currlen += 1 i += 1 if (currlen % 2 == 0): if (maxlen < currlen): maxlen = currlen st = i - currlen if (st == -1): return "-1" return str[st: st + maxlen]
0debug
static void mips_cpu_class_init(ObjectClass *c, void *data) { MIPSCPUClass *mcc = MIPS_CPU_CLASS(c); CPUClass *cc = CPU_CLASS(c); DeviceClass *dc = DEVICE_CLASS(c); mcc->parent_realize = dc->realize; dc->realize = mips_cpu_realizefn; mcc->parent_reset = cc->reset; cc->reset = mips_cpu_reset; cc->has_work = mips_cpu_has_work; cc->do_interrupt = mips_cpu_do_interrupt; cc->cpu_exec_interrupt = mips_cpu_exec_interrupt; cc->dump_state = mips_cpu_dump_state; cc->set_pc = mips_cpu_set_pc; cc->synchronize_from_tb = mips_cpu_synchronize_from_tb; cc->gdb_read_register = mips_cpu_gdb_read_register; cc->gdb_write_register = mips_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = mips_cpu_handle_mmu_fault; #else cc->do_unassigned_access = mips_cpu_unassigned_access; cc->do_unaligned_access = mips_cpu_do_unaligned_access; cc->get_phys_page_debug = mips_cpu_get_phys_page_debug; cc->vmsd = &vmstate_mips_cpu; #endif cc->disas_set_info = mips_cpu_disas_set_info; cc->gdb_num_core_regs = 73; cc->gdb_stop_before_watchpoint = true; dc->cannot_destroy_with_object_finalize_yet = true; }
1threat
What is the little white gap for my css? : <!-- begin snippet: js hide: false --> <!-- language: lang-css --> body{ margin:0px; padding:0px;} div{ border:1px solid black; box-sizing:border-box; font-size:30px;} #wrapper{ width:900px; margin:0px auto;} #header{ width:100%; height:100px; background:red;} #container{ width:100%; height:100px; background:black;} #mainBox{ width:75%; height:150px; background:blue; float:left; } #sideBox{ width:25%; height:100px; background:yellow; float:left; } #footer{ clear:both; width:100%; height:50px; background:white; } <!-- language: lang-html --> <body> <div id="wrapper"> <div id="header">this is the header </div> <div id="container"> <div id="mainBox">main box </div> <div id="sideBox">side box </div> </div> <div id="footer">this is the footer </div> </div> <!-- end snippet --> [![enter image description here][1]][1] There is a little white gap on the downside of mainBox,what is it and which cause it? [1]: http://i.stack.imgur.com/jeFP4.png
0debug
How to use map from purrr with dplyr::mutate to create multiple new columns based on column pairs : <p>I have to following issue using R. In short I want to create multiple new columns in a data frame based on calculations of different column pairs in the data frame.</p> <p>The data looks as follows:</p> <pre><code>df &lt;- data.frame(a1 = c(1:5), b1 = c(4:8), c1 = c(10:14), a2 = c(9:13), b2 = c(3:7), c2 = c(15:19)) df a1 b1 c1 a2 b2 c2 1 4 10 9 3 15 2 5 11 10 4 16 3 6 12 11 5 17 4 7 13 12 6 18 5 8 14 13 7 19 </code></pre> <p>The output is supposed to look like the following:</p> <pre><code>a1 b1 c1 a2 b2 c2 sum_a sum_b sum_c 1 4 10 9 3 15 10 7 25 2 5 11 10 4 16 12 9 27 4 7 13 12 6 18 16 13 31 5 8 14 13 7 19 18 15 33 </code></pre> <p>I can achieve this using dplyr doing some manual work in the following way:</p> <pre><code>df %&gt;% rowwise %&gt;% mutate(sum_a = sum(a1, a2), sum_b = sum(b1, b2), sum_c = sum(c1, c2)) %&gt;% as.data.frame() </code></pre> <p>So what is being done is: take columns with the letter "a" in it, calulate the sum rowwise, and create a new column with the sum named sum_[letter]. Repeat for columns with different letters.</p> <p>This is working, however, if I have a large data set with say 300 different column pairs the manual input would be significant, since I would have to write 300 mutate calls.</p> <p>I recently stumbled upon the R package "purrr" and my guess is that this would solve my problem of doing what I want in a more automated way.</p> <p>In particular, I would think to be able to use purrr:map2 to which I pass two lists of column names. </p> <ul> <li>list1 = all columns with the number 1 in it</li> <li>list2 = all columns with the number 2 in it</li> </ul> <p>Then I could calculate the sum of each matching list entry, in the form of:</p> <pre><code>map2(list1, list2, ~mutate(sum)) </code></pre> <p>However, I am not able to figure out how to best approach this problem using purrr. I am rather new to using purrr, so I would really appreciate any help on this issue.</p>
0debug
static void vfio_bar_quirk_teardown(VFIODevice *vdev, int nr) { VFIOBAR *bar = &vdev->bars[nr]; while (!QLIST_EMPTY(&bar->quirks)) { VFIOQuirk *quirk = QLIST_FIRST(&bar->quirks); memory_region_del_subregion(&bar->mem, &quirk->mem); QLIST_REMOVE(quirk, next); g_free(quirk); } }
1threat
av_cold int ff_nvenc_encode_close(AVCodecContext *avctx) { NVENCContext *ctx = avctx->priv_data; NV_ENCODE_API_FUNCTION_LIST *nv = &ctx->nvel.nvenc_funcs; int i; av_frame_free(&avctx->coded_frame); if (ctx->in) { for (i = 0; i < ctx->nb_surfaces; ++i) { nv->nvEncDestroyInputBuffer(ctx->nvenc_ctx, ctx->in[i].in); nv->nvEncDestroyBitstreamBuffer(ctx->nvenc_ctx, ctx->out[i].out); } } av_freep(&ctx->in); av_freep(&ctx->out); if (ctx->nvenc_ctx) nv->nvEncDestroyEncoder(ctx->nvenc_ctx); if (ctx->cu_context) ctx->nvel.cu_ctx_destroy(ctx->cu_context); if (ctx->nvel.nvenc) dlclose(ctx->nvel.nvenc); if (ctx->nvel.cuda) dlclose(ctx->nvel.cuda); return 0; }
1threat
I keep getting cannot read property error. : I am trying to do a bubblesort. I am using this algorithm to sort a 2d array and I keep getting an error. Here is the function: var array = [["Rober Hill", 123.54], ["Chrsitopher Reddkin", 54.67], ["Maggie Woods", 1000.87], ["Jennifer Jones", 3.34], ["Marcus Parker", 64.98]]; table = document.getElementById("table"); function bubbleSort(array, length, element) { var swapped = false; do { for (var a = 0; a < 5; a++) { if (array[a][1] > array[a+1][1]) { var temp = array[a][1]; array[a][1] = array[a+1][1]; array[a+1][1] = temp; swapped = true; } } } while(swapped); return array; } The error says: Sorting.html:59 Uncaught TypeError: Cannot read property '0' of undefined. I have this function on a button. Any kind of help would be nice! Thank you
0debug
rotate animation in jquery or css : <p>I want to create a rotating wheel luck game. I know that jquery has some features like fadein, fadeout etc. I was just wondering if there is also a rotating effect in jquery? if not then how can i do this effect? thanks</p>
0debug
Pytorch: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead : <p>I have an error in my code which is not getting fixed any which way I try.</p> <p>The Error is simple, I return a value:</p> <pre><code>torch.exp(-LL_total/T_total) </code></pre> <p>and get the error later in the pipeline:</p> <pre><code>RuntimeError: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead. </code></pre> <p>Solutions such as <code>cpu().detach().numpy()</code> give the same error.</p> <p>How could I fix it? Thanks.</p>
0debug
static av_cold int vc1_decode_init(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; GetBitContext gb; v->output_width = avctx->width; v->output_height = avctx->height; if (!avctx->extradata_size || !avctx->extradata) return -1; if (!(avctx->flags & AV_CODEC_FLAG_GRAY)) avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); else avctx->pix_fmt = AV_PIX_FMT_GRAY8; v->s.avctx = avctx; if (ff_vc1_init_common(v) < 0) return -1; ff_blockdsp_init(&s->bdsp, avctx); ff_h264chroma_init(&v->h264chroma, 8); ff_qpeldsp_init(&s->qdsp); if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) { int count = 0; init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8); if (ff_vc1_decode_sequence_header(avctx, v, &gb) < 0) return -1; count = avctx->extradata_size*8 - get_bits_count(&gb); if (count > 0) { av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n", count, get_bits_long(&gb, FFMIN(count, 32))); } else if (count < 0) { av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count); } } else { const uint8_t *start = avctx->extradata; uint8_t *end = avctx->extradata + avctx->extradata_size; const uint8_t *next; int size, buf2_size; uint8_t *buf2 = NULL; int seq_initialized = 0, ep_initialized = 0; if (avctx->extradata_size < 16) { av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size); return -1; } buf2 = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); start = find_next_marker(start, end); next = start; for (; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; buf2_size = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&gb, buf2, buf2_size * 8); switch (AV_RB32(start)) { case VC1_CODE_SEQHDR: if (ff_vc1_decode_sequence_header(avctx, v, &gb) < 0) { av_free(buf2); return -1; } seq_initialized = 1; break; case VC1_CODE_ENTRYPOINT: if (ff_vc1_decode_entry_point(avctx, v, &gb) < 0) { av_free(buf2); return -1; } ep_initialized = 1; break; } } av_free(buf2); if (!seq_initialized || !ep_initialized) { av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n"); return -1; } v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE); } v->sprite_output_frame = av_frame_alloc(); if (!v->sprite_output_frame) return AVERROR(ENOMEM); avctx->profile = v->profile; if (v->profile == PROFILE_ADVANCED) avctx->level = v->level; avctx->has_b_frames = !!avctx->max_b_frames; if (v->color_prim == 1 || v->color_prim == 5 || v->color_prim == 6) avctx->color_primaries = v->color_prim; if (v->transfer_char == 1 || v->transfer_char == 7) avctx->color_trc = v->transfer_char; if (v->matrix_coef == 1 || v->matrix_coef == 6 || v->matrix_coef == 7) avctx->colorspace = v->matrix_coef; s->mb_width = (avctx->coded_width + 15) >> 4; s->mb_height = (avctx->coded_height + 15) >> 4; if (v->profile == PROFILE_ADVANCED || v->res_fasttx) { ff_vc1_init_transposed_scantables(v); } else { memcpy(v->zz_8x8, ff_wmv1_scantable, 4*64); v->left_blk_sh = 3; v->top_blk_sh = 0; } if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { v->sprite_width = avctx->coded_width; v->sprite_height = avctx->coded_height; avctx->coded_width = avctx->width = v->output_width; avctx->coded_height = avctx->height = v->output_height; if (v->sprite_width > 1 << 14 || v->sprite_height > 1 << 14 || v->output_width > 1 << 14 || v->output_height > 1 << 14) return -1; } return 0; }
1threat
Attempting Python list comprehension with two variable of different ranges : <p>I'm trying to generate a list quickly with content from two different arrays of size n and n/2. As an example:</p> <pre><code>A = [70, 60, 50, 40, 30, 20, 10, 0] B = [1, 2, 3, 4] </code></pre> <p>I wish to generate something like</p> <pre><code>[(A[x], B[y]) for x in range(len(A)) for y in range(len(B))] </code></pre> <p>I understand the second for statement is the nested for loop after the "x" one. I'm trying to get the contents of the new array to be</p> <pre><code>A[0], B[0] A[1], B[1] A[2], B[2] A[3], B[3] A[4], B[0] A[5], B[1] A[6], B[2] A[7], B[3] </code></pre> <p>Could anyone point me in the right direction?</p>
0debug
How to get last item from array of object? : <p>I have JSON object from server and requirement is to always display last item from the array <code>items</code>. how can i achieve that task using AngularJs or native JavaScript ?</p> <p>Below case i have to display text <code>Chief Administrative Officer</code>.</p> <p>main.js</p> <pre><code> angular.forEach($scope.rcsaErhTreeData, function(val) { angular.forEach(val, function(val) { console.log('this is the array value', val[0].text); }); }); </code></pre> <p>json.js</p> <pre><code>[{ "uid": null, "index": 0, "selected": null, "expanded": null, "id": 2701, "text": "BAC Enterprise Wide", "parentId": 0, "items": [{ "uid": null, "index": 0, "selected": null, "expanded": null, "id": 4114, "text": "Chief Administrative Officer", "parentId": 2701, "items": [] }] }] </code></pre>
0debug
How do I Add Value as Source Code in Php Variable : <p>My source code here</p> <pre><code>&lt;?php $a = "$b = dfsdf "; echo $a; ?&gt; </code></pre> <p>I want to get out put result as below</p> <pre><code>$b = dfsdf </code></pre>
0debug
static av_cold int a64multi_encode_init(AVCodecContext *avctx) { A64Context *c = avctx->priv_data; int a; av_lfg_init(&c->randctx, 1); if (avctx->global_quality < 1) { c->mc_lifetime = 4; } else { c->mc_lifetime = avctx->global_quality /= FF_QP2LAMBDA; } av_log(avctx, AV_LOG_INFO, "charset lifetime set to %d frame(s)\n", c->mc_lifetime); c->mc_frame_counter = 0; c->mc_use_5col = avctx->codec->id == AV_CODEC_ID_A64_MULTI5; c->mc_pal_size = 4 + c->mc_use_5col; for (a = 0; a < c->mc_pal_size; a++) { c->mc_luma_vals[a]=a64_palette[mc_colors[a]][0] * 0.30 + a64_palette[mc_colors[a]][1] * 0.59 + a64_palette[mc_colors[a]][2] * 0.11; } if (!(c->mc_meta_charset = av_malloc_array(c->mc_lifetime, 32000 * sizeof(int))) || !(c->mc_best_cb = av_malloc(CHARSET_CHARS * 32 * sizeof(int))) || !(c->mc_charmap = av_mallocz_array(c->mc_lifetime, 1000 * sizeof(int))) || !(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t))) || !(c->mc_charset = av_malloc(0x800 * (INTERLACED+1) * sizeof(uint8_t)))) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate buffer memory.\n"); return AVERROR(ENOMEM); } if (!(avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE))) { av_log(avctx, AV_LOG_ERROR, "Failed to allocate memory for extradata.\n"); return AVERROR(ENOMEM); } avctx->extradata_size = 8 * 4; AV_WB32(avctx->extradata, c->mc_lifetime); AV_WB32(avctx->extradata + 16, INTERLACED); avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { a64multi_close_encoder(avctx); return AVERROR(ENOMEM); } avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->key_frame = 1; if (!avctx->codec_tag) avctx->codec_tag = AV_RL32("a64m"); c->next_pts = AV_NOPTS_VALUE; return 0; }
1threat
static uint64_t pfpu_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistPFPUState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_CTL: case R_MESHBASE: case R_HMESHLAST: case R_VMESHLAST: case R_CODEPAGE: case R_VERTICES: case R_COLLISIONS: case R_STRAYWRITES: case R_LASTDMA: case R_PC: case R_DREGBASE: case R_CODEBASE: r = s->regs[addr]; break; case GPR_BEGIN ... GPR_END: r = s->gp_regs[addr - GPR_BEGIN]; break; case MICROCODE_BEGIN ... MICROCODE_END: r = s->microcode[get_microcode_address(s, addr)]; break; default: error_report("milkymist_pfpu: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_pfpu_memory_read(addr << 2, r); return r; }
1threat
Why doesn't my arrow function return a value? : <p>I have an arrow function that looks like this (simplified):</p> <pre><code>const f = arg =&gt; { arg.toUpperCase(); }; </code></pre> <p>But when I call it, I get <code>undefined</code>:</p> <pre><code>console.log(f("testing")); // undefined </code></pre> <p>Why?</p> <p>Example:</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const f = arg =&gt; { arg.toUpperCase(); }; console.log(f("testing"));</code></pre> </div> </div> </p> <hr> <p><em>(<strong>Note:</strong> This is meant to be a clean, canonical dupetarget for the <strong>specific</strong> issue with arrow functions above.)</em></p>
0debug
CREATING VIEW WITH SELECT QUERY HAVING SUB QUERIES : CREATE OR REPLACE VIEW SAMPLE_VIEW(MISSION_ID,"ESMP TRACK NO","RFPS TRACK NO","RADAR ID") AS SELECT ESMP.MISSION_ID,ESMP.TRACK_NO,RFPS.RFPS_TRK_NO,(SELECT RADAR_ID FROM MATCHED_TT_DETAILS TT1 WHERE TT1.MISSION_ID = ESMP.MISSION_ID AND TT1.TRACK_NO = ESMP.TRACK_NO) FROM ESMP_DETAILS ESMP,RFPS_DETAILS RFPS WHERE ESMP.MISSION_ID = RFPS.MISSION_ID AND ESMP.TRACK_NO = RFPS.ESMP_TRACK_NO; I have created above view and i'm getting error. ESMP_DETAILS table =================== MISSION_ID TRACK_NO A 4 B 5 C 6 RFPS_DETAILS TABLE ================== MISSION_ID RFPS_TRK_NO A 77 B 88 MATCHED_TT_DETAILS TABLE ======================== MISSION_ID RADAR_ID A 5 A 6 B 4 I WANT OUTPUT LIKE BELOW IN VIEW ======================== MISSION_ID TRACK_NO RFPS_TRK_NO RADAR_ID A 4 77 5 A 4 77 6 B 5 88 4
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
11.1*9 = 99.89999999999999 : <p>I am using javascript to calculate a basket total for a simple html5 application. But javascript giving me wrong result in mobile and pc side. </p> <p>Tested in Safari and Chrome in Mac and Chrome in Android. </p> <p>For example: 9.1*9= 81.89999999999999 11.1*9= 99.89999999999999</p> <p>What can i do :D</p>
0debug
static int encode_init(AVCodecContext *avctx) { HYuvContext *s = avctx->priv_data; int i, j, width, height; s->avctx= avctx; s->flags= avctx->flags; dsputil_init(&s->dsp, avctx); width= s->width= avctx->width; height= s->height= avctx->height; assert(width && height); avctx->extradata= av_mallocz(1024*30); avctx->stats_out= av_mallocz(1024*30); s->version=2; avctx->coded_frame= &s->picture; switch(avctx->pix_fmt){ case PIX_FMT_YUV420P: s->bitstream_bpp= 12; break; case PIX_FMT_YUV422P: s->bitstream_bpp= 16; break; default: av_log(avctx, AV_LOG_ERROR, "format not supported\n"); return -1; } avctx->bits_per_sample= s->bitstream_bpp; s->decorrelate= s->bitstream_bpp >= 24; s->predictor= avctx->prediction_method; s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0; if(avctx->context_model==1){ s->context= avctx->context_model; if(s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with 2 pass huffyuv encoding\n"); return -1; } }else s->context= 0; if(avctx->codec->id==CODEC_ID_HUFFYUV){ if(avctx->pix_fmt==PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n"); return -1; } if(avctx->context_model){ av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported by huffyuv; use vcodec=ffvhuff\n"); return -1; } if(s->interlaced != ( height > 288 )) av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n"); }else if(avctx->strict_std_compliance>=0){ av_log(avctx, AV_LOG_ERROR, "This codec is under development; files encoded with it may not be decodeable with future versions!!! Set vstrict=-1 to use it anyway.\n"); return -1; } ((uint8_t*)avctx->extradata)[0]= s->predictor; ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp; ((uint8_t*)avctx->extradata)[2]= 0x20 | (s->interlaced ? 0x10 : 0); if(s->context) ((uint8_t*)avctx->extradata)[2]|= 0x40; ((uint8_t*)avctx->extradata)[3]= 0; s->avctx->extradata_size= 4; if(avctx->stats_in){ char *p= avctx->stats_in; for(i=0; i<3; i++) for(j=0; j<256; j++) s->stats[i][j]= 1; for(;;){ for(i=0; i<3; i++){ char *next; for(j=0; j<256; j++){ s->stats[i][j]+= strtol(p, &next, 0); if(next==p) return -1; p=next; } } if(p[0]==0 || p[1]==0 || p[2]==0) break; } }else{ for(i=0; i<3; i++) for(j=0; j<256; j++){ int d= FFMIN(j, 256-j); s->stats[i][j]= 100000000/(d+1); } } for(i=0; i<3; i++){ generate_len_table(s->len[i], s->stats[i], 256); if(generate_bits_table(s->bits[i], s->len[i])<0){ return -1; } s->avctx->extradata_size+= store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]); } if(s->context){ for(i=0; i<3; i++){ int pels = width*height / (i?40:10); for(j=0; j<256; j++){ int d= FFMIN(j, 256-j); s->stats[i][j]= pels/(d+1); } } }else{ for(i=0; i<3; i++) for(j=0; j<256; j++) s->stats[i][j]= 0; } s->picture_number=0; return 0; }
1threat
How to use logic operators in jinja template on salt-stack (AND, OR) : <p>I am using a jinja template to generate a state file for salt. I added some conditionals and would like to express: <code>if A or B</code>. However, it seems I cannot get any logical operator working.</p> <p>It doesn't like <code>||, |, &amp;&amp;</code>(which I understand doesn't apply here), but also not <code>and, or</code> and not even grouping with <code>()</code>, which should be working according to the <a href="http://jinja.pocoo.org/docs/2.9/templates/#logic" rel="noreferrer">jinja documentation</a>. I couldn't find any information on this in the salt docs, but I feel I must be making some stupid mistake?</p> <p>My code:</p> <pre><code>{% if grains['configvar'] == 'value' OR grains['configvar'] == 'some other value' %} </code></pre> <p>Error:</p> <pre><code>Data failed to compile: Rendering SLS 'base:mystate' failed: Jinja syntax error: expected token 'end of statement block', got 'OR'; line 3 </code></pre>
0debug
Infinite loop in C, codeblock : <p>Here is my code. </p> <pre><code>#include&lt;stdio.h&gt; main() { float H,U,D,F; int x=0,i=0; scanf("%f %f %f %f",&amp;H,&amp;U,&amp;D,&amp;F); while(H&gt;x){ x=x+U-D; U=U-(F/100*U); i++; printf("%d\t%d\t%2lf\t%2lf\t%2lf\n",i,x,U,D,F); } printf("%d",i); } </code></pre> <p>It has fallen in an infinite loop. What's the problem here?</p>
0debug
vpn server and client (possibly) on the same machine : what i'm trying to achieve is: - connect to a vpn as client and route all my internal network's traffic over the vpn - run a vpn server, so that people from outside can connect to my internal network and get routed over the a.m. vpn client i'm trying to achieve that with a router running dd-wrt (netgear D6200), and / or a raspberry pi. can someone tell me if this can be achieved, and if, direct me to what would be a possible solution? (i'm not looking for a tutorial, just a direction). thanks!
0debug
CSS hide scroll bar, but have element scrollable : <p>I have this element called items and the content inside the element is longer than the element height, I want to make it scrollable but hide the scroll bar, how would I do that?</p> <pre><code>&lt;div class="left-side"&gt; &lt;div class="items" style="display:block;width: 94%;margin: 0 auto;overflow: hidden;"&gt; &lt;/div&gt; &lt;/div&gt; .left-side { width: 1470px; padding-top: 20px; height: 878px; } </code></pre> <p>I tried setting the left-side class overflow to auto, but that didn't do anything.</p>
0debug
Can't update or install package: An item with the same key has already been added : <h3>Problem</h3> <p>In a particular project, I can't update or install any NuGet packages. When I try to do so using the NuGet GUI, it does some work and then stops without saying anything. When I try to do so using the package manager console, I get this output:</p> <pre><code>PM&gt; Update-Package –reinstall EntityFramework Attempting to gather dependencies information for multiple packages with respect to project 'SmartCentre', targeting '.NETFramework,Version=v4.5.2' Update-Package : An item with the same key has already been added. At line:1 char:15 + Update-Package &lt;&lt;&lt;&lt; –reinstall EntityFramework + CategoryInfo : NotSpecified: (:) [Update-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand </code></pre> <h3>Environment</h3> <ul> <li>Visual Studio Professional 2015 Update 1</li> <li>NuGet 3.3.0.167</li> </ul> <h3>What I've tried</h3> <ul> <li>Deleting the <code>packages</code> folder</li> <li>Restarting Visual Studio</li> <li>Restarting the computer</li> </ul>
0debug
How to put the name of the file in advance when uploading? : I want to save the uploaded file with "1.jpg" name. If it already exists in the "upload" folder, save with "2.jpg", and if file "2.jpg" already exists in the "upload" folder, Wait until the another script clears one of them. If, after some time (about 120 seconds), none of the two files was erased, it will display an error message. What code should I use?
0debug
Update multiple rows in sql server 9.0.5000 : I'mk currently creating a script automatically with a program that copies files from one place to another, and I used to do the following: UPDATE d SET Path= t.Path FROM dbo.tableOperation d JOIN ( VALUES (1,'Path 1'), (2,'Path 2') ) t (IdRegister, Path) ON t.IdRegister = d.IdRegister And on the version of SQL server (10.50.1600) it was working fine, but I found some issues when trying to execute the script on the server I have to update the data (9.0.50000). I have to update tenths of thousands rows at a time, how can I do it?
0debug
void HELPER(ove)(CPUOpenRISCState *env, target_ulong test) { if (unlikely(test)) { OpenRISCCPU *cpu = openrisc_env_get_cpu(env); CPUState *cs = CPU(cpu); cs->exception_index = EXCP_RANGE; cpu_loop_exit_restore(cs, GETPC()); } }
1threat
Showing Legend on the side of graph : <p>I plotted a graph and the legend is showing right on top of the graph there by hiding the graph. </p> <p>How can I show it on the side. </p> <p>Here is the code I wrote</p> <pre><code>############################################################################## # Plot ROC curves for the multiclass problem # Compute macro-average ROC curve and ROC area # First aggregate all false positive rates all_fpr = np.unique(np.concatenate([fpr[i] for i in range(n_classes)])) # Then interpolate all ROC curves at this points mean_tpr = np.zeros_like(all_fpr) for i in range(n_classes): mean_tpr += interp(all_fpr, fpr[i], tpr[i]) # Finally average it and compute AUC mean_tpr /= n_classes fpr["macro"] = all_fpr tpr["macro"] = mean_tpr roc_auc["macro"] = auc(fpr["macro"], tpr["macro"]) # Plot all ROC curves plt.figure() plt.plot(fpr["micro"], tpr["micro"], label='micro-average ROC curve (area = {0:0.2f})' ''.format(roc_auc["micro"]), linewidth=2) plt.plot(fpr["macro"], tpr["macro"], label='macro-average ROC curve (area = {0:0.2f})' ''.format(roc_auc["macro"]), linewidth=2) for i in range(n_classes): plt.plot(fpr[i], tpr[i], label='AUC class {0} (area = {1:0.2f})' ''.format(i, roc_auc[i])) plt.plot([0, 1], [0, 1], 'k--') plt.xlim([0.0, 1.0]) plt.ylim([0.0, 1.05]) plt.xlabel('False Positive Rate') plt.ylabel('True Positive Rate') plt.title('Multi-Class ROC Curve of '+name) plt.legend(loc="lower right") </code></pre> <p>And here is the image I got. </p> <p><a href="https://i.stack.imgur.com/I1yfn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I1yfn.png" alt="enter image description here"></a></p>
0debug
pandas series,isnull() is not working inside list comprehension : <p>for the following simple code:</p> <pre><code>drop_cols = [col for col in train.columns if col[0] == 'V' and train[col].isnulll().sum()/len(train) &gt; 0.76] drop_cols </code></pre> <p>I get this error:</p> <blockquote> <p>AttributeError Traceback (most recent call last) in () ----> 1 drop_cols = [col for col in train.columns if col[0] == 'V' and train[col].isnulll().sum()/len(train) > 0.76] 2 drop_cols</p> <p> in (.0) ----> 1 drop_cols = [col for col in train.columns if col[0] == 'V' and train[col].isnulll().sum()/len(train) > 0.76] 2 drop_cols</p> <p>C:\Anaconda3\lib\site-packages\pandas\core\generic.py in <strong>getattr</strong>(self, name) 5065 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5066<br> return self[name] -> 5067 return object.<strong>getattribute</strong>(self, name) 5068 5069 def <strong>setattr</strong>(self, name, value):</p> <p>AttributeError: 'Series' object has no attribute 'isnulll'</p> </blockquote> <p>isnull() is working elsewhere. What is the cause and fix for this?</p>
0debug