problem
stringlengths
26
131k
labels
class label
2 classes
How to import all images from a folder in ReactJS? : <p>I want to import all images from a folder and want to use as needed. But can't do it by following methods. What I am doing? this: </p> <pre><code>import * as imageSrc from '../img'; let imageUrl = []; imageSrc.map( imageUrl.push(img) )) </code></pre> <p>I am getting this error in console.log</p> <pre><code>index.js:1452 ./src/components/Main.jsx Module not found: Can't resolve '../img' in 'G:\Projects\Personal\Portfolios\Portfolio_Main\React_portfolio\portfolio\src\components' </code></pre> <p>Folder Structure:</p> <pre><code>src&gt; components&gt; Main.jsx img&gt; [all image files] </code></pre>
0debug
Spring Data Rest controllers: behaviour and usage of @BasePathAwareController, @RepositoryRestController, @Controller and @RestController : <p>I'm trying to understand the exact behaviour of the Spring Data Rest Controllers.</p> <p>I have made a simple implementation to test 4 kinds of annotated controllers: <code>@BasePathAwareController</code>, <code>@RepositoryRestController</code>, <code>@RestController</code>, <code>@Controller</code></p> <p>The controller has a mapping for an entity "author" in the repository.</p> <p>This is the controller:</p> <pre><code>@BasePathAwareController //@RepositoryRestController //@RestController //@Controller public class MyController { @RequestMapping(value="authors/mycontroller/test") public void handleRequest(){ System.out.println("handleRequest of class MyController"); } @RequestMapping(value="/authors/mycontroller/testslash") public void handleSlashRequest(){ System.out.println("handleSlashRequest of class MyController"); } @RequestMapping(value="api/authors/mycontroller/test") public void handleApiRequest(){ System.out.println("handleApiRequest of class MyController"); } @RequestMapping(value="/api/authors/mycontroller/testslash") public void handleSlashApiRequest(){ System.out.println("handleSlashApiRequest of class MyController"); } } </code></pre> <p>I'm testing 4 methods because I have some doubts about the right mapping to be used.</p> <p>For every experiment, I use a different controller with the sames mappings, simply decommenting the annotation that I need for that experiment.</p> <p>I'm calling these two URLS with HTTP GET:</p> <pre><code>http://localhost:8080/myApp/api/mycontroller/test http://localhost:8080/myApp/api/mycontroller/testslash </code></pre> <p>This is the result that I obtain using <code>@BasePathAwareController</code>:</p> <pre><code>http://localhost:8080/myApp/api/mycontroller/test White page, No errors, No print on console http://localhost:8080/myApp/api/mycontroller/testslash White page, No errors, No print on console </code></pre> <p>This is the result using <code>@RepositoryRestController</code>:</p> <pre><code>http://localhost:8080/myApp/api/mycontroller/test White page, No errors, No print on console http://localhost:8080/myApp/api/mycontroller/testslash White page, and this message on the console (only for the first HTTP GET on this url): jul 27, 2016 9:23:57 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/myApp/api/authors/mycontroller/testslash] in DispatcherServlet with name 'rest' </code></pre> <p>This is the result if I use <code>@RestController</code>:</p> <pre><code>http://localhost:8080/myApp/api/mycontroller/test White page, in console: "handleRequest of class MyController" http://localhost:8080/myApp/api/mycontroller/testslash White page, in console: "handleSlashRequest of class MyController" </code></pre> <p>Finally, this is the result using <code>@Controller</code>:</p> <pre><code>http://localhost:8080/myApp/api/mycontroller/test HTTP STATUS 404, in console: "handleRequest of class MyController" http://localhost:8080/myApp/api/mycontroller/testslash HTTP STATUS 404, in console: "handleSlashRequest of class MyController" For both urls I have this warning: jul 27, 2016 9:28:11 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/myApp/api/authors/mycontroller/authors/mycontroller/test] in DispatcherServlet with name 'rest' </code></pre> <p>I don't understand what's going on.</p> <p>The only annotation that seems to provide the expected result is the <code>@RestController</code>.</p> <p><code>@Controller</code> apparently seems to work, but I have an HTTP status 404 and there is a message with an inconsistent URL <code>/myApp/api/authors/mycontroller/authors/mycontroller/test</code>, despite there is the correct handling message on the console.</p> <p>The other two annotations (<code>@BasePathAwareController</code> and <code>@RepositoryRestController</code>) don't do nothing.</p> <p>In summary:</p> <ul> <li><code>@BasePathAwareController</code>: doesn't do nothing</li> <li><code>@RepositoryRestController</code>: doesn't do nothing</li> <li><code>@Controller</code>: strange behaviour</li> <li><code>@RestController</code>: works perfectly</li> </ul> <p>It would be greatly appreciated any type of clarification about the behaviour and the usage of every kind of @Controller.</p> <p>Thanks.</p>
0debug
How to get only audio and video name without the .mp3 and .mp4 extention in android studio : I have audio and video names like this : azan1(1).mp3 and Funny.mp4 So I need an only AudioName as azan and VideoName as Funny. Need to replace .mp3 and .mp4 from the string how can I achieve this in code.??
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
how do I get the 3 times array in for loop? : I'm not familiar with c/c++, trying to implement for loop statement. But I've got error. >error C2296: '*' : illegal, left operand has type 'unsigned char *' unsigned char *_Orgin_Pixel_; unsigned char *_Copy_Pixel_; .... for (unsigned int i = 0; i < Picture_x_ * Picture_y_; i++) { *(_Copy_Pixel_*3 + i) = _Orgin_Pixel_[i]; } How do I resolve that problem?
0debug
.gitlab-ci.yml after_script section: how can I tell whether the task succeeded or failed? : <p>I'm using <a href="https://about.gitlab.com/features/gitlab-ci-cd/" rel="noreferrer">Gitlab CI</a>, and so have been working on a fairly complex <a href="https://docs.gitlab.com/ee/ci/yaml/" rel="noreferrer"><code>.gitlab-ci.yml</code></a> file. The file has an <code>after_script</code> section which runs when the main task is complete, or the main task has failed somehow. Problem: I need to do different cleanup based on whether the main task succeeded or failed, but I can't find any <a href="https://docs.gitlab.com/ee/ci/variables/" rel="noreferrer">Gitlab CI variable</a> that indicates the result of the main task.</p> <p>How can I tell, inside the <code>after_script</code> section, whether the main task has succeeded or failed?</p>
0debug
docker-compose mysql init sql is not executed : <p>I am trying to set up a mysql docker container and execute init sql script. Unfortunately the sql script is not executed. What am I doing wrong?</p> <pre><code>version: '3.3' services: api: container_name: 'api' build: './api' ports: - target: 8080 published: 8888 protocol: tcp mode: host volumes: - './api:/go/src/app' depends_on: - 'mysql' mysql: image: 'mysql:latest' container_name: 'mysql' volumes: - ./db_data:/var/lib/mysql:rw - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql:ro restart: always environment: MYSQL_USER: test MYSQL_PASSWORD: test MYSQL_ROOT_PASSWORD: test MYSQL_DATABASE: test ports: - '3306:3306' volumes: db_data: </code></pre> <p>I execute file with <code>docker-compose up -d --build</code></p>
0debug
uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val; k->get_config(vdev, vdev->config); if (addr > (vdev->config_len - sizeof(val))) return (uint32_t)-1; val = lduw_p(vdev->config + addr); return val; }
1threat
Is this Quicksort correct? : <p>I changed the pivot to be the first element in the array, will this Quicksort algorithm still be ok? and will the variable "l" in the data array be the first element in all the partitioning steps?</p> <p>x = data[l] // pivot</p> <p>thanks</p> <pre><code> public void QuickSort(int[] data) { QuickSort(data, 0, data.Length - 1); } private void QuickSort(int[] data, int l, int r) { int i, j; int x; i = l; j = r; x = data[l]; while (true) { while (data[i] &lt; x) { i++; } while (data[j] &gt; x) { j--; } if (l &lt;= j) { int temporary = data[i]; data[i] = data[j]; data[j] = temporary; i++; j--; } if (i &gt; j) { break; } } if (l &lt; j) { QuickSort(data, l, j); } if (i &lt; r) { QuickSort(data, i, r); } } </code></pre>
0debug
Could anyone explain me what I'm doing wrong - Swift logical operators : enter code here var results: [Int] = [] for n in 1...100 { if n % 2 !=0 && n % 7 == 0 { results.append(n) } } giving me the errors : '{' is expected after the if statement "braced block of statements is an unused closure" I'm freaking out.... Thanks for any help in advance p.s - I'm new to stackoverflow so if I did something wrong feel free to tell me what I did wrong and how to improve it `enter code here`
0debug
String interpolation issues : <p>I'm trying to figure out why my unit test fails (The third assert below):</p> <pre><code>var date = new DateTime(2017, 1, 1, 1, 0, 0); var formatted = "{countdown|" + date.ToString("o") + "}"; //Works Assert.AreEqual(date.ToString("o"), $"{date:o}"); //Works Assert.AreEqual(formatted, $"{{countdown|{date.ToString("o")}}}"); //This one fails Assert.AreEqual(formatted, $"{{countdown|{date:o}}}"); </code></pre> <p>AFAIK, this should work correctly, but it appears that it doesn't pass the formatting parameter in correctly, it it appears as just <code>{countdown|o}</code> to the code. Any idea why this is failing?</p>
0debug
socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, socklen_t salen, Error **errp) { SocketAddress *addr; struct sockaddr_un *su = (struct sockaddr_un *)sa; addr = g_new0(SocketAddress, 1); addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix = g_new0(UnixSocketAddress, 1); if (su->sun_path[0]) { addr->u.q_unix->path = g_strndup(su->sun_path, sizeof(su->sun_path)); } return addr; }
1threat
SQL Server User Mapping Error 15023 : <p>I try to map my other DB to a user by going to <br/>Security > Logins > right click someuser > Properties > User Mapping > Select DB > set as db_owner and then ok, but I keep on getting an error saying </p> <blockquote> <p>User, group, or role 'someuser' already exists in the current database. (Microsoft SQL Server, Error: 15023)</p> </blockquote> <p>What is causing the error, and how do I map that user to the database? </p>
0debug
ANGULAR 2 ROUTER NOT WORKING : can someone tell me why the navigation is not working? when i click on the button nothing happened but work.But if i use <router-outlet></router-outlet> it work This is my my app.module.ts @NgModule({ declarations: [ AppComponent, DashboardComponent, LoginComponent, SettingsComponent, RegisterComponent, ], imports: [ BrowserModule, AngularFireDatabaseModule, AngularFireAuthModule, FormsModule, AppRoutingModule, AngularFireModule, ], providers: [], bootstrap: [LoginComponent] }) export class AppModule { constructor() { firebase.initializeApp({ }); } }
0debug
static bool scsi_target_emulate_inquiry(SCSITargetReq *r) { assert(r->req.dev->lun != r->req.lun); scsi_target_alloc_buf(&r->req, SCSI_INQUIRY_LEN); if (r->req.cmd.buf[1] & 0x2) { return false; } if (r->req.cmd.buf[1] & 0x1) { uint8_t page_code = r->req.cmd.buf[2]; r->buf[r->len++] = page_code ; r->buf[r->len++] = 0x00; switch (page_code) { case 0x00: { int pages; pages = r->len++; r->buf[r->len++] = 0x00; r->buf[pages] = r->len - pages - 1; break; } default: return false; } assert(r->len < r->buf_len); r->len = MIN(r->req.cmd.xfer, r->len); return true; } if (r->req.cmd.buf[2] != 0) { return false; } r->len = MIN(r->req.cmd.xfer, SCSI_INQUIRY_LEN); memset(r->buf, 0, r->len); if (r->req.lun != 0) { r->buf[0] = TYPE_NO_LUN; } else { r->buf[0] = TYPE_NOT_PRESENT | TYPE_INACTIVE; r->buf[2] = 5; r->buf[3] = 2 | 0x10; r->buf[4] = r->len - 5; r->buf[7] = 0x10 | (r->req.bus->info->tcq ? 0x02 : 0); memcpy(&r->buf[8], "QEMU ", 8); memcpy(&r->buf[16], "QEMU TARGET ", 16); pstrcpy((char *) &r->buf[32], 4, qemu_get_version()); } return true; }
1threat
static void qmp_output_end_list(Visitor *v, void **obj) { QmpOutputVisitor *qov = to_qov(v); QObject *value = qmp_output_pop(qov, obj); assert(qobject_type(value) == QTYPE_QLIST); }
1threat
int cpu_exec(CPUArchState *env) { CPUState *cpu = ENV_GET_CPU(env); #if !(defined(CONFIG_USER_ONLY) && \ (defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X))) CPUClass *cc = CPU_GET_CLASS(cpu); #endif #ifdef TARGET_I386 X86CPU *x86_cpu = X86_CPU(cpu); #endif int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; uintptr_t next_tb; if (cpu->halted) { if (!cpu_has_work(cpu)) { return EXCP_HALTED; } cpu->halted = 0; } current_cpu = cpu; smp_mb(); if (unlikely(exit_request)) { cpu->exit_request = 1; } #if defined(TARGET_I386) CC_SRC = env->eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); env->df = 1 - (2 * ((env->eflags >> 10) & 1)); CC_OP = CC_OP_EFLAGS; env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C); #elif defined(TARGET_SPARC) #elif defined(TARGET_M68K) env->cc_op = CC_OP_FLAGS; env->cc_dest = env->sr & 0xf; env->cc_x = (env->sr >> 4) & 1; #elif defined(TARGET_ALPHA) #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_PPC) env->reserve_addr = -1; #elif defined(TARGET_LM32) #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_MOXIE) #elif defined(TARGET_OPENRISC) #elif defined(TARGET_SH4) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #elif defined(TARGET_XTENSA) #else #error unsupported target CPU #endif cpu->exception_index = -1; for(;;) { if (sigsetjmp(cpu->jmp_env, 0) == 0) { if (cpu->exception_index >= 0) { if (cpu->exception_index >= EXCP_INTERRUPT) { ret = cpu->exception_index; if (ret == EXCP_DEBUG) { cpu_handle_debug_exception(env); } break; } else { #if defined(CONFIG_USER_ONLY) #if defined(TARGET_I386) cc->do_interrupt(cpu); #endif ret = cpu->exception_index; break; #else cc->do_interrupt(cpu); cpu->exception_index = -1; #endif } } next_tb = 0; for(;;) { interrupt_request = cpu->interrupt_request; if (unlikely(interrupt_request)) { if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; cpu->exception_index = EXCP_DEBUG; cpu_loop_exit(cpu); } #if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \ defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \ defined(TARGET_MICROBLAZE) || defined(TARGET_LM32) || defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HALT) { cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; cpu->halted = 1; cpu->exception_index = EXCP_HLT; cpu_loop_exit(cpu); } #endif #if defined(TARGET_I386) #if !defined(CONFIG_USER_ONLY) if (interrupt_request & CPU_INTERRUPT_POLL) { cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; apic_poll_irq(x86_cpu->apic_state); } #endif if (interrupt_request & CPU_INTERRUPT_INIT) { cpu_svm_check_intercept_param(env, SVM_EXIT_INIT, 0); do_cpu_init(x86_cpu); cpu->exception_index = EXCP_HALTED; cpu_loop_exit(cpu); } else if (interrupt_request & CPU_INTERRUPT_SIPI) { do_cpu_sipi(x86_cpu); } else if (env->hflags2 & HF2_GIF_MASK) { if ((interrupt_request & CPU_INTERRUPT_SMI) && !(env->hflags & HF_SMM_MASK)) { cpu_svm_check_intercept_param(env, SVM_EXIT_SMI, 0); cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; do_smm_enter(x86_cpu); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_NMI) && !(env->hflags2 & HF2_NMI_MASK)) { cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); next_tb = 0; } else if (interrupt_request & CPU_INTERRUPT_MCE) { cpu->interrupt_request &= ~CPU_INTERRUPT_MCE; do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); next_tb = 0; } else if ((interrupt_request & CPU_INTERRUPT_HARD) && (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { int intno; cpu_svm_check_intercept_param(env, SVM_EXIT_INTR, 0); cpu->interrupt_request &= ~(CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); next_tb = 0; #if !defined(CONFIG_USER_ONLY) } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) && (env->eflags & IF_MASK) && !(env->hflags & HF_INHIBIT_IRQ_MASK)) { int intno; cpu_svm_check_intercept_param(env, SVM_EXIT_VINTR, 0); intno = ldl_phys(cpu->as, env->vm_vmcb + offsetof(struct vmcb, control.int_vector)); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); cpu->interrupt_request &= ~CPU_INTERRUPT_VIRQ; next_tb = 0; #endif } } #elif defined(TARGET_PPC) if ((interrupt_request & CPU_INTERRUPT_RESET)) { cpu_reset(cpu); } if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; } next_tb = 0; } #elif defined(TARGET_LM32) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) { cpu->exception_index = EXCP_IRQ; cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_MICROBLAZE) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sregs[SR_MSR] & MSR_IE) && !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP)) && !(env->iflags & (D_FLAG | IMM_FLAG))) { cpu->exception_index = EXCP_IRQ; cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_MIPS) if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { cpu->exception_index = EXCP_EXT_INTERRUPT; env->error_code = 0; cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_OPENRISC) { int idx = -1; if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sr & SR_IEE)) { idx = EXCP_INT; } if ((interrupt_request & CPU_INTERRUPT_TIMER) && (env->sr & SR_TEE)) { idx = EXCP_TICK; } if (idx >= 0) { cpu->exception_index = idx; cc->do_interrupt(cpu); next_tb = 0; } } #elif defined(TARGET_SPARC) if (interrupt_request & CPU_INTERRUPT_HARD) { if (cpu_interrupts_enabled(env) && env->interrupt_index > 0) { int pil = env->interrupt_index & 0xf; int type = env->interrupt_index & 0xf0; if (((type == TT_EXTINT) && cpu_pil_allowed(env, pil)) || type != TT_EXTINT) { cpu->exception_index = env->interrupt_index; cc->do_interrupt(cpu); next_tb = 0; } } } #elif defined(TARGET_ARM) if (interrupt_request & CPU_INTERRUPT_FIQ && !(env->daif & PSTATE_F)) { cpu->exception_index = EXCP_FIQ; cc->do_interrupt(cpu); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_HARD && ((IS_M(env) && env->regs[15] < 0xfffffff0) || !(env->daif & PSTATE_I))) { cpu->exception_index = EXCP_IRQ; cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_UNICORE32) if (interrupt_request & CPU_INTERRUPT_HARD && !(env->uncached_asr & ASR_I)) { cpu->exception_index = UC32_EXCP_INTR; cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_SH4) if (interrupt_request & CPU_INTERRUPT_HARD) { cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_ALPHA) { int idx = -1; switch (env->pal_mode ? 7 : env->ps & PS_INT_MASK) { case 0 ... 3: if (interrupt_request & CPU_INTERRUPT_HARD) { idx = EXCP_DEV_INTERRUPT; } case 4: if (interrupt_request & CPU_INTERRUPT_TIMER) { idx = EXCP_CLK_INTERRUPT; } case 5: if (interrupt_request & CPU_INTERRUPT_SMP) { idx = EXCP_SMP_INTERRUPT; } case 6: if (interrupt_request & CPU_INTERRUPT_MCHK) { idx = EXCP_MCHK; } } if (idx >= 0) { cpu->exception_index = idx; env->error_code = 0; cc->do_interrupt(cpu); next_tb = 0; } } #elif defined(TARGET_CRIS) if (interrupt_request & CPU_INTERRUPT_HARD && (env->pregs[PR_CCS] & I_FLAG) && !env->locked_irq) { cpu->exception_index = EXCP_IRQ; cc->do_interrupt(cpu); next_tb = 0; } if (interrupt_request & CPU_INTERRUPT_NMI) { unsigned int m_flag_archval; if (env->pregs[PR_VR] < 32) { m_flag_archval = M_FLAG_V10; } else { m_flag_archval = M_FLAG_V32; } if ((env->pregs[PR_CCS] & m_flag_archval)) { cpu->exception_index = EXCP_NMI; cc->do_interrupt(cpu); next_tb = 0; } } #elif defined(TARGET_M68K) if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { cpu->exception_index = env->pending_vector; do_interrupt_m68k_hardirq(env); next_tb = 0; } #elif defined(TARGET_S390X) && !defined(CONFIG_USER_ONLY) if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->psw.mask & PSW_MASK_EXT)) { cc->do_interrupt(cpu); next_tb = 0; } #elif defined(TARGET_XTENSA) if (interrupt_request & CPU_INTERRUPT_HARD) { cpu->exception_index = EXC_IRQ; cc->do_interrupt(cpu); next_tb = 0; } #endif if (cpu->interrupt_request & CPU_INTERRUPT_EXITTB) { cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; next_tb = 0; } } if (unlikely(cpu->exit_request)) { cpu->exit_request = 0; cpu->exception_index = EXCP_INTERRUPT; cpu_loop_exit(cpu); } spin_lock(&tcg_ctx.tb_ctx.tb_lock); have_tb_lock = true; tb = tb_find_fast(env); if (tcg_ctx.tb_ctx.tb_invalidated_flag) { next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } if (qemu_loglevel_mask(CPU_LOG_EXEC)) { qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); } if (next_tb != 0 && tb->page_addr[1] == -1) { tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK), next_tb & TB_EXIT_MASK, tb); } have_tb_lock = false; spin_unlock(&tcg_ctx.tb_ctx.tb_lock); cpu->current_tb = tb; barrier(); if (likely(!cpu->exit_request)) { tc_ptr = tb->tc_ptr; next_tb = cpu_tb_exec(cpu, tc_ptr); switch (next_tb & TB_EXIT_MASK) { case TB_EXIT_REQUESTED: tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); next_tb = 0; break; case TB_EXIT_ICOUNT_EXPIRED: { int insns_left; tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { cpu->icount_extra += insns_left; if (cpu->icount_extra > 0xffff) { insns_left = 0xffff; } else { insns_left = cpu->icount_extra; } cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { cpu_exec_nocache(env, insns_left, tb); } cpu->exception_index = EXCP_INTERRUPT; next_tb = 0; cpu_loop_exit(cpu); } break; } default: break; } } cpu->current_tb = NULL; } } else { cpu = current_cpu; env = cpu->env_ptr; #if !(defined(CONFIG_USER_ONLY) && \ (defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X))) cc = CPU_GET_CLASS(cpu); #endif #ifdef TARGET_I386 x86_cpu = X86_CPU(cpu); #endif if (have_tb_lock) { spin_unlock(&tcg_ctx.tb_ctx.tb_lock); have_tb_lock = false; } } } #if defined(TARGET_I386) env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP) | (env->df & DF_MASK); #elif defined(TARGET_ARM) #elif defined(TARGET_UNICORE32) #elif defined(TARGET_SPARC) #elif defined(TARGET_PPC) #elif defined(TARGET_LM32) #elif defined(TARGET_M68K) cpu_m68k_flush_flags(env, env->cc_op); env->cc_op = CC_OP_FLAGS; env->sr = (env->sr & 0xffe0) | env->cc_dest | (env->cc_x << 4); #elif defined(TARGET_MICROBLAZE) #elif defined(TARGET_MIPS) #elif defined(TARGET_MOXIE) #elif defined(TARGET_OPENRISC) #elif defined(TARGET_SH4) #elif defined(TARGET_ALPHA) #elif defined(TARGET_CRIS) #elif defined(TARGET_S390X) #elif defined(TARGET_XTENSA) #else #error unsupported target CPU #endif current_cpu = NULL; return ret; }
1threat
static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in, int x1, int y1, int x2, int y2) { if (x1 >= 0 && y1 >= 0) { if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1) && x2 >= x1 && y2 >= y1) { const int cx = x1 + (x2 - x1)/2; const int cy = y1 + (y2 - y1)/2; const int scaled_x = cx * ASS_DEFAULT_PLAYRESX / 720; const int scaled_y = cy * ASS_DEFAULT_PLAYRESY / 480; av_bprintf(dst, "{\\an5}{\\pos(%d,%d)}", scaled_x, scaled_y); } else { const int scaled_x = x1 * ASS_DEFAULT_PLAYRESX / 720; const int scaled_y = y1 * ASS_DEFAULT_PLAYRESY / 480; av_bprintf(dst, "{\\an1}{\\pos(%d,%d)}", scaled_x, scaled_y); } } ff_htmlmarkup_to_ass(avctx, dst, in); }
1threat
static void iscsi_retry_timer_expired(void *opaque) { struct IscsiTask *iTask = opaque; iTask->complete = 1; if (iTask->co) { qemu_coroutine_enter(iTask->co, NULL); } }
1threat
Catchable fatal error: Object of class mysqli could not be converted to string on line 8 : <p>I tried checking many time , still gives me this error. Actually i am trying to create a php file with the contents of $output in it .</p> <pre><code>&lt;?php include 'dbconfig.php'; $rand = $_GET['rand']; $filename = $rand.".php"; $output = "&lt;?php"; $output .="include '../dbconfig.php';"; $output .="$myself = basename(__FILE__, '.php'); "; $output .="$query = mysqli_query($dbconfig,\"Select command from records where token = '$myself'\");"; $output .="if(mysqli_num_rows($query) &gt; 0)"; $output .="{"; $output .="while($row=$query-&gt;fetch_assoc())"; $output .="{"; $output .="$command = $row[command];"; $output .="}"; $output .="echo 'exec $command endexec';"; $output .="}"; $output .="?&gt;"; $file = fopen("puppet\$filename","w"); fwrite($file,$putput); $check = "Select * from records where usertoken = $rand"; $check1 = mysqli_query($dbconfig,$check); if(mysqli_num_rows($check1)== 0){ $ins = "Insert into records (usertoken)Values('$rand')"; if(mysqli_query($dbconfig,$ins)){ $success=true; } }else{ $success=false; } ?&gt; </code></pre>
0debug
How to increase value of variable after second loop? (I'm a Beginner) : I am making a for loop for my robot. Basically, I want to robot to move one more row that the one before it after each loop. I want to start at how many rows the user wants eventually keep going. So if the user wants 4 row to begin with, it'll start off moving 4 rows, then it'll move for 5 rows, then it'll move for 6 rows, etc. I used variable makeLine and put it as makeLine++ so it would increase each time by one. However, when I do this it starts off at 5 instead of 4 each time. How do I make sure it starts off at the value the user inputted but also go up by 1 after that Sorry if this is a stupid question I'm a beginner lol
0debug
MS Access DLookUp malfunction. : Good day everyone, I have a very weird problem occurring in MS Access which I can't seem to figure out. The summary is: I have a table from Sharepoint that is connected to my MS Access db and a Person table in my Ms Access db. I pull the information row by row from the Sharepoint table and add it to Person Table. However, before adding the new data I must check if that specific Person already exists in my table. I check for 'Lastname', 'Firstname' and 'Date created' using DLookup function. Here where everything goes side ways. DLookup returns me a NULL for almost half of the record that already exist in Person Table. After playing a lot with the condition in DLookup statement my conclusion is that there is a problem with the 'Date created' parameter, yet I have tried using "#" and CDate and even Format, nothing works. Please help! P.S: I have tried DCount, same thing happens. DCount returns 0 yet I know for a fact the record is there.
0debug
INC command in assemblxy x86 : does the INC command used on registers increments by 1 byte or by 4 bytes? For example, first I set mov ecx,0. and then inc ecx. what does ecx hold? example number 2: esi holds an address in memory. What happens in this case? I think that in the first case is 4 bytes and in the second its 1 byte (because memory), am I right?
0debug
Sort a python dictionary value which is a list : <p>I have a dictionary with the following structure, how can I sort each list within itself in ascending order?</p> <pre><code>mydictionary = {'1':[1,4,2], '2':[2,1,3], '3':[1,3,2]} </code></pre> <p>I want to have the dictionary sorted like this:</p> <pre><code>mydictionary_sorted = {'1':[1,2,4], '2':[1,2,3], '3':[1,2,3]} </code></pre>
0debug
Clear Screen comand in R Language : <p>I'm new in R language and now learning with RStudio, sometimes when I do code and my command line in so full with errors, and I want to clear the screen. Like you know when you got really tired of messy screen. What is the command to this, like cls in CMD or CLC in Matlab?</p>
0debug
void cpu_single_step(CPUState *cpu, int enabled) { #if defined(TARGET_HAS_ICE) if (cpu->singlestep_enabled != enabled) { cpu->singlestep_enabled = enabled; if (kvm_enabled()) { kvm_update_guest_debug(cpu, 0); } else { CPUArchState *env = cpu->env_ptr; tb_flush(env); } } #endif }
1threat
static void ipmi_sim_realize(DeviceState *dev, Error **errp) { IPMIBmc *b = IPMI_BMC(dev); unsigned int i; IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b); qemu_mutex_init(&ibs->lock); QTAILQ_INIT(&ibs->rcvbufs); ibs->bmc_global_enables = (1 << IPMI_BMC_EVENT_LOG_BIT); ibs->device_id = 0x20; ibs->ipmi_version = 0x02; ibs->restart_cause = 0; for (i = 0; i < 4; i++) { ibs->sel.last_addition[i] = 0xff; ibs->sel.last_clear[i] = 0xff; ibs->sdr.last_addition[i] = 0xff; ibs->sdr.last_clear[i] = 0xff; } ipmi_sdr_init(ibs); ibs->acpi_power_state[0] = 0; ibs->acpi_power_state[1] = 0; if (qemu_uuid_set) { memcpy(&ibs->uuid, qemu_uuid, 16); } else { memset(&ibs->uuid, 0, 16); } ipmi_init_sensors_from_sdrs(ibs); register_cmds(ibs); ibs->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ipmi_timeout, ibs); vmstate_register(NULL, 0, &vmstate_ipmi_sim, ibs); }
1threat
Java JFrame layouts issue : I am new to programming and I am making a simple school project. I am trying make everything dynamicaly.I have two JPanels which I need to seperate 1:5 in one JFrame. But I can't find the suitable layout.
0debug
when I close my java program it refreshes everything : Label.setEnabled(true) If(i==0) Label.setEnabled(false); . if I is equal to 0 it would not be enabled but when I close the program and open it again it will be enabled instead of staying disabled.
0debug
SQL add columns of each record together : <p>To be blunt I don't know SQL however I don't want the answer, I want to work it out myself.</p> <p>Here's the question:</p> <p>Write a SQL query to calculate the number of goals for each team.</p> <p>players</p> <pre><code>id name team_id goals 1 Joel 1 3 2 Ed 2 1 3 Simon 2 4 </code></pre> <p>teams</p> <pre><code>id name 1 New Zealand 2 London </code></pre> <p>What I'm asking for is an arrow to information that will allow me to solve the question.</p> <p>I've tried looking myself but I don't even know the correct terminology to ask the question, googling 'write sql to add fields for each row' just seems to return about adding columns or inserting.</p>
0debug
React Context: TypeError: render is not a function : <p>I'm trying to use React Context to pass a function to a nested child component, which effectively allows the child to update the parents state when pressed.</p> <p>The problem is I seem to be getting an error <strong>'TypeError: render is not a function. (In render(newValue), render is an instance of Array'</strong> and an error in my console reads: <strong>'Warning: A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it.'</strong></p> <p>I've looked around at this error and also at documentation but no answers seem to answer my question, I can't quite work out why this isn't working.</p> <p><strong>EDIT:</strong> I should add that there are multiple child components rendered, as they're built from an array of objects</p> <p>Snippets:</p> <p>Parent:</p> <pre><code>class Product extends Component { state = { selected_ind: 0 }; handleContextChange = selected_ind =&gt; { this.setState({selected_ind}); }; render() { const contextValue = { data: this.state, handleChange: this.handleContextChange }; //Desconstruct props for ease of use const { attr_data, variant, product_name } = this.props; return ( &lt;Container&gt; &lt;Heading&gt;Product Options&lt;/Heading&gt; &lt;IndexContext.Provider value={contextValue}&gt; &lt;OptionTile tileColor='grey' onPress={ () =&gt; this.props.navigation.navigate('Variants', { attr_data: attr_data, selected_ind: this.state.selected_ind })} //Replace with named function option="Variant" selected_ind={ this.state.selected_ind } value={ selected_attr.name } /&gt; &lt;/IndexContext.Provider&gt; &lt;OptionTile tileColor='grey' option="Quantity" value="1" /&gt; &lt;/Container&gt; </code></pre> <p>Within OptionTile is the child I'd like to use the function within:</p> <pre><code>const VariantTile = (props) =&gt; { return ( &lt;IndexContext.Consumer&gt; {({ handleChange }) =&gt; ( &lt;TouchableOpacity onPress={handleChange(props.index)}&gt; &lt;AsyncImage source={ props.img_src } placeholderColor="#fafafa" style={{ flex: 1, width: null, height: 200 }} /&gt; &lt;Text&gt;{ props.var_name }&lt;/Text&gt; &lt;Text&gt;{ props.price }&lt;/Text&gt; &lt;Text&gt;{ props.sku }&lt;/Text&gt; &lt;/TouchableOpacity&gt; )}; &lt;/IndexContext.Consumer&gt; ) }; </code></pre> <p>And the context component is simple:</p> <pre><code>const IndexContext = React.createContext(); export default IndexContext; </code></pre>
0debug
int bdrv_eject(BlockDriverState *bs, int eject_flag) { BlockDriver *drv = bs->drv; if (bs->locked) { return -EBUSY; } if (drv && drv->bdrv_eject) { drv->bdrv_eject(bs, eject_flag); } bs->tray_open = eject_flag; return 0; }
1threat
rottet alpha numeric and numbers placeses : i need to rottet the placess on numeric and alpha-numeric placess. need to see first the alph-numeric and then the numeric. for example: 11AA 20BA 70D 9SD i need to get this: AA11 BA20 D70 SD9 i try with reverse - but it not what i need.... public static string Reverse( string s ) { char[] charArray = s.ToCharArray(); Array.Reverse( charArray ); return new string( charArray ); } thanks
0debug
Self-made slideToggle() : <p>I've been using <code>slideToggle()</code> and I love the effect. How does this <code>slideToggle()</code> work and how do I recreate it using CSS + Javascript? How does it give the sliding effect as I can't simply just play with <code>height: 0</code> and <code>height: auto</code>?</p>
0debug
static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h) { int sx = 0, sy = 0; int dx = 0, dy = 0; int depth = 0; int notify = 0; if (*s->cirrus_rop == cirrus_bitblt_rop_fwd_src || *s->cirrus_rop == cirrus_bitblt_rop_bkwd_src) { int width, height; depth = s->vga.get_bpp(&s->vga) / 8; if (!depth) { return 0; } s->vga.get_resolution(&s->vga, &width, &height); sx = (src % ABS(s->cirrus_blt_srcpitch)) / depth; sy = (src / ABS(s->cirrus_blt_srcpitch)); dx = (dst % ABS(s->cirrus_blt_dstpitch)) / depth; dy = (dst / ABS(s->cirrus_blt_dstpitch)); w /= depth; if (s->cirrus_blt_dstpitch < 0) { sx -= (s->cirrus_blt_width / depth) - 1; dx -= (s->cirrus_blt_width / depth) - 1; sy -= s->cirrus_blt_height - 1; dy -= s->cirrus_blt_height - 1; } if (sx >= 0 && sy >= 0 && dx >= 0 && dy >= 0 && (sx + w) <= width && (sy + h) <= height && (dx + w) <= width && (dy + h) <= height) { notify = 1; } } if (notify) graphic_hw_update(s->vga.con); (*s->cirrus_rop) (s, s->vga.vram_ptr + s->cirrus_blt_dstaddr, s->vga.vram_ptr + s->cirrus_blt_srcaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch, s->cirrus_blt_width, s->cirrus_blt_height); if (notify) { qemu_console_copy(s->vga.con, sx, sy, dx, dy, s->cirrus_blt_width / depth, s->cirrus_blt_height); } cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_width, s->cirrus_blt_height); return 1; }
1threat
av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq) { afq->avctx = avctx; afq->next_pts = AV_NOPTS_VALUE; afq->remaining_delay = avctx->delay; afq->remaining_samples = avctx->delay; afq->frame_queue = NULL; }
1threat
How can I bring xampp control panel setting to desktop, in Ubuntu? : <p>I am running lampp on ubuntu 64 bit system, I am finding problem to start xampp server every time.</p>
0debug
Why they still have separate floating point unit , if there is Neon for fast processing of floating points in ARM cortex processors. : <p>Neon (advanced SIMD) is very fast for add,subtract,multiply and floating point operations like single precision and double precision. Why ARM company still have another separate unit for floating point calculation as you can see in picture. i am little bit confused about it. </p> <p><a href="https://i.stack.imgur.com/d8Xe0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d8Xe0.png" alt="enter image description here"></a></p>
0debug
HttpClient in using statement : <p>hi i read this article <a href="http://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/" rel="noreferrer">You're using HttpClient wrong and it is destabilizing your software</a> the article is suggesting these 2</p> <ol> <li>Make your HttpClient static</li> <li>Do not dispose of or wrap your HttpClient in a using unless you explicitly are looking for a particular behaviour (such as causing your services to fail)</li> </ol> <p>now a newbie on c# like me would just follow it like the code posted on the article here is the original code the he said would make the application fail</p> <pre><code>using System; using System.Net.Http; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Starting connections"); for(int i = 0; i&lt;10; i++) { using(var client = new HttpClient()) { var result = client.GetAsync("http://aspnetmonsters.com").Result; Console.WriteLine(result.StatusCode); } } Console.WriteLine("Connections done"); } } } </code></pre> <p>and to fix it he gave this code:</p> <pre><code>using System; using System.Net.Http; namespace ConsoleApplication { public class Program { private static HttpClient Client = new HttpClient(); public static void Main(string[] args) { Console.WriteLine("Starting connections"); for(int i = 0; i&lt;10; i++) { var result = Client.GetAsync("http://aspnetmonsters.com").Result; Console.WriteLine(result.StatusCode); } Console.WriteLine("Connections done"); Console.ReadLine(); } } } </code></pre> <p>now being curious like any newbie i thought of the for loop inside the using statement will the effect be the same as the latter?</p> <p>thank you </p>
0debug
breaking float value in char and transmit it on tcp and read using java program : <p>I using this c code to convert and transmit float data form micro controller using TCP/IP. Here I break float in to four char value and this work well. But I need its equivalent java code to again get float value on server end. </p> <p>I am new for java. so please help. </p> <p>/********************************************************************************/</p> <pre><code>unsigned char outbox[5]; void breakDown(void) { int index=0; float member=-600.231; unsigned long d = *(unsigned long *)&amp;member; outbox[0] = d &amp; 0x00FF; outbox[1] = (d &amp; 0xFF00) &gt;&gt; 8; outbox[2] = (d &amp; 0xFF0000) &gt;&gt; 16; outbox[3] = (d &amp; 0xFF000000) &gt;&gt; 24; } void buildUp(void) { unsigned long d; unsigned index; d = ((long)outbox[3] &lt;&lt; 24); d|= ((long)outbox[2] &lt;&lt; 16); d|= ((long)outbox[1] &lt;&lt; 8); d|= ((long)outbox[0]); float member = *(float *)&amp;d; printf("Float output=%f\n\n",member); } </code></pre>
0debug
def sum_Of_Subarray_Prod(arr,n): ans = 0 res = 0 i = n - 1 while (i >= 0): incr = arr[i]*(1 + res) ans += incr res = incr i -= 1 return (ans)
0debug
static target_ulong h_send_logical_lan(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong *bufs = args + 1; target_ulong continue_token = args[7]; VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev; unsigned total_len; uint8_t *lbuf, *p; int i, nbufs; int ret; dprintf("H_SEND_LOGICAL_LAN(0x" TARGET_FMT_lx ", <bufs>, 0x" TARGET_FMT_lx ")\n", reg, continue_token); if (!sdev) { return H_PARAMETER; } dprintf("rxbufs = %d\n", dev->rx_bufs); if (!dev->isopen) { return H_DROPPED; } if (continue_token) { return H_HARDWARE; } total_len = 0; for (i = 0; i < 6; i++) { dprintf(" buf desc: 0x" TARGET_FMT_lx "\n", bufs[i]); if (!(bufs[i] & VLAN_BD_VALID)) { break; } total_len += VLAN_BD_LEN(bufs[i]); } nbufs = i; dprintf("h_send_logical_lan() %d buffers, total length 0x%x\n", nbufs, total_len); if (total_len == 0) { return H_SUCCESS; } if (total_len > MAX_PACKET_SIZE) { return H_RESOURCE; } lbuf = alloca(total_len); p = lbuf; for (i = 0; i < nbufs; i++) { ret = spapr_tce_dma_read(sdev, VLAN_BD_ADDR(bufs[i]), p, VLAN_BD_LEN(bufs[i])); if (ret < 0) { return ret; } p += VLAN_BD_LEN(bufs[i]); } qemu_send_packet(&dev->nic->nc, lbuf, total_len); return H_SUCCESS; }
1threat
Are there any benefits of using subcollections in firestore? : <p>I have a subcollection for each doc in the users collection of my app. This subcollection stores docs that are related to the user, however they could just as well be saved to a master collection, each doc with an associated userId. </p> <p>I chose this structure as it seemed the most obvious at the time but I can imagine it will make things harder down the road if I need to do database maintenance. E.g. If I wanted to clean up those docs, I would have to query each user and then each users docs, whereas if I had a master collection I could just query all docs.</p> <p>That lead me to question what is the point of subcollections at all, if you can just associate those docs with an ID. Is it solely there so that you can expand if your doc becomes close to the 1MB limit?</p>
0debug
how to get value from dynamically created edit text in android : **PLEASE DON'T MARK THIS QUESTION AS DUPLICATE BECAUSE I HAVE SEARCHED ALMOST EVERYTHING AND TRIED EVERY SOLUTION BUT NONE OF THEM WORKED FOR ME.** *and because i don't have much reputation i am not able to post comment on other answered post about my issue and that is why i am asking this question* my question is how to get value from dynamically created EditText in android this is my dynamic view (xml file) <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/et_waypoint" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/background" android:hint="Way Points" android:padding="10dp" android:textSize="16sp" /> <Button android:id="@+id/btn_waypoint" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Find" /> </LinearLayout> and i am using `LayoutInflater` because i want perfect Designed layout which is not accomplish by me via `setLayoutParams` so this is the reason i am using `LayoutInflater` and here is my code LayoutInflater l = getLayoutInflater(); final LinearLayout mainActivity = (LinearLayout) findViewById(R.id.dynamic); final View view = l.inflate(R.layout.dynamic_layout_waypoints, null); buttonWayPoints = (Button) view.findViewById(R.id.btn_waypoint); editTextWayPoints = (EditText) view.findViewById(R.id.et_waypoint); mainActivity.addView(editTextWayPoints); and i am new to android so please help me with this. and most of people suggest this > http://stackoverflow.com/a/5923764/4696610 solution but its not worked for me, the issue is when i implement this code my **ADD NEW EDIT TEXT BUTTON** not respond me.
0debug
SQL-Creating TAble : Hi So i am stuck with this question.I know table can be created with the select statement. CREATE TABLE new_orders (ordr_id,order_date DEFAULT SYSDATE,cus_id) AS Select order_id.order_date,customer_id FROM Orders; Which statement would be true regarding the above question ? 1.The NEW_ORDERS table would not get created beacuse the default value cannot be specified in the column definition. 2.The NEW_ORDERS table would get created and only the NOT NULL constraint define on the specified columnns would be passed to the new table. 3.The NEW_ORDERS table would not get created because the column names in the CREATE TABLE command and the SELECT clause do not match. 4.The NEW_ORDERS table would get created and all the constraints defined on the specified columns in the orders table would be passed to new Table. I think correct answer should be 3,but it's wrong.The correct answer according to my book is 2.I don't get it how ? Can anyone pls help me with the ?
0debug
helm dry run install : <p>I am trying to test my development helm chat deployment output using <code>--dry-run</code> option. when I run the below command its trying to connect to Kubernetes API server. </p> <p>Is dry run option required to connect Kubernetes cluster? all I want to check the deployment yaml file output.</p> <pre><code>helm install mychart-0.1.0.tgz --dry-run --debug Error: Get http://localhost:8080/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it. </code></pre>
0debug
Scopes in blank function c++ : <p>Hy, my question is simple.. I have this function.</p> <pre><code>CPythonMessenger::CPythonMessenger(): m_poMessengerHandler(NULL) { } </code></pre> <p>What scope have and why is there since constructor is empty and also is not used <code>m_poMessengerHandler(NULL)</code> i want to say the function is not used anywhere is constructor.</p>
0debug
def drop_empty(dict1): dict1 = {key:value for (key, value) in dict1.items() if value is not None} return dict1
0debug
What does a ws() block do in Jenkins? : <p>I'm trying to convert few <code>Jenkinsfile</code>s from <a href="https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline" rel="noreferrer">Scripted Pipeline</a> to <a href="https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline" rel="noreferrer">Declarative Pipeline</a>. I have a block like this in a <code>Jenkinsfile</code>:</p> <pre><code>ws("/path/to/dir") { // do stuff } </code></pre> <p>I wonder what does it do exactly and what's the proper way to convert it to the Declarative Pipeline syntax.</p>
0debug
how can i make the user input become a variable and then have that variable be used in a later function? this is my code: : I can't figure out what im doing wrong, i wanted to make a program that allowed the user to pick a stock ticker and a couple of other inputs, and then get real time data that immediately went back into the program and would display the stock info and stuff. theres a lot of code there, i wanted to make a stock program that allowed the user to pick a stock, pick a start and end date, and see some basic stock info from those dates. that code isself works, but ive been struggling with getting you to be able to use a gui to provide inputs into the stock program. from tkinter import * #import tkinter from tkinter import ttk import random import random import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import pandas as pd import pandas_datareader.data as web from optparse import OptionParser compname = 'Company Name' tckersymbl = 'Ticker Symbol' strtdte = 'Start Date (y, m, d)' numbday = 'Number of Days' #fields = 'Company Name', 'Ticker Symbol', 'Start Date (y, m, d)', 'Number of Days' def fetch(entries): for entry in entries: field = entry[0] text = entry[1].get() companyname = entry[0] print('%s: "%s"' % (field, text)) def makeform(root, tckersymbl): entries = [] for field in compname: companyname = entry[0] row = Frame(root) lab = Label(row, width=15, text=field, anchor='w') ent = Entry(row) row.pack(side=TOP, fill=X, padx=5, pady=5) lab.pack(side=LEFT) ent.pack(side=RIGHT, expand=YES) entries.append((field, ent)) return entries def fetch1(entries): for entry in entries: field1 = entry[2] text1 = entry[3].get() ticker = entry[2] print('%s: "%s"' % (field1, text1)) def makeform1(root, tckersymbl): entries = [] for field1 in tckersymbl: ticker = entry[2] row = Frame(root) lab = Label(row, width=15, text=field1, anchor='w') ent = Entry(row) row.pack(side=TOP, fill=X, padx=5, pady=5) lab.pack(side=LEFT) ent.pack(side=RIGHT, expand=YES) entries.append((field1, ent)) return entries def fetch2(entries): for entry in entries: field2 = entry[4] text2 = entry[5].get() startday = entry[4] startday1 = startday.int() print('%s: "%s"' % (field2, text2)) def makeform2(root, strtdte): entries = [] for field2 in strtdte: startday = entry[4] startday1 = startday.int() row = Frame(root) lab = Label(row, width=15, text=field2, anchor='w') ent = Entry(row) row.pack(side=TOP, fill=X, padx=5, pady=5) lab.pack(side=LEFT) ent.pack(side=RIGHT, expand=YES) entries.append((field2, ent)) return entries def fetch3(entries): for entry in entries: field3 = entry[6] text3 = entry[7].get() numbdays = entry[6] print('%s: "%s"' % (field3, text3)) def makeform3(root, numbday): entries = [] for field3 in numbday: numbdays = entry[6] row = Frame(root) lab = Label(row, width=15, text=field3, anchor='w') ent = Entry(row) row.pack(side=TOP, fill=X, padx=5, pady=5) lab.pack(side=LEFT) ent.pack(side=RIGHT, expand=YES) entries.append((field3, ent)) return entries #companyname = entry[0] #ticker = entry[2] #startday = entry[4] #startday1 = startday.int() #numbdays = entry[6] print(companyname) style.use('ggplot') start = dt.datetime(startday1) end = dt.datetime.now() df = web.DataReader(ticker, 'iex', start, end) df.reset_index(inplace=True) print(df.head(numbdays)) #change value to change number of days you get. default is five if __name__ == '__main__': root = Tk() root.geometry("350x175") ents = makeform(root, compname, tckersymbl, strtdte, numbday) root.bind('<Return>', (lambda event, e=ents: fetch(e))) b1 = Button(root, text='Show', command=(lambda e=ents: fetch(e))) b1.pack(side=LEFT, padx=5, pady=5) b2 = Button(root, text='Quit', command=root.quit) b2.pack(side=LEFT, padx=5, pady=5) root.mainloop() #compname = 'Company Name' #tckersymbl = 'Ticker Symbol' #strtdte = 'Start Date (y, m, d)' #numbday = 'Number of Days'
0debug
Count the difference in sql result : [enter image description here][1] [1]: http://i.stack.imgur.com/suHH7.jpg I would like to get number that has different isreq but the same type. Anyone please. Thanks.
0debug
static void option_rom_reset(void *_rrd) { RomResetData *rrd = _rrd; cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size); }
1threat
PyQt QTableView Set Horizontal & Vertical Header Labels : <p>using QTableWidget i can do </p> <pre><code>table = QTableWidget() table.setHorizontalHeaderLabels(QString("Name;Age;Sex;Add").split(";")) table.horizontalHeaderItem().setTextAlignment(Qt.AlignHCenter) </code></pre> <p>how can i do same with QTableView ??</p>
0debug
how to make a bot to message only certain people : i developed a welcome bot using microsoft bot framework. i want it add to teams . In teams i want the bot to send welcome messages to only certain members belonging to a particular team or group. please provide me advise or steps to do it.
0debug
static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val) { AHCIPortRegs *pr = &s->dev[port].port_regs; DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); switch (offset) { case PORT_LST_ADDR: pr->lst_addr = val; break; case PORT_LST_ADDR_HI: pr->lst_addr_hi = val; break; case PORT_FIS_ADDR: pr->fis_addr = val; break; case PORT_FIS_ADDR_HI: pr->fis_addr_hi = val; break; case PORT_IRQ_STAT: pr->irq_stat &= ~val; ahci_check_irq(s); break; case PORT_IRQ_MASK: pr->irq_mask = val & 0xfdc000ff; ahci_check_irq(s); break; case PORT_CMD: pr->cmd = val & ~(PORT_CMD_LIST_ON | PORT_CMD_FIS_ON); if (pr->cmd & PORT_CMD_START) { if (ahci_map_clb_address(&s->dev[port])) { pr->cmd |= PORT_CMD_LIST_ON; } else { error_report("AHCI: Failed to start DMA engine: " "bad command list buffer address"); } } if (pr->cmd & PORT_CMD_FIS_RX) { if (ahci_map_fis_address(&s->dev[port])) { pr->cmd |= PORT_CMD_FIS_ON; } else { error_report("AHCI: Failed to start FIS receive engine: " "bad FIS receive buffer address"); } } if ((pr->cmd & PORT_CMD_FIS_ON) && !s->dev[port].init_d2h_sent) { ahci_init_d2h(&s->dev[port]); s->dev[port].init_d2h_sent = true; } check_cmd(s, port); break; case PORT_TFDATA: break; case PORT_SIG: break; case PORT_SCR_STAT: break; case PORT_SCR_CTL: if (((pr->scr_ctl & AHCI_SCR_SCTL_DET) == 1) && ((val & AHCI_SCR_SCTL_DET) == 0)) { ahci_reset_port(s, port); } pr->scr_ctl = val; break; case PORT_SCR_ERR: pr->scr_err &= ~val; break; case PORT_SCR_ACT: pr->scr_act |= val; break; case PORT_CMD_ISSUE: pr->cmd_issue |= val; check_cmd(s, port); break; default: break; } }
1threat
How to define xvalue mixed category? : <p>Are all <code>xvalues</code> <code>glvalues</code> and <code>rvalues</code> at the same time? Or a <code>xvalue</code> may be either <code>glvalue</code> or a <code>rvalue</code>?</p> <p>If it's a <code>glvalue</code> or/xor <code>rvalue</code>, can you give a example for each case?</p>
0debug
Print in Local Printer but Connected to Server PHP : <p>I have a direct printing in PHP using printer functions but we have two printers and only one printer can be added in printer_open(printer name). How can the other pc with different printer can print in their respective local printer?</p>
0debug
Microservice return response first and then process the request : <p>I am working on a solution for which i am trying to create a microservice which returns response immediately and then processes the request.</p> <p>I am trying to use Java 8 and Spring for this.</p>
0debug
Sort array of objects into ascending order : <p>I have an array of objects. Each object has a key "username".</p> <p>Is there a swift way of sorting this array of objects into ascending order?</p> <pre><code>(array(at: indexPath.row) as AnyObject).value(forKey: "username") as? String)! </code></pre> <p>Thanks</p>
0debug
void ff_nut_free_sp(NUTContext *nut) { av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free); av_tree_destroy(nut->syncpoints); }
1threat
Java Script for of : <p>Can you explain me, please, why first console.log shows me array with both: array.foo and item, but when I use for of loop it does not show array.foo? </p> <pre><code>let array = [3,5,8, item = 'good']; array.foo = 'hello'; console.log(array); for (var i of array) { console.log( i); } </code></pre>
0debug
Icons/Images do not display with TabBarBottom in React Native : <p>I've pretty much taken the sample code from the TabNavigator documentation and the icon's/images simply don't appear on iOS or Android. Even the label override doesn't seem to take effect. What am I doing wrong?</p> <p><a href="https://i.stack.imgur.com/3z0VQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3z0VQ.png" alt="enter image description here"></a></p> <p>Here's the link to the docs I've been using: <a href="https://reactnavigation.org/docs/navigators/tab" rel="noreferrer">https://reactnavigation.org/docs/navigators/tab</a></p> <p>Here's my code:</p> <pre><code>class MyHomeScreen extends React.Component { static navigationOptions = { tabBarLabel: 'Not displayed', // Note: By default the icon is only shown on iOS. Search the showIcon option below. tabBarIcon: ({ tintColor }) =&gt; ( &lt;Image source={require('./chats-icon.png')} style={[styles.icon, {tintColor: tintColor}]} /&gt; ), }; render() { return ( &lt;Button onPress={() =&gt; this.props.navigation.navigate('Notifications')} title="Go to notifications" /&gt; ); } } class MyNotificationsScreen extends React.Component { static navigationOptions = { tabBarLabel: 'Notifications', tabBarIcon: ({ tintColor }) =&gt; ( &lt;Image source={require('./notif-icon.png')} style={[styles.icon, {tintColor: tintColor}]} /&gt; ), }; render() { return ( &lt;Button onPress={() =&gt; this.props.navigation.goBack()} title="Go back home" /&gt; ); } } const styles = StyleSheet.create({ icon: { width: 26, height: 26, }, }); const MyApp = TabNavigator({ Displayed: { screen: MyHomeScreen, }, Notifications: { screen: MyNotificationsScreen, }, }, { tabBarOptions: { activeTintColor: '#e91e63', }, }); </code></pre>
0debug
what is the c parameter in this source code? : <p>I want to know what is the c in the below source code . can you explain me what is it doing ???</p> <pre><code> private void txtFamilytoSearch_TextChanged(object sender, EventArgs e) { var db = new LINQDataContext(); if (txtFamilytoSearch.Text == "") gvTable.DataSource = db.MyTables; else gvTable.DataSource = db.MyTables.Where(c =&gt; c.Family.Substring(0, txtFamilytoSearch.Text.Length) == txtFamilytoSearch.Text).Select(c =&gt; c); } </code></pre> <p>this is some part of C# code in linq tecnology. </p> <p>thank you ;-)</p>
0debug
Need clarification of the target and lib compiler options : <p>I find I'm confused by the target and lib options and how they interact with the features supported in the source code. I feel the docs need improving a little so am asking here before raising an issue.</p> <p>I naively assumed that target specifies the version of JS that the output code requires to run (with the addition of a module loader). Thus we can always use all the advanced JS features (like object spread) that TS supports in our source and the compiler generates suitable code for the target we specify. I assume it had polyfills etc at hand and the code would just run on the target VM.</p> <p>However the docs for the lib option specify the default libs depend on the target. But, libs effect what source types are available and so effect what code we can use. Thus the source features we can use depend on the target. That is not as I expected. I should say my understanding of lib is that they are typings with a different API, though the docs do not really say what they are.</p> <p>I can see that here are some language features that do not depend on types and others that do. However it's not clear if that's part of the reason for this situation.</p> <p>Can someone please clarify this?</p> <p>A secondary question is why is there both an ES6 and an ES2015 lib when they are usual documented as being the same thing.</p> <p>thanks</p>
0debug
How can i use MCLR on a pic18f4550 using Proteus? : I'm trying to use Master clear(MCLR) on a pic18f4550 with Proteus, but whenever I press the button to do so, the red and blue dots that represent on and off in Proteus turn yellow and the LED doesn't turn off I'm trying to replicate a Proteus file that my professor used and it worked perfectly, but even though it seems my file is looking exactly the same as his, it doesn't work. Here's [my circuit](https://i.imgur.com/zHm4mkv.png), [professor's circuit](https://i.imgur.com/MkYI2fp.png), and here's what happens when i press the: [MCLR button](https://i.imgur.com/o9TfOsw.png). Here's the code, but I'm pretty sure that's not the problem #include <p18f4550.h> #include <delays.h> #pragma config FOSC = HS #pragma config PWRT = ON #pragma config PBADEN = OFF #pragma config WDT = OFF #pragma config LVP = OFF #pragma config MCLRE = ON void main() { TRISB=0x00; PORTB=0b11111111; while (1){ PORTBbits.RB1 = 0; Delay1KTCYx(100); PORTBbits.RB1 = 1; Delay1KTCYx (100); } } The only error message i get is from Proteus, that says: [PIC18]PC=0x00BC $MCLR$ is low. Processor is in reset.
0debug
How do I resolve the deprecation warning "Method to_hash is deprecated and will be removed in Rails 5.1" : <p>I'm trying to update to Rails 5, I'm getting the following deprecation warning:</p> <blockquote> <p>DEPRECATION WARNING: Method to_hash is deprecated and will be removed in Rails 5.1, as <code>ActionController::Parameters</code> no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: <a href="http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html" rel="noreferrer">http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html</a> (called from column_header at /Data/Projects/portal/trunk/app/helpers/application_helper.rb:114)</p> </blockquote> <p>The line the warning is on looks like this:</p> <pre><code> link_to(name, { action: action_name, params: params.merge({ order: key, page: nil }) }, { title: "Sort by this field", }) + </code></pre> <p>As you can see, I'm not calling <code>to_hash</code>. Maybe Rails is. Maybe some other gem is. I have no way to tell, because they didn't think it was worth providing a stack trace. (Pro tip - it usually <em>is</em> worth providing a stack trace!)</p> <p>So anyway, I followed the link, planning to find a replacement, and <a href="http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html#method-i-merge" rel="noreferrer">the <code>merge</code> method does not <em>appear</em> to be deprecated</a>, but maybe they simply forgot to document deprecated status, so I can't really be sure.</p> <p>So what am I supposed to do to clear this?</p>
0debug
Why DOM-element <select> can't have :before or :after? : <p>I knew why inputs doesnt have it (except in Google Chrome), but why selects does not have it, when they have end tag?</p>
0debug
int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; VP56Context *s = avctx->priv_data; AVFrame *const p = s->framep[VP56_FRAME_CURRENT]; int remaining_buf_size = avpkt->size; int is_alpha, av_uninit(alpha_offset); if (s->has_alpha) { if (remaining_buf_size < 3) return -1; alpha_offset = bytestream_get_be24(&buf); remaining_buf_size -= 3; if (remaining_buf_size < alpha_offset) return -1; } for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) { int mb_row, mb_col, mb_row_flip, mb_offset = 0; int block, y, uv, stride_y, stride_uv; int golden_frame = 0; int res; s->modelp = &s->models[is_alpha]; res = s->parse_header(s, buf, remaining_buf_size, &golden_frame); if (!res) return -1; if (res == 2) { int i; for (i = 0; i < 4; i++) { if (s->frames[i].data[0]) avctx->release_buffer(avctx, &s->frames[i]); } if (is_alpha) return -1; } if (!is_alpha) { p->reference = 1; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (res == 2) if (vp56_size_changed(avctx)) { avctx->release_buffer(avctx, p); return -1; } } if (p->key_frame) { p->pict_type = AV_PICTURE_TYPE_I; s->default_models_init(s); for (block=0; block<s->mb_height*s->mb_width; block++) s->macroblocks[block].type = VP56_MB_INTRA; } else { p->pict_type = AV_PICTURE_TYPE_P; vp56_parse_mb_type_models(s); s->parse_vector_models(s); s->mb_type = VP56_MB_INTER_NOVEC_PF; } s->parse_coeff_models(s); memset(s->prev_dc, 0, sizeof(s->prev_dc)); s->prev_dc[1][VP56_FRAME_CURRENT] = 128; s->prev_dc[2][VP56_FRAME_CURRENT] = 128; for (block=0; block < 4*s->mb_width+6; block++) { s->above_blocks[block].ref_frame = VP56_FRAME_NONE; s->above_blocks[block].dc_coeff = 0; s->above_blocks[block].not_null_dc = 0; } s->above_blocks[2*s->mb_width + 2].ref_frame = VP56_FRAME_CURRENT; s->above_blocks[3*s->mb_width + 4].ref_frame = VP56_FRAME_CURRENT; stride_y = p->linesize[0]; stride_uv = p->linesize[1]; if (s->flip < 0) mb_offset = 7; for (mb_row=0; mb_row<s->mb_height; mb_row++) { if (s->flip < 0) mb_row_flip = s->mb_height - mb_row - 1; else mb_row_flip = mb_row; for (block=0; block<4; block++) { s->left_block[block].ref_frame = VP56_FRAME_NONE; s->left_block[block].dc_coeff = 0; s->left_block[block].not_null_dc = 0; } memset(s->coeff_ctx, 0, sizeof(s->coeff_ctx)); memset(s->coeff_ctx_last, 24, sizeof(s->coeff_ctx_last)); s->above_block_idx[0] = 1; s->above_block_idx[1] = 2; s->above_block_idx[2] = 1; s->above_block_idx[3] = 2; s->above_block_idx[4] = 2*s->mb_width + 2 + 1; s->above_block_idx[5] = 3*s->mb_width + 4 + 1; s->block_offset[s->frbi] = (mb_row_flip*16 + mb_offset) * stride_y; s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8*stride_y; s->block_offset[1] = s->block_offset[0] + 8; s->block_offset[3] = s->block_offset[2] + 8; s->block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv; s->block_offset[5] = s->block_offset[4]; for (mb_col=0; mb_col<s->mb_width; mb_col++) { vp56_decode_mb(s, mb_row, mb_col, is_alpha); for (y=0; y<4; y++) { s->above_block_idx[y] += 2; s->block_offset[y] += 16; } for (uv=4; uv<6; uv++) { s->above_block_idx[uv] += 1; s->block_offset[uv] += 8; } } } if (p->key_frame || golden_frame) { if (s->framep[VP56_FRAME_GOLDEN]->data[0] && s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]); s->framep[VP56_FRAME_GOLDEN] = p; } if (s->has_alpha) { FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN], s->framep[VP56_FRAME_GOLDEN2]); buf += alpha_offset; remaining_buf_size -= alpha_offset; } } if (s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN] || s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN2]) { if (s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN] && s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN2]) FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS], s->framep[VP56_FRAME_UNUSED]); else FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS], s->framep[VP56_FRAME_UNUSED2]); } else if (s->framep[VP56_FRAME_PREVIOUS]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]); FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT], s->framep[VP56_FRAME_PREVIOUS]); p->qstride = 0; p->qscale_table = s->qscale_table; p->qscale_type = FF_QSCALE_TYPE_VP56; *(AVFrame*)data = *p; *data_size = sizeof(AVFrame); return avpkt->size; }
1threat
How call and execute a method present in a .dll file and show your (s) Form (s)? : <p>I had that imported a Form already made for a .dll file, and now want call this Form from of my .exe software and open he normally on .dll file.</p> <p>This is all that have until now, but nothing works :-(</p> <p><strong><em>Dll file with a Form inside</em></strong></p> <pre><code>library test; uses System.SysUtils, Winapi.Windows, UMyForm, // Reference to my Form (traditional VCL Form) System.Classes, StrUtils; {$R *.res} var HProcess: THandle; Hid: Cardinal; b: Boolean = False; procedure Call; begin MyForm := TMyForm.Create(nil); MyForm.ShowModal; end; end; begin HProcess:= OpenProcess(PROCESS_ALL_ACCESS,False,GetCurrentProcessId); CreateRemoteThread(HProcess,nil,0,@call,@call,0,Hid); end. </code></pre> <p><strong><em>My software that call and open the Form of Dll file</em></strong></p> <pre><code>unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) btn1: TButton; procedure btn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin LoadLibraryA(PAnsiChar('test.dll')); end; end. </code></pre>
0debug
mkdir(),mkdirs() returns false : I'm creating and deleting same folder continuously as a requirement. mkdir() creating some times correctly but some times creating operation failed file and mkdir() returns false. I have searched i got solution like change directory name before deleting,but I'm not deleting directory through android code .deleting is done by windows side.So, please any help.. File file = new File(Environment.getExternalStorageDirectory() + File.separator + "eTestifyData" + File.separator + orgId + File.separator + providerId + File.separator + datewise + File.separator + encounterId); if (file.exists()) { write(file, file.getAbsolutePath(), jsonData); } else { if (file.mkdirs()) { write(file, file.getAbsolutePath(), jsonData); } }
0debug
Adding rows from case statement - SQL SERVER : The current results i have are this I am comparing the totals from the two tables on a monthly basis. When the total is different between the 2 tables i want to add the difference to another column | MonthYear | Person | Table1 Amount | Table2 Amount | Unknown | |-----------|--------|---------------|---------------|---------| | Jun-17 | Tom | 100 | 125 | 25 | | Nov-17 | | 50 | 150 | 100 | | Sep-17 | Ben | 50 | 50 | 0 | Which i have achieved but how do i add the case statement as a row instead instead of a column e.g output like this. I can then group via the 'unknown' category. | MonthYear | Person | Table1 Amount | Table2 Amount | Difference | |-----------|--------|---------------|---------------| ---------| | Jun-17 | Tom | 100 | 125 | 25 | | Nov-17 | | 50 | 150 | 100 | | Sep-17 | Ben | 50 | 50 | 0 | | Jun-17 |Unknown | 25 | Null | 0 | | Nov-17 |Unknown | 100 | Null | 0 | Can this be done? Any help would be appreciated. Thanks
0debug
How to delete a file using golang on program exit? : <p>I have made a command line application where I am zipping up folders and sharing on my local server for others to download. What I want to do is delete my copy of the zipped folder as soon as I close the server. This is my code:</p> <pre><code>func main() { //flag to specify whether we will be uploading folder or a single file zipped := flag.Bool("z",false,"Use for zipping folders and serving them as a single file on the server.(Deletes the zipped file once the server closes.)") save := flag.Bool("s",false,"Use with -z for saving the zipped files locally even after the server closes.") flag.Parse() if len(flag.Args())&gt;0{ if *zipped{ fmt.Println("zipping...") flag.Args()[0]=ZipFile() if !(*save){ //I expect this to remove the file when I hit ctrl+c on cmd defer os.Remove(flag.Args()[0]) } } http.HandleFunc("/",ShareFile) fmt.Printf("Sharing file on %s:8080\n",GetOutboundIP()) log.Fatal(http.ListenAndServe(":8080",nil)) }else{ fmt.Println("Invalid usage. No file mentioned. Use wshare -h for help.") } } </code></pre> <p>When I hit ctrl-c, the program exits and main function closes and as a result,shouldn't os.Remove(xyz) get executed? <a href="https://tour.golang.org/flowcontrol/12" rel="noreferrer">A tour of go</a> says, defer executes the expression when the function returns. Here, I don't feel main gets the oppurtunity to return anything at all. </p> <p>What is a workaround to achieve what I am trying to do? I have some solutions in my head like wait for a keypress etc. but I want this program to be super simple,so is there a way to delete the file as soon as the server closes/program exits without requiring any further input from me?</p>
0debug
How can i add more than one container in body : So, im really new to flutter or dart. I looked at many tutoriais, a bit hard to learn. i need to know, if i can, and how can i add more containers that contain Texts or Button in flutter. I already tried many things, but everything give me a error. i want to put some buttons at one container, and in other container i want to add some labels. and i need to put this two containers at my Scaffold, how i do it? or maybe how can i add two scaffold at same page, so i need labels at one and buttons in other.. import 'package:flutter/material.dart'; void main() => runApp (MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'My Tittle', debugShowCheckedModeBanner: false, home: Scaffold( appBar:AppBar( title: Text('My Title'), ), body: Container( child: Text('Hello World), ), //Container # I WANT TO ADD ANOTHER CONTAINER HERE ), //Scaffold ); //MaterialApp } }
0debug
static always_inline int _find_pte (mmu_ctx_t *ctx, int is_64b, int h, int rw) { target_ulong base, pte0, pte1; int i, good = -1; int ret, r; ret = -1; base = ctx->pg_addr[h]; for (i = 0; i < 8; i++) { #if defined(TARGET_PPC64) if (is_64b) { pte0 = ldq_phys(base + (i * 16)); pte1 = ldq_phys(base + (i * 16) + 8); r = pte64_check(ctx, pte0, pte1, h, rw); #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Load pte from 0x" ADDRX " => 0x" ADDRX " 0x" ADDRX " %d %d %d 0x" ADDRX "\n", base + (i * 16), pte0, pte1, (int)(pte0 & 1), h, (int)((pte0 >> 1) & 1), ctx->ptem); } #endif } else #endif { pte0 = ldl_phys(base + (i * 8)); pte1 = ldl_phys(base + (i * 8) + 4); r = pte32_check(ctx, pte0, pte1, h, rw); #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Load pte from 0x" ADDRX " => 0x" ADDRX " 0x" ADDRX " %d %d %d 0x" ADDRX "\n", base + (i * 8), pte0, pte1, (int)(pte0 >> 31), h, (int)((pte0 >> 6) & 1), ctx->ptem); } #endif } switch (r) { case -3: return -1; case -2: ret = -2; good = i; break; case -1: default: break; case 0: ret = 0; good = i; goto done; } } if (good != -1) { done: #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "found PTE at addr 0x" PADDRX " prot=0x%01x " "ret=%d\n", ctx->raddr, ctx->prot, ret); } #endif pte1 = ctx->raddr; if (pte_update_flags(ctx, &pte1, ret, rw) == 1) { #if defined(TARGET_PPC64) if (is_64b) { stq_phys_notdirty(base + (good * 16) + 8, pte1); } else #endif { stl_phys_notdirty(base + (good * 8) + 4, pte1); } } } return ret; }
1threat
static void vga_update_display(void *opaque) { VGACommonState *s = opaque; int full_update, graphic_mode; qemu_flush_coalesced_mmio_buffer(); if (ds_get_bits_per_pixel(s->ds) == 0) { } else { full_update = 0; if (!(s->ar_index & 0x20)) { graphic_mode = GMODE_BLANK; } else { graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE; } if (graphic_mode != s->graphic_mode) { s->graphic_mode = graphic_mode; s->cursor_blink_time = qemu_get_clock_ms(vm_clock); full_update = 1; } switch(graphic_mode) { case GMODE_TEXT: vga_draw_text(s, full_update); break; case GMODE_GRAPH: vga_draw_graphic(s, full_update); break; case GMODE_BLANK: default: vga_draw_blank(s, full_update); break; } } }
1threat
Asp.net Core EF options.UseInMemoryDatabase System.TypeLoadException : <p>I used EF in Asp.net Core, but got below error in below code:</p> <pre><code>public class TodoContext : DbContext { public TodoContext(DbContextOptions&lt;TodoContext&gt; options) : base(options) { } public DbSet&lt;TodoItem&gt; TodoItems { get; set; } } </code></pre> <p>Error Message: </p> <blockquote> <p>An exception of type 'System.TypeLoadException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code</p> <p>Additional information: Could not load type 'Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.</p> </blockquote> <p>Here is my Project.json</p> <pre><code>{ "dependencies": { "Microsoft.NETCore.App": { "version": "1.0.1", "type": "platform" }, "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.Extensions.Logging.Console": "1.0.0", //Dependence for MVC "Microsoft.AspNetCore.Mvc": "1.1.1", "Microsoft.AspNetCore.StaticFiles": "1.1.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0", "Microsoft.Extensions.Configuration.Json": "1.1.0", //Dependence for EF "Microsoft.EntityFrameworkCore": "1.1.0", "Microsoft.EntityFrameworkCore.InMemory": "1.0.0-rc2-final" //Dependence for EF with SQL, this is avalible under VS 2017 RC //"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", //Entity Framework commands to maintain the database //"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview4-final" }, "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "portable-net45+win8" ] } }, "buildOptions": { "emitEntryPoint": true, //used for Razor pages which are compiled at runtime,and the compiler needs access to reference assemblies, //to make sure it compiles correctly "preserveCompilationContext": true }, "runtimeOptions": { "configProperties": { "System.GC.Server": true } }, "publishOptions": { "include": [ "wwwroot", "web.config" ] }, "scripts": { "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] } } </code></pre> <p>Any help would be appreciated.<br> Reards,<br> Edward </p>
0debug
How to add apostrophes in a dictionnary : <p>I was just wondering if it is possible to add an apostrophe in this situation. I want the test key to have the value of "I don't know" not "I don". Is it possible to do so? If so how?</p> <pre><code> my_dict = { "test": 'I don't know' } </code></pre>
0debug
void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels) { int i, j, ch; Band *bands = c->bands; int off; float mul; memset(c->sb_samples, 0, sizeof(c->sb_samples)); off = 0; for(i = 0; i <= maxband; i++, off += SAMPLES_PER_BAND){ for(ch = 0; ch < 2; ch++){ if(bands[i].res[ch]){ j = 0; mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][0] & 0xFF]; for(; j < 12; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][1] & 0xFF]; for(; j < 24; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][2] & 0xFF]; for(; j < 36; j++) c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off]; } } if(bands[i].msf){ int t1, t2; for(j = 0; j < SAMPLES_PER_BAND; j++){ t1 = c->sb_samples[0][j][i]; t2 = c->sb_samples[1][j][i]; c->sb_samples[0][j][i] = t1 + t2; c->sb_samples[1][j][i] = t1 - t2; } } } mpc_synth(c, data, channels); }
1threat
insert is not working : **this code is not working i m trying to insert the data** int a = 1; DateTime cDate; cDate = DateTime.Today; string insertString = "insert into tbl_complaint(Date,User_id,department_name,Product_name,complaint_details,Status) values(@date,@uid,@dept,@product,@details,@status)"; SqlCommand cmd = new SqlCommand(insertString, con); cmd.Parameters.AddWithValue("@date", cDate); cmd.Parameters.AddWithValue("@uid", a); cmd.Parameters.AddWithValue("@dept", ddlDept.SelectedValue); cmd.Parameters.AddWithValue("@product", txtPName.Text); cmd.Parameters.AddWithValue("@details", txtCDes.Text); cmd.Parameters.AddWithValue("@status", "Submited"); cmd.CommandType = CommandType.Text; try { int check; con.Open(); check= cmd.ExecuteNonQuery(); con.Close(); }
0debug
how i open Qdialog window instead CloseWindow in taskbar : how i open Qdialog window instead QuitProgram in taskbar, when i click right-button in CloseWindow ? [Check Image][1] Obs: i already have a QDialog Ui with Button Quit Program. [1]: https://i.stack.imgur.com/UUVK6.png
0debug
How to track newer C++ std documents of given topic? : <p>Following is a C++ std document. The document number is N3721, which superseded the older N3634.</p> <p><a href="https://i.stack.imgur.com/ibZ8X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ibZ8X.png" alt="enter image description here"></a></p> <p>Obviously, it's easy to track older documents of given topic.</p> <p>However, my question is:</p> <p><strong>How to track newer documents of given topic?</strong> </p> <p>For example, if N3721 is superseded by a newer document, how to track the newer one?</p>
0debug
Wiki Documentation Site with Source Control & Release Management : <p>I've been searching for information on available wiki software, using pages such as <a href="https://en.wikipedia.org/wiki/Comparison_of_wiki_software" rel="nofollow">https://en.wikipedia.org/wiki/Comparison_of_wiki_software</a>, and am looking for a solution which will meet a number of requirements, but haven't been able to find anything suitable yet. I am looking to create a documentation site in a form similar to TechNet, MSDN, or <a href="https://documentation.red-gate.com" rel="nofollow">https://documentation.red-gate.com</a>, and although this could be done with either a SharePoint site or a traditional wiki such as MediaWiki, these are generally for open, community edited content which evolves rapidly, or internal company documentation where the presence of errors and incomplete content is not considered an issue. In this case the documentation is to be visible to customers online and would only be edited by our staff, so it would be preferable for its content to be in source control and using managed releases to different environments (i.e. a DEV site where our staff edit the content, a TEST site for proof reading and a LIVE site, online for the public) so that half-written content, or content which has not been proof read is not immediately visible as it is in a standard wiki, but the ability to allow staff to edit the documentation quickly in a wiki-style format is also important.</p> <p>I am aware that projects such as Sandcastle, Document! X and Doxygen, which generate MSDN style documentation directly from the source code, but do not intend this to be a documentation site generated from source code comments, but one containing written articles. In essence, I am looking for software which provides:</p> <ul> <li>The ease of use of a wiki - anyone can log into the DEV site and add/edit content.</li> <li>Source control of all the content, presumably Markdown files and images, not in a database, where the source control (TFS) is automatically updated/files checked out/checked in, by the aforementioned 'easy edit' wiki capabilities.</li> <li>As a result of the above, the ability to 'release' the documentation to test and production environments, as you might do with any other web site solution.</li> </ul> <p>Additional examples would be sites such as <a href="http://uk.mathworks.com/help" rel="nofollow">http://uk.mathworks.com/help</a> or <a href="https://docs.python.org/3/tutorial/introduction.html" rel="nofollow">https://docs.python.org/3/tutorial/introduction.html</a>. Can anyone provide information on whether such a solution is available, or an explanation of how sites such as MSDN, TechNet or the RedGate documentation site are managed and the applications used for them?</p>
0debug
av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; dsp->vp8_idct_add = ff_vp8_idct_add_armv6; dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; }
1threat
Css select how works? : How can I select content inside p tag **THIS** ? <p><span class='x' id='1'><a href='#'>y</a>.</span>THIS</p>
0debug
ARITH3(addlv) ARITH3(sublv) ARITH3(addqv) ARITH3(subqv) ARITH3(umulh) ARITH3(mullv) ARITH3(mulqv) ARITH3(minub8) ARITH3(minsb8) ARITH3(minuw4) ARITH3(minsw4) ARITH3(maxub8) ARITH3(maxsb8) ARITH3(maxuw4) ARITH3(maxsw4) ARITH3(perr) #define MVIOP2(name) \ static inline void glue(gen_, name)(int rb, int rc) \ { \ if (unlikely(rc == 31)) \ return; \ if (unlikely(rb == 31)) \ tcg_gen_movi_i64(cpu_ir[rc], 0); \ else \ gen_helper_ ## name (cpu_ir[rc], cpu_ir[rb]); \ } MVIOP2(pklb) MVIOP2(pkwb) MVIOP2(unpkbl) MVIOP2(unpkbw) static void gen_cmp(TCGCond cond, int ra, int rb, int rc, int islit, uint8_t lit) { TCGv va, vb; if (unlikely(rc == 31)) { return; } if (ra == 31) { va = tcg_const_i64(0); } else { va = cpu_ir[ra]; } if (islit) { vb = tcg_const_i64(lit); } else { vb = cpu_ir[rb]; } tcg_gen_setcond_i64(cond, cpu_ir[rc], va, vb); if (ra == 31) { tcg_temp_free(va); } if (islit) { tcg_temp_free(vb); } }
1threat
Hey i have a group of radio button and i want to set them disabled if there value >= some value : $('input[type=radio][name="motor_hp"]').change(function(){ var value = parseFloat($(this).val()).toFixed(1); console.log(value); $('input[name="ics-drive"]').filter(function(){ console.log($(this).val()); return parseFloat($(this).attr('value')).toFixed(1) >= value; }).prop("disabled",true); })
0debug
int av_expr_parse(AVExpr **expr, const char *s, const char * const *const_names, const char * const *func1_names, double (* const *funcs1)(void *, double), const char * const *func2_names, double (* const *funcs2)(void *, double, double), int log_offset, void *log_ctx) { Parser p = { 0 }; AVExpr *e = NULL; char *w = av_malloc(strlen(s) + 1); char *wp = w; const char *s0 = s; int ret = 0; if (!w) return AVERROR(ENOMEM); while (*s) if (!av_isspace(*s++)) *wp++ = s[-1]; *wp++ = 0; p.class = &eval_class; p.stack_index=100; p.s= w; p.const_names = const_names; p.funcs1 = funcs1; p.func1_names = func1_names; p.funcs2 = funcs2; p.func2_names = func2_names; p.log_offset = log_offset; p.log_ctx = log_ctx; if ((ret = parse_expr(&e, &p)) < 0) if (*p.s) { av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0); ret = AVERROR(EINVAL); if (!verify_expr(e)) { ret = AVERROR(EINVAL); e->var= av_mallocz(sizeof(double) *VARS); *expr = e; e = NULL; end: av_expr_free(e); av_free(w); return ret;
1threat
static void do_info_history (void) { int i; for (i = 0; i < TERM_MAX_CMDS; i++) { if (term_history[i] == NULL) break; term_printf("%d: '%s'\n", i, term_history[i]); } }
1threat
static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; V9fsString fullname; char *buffer; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", dir->data, name); if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { if (flags == AT_REMOVEDIR) { buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root, fullname.data, VIRTFS_META_DIR); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { goto err_out; } } buffer = local_mapped_attr_path(ctx, fullname.data); ret = remove(buffer); g_free(buffer); if (ret < 0 && errno != ENOENT) { goto err_out; } } buffer = rpath(ctx, fullname.data); ret = remove(buffer); g_free(buffer); err_out: v9fs_string_free(&fullname); return ret; }
1threat
int swr_init(SwrContext *s){ s->in_buffer_index= 0; s->in_buffer_count= 0; s->resample_in_constraint= 0; free_temp(&s->postin); free_temp(&s->midbuf); free_temp(&s->preout); free_temp(&s->in_buffer); swr_audio_convert_free(&s-> in_convert); swr_audio_convert_free(&s->out_convert); s-> in.planar= s-> in_sample_fmt >= 0x100; s->out.planar= s->out_sample_fmt >= 0x100; s-> in_sample_fmt &= 0xFF; s->out_sample_fmt &= 0xFF; if( s->int_sample_fmt != AV_SAMPLE_FMT_S16 &&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){ av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(s->int_sample_fmt)); return AVERROR(EINVAL); } if(s->in_sample_fmt <= AV_SAMPLE_FMT_S16 || s->int_sample_fmt==AV_SAMPLE_FMT_S16){ s->int_sample_fmt= AV_SAMPLE_FMT_S16; }else s->int_sample_fmt= AV_SAMPLE_FMT_FLT; if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){ s->resample = swr_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8); }else swr_resample_free(&s->resample); if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){ av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); return -1; } if(!s-> in_ch_layout) s-> in_ch_layout= guess_layout(s->in.ch_count); if(!s->out_ch_layout) s->out_ch_layout= guess_layout(s->out.ch_count); s->rematrix= s->out_ch_layout !=s->in_ch_layout; #define RSC 1 finetune if(!s-> in.ch_count) s-> in.ch_count= av_get_channel_layout_nb_channels(s-> in_ch_layout); if(!s->out.ch_count) s->out.ch_count= av_get_channel_layout_nb_channels(s->out_ch_layout); av_assert0(s-> in.ch_count); av_assert0(s->out.ch_count); s->resample_first= RSC*s->out.ch_count/s->in.ch_count - RSC < s->out_sample_rate/(float)s-> in_sample_rate - 1.0; s-> in.bps= av_get_bits_per_sample_fmt(s-> in_sample_fmt)/8; s->int_bps= av_get_bits_per_sample_fmt(s->int_sample_fmt)/8; s->out.bps= av_get_bits_per_sample_fmt(s->out_sample_fmt)/8; s->in_convert = swr_audio_convert_alloc(s->int_sample_fmt, s-> in_sample_fmt, s-> in.ch_count, 0); s->out_convert= swr_audio_convert_alloc(s->out_sample_fmt, s->int_sample_fmt, s->out.ch_count, 0); s->postin= s->in; s->preout= s->out; s->midbuf= s->in; s->in_buffer= s->in; if(!s->resample_first){ s->midbuf.ch_count= s->out.ch_count; s->in_buffer.ch_count = s->out.ch_count; } s->in_buffer.bps = s->postin.bps = s->midbuf.bps = s->preout.bps = s->int_bps; s->in_buffer.planar = s->postin.planar = s->midbuf.planar = s->preout.planar = 1; if(s->rematrix && swr_rematrix_init(s)<0) return -1; return 0; }
1threat
Can I use "request" and "cheerio" libraries to extract data from a .html file? : <p>I'm creating a React Web Application and using request and cheerio to do some Web Scrapping. I need to extract data from a .html file. The user enters with a .html in an input:</p> <pre><code>&lt;input type='file' /&gt; </code></pre> <p>How can I extract data from the file? It is possible with those libraries? I know that request needs an <code>url</code> and I guess that it will be the local path to file. I used the following code to do Web Scrapping:</p> <pre><code>const foo = await new Promise(function (resolve, reject) { request.get(url, (err, res2, data) =&gt; { const $ = cheerio.load(data) let s = $("tbody &lt; table.table_lt").text().replace(/\t/g, '').replace(/\n/g, '') resolve(s) }) }) </code></pre> <p>But this work just with Web.</p>
0debug
How to translate simple Ajax to TypeScript? : <p>I have a simple JavaScript code which using Ajax. I want translate this ajax query to TypeScript for more object oriented view. With class and method and hard data types (similar to Java:-).</p> <p>Help me translate if it posible:</p> <pre><code>$(document).ready(function() { $('#my-viewscope').click(function() { $ajax({ url: 'get_data_servlet', type: 'post', dataType: 'json', success: function(response) { $.each(response, function(key, value) { console.log(value); }); } }) }) }); </code></pre>
0debug
def even_num(x): if x%2==0: return True else: return False
0debug
http://localhost:8000/broadcasting/auth 404 (Not Found) : <p>I am trying to make my app app connect to pusher on a private channel.</p> <p>But I am getting the following error:</p> <blockquote> <p>pusher.js?b3eb:593 POST <a href="http://localhost:8000/broadcasting/auth" rel="noreferrer">http://localhost:8000/broadcasting/auth</a> 404 (Not Found)</p> </blockquote> <p>What maybe the cause of the error and how to resolve it.</p>
0debug
Converting a string into date format : <p>I'm adding an event, the event displays starting hour (hh:mm) and ending hour (hh:mm), there are 2 tiemPickers, one to pick starting time and one for duration.</p> <p><strong>Problem 1:</strong> </p> <p>If the user picks the starting time to be at 10:30h and duration of 1:40h, the ending time should be 12:10h instead of 11:70h, how do I do this?</p> <p><strong>Problem 2:</strong></p> <p>If the user picks starting time of 23:00h and duration of 02:00h, ending time should be 01:00h instead of 25:00h.</p> <p><strong>What I have:</strong></p> <pre><code>// getting the selected time int endingHourInt = prefs.getInt("mDurationHour", 0) + prefs.getInt("mStartingHour",0); int endingMinInt = prefs.getInt("mDurationMin", 0) + prefs.getInt("mStartingMin",0); // displaying the text endingTime.setText(endingHourInt + ":" + endingMinInt ); </code></pre>
0debug
How to solve "control reaches end of non-void function "warning? : I have been getting a compiler error( control reaches end of non-void function) extern RC_Code_t osa_odm_init (void) { if ( odmInitFlag == BOOL_FALSE ) { ........ ......... return (RC_OK); } } I specified the return value of the function as void but i am getting error.How to fix this?
0debug
void avformat_free_context(AVFormatContext *s) { int i; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); if (s->oformat && s->oformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = s->nb_streams - 1; i >= 0; i--) { ff_free_stream(s, s->streams[i]); } for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_freep(&s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); }
1threat
How to escape single quote (') in Thymeleaf : <p><code>&lt;h1 th:text="${'What\'s up?'}"&gt;&lt;/h1&gt;</code></p> <p>I want this to output </p> <p><code>&lt;h1&gt;What's up?&lt;/h1&gt;</code></p> <p>But I get an <code>TemplateInputException</code>. I have tried with HTML entity but it fails the same.</p>
0debug
static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska) { EbmlList *blocks_list; MatroskaBlock *blocks; int i, res; res = ebml_parse(matroska, matroska_cluster_incremental_parsing, &matroska->current_cluster); if (res == 1) { if (matroska->current_cluster_pos) ebml_level_end(matroska); ebml_free(matroska_cluster, &matroska->current_cluster); memset(&matroska->current_cluster, 0, sizeof(MatroskaCluster)); matroska->current_cluster_num_blocks = 0; matroska->current_cluster_pos = avio_tell(matroska->ctx->pb); matroska->prev_pkt = NULL; if (matroska->current_id) matroska->current_cluster_pos -= 4; res = ebml_parse(matroska, matroska_clusters_incremental, &matroska->current_cluster); if (res == 1) res = ebml_parse(matroska, matroska_cluster_incremental_parsing, &matroska->current_cluster); } if (!res && matroska->current_cluster_num_blocks < matroska->current_cluster.blocks.nb_elem) { blocks_list = &matroska->current_cluster.blocks; blocks = blocks_list->elem; matroska->current_cluster_num_blocks = blocks_list->nb_elem; i = blocks_list->nb_elem - 1; if (blocks[i].bin.size > 0 && blocks[i].bin.data) { int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1; uint8_t* additional = blocks[i].additional.size > 0 ? blocks[i].additional.data : NULL; if (!blocks[i].non_simple) blocks[i].duration = 0; res = matroska_parse_block(matroska, blocks[i].bin.data, blocks[i].bin.size, blocks[i].bin.pos, matroska->current_cluster.timecode, blocks[i].duration, is_keyframe, additional, blocks[i].additional_id, blocks[i].additional.size, matroska->current_cluster_pos); } } if (res < 0) matroska->done = 1; return res; }
1threat
im receiving this code when i run npm run dev why? : Failed to compile. [1] [1] ./src/index.js [1] Module not found: Can't resolve '.components/App' in 'C:\Users\Adam\Desktop\ChatBot\client\src' I'm receiving this result when I run ...npm run dev why? thanks in advance
0debug