problem
stringlengths
26
131k
labels
class label
2 classes
why my code is always giving the same result i.e ' the string is not a palindrome' : <p>my code always give the same result i.e. 'the string is not a palindrome' why is this happening? but the reversing of string is working properly</p> <pre><code>original = input('enter string: ') index = len(original) - 1 reverse_string =" " while index &gt;= 0 : reverse_string += original[index] index = index - 1 print('reverse string:', reverse_string) if (reverse_string == original): print("it's a palindrome:") else: print("it's not a palindrome:") </code></pre>
0debug
static void virtio_gpu_resource_destroy(VirtIOGPU *g, struct virtio_gpu_simple_resource *res) { pixman_image_unref(res->image); QTAILQ_REMOVE(&g->reslist, res, next); g->hostmem -= res->hostmem; g_free(res); }
1threat
How to fix the TypeError (list indices must be interger) in this program? : In one of the program I am using, I am getting a `TypeError` when trying to mine/parse a value out of `dict type` data. Error Type: <type 'exceptions.TypeError'> Error Value: list indices must be integers, not str I tried to print the values of that dict (by adding a print statement) to see what was the issue. Below is a brief part of that python program: for c in results: print('value of c : ', c, type(c)) # what I added to see the issue with dict data for ci, lr in c['chain_info'].iteritems(): outfile = open(lr.output_file, 'a') write = outfile.write if lr.number_vcf_lines > 0: write(CHAIN_STRING.format(CHAIN_STRING, from_chr=int(c['chrom']), from_length=lr.chromosome_length, from_start=0, from_end=lr.chromosome_length, to_chr=c['chrom'], to_length=lr.end_length, to_start=0, to_end=lr.sums[0] + lr.last_fragment_size + lr.sums[2], id=c['chrom'])) write("\n") print('value of c : ', c, type(c)) # gave me ('value of c : ', {'chrom': '1', 'stats': OrderedDict([('ACCEPTED', 0)]), 'chain_info': {'right': <g2gtools.vcf2chain.VCFtoChainInfo object at 0x7fe9de396dd0>, 'left': <g2gtools.vcf2chain.VCFtoChainInfo object at 0x7fe9d9252d50>}}, <type 'dict'>) What is the problem with this data/program??
0debug
static void scsi_dma_restart_bh(void *opaque) { SCSIDiskState *s = opaque; SCSIRequest *req; SCSIDiskReq *r; qemu_bh_delete(s->bh); s->bh = NULL; QTAILQ_FOREACH(req, &s->qdev.requests, next) { r = DO_UPCAST(SCSIDiskReq, req, req); if (r->status & SCSI_REQ_STATUS_RETRY) { int status = r->status; int ret; r->status &= ~(SCSI_REQ_STATUS_RETRY | SCSI_REQ_STATUS_RETRY_TYPE_MASK); switch (status & SCSI_REQ_STATUS_RETRY_TYPE_MASK) { case SCSI_REQ_STATUS_RETRY_READ: scsi_read_data(&r->req); break; case SCSI_REQ_STATUS_RETRY_WRITE: scsi_write_data(&r->req); break; case SCSI_REQ_STATUS_RETRY_FLUSH: ret = scsi_disk_emulate_command(r, r->iov.iov_base); if (ret == 0) { scsi_command_complete(r, GOOD, NO_SENSE); } } } } }
1threat
how to create mysql dynamc pivot rows to colum : please am in need of urgent help from anyone who can solve this. SELECT DISTINCT _2_12_company.companyInitials, _2_05_comptype.typeInitials FROM _2_12_company, _2_05_comptype, _2_19_companycomptype WHERE _2_12_company.id = _2_19_companycomptype.companyID AND _2_05_comptype.id = _2_19_companycomptype.typeID and here is the result AMAZON | MICROSOFT AMAZON | FACEBOOK AMAZON | ALI EXPRESS but i whant the result to be like below in a dynamic fashion AMAZON | MICROSOFT/FACEBOOK/ALI EXPRESS
0debug
Why is statically linking glibc discouraged? : <p>Most of the sources online state that you can statically link glibc, but discourage from doing so; e.g. <a href="https://centos.pkgs.org/7/centos-updates-x86_64/glibc-static-2.17-260.el7_6.4.x86_64.rpm.html" rel="noreferrer">centos package repo</a>:</p> <pre><code>The glibc-static package contains the C library static libraries for -static linking. You don't need these, unless you link statically, which is highly discouraged. </code></pre> <p>These sources rarely (or never) say why that would be a bad idea.</p>
0debug
How can I find the highest and lowest values in a list? : <p>I have a code that looks something like this for school:</p> <pre><code> print ("Couple A Results") coupleA = [] judges = 5 while len(coupleA) &lt; judges: judge1 = input("Input Scores For Couple A in round 1: ") judge2 = input("Input Scores For Couple A in round 1: ") judge3 = input("Input Scores For Couple A in round 1: ") judge4 = input("Input Scores For Couple A in round 1: ") judge5 = input("Input Scores For Couple A in round 1: ") coupleA.append(judge1) coupleA.append(judge2) coupleA.append(judge3) coupleA.append(judge4) coupleA.append(judge5) print coupleA print ("\nThese are the scores for couple A:") print coupleA </code></pre> <p>I would like a separate piece of code to pull out the highest and lowest values from the list that had been inputted, and add the values in between. does anyone know how i would do this? Thanks </p>
0debug
how do I centralize (center) a navigation bar? : ``` <div class="topnav" align="middle"> <a href="http://actividad.csjpr.xyz>Actividad</a> <a href="http://clase.csjpr.xyz">Clase</a> <a href="http://club.csjpr.xyz">Club</a> <a href="http://comite.csjpr.xyz">Comite</a> <a href="htt://competencia.csjpr.xyz">Competencia</a> <a href="http://deporte.csjpr.xyz">Deporte</a> <a href="http://oficina.csjpr.xyz">Oficina</a> <a href="http://organizacion.csjpr.xyz">Organización</a> <a href="http://programa.csjpr.xyz">Programa</a> ``` **This is what I currently have. I'd like to centralize it because it is automatically appearing on the left. Thank you.**
0debug
ASP.NET Identity - custom UserManager, UserStore : <p>I am a bit confused with customizing UserManager and UserStore. Out of the box solution comes with EF implementation and i don't want to use EF but my own DAL that uses MSSQL. I want to have Claims based security where one of the users Claims will be roles.</p> <p>What i am confused with is the overall process i should do. From what i undestand so far is that i need to make my own</p> <pre><code>CustomApplicationUser : IUser CustomUserManager : UserManager&lt;CustomApplicationUser&gt; CustomUserStore : IUserStore, IUserClaimStore </code></pre> <p>Questions:</p> <ol> <li>Am i on the right track with this?</li> <li>I want to use IsInRole() method on my CustomUserManager but not sure how to do it with Claims. I am aware there is IUserRoleStore.IsInRole() which default UserManager calls in UserManager.IsInRole() but i don't want separate Roles table in my DB. What i want is Claims DB table with one of ClaimType being Role and that UserManager.IsInRole() uses that. Now, i am not evet sure why would i ever need UserManager.IsInRole() method? Would i actually need to have something like custom ClaimsIdentity SignInManager.CreateUserIdentityAsync() and within that one call my own implementation of filling in all users info including Claims?</li> </ol> <p>It seems a bit confusing for me and i can't seem to find some clear documentation about it so if anyone could shed a bit of light on it i would highly appreciate it!</p>
0debug
import re pattern = 'fox' text = 'The quick brown fox jumps over the lazy dog.' def find_literals(text, pattern): match = re.search(pattern, text) s = match.start() e = match.end() return (match.re.pattern, s, e)
0debug
variable length data types inside a buffer in C : <p>What would be the easiest way to handle serialization of data of variable number of bits put into a uint8 buffer?</p> <p>For example, the first 4 bits are one variable, then 1 bit is a boolean, another one is 3 bits long. Then you have an array of 8 bytes, and then a 13 bit variable and so on. All this would be written into an unsigned char buffer to be sent over a socket.</p> <p>The variables data types are sometimes not aligning on 8 bit -16 bit boundaries, they have weird # of bits like 7 bits long, 13 bits long, 3 bits long, etc.</p> <p>Would it best to write something in C for this, or to use a third party library?</p>
0debug
How to create one vertical column in between rows in Flexbox : <p><a href="https://i.stack.imgur.com/7VcfC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7VcfC.png" alt="enter image description here"></a></p> <p>Is there is a way to create this style with Flexbox? </p>
0debug
How to range array in golang to not randomize predetermined key? : <p>I have a trouble with my current golang's project.</p> <p>I have another package in go that result an array with pretedermined key, example :</p> <pre><code>package updaters var CustomSql map[string]string func InitSqlUpdater() { CustomSql = map[string]string{ "ShouldBeFirst": "Text Should Be First", "ShouldBeSecond": "Text Should Be Second", "ShouldBeThird": "Text Should Be Third", "ShouldBeFourth": "Text Should Be Fourth" } } </code></pre> <p>And send it to main.go, to iterate each index and value, but the results is random (In my situation, I need that in sequence).</p> <p>Real Case : <a href="https://play.golang.org/p/ONXEiAj-Q4v" rel="nofollow noreferrer">https://play.golang.org/p/ONXEiAj-Q4v</a></p> <p>I google why the golangs iterate in random way, and the example is using sort, but my array keys is predetermined, and sort is only for asc desc alphabet and number.</p> <p>So, How can I achieve the way that arrays is not being randomize in iterate?</p> <pre><code>ShouldBeFirst = Text Should Be First ShouldBeSecond = Text Should Be Second ShouldBeThird = Text Should Be Third ShouldBeFourth = Text Should Be Fourth </code></pre> <p>Anyhelp will appreciate, thanks.</p>
0debug
How to Add, Delete new Columns in Sequelize CLI : <p>I've just started using Sequelize and Sequelize CLI</p> <p>Since it's a development time, there are a frequent addition and deletion of columns. What the best the method to add a new column to an existing model?</p> <p>For example, I want to a new column '<strong>completed</strong>' to <strong>Todo</strong> model. I'll add this column to models/todo.js. Whats the next step?</p> <p>I tried <code>sequelize db:migrate</code></p> <p>not working: <em>"No migrations were executed, database schema was already up to date."</em></p>
0debug
static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, uint8_t *buf, int lun) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d); uint64_t nb_sectors; uint64_t lba; uint32_t len; int cmdlen; int is_write; uint8_t command; uint8_t *outbuf; SCSIRequest *r; command = buf[0]; r = scsi_find_request(s, tag); if (r) { BADF("Tag 0x%x already in use\n", tag); scsi_cancel_io(d, tag); } r = scsi_new_request(d, tag); outbuf = (uint8_t *)r->iov.iov_base; is_write = 0; DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, tag, buf[0]); switch (command >> 5) { case 0: lba = (uint64_t) buf[3] | ((uint64_t) buf[2] << 8) | (((uint64_t) buf[1] & 0x1f) << 16); len = buf[4]; cmdlen = 6; break; case 1: case 2: lba = (uint64_t) buf[5] | ((uint64_t) buf[4] << 8) | ((uint64_t) buf[3] << 16) | ((uint64_t) buf[2] << 24); len = buf[8] | (buf[7] << 8); cmdlen = 10; break; case 4: lba = (uint64_t) buf[9] | ((uint64_t) buf[8] << 8) | ((uint64_t) buf[7] << 16) | ((uint64_t) buf[6] << 24) | ((uint64_t) buf[5] << 32) | ((uint64_t) buf[4] << 40) | ((uint64_t) buf[3] << 48) | ((uint64_t) buf[2] << 56); len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24); cmdlen = 16; break; case 5: lba = (uint64_t) buf[5] | ((uint64_t) buf[4] << 8) | ((uint64_t) buf[3] << 16) | ((uint64_t) buf[2] << 24); len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24); cmdlen = 12; break; default: BADF("Unsupported command length, command %x\n", command); goto fail; } #ifdef DEBUG_SCSI { int i; for (i = 1; i < cmdlen; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif if (lun || buf[1] >> 5) { DPRINTF("Unimplemented LUN %d\n", lun ? lun : buf[1] >> 5); if (command != 0x03 && command != 0x12) goto fail; } switch (command) { case 0x0: DPRINTF("Test Unit Ready\n"); if (!bdrv_is_inserted(s->dinfo->bdrv)) goto notready; break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(outbuf, 0, 4); r->iov.iov_len = 4; if (s->sense == SENSE_NOT_READY && len >= 18) { memset(outbuf, 0, 18); r->iov.iov_len = 18; outbuf[7] = 10; outbuf[12] = 0x3a; outbuf[13] = 0; } outbuf[0] = 0xf0; outbuf[1] = 0; outbuf[2] = s->sense; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); if (buf[1] & 0x2) { BADF("optional INQUIRY command support request not implemented\n"); goto fail; } else if (buf[1] & 0x1) { uint8_t page_code = buf[2]; if (len < 4) { BADF("Error: Inquiry (EVPD[%02X]) buffer size %d is " "less than 4\n", page_code, len); goto fail; } switch (page_code) { case 0x00: { DPRINTF("Inquiry EVPD[Supported pages] " "buffer size %d\n", len); r->iov.iov_len = 0; if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->iov.iov_len++] = 5; } else { outbuf[r->iov.iov_len++] = 0; } outbuf[r->iov.iov_len++] = 0x00; outbuf[r->iov.iov_len++] = 0x00; outbuf[r->iov.iov_len++] = 3; outbuf[r->iov.iov_len++] = 0x00; outbuf[r->iov.iov_len++] = 0x80; outbuf[r->iov.iov_len++] = 0x83; } break; case 0x80: { int l; if (len < 4) { BADF("Error: EVPD[Serial number] Inquiry buffer " "size %d too small, %d needed\n", len, 4); goto fail; } DPRINTF("Inquiry EVPD[Serial number] buffer size %d\n", len); l = MIN(len, strlen(s->drive_serial_str)); r->iov.iov_len = 0; if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->iov.iov_len++] = 5; } else { outbuf[r->iov.iov_len++] = 0; } outbuf[r->iov.iov_len++] = 0x80; outbuf[r->iov.iov_len++] = 0x00; outbuf[r->iov.iov_len++] = l; memcpy(&outbuf[r->iov.iov_len], s->drive_serial_str, l); r->iov.iov_len += l; } break; case 0x83: { int max_len = 255 - 8; int id_len = strlen(bdrv_get_device_name(s->dinfo->bdrv)); if (id_len > max_len) id_len = max_len; DPRINTF("Inquiry EVPD[Device identification] " "buffer size %d\n", len); r->iov.iov_len = 0; if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->iov.iov_len++] = 5; } else { outbuf[r->iov.iov_len++] = 0; } outbuf[r->iov.iov_len++] = 0x83; outbuf[r->iov.iov_len++] = 0x00; outbuf[r->iov.iov_len++] = 3 + id_len; outbuf[r->iov.iov_len++] = 0x2; outbuf[r->iov.iov_len++] = 0; outbuf[r->iov.iov_len++] = 0; outbuf[r->iov.iov_len++] = id_len; memcpy(&outbuf[r->iov.iov_len], bdrv_get_device_name(s->dinfo->bdrv), id_len); r->iov.iov_len += id_len; } break; default: BADF("Error: unsupported Inquiry (EVPD[%02X]) " "buffer size %d\n", page_code, len); goto fail; } break; } else { if (buf[2] != 0) { BADF("Error: Inquiry (STANDARD) page or code " "is non-zero [%02X]\n", buf[2]); goto fail; } if (len < 5) { BADF("Error: Inquiry (STANDARD) buffer size %d " "is less than 5\n", len); goto fail; } if (len < 36) { BADF("Error: Inquiry (STANDARD) buffer size %d " "is less than 36 (TODO: only 5 required)\n", len); } } if(len > SCSI_MAX_INQUIRY_LEN) len = SCSI_MAX_INQUIRY_LEN; memset(outbuf, 0, len); if (lun || buf[1] >> 5) { outbuf[0] = 0x7f; } else if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { outbuf[0] = 5; outbuf[1] = 0x80; memcpy(&outbuf[16], "QEMU CD-ROM ", 16); } else { outbuf[0] = 0; memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); memcpy(&outbuf[32], QEMU_VERSION, 4); outbuf[2] = 3; outbuf[3] = 2; outbuf[4] = len - 5; outbuf[7] = 0x10 | (r->bus->tcq ? 0x02 : 0); r->iov.iov_len = len; break; case 0x16: DPRINTF("Reserve(6)\n"); if (buf[1] & 1) goto fail; break; case 0x17: DPRINTF("Release(6)\n"); if (buf[1] & 1) goto fail; break; case 0x1a: case 0x5a: { uint8_t *p; int page; page = buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %d)\n", page, len); p = outbuf; memset(p, 0, 4); outbuf[1] = 0; outbuf[3] = 0; if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM) { outbuf[2] = 0x80; } p += 4; if (page == 4) { int cylinders, heads, secs; p[0] = 4; p[1] = 0x16; bdrv_get_geometry_hint(s->dinfo->bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = 0; p[13] = 200; p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; p += 0x16; } else if (page == 5) { int cylinders, heads, secs; p[0] = 5; p[1] = 0x1e; p[2] = 5000 >> 8; p[3] = 5000 & 0xff; bdrv_get_geometry_hint(s->dinfo->bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; p[14] = 0; p[15] = 1; p[16] = 1; p[17] = 0; p[18] = 1; p[19] = 1; p[20] = 1; p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; p += 0x1e; } else if ((page == 8 || page == 0x3f)) { memset(p,0,20); p[0] = 8; p[1] = 0x12; if (bdrv_enable_write_cache(s->dinfo->bdrv)) { p[2] = 4; } p += 20; } if ((page == 0x3f || page == 0x2a) && (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM)) { p[0] = 0x2a; p[1] = 0x14; p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (bdrv_is_locked(s->dinfo->bdrv)? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; p += 22; } r->iov.iov_len = p - outbuf; outbuf[0] = r->iov.iov_len - 4; if (r->iov.iov_len > len) r->iov.iov_len = len; } break; case 0x1b: DPRINTF("Start Stop Unit\n"); if (bdrv_get_type_hint(s->dinfo->bdrv) == BDRV_TYPE_CDROM && (buf[4] & 2)) bdrv_eject(s->dinfo->bdrv, !(buf[4] & 1)); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->dinfo->bdrv, buf[4] & 1); break; case 0x25: DPRINTF("Read Capacity\n"); memset(outbuf, 0, 8); bdrv_get_geometry(s->dinfo->bdrv, &nb_sectors); nb_sectors /= s->cluster_size; if (nb_sectors) { nb_sectors--; s->max_lba = nb_sectors; if (nb_sectors > UINT32_MAX) nb_sectors = UINT32_MAX; outbuf[0] = (nb_sectors >> 24) & 0xff; outbuf[1] = (nb_sectors >> 16) & 0xff; outbuf[2] = (nb_sectors >> 8) & 0xff; outbuf[3] = nb_sectors & 0xff; outbuf[4] = 0; outbuf[5] = 0; outbuf[6] = s->cluster_size * 2; outbuf[7] = 0; r->iov.iov_len = 8; } else { notready: scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_NOT_READY); return 0; } break; case 0x08: case 0x28: case 0x88: DPRINTF("Read (sector %" PRId64 ", count %d)\n", lba, len); if (lba > s->max_lba) goto illegal_lba; r->sector = lba * s->cluster_size; r->sector_count = len * s->cluster_size; break; case 0x0a: case 0x2a: case 0x8a: DPRINTF("Write (sector %" PRId64 ", count %d)\n", lba, len); if (lba > s->max_lba) goto illegal_lba; r->sector = lba * s->cluster_size; r->sector_count = len * s->cluster_size; is_write = 1; break; case 0x35: DPRINTF("Synchronise cache (sector %" PRId64 ", count %d)\n", lba, len); bdrv_flush(s->dinfo->bdrv); break; case 0x43: { int start_track, format, msf, toclen; msf = buf[1] & 2; format = buf[2] & 0xf; start_track = buf[6]; bdrv_get_geometry(s->dinfo->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1); nb_sectors /= s->cluster_size; switch(format) { case 0: toclen = cdrom_read_toc(nb_sectors, outbuf, msf, start_track); break; case 1: toclen = 12; memset(outbuf, 0, 12); outbuf[1] = 0x0a; outbuf[2] = 0x01; outbuf[3] = 0x01; break; case 2: toclen = cdrom_read_toc_raw(nb_sectors, outbuf, msf, start_track); break; default: goto error_cmd; } if (toclen > 0) { if (len > toclen) len = toclen; r->iov.iov_len = len; break; } error_cmd: DPRINTF("Read TOC error\n"); goto fail; } case 0x46: DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len); memset(outbuf, 0, 8); outbuf[7] = 8; r->iov.iov_len = 8; break; case 0x56: DPRINTF("Reserve(10)\n"); if (buf[1] & 3) goto fail; break; case 0x57: DPRINTF("Release(10)\n"); if (buf[1] & 3) goto fail; break; case 0x9e: if ((buf[1] & 31) == 0x10) { DPRINTF("SAI READ CAPACITY(16)\n"); memset(outbuf, 0, len); bdrv_get_geometry(s->dinfo->bdrv, &nb_sectors); nb_sectors /= s->cluster_size; if (nb_sectors) { nb_sectors--; s->max_lba = nb_sectors; outbuf[0] = (nb_sectors >> 56) & 0xff; outbuf[1] = (nb_sectors >> 48) & 0xff; outbuf[2] = (nb_sectors >> 40) & 0xff; outbuf[3] = (nb_sectors >> 32) & 0xff; outbuf[4] = (nb_sectors >> 24) & 0xff; outbuf[5] = (nb_sectors >> 16) & 0xff; outbuf[6] = (nb_sectors >> 8) & 0xff; outbuf[7] = nb_sectors & 0xff; outbuf[8] = 0; outbuf[9] = 0; outbuf[10] = s->cluster_size * 2; outbuf[11] = 0; r->iov.iov_len = len; } else { scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_NOT_READY); return 0; } break; } DPRINTF("Unsupported Service Action In\n"); goto fail; case 0xa0: DPRINTF("Report LUNs (len %d)\n", len); if (len < 16) goto fail; memset(outbuf, 0, 16); outbuf[3] = 8; r->iov.iov_len = 16; break; case 0x2f: DPRINTF("Verify (sector %" PRId64 ", count %d)\n", lba, len); break; default: DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]); fail: scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_ILLEGAL_REQUEST); return 0; illegal_lba: scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_HARDWARE_ERROR); return 0; } if (r->sector_count == 0 && r->iov.iov_len == 0) { scsi_command_complete(r, STATUS_GOOD, SENSE_NO_SENSE); } len = r->sector_count * 512 + r->iov.iov_len; if (is_write) { return -len; } else { if (!r->sector_count) r->sector_count = -1; return len; } }
1threat
static uint64_t unassigned_mem_read(void *opaque, hwaddr addr, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem read " TARGET_FMT_plx "\n", addr); #endif if (current_cpu != NULL) { cpu_unassigned_access(current_cpu, addr, false, false, 0, size); } return -1ULL; }
1threat
How to prevent a product on WooCommerce from being indexed by Google? : <p>I'm referring to specific product not all products. I've googled and can't find any answer to this.</p>
0debug
how do i grep the output from first grep of the date : This is what I have find /tttt/aaaa/bbb -type f -mtime -1 -mtime 0 -print0| xargs -0 grep -l "abc" I would like to find the output that also contains "def"
0debug
how to filter the existing month into next month : i have a code : SELECT pegawai.Nama, pegawai.Tempat_Lahir, pegawai.Tanggal_lahir, pegawai.NIP, pegawai.Tingkat_Ijasah, pegawai.Jurusan, pegawai.Golongan_CPNS,pegawai.TMT_CPNS, pegawai.Alamat, pensiun.TMT_Pensiun, pensiun.SKPensiun from pegawai JOIN pensiun on pegawai.NIP=pensiun.NIP) WHERE (MONTH(CONVERT(Date, Month)) = MONTH(GETDATE()) + 1)) AS pensiun.TMT_Pensiun months in the filter is TMT_Pensiun
0debug
static int megasas_dcmd_set_properties(MegasasState *s, MegasasCmd *cmd) { struct mfi_ctrl_props info; size_t dcmd_size = sizeof(info); if (cmd->iov_size < dcmd_size) { trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size, dcmd_size); return MFI_STAT_INVALID_PARAMETER; } dma_buf_write((uint8_t *)&info, cmd->iov_size, &cmd->qsg); trace_megasas_dcmd_unsupported(cmd->index, cmd->iov_size); return MFI_STAT_OK; }
1threat
Scanf Didn't work : <p>In my code second scanf doesn't work and couldn't read the character. How can I solve that ?</p> <pre><code>#include &lt;stdio.h&gt; int main() { int a, result; // ***************** Menu ******************* printf("Hello !!! \n The Operations That This Calculator Can Do :"); printf("\n1. Simple Operations"); printf("\n2. Calculate The Biggest Number"); printf("\n3. Taylor expansion"); printf("\n4. Sum Digits Of a Number"); printf("\n5. Found The Prime Numbers Before The Number That You Entered"); printf("\nEnter The Number Of Operation That You Want : "); scanf_s("%d", &amp;a); if (a == 1){ char ch; int num1, num2; printf("\n Please Enter Your Operation Like That (- 5 3 ) : "); scanf_s("%c", &amp;ch); if (ch == '-'){ scanf_s("%d", &amp;num1); scanf_s("%d", &amp;num2); result = num1 - num2; printf("\n &gt; %d", result); } if (ch == '+'){ scanf_s("%d", &amp;num1); scanf_s("%d", &amp;num2); result = num1 + num2; printf("\n &gt; %d", result); } } return 0; } </code></pre>
0debug
Find duplicate images algorithm : <p>I want to create a program that find the duplicate images into a directory, something like <a href="https://profesionalsoftware.com/image-cleaner-duplicate-photo-finder-and-remover/" rel="nofollow noreferrer">this app</a> does and I wonder what would be the algorithm to determine if two images are the same. Any suggestion is welcome.</p>
0debug
How to access object within a json object in angular 2+ : I am a beginner of angular. I tried to access this json object using console.log(this.selected[0].delivery.shipping_type); Selected is an array and i am trying to show the 0th element of selected.How to access shipping_type within delivery.console.log returns this error: Cannot read property 'shipping_type' of undefined. ``` selected[0]= {createdAt: "2019-09-20T01:47:27.291Z" delivery.address: "21 Woodlands Crossing, Singapore 738203" delivery.contact_no: "738203" delivery.postal_code: "738203" delivery.recepient: "Dhania" delivery.shipping_fee: 5 delivery.shipping_type: "regular" delivery.unit_no: "#03-07", __v: 0 _id: "5d842faf06f2a639183226c0"} ```
0debug
What's the correct way to have Singleton class in c# : <p>I am learning Singleton design pattern in C#, and I have written below code in two ways, and I want to know Which one is the right way to create a Singleton class:</p> <pre><code>public sealed class TranslationHelper { // first way private static readonly TranslationHelper translationHelper = new TranslationHelper(); // second way public static readonly TranslationHelper translationHelpers = new TranslationHelper(); // Direct call public static TranslationHelper GetTranslationHelper() { return translationHelper; } private TranslationHelper() { } } </code></pre> <p>CALL:</p> <pre><code>TranslationHelper instance = TranslationHelper.GetTranslationHelper(); TranslationHelper ins = TranslationHelper.translationHelpers; </code></pre> <p>I am beginner so I am not sure if both methods are same. Please guide me.</p>
0debug
Purpose of import this : <p>There is a well known Easter Egg in Python called <code>import this</code> that when added to your code will automatically output</p> <pre><code>The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! </code></pre> <p>So what exactly is the purpose of <code>this</code>?</p> <p>It also contains 4 variables:</p> <ul> <li><code>this.c</code> which contains the number <code>97</code></li> <li><code>this.s</code> which contains <code>The Zen of Python</code> encoded in <code>rot13</code></li> <li><code>this.i</code> which contains the number <code>25</code></li> <li><code>this.d</code> which contains the following dictionary: <code>{'G': 'T', 'z': 'm', 'C': 'P', 't': 'g', 'F': 'S', 'p': 'c', 'o': 'b', 'P': 'C', 'V': 'I', 'T': 'G', 'Q': 'D', 'W': 'J', 'R': 'E', 'i': 'v', 'M': 'Z', 'w': 'j', 'O': 'B', 'L': 'Y', 'n': 'a', 'd': 'q', 'D': 'Q', 'K': 'X', 'H': 'U', 'S': 'F', 'N': 'A', 'A': 'N', 'B': 'O', 'v': 'i', 'a': 'n', 'I': 'V', 'J': 'W', 'u': 'h', 'q': 'd', 'j': 'w', 'e': 'r', 'x': 'k', 's': 'f', 'X': 'K', 'E': 'R', 'm': 'z', 'h': 'u', 'g': 't', 'y': 'l', 'U': 'H', 'c': 'p', 'r': 'e', 'f': 's', 'l': 'y', 'b': 'o', 'Y': 'L', 'k': 'x', 'Z': 'M'}</code></li> </ul> <p>So what actually is the purpose of this (IMO) useless module? Has Guido Van Rossum ever said why he included it?</p>
0debug
int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options) { return avio_open2(pb, url, flags, int_cb, options); }
1threat
Why won't this Python 3.x function not work. : We just learned functions in class a couple days ago and I am not sure why this function won't run. It is basically identical to the functions that I did in class. def pay(hrs, rate, finalPay): hrs = int(input("Hours worked")) rate = float(input("Pay grade")) finalPay = (hrs * rate) if hrs > 40: finalPay = (((finalPay - 40) * 1.5) + finalPay) return finalPay print(pay) I get function pay at 0x109b5a6a8 in the terminal after I try to run it. If I try to list the parameters in the print function I get a traceback error stating said parameters are not defined. I am not sure what is going on here. All help is appreciated.
0debug
def max_product(arr): arr_len = len(arr) if (arr_len < 2): return None x = arr[0]; y = arr[1] for i in range(0, arr_len): for j in range(i + 1, arr_len): if (arr[i] * arr[j] > x * y): x = arr[i]; y = arr[j] return x,y
0debug
Passing boolean Vue prop value in HTML : <p>I am fairly new to Vue and have started with a project with <a href="https://github.com/vuejs/vue-cli" rel="noreferrer">vue-cli</a>.</p> <p>I am looking into conditional rendering based on a prop sent from parent.</p> <p><strong>Home.vue</strong> <em>(parent)</em></p> <pre><code>&lt;template&gt; &lt;Header have-banner="true" page-title="Home"&gt; &lt;/Header&gt; &lt;/template&gt; &lt;script&gt; import Header from "./Header"; export default { components: { Header, }, name: "Home", data() { return { header: "Hello Vue!", }; }, }; &lt;/script&gt; </code></pre> <p><strong>Header.vue</strong> <em>(child)</em></p> <pre><code>&lt;template&gt; &lt;header&gt; &lt;div v-if="haveBanner == 'true'"&gt; ... &lt;/div&gt; ... &lt;/header&gt; &lt;/template&gt; </code></pre> <p>I have looked at another <a href="https://vue-school.com/conditional-rendering#v-if-and-v-else" rel="noreferrer">conventional</a> way to achieve this but vue-cli renders templates differently.</p> <p>As passing the prop in the HTML markup, the prop <code>haveBanner</code> evaluates as a string and, therefore, even if I did:</p> <p><em>Parent</em></p> <pre><code>&lt;Header have-banner="false"&gt;&lt;/Header&gt; </code></pre> <p><em>Child</em></p> <pre><code>&lt;div v-if="haveBanner"`&gt; ... &lt;/div&gt; </code></pre> <p>That <code>&lt;div&gt;</code> would still display and, because of this, I am having to do an explicit check to see if it evaluates to <code>'true'</code>. I am not a fan of this due to possible issues with type coercion and I am thrown a warning with a type check (<code>===</code>) saying:</p> <blockquote> <p>Binary operation argument type string is not compatible with type string</p> </blockquote> <p>Is there a way to for either the child to evaluate this prop as a boolean or for the parent to pass it as a boolean in the markup?</p>
0debug
void nvdimm_acpi_hotplug(AcpiNVDIMMState *state) { nvdimm_build_fit_buffer(&state->fit_buf); }
1threat
Is there a way to create clusters in arcgis : <p>I have arcgis Web application.In that I need to create clusters.I have tried with examples which I got in Google search. Can anyone tell me how to do it</p>
0debug
Why does the order of elements in a Boolean expression change the outcome? : <p>If x is 0, 0 is printed. If y is 0, we get an error.</p> <p>Why is this? The only thing I can think of is that the order in which the Boolean expression is compiled matters. If x is 0 then we get (false)&amp;&amp;(error value) where false is on the left side, and if y is 0 then we get (error value)&amp;&amp;(false). Why does this effect what is printed?</p> <pre><code>int main(void) { int x = 1; int y = 0; int a = (x/y &gt; 0)&amp;&amp;(y/x &gt; 0); printf("%d\n", a); return 0; } </code></pre>
0debug
static inline int cris_bound_b(int v, int b) { int r = v; asm ("bound.b\t%1, %0\n" : "+r" (r) : "ri" (b)); return r; }
1threat
There is an image with an insecure URL loaded in the code of my wordpress site but I cannot find i to delete as it? : <p>I have a woocommerce WP website and I previously installed a currency converter plugin so my website could display multiple currencies.</p> <p>I uploaded some flag images of different countries to the plugin so that it would display the relevant flags next to each currency.</p> <p>I later decided to uninstall the currency switcher plugin and then after I did that I installed a letsencrypt SSL certificate. After a few months I decided to re-install the currency switcher plugin and after activating it my SSL certificate dissapeared.</p> <p>I went to www.whynopadlock.com and I tested my website to find out why the SSL padlock had dissapeared and the results advised that there are two images with insecure URL's which are causing the security failure.</p> <p>It appears that when I deleted the currency switcher plugin the flag images I uploaded with insecure url's did not actually get deleted and when I reinstalled the plugin it is somehow using them again.</p> <p>I have searched the theme editor, I also looked in File manager to see if I could locate these images so I could delete them but cannot find them anywhere.</p> <p>I also looked in the media library and they are not there either.</p> <p>When I am on the homepage of my website in Firefox and I click F12, if I scroll through the HTML which appears I can find the image URL's which are causing the problem but do not know where that file would be located so I can edit it.</p> <p>Could anybody please advise?</p> <p>Thank you</p>
0debug
java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile : <p>Below is the error I am getting while migrating yo Java 8 with API Level 24 Looks like it's from lombok pre-processor. Any help appreciated Error:/MyApp.native.android/AndroidApp/src/main/java/com/cba/MyApp/android/view/fragment/ProfileDetails/tabs/Profile.java:21: The import lombok cannot be resolved</p> <pre><code>FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'. &gt; java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:47) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: java.lang.RuntimeException: java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.builder.tasks.Job.awaitRethrowExceptions(Job.java:79) at com.android.build.gradle.tasks.JackTask.compile(JackTask.java:133) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 68 more Caused by: java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:120) at com.android.builder.tasks.Job.runTask(Job.java:51) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223) Caused by: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:109) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1931) at com.android.build.gradle.tasks.JackTask.doMinification(JackTask.java:148) at com.android.build.gradle.tasks.JackTask.access$000(JackTask.java:73) at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:112) ... 3 more Caused by: com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:978) at com.android.jack.Jack.run(Jack.java:496) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 7 more BUILD FAILED com.android.jack.api.v01.CompilationException: Failed to compile at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:109) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1931) at com.android.build.gradle.tasks.JackTask.doMinification(JackTask.java:148) at com.android.build.gradle.tasks.JackTask.access$000(JackTask.java:73) at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:112) at com.android.builder.tasks.Job.runTask(Job.java:51) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223) at java.lang.Thread.run(Thread.java:745) Caused by: com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:978) at com.android.jack.Jack.run(Jack.java:496) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 8 more Warning: Exception while processing task java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile :AndroidApp:compileMyAppDebugJavaWithJack FAILED </code></pre>
0debug
execute stored procedure using table adapter in c# : In VB.net i can simply execute stored procedure from sql server 2008 using the query in image below, but in c# i got this error. can you help me about the proper syntax in c#? thanks [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/dVwgB.png
0debug
how to increase numeric value present in the string in vb.net : i m using this query in vb.net Raw_data = Alltext_line.Substring(Alltext_line.IndexOf("R|1")) and i want to increase R|1 to R|2,R|3 and so on using for loop i tried it many ways but getting error "string to double is invalid" any help will be appreciated
0debug
VS Code Refresh Integrated Terminal Environment Variables without Restart/Logout : <p>If you add/change some environment variables (e.g. PATH) on windows, even after restarting 'VS Code' it will not be available in VS Code integrated terminals.<br> But if you open that terminal from windows (Command Prompt/Powershell/...) it will have those new/updated values!! </p> <p>What should I do to refresh those environment variables? (without restart or log-out)</p>
0debug
static void v9fs_remove(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; pdu_unmarshal(pdu, offset, "d", &fid); trace_v9fs_remove(pdu->tag, pdu->id, fid); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out_err; } err = v9fs_mark_fids_unreclaim(pdu, &fidp->path); if (err < 0) { goto out_err; } err = v9fs_co_remove(pdu, &fidp->path); if (!err) { err = offset; } out_err: clunk_fid(pdu->s, fidp->fid); put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); }
1threat
Looking up data by key in Hugo with a string : <p>I'm trying to create a HUGO-based API documentation site which reads JSON schemas, and prints them in HTML.</p> <p>I'm almost there, but I'm stumped on how exactly to pass in the data I want to a partial. </p> <p>Given a standard JSON schema file, such as the following:</p> <pre><code>{"paths": { "/auth/login": { "get": { "operationId": "login", "responses": { "200": { "description": "", "schema": { "ref": "#/definitions/loginResponse" } } } }, }, "definitions": { "loginResponse": { "type": "object" } }} </code></pre> <p>I'd like to display the details of that path, and then render a partial using the schema definition in "ref". I found a way to read that ref param and parse it into a reference for the definition. "Target" below looks like:</p> <blockquote> <p>Target: .definitions.loginResponse</p> </blockquote> <pre><code>{{ range $path, $methods := .paths }} &lt;h4&gt;{{ $path }}&lt;/h4&gt; {{ range $method, $items := $methods }} &lt;h5&gt;{{ $method }}&lt;/h5&gt; &lt;ul&gt; {{ range $status, $info := .responses }} &lt;li&gt; &lt;div&gt;{{ $status }}&lt;/div&gt; &lt;h6&gt;Ref: {{ $info.schema.ref }}&lt;/h6&gt; &lt;p&gt;Target: {{ $target := (printf ".definitions.%s" (index (findRE "[^/]+(/?$)" $info.schema.ref) 0))}}&lt;/p&gt; &lt;div&gt;{{ partial "schema" $target }}&lt;/div&gt; &lt;/li&gt; {{ end }} &lt;/ul&gt; {{end}} {{end}} </code></pre> <p>The trouble is, <code>$target</code> is a string. In Javascript, I'd just be able to pass it in as a key to get that object param: <code>schema["definitions.loginResponse"]</code>.</p> <p>No such luck in HUGO, however. I simply can't find a way to go from that target key string to the actual param. </p> <p>Help! Am I missing something obvious? Am I going about this all wrong?</p>
0debug
How do I redirect from port 80 to port 8080? : I'm trying to redirect my port 80 to 8080 because the user need not type the url as webapp:8080 to access the web site. Here's the command that I came across to redirect from port 80 to 8080 : sudo iptables -A PREROUTING -t nat -i enp0s25 -p tcp --dport 80 -j REDIRECT --to-port 8080 I'm now able to access the page as webapp/. But the problem now I'm facing is that I'm not able to access the page if I give webapp/ after I restart the system. I'm getting a google authentication error. How do I fix this?
0debug
Stuck at the java code Android Studio : <p>i'm making a sample quiz app with yes no questions, my xml is already done, but i'm really stuck with the java part. i need to display a toast when i click the button, so i can say: you like your phone brand, and when is negative i need to show a toast saying: you don't like your phone brand much. i have all the checkboxes wit ids but i'm really confused now... thanks in advance for the precious help, i appreciate it!</p> <p>This is the java code</p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } //This is called when tapping the button public void showResult(View view) { CheckBox firstCheckbox = (CheckBox) findViewById(R.id.yes_One); boolean isYes = firstCheckbox.isChecked(); CheckBox firstNCheckbox = (CheckBox) findViewById(R.id.no_One); boolean isNo = firstNCheckbox.isChecked(); CheckBox secondCheckbox = (CheckBox) findViewById(R.id.yes_Two); boolean isYesTwo = secondCheckbox.isChecked(); CheckBox secondNCheckbox = (CheckBox) findViewById(R.id.no_Two); boolean isNoTwo = secondNCheckbox.isChecked(); CheckBox thirdCheckbox = (CheckBox) findViewById(R.id.yes_Three); boolean isYesthree = thirdCheckbox.isChecked(); CheckBox thirdNCheckbox = (CheckBox) findViewById(R.id.no_Three); boolean isNoThree = thirdNCheckbox.isChecked(); CheckBox fourthCheckbox = (CheckBox) findViewById(R.id.yes_Four); boolean isYesFour = fourthCheckbox.isChecked(); CheckBox fourthNCheckbox = (CheckBox) findViewById(R.id.no_Four); boolean isNoFour = fourthNCheckbox.isChecked(); } </code></pre> <p>}</p>
0debug
static void check_threshold_8(void){ LOCAL_ALIGNED_32(uint8_t, in , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, max , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_ref , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, out_new , [WIDTH_PADDED]); ptrdiff_t line_size = WIDTH_PADDED; int w = WIDTH; ThresholdContext s; s.depth = 8; ff_threshold_init(&s); declare_func(void, const uint8_t *in, const uint8_t *threshold, const uint8_t *min, const uint8_t *max, uint8_t *out, ptrdiff_t ilinesize, ptrdiff_t tlinesize, ptrdiff_t flinesize, ptrdiff_t slinesize, ptrdiff_t olinesize, int w, int h); memset(in, 0, WIDTH_PADDED); memset(threshold, 0, WIDTH_PADDED); memset(min, 0, WIDTH_PADDED); memset(max, 0, WIDTH_PADDED); memset(out_ref, 0, WIDTH_PADDED); memset(out_new, 0, WIDTH_PADDED); randomize_buffers(in, WIDTH); randomize_buffers(threshold, WIDTH); randomize_buffers(min, WIDTH); randomize_buffers(max, WIDTH); if (check_func(s.threshold, "threshold8")) { call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, w, 1); call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); if (memcmp(out_ref, out_new, w)) fail(); bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); } }
1threat
static void test_visitor_in_int_overflow(TestInputVisitorData *data, const void *unused) { int64_t res = 0; Error *err = NULL; Visitor *v; v = visitor_input_test_init(data, "%f", DBL_MAX); visit_type_int(v, &res, NULL, &err); g_assert(err); error_free(err); }
1threat
java SimpleDateFormat? : <pre><code>public static void main(String[] args) { Date now = new Date(); String dateString = now.toString(); System.out.println(" 1. " + dateString); SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); try { Date parsed = format.parse(dateString); System.out.println(" 2. " + parsed.toString()); } catch (ParseException pe) { System.out.println("ERROR: Cannot parse \"" + dateString + "\""); } System.out.println(" 3. " + format.format(now)); } </code></pre> <p>print in console:</p> <pre><code> 1. Thu Feb 23 17:14:51 CET 2017 ERROR: Cannot parse "Thu Feb 23 17:14:51 CET 2017" 3. jeu. févr. 23 05:14:51 CET 2017 </code></pre> <p>instead of:</p> <pre><code> 1. Thu Feb 23 17:14:51 CET 2017 2. Thu Feb 23 17:14:51 CET 2017 3. jeu. févr. 23 05:14:51 CET 2017 </code></pre>
0debug
static void complete_request_vring(VirtIOBlockReq *req, unsigned char status) { stb_p(&req->in->status, status); vring_push(&req->dev->dataplane->vring, req->elem, req->qiov.size + sizeof(*req->in)); notify_guest(req->dev->dataplane); }
1threat
Removing one letter from a word : <p>So Is it possible to remove one letter from a string? For example</p> <p>String Word = "Hello";</p> <p>I want to create a function where decrementation happens like if you clicked it it will be Hell then Hel then He then H and "" is it possible? </p>
0debug
static void setup_frame(int usig, struct emulated_sigaction *ka, target_sigset_t *set, CPUState *regs) { struct sigframe *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); int i, err = 0; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return; err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto end; } if (err == 0) err = setup_return(regs, ka, &frame->retcode, frame, usig); end: unlock_user_struct(frame, frame_addr, 1); }
1threat
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); unsigned i; unsigned nvqs = s->conf->num_queues; if (!vblk->dataplane_started || s->stopping) { return; } if (vblk->dataplane_disabled) { vblk->dataplane_disabled = false; vblk->dataplane_started = false; return; } s->stopping = true; trace_virtio_blk_data_plane_stop(s); aio_context_acquire(s->ctx); for (i = 0; i < nvqs; i++) { VirtQueue *vq = virtio_get_queue(s->vdev, i); virtio_queue_aio_set_host_notifier_handler(vq, s->ctx, NULL); } blk_set_aio_context(s->conf->conf.blk, qemu_get_aio_context()); aio_context_release(s->ctx); for (i = 0; i < nvqs; i++) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); } k->set_guest_notifiers(qbus->parent, nvqs, false); vblk->dataplane_started = false; s->stopping = false; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
FacebookShare causing compiler error after update : <p>I just ran <code>pod update</code> for my app, and now it won't compile, giving these issues from <code>LinkShareContent.swift</code> in <code>FacebookShare</code>.</p> <pre><code>Cannot assign to property: 'contentDescription' is a get-only property Cannot assign to property: 'contentTitle' is a get-only property Cannot assign to property: 'imageURL' is a get-only property </code></pre> <p>These were the Facebook-related lines in my pod update:</p> <pre><code>Installing FBSDKCoreKit 4.23.0 (was 4.22.0) Installing FBSDKLoginKit 4.23.0 (was 4.22.0) Installing FBSDKShareKit 4.23.0 (was 4.22.0) Using FacebookCore (0.2.0) Using FacebookLogin (0.2.0) Using FacebookShare (0.2.0) </code></pre> <p>Does anyone know about this problem? Did I do something wrong?</p>
0debug
How to block a thread efficiently until a particular condition is met : <p>I am working on a multi-threaded server application in Linux using pthread library.For each client being connected there are two threads as I make two connection from device and one thread has dependency on other.until a particular condition is met First thread loop continuously in a while loop.when the condition is met the second thread sets the flag and the first thread based on that breaks the while loop and perform the required tasks.</p> <p>Is running a While loop continuously in a Thread until a particular condition is met a good approach.If not please specify a better approach.</p>
0debug
The name does not exist in the current context. Why? : <p>My code is:</p> <pre><code> if (textBox1.Text != "") { StreamReader tx = new StreamReader(textBox1.Text); } else { StreamReader tx = new StreamReader("new.txt"); } string line; while ((line = tx.ReadLine()) != null) { </code></pre> <p>If i delete "if" and leave it as:</p> <pre><code> StreamReader tx = new StreamReader("new.txt"); string line; while ((line = tx.ReadLine()) != null) { </code></pre> <p>Everything works. Why does if mess up my code?</p>
0debug
exponential 1/3 in Java : <p>Wondering what is the right way to represent <code>x^(1/3)</code>? Here is my code and it returns right value <code>2</code> for <code>8^(1/3)</code>. Wondering if any other better methods? </p> <pre><code>int a = 8; System.out.println(Math.pow(8, 1/3.0)); // returns 2 </code></pre> <p>regards, Lin</p>
0debug
static InputEvent *qapi_clone_InputEvent(InputEvent *src) { QmpOutputVisitor *qov; QmpInputVisitor *qiv; Visitor *ov, *iv; QObject *obj; InputEvent *dst = NULL; qov = qmp_output_visitor_new(); ov = qmp_output_get_visitor(qov); visit_type_InputEvent(ov, NULL, &src, &error_abort); obj = qmp_output_get_qobject(qov); qmp_output_visitor_cleanup(qov); if (!obj) { return NULL; } qiv = qmp_input_visitor_new(obj, false); iv = qmp_input_get_visitor(qiv); visit_type_InputEvent(iv, NULL, &dst, &error_abort); qmp_input_visitor_cleanup(qiv); qobject_decref(obj); return dst; }
1threat
ASP.NET Core RC2 Area not published : <p>So I just updated my app to use ASP.NET Core RC2. I published it using Visual Studio and noticed that my Area is not published:</p> <p>This snapshot is from <code>src\MyProject\bin\Release\PublishOutput</code>:</p> <p><a href="https://i.stack.imgur.com/FjpgY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FjpgY.png" alt="enter image description here"></a></p> <p>And here is my Area, named <code>Admin</code> in Visual Studio:</p> <p><a href="https://i.stack.imgur.com/VGvdF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VGvdF.png" alt="enter image description here"></a></p> <p>Am I missing an step or what?</p>
0debug
def are_Equal(arr1,arr2,n,m): if (n != m): return False arr1.sort() arr2.sort() for i in range(0,n - 1): if (arr1[i] != arr2[i]): return False return True
0debug
open an unsuported file type with a program automatically in a batch file : Im trying to open a file using a program, i would like to automatically do this with a batch file, everything i needs to run is in the same folder. Im not that good at batch files or coding but am trying to get better, if anyone knows how to do this that would be great.
0debug
static void usb_msd_copy_data(MSDState *s) { uint32_t len; len = s->usb_len; if (len > s->scsi_len) len = s->scsi_len; if (s->mode == USB_MSDM_DATAIN) { memcpy(s->usb_buf, s->scsi_buf, len); } else { memcpy(s->scsi_buf, s->usb_buf, len); } s->usb_len -= len; s->scsi_len -= len; s->usb_buf += len; s->scsi_buf += len; s->data_len -= len; if (s->scsi_len == 0 || s->data_len == 0) { if (s->mode == USB_MSDM_DATAIN) { s->scsi_dev->info->read_data(s->scsi_dev, s->tag); } else if (s->mode == USB_MSDM_DATAOUT) { s->scsi_dev->info->write_data(s->scsi_dev, s->tag); } } }
1threat
where to get oracle database vm without oracle account? : <p>I want to install Oracle database either 11g or 12c but since I am on Ubuntu 18.04 and since I neither have oracle account nor able to have one I was looking for virtual box image that contain the database. note : I was thinking to create windows VM and then install Oracle database inside it but I can not find 32 bit version of the database for that purpose. Please take into consideration I neither have oracle account nor able to have one and I need the database just for educational purposes.</p>
0debug
Get the output value of bash script executed with java : <p>I use this code to execute a script within my java program</p> <pre><code>pb.environment().put("time", time); pb.environment().put("value", value); Process p = pb.start(); p.waitFor(); // get the return value </code></pre> <p>After waiting for the process is it possible to get the output value ? With output value I mean the echo values used in the script </p>
0debug
Apollo GraphQl react. How to clear query cache for all variable combinations? : <p>I am using apollo graphql in my react application. Say I have the following query:</p> <pre><code>query ListQuery($filter: String!) { items(filter: $filter) { id name } } </code></pre> <p>This query lets me query a list of items using a filter. Say I used filter string A, and then used filter string B. The cache would now contain two entries: ListQuery(A) and ListQuery(B).</p> <p>Now let's say I use a mutation to add a new item. How can I remove all the cached queries from the cache? So in this case, I want to remove both ListQuery(A) and ListQuery(B) from the cache.</p> <p>How can I accomplish this?</p>
0debug
static void term_exit(void) { tcsetattr (0, TCSANOW, &oldtty); }
1threat
Error when checking model input: expected convolution2d_input_1 to have 4 dimensions, but got array with shape (32, 32, 3) : <p>I want to train a deep network starting with the following layer:</p> <pre><code>model = Sequential() model.add(Conv2D(32, 3, 3, input_shape=(32, 32, 3))) </code></pre> <p>using </p> <pre><code>history = model.fit_generator(get_training_data(), samples_per_epoch=1, nb_epoch=1,nb_val_samples=5, verbose=1,validation_data=get_validation_data() </code></pre> <p>with the following generator:</p> <pre><code>def get_training_data(self): while 1: for i in range(1,5): image = self.X_train[i] label = self.Y_train[i] yield (image,label) </code></pre> <p>(validation generator looks similar).</p> <p>During training, I get the error: </p> <pre><code>Error when checking model input: expected convolution2d_input_1 to have 4 dimensions, but got array with shape (32, 32, 3) </code></pre> <p>How can that be, with a first layer</p> <pre><code> model.add(Conv2D(32, 3, 3, input_shape=(32, 32, 3))) </code></pre> <p>?</p>
0debug
VBA _Excel Collections method : I am new in vba please help me to solve the following problem using by Collections. I want name of student from below data where student is from USA or England that study maths or history using Collections Student Country Subject Mark Norris Reid England Maths 23 Merry Guider France Bio 48 Karly Manzella USA History 55 Brett Keltner Germany Geography 62 Jasmin Legg USA French 50 Mana Marlett Australia Bio 61 Renaldo Deems USA Geography 24 Kandance Kurt SA Geography 58 Dusty More England Bio 45 Denise Mathew France Geography 78 Classie Leatherman Ireland Bio 76 Jerilyn Sidner Spain French 71
0debug
Firebase push key - allowed characters : <p>I am wondering what kind of characters are allowed in the push key. Does it generate also a symbol underscore(_)? I always get a push key with letters with -.</p>
0debug
Typing React components in Flow when passing a component as a prop : <p>I want to pass a React component as input prop to another React component. I tried to reference it as React.Component&lt;*, *, *> but when I use the passed component in the render method I get an error. This is how I wrote out my flow code.</p> <pre><code>/* @flow */ import React, { Component } from 'react'; import ReactDOM from 'react-dom'; const Input = props =&gt; &lt;div&gt;Yo&lt;/div&gt; type DefaultProps = { InputComponent: Input }; type Props = { InputComponent: React.Component&lt;*, *, *&gt; }; class App extends Component&lt;DefaultProps, Props, void&gt; { static defaultProps = { InputComponent: Input }; props: Props; render() { const { InputComponent } = this.props return ( &lt;div&gt; &lt;InputComponent /&gt; &lt;/div&gt; ) } } ReactDOM.render( &lt;App /&gt;, document.getElementById('root') ) </code></pre> <p>However in the App render method I get the error</p> <pre><code>React element `InputComponent` (Expected React component instead of React$Component) </code></pre> <p>How should I properly type input components?</p>
0debug
static void xbzrle_cache_zero_page(ram_addr_t current_addr) { if (ram_bulk_stage || !migrate_use_xbzrle()) { return; } cache_insert(XBZRLE.cache, current_addr, ZERO_TARGET_PAGE); }
1threat
Java script )) Questions about random quiz game : <p>I'm making a simple random quiz game</p> <p>I wrote some scripts for the game </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var Playerfirstname = prompt("Enter your first name"); var Playerlastname = prompt("Enter your last name"); alert(`Hello ${Playerfirstname} ${Playerlastname}!`); console.log("Player name is :",Playerfirstname +","+ Playerlastname); var round1quiz = [ ['Whats is 2 + 2', '4'], ['What is 3 * 3', '9'], ['What is 5 * 5', '25'] ]; var round2quiz = [ ['Whats my name', 'Ian'], ['Where am i from', 'India'], ['My favorite Food', 'Idly'] ]; var round3quiz = [ ['Whats my name', 'Ian'], ['Where am i from', 'India'], ['My favorite Food', 'Idly'] ]; score = 0; var questions = 0; function round1() { shuffle(round1quiz) var round1 = prompt("If you want to start Quiz game, enter 'yes'"); if (round1 == 'yes' || round1 == 'y') { alert("Let's start Quiz game!"); alert("Round 1"); questions = round1quiz; } else { alert("sorry, try again"); var round1 = prompt("If you want to start Quiz game, enter 'yes' or 'y' "); } } round1(); function round2() { } function randomQuestions() { return [rq(), rq(), rq()] } function rq() { var a = getRandomInt(0, 100), b = getRandomInt(0, 100), operator = "+-*" [getRandomInt(0, 3)], answer = operator === "+" ? a + b : operator === "-" ? a - b : operator === "*" ? a * b:0; return ["what is " + a + operator + b, answer] } function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min)) + min; } function askQ(ans) { var answer = prompt(ans[0], ''); if (answer == ans[1]) { score++; alert('Your are right!, you get money'); } else { alert('Sorry, It is wrong answer'); } } // the loop that will ask all the questionseasy function startquiz() { for (var i = 0; i &lt; questions.length; i++) { askQ(questions[i]); } } startquiz(); alert(score); function shuffle(array) { // var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; }</code></pre> </div> </div> </p> <p>I wanna put round2 and round3 in my code</p> <p>If the player entered all correct answer and choose to play round2, round2questions will display.</p> <p>However, if the player chooses to stop playing the game, the game will be over How can I put that code in my script?</p>
0debug
Reactjs how to use ref inside map function? : <p>I'm mapping through an array and for each item display a button with text. Say I want that on clicking the button, the text underneath will change its color to red. How can I target the sibling of the button? I tried using ref but since it's a mapped jsx, only the last ref element will be declared.</p> <p>Here is my code:</p> <pre><code>class Exams extends React.Component { constructor(props) { super() this.accordionContent = null; } state = { examsNames: null, // fetched from a server } accordionToggle = () =&gt; { this.accordionContent.style.color = 'red' } render() { return ( &lt;div className="container"&gt; {this.state.examsNames &amp;&amp; this.state.examsNames.map((inst, key) =&gt; ( &lt;React.Fragment key={key}&gt; &lt;button onClick={this.accordionToggle} className="inst-link"&gt;&lt;/button&gt; &lt;div ref={accordionContent =&gt; this.accordionContent = accordionContent} className="accordionContent"&gt; &lt;p&gt;Lorem ipsum dolor sit amet consectetur, adipisicing elit. Aperiam, neque.&lt;/p&gt; &lt;/div&gt; &lt;/React.Fragment&gt; ))} &lt;/div&gt; ) } } export default Exams; </code></pre> <p>As explained, the outcome is that on each button click, the paragraph attached to the last button will be targeted.</p> <p>Thanks in advance</p>
0debug
How are HSV color values used? : <p>I've just read about HSV and what I found out is that the Hue, actually specifies that in what color range (like pink, orange,etc.) the color is, the Saturation specifies its tendency to white (the lower the value is, the whiter the color is) , and about the Value, it's just the same as Saturation, but about black color. I hope I've understood it correctly so far, because my actual question is, how can I get these H S V values from pixels? Is there a way I can get the values like I do for RGB? Or is there a way I can turn RGB values to HSV? Could someone help me on this please? Thanks. (I'm working with C++, and I shouldn't use OpenCV, I can only use CImg, and Imagemagick.)</p>
0debug
What's wrong with my command Insert using a datagriedview : I'm trying to insert data into my database using a DataGriedView in C #. However when I click the save button appears the following error message: System.Data.OleDb.OleDbException was unhandled    HResult = -2147217900    Message = Syntax error in INSERT INTO statement.    Source = Microsoft Office Access Database Engine    ErrorCode = -2147217900    Here's the code I have: private void save_btn_Click(object sender, EventArgs e) { OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Stock.accdb"); con.Open(); for (int i = 0; i < dataGridView_insert.Rows.Count; i++) { OleDbCommand cmd = new OleDbCommand("INSERT INTO product(OV,Reference,Cod_Client,Client,Qtd,Type_product,Posicion_product,) VALUES ('" + dataGridView_insert.Rows[i].Cells["OV"].Value + "','" + dataGridView_insert.Rows[i].Cells["Reference"].Value + "','" + dataGridView_insert.Rows[i].Cells["Cod_Client"].Value + "','" + dataGridView_insert.Rows[i].Cells["Client"].Value + "','" + dataGridView_insert.Rows[i].Cells["Qtd"].Value + "','" + dataGridView_insert.Rows[i].Cells["Type_product"].Value + "','" + dataGridView_insert.Rows[i].Cells["Posicion_product"].Value + " ' ", con); cmd.ExecuteNonQuery(); } con.Close(); } What is wrong? Thanks in advance,
0debug
How to find all open windows running on separate thread WPF : <p>In my WPF application, I have to show some windows on UI thread and some on separate thread. I can access all windows running on UI thread using System.Windows.Application.Current.Windows, but unable to find windows that are running on separate thread.</p> <p>Can any one knows how can i achieve this ?</p> <p>Thanks</p>
0debug
How to get the user's canonical ID for adding a S3 permission : <p>I want to add a S3 permission for a specific user. The AWS console is asking me for the Canonical ID for the user. I used the AWS CLI command <code>aws iam list-users</code> to retrieve the list of users, but there was no "Canonical ID" field, and the "User ID" is not recognized, giving me an "Invalid ID" message. I tryied also with ARN and it did not work.</p>
0debug
How to sort matrix diagonally : <p>How to go from:</p> <pre><code>0 2 3 1 5 1 5 6 8 </code></pre> <p>to</p> <pre><code>0 1 3 1 2 5 5 6 8 </code></pre> <p>or something similar?</p>
0debug
:focus:active together not working on firefox. : I want outline should not come on "a" tag on click. it should only come when focus is on link by Tabbing on by jQuery focus event. Now outline comes on focus and doesnt go out till we not click anywhere else.
0debug
static void spapr_tce_reset(DeviceState *dev) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev); size_t table_size = tcet->nb_table * sizeof(uint64_t); tcet->bypass = false; memset(tcet->table, 0, table_size); }
1threat
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; C93DecoderContext * const c93 = avctx->priv_data; AVFrame * const newpic = &c93->pictures[c93->currentpic]; AVFrame * const oldpic = &c93->pictures[c93->currentpic^1]; GetByteContext gb; uint8_t *out; int stride, ret, i, x, y, b, bt = 0; c93->currentpic ^= 1; if ((ret = ff_reget_buffer(avctx, newpic)) < 0) return ret; stride = newpic->linesize[0]; bytestream2_init(&gb, buf, buf_size); b = bytestream2_get_byte(&gb); if (b & C93_FIRST_FRAME) { newpic->pict_type = AV_PICTURE_TYPE_I; newpic->key_frame = 1; } else { newpic->pict_type = AV_PICTURE_TYPE_P; newpic->key_frame = 0; } for (y = 0; y < HEIGHT; y += 8) { out = newpic->data[0] + y * stride; for (x = 0; x < WIDTH; x += 8) { uint8_t *copy_from = oldpic->data[0]; unsigned int offset, j; uint8_t cols[4], grps[4]; C93BlockType block_type; if (!bt) bt = bytestream2_get_byte(&gb); block_type= bt & 0x0F; switch (block_type) { case C93_8X8_FROM_PREV: offset = bytestream2_get_le16(&gb); if ((ret = copy_block(avctx, out, copy_from, offset, 8, stride)) < 0) return ret; break; case C93_4X4_FROM_CURR: copy_from = newpic->data[0]; case C93_4X4_FROM_PREV: for (j = 0; j < 8; j += 4) { for (i = 0; i < 8; i += 4) { offset = bytestream2_get_le16(&gb); if ((ret = copy_block(avctx, &out[j*stride+i], copy_from, offset, 4, stride)) < 0) return ret; } } break; case C93_8X8_2COLOR: bytestream2_get_buffer(&gb, cols, 2); for (i = 0; i < 8; i++) { draw_n_color(out + i*stride, stride, 8, 1, 1, cols, NULL, bytestream2_get_byte(&gb)); } break; case C93_4X4_2COLOR: case C93_4X4_4COLOR: case C93_4X4_4COLOR_GRP: for (j = 0; j < 8; j += 4) { for (i = 0; i < 8; i += 4) { if (block_type == C93_4X4_2COLOR) { bytestream2_get_buffer(&gb, cols, 2); draw_n_color(out + i + j*stride, stride, 4, 4, 1, cols, NULL, bytestream2_get_le16(&gb)); } else if (block_type == C93_4X4_4COLOR) { bytestream2_get_buffer(&gb, cols, 4); draw_n_color(out + i + j*stride, stride, 4, 4, 2, cols, NULL, bytestream2_get_le32(&gb)); } else { bytestream2_get_buffer(&gb, grps, 4); draw_n_color(out + i + j*stride, stride, 4, 4, 1, cols, grps, bytestream2_get_le16(&gb)); } } } break; case C93_NOOP: break; case C93_8X8_INTRA: for (j = 0; j < 8; j++) bytestream2_get_buffer(&gb, out + j*stride, 8); break; default: av_log(avctx, AV_LOG_ERROR, "unexpected type %x at %dx%d\n", block_type, x, y); return AVERROR_INVALIDDATA; } bt >>= 4; out += 8; } } if (b & C93_HAS_PALETTE) { uint32_t *palette = (uint32_t *) newpic->data[1]; for (i = 0; i < 256; i++) { palette[i] = 0xFFU << 24 | bytestream2_get_be24(&gb); } newpic->palette_has_changed = 1; } else { if (oldpic->data[1]) memcpy(newpic->data[1], oldpic->data[1], 256 * 4); } if ((ret = av_frame_ref(data, newpic)) < 0) return ret; *got_frame = 1; return buf_size; }
1threat
Dictionary to list of strings pair : <p>I have the following dictionary: </p> <pre><code>{'PoP': 4, 'apple': 1, 'anTs': 2, 'poeT': 1} </code></pre> <p>And I wish to have a list of values like this:</p> <pre><code>['PoP, 4', 'apple, 1', 'anTs, 2', 'poeT,1'] </code></pre> <p>Which is like having a list of tuples but without the parentheses. Is there anyway to do this ?</p>
0debug
precision of java floating-point numbers : If we run the following code: float f = 1.2345678990922222f; double d = 1.22222222222222222222d; System.out.println("f = " + f + "\t" + "d = " + d); it prints: f = 1.2345679 d = 1.2222222222222223 The long tail in the literal 1.2345678990922222 is ignored but the long tail in 1.22222222222222222222 is not (the last decimal digit in the variable d becomes 3 instead of 2). Anybody knows why?
0debug
static ssize_t local_lgetxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { if ((ctx->fs_sm == SM_MAPPED) && (strncmp(name, "user.virtfs.", 12) == 0)) { errno = ENOATTR; return -1; } return lgetxattr(rpath(ctx, path), name, value, size); }
1threat
Angular 2 conditional ngFor : <p>I'm trying to clean up my template code. I have the following:</p> <pre><code>&lt;ul&gt; &lt;li *ngIf="condition" *ngFor="let a of array1"&gt; &lt;p&gt;{{a.firstname}}&lt;/p&gt; &lt;p&gt;{{a.lastname}}&lt;/p&gt; &lt;/li&gt; &lt;li *ngIf="!condition" *ngFor="let b of array2"&gt; &lt;p&gt;{{b.firstname}}&lt;/p&gt; &lt;p&gt;{{b.lastname}}&lt;/p&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Is there a way to conditionally pick <code>array1</code> or <code>array2</code> to iterate through using <code>*ngIf</code> or something so that I don't have to repeat so much template code? This is just an example; my actual <code>&lt;li&gt;</code> contains a lot more content so I really don't want to repeat myself. Thanks!</p>
0debug
schedule queue job don't work for me i cant find any solution : protected function schedule(Schedule $schedule){ `enter code here`$schedule->job(new SendFeedbackEmail)->everyMinute(); }
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
How to get top 50 countries and leave the rest of the countries grouped to others in MS sql server : I would like to see TOP 50 countries, remaining countries need to be grouped as other countries using CASE statement. IS that possible to do. Please suggest.
0debug
Why do i get two references for the same singletonPattern instance? : I was learning about the Singleton design pattern through a tutorial. Basically from what I understand it ensures that only one instance of a class is ever created, and any interaction with that class is done through that one instance in the heap. with that said, in the SingletonPatternDemo.java I wrote: SingleObject object1 = SingleObject.getInstance(); SingleObject object2 = SingleObject.getInstance(); from my understanding, both object1 and object2 reference the same object, thus they should point to the same location in memory. However when I write: System.out.println("object1 HashCode: " + System.identityHashCode(System.identityHashCode(object1))); System.out.println("object2 HashCode: " + System.identityHashCode(System.identityHashCode(object2))); after I run it I get: object1 HashCode: 865113938 object2 HashCode: 1442407170 since these two objects reference the same instance shouldn't they return the same hashcode? or am I missing something? [Singleton class][1] [Demo class][2] [1]: https://i.stack.imgur.com/UlGtH.png [2]: https://i.stack.imgur.com/O2nIe.png
0debug
Assign a value to Integer between two constant values? : <p>Lets say I have 3 Integers:</p> <pre><code>int a, b, c; b = 25; c = 10; </code></pre> <p>Now I want <code>a</code> to be either 25 or 10 but by random not something like:</p> <pre><code>a = b; </code></pre> <p>I want something like in if statement:</p> <pre><code>a = b || c; </code></pre> <p>How can I achieve it?</p>
0debug
attributes required not work when clone element html : i have some elements with attribute required and i write jQuery code to clone this element when i press submit it should be show message must fill input but dosen't work just for this clone elements ... so what's problem <div class='col-md-12'> <div class='box box-primary'> <div class='box-header with-border'> <h3 class='box-title'>Information of Person</h3> </div> <div class='form-group'> <div class='box-body rowClone2'> <div class='row rowClone'> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> <div class='col-xs-6 col-md-3' > <input type="tel" class="form-control"> </div> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> </div> <br> </div> <div class="row"> <div class="col-md-3"> <input type="submit" value="Submit" formnovalidate> </div> </div> </div>
0debug
How convert std::string to byte : <p>I want to convert a string to a byte, but I don't know how. This is my code:</p> <pre><code>void keyboard::SimKey(std::string def) { keybd_event(def, 0, 0, 0); } </code></pre> <p>I don't know how to change def to a byte.</p>
0debug
void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, struct QXLRect *area, struct QXLRect *dirty_rects, uint32_t num_dirty_rects, uint32_t clear_dirty_region, qxl_async_io async) { if (async == QXL_SYNC) { qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area, dirty_rects, num_dirty_rects, clear_dirty_region); } else { #if SPICE_INTERFACE_QXL_MINOR >= 1 spice_qxl_update_area_async(&qxl->ssd.qxl, surface_id, area, clear_dirty_region, 0); #else abort(); #endif } }
1threat
static void ppc6xx_set_irq (void *opaque, int pin, int level) { CPUState *env = opaque; int cur_level; #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: env %p pin %d level %d\n", __func__, env, pin, level); } #endif cur_level = (env->irq_input_state >> pin) & 1; if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) { switch (pin) { case PPC6xx_INPUT_INT: #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: set the external IRQ state to %d\n", __func__, level); } #endif ppc_set_irq(env, PPC_INTERRUPT_EXT, level); break; case PPC6xx_INPUT_SMI: #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: set the SMI IRQ state to %d\n", __func__, level); } #endif ppc_set_irq(env, PPC_INTERRUPT_SMI, level); break; case PPC6xx_INPUT_MCP: if (cur_level == 1 && level == 0) { #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: raise machine check state\n", __func__); } #endif ppc_set_irq(env, PPC_INTERRUPT_MCK, 1); } break; case PPC6xx_INPUT_CKSTP_IN: if (level) { #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: stop the CPU\n", __func__); } #endif env->halted = 1; } else { #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: restart the CPU\n", __func__); } #endif env->halted = 0; } break; case PPC6xx_INPUT_HRESET: if (level) { #if 0 #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: reset the CPU\n", __func__); } #endif cpu_reset(env); #endif } break; case PPC6xx_INPUT_SRESET: #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: set the RESET IRQ state to %d\n", __func__, level); } #endif ppc_set_irq(env, PPC_INTERRUPT_RESET, level); break; default: #if defined(PPC_DEBUG_IRQ) if (loglevel & CPU_LOG_INT) { fprintf(logfile, "%s: unknown IRQ pin %d\n", __func__, pin); } #endif return; } if (level) env->irq_input_state |= 1 << pin; else env->irq_input_state &= ~(1 << pin); } }
1threat
Laravel change pagination data : <p>My Laravel pagination output is like laravel pagination used to be, but I need to change the data array for each object. My output is:</p> <p><a href="https://i.stack.imgur.com/wokI8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wokI8.png" alt="Output"></a></p> <p>As you can see, the data object has 2 items, which I need to change.</p> <p>My code is:</p> <pre><code>$items = $this-&gt;items() -&gt;where('position', '=', null) -&gt;paginate(15); </code></pre> <p>Which returns the user items with pivot table, but I don't like the way the pivot table is shown in the JSON, so I decided to change the items and organize each item with the pivot before the item.</p> <p>For this purpose, I tried to use <code>foreach</code></p> <pre><code>foreach ($items-&gt;data as $item) { } </code></pre> <p>which giving my an error, for a reason I don't know:</p> <pre><code>Undefined property: Illuminate\Pagination\LengthAwarePaginator::$data" status_code: 500 </code></pre> <p>Any help?</p>
0debug
router subscribe calls multiple time : <p>I have this code</p> <pre><code>ngOnInit() { this.router.events.subscribe((val) =&gt; { if (this.router.url.indexOf('page') &gt; -1) { let Id = this.activedRoute.snapshot.params['Id']; this.busy = this.httpCall.get('/pub/page/GetPageById/' + Id) .subscribe( data =&gt; { this.pages = &lt;Page[]&gt;data; }); console.log(Id); } }); } </code></pre> <p>and when I navigate to <code>domain.com/#/en/page/13</code> it logs <code>13</code>. Then when I navigate to the page which id is 27 it says: <code>13 13 27</code>. when I navigate back to 13: <code>27 27 13</code>. What's wrong?</p>
0debug
Realm ORM: how to deal with Maps? : <p>I am creating an Android app and I need to persist a <code>Map&lt;String,MyClass&gt;</code>. I've just started to use <a href="https://realm.io" rel="noreferrer">Realm ORM</a>, as it supports one-to-one and one-to-many, enumerations and lists. I also found a workaround for lists of strings (i.e. I have to create a StringWrapper class encapsulating a string. However, from the <a href="https://realm.io/docs/java/latest/" rel="noreferrer">documentation</a> I understand there is no easy way like <code>RealmMap</code>, as it happens for lists. So, I'm looking for the best way to persist a map. My current idea is to replace my map with a list of objects <code>KeyValueObject</code> encapsulating a <code>String</code> (the former map key) and a <code>MyClass</code>. Similarly to <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html" rel="noreferrer"><code>Map.Entry</code></a>. Is there any other solution that does not need me to rework the domain model for technology reasons?</p>
0debug
ClickListener in PagerAdapter fires on wrong position : <p>I'm using <a href="https://github.com/crosswall/Android-Coverflow">this project (Android-Coverflow)</a> in my app, which works as expected with one exception: when setting a <code>View.OnClickListener</code> on the single items in <code>instantiateItem</code> I do get wrong positions, i.e.:</p> <ul> <li>the middle item returns the correct position.</li> <li>the item on the right of the middle item displays the correct position (middle-item + 1)</li> <li>the item to the left of the middle item displays the wrong position: the same as the item to the right.</li> </ul> <p>So if I'm scrolling so far that item with index 3 is in the middle, I get</p> <ul> <li>3 for the middle item (correct)</li> <li>4 for the item to the right (correct)</li> <li>4 for the item to the left (wrong)</li> </ul> <p>I add the <code>ClickListener</code> inside the <code>instantiateItem</code> method, so I would expect it to be correct...</p> <p>What could I probably be missing here?</p> <p>I uploaded the adapted project to Github: <a href="https://github.com/haemi/Android-Coverflow-Clicklistener-Issue">https://github.com/haemi/Android-Coverflow-Clicklistener-Issue</a> - inside "transformer coverflow 2" the issue is visible. The according code is here: <a href="https://github.com/haemi/Android-Coverflow-Clicklistener-Issue/blob/master/app/src/main/java/me/crosswall/coverflow/demo/Normal2Activity.java#L63">https://github.com/haemi/Android-Coverflow-Clicklistener-Issue/blob/master/app/src/main/java/me/crosswall/coverflow/demo/Normal2Activity.java#L63</a></p>
0debug
int bdrv_pread(BlockDriverState *bs, int64_t offset, void *buf, int bytes) { QEMUIOVector qiov; struct iovec iov = { .iov_base = (void *)buf, .iov_len = bytes, }; int ret; if (bytes < 0) { return -EINVAL; } qemu_iovec_init_external(&qiov, &iov, 1); ret = bdrv_prwv_co(bs, offset, &qiov, false, 0); if (ret < 0) { return ret; } return bytes; }
1threat
static void mvc_fast_memmove(CPUS390XState *env, uint32_t l, uint64_t dest, uint64_t src) { S390CPU *cpu = s390_env_get_cpu(env); hwaddr dest_phys; hwaddr src_phys; hwaddr len = l; void *dest_p; void *src_p; uint64_t asc = env->psw.mask & PSW_MASK_ASC; int flags; if (mmu_translate(env, dest, 1, asc, &dest_phys, &flags, true)) { cpu_stb_data(env, dest, 0); cpu_abort(CPU(cpu), "should never reach here"); } dest_phys |= dest & ~TARGET_PAGE_MASK; if (mmu_translate(env, src, 0, asc, &src_phys, &flags, true)) { cpu_ldub_data(env, src); cpu_abort(CPU(cpu), "should never reach here"); } src_phys |= src & ~TARGET_PAGE_MASK; dest_p = cpu_physical_memory_map(dest_phys, &len, 1); src_p = cpu_physical_memory_map(src_phys, &len, 0); memmove(dest_p, src_p, len); cpu_physical_memory_unmap(dest_p, 1, len, len); cpu_physical_memory_unmap(src_p, 0, len, len); }
1threat
QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque) { QEMUBH *bh; bh = qemu_malloc(sizeof(*bh)); bh->cb = cb; bh->opaque = opaque; return bh; }
1threat
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[3*i + 0]; int g= src1[3*i + 1]; int b= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
1threat
How to make `Map::get` return either an `Optional` of the found value or `Optional.empty()` : <p>I'm trying to do this:</p> <pre><code>return Optional.of(myMap.getOrDefault(myKey, null)); </code></pre> <p>Really, what I want is to return an <code>Optional.of(foundVal)</code> if found, otherwise <code>Optional.empty()</code>. I don't believe <code>Optional.of(null)</code> equates to that. What syntax does what I want to do?</p> <p>That is, how can I get a map <code>get</code> to return a proper <code>Optional</code>?</p>
0debug