problem
stringlengths
26
131k
labels
class label
2 classes
Why doesn't Kotlin allow to use lateinit with primitive types? : <p>In the Kotlin language we, by default, have to initialize each variable when it is introduced. To avoid this, the <code>lateinit</code> keyword can be used. Referring to a <code>lateinit</code> variable before it has been initialized results in a runtime exception.</p> <p><code>lateinit</code> can not, however, be used with the primitive types. Why is it so?</p>
0debug
static void musb_rx_packet_complete(USBPacket *packey, void *opaque) { MUSBEndPoint *ep = (MUSBEndPoint *) opaque; int epnum = ep->epnum; MUSBState *s = ep->musb; ep->fifostart[1] = 0; ep->fifolen[1] = 0; #ifdef CLEAR_NAK if (ep->status[1] != USB_RET_NAK) { #endif ep->csr[1] &= ~MGC_M_RXCSR_H_REQPKT; if (!epnum) ep->csr[0] &= ~MGC_M_CSR0_H_REQPKT; #ifdef CLEAR_NAK } #endif ep->csr[1] &= ~(MGC_M_RXCSR_H_ERROR | MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR); if (!epnum) ep->csr[0] &= ~(MGC_M_CSR0_H_ERROR | MGC_M_CSR0_H_RXSTALL | MGC_M_CSR0_H_NAKTIMEOUT | MGC_M_CSR0_H_NO_PING); if (ep->status[1] == USB_RET_STALL) { ep->status[1] = 0; packey->len = 0; ep->csr[1] |= MGC_M_RXCSR_H_RXSTALL; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_RXSTALL; } if (ep->status[1] == USB_RET_NAK) { ep->status[1] = 0; if (ep->interrupt[1]) return musb_packet(s, ep, epnum, USB_TOKEN_IN, packey->len, musb_rx_packet_complete, 1); ep->csr[1] |= MGC_M_RXCSR_DATAERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_NAKTIMEOUT; } if (ep->status[1] < 0) { if (ep->status[1] == USB_RET_BABBLE) { musb_intr_set(s, musb_irq_rst_babble, 1); return; } ep->csr[1] |= MGC_M_RXCSR_H_ERROR; if (!epnum) ep->csr[0] |= MGC_M_CSR0_H_ERROR; musb_rx_intr_set(s, epnum, 1); return; } packey->len = ep->status[1]; if (!(ep->csr[1] & (MGC_M_RXCSR_H_RXSTALL | MGC_M_RXCSR_DATAERROR))) { ep->csr[1] |= MGC_M_RXCSR_FIFOFULL | MGC_M_RXCSR_RXPKTRDY; if (!epnum) ep->csr[0] |= MGC_M_CSR0_RXPKTRDY; ep->rxcount = packey->len; } musb_rx_intr_set(s, epnum, 1); }
1threat
How to detect on long key press release in Android : <p>I am trying to implement a code that does something like a Joystick.</p> <p>For an example when i press the LED on button, the LED stays on till i keep holding the LED on button and goes off when i release the button.</p> <p>So how do i get the onRelease event when the user releases the software button. </p>
0debug
static void machvirt_init(MachineState *machine) { VirtMachineState *vms = VIRT_MACHINE(machine); VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(machine); qemu_irq pic[NUM_IRQS]; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *secure_sysmem = NULL; int n, virt_max_cpus; MemoryRegion *ram = g_new(MemoryRegion, 1); const char *cpu_model = machine->cpu_model; char **cpustr; ObjectClass *oc; const char *typename; CPUClass *cc; Error *err = NULL; bool firmware_loaded = bios_name || drive_get(IF_PFLASH, 0, 0); uint8_t clustersz; if (!cpu_model) { cpu_model = "cortex-a15"; } if (!vms->gic_version) { if (!kvm_enabled()) { error_report("gic-version=host requires KVM"); exit(1); } vms->gic_version = kvm_arm_vgic_probe(); if (!vms->gic_version) { error_report("Unable to determine GIC version supported by host"); exit(1); } } cpustr = g_strsplit(cpu_model, ",", 2); if (!cpuname_valid(cpustr[0])) { error_report("mach-virt: CPU %s not supported", cpustr[0]); exit(1); } if (vms->secure && firmware_loaded) { vms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; } else if (vms->virt) { vms->psci_conduit = QEMU_PSCI_CONDUIT_SMC; } else { vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC; } if (vms->gic_version == 3) { virt_max_cpus = vms->memmap[VIRT_GIC_REDIST].size / 0x20000; clustersz = GICV3_TARGETLIST_BITS; } else { virt_max_cpus = GIC_NCPU; clustersz = GIC_TARGETLIST_BITS; } if (max_cpus > virt_max_cpus) { error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by machine 'mach-virt' (%d)", max_cpus, virt_max_cpus); exit(1); } vms->smp_cpus = smp_cpus; if (machine->ram_size > vms->memmap[VIRT_MEM].size) { error_report("mach-virt: cannot model more than %dGB RAM", RAMLIMIT_GB); exit(1); } if (vms->virt && kvm_enabled()) { error_report("mach-virt: KVM does not support providing " "Virtualization extensions to the guest CPU"); exit(1); } if (vms->secure) { if (kvm_enabled()) { error_report("mach-virt: KVM does not support Security extensions"); exit(1); } secure_sysmem = g_new(MemoryRegion, 1); memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory", UINT64_MAX); memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1); } create_fdt(vms); oc = cpu_class_by_name(TYPE_ARM_CPU, cpustr[0]); if (!oc) { error_report("Unable to find CPU definition"); exit(1); } typename = object_class_get_name(oc); cc = CPU_CLASS(oc); cc->parse_features(typename, cpustr[1], &err); g_strfreev(cpustr); if (err) { error_report_err(err); exit(1); } for (n = 0; n < smp_cpus; n++) { Object *cpuobj = object_new(typename); if (!vmc->disallow_affinity_adjustment) { uint8_t aff1 = n / clustersz; uint8_t aff0 = n % clustersz; object_property_set_int(cpuobj, (aff1 << ARM_AFF1_SHIFT) | aff0, "mp-affinity", NULL); } if (!vms->secure) { object_property_set_bool(cpuobj, false, "has_el3", NULL); } if (!vms->virt && object_property_find(cpuobj, "has_el2", NULL)) { object_property_set_bool(cpuobj, false, "has_el2", NULL); } if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) { object_property_set_int(cpuobj, vms->psci_conduit, "psci-conduit", NULL); if (n > 0) { object_property_set_bool(cpuobj, true, "start-powered-off", NULL); } } if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) { object_property_set_bool(cpuobj, false, "pmu", NULL); } if (object_property_find(cpuobj, "reset-cbar", NULL)) { object_property_set_int(cpuobj, vms->memmap[VIRT_CPUPERIPHS].base, "reset-cbar", &error_abort); } object_property_set_link(cpuobj, OBJECT(sysmem), "memory", &error_abort); if (vms->secure) { object_property_set_link(cpuobj, OBJECT(secure_sysmem), "secure-memory", &error_abort); } object_property_set_bool(cpuobj, true, "realized", NULL); } fdt_add_timer_nodes(vms); fdt_add_cpu_nodes(vms); fdt_add_psci_node(vms); memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", machine->ram_size); memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); create_gic(vms, pic); fdt_add_pmu_nodes(vms); create_uart(vms, pic, VIRT_UART, sysmem, serial_hds[0]); if (vms->secure) { create_secure_ram(vms, secure_sysmem); create_uart(vms, pic, VIRT_SECURE_UART, secure_sysmem, serial_hds[1]); } create_rtc(vms, pic); create_pcie(vms, pic); create_gpio(vms, pic); create_virtio_devices(vms, pic); vms->fw_cfg = create_fw_cfg(vms, &address_space_memory); rom_set_fw(vms->fw_cfg); vms->machine_done.notify = virt_machine_done; qemu_add_machine_init_done_notifier(&vms->machine_done); vms->bootinfo.ram_size = machine->ram_size; vms->bootinfo.kernel_filename = machine->kernel_filename; vms->bootinfo.kernel_cmdline = machine->kernel_cmdline; vms->bootinfo.initrd_filename = machine->initrd_filename; vms->bootinfo.nb_cpus = smp_cpus; vms->bootinfo.board_id = -1; vms->bootinfo.loader_start = vms->memmap[VIRT_MEM].base; vms->bootinfo.get_dtb = machvirt_dtb; vms->bootinfo.firmware_loaded = firmware_loaded; arm_load_kernel(ARM_CPU(first_cpu), &vms->bootinfo); create_platform_bus(vms, pic); }
1threat
Pepper's tablet default : <p>I'm new about Pepper robot. At the first beginning of Pepper using it's tablet shows three circles include Retail,Office and tourism. Now, the Pepper's tablet just show something such as screensavers. How I can change it's tablet's mode to first configuration? I also did reset factory but It doesn't return to my desire mode instead of showing screensavers. <a href="https://i.stack.imgur.com/uC6G4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uC6G4.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/YkXSg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YkXSg.jpg" alt="enter image description here"></a></p>
0debug
The usage of computed properties in swift : <p>computed properties evaluated every time they are accessed(I mean the getter is called everytime),so why I just use a stored properties?</p>
0debug
static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets *ps, int is_nalff, int nal_length_size, void *logctx) { int i; int ret = 0; H2645Packet pkt = { 0 }; ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, nal_length_size, AV_CODEC_ID_HEVC, 1); if (ret < 0) { goto done; } for (i = 0; i < pkt.nb_nals; i++) { H2645NAL *nal = &pkt.nals[i]; switch (nal->type) { case HEVC_NAL_VPS: ff_hevc_decode_nal_vps(&nal->gb, logctx, ps); break; case HEVC_NAL_SPS: ff_hevc_decode_nal_sps(&nal->gb, logctx, ps, 1); break; case HEVC_NAL_PPS: ff_hevc_decode_nal_pps(&nal->gb, logctx, ps); break; default: av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n", nal->type); break; } } done: ff_h2645_packet_uninit(&pkt); return ret; }
1threat
How can I change the origin remote in VSCode? : <p>VS Code is my actual IDE and git client for all my projects. I'd like to change the origin remote of an actual repository.</p> <p>How can i do it?</p>
0debug
static int execute_command(BlockDriverState *bdrv, SCSIGenericReq *r, int direction, BlockDriverCompletionFunc *complete) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, r->req.dev); r->io_header.interface_id = 'S'; r->io_header.dxfer_direction = direction; r->io_header.dxferp = r->buf; r->io_header.dxfer_len = r->buflen; r->io_header.cmdp = r->req.cmd.buf; r->io_header.cmd_len = r->req.cmd.len; r->io_header.mx_sb_len = sizeof(s->sensebuf); r->io_header.sbp = s->sensebuf; r->io_header.timeout = MAX_UINT; r->io_header.usr_ptr = r; r->io_header.flags |= SG_FLAG_DIRECT_IO; r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r); if (r->req.aiocb == NULL) { BADF("execute_command: read failed !\n"); return -1; } return 0; }
1threat
static int usb_host_handle_iso_data(USBHostDevice *s, USBPacket *p, int in) { AsyncURB *aurb; int i, j, ret, max_packet_size, offset, len = 0; max_packet_size = get_max_packet_size(s, p->devep); if (max_packet_size == 0) return USB_RET_NAK; aurb = get_iso_urb(s, p->devep); if (!aurb) { aurb = usb_host_alloc_iso(s, p->devep, in); } i = get_iso_urb_idx(s, p->devep); j = aurb[i].iso_frame_idx; if (j >= 0 && j < ISO_FRAME_DESC_PER_URB) { if (in) { if (aurb[i].urb.status) { len = urb_status_to_usb_ret(aurb[i].urb.status); aurb[i].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1; } else if (aurb[i].urb.iso_frame_desc[j].status) { len = urb_status_to_usb_ret( aurb[i].urb.iso_frame_desc[j].status); } else if (aurb[i].urb.iso_frame_desc[j].actual_length > p->len) { printf("husb: received iso data is larger then packet\n"); len = USB_RET_NAK; } else { len = aurb[i].urb.iso_frame_desc[j].actual_length; memcpy(p->data, aurb[i].urb.buffer + j * aurb[i].urb.iso_frame_desc[0].length, len); } } else { len = p->len; offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->devep); if (len > max_packet_size) { printf("husb: send iso data is larger then max packet size\n"); return USB_RET_NAK; } memcpy(aurb[i].urb.buffer + offset, p->data, len); aurb[i].urb.iso_frame_desc[j].length = len; offset += len; set_iso_buffer_used(s, p->devep, offset); if (!is_iso_started(s, p->devep) && i == 1 && j == 8) { set_iso_started(s, p->devep); } } aurb[i].iso_frame_idx++; if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) { i = (i + 1) % s->iso_urb_count; set_iso_urb_idx(s, p->devep, i); } } else { if (in) { set_iso_started(s, p->devep); } else { DPRINTF("hubs: iso out error no free buffer, dropping packet\n"); } } if (is_iso_started(s, p->devep)) { for (i = 0; i < s->iso_urb_count; i++) { if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) { ret = ioctl(s->fd, USBDEVFS_SUBMITURB, &aurb[i]); if (ret < 0) { printf("husb error submitting iso urb %d: %d\n", i, errno); if (!in || len == 0) { switch(errno) { case ETIMEDOUT: len = USB_RET_NAK; break; case EPIPE: default: len = USB_RET_STALL; } } break; } aurb[i].iso_frame_idx = -1; change_iso_inflight(s, p->devep, +1); } } } return len; }
1threat
jquery executes before html loaded : How to make the html loaded before javascript function <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> $(document).ready(function() { var x =10; if(x==10) { $('h1').text("Its changed !"); alert("Test"); } }) <!-- language: lang-html --> <h1>Hello</h1> <!-- end snippet --> Here the alert message will appear then <h1> changes I tried also <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> $(function(){ window.on('load',function(){ //code }) }) <!-- end snippet --> but it doesn't work .
0debug
Setting Explict Annotation Processor : <p>I am attempting to add a maven repository to my Android Studio project. When I do a Gradle project sync everything is fine. However, whenever I try to build my apk, I get this error:</p> <pre><code>Execution failed for task ':app:javaPreCompileDebug'. &gt; Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - classindex-3.3.jar Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions .includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future. See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details. </code></pre> <p>The link included (<a href="https://developer.android.com/r/tools/annotation-processor-error-message.html" rel="noreferrer">https://developer.android.com/r/tools/annotation-processor-error-message.html</a>) in the error 404s so its of no help. </p> <p>I have enabled annotation processing in the android studio settings, and added <code>includeCompileClasspath = true</code> to my Annotation Processor options. I have also tried adding <code>classindex</code>, <code>classindex-3.3</code> and <code>classindex-3.3.jar</code> to Processor FQ Name, but that did not help either.</p> <p>these are the lines I have added to the default build.gradle under dependecies:</p> <pre><code>dependencies { ... compile group: 'com.skadistats', name: 'clarity', version:'2.1.1' compile group: 'org.atteo.classindex', name: 'classindex', version:'3.3' } </code></pre> <p>Originally I just had the "clarity" one added, because that is the one I care about, but I added the "classindex" entry in the hopes that it would fix it. Removing "clarity" and keeping "classindex" gives me the exact same error. </p> <p>I'm not all too familiar with gradle/maven so any help would be appreciated.</p>
0debug
strcpy() alternative for integers and doubles - c : <p>So I used this code in order to pass a variable in to my struct:</p> <pre><code>strcpy(s[i].orderName, Name); </code></pre> <p>and it works how I want it to. However, the rest of my variables are integers and a double and it appears there is no "intcpy()" alternative from what I have found. Is there another way to pass integer and double variables in to my struct?</p> <p>Thank you.</p>
0debug
Git signed commits - How to suppress "You need a passphrase to unlock the secret key..." : <p>I changed my global Git configuration to sign all commits. I also use gpg-agent so that I don't have to type my password every time.</p> <p>Now every time I make a new commit I see the following five lines printed to my console:</p> <pre><code>[blank line] You need a passphrase to unlock the secret key for user: "John Doe &lt;mail@gmail.com&gt;" 2048-bit RSA key, ID ABCDEF12, created 2016-01-01 [blank line] </code></pre> <p>Even worse, when I do a simple stash, this message is printed <em>twice</em>, needlessly filling my console (I assume for one for each of the two commit objects that are created).</p> <p>Is there a way to suppress this output?</p>
0debug
Can someone help me better understand this code. The point of this function is to have user input numbers and the program returns the numbers reversed : Can someone help me better understand this code. The point of this function is to have user input numbers and the program returns the numbers reversed. I'm just curious to know how it works, what exactly in the reverse function is doing the reversing? I tried doing the math but i keep hitting a roadblock. class Program { static void Main(string[] args) { int n = 0, result = 0; Console.WriteLine("Please Enter a Number: "); n = Convert.ToInt32(Console.ReadLine()); result = reverse(n); Console.WriteLine("The Reverse Number Is : " + result); Console.ReadKey(); } public static int reverse(int n) { int temp = 0, rev = 0; while( n != 0) { temp = n % 10; rev = (rev * 10) + temp; n = n / 10; } return rev; } } }
0debug
To get Connections Tab displayed in Oracle Sql Developer : I am unable to see the connections tab with schemas and table list in Oracle Sql Developer instead it only shows query editor and on top of it database name to which I have made connection. How to get Connection tab without restoring factory settings?
0debug
void virtqueue_map_sg(struct iovec *sg, hwaddr *addr, size_t num_sg, int is_write) { unsigned int i; hwaddr len; if (num_sg > VIRTQUEUE_MAX_SIZE) { error_report("virtio: map attempt out of bounds: %zd > %d", num_sg, VIRTQUEUE_MAX_SIZE); exit(1); } for (i = 0; i < num_sg; i++) { len = sg[i].iov_len; sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write); if (sg[i].iov_base == NULL || len != sg[i].iov_len) { error_report("virtio: error trying to map MMIO memory"); exit(1); } } }
1threat
Google Sheets API v4 - How to get the last row with value? : <p>How to get the last row with value in the new Google Sheets API v4 ?</p> <p>i use this to get a range from a sheet:</p> <pre><code>mService.spreadsheets().values().get("ID_SHEET", "Sheet1!A2:B50").execute(); </code></pre> <p>how to detect the last row with value in the sheet ?</p>
0debug
Permission Denial in emulator : java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxx cmp=com.android.server.telecom/.components.UserCallActivity } from ProcessRecord{9a25695 2469:in.preciseit.dialhingoli/u0a59} (pid=2469, uid=10059) with revoked permission android.permission.CALL_PHONE here is what i want to ask in Logcat error
0debug
C++20 Concepts : Which template specialization gets chosen when the template argument qualifies for multiple concepts? : <p>Given :</p> <pre><code>#include &lt;concepts&gt; #include &lt;iostream&gt; template&lt;class T&gt; struct wrapper; template&lt;std::signed_integral T&gt; struct wrapper&lt;T&gt; { wrapper() = default; void print() { std::cout &lt;&lt; "signed_integral" &lt;&lt; std::endl; } }; template&lt;std::integral T&gt; struct wrapper&lt;T&gt; { wrapper() = default; void print() { std::cout &lt;&lt; "integral" &lt;&lt; std::endl; } }; int main() { wrapper&lt;int&gt; w; w.print(); // Output : signed_integral return 0; } </code></pre> <p>From code above, <code>int</code> qualifies to both <code>std::integral</code> and <code>std::signed_integral</code> concept.</p> <p>Surprisingly this compiles and prints "signed_integral" on both GCC and MSVC compilers. I was expecting it to fail with an error along the lines of "template specialization already been defined".</p> <p>Okay, that's legal, fair enough, but why was <code>std::signed_integral</code> chosen instead of <code>std::integral</code>? Is there any rules defined in the standard with what template specialization gets chosen when multiple concepts qualify for the template argument?</p>
0debug
How to hide error notification message in magento2 : How to hide error notification message in magento2 (only error)?[enter image description here][1] [1]: https://i.stack.imgur.com/4txWD.png
0debug
time format problem comparison is not working : two table time is format Jan 1 2018 10:42:06 but is not working comparison table1.time > table2.time data is not coming
0debug
How to get message tracking logs from office 365? Any APIs? : Graph api or powershell will work of any other solution like auto forwarding or any other option
0debug
C# Convert string to dateTime US : I have a string in the following format. "Ene 1 2017 12:00AM" I need to convert it to a date: "Jan 1 2017 12:00AM" or "01/01/2017" thanks
0debug
static void test_visitor_out_native_list_uint64(TestOutputVisitorData *data, const void *unused) { test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U64); }
1threat
How to fix this dropup menu in IE? : <p>This drop up notification menu doesn't work in IE 11: <a href="https://sharebootstrap.com/demo/docu/" rel="nofollow noreferrer">https://sharebootstrap.com/demo/docu/</a></p> <p>How to fix this code in IE 11?</p>
0debug
Code .php gets commented out : <p><strong>1 - Here's a image of my error code .. <em>The purple color zone is the zone commented out automatically and I don't know why it happens...</em></strong></p> <p><a href="https://i.stack.imgur.com/nV5ih.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nV5ih.jpg" alt="enter image description here"></a></p> <p><strong>2 - I use Mozilla Firefox and Chrome, and bothwhere happens this.</strong> <strong>3 - I use XAMPP to connect 80 Apache and 3306 to MySQL ... db works good</strong></p> <p><strong>...WHY MY CODE GETS COMMENTED OUT? SOME HELP? I can give more info if needed thx</strong></p>
0debug
Find count of sub_string in string : <p>Why is this giving output as 1 and not 2:</p> <pre><code>string = "ABCDCDC" print(string.count("CDC")) </code></pre> <p>Also, since this is not working, how can I get 2 in this case?</p>
0debug
Docker, one or more build-args where not consumed : <p>I'm trying to build Oracle WebLogic Docker image with custom environment variables</p> <pre><code>$ docker build -t 12213-domain --build-arg ADMIN_PORT=8888 --build-arg ADMIN_PASSWORD=wls . </code></pre> <p>but I get the following warning on the build log</p> <pre><code>[Warning] One or more build-args [ADMIN_PASSWORD ADMIN_PORT] were not consumed </code></pre> <p>Here is the Dockerfile of the image I'm trying to build</p> <pre><code>#Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved. # #Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. # # ORACLE DOCKERFILES PROJECT # -------------------------- # This Dockerfile extends the Oracle WebLogic image by creating a sample domain. # # Util scripts are copied into the image enabling users to plug NodeManager # automatically into the AdminServer running on another container. # # HOW TO BUILD THIS IMAGE # ----------------------- # Put all downloaded files in the same directory as this Dockerfile # Run: # $ sudo docker build -t 12213-domain # # Pull base image # --------------- FROM oracle/weblogic:12.2.1.3-developer # Maintainer # ---------- MAINTAINER Monica Riccelli &lt;monica.riccelli@oracle.com&gt; # WLS Configuration # --------------------------- ENV ADMIN_HOST="wlsadmin" \ NM_PORT="5556" \ MS_PORT="8001" \ DEBUG_PORT="8453" \ ORACLE_HOME=/u01/oracle \ SCRIPT_FILE=/u01/oracle/createAndStartWLSDomain.sh \ CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true" \ PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/${DOMAIN_NAME:-base_domain}/bin:/u01/oracle # Domain and Server environment variables # ------------------------------------------------------------ ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}" \ PRE_DOMAIN_HOME=/u01/oracle/user_projects \ ADMIN_PORT="${ADMIN_PORT:-7001}" \ ADMIN_USERNAME="${ADMIN_USERNAME:-weblogic}" \ ADMIN_NAME="${ADMIN_NAME:-AdminServer}" \ MS_NAME="${MS_NAME:-""}" \ NM_NAME="${NM_NAME:-""}" \ ADMIN_PASSWORD="${ADMIN_PASSWORD:-""}" \ CLUSTER_NAME="${CLUSTER_NAME:-DockerCluster}" \ DEBUG_FLAG=true \ PRODUCTION_MODE=dev # Add files required to build this image COPY container-scripts/* /u01/oracle/ #Create directory where domain will be written to USER root RUN chmod +xw /u01/oracle/*.sh &amp;&amp; \ chmod +xw /u01/oracle/*.py &amp;&amp; \ mkdir -p $PRE_DOMAIN_HOME &amp;&amp; \ chmod a+xr $PRE_DOMAIN_HOME &amp;&amp; \ chown -R oracle:oracle $PRE_DOMAIN_HOME VOLUME $PRE_DOMAIN_HOME # Expose Node Manager default port, and also default for admin and managed server EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT $DEBUG_PORT USER oracle WORKDIR $ORACLE_HOME # Define default command to start bash. CMD ["/u01/oracle/createAndStartWLSDomain.sh"] </code></pre> <p>I'm running docker-toolbox on windows, and the docker version is</p> <pre><code>$ docker --version Docker version 18.03.0-ce, build 0520e24302 </code></pre>
0debug
Named entity recognition in Spacy : <p>I am trying to find Named entities for a sentence as below </p> <pre><code>import spacy.lang.en parser = spacy.lang.en.English() ParsedSentence = parser(u"Alphabet is a new startup in China") for Entity in ParsedSentence.ents: print (Entity.label, Entity.label_, ' '.join(t.orth_ for t in Entity)) </code></pre> <p>I am expecting to get the result "Alphabet","China" but I am getting an empty set as result. What am I doing wrong here</p>
0debug
Google dataflow streaming pipeline is not distributing workload over several workers after windowing : <p>I'm trying to set up a dataflow streaming pipeline in python. I have quite some experience with batch pipelines. Our basic architecture looks like this: <a href="https://i.stack.imgur.com/OXB4O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OXB4O.png" alt="enter image description here"></a></p> <p>The first step is doing some basic processing and takes about 2 seconds per message to get to the windowing. We are using sliding windows of 3 seconds and 3 second interval (might change later so we have overlapping windows). As last step we have the SOG prediction that takes about 15ish seconds to process and which is clearly our bottleneck transform.</p> <p>So, The issue we seem to face is that the workload is perfectly distributed over our workers before the windowing, but the most important transform is not distributed at all. All the windows are processed one at a time seemingly on 1 worker, while we have 50 available.</p> <p>The logs show us that the sog prediction step has an output once every 15ish seconds which should not be the case if the windows would be processed over more workers, so this builds up huge latency over time which we don't want. With 1 minute of messages, we have a latency of 5 minutes for the last window. When distribution would work, this should only be around 15sec (the SOG prediction time). So at this point we are clueless..</p> <p><a href="https://i.stack.imgur.com/5AEmD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5AEmD.png" alt="enter image description here"></a></p> <p>Does anyone see if there is something wrong with our code or how to prevent/circumvent this? It seems like this is something happening in the internals of google cloud dataflow. Does this also occur in java streaming pipelines?</p> <p>In batch mode, Everything works fine. There, one could try to do a reshuffle to make sure no fusion etc occurs. But that is not possible after windowing in streaming.</p> <pre><code>args = parse_arguments(sys.argv if argv is None else argv) pipeline_options = get_pipeline_options(project=args.project_id, job_name='XX', num_workers=args.workers, max_num_workers=MAX_NUM_WORKERS, disk_size_gb=DISK_SIZE_GB, local=args.local, streaming=args.streaming) pipeline = beam.Pipeline(options=pipeline_options) # Build pipeline # pylint: disable=C0330 if args.streaming: frames = (pipeline | 'ReadFromPubsub' &gt;&gt; beam.io.ReadFromPubSub( subscription=SUBSCRIPTION_PATH, with_attributes=True, timestamp_attribute='timestamp' )) frame_tpl = frames | 'CreateFrameTuples' &gt;&gt; beam.Map( create_frame_tuples_fn) crops = frame_tpl | 'MakeCrops' &gt;&gt; beam.Map(make_crops_fn, NR_CROPS) bboxs = crops | 'bounding boxes tfserv' &gt;&gt; beam.Map( pred_bbox_tfserv_fn, SERVER_URL) sliding_windows = bboxs | 'Window' &gt;&gt; beam.WindowInto( beam.window.SlidingWindows( FEATURE_WINDOWS['goal']['window_size'], FEATURE_WINDOWS['goal']['window_interval']), trigger=AfterCount(30), accumulation_mode=AccumulationMode.DISCARDING) # GROUPBYKEY (per match) group_per_match = sliding_windows | 'Group' &gt;&gt; beam.GroupByKey() _ = group_per_match | 'LogPerMatch' &gt;&gt; beam.Map(lambda x: logging.info( "window per match per timewindow: # %s, %s", str(len(x[1])), x[1][0][ 'timestamp'])) sog = sliding_windows | 'Predict SOG' &gt;&gt; beam.Map(predict_sog_fn, SERVER_URL_INCEPTION, SERVER_URL_SOG ) pipeline.run().wait_until_finish() </code></pre>
0debug
int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, unsigned char *dest, int dest_size) { PixFmtInfo* pf = &pix_fmt_info[pix_fmt]; int i, j, w, h, data_planes; const unsigned char* s; int size = avpicture_get_size(pix_fmt, width, height); if (size > dest_size) return -1; if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_UYVY422 || pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555) w = width * 2; else if (pix_fmt == PIX_FMT_UYVY411) w = width + width/2; else if (pix_fmt == PIX_FMT_PAL8) w = width; else w = width * (pf->depth * pf->nb_channels / 8); data_planes = 1; h = height; } else { data_planes = pf->nb_channels; w = (width*pf->depth + 7)/8; h = height; } for (i=0; i<data_planes; i++) { if (i == 1) { w = width >> pf->x_chroma_shift; h = height >> pf->y_chroma_shift; } s = src->data[i]; for(j=0; j<h; j++) { memcpy(dest, s, w); dest += w; s += src->linesize[i]; } } if (pf->pixel_type == FF_PIXEL_PALETTE) memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); return size; }
1threat
Angular 4 get headers from API response : <p>I'm sending a request to an API, it returns an array of data, but I don't know how to extract the headers from that url, this is what i've tried in my service</p> <pre><code>@Injectable() export class ResourcesService { private resourcesurl = "http://localhost:9111/v1/resources"; constructor(private http: Http) { } getResources() { let headers = new Headers(); headers.append("api_key", "123456"); return this.http.get(this.resourcesurl, { headers: headers }).map(this.extractData).catch(this.handleError); } getresourceheaders(){ let headers = new Headers(); headers.append("api_key", "123456"); let options = new RequestOptions(); let testsss = options.headers let headerapi = this.http.request(this.resourcesurl, options); let test = this.http.get(this.resourcesurl, { headers: headers }); console.log(headerapi); } private extractData(res: Response) { let body = res.json(); return body.data || {}; } private handleError(error: Response | any) { let errMsg: string; if (error instanceof Response) { const body = error.json() || ''; const err = body.error || JSON.stringify(body); errMsg = `${error.status} - ${error.statusText || ''} ${err}`; } else { errMsg = error.message ? error.message : error.toString(); } console.error(errMsg); return Observable.throw(errMsg); } } </code></pre> <p>I want to get the headers from that response that in this case is <strong>resourceurl</strong></p> <p>any idea?</p>
0debug
How to append a list to an existing list of lists? : <p>If I have a list of lists <code>[[1,1,1,1],[2,2,2,2]]</code> how do I add a 3rd list <code>[3,3,3,3]</code> to it to make it <code>[[1,1,1,1],[2,2,2,2],[3,3,3,3]]</code></p>
0debug
ReactJS "TypeError: Cannot read property 'array' of undefined" : <p>While running this code I got error on the first line on <code>App.propTypes</code> </p> <blockquote> <p>TypeError: Cannot read property 'array' of undefined</p> </blockquote> <p>Code:</p> <pre><code> class App extends React.Component { render() { return ( &lt;div&gt; &lt;h3&gt;Array: {this.props.propArray}&lt;/h3&gt; &lt;h3&gt;Array: {this.props.propBool ? "true" : "false"}&lt;/h3&gt; &lt;h3&gt;Func: {this.props.propFunc(3)}&lt;/h3&gt; &lt;h3&gt;Number: {this.props.propNumber}&lt;/h3&gt; &lt;h3&gt;String: {this.props.propString}&lt;/h3&gt; &lt;h3&gt;Object: {this.props.propObject.objectName1}&lt;/h3&gt; &lt;h3&gt;Object: {this.props.propObject.objectName2}&lt;/h3&gt; &lt;h3&gt;Object: {this.props.propObject.objectName3}&lt;/h3&gt; &lt;/div&gt; ); } } App.propTypes = { propArray: React.PropTypes.array.isRequired, //I got error over here propBool: React.PropTypes.bool.isRequired, propFunc: React.PropTypes.func, propNumber: React.PropTypes.number, propString: React.PropTypes.string, propObject: React.PropTypes.object } App.defaultProps = { propArray: [1,2,3,4,5], propBool: true, propFunc: function(e){return e}, propNumber: 1, propString: "String value...", propObject: { objectName1:"objectValue1", objectName2: "objectValue2", objectName3: "objectValue3" } } </code></pre> <p>I tried to search but I didn't get the correct solution.</p>
0debug
static int nut_write_header(AVFormatContext * avf) { NUTContext * priv = avf->priv_data; AVIOContext * bc = avf->pb; nut_muxer_opts_tt mopts = { .output = { .priv = bc, .write = av_write, }, .alloc = { av_malloc, av_realloc, av_free }, .write_index = 1, .realtime_stream = 0, .max_distance = 32768, .fti = NULL, }; nut_stream_header_tt * s; int i; priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s); for (i = 0; i < avf->nb_streams; i++) { AVCodecContext * codec = avf->streams[i]->codec; int j; int fourcc = 0; int num, denom, ssize; s[i].type = codec->codec_type == AVMEDIA_TYPE_VIDEO ? NUT_VIDEO_CLASS : NUT_AUDIO_CLASS; if (codec->codec_tag) fourcc = codec->codec_tag; else fourcc = ff_codec_get_tag(nut_tags, codec->codec_id); if (!fourcc) { if (codec->codec_type == AVMEDIA_TYPE_VIDEO) fourcc = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id); if (codec->codec_type == AVMEDIA_TYPE_AUDIO) fourcc = ff_codec_get_tag(ff_codec_wav_tags, codec->codec_id); } s[i].fourcc_len = 4; s[i].fourcc = av_malloc(s[i].fourcc_len); for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF; ff_parse_specific_params(codec, &num, &ssize, &denom); avpriv_set_pts_info(avf->streams[i], 60, denom, num); s[i].time_base.num = denom; s[i].time_base.den = num; s[i].fixed_fps = 0; s[i].decode_delay = codec->has_b_frames; s[i].codec_specific_len = codec->extradata_size; s[i].codec_specific = codec->extradata; if (codec->codec_type == AVMEDIA_TYPE_VIDEO) { s[i].width = codec->width; s[i].height = codec->height; s[i].sample_width = 0; s[i].sample_height = 0; s[i].colorspace_type = 0; } else { s[i].samplerate_num = codec->sample_rate; s[i].samplerate_denom = 1; s[i].channel_count = codec->channels; } } s[avf->nb_streams].type = -1; priv->nut = nut_muxer_init(&mopts, s, NULL); return 0; }
1threat
static void avc_luma_hv_qrt_4w_msa(const uint8_t *src_x, const uint8_t *src_y, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height) { uint32_t loop_cnt; v16i8 src_hz0, src_hz1, src_hz2, src_hz3; v16i8 src_vt0, src_vt1, src_vt2, src_vt3, src_vt4; v16i8 src_vt5, src_vt6, src_vt7, src_vt8; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, vert_out0, vert_out1; v8i16 out0, out1; v16u8 out; LD_SB3(&luma_mask_arr[48], 16, mask0, mask1, mask2); LD_SB5(src_y, src_stride, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4); src_y += (5 * src_stride); src_vt0 = (v16i8) __msa_insve_w((v4i32) src_vt0, 1, (v4i32) src_vt1); src_vt1 = (v16i8) __msa_insve_w((v4i32) src_vt1, 1, (v4i32) src_vt2); src_vt2 = (v16i8) __msa_insve_w((v4i32) src_vt2, 1, (v4i32) src_vt3); src_vt3 = (v16i8) __msa_insve_w((v4i32) src_vt3, 1, (v4i32) src_vt4); XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3); for (loop_cnt = (height >> 2); loop_cnt--;) { LD_SB4(src_x, src_stride, src_hz0, src_hz1, src_hz2, src_hz3); src_x += (4 * src_stride); XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3); hz_out0 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src_hz0, src_hz1, mask0, mask1, mask2); hz_out1 = AVC_XOR_VSHF_B_AND_APPLY_6TAP_HORIZ_FILT_SH(src_hz2, src_hz3, mask0, mask1, mask2); SRARI_H2_SH(hz_out0, hz_out1, 5); SAT_SH2_SH(hz_out0, hz_out1, 7); LD_SB4(src_y, src_stride, src_vt5, src_vt6, src_vt7, src_vt8); src_y += (4 * src_stride); src_vt4 = (v16i8) __msa_insve_w((v4i32) src_vt4, 1, (v4i32) src_vt5); src_vt5 = (v16i8) __msa_insve_w((v4i32) src_vt5, 1, (v4i32) src_vt6); src_vt6 = (v16i8) __msa_insve_w((v4i32) src_vt6, 1, (v4i32) src_vt7); src_vt7 = (v16i8) __msa_insve_w((v4i32) src_vt7, 1, (v4i32) src_vt8); XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7); vert_out0 = AVC_CALC_DPADD_B_6PIX_2COEFF_R_SH(src_vt0, src_vt1, src_vt2, src_vt3, src_vt4, src_vt5); vert_out1 = AVC_CALC_DPADD_B_6PIX_2COEFF_R_SH(src_vt2, src_vt3, src_vt4, src_vt5, src_vt6, src_vt7); SRARI_H2_SH(vert_out0, vert_out1, 5); SAT_SH2_SH(vert_out0, vert_out1, 7); out0 = __msa_srari_h((hz_out0 + vert_out0), 1); out1 = __msa_srari_h((hz_out1 + vert_out1), 1); SAT_SH2_SH(out0, out1, 7); out = PCKEV_XORI128_UB(out0, out1); ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride); dst += (4 * dst_stride); src_vt3 = src_vt7; src_vt1 = src_vt5; src_vt0 = src_vt4; src_vt4 = src_vt8; src_vt2 = src_vt6; } }
1threat
Input string was not in a correct format. Expected type is Decimal : I am not inserting any value in `VOUCHER_NO` column and updating it. But it is giving me error as >Input string was not in a correct format.Couldn't store <> in VOUCHER_NO Column. Expected type is Decimal. Below is my code drpayinfo[0]["VOUCHER_NO"] = e.Record["VOUCHER_NO"];
0debug
C# 7 Expression Bodied Constructors : <p>In C# 7, how do I write an Expression Bodied Constructor like this using 2 parameters.</p> <pre><code>public Person(string name, int age) { Name = name; Age = age; } </code></pre>
0debug
def count_reverse_pairs(test_list): res = sum([1 for idx in range(0, len(test_list)) for idxn in range(idx, len( test_list)) if test_list[idxn] == str(''.join(list(reversed(test_list[idx]))))]) return str(res)
0debug
Sound Localization with a single microphone : <p>I am trying to determine the direction of an audio signal using the microphone on an iPhone. Is there any way to do this? As far as I have read and attempted, it isn't possible. I have made extensive models with keras and even then determining the location of the sound is shaky at best due to the number of variables. So not including any ML aspects, is there a library or method to determine audio direction from an iOS microphone?</p>
0debug
Insert not inserting in property : <p>Insert not adding to variable in property</p> <pre><code>private string _DirectoryList = ""; public string DirectoryListAdd { get { return _DirectoryList; } set { _DirectoryList.Insert(0, value + Environment.NewLine); OnPropertyChanged("DirectoryListAdd"); } } public MainWindow() { InitializeComponent(); DirectoryListAdd = "a"; DirectoryListAdd = "b"; Console.WriteLine(DirectoryListAdd); } </code></pre> <p>This is returning "". I wouldve expected it to return</p> <pre><code>a b </code></pre>
0debug
os module of python regarding os.linesep : <p>Why has os.linesep() been used here in my code?</p> <pre><code>def GetInstruction(): print(os.linesep)#&lt;--------??? Instruction = input("&gt; ").lower() return Instruction </code></pre>
0debug
Bootstrap mobile nav not toggling : <p>Website in question</p> <p><a href="https://steve-morris.co.uk/" rel="nofollow">https://steve-morris.co.uk/</a></p> <p>Menu works fine in normal view but when trying to view via a mobile device the nav bar toggle button does nothing with no errors reported either.</p> <p>Any ideas?</p>
0debug
What is the difference between ADAL.js and MSAL.js? : <p>I am trying to handle authentication for my app which uses Microsoft Graph.</p> <p>What is the difference between these two libraries?</p> <ul> <li><p><a href="https://github.com/AzureAD/azure-activedirectory-library-for-js" rel="noreferrer">Active Directory Authentication Library for JavaScript (ADAL.js)</a></p></li> <li><p><a href="https://github.com/AzureAD/microsoft-authentication-library-for-js" rel="noreferrer">Microsoft Authentication Library for JavaScript (MSAL.js)</a></p></li> </ul> <p>Is ADAL.js just an Angular 1 library of MSAL.js?</p>
0debug
Firebase serve error: Port 5000 is not open. Could not start functions emulator : <p>I'm trying to serve firebase functions locally, but when I run <code>firebase serve</code> or <code>firebase emulators:start</code> the error message is: "Port 5000 is not open, could not start functions emulator."</p> <p>I'm using Windows 10, so I've tried to change the port number, check if the port is blocked by Firewall and I create a new rule in Firewall to ports 5000-5010 but none of this approaches worked for me.</p>
0debug
Can someone please help me separate the column in my data file using R? : The col is named id and i need to separate them into two columns based on _POS_ id *ID_131604_scaffold109166_Locus_191120_0_37.5_LINEAR_No_definition_line_found_POS_196 *ID_131604_scaffold109166_Locus_191120_0_37.5_LINEAR_No_definition_line_found_POS_204 *ID_131604_scaffold109166_Locus_191120_0_37.5_LINEAR_No_definition_line_found_POS_210 *ID_166920_C1460071_12.0_No_definition_line_found_POS_4529 *ID_167502_C1460265_46.0_No_definition_line_found_POS_720 *ID_167502_C1460265_46.0_No_definition_line_found_POS_727 *ID_167502_C1460265_46.0_No_definition_line_found_POS_734 *ID_167502_C1460265_46.0_No_definition_line_found_POS_2179 *ID_23929_C933331_63.0_No_definition_line_found_POS_121 *ID_23929_C933331_63.0_No_definition_line_found_POS_131
0debug
Client for vue.js from swagger spec : <p>I have the swagger/openapi specification. Does any solution exist to generate a javascript client and then use it in vue.js components? </p> <p>After googling I found this: <a href="https://github.com/swagger-api/swagger-codegen" rel="noreferrer">https://github.com/swagger-api/swagger-codegen</a> but I want to find more "native" solution for vue.js/webpack</p>
0debug
PHP URL decode GET : While intercepting traffic of an app i got this GET APIs but i dont know how to decode them so that they look like what they are actually please help me. /api/v1/referral/createuser?phoneNumber=7018805137&deviceImeiId=lQAHMiAwBx%2B%2FchlgHKjWfA%3D%3D%0A&hardwareSerialNumber=bcZ%2Bb5VrI84UN%2FWXJj8hyQ%3D%3D%0A&macAddress=pDQheRx1nNFqOz%2Fw9Y9bI3I96uVKXjhkDXNhNgV%2FyGw%3D%0A&androidID=PQ9kdlHyznGdGKcl0QYh3hp4XeRUz0bBVMnABcxRsZ8%3D%0A&referralCode=7JMYUZ&lastEnabledTime=1481449847956&updateTime=1481449669855&installationTime=1481449669855
0debug
c# - If data from database table column has country name then display "text on datatable" : I was able to retieve data from sql database and return it in json format . Now i have this region table which has the region and country name on it . Now wen retrieving data from this table which has country name i want to display only the let say airport on that country only one airport . public void GetAllRooms() { string cs = ConfigurationManager.ConnectionStrings["MYDB"].ConnectionString; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "SELECT tblResortsRooms.intResortID, tblResortsRooms.strRoomType,tblResortsRooms.strDescription, tblRegions.strRegion FROM ((tblResortsRooms INNER JOIN tblResorts ON tblResorts.intResortID = tblResortsRooms.intResortID) INNER JOIN tblRegions ON tblRegions.intRegionID = tblResorts.intResortID);"; con.Open(); DataTable dt = new DataTable(); // NEED HELP IN ENTRING THAT CODE HERE SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); string JSONString = string.Empty; JSONString = JsonConvert.SerializeObject(dt); Context.Response.Write(JSONString); }
0debug
VBA to create new folder, named (yyyy-mm-dd) based on what's next business day : This in my current folder and Workbook (ThisWB) holding my vba: **\2018-10-18\ThisWB.xlsm** This is new folders what I want to create from running vba in "ThisWB.xlsm": **\2018-10-19\R2** (only example, does not match today's date) First folder should be named based on tomorrows date. Next one should be fixed to "R2". As I move stuff around a lot, I'm hoping for a vba that doesn't need the entire folder path starting with "C:\". And here's the real bugger: When running vba on weekdays monday to thursday, folder should be named based on tomorrows date. When running vba on friday (or saturday), folder should be named based on next business day - which for me is monday... Can this be done?
0debug
static int xio3130_upstream_initfn(PCIDevice *d) { PCIEPort *p = PCIE_PORT(d); int rc; Error *err = NULL; pci_bridge_initfn(d, TYPE_PCIE_BUS); pcie_port_init_reg(d); rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT, &err); if (rc < 0) { assert(rc == -ENOTSUP); error_report_err(err); goto err_bridge; } rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET, XIO3130_SSVID_SVID, XIO3130_SSVID_SSID); if (rc < 0) { goto err_bridge; } rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_UPSTREAM, p->port); if (rc < 0) { goto err_msi; } pcie_cap_flr_init(d); pcie_cap_deverr_init(d); rc = pcie_aer_init(d, XIO3130_AER_OFFSET, PCI_ERR_SIZEOF); if (rc < 0) { goto err; } return 0; err: pcie_cap_exit(d); err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); return rc; }
1threat
static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) { int err = 0; if (dst != src) { dst->sub_id = src->sub_id; dst->time_base = src->time_base; dst->width = src->width; dst->height = src->height; dst->pix_fmt = src->pix_fmt; dst->coded_width = src->coded_width; dst->coded_height = src->coded_height; dst->has_b_frames = src->has_b_frames; dst->idct_algo = src->idct_algo; dst->slice_count = src->slice_count; dst->bits_per_coded_sample = src->bits_per_coded_sample; dst->sample_aspect_ratio = src->sample_aspect_ratio; dst->dtg_active_format = src->dtg_active_format; dst->profile = src->profile; dst->level = src->level; dst->bits_per_raw_sample = src->bits_per_raw_sample; dst->ticks_per_frame = src->ticks_per_frame; dst->color_primaries = src->color_primaries; dst->color_trc = src->color_trc; dst->colorspace = src->colorspace; dst->color_range = src->color_range; dst->chroma_sample_location = src->chroma_sample_location; } if (for_user) { dst->coded_frame = src->coded_frame; dst->has_b_frames += src->thread_count - 1; } else { if (dst->codec->update_thread_context) err = dst->codec->update_thread_context(dst, src); } return err; }
1threat
Excel macro in Mac - populating a spreadsheet from other tab values : I am not familiar with VBA in excel macro, and I need to create a macro in excel for mac which does the following: I have 2 tabs (wkst1 and wkst2) and need to populate a third one (wkst3) wkst1 has one column with names listed e.g. A B wkst2 has two columns X 1 Y 4 I need to populate wkst3 to ensure all rows in wkst2 are associated to each name listed in wkst1. e.g. my wished result would be: A X 1 A Y 4 B X 1 B Y 4 May you suggest the code I should use for this macro ? Thanks in advance!
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
CPP - core dumbed while using vector<string> : So on ubuntu i always get core dumped when trying to execute this function: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> vector<string> inArray(vector<string> &array1, vector<string> &array2){ vector<string> result; for(int i=0;i<array1.size();i++){ for(int j=0;j<array2.size();j++){ if(array1[i] == array2[j])result.push_back(array1[i]); } } return result; } <!-- end snippet --> Can someone tell me what is wrong?
0debug
sed is not changing the string : <p>I have 3 files:</p> <pre><code>File1: &amp;VAR1='1111'; File2: &amp;VAR2 = '2222'; File3: &amp;VAR1 = 1111 </code></pre> <p>I want to change that for example with &amp;NEWVAR = 'NEW';</p> <p>So I have the following script:</p> <pre><code>A="\&amp;VAR1\s*\=\s*'*[1]{4}'*" for f in /u/123456/*; do if grep -qE $A $f; then sed 's/$LAREXP/$LACADE/g' $f fi done </code></pre> <p>Grep tells me there are coincidence en File1 and File3, wich is correct, but the sed command is no replacing the old string with the new one in those files. It shows on screen the content of the files but there's no replace.</p> <p>Can anyone help me with this?</p> <p>Regards,</p>
0debug
tkinter destroy not working : <p>So I'm coding a game with python and tkinter where I need a popup window when the game finishes but when I click the "play again" button it doesn't destroy the popup window. Also the message on the popup appears with curly brackets, ie "{Game over, player} red wins!</p> <p>Here's the popup window code:</p> <pre><code>def gameOverPopup(winOrTie): if winOrTie==True: lText=("Game over, player",player,"wins!") else: lText=("Game over, board full!") popup=tk.Toplevel() winLabel=tk.Label(popup,text=lText) winLabel.grid(column=1,row=1,padx=50,pady=25) againButton=tk.Button(popup,text="Play again",command=resetGame(popup)) againButton.grid(column=1,row=2,padx=50,pady=25) endButton=tk.Button(popup,text="Quit",command=window.destroy) endButton.grid(column=1,row=3,padx=50,pady=25) def resetGame(popup): popup.destroy </code></pre>
0debug
static int protocol_version(VncState *vs, uint8_t *version, size_t len) { char local[13]; memcpy(local, version, 12); local[12] = 0; if (sscanf(local, "RFB %03d.%03d\n", &vs->major, &vs->minor) != 2) { VNC_DEBUG("Malformed protocol version %s\n", local); vnc_client_error(vs); return 0; } VNC_DEBUG("Client request protocol version %d.%d\n", vs->major, vs->minor); if (vs->major != 3 || (vs->minor != 3 && vs->minor != 4 && vs->minor != 5 && vs->minor != 7 && vs->minor != 8)) { VNC_DEBUG("Unsupported client version\n"); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); return 0; } if (vs->minor == 4 || vs->minor == 5) vs->minor = 3; if (vs->minor == 3) { if (vs->vd->auth == VNC_AUTH_NONE) { VNC_DEBUG("Tell client auth none\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); vnc_read_when(vs, protocol_client_init, 1); } else if (vs->vd->auth == VNC_AUTH_VNC) { VNC_DEBUG("Tell client VNC auth\n"); vnc_write_u32(vs, vs->vd->auth); vnc_flush(vs); start_auth_vnc(vs); } else { VNC_DEBUG("Unsupported auth %d for protocol 3.3\n", vs->vd->auth); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); } } else { VNC_DEBUG("Telling client we support auth %d\n", vs->vd->auth); vnc_write_u8(vs, 1); vnc_write_u8(vs, vs->vd->auth); vnc_read_when(vs, protocol_client_auth, 1); vnc_flush(vs); } return 0; }
1threat
Sintax explanation : Hello I am learning angular via the Tour of Heroes tutorial, I was wondering can someone explain this syntax getHeroes(): Hero[] { return HEROES; } Why it is the getHeroes() method : to the Hero array and then return Heroes
0debug
How use tm_yday in Qt : <p>I need get number of days since 1 January. But I dont know how to use tm_yday(how use this function)! Then i need convert it to Qstring.How can I do this? Please give code or example how to do this. Thank you.</p>
0debug
av_cold void ff_vp9_init_static(AVCodec *codec) { if ( vpx_codec_version_major() < 1 || (vpx_codec_version_major() == 1 && vpx_codec_version_minor() < 3)) codec->capabilities |= AV_CODEC_CAP_EXPERIMENTAL; codec->pix_fmts = vp9_pix_fmts_def; #if CONFIG_LIBVPX_VP9_ENCODER if ( vpx_codec_version_major() > 1 || (vpx_codec_version_major() == 1 && vpx_codec_version_minor() >= 4)) { #ifdef VPX_CODEC_CAP_HIGHBITDEPTH vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) codec->pix_fmts = vp9_pix_fmts_highbd; else #endif codec->pix_fmts = vp9_pix_fmts_highcol; } #endif }
1threat
static void gen_rfsvc(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_rfsvc(cpu_env); gen_sync_exception(ctx); #endif }
1threat
Differences between "Click Classes" and "Click Element" in Google Tag Manager : <p>I don't really understand the differences between "Click classes" and "Click Element" in Google Tag Manager. I don't understand the expected use of these event and I don't understand their respective behavior regarding "contains" and "CSS selector". </p> <p>Let's say I have <code>class="buttons primary small"</code>.</p> <p>What's working :</p> <pre><code>Click Element -&gt; Matches CSS selector -&gt; .buttons.small Click Classes -&gt; contains -&gt; small </code></pre> <p>What's not working </p> <pre><code>Click Element -&gt; contains -&gt; .buttons.small Click Classes -&gt; Matches CSS selector -&gt; small </code></pre> <p>if Click Classes is "an array of the classes on an object", What's really happen "under the hood" of GTM when doing this kind of manipulation ? </p> <p>It's not that I have a real issues, just trying to understand properly. </p>
0debug
Change Bootstrap 4 checkbox size : <p>Is there a way to change Bootstraps 4 beta checkbox size to a bigger one?</p> <p>I almost tried altering styles but this didn't work.</p> <p>Thanks!</p>
0debug
How to fetch data using post or get method using url in android : http://xid.e42.in/testMobile.php,i need to get value from using this URL.using web services
0debug
Cannot convert value of type Substring to expected argument type String - Swift 4 : <p>Trying to get substring of String and append it to array of Strings:</p> <pre><code>var stringToSplit = "TEST TEXT" var s = [String]() let subStr = anotherString[0 ..&lt; 6] s.append(subStr) // &lt;---- HERE I GET THE ERROR </code></pre> <p><a href="https://i.stack.imgur.com/9Ijkp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9Ijkp.png" alt="error desc"></a></p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
How to make this type degine any one Know That in adnroid : Design Like circle Show in Activity How to make this type of design or what to call it Please Suggest Me[enter image description here][1] [enter image description here][1] [1]: https://i.stack.imgur.com/VadV3.jpg
0debug
auto click button if style display is block : hello everyone i am totally new to this and i was just wondering is there away to auto click a button when style display is block? i would really appreciate if someone can point me in the right direction. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <div id="advert" img="" style="display: block;"> <div id="continueItems" class="text-center"> <p> TEXT HERE</p> </div> <br> <div class="text-center"> <button id="statsContinue" class="btn btn-primary text-center" data-itr="continue" onclick="closeStats();">Continue</button> </div> </div> <!-- end snippet -->
0debug
Why the function signature of thread constructor and bind in c++ is the same : <p>Recently, I am playing around with c++ multi-threading stuff, the signature of constructor of a thread is</p> <p>thread (Fn&amp;&amp; fn, Args&amp;&amp;... args)</p> <p>and the signature of c++ bind function is</p> <p>bind (Fn&amp;&amp; fn, Args&amp;&amp;... args);</p> <p>I don't think it is a coincident, but I cannot tell a concrete reason. Can anyone see the logic behind these two function? </p>
0debug
Suggestion based on user's search : <p>I have this problem: in my website the user writes in an input bar the name of an ArtWork. Then, usign the Google APIs, I give him the title, the image as well as other useful details.</p> <p>But on my website I've also uploaded e-books containing useful information to use during the search. My question is: is there a way that makes the system suggest the user the most useful e-books based on his search (for ex.: if I type in Andy Warhol, I would only like to see e-books that talk about Modern Art and not those that talk about Greek or Roman art).</p> <p>Thanks in advance for your help!</p>
0debug
Could not install package 'Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0 : <p>I'm attempting to use Net Core in my mvc application for security policies. Articles I've read said I need to install DependencyInjection which I'm doing through NuGet in VS 2017. I'm getting the following error:</p> <p>Could not install package 'Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. </p> <p>Is this version too new for .net 4.5.2? What version should I be using?</p>
0debug
Is it possible to require npm modules in a chrome extension ? : <p>I tried so but I have a 'require is not defined' error. I can't find information about that, can someone enlighten the noob in me please?</p>
0debug
Expected ')' to match this '(' when adding & to function prototype : I'm writing a recursive bst insert function and I recognized that I was modifying a copy of the struct. So I changed the prototype of the function from this: ```void BSTRecursiveInsert(BSTNode* tree, DataObject* elem)``` to this: ```void BSTRecursiveInsert(BSTNode*& tree, DataObject* elem)``` but I get the compiler error I wrote as question title. What am I missing?
0debug
Arduino project. USB+external power source - works fine. No USB - everything goes crazy : <p>I have this circuit:</p> <p><a href="https://i.stack.imgur.com/JOhiC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JOhiC.jpg" alt="enter image description here"></a></p> <p>It is a simple project - a focus system for a taken lens and anamorphic adaptor. I have three pots. The first one I use as a manipulator. The second is used to get the position of the continuous rotation servo (JX DC6015 Mod) - motor#1. The third pot is used to control the position of the other continuous rotation servo (JX DC6015 Mod) - motor#2. There are also some buttons and diodes for calibration purposes. Motor#1 rotates the taken lens and motor#2 rotates the adaptor. </p> <p>Well, let's look at the circuit. I also have there a 1N4007 diode and a 47uF cap. I use this scheme because the circuit even didn't turned on when I tried to power it from a battery. Now at least it turns on. But let's leave it aside for a moment. </p> <p>The main problem is that everything works perfect when I use an external AC-DC adaptor (or battery) with Nano's USB connected to my laptop. As soon as I unplug the USB cable the system goes crazy. In case it is connected to the AC-DC adaptor it just starts rotating servos several turns CW and then backwards. In case it is powered just with a battery the servos just rotates CCW or CW very fast and never stop. </p> <p>It looks for me like I have a GND loop problem. I tried to decouple my pots by adding 3 caps for each pot connecting a signal pin with GND, but things went even worse. It didn't work even with USB connected to Arduino. Servos rotated CW and CCW changing the direction very fast.</p> <p>I tried two other Arduino controllers, but it was all the same. </p> <p>I've tested all the GNDs. They are all connected together.</p> <p>Then I decided to try to isolate VCC and GND from servo putting NME0505SC between power source and Arduino. But it didn't help as well. </p>
0debug
Read CSV items with column name : <p>When reading a CSV, instead of skipping first line (header), and reading row items by number:</p> <pre><code>with open('info.csv') as f: reader = csv.reader(f, delimiter=';') next(reader, None) for row in reader: name = row[0] blah = row[1] </code></pre> <p>is there a built-in way to access row items by making use of header name? Something like:</p> <pre><code>with open('info.csv') as f: reader = csv.reader(f, delimiter=';', useheader=True) for row in reader: name = row['name'] blah = row['blah'] </code></pre> <p>where <code>info.csv</code> has a header line:</p> <blockquote> <p>name;blah<br> John;Hello2<br> Mike;Hello2 </p> </blockquote>
0debug
static void arm1026_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); cpu->dtb_compatible = "arm,arm1026"; set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_AUXCR); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); cpu->midr = 0x4106a262; cpu->reset_fpsid = 0x410110a0; cpu->ctr = 0x1dd20d2; cpu->reset_sctlr = 0x00090078; cpu->reset_auxcr = 1; { ARMCPRegInfo ifar = { .name = "IFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[1]), .resetvalue = 0 }; define_one_arm_cp_reg(cpu, &ifar); } }
1threat
Unit test with moment.js : <p>I'm new to writing unit tests and need some help testing part of a function.</p> <p>My function looks like this...</p> <pre><code>getData() { return this.parameters.map(p =&gt; { return { name: p.name, items: p.items.map(item =&gt; { const toTime = item.hasOwnProperty('end') ? moment.utc(item.end._d).unix() : null; const fromTime = item.hasOwnProperty('start') ? moment.utc(item.start._d).unix() : null; return { id: item.id, fromTime: fromTime, toTime: toTime, }; }), }; }); } </code></pre> <p>and so far my test looks like this (jasmine)</p> <pre><code>describe('getData()', function() { it('should return json data', function() { $ctrl.parameters = [{ name: 'test', items: [{ id: 1, fromTime: null, toTime: null }, { id: 13, fromTime: null, toTime: null }] }]; expect($ctrl.getData()).toEqual([{ name: 'test', items: [{ id: 1, fromTime: null, toTime: null }, { id: 13, fromTime: null, toTime: null }] }]); }); }); </code></pre> <p>This test is working/passing, but as you can see I am not testing the ternary if/else that uses Moment.js. Basically what the ternary does is check if items contains a property called <code>start</code> / <code>end</code> and if it does, convert that value to a epoch/unix timestamp and assign it to either <code>toTime</code> or <code>fromTime</code>. So if items had a property called end with a value of <code>'Sat Oct 31 2015 00:00:00 GMT+0000 (GMT)'</code>, then it would be converted to <code>'1446249600'</code> and assigned to <code>toTime</code> </p> <p>Hopefully that explains it! I'm not sure how to write a test for it and would appreciate any help/suggestions. </p>
0debug
Get Index of last value that matches a condition in an array ruby : So i have the following array ["Pending Verification", "Pending Verification", nil, nil] I want to be able to get the last index that matched the value nil. So meaning my index value should be 3 or in this scenario [nil, "Pending Verification", nil, "Bla"] it should be 2 How can i do this in ruby?
0debug
Error when accessing Sas url through javaServer failed to authenticate the request : I am getting error saying that Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature I want to access my blob and download a particular file to local i am stuck in first step only. i tried to get the Blob containers to SAS url with account name and key it can access and through desktop application i am able to access and download file, But though code i can't. CloudBlobContainer container = new CloudBlobContainer(new URI(uri)); ArrayList<ListBlobItem> items= (ArrayList<ListBlobItem>) container.listBlobs();
0debug
How to do an if-else comparison on enums with arguments : <p><strong>Language</strong>: Swift2.3</p> <p>For example let's I'll show you different kinds of enums</p> <pre><code>enum Normal { case one case two, three } enum NormalRaw: Int { case one case two, three } enum NormalArg { case one(Int) case two, three } </code></pre> <p><code>Switch</code> can be used on all three enums like so:</p> <pre><code>var normal: Normal = .one var normalRaw: NormalRaw = .one var normalArg: NormalArg = .one(1) switch normal { case .one: print("1") default: break } switch normalRaw { case .one: print(normalRaw.rawValue) default: break } switch normalArg { case .one(let value): print(value) default: break } </code></pre> <p>On the if-else statement though I can only do comparison for <code>Normal</code> and <code>NormalRaw</code>, and an error message shows for <code>NormalArg</code>, so I can't run the code</p> <blockquote> <p>Binary Operator '==' cannot be applied to operands of type <code>NormalArg</code> and <code>_</code></p> </blockquote> <p>Here's the code example:</p> <pre><code>if normal == .two { // no issue .. do something } if normalRaw == .two { // no issue .. do something } if normalArg == .two { // error here (the above message) .. do something } if normalArg == .one(_) { // error here (the above message) .. do something } if normalArg == .three { // error here (the above message) .. do something } </code></pre> <p>Any Ideas? I'm not really doing anything with this code, I'm just wondering as to why we can't do comparison.</p>
0debug
How to define constant string in Swagger open api 3.0 : <p>How to define constant string variable in swagger open api 3.0 ? If I define enum it would be like as follows</p> <pre><code>"StatusCode": { "title": "StatusCode", "enum": [ "success", "fail" ], "type": "string" } </code></pre> <p>But enums can be list of values, Is there any way to define string constant in swagger open api 3.0</p> <p>code can be executed form the <a href="http://editor.swagger.io/" rel="noreferrer">http://editor.swagger.io/</a></p>
0debug
J unit testing failing when using picocli : test wont run correctly trying to run a junit test- errors Please be kind fairly new to both java and picocli package picocli; import java.io.Serializable; import picocli.CommandLine.Option; public class ComparatorRunnerConfig implements Serializable{ /** The output path. */ @Option(names = {"-o", "--output-parquet"}, required = false, description = "define output parquet path") private String outputParquetPath; public String getOutputParquetPath() { return outputParquetPath; } @Option(names = {"-ic", "ingestorPath"}, required = false, description = "define ingestor path") private String ingestorPath; public String getingestorPath() { return ingestorPath; } @Option(names = {"-if", "--inputfile"}, required = false, description = "define input-file") private String inputFile; public String getinputFile() { return inputFile; } @Option(names = {"-rc", "--report-class"}, required = false, description = "define report") private String report; public String getReport() { return report; } @Option(names = {"-of", "--output-file"}, required = false, description = "define outputfile") private String outputFile; public String getoutputFile() { return outputFile; } //Using the config in a main method: public static void main(String[] args) { ComparatorRunnerConfig config = new ComparatorRunnerConfig(); new CommandLine(config).parse(args); } } MY JUNIT TEST package picocli; import static org.junit.Assert.*; import org.junit.Test; public class ConfigurationTest { @Test public void testBasicConfigOptions() { String args = "-rc BlahBlah"; ComparatorRunnerConfig mfc = new ComparatorRunnerConfig(); new CommandLine( mfc ).parse(args); String myTestValue = mfc.getReport(); assertEquals("I expected the ComparatorRunnerConfig to have the value getReport but got: "+myTestValue, myTestValue, "BlahBlah"); } } test fails
0debug
Does a javaScript file always have to be named main.js when using it for website? : <p>I am making a website for a school project. I am currently linking my sign up page to send information to my firebase database (it works so far). But I was wondering if I could have multiple .js files for the same website in the same folder. I started out with a "main.js" file, linked it to my signUp.html. Then, I thought it would be good to maybe have at least 2 different .js files for this webiste. So I changed the name from main.js to signUp.js (I also made the ref change in the signUp.html), but my page stopped working until I changed everything back to main.js. </p>
0debug
Hi, I am new to this and I didn't see any answers that work. I want to do a jQuery dropdown menu with click function. Please help and thanks : <div class="navMenu"> <ul> <li><a href="#">Home</a> <ul> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> <li><a href="#">Link 4</a></li> </ul></li> //above is html and below is jQuery $(document).ready(function(){ $(".navMenu ul li").click(function() { $(this).find('li ul.child').fadeToggle(400); }); }); *targeting the navMenu class clicking on ul li* *then I want it to find li ul.child where links are located.*
0debug
How do I make a <div> stay on the bottom of the screen unless there is overflow? : <p>I want my website to have a that is used as a footer, but I want it to stay at the bottom of the page, but when I add content to the website, I want the to go down with the overflow. Is there a way to do that? </p>
0debug
bool write_list_to_cpustate(ARMCPU *cpu) { int i; bool ok = true; for (i = 0; i < cpu->cpreg_array_len; i++) { uint32_t regidx = kvm_to_cpreg_id(cpu->cpreg_indexes[i]); uint64_t v = cpu->cpreg_values[i]; const ARMCPRegInfo *ri; ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); if (!ri) { ok = false; continue; } if (ri->type & ARM_CP_NO_MIGRATE) { continue; } write_raw_cp_reg(&cpu->env, ri, v); if (read_raw_cp_reg(&cpu->env, ri) != v) { ok = false; } } return ok; }
1threat
C++ Console - New lat/lon coordinate using azimuth and range : <p>I would like assistance understanding this code I found during a search. I have been stuck for 2 weeks trying to get it and it's holding my project back. I am honestly trying to learn as I go and not just be a script kiddie about it, but this is much more complicated than the rest of my project even though I am trying. (I just learned about <strong>auto</strong> today while trying to understand this code, for example.)</p> <p>I am working on a weather app and I know the lat/lon of the radar site. I need the lat/lon of a feature the radar has detected based off of the azimuth/range that the radar tells me (example, 271 degrees and 7 nautical miles). I need to understand how I can use this code below to convert the azimuth/range to a new lat lon coordinate. I don't require the other functions, just to be able to put my variables (starting coords, azimuth and range) and get a result. The code below looks to do much more than that, and it is confusing me.</p> <p>I see the following code near the end :</p> <pre><code>auto coordinate = CoordinateToCoordinate(latitude1, longitude1, angle, meters); </code></pre> <p>... Which looks to be the part I would need out of this. I see how it's calculating it but once I dig deeper I just get myself confused. I have tried hacking at the code so much that I gave up and don't even have any examples.</p> <p>I would like to be able to set my variables manually (example cin>>) and have the lat and lon output into a variable that I can save to a text file. I am able to do everything myself (ingesting the starting variables and writing the result to a text file) except the actual conversion itself.</p> <p>How could I get started with this using the code below? </p> <p>My example variables are :</p> <pre><code>Original Latitude = 29.4214 Original Longitude = -98.0142 Azimuth from Origin = 271 degrees Range from Origin = 6 nautical miles (I can convert to meters if needed, in this case it's 11112 meters) </code></pre> <p>The actual unedited code is below and <a href="https://ideone.com/9yuONO" rel="nofollow noreferrer"> a copy at this link.</a> If I get help with this I won't just copy/paste and I will come back with the completed code after I make it. I really am wanting to understand as I go, so I can be better with these advanced topics and not be constrained in the future. Code below :</p> <pre><code>#include&lt;iostream&gt; #include&lt;iomanip&gt; #include&lt;cmath&gt; // Source: // http://w...content-available-to-author-only...o.uk/scripts/latlong.html static const double PI = 3.14159265358979323846, earthDiameterMeters = 6371.0 * 2 * 1000; double degreeToRadian (const double degree) { return (degree * PI / 180); }; double radianToDegree (const double radian) { return (radian * 180 / PI); }; double CoordinatesToAngle (double latitude1, const double longitude1, double latitude2, const double longitude2) { const auto longitudeDifference = degreeToRadian(longitude2 - longitude1); latitude1 = degreeToRadian(latitude1); latitude2 = degreeToRadian(latitude2); using namespace std; const auto x = (cos(latitude1) * sin(latitude2)) - (sin(latitude1) * cos(latitude2) * cos(longitudeDifference)); const auto y = sin(longitudeDifference) * cos(latitude2); const auto degree = radianToDegree(atan2(y, x)); return (degree &gt;= 0)? degree : (degree + 360); } double CoordinatesToMeters (double latitude1, double longitude1, double latitude2, double longitude2) { latitude1 = degreeToRadian(latitude1); longitude1 = degreeToRadian(longitude1); latitude2 = degreeToRadian(latitude2); longitude2 = degreeToRadian(longitude2); using namespace std; auto x = sin((latitude2 - latitude1) / 2), y = sin((longitude2 - longitude1) / 2); #if 1 return earthDiameterMeters * asin(sqrt((x * x) + (cos(latitude1) * cos(latitude2) * y * y))); #else auto value = (x * x) + (cos(latitude1) * cos(latitude2) * y * y); return earthDiameterMeters * atan2(sqrt(value), sqrt(1 - value)); #endif } std::pair&lt;double,double&gt; CoordinateToCoordinate (double latitude, double longitude, double angle, double meters) { latitude = degreeToRadian(latitude); longitude = degreeToRadian(longitude); angle = degreeToRadian(angle); meters *= 2 / earthDiameterMeters; using namespace std; pair&lt;double,double&gt; coordinate; coordinate.first = asin((sin(latitude) * cos(meters)) + (cos(latitude) * sin(meters) * cos(angle))); coordinate.second = longitude + atan2((sin(angle) * sin(meters) * cos(latitude)), cos(meters) - (sin(latitude) * sin(coordinate.first))); coordinate.first = radianToDegree(coordinate.first); coordinate.second = radianToDegree(coordinate.second); return coordinate; } int main () { using namespace std; const auto latitude1 = 12.968460, longitude1 = 77.641308, latitude2 = 12.967862, longitude2 = 77.653130; cout &lt;&lt; std::setprecision(10); cout &lt;&lt; "(" &lt;&lt; latitude1 &lt;&lt; "," &lt;&lt; longitude1 &lt;&lt; ") --- " "(" &lt;&lt; latitude2 &lt;&lt; "," &lt;&lt; longitude2 &lt;&lt; ")\n"; auto angle = CoordinatesToAngle(latitude1, longitude1, latitude2, longitude2); cout &lt;&lt; "Angle = " &lt;&lt; angle &lt;&lt; endl; auto meters = CoordinatesToMeters(latitude1, longitude1, latitude2, longitude2); cout &lt;&lt; "Meters = " &lt;&lt; meters &lt;&lt; endl; auto coordinate = CoordinateToCoordinate(latitude1, longitude1, angle, meters); cout &lt;&lt; "Destination = (" &lt;&lt; coordinate.first &lt;&lt; "," &lt;&lt; coordinate.second &lt;&lt; ")\n"; } </code></pre>
0debug
static int update_error_limit(WavpackFrameContext *ctx) { int i, br[2], sl[2]; for (i = 0; i <= ctx->stereo_in; i++) { if (ctx->ch[i].bitrate_acc > UINT_MAX - ctx->ch[i].bitrate_delta) return AVERROR_INVALIDDATA; ctx->ch[i].bitrate_acc += ctx->ch[i].bitrate_delta; br[i] = ctx->ch[i].bitrate_acc >> 16; sl[i] = LEVEL_DECAY(ctx->ch[i].slow_level); } if (ctx->stereo_in && ctx->hybrid_bitrate) { int balance = (sl[1] - sl[0] + br[1] + 1) >> 1; if (balance > br[0]) { br[1] = br[0] << 1; br[0] = 0; } else if (-balance > br[0]) { br[0] <<= 1; br[1] = 0; } else { br[1] = br[0] + balance; br[0] = br[0] - balance; } } for (i = 0; i <= ctx->stereo_in; i++) { if (ctx->hybrid_bitrate) { if (sl[i] - br[i] > -0x100) ctx->ch[i].error_limit = wp_exp2(sl[i] - br[i] + 0x100); else ctx->ch[i].error_limit = 0; } else { ctx->ch[i].error_limit = wp_exp2(br[i]); } } return 0; }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
create instance of class inside namespace : is a better way to implement this code ? int getBlockVector(vector<unsigned char>& vect, const int pos, const int length) { int destinyInt = 0; switch (length) { case 1 : destinyInt = (0x00 << 24) | (0x00 << 16) | (0x00 << 8) | vecct.at(pos); break; case 2 : destinyInt = (0x00 << 24) | (0x00 << 16) | (vect.at(pos + 1) << 8) | vect.at(pos); break; case 3 : destinyInt = (0x00 << 24) | (vect.at(pos + 2) << 16) | (vect.at(pos + 1) << 8) | vect.at(pos); break; case 4 : destinyInt = (vect.at(pos + 3) << 24) | (vect.at(pos + 2) << 16) | (vect.at(pos + 1) << 8) | vect.at(pos); break; default : destinyInt = -1; return destinyInt;} considering the ugly default value. How implement this function with iterators and template for vector, deque, queue, etc. Note: the bounds are checked before.
0debug
How add include path to make(linux)? : I tried to add paths using `export PATH=<myPath>`   `export CPPFLAGS='-I<myPath>'` The <br> I tried to run make using the `make -I=<myPath>` <br> But make still does not see hpp files.
0debug
How to Fix output in python : how to fix this Expected output: 1 - that 2 - is 3 - weird list = ['that', 'is', 'weird'] for i, k in range(list): print str(i) + ' - ' + k
0debug
Returning values in Elixir? : <p>I've recently decided to learn Elixir. Coming from a C++/Java/JavaScript background I've been having a lot of trouble grasping the basics. This might sound stupid but how would return statements work in Elixir? I've looked around and it seems as though it's just the last line of a function i.e.</p> <pre><code>def Hello do "Hello World!" end </code></pre> <p>Would this function return "Hello World!", is there another way to do a return? Also, how would you return early? in JavaScript we could write something like this to find if an array has a certain value in it:</p> <pre><code>function foo(a){ for(var i = 0;i&lt;a.length;i++){ if(a[i] == "22"){ return true; } } return false; } </code></pre> <p>How would that work in Elixir?</p>
0debug
Its my first time here! using a friends script, Its returning PHP Warning: Illegal string offset 'error' : I a using a friends script in winSCP using putty and when i do 'create' in the script, it returns this error. I REALLY need help with this please, my friend is away for a week. it directs me to 'line 86' in the php file. I have went ahead and copy and pasted the other lines surrounding line 86 to give a better idea. ERROR FACED: PHP Warning: Illegal string offset 'error' in /root/100tb/includes/100tb.php on line 86 Line 86 is- $errorMessage = (isset($result['data']['error']['message']))? $result['data']['error']['message'] : $result['data']['error']; All help appreciated. } } curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($handle); if (isset($response[0])) { if ($response[0] == '[' || $response[0] == '{') { $response = json_decode($response, TRUE); } } $result = array( 'data' => $response, 'info' => curl_getinfo($handle), ); curl_close($handle); if ($result['info']['http_code'] !== 200) { $errorMessage = (isset($result['data']['error']['message']))? $result['data']['error']['message'] : $result['data']['error']; throw new Exception($errorMessage,$result['info']['http_code']); } return $result['data']; }
0debug
How to connect an office addin to a server? : It seems that most of office addins don't have a server or a database. But it seems that some addins do have a server behind. I have built websites by `mean-stack`. And we can indeed use `angularjs` to build front-end of an office addin. Does anyone know how to connect the front-end of an office addin to a (mongo + express + node) server? Is there any tutorial?
0debug
How to post this type of Json data using Volley : <p>I am using <a href="/questions/tagged/volley" class="post-tag" title="show questions tagged &#39;volley&#39;" rel="tag">volley</a> to post <a href="/questions/tagged/json" class="post-tag" title="show questions tagged &#39;json&#39;" rel="tag">json</a> data to server.The data is in this form. </p> <pre><code>{ "count": 1, "next": null, "previous": null, "results": [ { "user": { "first_name": "abc", "last_name": "xyz", "username": "abc@gmail.com", "email": "abc@gmail.com", "groups": [], "is_active": true }, "phone": "1234567890", "address": "address" } ] } </code></pre> <p>How to post this data using Volley ?</p>
0debug
What are the possible values that can be given to `@Suppress` in Kotlin? : <p>The Kotlin compiler gave me the following warning:</p> <blockquote> <p>Warning:(399, 1) Kotlin: Expected performance impact of inlining '...' can be insignificant. Inlining works best for functions with lambda parameters </p> </blockquote> <p>In this case I would like to suppress this warning. I don't know what value to give to <code>@Suppress</code>, however, and I can't find any documentation for what values <code>@Suppress</code> accepts.</p> <p>What are the possible values that can be given to <code>@Suppress</code>, and what do they mean?</p>
0debug
How can I negate this express : *I have absolutely no clue how to work with regex's. I am less than a beginner.* I want to find any invalid css names from a string, so I can exclude them. Looking online I found a way to select the valid names. What I can't do is negate this expression: https://regexr.com/3ik89 Seems like everything I try just breaks it.
0debug