problem
stringlengths
26
131k
labels
class label
2 classes
void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, BlockdevOnError on_source_error, BlockdevOnError on_target_error, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { int64_t len; assert(bs); assert(target); assert(cb); if ((on_source_error == BLOCKDEV_ON_ERROR_STOP || on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) && !bdrv_iostatus_is_enabled(bs)) { error_set(errp, QERR_INVALID_PARAMETER, "on-source-error"); return; } len = bdrv_getlength(bs); if (len < 0) { error_setg_errno(errp, -len, "unable to get length for '%s'", bdrv_get_device_name(bs)); return; } BackupBlockJob *job = block_job_create(&backup_job_type, bs, speed, cb, opaque, errp); if (!job) { return; } job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->target = target; job->common.len = len; job->common.co = qemu_coroutine_create(backup_run); qemu_coroutine_enter(job->common.co, job); }
1threat
static void yop_next_macroblock(YopDecContext *s) { if (s->row_pos == s->frame.linesize[0] - 2) { s->dstptr += s->frame.linesize[0]; s->row_pos = 0; }else { s->row_pos += 2; } s->dstptr += 2; }
1threat
static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) { VirtIONet *n = VIRTIO_NET(vdev); int i; virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)), !!(features & (1 << VIRTIO_NET_F_CTRL_VQ))); virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF))); if (n->has_vnet_hdr) { tap_set_offload(qemu_get_subqueue(n->nic, 0)->peer, (features >> VIRTIO_NET_F_GUEST_CSUM) & 1, (features >> VIRTIO_NET_F_GUEST_TSO4) & 1, (features >> VIRTIO_NET_F_GUEST_TSO6) & 1, (features >> VIRTIO_NET_F_GUEST_ECN) & 1, (features >> VIRTIO_NET_F_GUEST_UFO) & 1); } for (i = 0; i < n->max_queues; i++) { NetClientState *nc = qemu_get_subqueue(n->nic, i); if (!nc->peer || nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) { continue; } if (!tap_get_vhost_net(nc->peer)) { continue; } vhost_net_ack_features(tap_get_vhost_net(nc->peer), features); } }
1threat
Google Spreadsheet 2 million limit : Is there any way to fix the 2 million cell limit in google spreadsheet? I'm even willing to pay to any google service,if it demands me to.I only need spreadsheet with unlimited cells/storage,flexibilty in using it.Can anyone suggest me a plan,if there is any?
0debug
Using a For Loop to change an If statement : <p>Just a real quick one. I has a list of variables which only change by 1 digit. I want my <code>if</code> statement to refer to each individual variable, but I'm not sure how to go about it. Can you help me out?</p> <pre><code>CheckGabba1 = IntVar() CheckGabba2 = IntVar() CheckGabba3 = IntVar() ## etc. (x10) ## There are items in these lists (This is just to show that they are lists) AllEventsGabba = [] SelectedEventsGabba = [] NumEvents = 10 ListIndex = 0 for EventCheck in range(NumEvents): if (CheckGabba(ListIndex + 1)).get() == 1: SelectedEventsGabba.append(AllEventsGabba[ListIndex]) ListIndex += 1 else: ListIndex += 1 </code></pre> <p>Obviously <code>(CheckGabba(ListIndex + 1)</code> is wrong, but I'm not sure what it needs to be replaced with to get the loop to autonomously check each variable, rather than hard-writing (Which I can do, but would prefer not to).</p>
0debug
Compile Error variable not initialized : <p>I've written program here to prompt a user for 3 integer variables compare them and find out which one is the largest middle and smallest, that part works fine. My issue is if you look at my first if statement I am trying to save those values each into a variable in memory, I keep getting variables not initialized errors. Any help would be great! I am basically wanting to store those values to continue writing more code to compare them and find out if they create a triangle or not. </p> <pre><code>import java.util.Scanner; public class TriangleProgram { public static void main(String [] args) { Scanner input = new Scanner(System.in); int x; System.out.print("Enter X: "); x = input.nextInt(); int y; System.out.print("Enter Y: "); y = input.nextInt(); int z; System.out.print("Enter Z: "); z = input.nextInt(); System.out.println(); int largest; int middle; int smallest; if(x &gt; y &amp;&amp; x &gt; z &amp;&amp; y &gt; z) { System.out.println("Largeset Number: " + x); System.out.println("Middle Number: " + y); System.out.println("Smallest Number: " + z); x = largest; y = middle; z = smallest; } else if(x &gt; y &amp;&amp; x &gt; z &amp;&amp; z &gt; y) { System.out.println("Largeset Number: " + x); System.out.println("Middle Number: " + z); System.out.println("Smallest Number: " + y); } else if(y &gt; x &amp;&amp; y &gt; z &amp;&amp; x &gt; z) { System.out.println("Largeset Number: " + y); System.out.println("Middle Number: " + x); System.out.println("Smallest Number: " + z); } else if(y &gt; x &amp;&amp; y &gt; z &amp;&amp; z &gt; x) { System.out.println("Largeset Number: " + y); System.out.println("Middle Number: " + z); System.out.println("Smallest Number: " + x); } else if(z &gt; x &amp;&amp; z &gt; y &amp;&amp; x &gt; y) { System.out.println("Largeset Number: " + z); System.out.println("Middle Number: " + x); System.out.println("Smallest Number: " + y); } else { System.out.println("Largeset Number: " + z); System.out.println("Middle Number: " + y); System.out.println("Smallest Number: " + x); } } } </code></pre>
0debug
int net_init_vhost_user(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { int queues; const NetdevVhostUserOptions *vhost_user_opts; CharDriverState *chr; assert(opts->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER); vhost_user_opts = opts->u.vhost_user; chr = net_vhost_parse_chardev(vhost_user_opts, errp); if (!chr) { return -1; } if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net, (char *)name, errp)) { return -1; } queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1; if (queues < 1) { error_setg(errp, "vhost-user number of queues must be bigger than zero"); return -1; } return net_vhost_user_init(peer, "vhost_user", name, chr, queues); }
1threat
node: could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir parameters) : <p>I was trying to upgrade node version on our CI environment from node 6 to node 8. I updated the full-icu version as well.</p> <p>the <code>$NODE_ICU_DATA</code> is set to <code>/usr/lib/node_modules/full-icu</code> </p> <p>but still get this error</p> <pre><code>node: could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir parameters) </code></pre> <p>Any idea, how to fix this?</p>
0debug
static void RENAME(mix6to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){ int i; for(i=0; i<len; i++) { INTER t = in[2][i]*coeffp[0*6+2] + in[3][i]*coeffp[0*6+3]; out[0][i] = R(t + in[0][i]*(INTER)coeffp[0*6+0] + in[4][i]*(INTER)coeffp[0*6+4]); out[1][i] = R(t + in[1][i]*(INTER)coeffp[1*6+1] + in[5][i]*(INTER)coeffp[1*6+5]); } }
1threat
.net core 3 Problem while registering ApplicationDbContext for dependency injection : <p>when i register other services it work like <code>services.AddSingleton&lt;GeneratingData, GeneratingData&gt;()</code> but when i add <code>services.AddSingleton&lt;ApplicationDbContext, ApplicationDbContext&gt;();</code> it does work <a href="https://i.stack.imgur.com/dFCwe.png" rel="nofollow noreferrer">this error shows up</a></p> <p><a href="https://i.stack.imgur.com/pgHaL.png" rel="nofollow noreferrer">enter image description here</a> this is the code i write in startup file <a href="https://i.stack.imgur.com/YfvrZ.png" rel="nofollow noreferrer">adding ApplicationDbContext for dependency injection</a></p>
0debug
BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (bdrv_rd_badreq_sectors(bs, sector_num, nb_sectors)) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; } ret = drv->bdrv_aio_read(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->rd_ops ++; } return ret; }
1threat
Postgresql query current year : <p>I need to see only the current year rows from a table.</p> <p>Would it be possible filter a timestamp column only by current year parameter, is there some function that can return this value?</p> <pre><code>SELECT * FROM mytable WHERE "MYDATE" LIKE CURRENT_YEAR </code></pre>
0debug
static void load_elf_image(const char *image_name, int image_fd, struct image_info *info, char **pinterp_name, char bprm_buf[BPRM_BUF_SIZE]) { struct elfhdr *ehdr = (struct elfhdr *)bprm_buf; struct elf_phdr *phdr; abi_ulong load_addr, load_bias, loaddr, hiaddr, error; int i, retval; const char *errmsg; errmsg = "Invalid ELF image for this architecture"; if (!elf_check_ident(ehdr)) { goto exit_errmsg; } bswap_ehdr(ehdr); if (!elf_check_ehdr(ehdr)) { goto exit_errmsg; } i = ehdr->e_phnum * sizeof(struct elf_phdr); if (ehdr->e_phoff + i <= BPRM_BUF_SIZE) { phdr = (struct elf_phdr *)(bprm_buf + ehdr->e_phoff); } else { phdr = (struct elf_phdr *) alloca(i); retval = pread(image_fd, phdr, i, ehdr->e_phoff); if (retval != i) { goto exit_read; } } bswap_phdr(phdr, ehdr->e_phnum); #ifdef CONFIG_USE_FDPIC info->nsegs = 0; info->pt_dynamic_addr = 0; #endif loaddr = -1, hiaddr = 0; for (i = 0; i < ehdr->e_phnum; ++i) { if (phdr[i].p_type == PT_LOAD) { abi_ulong a = phdr[i].p_vaddr; if (a < loaddr) { loaddr = a; } a += phdr[i].p_memsz; if (a > hiaddr) { hiaddr = a; } #ifdef CONFIG_USE_FDPIC ++info->nsegs; #endif } } load_addr = loaddr; if (ehdr->e_type == ET_DYN) { load_addr = target_mmap(loaddr, hiaddr - loaddr, PROT_NONE, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, -1, 0); if (load_addr == -1) { goto exit_perror; } } else if (pinterp_name != NULL) { probe_guest_base(image_name, loaddr, hiaddr); } load_bias = load_addr - loaddr; #ifdef CONFIG_USE_FDPIC { struct elf32_fdpic_loadseg *loadsegs = info->loadsegs = g_malloc(sizeof(*loadsegs) * info->nsegs); for (i = 0; i < ehdr->e_phnum; ++i) { switch (phdr[i].p_type) { case PT_DYNAMIC: info->pt_dynamic_addr = phdr[i].p_vaddr + load_bias; break; case PT_LOAD: loadsegs->addr = phdr[i].p_vaddr + load_bias; loadsegs->p_vaddr = phdr[i].p_vaddr; loadsegs->p_memsz = phdr[i].p_memsz; ++loadsegs; break; } } } #endif info->load_bias = load_bias; info->load_addr = load_addr; info->entry = ehdr->e_entry + load_bias; info->start_code = -1; info->end_code = 0; info->start_data = -1; info->end_data = 0; info->brk = 0; for (i = 0; i < ehdr->e_phnum; i++) { struct elf_phdr *eppnt = phdr + i; if (eppnt->p_type == PT_LOAD) { abi_ulong vaddr, vaddr_po, vaddr_ps, vaddr_ef, vaddr_em; int elf_prot = 0; if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; vaddr = load_bias + eppnt->p_vaddr; vaddr_po = TARGET_ELF_PAGEOFFSET(vaddr); vaddr_ps = TARGET_ELF_PAGESTART(vaddr); error = target_mmap(vaddr_ps, eppnt->p_filesz + vaddr_po, elf_prot, MAP_PRIVATE | MAP_FIXED, image_fd, eppnt->p_offset - vaddr_po); if (error == -1) { goto exit_perror; } vaddr_ef = vaddr + eppnt->p_filesz; vaddr_em = vaddr + eppnt->p_memsz; if (vaddr_ef < vaddr_em) { zero_bss(vaddr_ef, vaddr_em, elf_prot); } if (elf_prot & PROT_EXEC) { if (vaddr < info->start_code) { info->start_code = vaddr; } if (vaddr_ef > info->end_code) { info->end_code = vaddr_ef; } } if (elf_prot & PROT_WRITE) { if (vaddr < info->start_data) { info->start_data = vaddr; } if (vaddr_ef > info->end_data) { info->end_data = vaddr_ef; } if (vaddr_em > info->brk) { info->brk = vaddr_em; } } } else if (eppnt->p_type == PT_INTERP && pinterp_name) { char *interp_name; if (*pinterp_name) { errmsg = "Multiple PT_INTERP entries"; goto exit_errmsg; } interp_name = malloc(eppnt->p_filesz); if (!interp_name) { goto exit_perror; } if (eppnt->p_offset + eppnt->p_filesz <= BPRM_BUF_SIZE) { memcpy(interp_name, bprm_buf + eppnt->p_offset, eppnt->p_filesz); } else { retval = pread(image_fd, interp_name, eppnt->p_filesz, eppnt->p_offset); if (retval != eppnt->p_filesz) { goto exit_perror; } } if (interp_name[eppnt->p_filesz - 1] != 0) { errmsg = "Invalid PT_INTERP entry"; goto exit_errmsg; } *pinterp_name = interp_name; } } if (info->end_data == 0) { info->start_data = info->end_code; info->end_data = info->end_code; info->brk = info->end_code; } if (qemu_log_enabled()) { load_symbols(ehdr, image_fd, load_bias); } close(image_fd); return; exit_read: if (retval >= 0) { errmsg = "Incomplete read of file header"; goto exit_errmsg; } exit_perror: errmsg = strerror(errno); exit_errmsg: fprintf(stderr, "%s: %s\n", image_name, errmsg); exit(-1); }
1threat
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
CPUSPARCState *cpu_sparc_init(const char *cpu_model) { SPARCCPU *cpu; CPUSPARCState *env; cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU)); env = &cpu->env; gen_intermediate_code_init(env); if (cpu_sparc_register(env, cpu_model) < 0) { object_delete(OBJECT(cpu)); return NULL; } qemu_init_vcpu(env); return env; }
1threat
First time on ReactJS : <p>Hey I'm learning <code>ReactJs</code> these days. As a starter, I don't know which extensions might be useful. I'm working on <code>VS Code</code>. By default its giving me these types of syntax errors: <a href="https://i.stack.imgur.com/lwKfz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lwKfz.png" alt="enter image description here"></a></p> <p>Can someone recommend me some useful extensions for React on VS Code?</p>
0debug
Replace every nth character occurrence in Java : <p>I have a rather finnicky and fragile string formatter, where the only way that I can split data entries from a source is to know the size of the entry, and then remove it from the input data.<br> For example, the output looks something like: </p> <pre><code>field1 / field2 / field3 / field4 / field1 / field2 / field3 / field4 / field1 / field2 / field3 / field4 / </code></pre> <p>And I would like to split the output on every nth /, in this case every 4th /.<br> I cannot split based on \n since the output can insert \n characters in order to wrap the output to the screen, and I am not allowed to alter the output code or receive it in another format. </p> <p>So far I had the idea of splitting the entire raw input based on /, then assembling every n entries as an object, however I do not feel as if this is a particularly elegant solution.</p>
0debug
static uint32_t adler32(uint32_t adler, const uint8_t *buf, unsigned int len) { unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; int k; if (buf == NULL) return 1L; while (len > 0) { k = len < NMAX ? len : NMAX; len -= k; while (k >= 16) { DO16(buf); k -= 16; } if (k != 0) do { DO1(buf); } while (--k); s1 %= BASE; s2 %= BASE; } return (s2 << 16) | s1; }
1threat
Translating pseudocode into Python code : This is the pseudocode I was given: COMMENT: define a function sort1 INPUT: a list of numbers my list print the initial list loop over all positions i in the list; starting with the second element (index 1) COMMENT: at this point the elements from 0 to i-1 in this list are sorted loop backward over those positions j in the list lying to the left of i ; starting at position i-1 continue this loop as long as the value at j+1 is less than the value at j swap the values at positions j and j+1 print the current list And this is the python code I came up with: > #define a function sort1 > my_list=range(1,40) > print > print my_list > num_comparisons=0 > num_swaps=0 > for pos in range (0,len(my_list)-1): for i in range(pos+1,len(my_list)): # starting at position i-1 continue this loop as long as the value at j+1 is less than the value at j num_comparisons+=1 if my_list[i]<my_list[pos]: num_swaps+=1 [my_list[i],my_list[pos]]=[my_list[pos],my_list[i]] > print my_list > print > print num_comparisons, num_swaps I'm not sure I did it correctly though
0debug
static void vnc_display_close(VncDisplay *vs) { if (!vs) return; vs->enabled = false; vs->is_unix = false; if (vs->lsock != NULL) { if (vs->lsock_tag) { g_source_remove(vs->lsock_tag); } object_unref(OBJECT(vs->lsock)); vs->lsock = NULL; } vs->ws_enabled = false; if (vs->lwebsock != NULL) { if (vs->lwebsock_tag) { g_source_remove(vs->lwebsock_tag); } object_unref(OBJECT(vs->lwebsock)); vs->lwebsock = NULL; } vs->auth = VNC_AUTH_INVALID; vs->subauth = VNC_AUTH_INVALID; if (vs->tlscreds) { object_unparent(OBJECT(vs->tlscreds)); } g_free(vs->tlsaclname); vs->tlsaclname = NULL; }
1threat
Google App is Published on Internal Test Track but Can't Be Found/Downloaded : <p>I've successfully completed the publishing process for an APK to the Internal Test Track. But when I try to view the App for download on the Google Play Store using the "VIEW ON GOOGLE PLAY" link in the screenshot below...</p> <p><a href="https://i.stack.imgur.com/7BEoz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7BEoz.png" alt="enter image description here"></a></p> <p>...it opens a new window with the following error: <a href="https://i.stack.imgur.com/mmg3Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mmg3Y.png" alt="enter image description here"></a></p> <p>I've also tried using the testers link "download it on Google Play." below... <a href="https://i.stack.imgur.com/yTzwv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yTzwv.png" alt="enter image description here"></a></p> <p>...but it results in the same message stating the App can't be found.</p> <p>This is the first time the App has been published and it's being done on the Internal Test Track. <a href="https://i.stack.imgur.com/PagDq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PagDq.png" alt="enter image description here"></a></p> <p>The automated testing picked up a few warning and minor issues but no errors: <a href="https://i.stack.imgur.com/0r7QE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0r7QE.png" alt="enter image description here"></a></p> <p>Has anyone experienced this issue before? I've contacted Google support for advice but I thought it would be worth trying here too and seeing if anyone had any suggestions on what to try next. Thanks.</p>
0debug
static void sdp_parse_fmtp(AVStream *st, const char *p) { char attr[256]; char value[16384]; int i; RTSPStream *rtsp_st = st->priv_data; AVCodecContext *codec = st->codec; RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data; while(rtsp_next_attr_and_value(&p, attr, sizeof(attr), value, sizeof(value))) { sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context, attr, value); for (i = 0; attr_names[i].str; ++i) { if (!strcasecmp(attr, attr_names[i].str)) { if (attr_names[i].type == ATTR_NAME_TYPE_INT) *(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value); else if (attr_names[i].type == ATTR_NAME_TYPE_STR) *(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value); } } } }
1threat
static void test_acpi_piix4_tcg_cphp(void) { test_data data; memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".cphp"; test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6" " -numa node -numa node", &data); free_test_data(&data); }
1threat
unable to import django : <p><a href="https://i.stack.imgur.com/HWaIk.png" rel="nofollow noreferrer">the error that is happening</a></p> <p>I have installed the django version 3.0.2 all running but idk what could be the problem</p>
0debug
static coroutine_fn int cow_co_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { int ret; BDRVCowState *s = bs->opaque; qemu_co_mutex_lock(&s->lock); ret = cow_read(bs, sector_num, buf, nb_sectors); qemu_co_mutex_unlock(&s->lock); return ret; }
1threat
Learning to learn RegEx i need to find RegEx . ? ! ; : <p>Learning to learn RegEx i need to find RegEx for these symbols . ? ! ; ... </p> <p>Thank you For Help!</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
static inline int decode_cabac_mb_transform_size( H264Context *h ) { return get_cabac( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ); }
1threat
C++ Store function as Variable on the fly : <p>I am wondering if there is any way to create a function as a variable or change a class's function on the fly. Here are some examples to show what I mean</p> <p>Java</p> <pre><code>Thread t = new Thread() { public void run() { //do something } } </code></pre> <p>Javascript</p> <pre><code>var f = function() { //do something } </code></pre> <p>I am aware that you can use a predefined function as a variable, but I'm looking to do this entirely in a function.</p>
0debug
How to add authorization header in POSTMAN environment? : <p>I'm testing bunch of API calls using POSTMAN. Instead of adding authorization header to each request, can I make it as a part of POSTMAN environment? So, I don't have to pass it with every request.</p>
0debug
static void mpeg1_skip_picture(MpegEncContext *s, int pict_num) { assert(s->codec_id == CODEC_ID_MPEG1VIDEO); put_header(s, PICTURE_START_CODE); put_bits(&s->pb, 10, pict_num & 0x3ff); put_bits(&s->pb, 3, P_TYPE); put_bits(&s->pb, 16, 0xffff); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 0); put_header(s, SLICE_MIN_START_CODE); put_bits(&s->pb, 5, 1); put_bits(&s->pb, 1, 0); encode_mb_skip_run(s, 0); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); encode_mb_skip_run(s, s->mb_width * s->mb_height - 2); put_bits(&s->pb, 3, 1); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); }
1threat
static void v9fs_symlink(void *opaque) { V9fsPDU *pdu = opaque; V9fsString name; V9fsString symname; V9fsFidState *dfidp; V9fsQID qid; struct stat stbuf; int32_t dfid; int err = 0; gid_t gid; size_t offset = 7; v9fs_string_init(&name); v9fs_string_init(&symname); err = pdu_unmarshal(pdu, offset, "dssd", &dfid, &name, &symname, &gid); if (err < 0) { trace_v9fs_symlink(pdu->tag, pdu->id, dfid, name.data, symname.data, gid); if (name_is_illegal(name.data)) { err = -ENOENT; dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -EINVAL; err = v9fs_co_symlink(pdu, dfidp, &name, symname.data, gid, &stbuf); if (err < 0) { goto out; stat_to_qid(&stbuf, &qid); err = pdu_marshal(pdu, offset, "Q", &qid); if (err < 0) { goto out; err += offset; trace_v9fs_symlink_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path); out: put_fid(pdu, dfidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); v9fs_string_free(&symname);
1threat
PCIDevice *pci_get_function_0(PCIDevice *pci_dev) { if(pcie_has_upstream_port(pci_dev)) { return pci_dev->bus->devices[0]; } else { return pci_dev->bus->devices[PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 0)]; } }
1threat
Can someone please explain this recursion question the problem is solved? : <blockquote> <p>Given base and n that are both 1 or more, compute recursively (no loops) the value of base to the n power, so powerN(3, 2) is 9 (3 squared).</p> </blockquote> <p>The answer is </p> <pre><code>public int powerN(int base, int n) { if(n == 1) return base; return base * powerN(base, n - 1); } </code></pre> <p>I am confused because when I look at this because is this not saying multiply the base against the returned number of <code>powerN()</code>?</p> <blockquote> <p>powerN(3,3);</p> <p>= 3</p> <p>= 3*powerN(base, n-1) = 6</p> <p>= 3*powerN(base, n-1) = 9</p> </blockquote> <p>Which would multiply 9*6*3?</p> <p>I do not see why we would have to multiply the base by the function? </p> <p>Should the method not just return the answer as the base never changes and once <code>n==1</code> the base case executes </p>
0debug
static void test_cipher(const void *opaque) { const QCryptoCipherTestData *data = opaque; QCryptoCipher *cipher; Error *err = NULL; uint8_t *key, *iv, *ciphertext, *plaintext, *outtext; size_t nkey, niv, nciphertext, nplaintext; char *outtexthex; g_test_message("foo"); nkey = unhex_string(data->key, &key); niv = unhex_string(data->iv, &iv); nciphertext = unhex_string(data->ciphertext, &ciphertext); nplaintext = unhex_string(data->plaintext, &plaintext); g_assert(nciphertext == nplaintext); outtext = g_new0(uint8_t, nciphertext); cipher = qcrypto_cipher_new( data->alg, data->mode, key, nkey, &err); g_assert(cipher != NULL); g_assert(err == NULL); if (iv) { g_assert(qcrypto_cipher_setiv(cipher, iv, niv, &err) == 0); g_assert(err == NULL); } g_assert(qcrypto_cipher_encrypt(cipher, plaintext, outtext, nplaintext, &err) == 0); g_assert(err == NULL); outtexthex = hex_string(outtext, nciphertext); g_assert_cmpstr(outtexthex, ==, data->ciphertext); g_free(outtext); g_free(outtexthex); g_free(key); g_free(iv); g_free(ciphertext); g_free(plaintext); qcrypto_cipher_free(cipher); }
1threat
Swift - UISearchController with separate searchResultsController : <p>I'm trying to figure out how to use UISearchController when you want to display the results in a separate searchResultsController - every single guide, video and tutorial I've found have all used the current viewController to present the search results, and instantiate UISearchController like so:</p> <pre><code>let searchController = UISearchController(searchResultsController: nil) </code></pre> <p>but I want to dim the view and present a new tableView with the search results, in the same way done on the App Store search. So what I've done is created a new tableViewController, given it a storyboard id, and then instantiated it like so:</p> <pre><code>let storyboard = UIStoryboard(name: "Main", bundle: nil) let resultsController = storyboard.instantiateViewController(withIdentifier: "searchResults") as! UITableViewController let searchController = UISearchController(searchResultsController: resultsController ) </code></pre> <p>which seems to work. However, I'm pretty stuck from here on out. I have no idea how to display the search results in the resultsController, what to put in cellForRowAtIndexPath in the resultsController and so on.</p> <p>Any help is appreciated!</p>
0debug
static av_cold int libspeex_decode_init(AVCodecContext *avctx) { LibSpeexContext *s = avctx->priv_data; const SpeexMode *mode; if (avctx->sample_rate <= 8000) mode = &speex_nb_mode; else if (avctx->sample_rate <= 16000) mode = &speex_wb_mode; else mode = &speex_uwb_mode; if (avctx->extradata_size >= 80) s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size); avctx->sample_fmt = AV_SAMPLE_FMT_S16; if (s->header) { avctx->sample_rate = s->header->rate; avctx->channels = s->header->nb_channels; s->frame_size = s->header->frame_size; mode = speex_lib_get_mode(s->header->mode); if (!mode) { av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", s->header->mode); return AVERROR_INVALIDDATA; } } else av_log(avctx, AV_LOG_INFO, "Missing Speex header, assuming defaults.\n"); if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n"); return AVERROR(EINVAL); } speex_bits_init(&s->bits); s->dec_state = speex_decoder_init(mode); if (!s->dec_state) { av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex decoder.\n"); return -1; } if (!s->header) { speex_decoder_ctl(s->dec_state, SPEEX_GET_FRAME_SIZE, &s->frame_size); } if (avctx->channels == 2) { SpeexCallback callback; callback.callback_id = SPEEX_INBAND_STEREO; callback.func = speex_std_stereo_request_handler; callback.data = &s->stereo; s->stereo = (SpeexStereoState)SPEEX_STEREO_STATE_INIT; speex_decoder_ctl(s->dec_state, SPEEX_SET_HANDLER, &callback); } avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; }
1threat
get all records by records type mysql table : i have a table like this <pre> list_type list_name ---------- --------- city Chicago city Houston city Philadelphia city Phoenix state Alabama state Alaska state California state Connecticut state Delaware state Florida state Georgia color Red color Green color Blue </pre> when i run a mysql query, i need output like this <b>without using of GROUP_CONCAT</B> <PRE> list_type list_name ---------- --------- city Chicago,Houston,Philadelphia,Phoenix state Alabama,Alaska,California,Connecticut,Delaware,Florida,Georgia color Red,Green,Blue </PRE>
0debug
Difference between uwsgi_pass and proxy_pass in Nginx? : <p>I'm running uWSGI behind Nginx and have been using <code>proxy_pass</code> to get Nginx to hit uWSGI. Is there any benefit to switch to <code>uwsgi_pass</code>. If so, what is it?</p>
0debug
Issues in downloading Github package : <p>I am looking to download a PCA package in the Sklearn download, and download errors continuously pop up. </p> <p>I am attempting to use the pip command to download directly from GitHub, but keep getting the message that 'Git' is not installed </p> <pre><code> pip install git+git://github.com/mGalarnyk/Python_Tutorials/tree/master/Sklearn Collecting git+git://github.com/mGalarnyk/Python_Tutorials/tree/master/Sklearn Cloning git://github.com/mGalarnyk/Python_Tutorials/tree/master/Sklearn to c:\users\ommited\appdata\local\temp\pip-req-build-ggw1h5ld Running command git clone -q git://github.com/mGalarnyk/Python_Tutorials/tree/master/Sklearn 'C:\Users\omitd~1\AppData\Local\Temp\pip-req-build-ggw1h5ld' ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q git://github.com/mGalarnyk/Python_Tutorials/tree/master/Sklearn 'C:\Users\omit~1\AppData\Local\Temp\pip-req-build-ggw1h5ld' ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH? </code></pre> <p>Should be a cut and paste install</p>
0debug
Transparent AppBar in material-ui (React) : <p>Is there a way to change the background property of my material-ui <code>AppBar</code> component to transparent without having to actually change the CSS?</p> <p>I've tried the opacity property, but that reduces the opacity of everything within the component it seems.</p> <p>Below is an example of what I mean on Stripe's website.</p> <p><a href="https://i.stack.imgur.com/UsSR0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/UsSR0.jpg" alt="enter image description here"></a></p>
0debug
error i'm getting when running rake routes : > $ rake routes rake aborted! LoadError: incompatible library version - > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3.rb:6:in > `require' > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3.rb:6:in > `rescue in <top (required)>' > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3.rb:2:in > `<top (required)>' > /home/latei/Desktop/rails/alpha-blog/config/application.rb:7:in `<top > (required)>' /home/latei/Desktop/rails/alpha-blog/Rakefile:4:in > `require_relative' /home/latei/Desktop/rails/alpha-blog/Rakefile:4:in > `<top (required)>' > /home/latei/.rvm/gems/ruby-2.4.1@global/gems/rake-12.0.0/exe/rake:27:in > `<top (required)>' LoadError: cannot load such file -- > sqlite3/2.3/sqlite3_native > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3.rb:4:in > `require' > /home/latei/.rvm/gems/ruby-2.4.1/gems/sqlite3-1.3.13/lib/sqlite3.rb:4:in > `<top (required)>' > /home/latei/Desktop/rails/alpha-blog/config/application.rb:7:in `<top > (required)>' /home/latei/Desktop/rails/alpha-blog/Rakefile:4:in > `require_relative' /home/latei/Desktop/rails/alpha-blog/Rakefile:4:in > `<top (required)>' > /home/latei/.rvm/gems/ruby-2.4.1@global/gems/rake-12.0.0/exe/rake:27:in > `<top (required)>' (See full trace by running task with --trace)
0debug
How to protect shared prefence data not to be clear at GC run? : My application crashes when i keep my application on pause for more than 15-20 min.I have kept user credentials in Shared preference. It is due to shared preference data which is cleared by GC. Can anyone suggest how get rid of this problem ?
0debug
Dotnet core 2.1.302 Ubuntu Linux Development certificate trust : <p>I am running ubuntu 18.04 and I have installed dotnet 2.1.302. I need help in trusting the developer certificates to run my aspnetcore app with https. So far I managed to import the certificates from /home/alberto/.dotnet/corefx/cryptography/x509stores/ca and /home/alberto/.dotnet/corefx/cryptography/x509stores/my in chrome but they still show untrusted. A search of the web only revealed how to create your own certificate and run it but I just need to use the ones by MS for development if possible. Any help appreciated!</p> <p>Cheers, Alberto</p>
0debug
static int qemu_chr_fe_write_buffer(CharDriverState *s, const uint8_t *buf, int len, int *offset) { int res = 0; *offset = 0; qemu_mutex_lock(&s->chr_write_lock); while (*offset < len) { do { res = s->chr_write(s, buf + *offset, len - *offset); if (res == -1 && errno == EAGAIN) { g_usleep(100); } } while (res == -1 && errno == EAGAIN); if (res <= 0) { break; } *offset += res; } if (*offset > 0) { qemu_chr_fe_write_log(s, buf, *offset); } qemu_mutex_unlock(&s->chr_write_lock); return res; }
1threat
Sql query to find max value within 60 seconds .... : Suppose i have a table like below (with different ids) ... here for example took '99' ... id hist_timestamp DP mints Secnds value 99 2016-08-01 00:09:40 1 9 40 193.214 99 2016-08-01 00:10:20 1 10 20 198.573 99 2016-08-01 00:12:00 1 12 0 194.432 99 2016-08-01 00:52:10 1 52 10 430.455 99 2016-08-01 00:55:50 1 55 50 400.739 99 2016-08-01 01:25:10 2 25 10 193.214 99 2016-08-01 01:25:50 2 25 50 193.032 99 2016-08-01 01:34:30 2 34 30 403.113 99 2016-08-01 01:37:10 2 37 10 417.18 99 2016-08-01 01:38:10 2 38 10 400.495 99 2016-08-01 03:57:00 4 57 0 190.413 99 2016-08-01 03:58:40 4 58 40 191.936 Here i have a value column, starting from the first record i need to find max value within next 60 seconds which will result in below. In the group of those 60 seconds, i need to select one record with max value. id hist_timestamp DP mints Secnds value 99 2016-08-01 00:10:20 1 10 20 198.573 99 2016-08-01 00:12:00 1 12 0 194.432 99 2016-08-01 00:52:10 1 52 10 430.455 99 2016-08-01 00:55:50 1 55 50 400.739 99 2016-08-01 01:25:10 2 25 10 193.214 99 2016-08-01 01:34:30 2 34 30 403.113 99 2016-08-01 01:37:10 2 37 10 417.18 99 2016-08-01 03:57:00 4 57 0 190.413 99 2016-08-01 03:58:40 4 58 40 191.936 Can you please help me please with sql query. Thanks !!!
0debug
Regex \s\s matches `return + place` : <p>I have constructed a string as follows</p> <pre><code>let str = String.fromCharCode(13) + ' '; </code></pre> <p>Next, I would like to know if the string contains two spaces</p> <pre><code>str.match(/\s\s/) </code></pre> <p>The weird thing is that it is a match. But if I do</p> <pre><code>str.match(/ /) </code></pre> <p>it isn't. Can someone explain to me why this is happening ?</p>
0debug
Why does it show none at the end? Once i call the main function? How does the code need to be improved to not have it show none at the end? : <p>Once i call the main function I get none at the end. How does the code need to be improved to not have it show none in the end of the function call. <a href="https://i.stack.imgur.com/H0oEa.png" rel="nofollow noreferrer">def count_spaces, then call main function to count number of spaces</a></p>
0debug
static int spapr_vio_busdev_init(DeviceState *qdev) { VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev); char *id; if (dev->reg != -1) { VIOsPAPRDevice *other = reg_conflict(dev); if (other) { fprintf(stderr, "vio: %s and %s devices conflict at address %#x\n", object_get_typename(OBJECT(qdev)), object_get_typename(OBJECT(&other->qdev)), dev->reg); return -1; } } else { VIOsPAPRBus *bus = DO_UPCAST(VIOsPAPRBus, bus, dev->qdev.parent_bus); do { dev->reg = bus->next_reg++; } while (reg_conflict(dev)); } if (!dev->qdev.id) { id = vio_format_dev_name(dev); if (!id) { return -1; } dev->qdev.id = id; } dev->qirq = spapr_allocate_msi(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; } rtce_init(dev); return pc->init(dev); }
1threat
How to refresh/reload an activity in android without losing the data in that activity : I am developing an android application i which i want to refresh the current activity without losing the data but when i use the following code the activity gets restarted but the selected values in edittext gets lost.So can anyone tell me how to refresh the current activity without losing data in that activity. Intent i=getIntent(); finish(); startActivity(i);
0debug
bestpractises for big react projects : <p>I want to develop my first reactjs project. It will be a big project with lots of views and components.</p> <p>what would be a good best practise to get structure in it? ReactJS ist just for frontend stuff and the communication over REST with a Play framework backend.</p>
0debug
static int wavpack_encode_block(WavPackEncodeContext *s, int32_t *samples_l, int32_t *samples_r, uint8_t *out, int out_size) { int block_size, start, end, data_size, tcount, temp, m = 0; int i, j, ret = 0, got_extra = 0, nb_samples = s->block_samples; uint32_t crc = 0xffffffffu; struct Decorr *dpp; PutByteContext pb; if (!(s->flags & WV_MONO) && s->optimize_mono) { int32_t lor = 0, diff = 0; for (i = 0; i < nb_samples; i++) { lor |= samples_l[i] | samples_r[i]; diff |= samples_l[i] - samples_r[i]; if (lor && diff) break; } if (i == nb_samples && lor && !diff) { s->flags &= ~(WV_JOINT_STEREO | WV_CROSS_DECORR); s->flags |= WV_FALSE_STEREO; if (!s->false_stereo) { s->false_stereo = 1; s->num_terms = 0; CLEAR(s->w); } } else if (s->false_stereo) { s->false_stereo = 0; s->num_terms = 0; CLEAR(s->w); } } if (s->flags & SHIFT_MASK) { int shift = (s->flags & SHIFT_MASK) >> SHIFT_LSB; int mag = (s->flags & MAG_MASK) >> MAG_LSB; if (s->flags & WV_MONO_DATA) shift_mono(samples_l, nb_samples, shift); else shift_stereo(samples_l, samples_r, nb_samples, shift); if ((mag -= shift) < 0) s->flags &= ~MAG_MASK; else s->flags -= (1 << MAG_LSB) * shift; } if ((s->flags & WV_FLOAT_DATA) || (s->flags & MAG_MASK) >> MAG_LSB >= 24) { av_fast_padded_malloc(&s->orig_l, &s->orig_l_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_l, samples_l, sizeof(int32_t) * nb_samples); if (!(s->flags & WV_MONO_DATA)) { av_fast_padded_malloc(&s->orig_r, &s->orig_r_size, sizeof(int32_t) * nb_samples); memcpy(s->orig_r, samples_r, sizeof(int32_t) * nb_samples); } if (s->flags & WV_FLOAT_DATA) got_extra = scan_float(s, samples_l, samples_r, nb_samples); else got_extra = scan_int32(s, samples_l, samples_r, nb_samples); s->num_terms = 0; } else { scan_int23(s, samples_l, samples_r, nb_samples); if (s->shift != s->int32_zeros + s->int32_ones + s->int32_dups) { s->shift = s->int32_zeros + s->int32_ones + s->int32_dups; s->num_terms = 0; } } if (!s->num_passes && !s->num_terms) { s->num_passes = 1; if (s->flags & WV_MONO_DATA) ret = wv_mono(s, samples_l, 1, 0); else ret = wv_stereo(s, samples_l, samples_r, 1, 0); s->num_passes = 0; } if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) crc += (crc << 1) + samples_l[i]; if (s->num_passes) ret = wv_mono(s, samples_l, !s->num_terms, 1); } else { for (i = 0; i < nb_samples; i++) crc += (crc << 3) + (samples_l[i] << 1) + samples_l[i] + samples_r[i]; if (s->num_passes) ret = wv_stereo(s, samples_l, samples_r, !s->num_terms, 1); } if (ret < 0) return ret; if (!s->ch_offset) s->flags |= WV_INITIAL_BLOCK; s->ch_offset += 1 + !(s->flags & WV_MONO); if (s->ch_offset == s->avctx->channels) s->flags |= WV_FINAL_BLOCK; bytestream2_init_writer(&pb, out, out_size); bytestream2_put_le32(&pb, MKTAG('w', 'v', 'p', 'k')); bytestream2_put_le32(&pb, 0); bytestream2_put_le16(&pb, 0x410); bytestream2_put_le16(&pb, 0); bytestream2_put_le32(&pb, 0); bytestream2_put_le32(&pb, s->sample_index); bytestream2_put_le32(&pb, nb_samples); bytestream2_put_le32(&pb, s->flags); bytestream2_put_le32(&pb, crc); if (s->flags & WV_INITIAL_BLOCK && s->avctx->channel_layout != AV_CH_LAYOUT_MONO && s->avctx->channel_layout != AV_CH_LAYOUT_STEREO) { put_metadata_block(&pb, WP_ID_CHANINFO, 5); bytestream2_put_byte(&pb, s->avctx->channels); bytestream2_put_le32(&pb, s->avctx->channel_layout); bytestream2_put_byte(&pb, 0); } if ((s->flags & SRATE_MASK) == SRATE_MASK) { put_metadata_block(&pb, WP_ID_SAMPLE_RATE, 3); bytestream2_put_le24(&pb, s->avctx->sample_rate); bytestream2_put_byte(&pb, 0); } put_metadata_block(&pb, WP_ID_DECTERMS, s->num_terms); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; bytestream2_put_byte(&pb, ((dpp->value + 5) & 0x1f) | ((dpp->delta << 5) & 0xe0)); } if (s->num_terms & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECWEIGHT(type) do { \ temp = store_weight(type); \ bytestream2_put_byte(&pb, temp); \ type = restore_weight(temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECWEIGHTS); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = s->num_terms - 1; i >= 0; --i) { struct Decorr *dpp = &s->decorr_passes[i]; if (store_weight(dpp->weightA) || (!(s->flags & WV_MONO_DATA) && store_weight(dpp->weightB))) break; } tcount = i + 1; for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i < tcount) { WRITE_DECWEIGHT(dpp->weightA); if (!(s->flags & WV_MONO_DATA)) WRITE_DECWEIGHT(dpp->weightB); } else { dpp->weightA = dpp->weightB = 0; } } end = bytestream2_tell_p(&pb); out[start - 2] = WP_ID_DECWEIGHTS | (((end - start) & 1) ? WP_IDF_ODD: 0); out[start - 1] = (end - start + 1) >> 1; if ((end - start) & 1) bytestream2_put_byte(&pb, 0); #define WRITE_DECSAMPLE(type) do { \ temp = log2s(type); \ type = wp_exp2(temp); \ bytestream2_put_le16(&pb, temp); \ } while (0) bytestream2_put_byte(&pb, WP_ID_DECSAMPLES); bytestream2_put_byte(&pb, 0); start = bytestream2_tell_p(&pb); for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (i == 0) { if (dpp->value > MAX_TERM) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesA[1]); if (!(s->flags & WV_MONO_DATA)) { WRITE_DECSAMPLE(dpp->samplesB[0]); WRITE_DECSAMPLE(dpp->samplesB[1]); } } else if (dpp->value < 0) { WRITE_DECSAMPLE(dpp->samplesA[0]); WRITE_DECSAMPLE(dpp->samplesB[0]); } else { for (j = 0; j < dpp->value; j++) { WRITE_DECSAMPLE(dpp->samplesA[j]); if (!(s->flags & WV_MONO_DATA)) WRITE_DECSAMPLE(dpp->samplesB[j]); } } } else { CLEAR(dpp->samplesA); CLEAR(dpp->samplesB); } } end = bytestream2_tell_p(&pb); out[start - 1] = (end - start) >> 1; #define WRITE_CHAN_ENTROPY(chan) do { \ for (i = 0; i < 3; i++) { \ temp = wp_log2(s->w.c[chan].median[i]); \ bytestream2_put_le16(&pb, temp); \ s->w.c[chan].median[i] = wp_exp2(temp); \ } \ } while (0) put_metadata_block(&pb, WP_ID_ENTROPY, 6 * (1 + (!(s->flags & WV_MONO_DATA)))); WRITE_CHAN_ENTROPY(0); if (!(s->flags & WV_MONO_DATA)) WRITE_CHAN_ENTROPY(1); if (s->flags & WV_FLOAT_DATA) { put_metadata_block(&pb, WP_ID_FLOATINFO, 4); bytestream2_put_byte(&pb, s->float_flags); bytestream2_put_byte(&pb, s->float_shift); bytestream2_put_byte(&pb, s->float_max_exp); bytestream2_put_byte(&pb, 127); } if (s->flags & WV_INT32_DATA) { put_metadata_block(&pb, WP_ID_INT32INFO, 4); bytestream2_put_byte(&pb, s->int32_sent_bits); bytestream2_put_byte(&pb, s->int32_zeros); bytestream2_put_byte(&pb, s->int32_ones); bytestream2_put_byte(&pb, s->int32_dups); } if (s->flags & WV_MONO_DATA && !s->num_passes) { for (i = 0; i < nb_samples; i++) { int32_t code = samples_l[i]; for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) { int32_t sam; if (dpp->value > MAX_TERM) { if (dpp->value & 1) sam = 2 * dpp->samplesA[0] - dpp->samplesA[1]; else sam = (3 * dpp->samplesA[0] - dpp->samplesA[1]) >> 1; dpp->samplesA[1] = dpp->samplesA[0]; dpp->samplesA[0] = code; } else { sam = dpp->samplesA[m]; dpp->samplesA[(m + dpp->value) & (MAX_TERM - 1)] = code; } code -= APPLY_WEIGHT(dpp->weightA, sam); UPDATE_WEIGHT(dpp->weightA, dpp->delta, sam, code); } m = (m + 1) & (MAX_TERM - 1); samples_l[i] = code; } if (m) { for (tcount = s->num_terms, dpp = s->decorr_passes; tcount--; dpp++) if (dpp->value > 0 && dpp->value <= MAX_TERM) { int32_t temp_A[MAX_TERM], temp_B[MAX_TERM]; int k; memcpy(temp_A, dpp->samplesA, sizeof(dpp->samplesA)); memcpy(temp_B, dpp->samplesB, sizeof(dpp->samplesB)); for (k = 0; k < MAX_TERM; k++) { dpp->samplesA[k] = temp_A[m]; dpp->samplesB[k] = temp_B[m]; m = (m + 1) & (MAX_TERM - 1); } } } } else if (!s->num_passes) { if (s->flags & WV_JOINT_STEREO) { for (i = 0; i < nb_samples; i++) samples_r[i] += ((samples_l[i] -= samples_r[i]) >> 1); } for (i = 0; i < s->num_terms; i++) { struct Decorr *dpp = &s->decorr_passes[i]; if (((s->flags & MAG_MASK) >> MAG_LSB) >= 16 || dpp->delta != 2) decorr_stereo_pass2(dpp, samples_l, samples_r, nb_samples); else decorr_stereo_pass_id2(dpp, samples_l, samples_r, nb_samples); } } bytestream2_put_byte(&pb, WP_ID_DATA | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 3, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_MONO_DATA) { for (i = 0; i < nb_samples; i++) wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); } else { for (i = 0; i < nb_samples; i++) { wavpack_encode_sample(s, &s->w.c[0], s->samples[0][i]); wavpack_encode_sample(s, &s->w.c[1], s->samples[1][i]); } } encode_flush(s); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 1) >> 1); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); if (got_extra) { bytestream2_put_byte(&pb, WP_ID_EXTRABITS | WP_IDF_LONG); init_put_bits(&s->pb, pb.buffer + 7, bytestream2_get_bytes_left_p(&pb)); if (s->flags & WV_FLOAT_DATA) pack_float(s, s->orig_l, s->orig_r, nb_samples); else pack_int32(s, s->orig_l, s->orig_r, nb_samples); flush_put_bits(&s->pb); data_size = put_bits_count(&s->pb) >> 3; bytestream2_put_le24(&pb, (data_size + 5) >> 1); bytestream2_put_le32(&pb, s->crc_x); bytestream2_skip_p(&pb, data_size); if (data_size & 1) bytestream2_put_byte(&pb, 0); } block_size = bytestream2_tell_p(&pb); AV_WL32(out + 4, block_size - 8); return block_size; }
1threat
Haskell: Parse error: module header, import declaration or top-level declaration expected : <p>I am saving some commands in a Haskell script in a .hs file while working thru a Haskell textbook. Here's a small example.</p> <pre><code>fst (1,2) snd (1,2) </code></pre> <p>When I run these commands from the prelude in GHCi, they work fine. When I try to compile the .hs file with these two lines, I get the following:</p> <pre><code>ch4_test.hs:2:1: error: Parse error: module header, import declaration or top-level declaration expected. | 2 | fst (1,2) | ^^^^^^^^^ Failed, no modules loaded. </code></pre> <p>I've googled this error and can't find any explanation what I'm doing wrong.</p>
0debug
static av_cold int rv30_decode_init(AVCodecContext *avctx) { RV34DecContext *r = avctx->priv_data; int ret; r->rv30 = 1; if ((ret = ff_rv34_decode_init(avctx)) < 0) return ret; if(avctx->extradata_size < 2){ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); return -1; r->max_rpr = avctx->extradata[1] & 7; r->parse_slice_header = rv30_parse_slice_header; r->decode_intra_types = rv30_decode_intra_types; r->decode_mb_info = rv30_decode_mb_info; r->loop_filter = rv30_loop_filter; r->luma_dc_quant_i = rv30_luma_dc_quant; r->luma_dc_quant_p = rv30_luma_dc_quant; return 0;
1threat
Angular 4 error in IE11 : <p>I have Angular 4 project that works successfully on Chrome. However it doesn't load on IE11 with the following error in polyfills.bundle.js(I use command "ng build --env=prod" to build site):</p> <pre><code>var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); var f = ctx(fn, that, entries ? 2 : 1); var index = 0; var length, step, iterator, result; if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); </code></pre> <p>iterFn is undefined here so error is thrown. Please advise.</p>
0debug
Download all SSRS reports : <p>I want to get a copy of all .rdl files in one server. I can do the download manually one report at the time, but this is time consuming especially that this server has around 1500 reports.</p> <p>Is there any way or any tool that allows me to download all the .rdl files and take a copy of them?</p>
0debug
UNION versus SELECT DISTINCT and UNION ALL Performance : <p>Is there any difference between these two performance-wise?</p> <pre><code>-- eliminate duplicates using UNION SELECT col1,col2,col3 FROM Table1 UNION SELECT col1,col2,col3 FROM Table2 UNION SELECT col1,col2,col3 FROM Table3 UNION SELECT col1,col2,col3 FROM Table4 UNION SELECT col1,col2,col3 FROM Table5 UNION SELECT col1,col2,col3 FROM Table6 UNION SELECT col1,col2,col3 FROM Table7 UNION SELECT col1,col2,col3 FROM Table8 -- eliminate duplicates using DISTINCT SELECT DISTINCT * FROM ( SELECT col1,col2,col3 FROM Table1 UNION ALL SELECT col1,col2,col3 FROM Table2 UNION ALL SELECT col1,col2,col3 FROM Table3 UNION ALL SELECT col1,col2,col3 FROM Table4 UNION ALL SELECT col1,col2,col3 FROM Table5 UNION ALL SELECT col1,col2,col3 FROM Table6 UNION ALL SELECT col1,col2,col3 FROM Table7 UNION ALL SELECT col1,col2,col3 FROM Table8 ) x </code></pre>
0debug
static void mirror_iteration_done(MirrorOp *op, int ret) { MirrorBlockJob *s = op->s; struct iovec *iov; int64_t chunk_num; int i, nb_chunks, sectors_per_chunk; trace_mirror_iteration_done(s, op->sector_num * BDRV_SECTOR_SIZE, op->nb_sectors * BDRV_SECTOR_SIZE, ret); s->in_flight--; s->sectors_in_flight -= op->nb_sectors; iov = op->qiov.iov; for (i = 0; i < op->qiov.niov; i++) { MirrorBuffer *buf = (MirrorBuffer *) iov[i].iov_base; QSIMPLEQ_INSERT_TAIL(&s->buf_free, buf, next); s->buf_free_count++; } sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; chunk_num = op->sector_num / sectors_per_chunk; nb_chunks = DIV_ROUND_UP(op->nb_sectors, sectors_per_chunk); bitmap_clear(s->in_flight_bitmap, chunk_num, nb_chunks); if (ret >= 0) { if (s->cow_bitmap) { bitmap_set(s->cow_bitmap, chunk_num, nb_chunks); } if (!s->initial_zeroing_ongoing) { s->common.offset += (uint64_t)op->nb_sectors * BDRV_SECTOR_SIZE; } } qemu_iovec_destroy(&op->qiov); g_free(op); if (s->waiting_for_io) { qemu_coroutine_enter(s->common.co); } }
1threat
Is it possible in javascript to invoke "Object" : <p>Do we have any ways to do in js something like this? </p> <pre><code>const pseudoFunction = {}; pseudoFunction(); </code></pre> <p>Maybe add methods, constructor or something else to <code>pseudoFunction</code>?</p>
0debug
Ihave a list = ['a',3,4,'b',6,'c',5,1] how i can convert it in a list = ['a',34,'b',6,'c',51]? : I have a list input as `list = ['a',3,4,'b',6,'c',5,1]` and I want to my output list as `list = ['a',34,'b',6,'c',51]`.
0debug
linux wildcard usage in cp and mv : <p>I am composing a script to process 20 files. All of them located in different directories. I have partial file name. </p> <ol> <li>In log directory, File1_Date_time.err change to File1__Date_time_orig.err</li> <li>cd ../scripts/ </li> <li>sh File.sh </li> </ol> <p>File1 directory is /data/data1directory/Sample_File1/logs/File1_Data_time.err<Br> File2 directory is /data/data2directory/Sample_File2/logs/File2_Data_time.err<Br> .....</p> <p>My script looks like this. (runrunrun.sh)</p> <pre><code>#!/bin/bash INPUT=$1 mv /data/*/Sample_*/logs/*_Data_time.err /data/*/Sample_*/logs/*_Data_time_orig.err cp /data/*/Sample_*/scripts/*.sh /data/*/Sample_*/scripts/*_orig.sh sh /data/*/Sample_*/scripts/*_orig.sh </code></pre> <p>When running it, I tried.<Br> ./runrunrun.sh File1 <Br> . runrunrun.sh File1 <Br> sh runrunrun.sh File1 <Br></p> <p>mv: cannot move <code>/data/data1directory/Sample_File1/logs/File1_Data_time.err /data/*/Sample_*/logs/*_Data_time_orig.err</code>: No such file or directory cp also got similar feedback</p> <p>Am I doing it correct?</p> <p>Thanks!</p>
0debug
DICOM Files acting flakey in Image viewers after anonymization : <p>I wrote my own version of DICOM Anonymizer with python. I have a set of tags that have to be anonymized, including <code>Frame of Reference UID</code>, <code>Series Instance UID</code> and <code>SOP Instance UID</code>. Changing these to random values as a way of anonymizing seems to be breaking the way images for one patient is being shown as a volume, or in some cases image viewers like Clear Canvas don't even open the files.</p> <p>I know some of the Anonymizers available to use do hash these tags. My question is how can I do that and keep the dicom files intact.</p> <p>Also, I am pretty new to DICOM so if someone could explain what would not having those tags anonymized give away as sensitive information would be great.</p> <p>Thanks.</p>
0debug
Alt+D shortcut key unable to overriade in edge : I am unable to override the alt+d key in javascript edge browser remaining all browsers working
0debug
def listify_list(list1): result = list(map(list,list1)) return result
0debug
Array sum that I got from a for loop returns NaN (Javascript) : <p>That function below returns <strong>NaN</strong> instead of expected <strong>4</strong>. I bet there's some obvious mistake, but I'm not seeing it.</p> <pre><code>function myFunction(arr) { let arrSum = 0 for (let i=0; i&lt;=arr.length; i++) {arrSum += arr[i];} return arrSum; } const myArr = [2,2]; console.log(myFunction(myArr)); </code></pre>
0debug
How to use MVP with Viewpager - android : i am new to applying MVP to android use. i wanted a sample on how should i make a MVP arch for Viewpager do i have to create Model view and presenter class for all the fragments that are to be loaded to the Viewpager ? Can any one please provide a sample for applying MVP on a viewpager or a MVP with Tabbed Viewpager
0debug
If thread scheduler runs one thread at time then how java is provide multithreading? : Below is what I have seen on java t point about thread scheduler. Thread Scheduler in Java Thread scheduler in java is the part of the JVM that decides which thread should run. There is no guarantee that which runnable thread will be chosen to run by the thread scheduler. Only one thread at a time can run in a single process. The thread scheduler mainly uses preemptive or time slicing scheduling to schedule the threads.
0debug
Formatting a Duration like HH:mm:ss : <p>Is there a good way to format a Duration in something like hh:mm:ss, without having to deal with time zones?</p> <p>I tried this:</p> <pre><code>DateTime durationDate = DateTime.fromMillisecondsSinceEpoch(0); String duration = DateFormat('hh:mm:ss').format(durationDate); </code></pre> <p>But I always get 1 hour to much, in this case it would say <code>01:00:00</code></p> <p>And When I do this:</p> <pre><code>Duration(milliseconds: 0).toString(); </code></pre> <p>I get this: <code>0:00:00.000000</code></p>
0debug
What is the Play 2.5.x equivalent to acceptWithActor[String, JsValue]? : <p>Before I migrated to Play 2.5.x I used <code>WebSocket.acceptWithActor</code> frequently. Now I can't get my web sockets to stay open when using different input and output, in my case, input is String, output is JsValue.</p> <p>My receiver before Play 2.5.x:</p> <pre><code>object Application extends Controller { def myWebSocket = WebSocket.acceptWithActor[String, JsValue] { request =&gt; out =&gt; MyActor.props(out) } </code></pre> <p>My receiver in Play 2.5.x:</p> <pre><code>@Singleton class Application @Inject() (implicit system: ActorSystem, materializer: Materializer) extends Controller { implicit val messageFlowTransformer = MessageFlowTransformer.jsonMessageFlowTransformer[String, JsValue] def myWebSocket = WebSocket.accept[String, JsValue] { request =&gt; ActorFlow.actorRef(out =&gt; MyActor.props(out)) } } </code></pre> <p>In my actor <code>preStart</code> is called immediately followed by <code>postStop</code>, so this is obviously incorrect, but I can't seem to find any solution in the documentation (<a href="https://www.playframework.com/documentation/2.5.x/ScalaWebSockets" rel="noreferrer">https://www.playframework.com/documentation/2.5.x/ScalaWebSockets</a>). If I use <code>WebSocket.accept[String, String]</code> the socket stays open.</p> <p>What am I doing wrong?</p>
0debug
Disable cookies and clear cache in Chrome Custom Tabs : <p>I am using Chrome Custom Tabs to redirect users to a link of an 3rd party site. But, I want the cookies to be disabled and cache cleared in the resultant chrome custom tab (just like if the link would have opened in the incognito mode of google chrome). I have searched through the documentation , but could not find a way to achieve this. Kindly help</p>
0debug
Select position of CardView in RecyclerView and Change Fragment in RecyclerView : <p><strong>* EASY PART *</strong></p> <p>At the moment I have set up a CardView inside a RecyclerView.</p> <p>What i need to do is to change the color of the 2nd cardview to yellow, and the 3rd cardview to red (At the moment they are all green). Also i want the first cardview to remain green.</p> <p><strong>* HARD PART *</strong></p> <p>What i also need, is to be able to switch to another fragment, whenever i click on one of the CardViews in the RecyclerView. So basically to switch fragments in my RecyclerAdapter.</p> <p>My RecyclerAdapter Java class is as follows:</p> <p>Thanks in advance!`</p> <pre><code>public class RecyclerAdapter extends RecyclerView.Adapter&lt;RecyclerAdapter.RecyclerViewHolder&gt; { Fragment fragment; private DataTabelFragment dataTabelFragment; private static String[] title = new String[]{"D42DB2", "B42DC6", "CURRENTLY NOT AVAILABLE"}; private static String[] beskrivelse = new String[]{"Temperatur &amp; Humdity Sensorer", "Light Sensorer", ""}; @Override public RecyclerViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { System.out.println( "DU ER KOMMET SÅ LANGT HABEBEEEEEEEEE" ); View view = LayoutInflater.from( viewGroup.getContext() ).inflate( R.layout.fragment_card_view_tabel, viewGroup, false ); viewGroup.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { } } ); return new RecyclerViewHolder( view ); } @Override public void onBindViewHolder(RecyclerViewHolder recyclerViewHolder, int i) { recyclerViewHolder.mBeskrivelse.setText( beskrivelse[i] ); recyclerViewHolder.mTitle.setText( title[i] ); recyclerViewHolder.cardView.setCardBackgroundColor( Color.parseColor( "#FFCE54" ) ); //recyclerViewHolder.cardView.setCardBackgroundColor( Color.parseColor( "#FFCE54" ) ); } @Override public int getItemCount() { return title.length; } class RecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mBeskrivelse; private TextView mTitle; private CardView cardView; public RecyclerViewHolder(View itemView) { super( itemView ); mBeskrivelse = (TextView) itemView.findViewById( R.id.item_beskrivelse ); mTitle = (TextView) itemView.findViewById( R.id.item_title ); cardView = (CardView) itemView.findViewById( R.id.card_view ); itemView.setOnClickListener( this ); } @Override public void onClick(View v) { Toast.makeText( itemView.getContext(), "HEJ DU HAR TRYKKET PÅ KNAP", Toast.LENGTH_LONG ).show(); //((FragmentActivity) itemView.getContext()).getSupportFragmentManager().beginTransaction().replace( R.id.recycler_view, new DataTabelFragment() ).commit(); } } } </code></pre>
0debug
Using default function implementation of interface in Kotlin : <p>I have a Kotlin interface with a default implementation, for instance:</p> <pre><code>interface Foo { fun bar(): String { return "baz" } } </code></pre> <p>This would be okay until I try to implement this interface from Java. When I do, it says the class need to be marked as abstract or implement the method <code>bar()</code>. Also when I try to implement the method, I am unable to call <code>super.bar()</code>.</p>
0debug
static uint64_t strongarm_gpio_read(void *opaque, hwaddr offset, unsigned size) { StrongARMGPIOInfo *s = opaque; switch (offset) { case GPDR: return s->dir; case GPSR: DPRINTF("%s: Read from a write-only register 0x" TARGET_FMT_plx "\n", __func__, offset); return s->gpsr; case GPCR: DPRINTF("%s: Read from a write-only register 0x" TARGET_FMT_plx "\n", __func__, offset); return 31337; case GRER: return s->rising; case GFER: return s->falling; case GAFR: return s->gafr; case GPLR: return (s->olevel & s->dir) | (s->ilevel & ~s->dir); case GEDR: return s->status; default: printf("%s: Bad offset 0x" TARGET_FMT_plx "\n", __func__, offset); } return 0; }
1threat
Websocket connections with postman : <p>I'm using Postman to test an existing REST API. This API calls async functions on the server which return a response over a websocket using StompJS.</p> <p>Is it possible to connect to the websocket using Postman?</p>
0debug
SQL DEVELOPER Insufficient Privileges Create table : I am new with Sql Developer and I got this problem. I make connection but when I try to create table it shows me error: ORA-01031: Insufficient Privileges. I try to find answer but I did not succeed. Please help [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/mJrRk.png
0debug
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; int64_t end, tmp; AVRational time_base; nut->last_syncpoint_pos= url_ftell(bc)-8; end= get_packetheader(nut, bc, 1); end += url_ftell(bc); tmp= get_v(bc); *back_ptr= nut->last_syncpoint_pos - 16*get_v(bc); if(*back_ptr < 0) return -1; ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp); if(skip_reserved(bc, end) || get_checksum(bc)){ av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n"); return -1; } *ts= tmp / s->nb_streams * av_q2d(nut->time_base[tmp % s->nb_streams])*AV_TIME_BASE; add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts); return 0; }
1threat
Cant upload file through okhttp3 : <p>I get the file on activity result.Or should i say the content uri version of it.</p> <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if(resultCode==RESULT_OK &amp;&amp; requestCode==0){ Log.d("uri data",""+data.getData()); selectedFileUri = data.getData(); </code></pre> <p>My question is how do i send this file through okhttp3 method?</p> <p>The okhttp 3 method is as follows</p> <pre><code>multipart.addFilePart("data[User][user_picture]", selectedFileUri); </code></pre> <p>Thank you for your time.</p>
0debug
void migration_incoming_state_destroy(void) { struct MigrationIncomingState *mis = migration_incoming_get_current(); qemu_event_destroy(&mis->main_thread_load_event);
1threat
Go style guideline? : <p>I'm starting in the programming with Go and I want to ask if there are some patterns to follow when programming, like:</p> <p>// Package</p> <p>// Structs orderer by importance</p> <p>// Struct methods</p> <p>// Un-exported methods</p> <p>// Exported methods</p> <p>// getters and setters</p>
0debug
need help first first year university homework problem invloving loops : Problem: In the space provided, write a program that uses nested loops to draw the pattern below. You are not allowed to use any of the formatting functions; your solution must use nested loops and must use calls to print("*", end="") and print("-", end="") to print characters to the screen (without moving to the next line) and calls to print() to move down to the next line. 1. ** 2. *_** 3. *__*** 4. *___**** 5. *____***** I have no idea where to start with this problem I'm new to programming. I must use nested loops and use print("*", end="") and print("-", end=""). I can't use formatting functions and I can only go to a new line using print()
0debug
Android app advertising : i need some help,plz help me in the below mention question if u can asap Actually i am developing an android app so(for revenue) i want to know #in_detail 1-Which is the best mobile advertising network that give me the highest cpc(cost per click) rates? 2-What are the factors that affect cpc rates? 3-Is there any network which give me fixed cpc rates? 4-Is there any network that do not have any refresh rate(refresh ads on user action(click,swipe etc))? 5-Is there a way through which i can calculate/get the exact earning of each click just after that click? 6-Same question for cpcv(cost per complete view(video ads) and cpm(cost per impression)! I search a lot about these questions but did'nt get/understand the answers...plzz help mee experienced people!
0debug
static av_cold int on2avc_decode_init(AVCodecContext *avctx) { On2AVCContext *c = avctx->priv_data; int i; c->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; c->is_av500 = (avctx->codec_tag == 0x500); if (c->is_av500 && avctx->channels == 2) { av_log(avctx, AV_LOG_ERROR, "0x500 version should be mono\n"); return AVERROR_INVALIDDATA; if (avctx->channels == 2) av_log(avctx, AV_LOG_WARNING, "Stereo mode support is not good, patch is welcome\n"); for (i = 0; i < 20; i++) c->scale_tab[i] = ceil(pow(10.0, i * 0.1) * 16) / 32; for (; i < 128; i++) c->scale_tab[i] = ceil(pow(10.0, i * 0.1) * 0.5); if (avctx->sample_rate < 32000 || avctx->channels == 1) memcpy(c->long_win, ff_on2avc_window_long_24000, 1024 * sizeof(*c->long_win)); else memcpy(c->long_win, ff_on2avc_window_long_32000, 1024 * sizeof(*c->long_win)); memcpy(c->short_win, ff_on2avc_window_short, 128 * sizeof(*c->short_win)); c->modes = (avctx->sample_rate <= 40000) ? ff_on2avc_modes_40 : ff_on2avc_modes_44; c->wtf = (avctx->sample_rate <= 40000) ? wtf_40 : wtf_44; ff_mdct_init(&c->mdct, 11, 1, 1.0 / (32768.0 * 1024.0)); ff_mdct_init(&c->mdct_half, 10, 1, 1.0 / (32768.0 * 512.0)); ff_mdct_init(&c->mdct_small, 8, 1, 1.0 / (32768.0 * 128.0)); ff_fft_init(&c->fft128, 6, 0); ff_fft_init(&c->fft256, 7, 0); ff_fft_init(&c->fft512, 8, 1); ff_fft_init(&c->fft1024, 9, 1); avpriv_float_dsp_init(&c->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); if (init_vlc(&c->scale_diff, 9, ON2AVC_SCALE_DIFFS, ff_on2avc_scale_diff_bits, 1, 1, ff_on2avc_scale_diff_codes, 4, 4, 0)) { av_log(avctx, AV_LOG_ERROR, "Cannot init VLC\n"); return AVERROR(ENOMEM); for (i = 1; i < 9; i++) { int idx = i - 1; if (ff_init_vlc_sparse(&c->cb_vlc[i], 9, ff_on2avc_quad_cb_elems[idx], ff_on2avc_quad_cb_bits[idx], 1, 1, ff_on2avc_quad_cb_codes[idx], 4, 4, ff_on2avc_quad_cb_syms[idx], 2, 2, 0)) { av_log(avctx, AV_LOG_ERROR, "Cannot init VLC\n"); on2avc_free_vlcs(c); return AVERROR(ENOMEM); for (i = 9; i < 16; i++) { int idx = i - 9; if (ff_init_vlc_sparse(&c->cb_vlc[i], 9, ff_on2avc_pair_cb_elems[idx], ff_on2avc_pair_cb_bits[idx], 1, 1, ff_on2avc_pair_cb_codes[idx], 2, 2, ff_on2avc_pair_cb_syms[idx], 2, 2, 0)) { av_log(avctx, AV_LOG_ERROR, "Cannot init VLC\n"); on2avc_free_vlcs(c); return AVERROR(ENOMEM); return 0;
1threat
tkinter- Applying random function(from a couple of them) on a text widget everytime the program starts : So i created a couple of functions, to change the theme of my application, and some examples are given below: def redtheme(): text.config(background="light salmon", foreground="red", insertbackground="red") def greentheme(): text.config(background="pale green", foreground="dark green", insertbackground="dark green") def bluetheme(): text.config(background="light blue", foreground="dark blue", insertbackground="blue") (text is the name of the text widget) So i want to create a function that makes a random one of these functions run whenever the application is started. in other words: I want a function that is executed when the application starts, the function will choose from random.choice, a function and execute that function: full = (redtheme, greentheme, bluetheme) selected = random.choice(full) # here, it could be text.config(full)?? or what? now, how do i make it so that one of the 3 functions is executed whenever tha application starts
0debug
After i add spring-cloud-sleuth-zipkin-stream into pom.xml.The app can start.But i can't invoke my controller : First i want to integrate zipkin + rabbitmq into my project. so my pom.xml is on below <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> </dependency> so after i add this.I can't not invoke my controller.But if the controller in the same package with the Application.The controller can be invoke?Thanks for you guys help
0debug
PHP quotes in SQL : <p>Why does this code produce an error</p> <pre><code> $sql = "INSERT INTO accountlist VALUES ("", "$user", "'$pwd", "$mail", "$date")"; </code></pre> <p>and this one doesn't?</p> <pre><code> $sql = "INSERT INTO accountlist VALUES ('', '$user', '$pwd', '$mail', '$date')"; </code></pre> <p>I know that double quotes process variables while single quotes doesn't, so the first option should be the right one, but it is the opposite!</p>
0debug
How to load component dynamically using component name in angular2? : <p>I am currently loading angular components dynamically in my application using following code.</p> <pre><code>export class WizardTabContentContainer { @ViewChild('target', { read: ViewContainerRef }) target: any; @Input() TabContent: any | string; cmpRef: ComponentRef&lt;any&gt;; private isViewInitialized: boolean = false; constructor(private componentFactoryResolver: ComponentFactoryResolver, private compiler: Compiler) { } updateComponent() { if (!this.isViewInitialized) { return; } if (this.cmpRef) { this.cmpRef.destroy(); } let factory = this.componentFactoryResolver.resolveComponentFactory(this.TabContent); this.cmpRef = this.target.createComponent(factory); } } </code></pre> <p>Here resolveComponentFactory function accepts component type. My question is, Is there any way I can load component using component name string e.g I have component defined as</p> <pre><code>export class MyComponent{ } </code></pre> <p>How can I add above component using component name string "MyComponent" instead of type?</p>
0debug
How to customize ModelMapper : <p>I want to use ModelMapper to convert entity to DTO and back. Mostly it works, but how do I customize it. It has has so many options that it's hard to figure out where to start. What's best practice? </p> <p>I'll answer it myself below, but if another answer is better I'll accept it.</p>
0debug
How do i use WRITE_SETTINGS in android 5.1 higher version? : <p>I've developed a app which will automatically create hotsopt when app is opened The app is working fine in android version 5.1 and below, when i'm trying to install app in android version 6.1 app wasn't showing the permissions which requires and after installing the app, app wasn't opening.</p>
0debug
Java regex add space everytime number found in the string : <p>For example I have the string <code>number1number1number1</code>. Then I want to change it to <code>number 1 number 1 number 1</code>. So, for every single number that I find and not separated by a space, I will add a space. What should I do?</p>
0debug
codeigniter URL routes not working properly : Usually codeigniter URL format is domain/controllerName/functionName/id but i want it like domain/product-name/product-detail-page. I have made changes in routes.php also but it gives me 404 page. Any help. Urgent. ASAP.
0debug
static void inter_recon(AVCodecContext *ctx) { static const uint8_t bwlog_tab[2][N_BS_SIZES] = { { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, }; VP9Context *s = ctx->priv_data; VP9Block *b = s->b; int row = s->row, col = s->col; ThreadFrame *tref1 = &s->refs[s->refidx[b->ref[0]]]; AVFrame *ref1 = tref1->f; ThreadFrame *tref2 = b->comp ? &s->refs[s->refidx[b->ref[1]]] : NULL; AVFrame *ref2 = b->comp ? tref2->f : NULL; int w = ctx->width, h = ctx->height; ptrdiff_t ls_y = s->y_stride, ls_uv = s->uv_stride; if (b->bs > BS_8x8) { if (b->bs == BS_8x4) { mc_luma_dir(s, s->dsp.mc[3][b->filter][0], s->dst[0], ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, col << 3, &b->mv[0][0], 8, 4, w, h); mc_luma_dir(s, s->dsp.mc[3][b->filter][0], s->dst[0] + 4 * ls_y, ls_y, ref1->data[0], ref1->linesize[0], tref1, (row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[3][b->filter][1], s->dst[0], ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, col << 3, &b->mv[0][1], 8, 4, w, h); mc_luma_dir(s, s->dsp.mc[3][b->filter][1], s->dst[0] + 4 * ls_y, ls_y, ref2->data[0], ref2->linesize[0], tref2, (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h); } } else if (b->bs == BS_4x8) { mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0], ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, col << 3, &b->mv[0][0], 4, 8, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4, ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0], ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, col << 3, &b->mv[0][1], 4, 8, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4, ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w, h); } } else { av_assert2(b->bs == BS_4x4); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0], ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, col << 3, &b->mv[0][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4, ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4 * ls_y, ls_y, ref1->data[0], ref1->linesize[0], tref1, (row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], s->dst[0] + 4 * ls_y + 4, ls_y, ref1->data[0], ref1->linesize[0], tref1, (row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0], ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, col << 3, &b->mv[0][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4, ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4 * ls_y, ls_y, ref2->data[0], ref2->linesize[0], tref2, (row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], s->dst[0] + 4 * ls_y + 4, ls_y, ref2->data[0], ref2->linesize[0], tref2, (row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w, h); } } } else { int bwl = bwlog_tab[0][b->bs]; int bw = bwh_tab[0][b->bs][0] * 4, bh = bwh_tab[0][b->bs][1] * 4; mc_luma_dir(s, s->dsp.mc[bwl][b->filter][0], s->dst[0], ls_y, ref1->data[0], ref1->linesize[0], tref1, row << 3, col << 3, &b->mv[0][0],bw, bh, w, h); if (b->comp) mc_luma_dir(s, s->dsp.mc[bwl][b->filter][1], s->dst[0], ls_y, ref2->data[0], ref2->linesize[0], tref2, row << 3, col << 3, &b->mv[0][1], bw, bh, w, h); } { int bwl = bwlog_tab[1][b->bs]; int bw = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4; VP56mv mvuv; w = (w + 1) >> 1; h = (h + 1) >> 1; if (b->bs > BS_8x8) { mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x + b->mv[2][0].x + b->mv[3][0].x, 4); mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y + b->mv[2][0].y + b->mv[3][0].y, 4); } else { mvuv = b->mv[0][0]; } mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][0], s->dst[1], s->dst[2], ls_uv, ref1->data[1], ref1->linesize[1], ref1->data[2], ref1->linesize[2], tref1, row << 2, col << 2, &mvuv, bw, bh, w, h); if (b->comp) { if (b->bs > BS_8x8) { mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x + b->mv[2][1].x + b->mv[3][1].x, 4); mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y + b->mv[2][1].y + b->mv[3][1].y, 4); } else { mvuv = b->mv[0][1]; } mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][1], s->dst[1], s->dst[2], ls_uv, ref2->data[1], ref2->linesize[1], ref2->data[2], ref2->linesize[2], tref2, row << 2, col << 2, &mvuv, bw, bh, w, h); } } if (!b->skip) { int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n; int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2); int end_x = FFMIN(2 * (s->cols - col), w4); int end_y = FFMIN(2 * (s->rows - row), h4); int tx = 4 * s->lossless + b->tx, uvtx = b->uvtx + 4 * s->lossless; int uvstep1d = 1 << b->uvtx, p; uint8_t *dst = s->dst[0]; for (n = 0, y = 0; y < end_y; y += step1d) { uint8_t *ptr = dst; for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d, n += step) { int eob = b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n]; if (eob) s->dsp.itxfm_add[tx][DCT_DCT](ptr, s->y_stride, s->block + 16 * n, eob); } dst += 4 * s->y_stride * step1d; } h4 >>= 1; w4 >>= 1; end_x >>= 1; end_y >>= 1; step = 1 << (b->uvtx * 2); for (p = 0; p < 2; p++) { dst = s->dst[p + 1]; for (n = 0, y = 0; y < end_y; y += uvstep1d) { uint8_t *ptr = dst; for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d, n += step) { int eob = b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n]) : s->uveob[p][n]; if (eob) s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, s->uv_stride, s->uvblock[p] + 16 * n, eob); } dst += 4 * uvstep1d * s->uv_stride; } } } }
1threat
How to access `this` value within the object : <p>In below code I can access <code>wrapper</code> like this: <code>tutorial.screen1.wrapper</code> </p> <pre><code>var tutorial = { screen1: { text: '&lt;div class="text"&gt;Click this to continue&lt;/div&gt;', wrapper: '&lt;div class="tutorial tutorial-screen-1"&gt;' + this.text + '&lt;/div&gt;' } </code></pre> <p>Because <code>this.text</code> cannot be accessed, <code>tutorial.screen1.wrapper</code> throws error.</p> <p>How to make this <code>this.text</code> work with in the object?</p>
0debug
Typescript noImplicitAny and noImplicitReturns not working as expected : <p>I have added the "noImplicitAny" and "noImplicitReturns" to my Typescript tsconfig.json file:</p> <pre><code>{ "compilerOptions": { "target":"es5", "noImplicitAny": true, "noImplicitThis": true, "noImplicitReturns": true, "noUnusedLocals":true, "out": "dist/js/main.js" } } </code></pre> <p>I expected that the following code would generate errors, or at least warnings:</p> <pre><code>private randomMove() { // no return type but no warning :( let o = 3; // no type for o but no warning :( } </code></pre> <p>The "noUnusedLocals" IS working.</p> <p>Is this how it's supposed to work, am I missing something? Is it possible to have Visual Studio Code generate warnings when you don't specify types / return types?</p>
0debug
what is the way to create local notification in iOS 10 . does it work in older iOS version? : <p>what is the way to create local notification in iOS 10? <strong>does it work in older iOS version?</strong></p>
0debug
static int check_physical (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw) { int in_plb, ret; ctx->raddr = eaddr; ctx->prot = PAGE_READ; ret = 0; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_REAL_4xx: case POWERPC_MMU_BOOKE: ctx->prot |= PAGE_WRITE; break; #if defined(TARGET_PPC64) case POWERPC_MMU_64B: ctx->raddr &= 0x0FFFFFFFFFFFFFFFULL; ctx->prot |= PAGE_WRITE; break; #endif case POWERPC_MMU_SOFT_4xx_Z: if (unlikely(msr_pe != 0)) { in_plb = (env->pb[0] < env->pb[1] && eaddr >= env->pb[0] && eaddr < env->pb[1]) || (env->pb[2] < env->pb[3] && eaddr >= env->pb[2] && eaddr < env->pb[3]) ? 1 : 0; if (in_plb ^ msr_px) { if (rw == 1) { ret = -2; } } else { ctx->prot |= PAGE_WRITE; } } break; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "BookE FSL MMU model not implemented\n"); break; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } return ret; }
1threat
What does the CV stand for in sklearn.linear_model.LogisticRegressionCV? : <p>scikit-learn has two logistic regression functions:</p> <ul> <li>sklearn.linear_model.LogisticRegression</li> <li>sklearn.linear_model.LogisticRegressionCV</li> </ul> <p>I'm just curious what the CV stands for in the second one. The only acronym I know in ML that matches "CV" is cross-validation, but I'm guessing that's not it, since that would be achieved in scikit-learn with a wrapper function, not as part of the logistic regression function itself (I think).</p>
0debug
void zipl_load(void) { ScsiMbr *mbr = (void *)sec; LDL_VTOC *vlbl = (void *)sec; memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, mbr, "Cannot read block 0"); dputs("checking magic\n"); if (magic_match(mbr->magic, ZIPL_MAGIC)) { ipl_scsi(); } if (virtio_guessed_disk_nature()) { virtio_assume_iso9660(); } ipl_iso_el_torito(); if (virtio_guessed_disk_nature()) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } print_eckd_msg(); if (magic_match(mbr->magic, IPL1_MAGIC)) { ipl_eckd_cdl(); } memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read block 2"); if (magic_match(vlbl->magic, CMS1_MAGIC)) { ipl_eckd_ldl(ECKD_CMS); } if (magic_match(vlbl->magic, LNX1_MAGIC)) { ipl_eckd_ldl(ECKD_LDL); } ipl_eckd_ldl(ECKD_LDL_UNLABELED); ipl_eckd_cdl(); virtio_panic("\n* this can never happen *\n"); }
1threat
Include git commit hash in jar version : <p>I'm using maven and my goal is to include the git commit hash in the version number. Something like : 1.1.{git_hash}. </p> <p>I'm trying to follow this <a href="https://www.jayway.com/2012/04/07/continuous-deployment-versioning-and-git/" rel="noreferrer">tutorial</a>.</p> <p>Q: is it possible to somehow override the version number specified in the version element of the pom file?</p>
0debug
Survey in Mysql : <p>I really need some help with this survey. I want to insert it into phpmyadmin. I'm studying and i need this for a project. </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;link rel="stylesheet" href="style.css" type="text/css"/&gt; &lt;script src="https://code.jquery.com/jquery-2.1.4.min.js"&gt;&lt;/script&gt; &lt;script src="script.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;form action="action.php" method="get"&gt; &lt;h1&gt;KÆLEDYR&lt;/h1&gt; &lt;h3&gt;Oplysninger om dig&lt;/h3&gt; Navn:&lt;br&gt; &lt;input type="text" name="name" value="Navn"&gt;&lt;br&gt;&lt;br&gt; Email:&lt;br&gt; &lt;input type="email" name="email" value="navn@gmail.com"&gt;&lt;br&gt;&lt;br&gt; Køn:&lt;br&gt; &lt;input type="radio" name="gender" value="male" checked&gt; Mand&lt;br&gt; &lt;input type="radio" name="gender" value="female"&gt; Kvinde&lt;br&gt; &lt;input type="radio" name="gender" value="other"&gt; Ved ikke&lt;br&gt;&lt;br&gt; Alder: &lt;input type="number" name="age" value="ex.20"&gt;&lt;br&gt;&lt;br&gt; &lt;h3&gt;Har du kæledyr?&lt;/h3&gt; Har du kæledyr?:&lt;br&gt; &lt;input type="radio" name="yes" value="yes" checked&gt;Ja&lt;br&gt; &lt;input type="radio" name="no" value="no"&gt;Nej&lt;br&gt;&lt;br&gt; Hvis ja, hvor mange har du?: &lt;input type="number" name="pet-number" value="ex.20"&gt;&lt;br&gt;&lt;br&gt; Hvilke kældedyr har du?: &lt;br&gt; &lt;input type="checkbox" name="animal1" value="Hund"&gt;Hund &lt;br&gt; &lt;input type="checkbox" name="animal2" value="Kat"&gt;Kat &lt;br&gt; &lt;input type="checkbox" name="animal3" value="Reptil"&gt;Reptil &lt;br&gt; &lt;input type="checkbox" name="animal4" value="Fugl"&gt;Fugl &lt;br&gt; &lt;input type="checkbox" name="animal5" value="Fisk"&gt;Fisk &lt;br&gt; &lt;input type="checkbox" name="animal6" value="Hest"&gt;Hest &lt;br&gt; &lt;input type="checkbox" name="animal6" value="andet"&gt;Andet &lt;br&gt;&lt;br&gt; Kældedyrs quiz: &lt;br&gt; En dalmatiner er stribet?: &lt;br&gt; &lt;input type="radio" name="true" value="true" checked&gt;Sandt&lt;br&gt; &lt;input type="radio" name="false" value="false"&gt;Falsk&lt;br&gt;&lt;br&gt; &lt;br&gt; En hest har 5 ben: &lt;br&gt; &lt;input type="radio" name="true" value="true" checked&gt;Sandt&lt;br&gt; &lt;input type="radio" name="false" value="false"&gt;Falsk&lt;br&gt;&lt;br&gt; &lt;input type="submit"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My action.php looks like this.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php /* File: action.php Purpose: INSERT INTO ... */ $mysqli = new mysqli("localhost", "root", "","survey"); // creates the object if ($mysqli-&gt;connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli-&gt;connect_errno . ") " . $mysqli-&gt;connect_error; // if error messages } echo "You're connected to the database via: " . $mysqli-&gt;host_info . "\n"; if($_GET) { /* $fn = $_GET['firstName']; $ln = $_GET['lastName']; // format the sql $sql = "INSERT INTO `sakila`.`actor` (`actor_id`, `first_name`, `last_name`, `last_update`) VALUES (NULL, '" . $fn . "', '" . $ln . "', CURRENT_TIMESTAMP);"; */ // INSERT $sql = "INSERT INTO `person` (`name`, '".$_GET['name']."')"; echo $_GET["name"]; $insert = $mysqli-&gt;query($sql); echo "&lt;p&gt;et svar her ....&lt;/p&gt;"; echo $sql; } else { echo "&lt;p&gt;Error: Use the form please. No GET got.&lt;/p&gt;"; } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How do i proceed and get my survey into the database?</p>
0debug
How to navigate from one controller to another view controller programmatically in swift? : override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "GMNewPostControllerSegueIdentifier" { let svc = segue.destination as? UINavigationController let vc: GMNewPostController = svc?.topViewController as! GMNewPostController } } @IBAction func newPostButtonAction(_ sender: UIButton) { performSegue(withIdentifier: "GMNewPostController", sender: self) } } There is my Code, I don't like to drag and drop from my storyboard because i have table view in vc2.
0debug