problem
stringlengths
26
131k
labels
class label
2 classes
i have an arraylist and i want to pass it to another classes to check availability and it's expired dates what are the methods ?? : public Boolean Checkup (Product[]x, String code ) { if (Product.contains(true)) { \\ why it is error System.out.println("Product is availible"); } else { System.out.println("Product is not availible"); } }
0debug
av_cold int ff_mss12_decode_init(MSS12Context *c, int version, SliceContext* sc1, SliceContext *sc2) { AVCodecContext *avctx = c->avctx; int i; if (avctx->extradata_size < 52 + 256 * 3) { av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d\n", avctx->extradata_size); if (AV_RB32(avctx->extradata) < avctx->extradata_size) { av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size: expected %d got %d\n", AV_RB32(avctx->extradata), avctx->extradata_size); avctx->coded_width = AV_RB32(avctx->extradata + 20); avctx->coded_height = AV_RB32(avctx->extradata + 24); if (avctx->coded_width > 4096 || avctx->coded_height > 4096) { av_log(avctx, AV_LOG_ERROR, "Frame dimensions %dx%d too large", av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d\n", AV_RB32(avctx->extradata + 4), AV_RB32(avctx->extradata + 8)); if (version != AV_RB32(avctx->extradata + 4) > 1) { av_log(avctx, AV_LOG_ERROR, "Header version doesn't match codec tag\n"); return -1; c->free_colours = AV_RB32(avctx->extradata + 48); if ((unsigned)c->free_colours > 256) { av_log(avctx, AV_LOG_ERROR, "Incorrect number of changeable palette entries: %d\n", c->free_colours); av_log(avctx, AV_LOG_DEBUG, "%d free colour(s)\n", c->free_colours); av_log(avctx, AV_LOG_DEBUG, "Display dimensions %dx%d\n", AV_RB32(avctx->extradata + 12), AV_RB32(avctx->extradata + 16)); av_log(avctx, AV_LOG_DEBUG, "Coded dimensions %dx%d\n", av_log(avctx, AV_LOG_DEBUG, "%g frames per second\n", av_int2float(AV_RB32(avctx->extradata + 28))); av_log(avctx, AV_LOG_DEBUG, "Bitrate %d bps\n", AV_RB32(avctx->extradata + 32)); av_log(avctx, AV_LOG_DEBUG, "Max. lead time %g ms\n", av_int2float(AV_RB32(avctx->extradata + 36))); av_log(avctx, AV_LOG_DEBUG, "Max. lag time %g ms\n", av_int2float(AV_RB32(avctx->extradata + 40))); av_log(avctx, AV_LOG_DEBUG, "Max. seek time %g ms\n", av_int2float(AV_RB32(avctx->extradata + 44))); if (version) { if (avctx->extradata_size < 60 + 256 * 3) { av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d for v2\n", avctx->extradata_size); c->slice_split = AV_RB32(avctx->extradata + 52); av_log(avctx, AV_LOG_DEBUG, "Slice split %d\n", c->slice_split); c->full_model_syms = AV_RB32(avctx->extradata + 56); if (c->full_model_syms < 2 || c->full_model_syms > 256) { av_log(avctx, AV_LOG_ERROR, "Incorrect number of used colours %d\n", c->full_model_syms); av_log(avctx, AV_LOG_DEBUG, "Used colours %d\n", c->full_model_syms); } else { c->slice_split = 0; c->full_model_syms = 256; for (i = 0; i < 256; i++) c->pal[i] = 0xFFU << 24 | AV_RB24(avctx->extradata + 52 + (version ? 8 : 0) + i * 3); c->mask_stride = FFALIGN(avctx->width, 16); c->mask = av_malloc(c->mask_stride * avctx->height); if (!c->mask) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate mask plane\n"); return AVERROR(ENOMEM); sc1->c = c; slicecontext_init(sc1, version, c->full_model_syms); if (c->slice_split) { sc2->c = c; slicecontext_init(sc2, version, c->full_model_syms); c->corrupted = 1; return 0;
1threat
Short horizontal line in front of the text : <p>I've ready many posts about creating a horizontal line before and after header, but all the examples are not totally what i want to have and I cannot change them to what I would like to have.</p> <p>Basically I need a SHORT (25px) horizontal line in front of the Header.</p> <p>See image: <a href="https://i.stack.imgur.com/MCgA1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MCgA1.jpg" alt="enter image description here"></a></p> <p>Maybe it is not possible to do with css ... how to do it better then?</p> <p>Any assistance would be welcome.</p> <p>Thanks in advance</p>
0debug
static void pc_q35_init(MachineState *machine) { PCMachineState *pcms = PC_MACHINE(machine); Q35PCIHost *q35_host; PCIHostState *phb; PCIBus *host_bus; PCIDevice *lpc; BusState *idebus[MAX_SATA_PORTS]; ISADevice *rtc_state; MemoryRegion *pci_memory; MemoryRegion *rom_memory; MemoryRegion *ram_memory; GSIState *gsi_state; ISABus *isa_bus; int pci_enabled = 1; qemu_irq *gsi; qemu_irq *i8259; int i; ICH9LPCState *ich9_lpc; PCIDevice *ahci; DeviceState *icc_bridge; PcGuestInfo *guest_info; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; MachineClass *mc = MACHINE_GET_CLASS(machine); if (machine->ram_size >= 0xb0000000) { lowmem = gigabyte_align ? 0x80000000 : 0xb0000000; } else { lowmem = 0xb0000000; } if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pcms->max_ram_below_4g); } } if (machine->ram_size >= lowmem) { pcms->above_4g_mem_size = machine->ram_size - lowmem; pcms->below_4g_mem_size = lowmem; } else { pcms->above_4g_mem_size = 0; pcms->below_4g_mem_size = machine->ram_size; } if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(machine->cpu_model, icc_bridge); pc_acpi_init("q35-acpi-dsdt.aml"); kvmclock_create(); if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = get_system_memory(); } guest_info = pc_guest_info_init(pcms); guest_info->isapc_ram_fw = false; guest_info->has_acpi_build = has_acpi_build; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; guest_info->legacy_acpi_table_size = 0; if (smbios_defaults) { smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", mc->name, smbios_legacy_mode, smbios_uuid_encoded, SMBIOS_ENTRY_POINT_21); } if (!xen_enabled()) { pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE)); object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL); q35_host->mch.ram_memory = ram_memory; q35_host->mch.pci_address_space = pci_memory; q35_host->mch.system_memory = get_system_memory(); q35_host->mch.address_space_io = get_system_io(); q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size; q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size; q35_host->mch.guest_info = guest_info; qdev_init_nofail(DEVICE(q35_host)); phb = PCI_HOST_BRIDGE(q35_host); host_bus = phb->bus; lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC), true, TYPE_ICH9_LPC_DEVICE); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pcms->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(lpc), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); ich9_lpc = ICH9_LPC_DEVICE(lpc); ich9_lpc->pic = gsi; ich9_lpc->ioapic = gsi_state->ioapic_irq; pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc, ICH9_LPC_NB_PIRQS); pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq); isa_bus = ich9_lpc->isa_bus; isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "q35"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); assert(pcms->vmport != ON_OFF_AUTO_MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy, (pcms->vmport != ON_OFF_AUTO_ON), 0xff0104); ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms), !mc->no_tco); ahci = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_SATA1_DEV, ICH9_SATA1_FUNC), true, "ich9-ahci"); idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); g_assert(MAX_SATA_PORTS == ICH_AHCI(ahci)->ahci.ports); ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports); ahci_ide_create_devs(ahci, hd); if (usb_enabled()) { ehci_create_ich9_with_companions(host_bus, 0x1d); } smbus_eeprom_init(ich9_smb_init(host_bus, PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 0xb100), 8, NULL, 0); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); pc_vga_init(isa_bus, host_bus); pc_nic_init(isa_bus, host_bus); if (pci_enabled) { pc_pci_device_init(host_bus); } }
1threat
PostGreSQL storage facilities... questions : Did PostGreSQL 9.6 have direct storage facilities like Oracle ou Microsoft SQL Server to deal with : 1) read-only storage ? 2) compressed storage ? 3) limited storage ? 4) planned capacity storage ? 5) verifying physical data integrity ? (eg : values for datatypes) 6) verifying logical data integrity ? (constraints) Thanks
0debug
Java: Is there a way to know if an inputStream is a readonly file : <p>We encounter errors because we update a read only file. Currently I have a method that soft deletes a file. This method has a parameter DataHandler which has a field that contains an input stream. Would like to ask for some suggestions if there is a way to determine if dataHandler.getInputStream is a ready only. Writing the stream in a file on hard disk is not an option either</p>
0debug
How to auto reload apps : <p>I'm just wondering how do apps like Facebook and Twitter automatically reload. For instance, if you get a message or a notification, you haven't requested it yourself. Is there a timer of sorts, or is there a smarter implementation?</p> <p>Thanks in advance.</p>
0debug
Cell color in excel : <p>I have a table in excel with data. I want that as soon as any data in any cell is updated the cell gets colored. As there is no condition (other than that the cell is updated) I am not able to do it using conditional formatting. This could be done through VBA. </p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){ MpegEncContext * const s = &h->s; unsigned int pps_id= get_ue_golomb(&s->gb); PPS *pps; const int qp_bd_offset = 6*(h->sps.bit_depth_luma-8); int bits_left; if(pps_id >= MAX_PPS_COUNT) { av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); return -1; } pps= av_mallocz(sizeof(PPS)); if(pps == NULL) return -1; pps->sps_id= get_ue_golomb_31(&s->gb); if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){ av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n"); goto fail; } pps->cabac= get_bits1(&s->gb); pps->pic_order_present= get_bits1(&s->gb); pps->slice_group_count= get_ue_golomb(&s->gb) + 1; if(pps->slice_group_count > 1 ){ pps->mb_slice_group_map_type= get_ue_golomb(&s->gb); av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n"); switch(pps->mb_slice_group_map_type){ case 0: #if 0 | for( i = 0; i <= num_slice_groups_minus1; i++ ) | | | | run_length[ i ] |1 |ue(v) | #endif break; case 2: #if 0 | for( i = 0; i < num_slice_groups_minus1; i++ ) | | | |{ | | | | top_left_mb[ i ] |1 |ue(v) | | bottom_right_mb[ i ] |1 |ue(v) | | } | | | #endif break; case 3: case 4: case 5: #if 0 | slice_group_change_direction_flag |1 |u(1) | | slice_group_change_rate_minus1 |1 |ue(v) | #endif break; case 6: #if 0 | slice_group_id_cnt_minus1 |1 |ue(v) | | for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | | |) | | | | slice_group_id[ i ] |1 |u(v) | #endif break; } } pps->ref_count[0]= get_ue_golomb(&s->gb) + 1; pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); goto fail; } pps->weighted_pred= get_bits1(&s->gb); pps->weighted_bipred_idc= get_bits(&s->gb, 2); pps->init_qp= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->init_qs= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb); pps->deblocking_filter_parameters_present= get_bits1(&s->gb); pps->constrained_intra_pred= get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb); pps->transform_8x8_mode= 0; h->dequant_coeff_pps= -1; memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4)); memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8)); bits_left = bit_length - get_bits_count(&s->gb); if (bits_left && (bits_left > 8 || show_bits(&s->gb, bits_left) != 1 << (bits_left - 1))) { pps->transform_8x8_mode= get_bits1(&s->gb); decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); } else { pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0]; } build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], h->sps.bit_depth_luma); build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], h->sps.bit_depth_luma); if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) pps->chroma_qp_diff= 1; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n", pps_id, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, pps->ref_count[0], pps->ref_count[1], pps->weighted_pred ? "weighted" : "", pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1], pps->deblocking_filter_parameters_present ? "LPAR" : "", pps->constrained_intra_pred ? "CONSTR" : "", pps->redundant_pic_cnt_present ? "REDU" : "", pps->transform_8x8_mode ? "8x8DCT" : "" ); } av_free(h->pps_buffers[pps_id]); h->pps_buffers[pps_id]= pps; return 0; fail: av_free(pps); return -1; }
1threat
The print of string constant is always attached with 'b' inTensorFlow : <p>Durng the test of TensorFlow r0.12(CPU) installed on Windows 10, I found that the printed string contant is always with an 'b' in the end. The print of python is normal. I cannot figure out the reason so came here for help. The code is as follows:</p> <pre><code>&gt;&gt;&gt;import tensorflow as tf &gt;&gt;&gt;hello = tf.constant('Hello, TensorFlow!') &gt;&gt;&gt;sess = tf.Session() &gt;&gt;&gt;print(sess.run(hello)) b'Hello, TensorFlow!' </code></pre>
0debug
Replacing whitespace in all column names in spark Dataframe : <p>I have spark dataframe with whitespaces in some of column names, which has to be replaced with underscore.</p> <p>I know a single column can be renamed using <code>withColumnRenamed()</code> in sparkSQL, but to rename 'n' number of columns, this function has to chained 'n' times (to my knowledge).</p> <p>To automate this, i have tried:</p> <pre><code>val old_names = df.columns() // contains array of old column names val new_names = old_names.map { x =&gt; if(x.contains(" ") == true) x.replaceAll("\\s","_") else x } // array of new column names with removed whitespace. </code></pre> <p>Now, how to replace df's header with <code>new_names</code></p>
0debug
Why HTML and CSS doesn't work : Currently I'm learning HTML and CSS on W3C-Schools and now I've stuck at [this][1] chapter. Beforehand I want to say that I'm learning it at my Samsung Galaxy Note 4 (with Android 5.1.1). I'm using the [AWD - IDE For Web dev][2], [Total Commander][3], [Samsung Internet Browser][4] and [Google Chrome][5]. My problem is, that I don't know why my HTML and CSS doesn't work. When I'm trying to define the CSS-Styling in a extern file ... [enter image description here][6] So there are two questions I have. **Where does the `ÁÁ` come from and why the HTML-Document is'nt designed as in CSS definded.** When I'm trying to define the CSS-Styling intern ... [enter image description here][7] Then the background just changes but the heading and the paragraph doesn't. The code that I'm used at my phone is a one-to-one copy from the chapter from W3C-Schools. I've also tried this with other Browsers and editors, but still doesn't work. I've also noticed that when I save the extern css-file in a own folder `css/styles.css` that I get the same result as the css-stylesheet intern. **But my final Question is: What's wrong with that?** Thanks in advance! tp://www.file-upload.net/download-11582495/SecWebpage.zip.html Here is the project folder from this problem. [1]: tp://www.w3schools.com/html/html_css.asp [2]: tps://play.google.com/store/apps/details?id=org.kidinov.awd&hl=en [3]: tps://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander&hl=en [4]: tps://play.google.com/store/apps/details?id=com.sec.android.app.sbrowser&hl=en [5]: tps://play.google.com/store/apps/details?id=com.android.chrome&hl=en [6]: http://i.stack.imgur.com/PpETh.jpg [7]: http://i.stack.imgur.com/9yFv2.jpg
0debug
Scale/Radius ratio issue : <p>I have a scale variable and a radius variable. When scale is a specific number, ratio needs to be a specific number. So far I know this..</p> <pre><code>Scale = 0.25 and Radius = 3.00 Scale = 0.50 and Radius = 1.50 Scale = 0.75 and Radius = 1.00 Scale = 1.00 and Radius = 0.75 </code></pre> <p>I need to find out what number the radius should be for 0.10, 0.15, 0.20, etc all the way to 1.0 and I can't figure out how. Does anyone have any ideas?</p>
0debug
intelliJ IDEA "Overrides method" warning with Java 8 lambda expressions : <p>I get a warning "Overrides method in java.util.function.Function" when using lambda expressions like <code>new Vector&lt;String&gt;().stream().map(String::toString);</code> but as far as I know this is just normal lambda usage. How can I get rid of this warning without removing legitimate override warnings?</p> <p>I use intelliJ IDEA 2016.1.3 with OpenJDK 8 on Gnome on Arch Linux.</p>
0debug
static void xics_kvm_realize(DeviceState *dev, Error **errp) { KVMXICSState *icpkvm = KVM_XICS(dev); XICSState *icp = XICS_COMMON(dev); int i, rc; Error *error = NULL; struct kvm_create_device xics_create_device = { .type = KVM_DEV_TYPE_XICS, .flags = 0, }; if (!kvm_enabled() || !kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)) { error_setg(errp, "KVM and IRQ_XICS capability must be present for in-kernel XICS"); goto fail; } icpkvm->set_xive_token = spapr_rtas_register("ibm,set-xive", rtas_dummy); icpkvm->get_xive_token = spapr_rtas_register("ibm,get-xive", rtas_dummy); icpkvm->int_off_token = spapr_rtas_register("ibm,int-off", rtas_dummy); icpkvm->int_on_token = spapr_rtas_register("ibm,int-on", rtas_dummy); rc = kvmppc_define_rtas_kernel_token(icpkvm->set_xive_token, "ibm,set-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,set-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(icpkvm->get_xive_token, "ibm,get-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,get-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(icpkvm->int_on_token, "ibm,int-on"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-on"); goto fail; } rc = kvmppc_define_rtas_kernel_token(icpkvm->int_off_token, "ibm,int-off"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-off"); goto fail; } rc = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &xics_create_device); if (rc < 0) { error_setg_errno(errp, -rc, "Error on KVM_CREATE_DEVICE for XICS"); goto fail; } icpkvm->kernel_xics_fd = xics_create_device.fd; object_property_set_bool(OBJECT(icp->ics), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } assert(icp->nr_servers); for (i = 0; i < icp->nr_servers; i++) { object_property_set_bool(OBJECT(&icp->ss[i]), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } } kvm_kernel_irqchip = true; kvm_irqfds_allowed = true; kvm_msi_via_irqfd_allowed = true; kvm_gsi_direct_mapping = true; return; fail: kvmppc_define_rtas_kernel_token(0, "ibm,set-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,get-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,int-on"); kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); }
1threat
How to validate Date of Birth in javascript with input[type="Date"]? : <p>I know there are a few questions out there on this topic, but they all are either unclear or, they are using <code>input[type="text"]</code> in them.</p> <p>In my HTML form I have an input of type date. So now I want to make sure that the date of birth is valid(Date is not in the future!). How do I do this?</p>
0debug
i want to display the vowel of every word if there is not any vowel in the word it just display there is not any vowel into the word : list = ["amita","aman","ishita","rythm"] k = 0 for str in list: print (str) for ch in str: if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u'): print(ch) else: print("there is not any vowel in the word") i want to display the vowel of every word. if there is not any vowel in the word it just display there is not any vowel into the word one time. but above code is displaying there is not any vowel again and again for the last name in the list for the last name rythm.
0debug
Calculating length of 95%-CI using dplyr : <p>Last time I asked how it was possible to calculate the average score per measurement occasion (week) for a variable (procras) that has been measured repeatedly for multiple respondents. So my (simplified) dataset in long format looks for example like the following (here two students, and 5 time points, no grouping variable):</p> <pre><code>studentID week procras 1 0 1.4 1 6 1.2 1 16 1.6 1 28 NA 1 40 3.8 2 0 1.4 2 6 1.8 2 16 2.0 2 28 2.5 2 40 2.8 </code></pre> <p>Using dplyr I would get the average score per measurement occasion</p> <pre><code>mean_data &lt;- group_by(DataRlong, week)%&gt;% summarise(procras = mean(procras, na.rm = TRUE)) </code></pre> <p>Looking like this e.g.:</p> <pre><code>Source: local data frame [5 x 2] occ procras (dbl) (dbl) 1 0 1.993141 2 6 2.124020 3 16 2.251548 4 28 2.469658 5 40 2.617903 </code></pre> <p>With ggplot2 I could now plot the average change over time, and by easily adjusting the group_data() of dplyr I could also get means per sub groups (for instance, the average score per occasion for men and women). Now I would like to add a column to the mean_data table which includes the length for the 95%-CIs around the average score per occasion.</p> <p><a href="http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/" rel="noreferrer">http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/</a> explains how to get and plot CIs, but this approach seems to become problematic as soon as I wanted to do this for any subgroup, right? So is there a way to let dplyr also include the CI (based on group size, ect.) automatically in the mean_data? After that it should be fairly easy to plot the new values as CIs into the graphs I hope. Thank you.</p>
0debug
ImgReSampleContext *img_resample_full_init(int owidth, int oheight, int iwidth, int iheight, int topBand, int bottomBand, int leftBand, int rightBand, int padtop, int padbottom, int padleft, int padright) { ImgReSampleContext *s; s = av_mallocz(sizeof(ImgReSampleContext)); if (!s) if((unsigned)owidth >= UINT_MAX / (LINE_BUF_HEIGHT + NB_TAPS)) s->line_buf = av_mallocz(owidth * (LINE_BUF_HEIGHT + NB_TAPS)); if (!s->line_buf) goto fail; s->owidth = owidth; s->oheight = oheight; s->iwidth = iwidth; s->iheight = iheight; s->topBand = topBand; s->bottomBand = bottomBand; s->leftBand = leftBand; s->rightBand = rightBand; s->padtop = padtop; s->padbottom = padbottom; s->padleft = padleft; s->padright = padright; s->pad_owidth = owidth - (padleft + padright); s->pad_oheight = oheight - (padtop + padbottom); s->h_incr = ((iwidth - leftBand - rightBand) * POS_FRAC) / s->pad_owidth; s->v_incr = ((iheight - topBand - bottomBand) * POS_FRAC) / s->pad_oheight; av_build_filter(&s->h_filters[0][0], (float) s->pad_owidth / (float) (iwidth - leftBand - rightBand), NB_TAPS, NB_PHASES, 1<<FILTER_BITS, 0); av_build_filter(&s->v_filters[0][0], (float) s->pad_oheight / (float) (iheight - topBand - bottomBand), NB_TAPS, NB_PHASES, 1<<FILTER_BITS, 0); return s; fail: av_free(s); }
1threat
Destructing in javascript : I have the following code let obj={ n:1, j:'test' }; obj[j] = 'new val' ; let { j } = obj; alert(j);//'test' Why is the output still old value.
0debug
i cant access other pages of site before the upload complete : When iam tried to upload a file via php copy() or ftp put. The page is loading to execute. then i cant access other pages of site before the upload cmplt. the page is only open after thr upload cmplt. i can open same pages in other browser.. please help me to how to fix this
0debug
Configuration Linux Kernel : <p>I need to compile kernel linux 3.4.4. I use "make menuconfig" to have a user-friendly interface to choose configuration.</p> <p>I haven't understood an aspect of the kernel configuration: what is the difference between i choose to include an option during the configuration and i choose to include, as a module, an option during the configuration?</p> <p>Thanks</p>
0debug
vreader_list_delete(VReaderList *list) { VReaderListEntry *current_entry; VReaderListEntry *next_entry = NULL; for (current_entry = vreader_list_get_first(list); current_entry; current_entry = next_entry) { next_entry = vreader_list_get_next(current_entry); vreader_list_entry_delete(current_entry); } list->head = NULL; list->tail = NULL; g_free(list); }
1threat
Value of float is different from what was scanned : <p>So I have this program in which I need to compare values in 0.0X range and if I scan for example 50.21 with this little thing</p> <pre><code>scanf("%f",bill); </code></pre> <p>the value stored in var. bill is actually 50.2099990845... which messes up calculations later in program. Is there any way to turn this number into 50.210000? Thanks for your time. </p>
0debug
Could not find or load main class Runnner java (Atom) : <p>I m getting error in loading my class Here is The image <a href="https://i.stack.imgur.com/pKNQ6.png" rel="nofollow noreferrer">error here</a></p>
0debug
I want to change the name of each file,but always wrong! Next is code? : importos def rename_files(): file_list=os.listdir(r"D:\360Downloads\test") #print(file_list) saved_path=os.getcwd() #print("Current Working Directory is "+saved_path) os.chdir(r"D:\360Downloads\test") for file_name in file_list: os.rename(file_name,file_name.translate(None,"0123456789")) rename_files() #the wrong message is translate() takes exactly one argument (2 given)
0debug
adb.exe start server failed android studio : <ol> <li>i type adb nodaemon server error: could not install <em>smartsocket</em> listener: cannot bind to 127.0.0.1:5037: Only one u sage of each socket address (protocol/network address/port) is normally permitted. (10048)</li> <li>netstat -ano | findstr 5037 TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 5652 TCP 127.0.0.1:5037 127.0.0.1:55726 ESTABLISHED 5652 TCP 127.0.0.1:5037 127.0.0.1:55770 ESTABLISHED 5652 TCP 127.0.0.1:55726 127.0.0.1:5037 ESTABLISHED 1620 TCP 127.0.0.1:55770 127.0.0.1:5037 ESTABLISHED 6488 So i could not find any error .I dont knw wny showing adb.exe start server failed.So what to do please help to resolve </li> </ol>
0debug
static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; acb->qcrs[acb->child_iter].buf = qemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size); qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }
1threat
Angular mat-form-field how to set width:100% : <p>I create a registration form as part of my learning Angular and Nodejs. My form looks wide and it is ok, however the fields on this form looks narrow or thin. I tried to set Width:100% direct to the container tag but didn't work.</p> <p>How to set width:100% for all these fields using a css tag?</p> <p>My form using angular:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;mat-card&gt; &lt;mat-card-header&gt; &lt;mat-card-title&gt; &lt;h4&gt;Register New User&lt;/h4&gt; &lt;/mat-card-title&gt; &lt;/mat-card-header&gt; &lt;mat-card-content class="register-container"&gt; &lt;form&gt; &lt;mat-form-field&gt; &lt;input matInput placeholder="E-mail" ng-model="data.email" type="email"&gt; &lt;/mat-form-field&gt; &lt;br /&gt; &lt;mat-form-field&gt; &lt;input matInput placeholder="Password" ng-model="data.pwd" type="password"&gt; &lt;/mat-form-field&gt; &lt;br&gt; &lt;mat-form-field&gt; &lt;input matInput placeholder="Name" ng-model="data.name" type="text"&gt; &lt;/mat-form-field&gt; &lt;br&gt; &lt;mat-form-field&gt; &lt;textarea matInput ng-model="data.description" placeholder="Leave a comment"&gt;&lt;/textarea&gt; &lt;/mat-form-field&gt; &lt;/form&gt; &lt;/mat-card-content&gt; &lt;/mat-card&gt;</code></pre> </div> </div> </p>
0debug
static void rtsp_cmd_describe(HTTPContext *c, const char *url) { FFStream *stream; char path1[1024]; const char *path; uint8_t *content; int content_length, len; struct sockaddr_in my_addr; url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && !strcmp(stream->fmt->name, "rtp") && !strcmp(path, stream->filename)) { goto found; } } rtsp_reply_error(c, RTSP_STATUS_SERVICE); return; found: len = sizeof(my_addr); getsockname(c->fd, (struct sockaddr *)&my_addr, &len); content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr); if (content_length < 0) { rtsp_reply_error(c, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); put_buffer(c->pb, content, content_length); }
1threat
Why do I get Gson builder error when starting a Spring Boot application? : <p>I have downloaded eclipse and installed the spring suit into it. I have written a JPA based Rest application by following one of the spring.io guides. When I try to run it as spring boot application. I get the following error.</p> <pre><code>java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; </code></pre> <p>Why am I getting this error? How do I fix this error?</p> <p>Here is the full output from the console.</p> <pre><code> . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.1.RELEASE) 2018-04-25 21:58:28.303 INFO 3574 --- [ main] .m.e.UserProfileEntityServiceApplication : Starting UserProfileEntityServiceApplication on Ajays-MBP.lan with PID 3574 (/Users/ajayamrite/workspaces/meghdoot_spring/UserProfileEntityService/target/classes started by ajayamrite in /Users/ajayamrite/workspaces/meghdoot_spring/UserProfileEntityService) 2018-04-25 21:58:28.306 INFO 3574 --- [ main] .m.e.UserProfileEntityServiceApplication : No active profile set, falling back to default profiles: default 2018-04-25 21:58:28.359 INFO 3574 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3bd40a57: startup date [Wed Apr 25 21:58:28 BST 2018]; root of context hierarchy 2018-04-25 21:58:29.557 INFO 3574 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]] 2018-04-25 21:58:30.142 INFO 3574 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$8d2d15cf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-04-25 21:58:30.553 INFO 3574 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2018-04-25 21:58:30.612 INFO 3574 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-04-25 21:58:30.612 INFO 3574 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29 2018-04-25 21:58:30.617 INFO 3574 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/ajayamrite/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.] 2018-04-25 21:58:30.716 INFO 3574 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-04-25 21:58:30.716 INFO 3574 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2360 ms 2018-04-25 21:58:30.826 INFO 3574 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-04-25 21:58:30.830 INFO 3574 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-04-25 21:58:30.831 INFO 3574 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-04-25 21:58:30.831 INFO 3574 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-04-25 21:58:30.831 INFO 3574 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-04-25 21:58:31.049 INFO 3574 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2018-04-25 21:58:31.311 INFO 3574 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2018-04-25 21:58:31.373 INFO 3574 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2018-04-25 21:58:31.443 INFO 3574 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. Wed Apr 25 21:58:31 BST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2018-04-25 21:58:31.674 INFO 3574 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.2.16.Final} 2018-04-25 21:58:31.675 INFO 3574 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2018-04-25 21:58:31.717 INFO 3574 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2018-04-25 21:58:31.854 INFO 3574 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 2018-04-25 21:58:32.718 INFO 3574 --- [ main] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@294aba23' 2018-04-25 21:58:32.722 INFO 3574 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2018-04-25 21:58:33.709 INFO 3574 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-04-25 21:58:33.881 INFO 3574 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3bd40a57: startup date [Wed Apr 25 21:58:28 BST 2018]; root of context hierarchy 2018-04-25 21:58:33.917 WARN 3574 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2018-04-25 21:58:33.947 INFO 3574 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2018-04-25 21:58:33.947 INFO 3574 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2018-04-25 21:58:33.967 INFO 3574 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-04-25 21:58:33.967 INFO 3574 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-04-25 21:58:33.977 INFO 3574 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in repositoryRestExceptionHandler 2018-04-25 21:58:34.103 WARN 3574 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gsonBuilder' defined in class path resource [org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.gson.GsonBuilder]: Factory method 'gsonBuilder' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; 2018-04-25 21:58:34.103 INFO 3574 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-04-25 21:58:34.105 INFO 3574 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2018-04-25 21:58:34.106 INFO 3574 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2018-04-25 21:58:34.109 INFO 3574 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2018-04-25 21:58:34.110 INFO 3574 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2018-04-25 21:58:34.120 INFO 3574 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-04-25 21:58:34.128 ERROR 3574 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gsonBuilder' defined in class path resource [org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.gson.GsonBuilder]: Factory method 'gsonBuilder' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE] at co.uk.meghdoot.entity.UserProfileEntityServiceApplication.main(UserProfileEntityServiceApplication.java:12) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.gson.GsonBuilder]: Factory method 'gsonBuilder' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] ... 18 common frames omitted Caused by: java.lang.BootstrapMethodError: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration$StandardGsonBuilderCustomizer.customize(GsonAutoConfiguration.java:96) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration.lambda$gsonBuilder$0(GsonAutoConfiguration.java:49) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_144] at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration.gsonBuilder(GsonAutoConfiguration.java:49) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration$$EnhancerBySpringCGLIB$$cbe82959.CGLIB$gsonBuilder$1(&lt;generated&gt;) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration$$EnhancerBySpringCGLIB$$cbe82959$$FastClassBySpringCGLIB$$6d1b6b91.invoke(&lt;generated&gt;) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE] at org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration$$EnhancerBySpringCGLIB$$cbe82959.gsonBuilder(&lt;generated&gt;) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE] ... 19 common frames omitted Caused by: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[na:1.8.0_144] at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:975) ~[na:1.8.0_144] at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1000) ~[na:1.8.0_144] at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1394) ~[na:1.8.0_144] at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1750) ~[na:1.8.0_144] at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477) ~[na:1.8.0_144] ... 33 common frames omitted </code></pre>
0debug
What is the application of pure abstract classes ? C++ : <p>We all know a basic example of an Animal and then Cat and Dog classes. But I don't get one thing, for example let's say that Animal is a pure abstract class that has only one method:</p> <pre><code> virtual void sayHello() = 0; </code></pre> <p>Then we make classes Cat and Dog and we still need to overwrite the method in their classes, so what's basically the purpose of it, becasue for now I see only additional code. I had one example with BankAccount class, we made 2 pure virtual classes only with methods: one to freeze an account and 2nd to put out the message about deposit. Then we made SavingsAccount class, which inherited all previously mentioned class and still I had to overwrite these pure virtual methods. Even If I did another i.e. account in foreign currency CurencyAccount, I still would have to overwrite the pure virtual method. So what's the purpose of making these pure virtual classes and methods? </p>
0debug
How to prevent page refresh or default prompt box in chrome : In my Quiz application have 10 questions in a page and all are input controls, i enter required answer ,during the time refresh a page without submitting, the browser gives a below pop up. Solution: I want an customize pop up (instead of chrome pop up) to say u need to finsih all the quiz and submit. or disable the refresh . How to do that, is there any better solution. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/IM3uD.png
0debug
Selecting Item From Category id Please0Help : Please Help me i'm trying to select items for my different category table but its shows only the i use with If() and i'm trying to use elseif if($get_idy='Cars'){ $sel = mysqli_query($con,"SELECT * FROM item WHERE category='Cars' "); }elseif($get_idy='Trucks'){ $sel = mysqli_query($con,"SELECT * FROM item WHERE category='Cars' "); } while($row= mysqli_fetch_array($sel)) { Please can someone help me
0debug
static void cuda_writew (void *opaque, target_phys_addr_t addr, uint32_t value) { }
1threat
How fix table header for following Table format : I have table in HTML format as follows: <html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <table class="report" border="0" cellspacing="0"> <tbody> <tr> <th class="xbrl-review" rowspan="2"></th> <th class="tl custom-border" colspan="1" rowspan="2"> <div style="width: 200px;"><strong>Document and Entity Information<br></strong></div> </th> <th class="xbrl-review"></th> <th class="th" colspan="1">3 Months Ended</th> <th class="xbrl-review"></th> <th class="th" colspan="1"></th> </tr> <tr> <th class="xbrl-review"></th> <th class="th"> <div class="xbrl-prop-context"> <div> <div>Sep. 30, 2014</div> </div> </div> </th> <th class="xbrl-review"></th> <th class="th"> <div class="xbrl-prop-context"> <div> <div>Nov. 07, 2014</div> </div> </div> </th> </tr> <tr class="re"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border ex"><a class="a xbrl-prop-element"href="javascript:void(0);" style="margin-left:0em;"><i class="icon-star blue">&#xA0;</i><strong><span class="xbrl-data-text">Document and Entity Information</span></strong></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">&#xA0;</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">&#xA0;</span></td> </tr> <tr class="re"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Entity Central Index Key</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border" ><span class="xbrl-data-text">0001501078</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border" ><span class="xbrl-data-text">111111111</span></td> </tr> <tr class="re"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Entity Central Index Key</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border" ><span class="xbrl-data-text">0001501078</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border" ><span class="xbrl-data-text">2222222</span></td> </tr> <tr class="ro"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Document Type</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">10-Q</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">3333333</span></td> </tr> <tr class="re"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Document Period End Date</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">Sep. 30, 2014</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">4444444</span></td> </tr> <tr class="ro"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Amendment Flag</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">false</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">true</span></td> </tr> <tr class="re"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Current Fiscal Year End Date</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">--06-30</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">4566756</span></td> </tr> <tr class="ro"> <td class="xbrl-review"></td> <td valign="top" class="pl custom-border"><a class="a xbrl-prop-element" href="javascript:void(0);" style="margin-left:1em;"><span class="xbrl-data-text">Entity Filer Category</span></a></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">Smaller Reporting Company</span></td> <td class="xbrl-review"></td> <td class="text xbrl-prop-data custom-border"><span class="xbrl-data-text">Harshal</span></td> </tr> </tbody> </table> </body> </html> Along with html following style is applied to it. th.th{ position: fixed; background-color:white; } th.tl{ position: fixed; background-color:white; } Right now `td` content are also going to move towards top and below to `th` so it is totally messed up. My expectation is well formatted Html with fix Table Header. Please help me out.
0debug
What is UI main fluid container in HTML? : <p>Not able to understand effects it creates in the HTML. Like what it means when written as </p> <p></p>
0debug
My app have been divided in 3 parts : Why is this is happening? That's an code error from .xml or from Java? [That's my app, he is divide in 3 (every part is a layout that is also an App) and I don't know why][1] [1]: https://i.stack.imgur.com/QBEMK.png
0debug
static void ppc_spapr_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; int i; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); target_phys_addr_t rma_alloc_size, rma_size; uint32_t initrd_base; long kernel_size, initrd_size, fw_size; long pteg_shift = 17; char *filename; spapr = g_malloc0(sizeof(*spapr)); QLIST_INIT(&spapr->phbs); cpu_ppc_hypercall = emulate_spapr_hypercall; rma_alloc_size = kvmppc_alloc_rma("ppc_spapr.rma", sysmem); if (rma_alloc_size == -1) { hw_error("qemu: Unable to create RMA\n"); exit(1); } if (rma_alloc_size && (rma_alloc_size < ram_size)) { rma_size = rma_alloc_size; } else { rma_size = ram_size; } spapr->fdt_addr = MIN(rma_size, 0x80000000) - FDT_MAX_SIZE; spapr->rtas_addr = spapr->fdt_addr - RTAS_MAX_SIZE; if (cpu_model == NULL) { cpu_model = kvm_enabled() ? "host" : "POWER7"; } for (i = 0; i < smp_cpus; i++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } cpu_ppc_tb_init(env, TIMEBASE_FREQ); qemu_register_reset((QEMUResetHandler *)&cpu_reset, env); env->hreset_vector = 0x60; env->hreset_excp_prefix = 0; env->gpr[3] = env->cpu_index; } spapr->ram_limit = ram_size; if (spapr->ram_limit > rma_alloc_size) { ram_addr_t nonrma_base = rma_alloc_size; ram_addr_t nonrma_size = spapr->ram_limit - rma_alloc_size; memory_region_init_ram(ram, NULL, "ppc_spapr.ram", nonrma_size); memory_region_add_subregion(sysmem, nonrma_base, ram); } spapr->htab_size = 1ULL << (pteg_shift + 7); spapr->htab = qemu_memalign(spapr->htab_size, spapr->htab_size); for (env = first_cpu; env != NULL; env = env->next_cpu) { env->external_htab = spapr->htab; env->htab_base = -1; env->htab_mask = spapr->htab_size - 1; env->spr[SPR_SDR1] = (unsigned long)spapr->htab | ((pteg_shift + 7) - 18); env->spr[SPR_HIOR] = 0; if (kvm_enabled()) { kvmppc_set_papr(env); } } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin"); spapr->rtas_size = load_image_targphys(filename, spapr->rtas_addr, ram_size - spapr->rtas_addr); if (spapr->rtas_size < 0) { hw_error("qemu: could not load LPAR rtas '%s'\n", filename); exit(1); } g_free(filename); spapr->icp = xics_system_init(XICS_IRQS); spapr->next_irq = 16; spapr->vio_bus = spapr_vio_bus_init(); for (i = 0; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { spapr_vty_create(spapr->vio_bus, SPAPR_VTY_BASE_ADDRESS + i, serial_hds[i]); } } spapr_create_phb(spapr, "pci", SPAPR_PCI_BUID, SPAPR_PCI_MEM_WIN_ADDR, SPAPR_PCI_MEM_WIN_SIZE, SPAPR_PCI_IO_WIN_ADDR); for (i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; if (!nd->model) { nd->model = g_strdup("ibmveth"); } if (strcmp(nd->model, "ibmveth") == 0) { spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd); } else { pci_nic_init_nofail(&nd_table[i], nd->model, NULL); } } for (i = 0; i <= drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus, 0x2000 + i); } if (kernel_filename) { uint64_t lowaddr = 0; kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, ram_size - KERNEL_LOAD_ADDR); } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } spapr->entry_point = KERNEL_LOAD_ADDR; } else { if (ram_size < (MIN_RAM_SLOF << 20)) { fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " "%ldM guest RAM\n", MIN_RAM_SLOF); exit(1); } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, FW_FILE_NAME); fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); if (fw_size < 0) { hw_error("qemu: could not load LPAR rtas '%s'\n", filename); exit(1); } g_free(filename); spapr->entry_point = 0x100; initrd_base = 0; initrd_size = 0; for (env = first_cpu; env != NULL; env = env->next_cpu) { env->halted = 1; } } spapr->fdt_skel = spapr_create_fdt_skel(cpu_model, rma_size, initrd_base, initrd_size, boot_device, kernel_cmdline, pteg_shift + 7); assert(spapr->fdt_skel != NULL); qemu_register_reset(spapr_reset, spapr); }
1threat
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[pkt->stream_index]->codec; FLVContext *flv = s->priv_data; unsigned ts; int size= pkt->size; uint8_t *data= NULL; int flags, flags_size; if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F || enc->codec_id == CODEC_ID_AAC) flags_size= 2; else if(enc->codec_id == CODEC_ID_H264) flags_size= 5; else flags_size= 1; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { avio_w8(pb, FLV_TAG_TYPE_VIDEO); flags = enc->codec_tag; if(flags == 0) { av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id); return -1; } flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER; } else { assert(enc->codec_type == AVMEDIA_TYPE_AUDIO); flags = get_audio_flags(enc); assert(size); avio_w8(pb, FLV_TAG_TYPE_AUDIO); } if (enc->codec_id == CODEC_ID_H264) { if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) { if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0) return -1; } } if (!flv->delay && pkt->dts < 0) flv->delay = -pkt->dts; ts = pkt->dts + flv->delay; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { if (flv->last_video_ts < ts) flv->last_video_ts = ts; } avio_wb24(pb,size + flags_size); avio_wb24(pb,ts); avio_w8(pb,(ts >> 24) & 0x7F); avio_wb24(pb,flv->reserved); avio_w8(pb,flags); if (enc->codec_id == CODEC_ID_VP6) avio_w8(pb,0); if (enc->codec_id == CODEC_ID_VP6F) avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0); else if (enc->codec_id == CODEC_ID_AAC) avio_w8(pb,1); else if (enc->codec_id == CODEC_ID_H264) { avio_w8(pb,1); avio_wb24(pb,pkt->pts - pkt->dts); } avio_write(pb, data ? data : pkt->data, size); avio_wb32(pb,size+flags_size+11); flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); avio_flush(pb); av_free(data); return pb->error; }
1threat
heartbeat failed for group because it's rebalancing : <p>What's the exact reason to have heartbeat failure for group because it's rebalancing ? What's the reason for rebalance where all the consumers in group are up ? </p> <p>Thank you.</p>
0debug
What do I need to learn to develop a simple login app for android os? : <p>I know programming with java and the basics of android studio.I need to know how to store user data from android app and make the app interactive.Also please let me know if there are any tutorials for any such development released recently.</p>
0debug
static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) { av_strlcatf(buff, size, "v=%d\r\n" "o=- %d %d IN IPV4 %s\r\n" "t=%d %d\r\n" "s=%s\r\n" "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n", s->sdp_version, s->id, s->version, s->src_addr, s->start_time, s->end_time, s->name[0] ? s->name : "No Name"); dest_write(buff, size, s->dst_addr, s->ttl); }
1threat
PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers) { PPCE500PCIState *controller; PCIDevice *d; int index; static int ppce500_pci_id; controller = qemu_mallocz(sizeof(PPCE500PCIState)); controller->pci_state.bus = pci_register_bus(NULL, "pci", mpc85xx_pci_set_irq, mpc85xx_pci_map_irq, pci_irqs, 0x88, 4); d = pci_register_device(controller->pci_state.bus, "host bridge", sizeof(PCIDevice), 0, NULL, NULL); pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_FREESCALE); pci_config_set_device_id(d->config, PCI_DEVICE_ID_MPC8533E); pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_POWERPC); controller->pci_dev = d; index = cpu_register_io_memory(pcie500_cfgaddr_read, pcie500_cfgaddr_write, controller); if (index < 0) goto free; cpu_register_physical_memory(registers + PCIE500_CFGADDR, 4, index); index = cpu_register_io_memory(pcie500_cfgdata_read, pcie500_cfgdata_write, &controller->pci_state); if (index < 0) goto free; cpu_register_physical_memory(registers + PCIE500_CFGDATA, 4, index); index = cpu_register_io_memory(e500_pci_reg_read, e500_pci_reg_write, controller); if (index < 0) goto free; cpu_register_physical_memory(registers + PCIE500_REG_BASE, PCIE500_REG_SIZE, index); register_savevm("ppce500_pci", ppce500_pci_id++, 1, ppce500_pci_save, ppce500_pci_load, controller); return controller->pci_state.bus; free: printf("%s error\n", __func__); qemu_free(controller); return NULL; }
1threat
python loop through colours : ## PYTHON HELP ## I've got a series of patches drawn in a grid entered by the user but want them to loop through a series of colours which are also typed by the user. i.e. the user enters 'blue, green, yellow' and the patches should follow that loop both horizontally and vertically def drawPatch(win, x, y, colours): #values carried from drawPatchwork and placed into this function for i in range(100, 0, -10): rectangle = Rectangle(Point(x + i, y + (100 - i)), Point(x, (y + 100))) if (i % 20) == 0: rectangle.setFill("white") else: rectangle.setFill(colours) rectangle.setOutline("") rectangle.draw(win) # win.getMouse() # win.close() # drawPatch(win=GraphWin("drawPatch", 100, 100), colour="red", x=0, y=0) def drawPatchwork(): width = int(input("Enter width: ")) height = int(input("Enter height: ")) colours = input("Enter your four colours: ").split(',') win = GraphWin("Draw Patch", width * 100, height * 100) for y in range(0, height * 100, 100): for x in range(0, width * 100, 100): drawPatch(win, x, y, colours) #items placed into drawPatch function win.getMouse() win.close()
0debug
static void test_io_channel_setup_sync(SocketAddress *listen_addr, SocketAddress *connect_addr, QIOChannel **src, QIOChannel **dst) { QIOChannelSocket *lioc; lioc = qio_channel_socket_new(); qio_channel_socket_listen_sync(lioc, listen_addr, &error_abort); if (listen_addr->type == SOCKET_ADDRESS_KIND_INET) { SocketAddress *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); g_free(connect_addr->u.inet.data->port); connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); qapi_free_SocketAddress(laddr); } *src = QIO_CHANNEL(qio_channel_socket_new()); qio_channel_socket_connect_sync( QIO_CHANNEL_SOCKET(*src), connect_addr, &error_abort); qio_channel_set_delay(*src, false); qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN); *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort)); g_assert(*dst); test_io_channel_set_socket_bufs(*src, *dst); object_unref(OBJECT(lioc)); }
1threat
Numpy converting range of angles from (-Pi, Pi) to (0, 2*Pi) : <p>This seems like it would be very straight forward but I can't seem to figure out how to map angles between -Pi and Pi to the range 0 to 2Pi. I tried using np.select but it freezes my program for some reason. I need the angles in this range since they will be used as training data for a neural net which can not output negative numbers.</p> <pre><code>audio = wav.read('/home/chase/Desktop/ge.wav')[1].astype(np.float32) audio = np.mean(audio, 1) audio /= np.max(np.abs(audio)) audio = np.array([np.fft.rfft(audio[i:i + FRAME_SIZE]) for i in range(0, len(audio) - len(audio) % FRAME_SIZE, FRAME_SIZE)]) audio /= FRAME_SIZE audio_mag = np.abs(audio) audio_phase = np.angle(audio) #this line freezes the program audio_phase = np.select(audio_phase &lt; 0 , 2 * np.pi + audio_phase, audio_phase) </code></pre> <p>I need the audio </p>
0debug
int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type, int check_BATs) { int ret; #if 0 if (loglevel != 0) { fprintf(logfile, "%s\n", __func__); } #endif if ((access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0)) { ret = check_physical(env, ctx, eaddr, rw); } else { ret = -1; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: if (check_BATs) ret = get_bat(env, ctx, eaddr, rw, access_type); #if defined(TARGET_PPC64) case POWERPC_MMU_64B: case POWERPC_MMU_64BRIDGE: #endif if (ret < 0) { ret = get_segment(env, ctx, eaddr, rw, access_type); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ret = mmu40x_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_601: cpu_abort(env, "601 MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE: ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "BookE FSL MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 does not do any translation\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } } #if 0 if (loglevel != 0) { fprintf(logfile, "%s address " ADDRX " => %d " PADDRX "\n", __func__, eaddr, ret, ctx->raddr); } #endif return ret; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Regex No Work , Regex between 2 String : please help me : I have a strange error with Regex: Remove the dot's on span :) Const AG = "<.span>$(.*)<./span>" Dim x As String = "<.span>$1</span.>" Dim lel As Regex = New Regex(AG) Dim lol As Match = lel.Match(x) The following code no work , i don't know why please help me :/
0debug
Remove duplication from an array o object : I have an object like below, class LocationData{ String time; String name; String address; } for this object i have created getter setter. By using service i fill this above model and save into room database. whenever user open my app i just update the room database data to server using API. Now sometimes the time duplication occurred. How to remove the object from based on time. time should be unique.
0debug
void do_info_roms(Monitor *mon, const QDict *qdict) { Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { if (!rom->fw_file) { monitor_printf(mon, "addr=" TARGET_FMT_plx " size=0x%06zx mem=%s name=\"%s\"\n", rom->addr, rom->romsize, rom->isrom ? "rom" : "ram", rom->name); } else { monitor_printf(mon, "fw=%s/%s" " size=0x%06zx name=\"%s\"\n", rom->fw_dir, rom->fw_file, rom->romsize, rom->name); } } }
1threat
how to read a checkbox already checked ON? : <form method="post"><div class="switch"><label>Off <input type="checkbox" name="test1" onclick="this.form.submit()"checked="checked"><span class="lever" ></span>On </label> hi i have this code on materialize it`s working, but when the button is already checked, won`t work for some reason so, if there is : <input type="checkbox" name="test1" onclick="this.form.submit()" checked="checked"> there will be the lever ON but when i click it off it won`t submit the form any help is really appreciate Thank you
0debug
showNotification in react-admin doesn't work, Still : <p><a href="https://codesandbox.io/s/simple-6nzp0" rel="nofollow noreferrer">https://codesandbox.io/s/simple-6nzp0</a> please see /src/posts/postEdit.js line 73. no notification show.</p> <p>Could you add a working code on the sandbox?</p> <p>though there are other discussion: <a href="https://stackoverflow.com/questions/54062100/shownotification-in-react-admin-doesnt-work">showNotification in react-admin doesn&#39;t work</a> <a href="https://github.com/marmelab/react-admin/issues/3402" rel="nofollow noreferrer">https://github.com/marmelab/react-admin/issues/3402</a> they all did not work.</p> <p>I need a working code on the sandbox so I know what I miss.</p> <p>Thanks.</p>
0debug
Is this a bug in R 3.5? : <p>When I call Rscript.exe for Version 3.5 of R, it is unable to open the file if the file name or path has a space in it. I saved 2 files with the code:</p> <p><code>cat("What do you get when you multiply 6 * 9?")</code></p> <p>as <strong>C:\foo bar.R</strong> and as <strong>C:\foo_bar.R</strong></p> <p>When I in a DOS command window try to run these using version 3.4.3 and 3.5:</p> <pre><code>C:\&gt;"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo bar.R" What do you get when you multiply 6 * 9? C:\&gt;"C:\Program Files\R\R-3.4.3\bin\x64\Rscript.exe" "C:\foo_bar.R" What do you get when you multiply 6 * 9? C:\&gt;"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo bar.R" Fatal error: cannot open file 'C:\foo': No such file or directory C:\&gt;"C:\Program Files\R\R-3.5.0\bin\x64\Rscript.exe" "C:\foo_bar.R" What do you get when you multiply 6 * 9? C:\&gt; </code></pre> <p>When I try to run the file with a space in the name in version 3.5.0 of R, there is a fatal error saying there is no such file.</p>
0debug
Dropdown item select chage event : net. I have one dropdown list. On select item in dropdown list i want to open dropdown list2. As same on select of dropdownlist2 item i want to open 2 textboxes and 2 labels. This should be change on dropdownlist2 item select. Hope you getting my question. Help Me. Thanx &
0debug
How to pass JSON data from server to client side and use the data in Javscript? : I would like to pass a JSON from server side to client side in Node.js. On the client side I want to use them in Javascript then. What I tried so far: ``` app.get('/test', function (req, res) { let data = { "questions":{ "5-2?":[ { "ans1":"3" }, { "ans2":"8" }, ], "1+2":[ { "ans1":"3" }, { "ans2":"1" } ] } }; res.render('test', { data: data }); }); ``` In my pug file I want to use that data with Javscript like this: ``` script console.log(!{data}); ```
0debug
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"name","selector":"username"} : Need help in solving below error. URL : https://services.gst.gov.in/services/login username = driver.find_element_by_name("username"); File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 495, in find_element_by_name return self.find_element(by=By.NAME, value=name) File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 966, in find_element 'value': value})['value'] File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute self.error_handler.check_response(response) File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"name","selector":"username"}
0debug
Toggle between fullscreen editor and terminal in VS Code : <p>As a Windows systems admin, I use PowerShell quite a lot. With the release of PS Core, and the implication that the ISE is dead, I've started to try to use VS Code as my day to day tool. One feature I'm missing from ISE is the ability to swap between the editor and the terminal in fullscreen. I usually kept ISE open and maximized, and used Ctrl+R to swap between editor and terminal as needed. I haven't found a way to maximize the terminal, and swap easily between terminal and editor. I know I can make the terminal take up most of the screen, but a) this still leaves about 2 lines of editor open at the top, and b) there doesn't seem to be an easy way to then maximize the editor. Is there a way to minic the ISE behaviour that I haven't found yet?</p>
0debug
Is there a way to run JavaScript in R? : I am working on a project which is primarily in R and requires some JavaScripts to run. So, I need a way to run JavaScripts in R itself. for example, Is there any way run below JavaScripts in R? public static void main(String[] args){ for(int i=0;i<5;i++){ System.out.println("HelloWorld"); } } ** Lib in R (v8,rJava,rserve)
0debug
static int gif_image_write_header(AVIOContext *pb, int width, int height, int loop_count, uint32_t *palette) { int i; avio_write(pb, "GIF", 3); avio_write(pb, "89a", 3); avio_wl16(pb, width); avio_wl16(pb, height); if (palette) { avio_w8(pb, 0xf7); avio_w8(pb, 0x1f); avio_w8(pb, 0); for (i = 0; i < 256; i++) { const uint32_t v = palette[i] & 0xffffff; avio_wb24(pb, v); } } else { avio_w8(pb, 0); avio_w8(pb, 0); avio_w8(pb, 0); } avio_w8(pb, 0x21); avio_w8(pb, 0xff); avio_w8(pb, 0x0b); avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); avio_w8(pb, 0x03); avio_w8(pb, 0x01); avio_wl16(pb, (uint16_t)loop_count); avio_w8(pb, 0x00); return 0; }
1threat
void do_brinc (void) { uint32_t a, b, d, mask; mask = (uint32_t)(-1UL) >> MASKBITS; b = T1_64 & mask; a = T0_64 & mask; d = word_reverse(1 + word_reverse(a | ~mask)); T0_64 = (T0_64 & ~mask) | (d & mask); }
1threat
How to install awscli using pip in library/node Docker image : <p>I'm trying to install <code>awscli</code> using <code>pip</code> (as per Amazon's recommendations) in a custom Docker image that comes <code>FROM library/node:6.11.2</code>. Here's a repro:</p> <pre><code>FROM library/node:6.11.2 RUN apt-get update &amp;&amp; \ apt-get install -y \ python \ python-pip \ python-setuptools \ groff \ less \ &amp;&amp; pip --no-cache-dir install --upgrade awscli \ &amp;&amp; apt-get clean CMD ["/bin/bash"] </code></pre> <p>However, with the above I'm met with:</p> <pre class="lang-none prettyprint-override"><code>no such option: --no-cache-dir </code></pre> <p>Presumably because I've got incorrect versions of Python and/or Pip?</p> <p>I'm installing Python, Pip, and awscli in a similar way with <code>FROM maven:3.5.0-jdk-8</code> and there it works just fine. I'm unsure what the <em>relevant</em> differences between the two images are.</p> <p>Removing said option from my Dockerfile doesn't do me much good either, because then I'm met with a big pile of different errors, an excerpt here:</p> <pre class="lang-none prettyprint-override"><code>Installing collected packages: awscli, PyYAML, docutils, rsa, colorama, botocore, s3transfer, pyasn1, jmespath, python-dateutil, futures, six Running setup.py install for PyYAML checking if libyaml is compilable ### ABBREVIATED ### ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory #include "Python.h" ^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ### ABBREVIATED ### </code></pre> <p>Bottom line: how do you properly install <code>awscli</code> in <code>library/node:6.x</code> based images?</p>
0debug
static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) { PowerPCCPU *cpu = opaque; CPUPPCState *env = &cpu->env; unsigned int i, j; target_ulong sdr1; uint32_t fpscr; target_ulong xer; for (i = 0; i < 32; i++) qemu_get_betls(f, &env->gpr[i]); #if !defined(TARGET_PPC64) for (i = 0; i < 32; i++) qemu_get_betls(f, &env->gprh[i]); #endif qemu_get_betls(f, &env->lr); qemu_get_betls(f, &env->ctr); for (i = 0; i < 8; i++) qemu_get_be32s(f, &env->crf[i]); qemu_get_betls(f, &xer); cpu_write_xer(env, xer); qemu_get_betls(f, &env->reserve_addr); qemu_get_betls(f, &env->msr); for (i = 0; i < 4; i++) qemu_get_betls(f, &env->tgpr[i]); for (i = 0; i < 32; i++) { union { float64 d; uint64_t l; } u; u.l = qemu_get_be64(f); env->fpr[i] = u.d; } qemu_get_be32s(f, &fpscr); env->fpscr = fpscr; qemu_get_sbe32s(f, &env->access_type); #if defined(TARGET_PPC64) qemu_get_betls(f, &env->spr[SPR_ASR]); qemu_get_sbe32s(f, &env->slb_nr); #endif qemu_get_betls(f, &sdr1); for (i = 0; i < 32; i++) qemu_get_betls(f, &env->sr[i]); for (i = 0; i < 2; i++) for (j = 0; j < 8; j++) qemu_get_betls(f, &env->DBAT[i][j]); for (i = 0; i < 2; i++) for (j = 0; j < 8; j++) qemu_get_betls(f, &env->IBAT[i][j]); qemu_get_sbe32s(f, &env->nb_tlb); qemu_get_sbe32s(f, &env->tlb_per_way); qemu_get_sbe32s(f, &env->nb_ways); qemu_get_sbe32s(f, &env->last_way); qemu_get_sbe32s(f, &env->id_tlbs); qemu_get_sbe32s(f, &env->nb_pids); if (env->tlb.tlb6) { for (i = 0; i < env->nb_tlb; i++) { qemu_get_betls(f, &env->tlb.tlb6[i].pte0); qemu_get_betls(f, &env->tlb.tlb6[i].pte1); qemu_get_betls(f, &env->tlb.tlb6[i].EPN); } } for (i = 0; i < 4; i++) qemu_get_betls(f, &env->pb[i]); for (i = 0; i < 1024; i++) qemu_get_betls(f, &env->spr[i]); if (!env->external_htab) { ppc_store_sdr1(env, sdr1); } qemu_get_be32s(f, &env->vscr); qemu_get_be64s(f, &env->spe_acc); qemu_get_be32s(f, &env->spe_fscr); qemu_get_betls(f, &env->msr_mask); qemu_get_be32s(f, &env->flags); qemu_get_sbe32s(f, &env->error_code); qemu_get_be32s(f, &env->pending_interrupts); qemu_get_be32s(f, &env->irq_input_state); for (i = 0; i < POWERPC_EXCP_NB; i++) qemu_get_betls(f, &env->excp_vectors[i]); qemu_get_betls(f, &env->excp_prefix); qemu_get_betls(f, &env->ivor_mask); qemu_get_betls(f, &env->ivpr_mask); qemu_get_betls(f, &env->hreset_vector); qemu_get_betls(f, &env->nip); qemu_get_betls(f, &env->hflags); qemu_get_betls(f, &env->hflags_nmsr); qemu_get_sbe32(f); qemu_get_sbe32(f); hreg_compute_mem_idx(env); return 0; }
1threat
Python regular expression quoted string : <p>I have the following string:</p> <pre><code>str1 = "I am doing 'very well' for your info" </code></pre> <p>and I want to extract the part between the single quotes i.e. <strong><em>very well</em></strong></p> <p>How am I supposed to set my regular expression?</p> <p>I tried the following but obviously it will give wrong result</p> <pre><code>import re pt = re.compile(r'\'*\'') m = pt.findall(str1) </code></pre> <p>Thanks</p>
0debug
static av_cold int concat_open(URLContext *h, const char *uri, int flags) { char *node_uri = NULL; int err = 0; int64_t size; size_t len, i; URLContext *uc; struct concat_data *data = h->priv_data; struct concat_nodes *nodes; av_strstart(uri, "concat:", &uri); for (i = 0, len = 1; uri[i]; i++) if (uri[i] == *AV_CAT_SEPARATOR) if (++len == UINT_MAX / sizeof(*nodes)) { av_freep(&h->priv_data); return AVERROR(ENAMETOOLONG); } if (!(nodes = av_malloc(sizeof(*nodes) * len))) { return AVERROR(ENOMEM); } else data->nodes = nodes; if (!*uri) err = AVERROR(ENOENT); for (i = 0; *uri; i++) { len = strcspn(uri, AV_CAT_SEPARATOR); if ((err = av_reallocp(&node_uri, len + 1)) < 0) break; av_strlcpy(node_uri, uri, len+1); uri += len + strspn(uri+len, AV_CAT_SEPARATOR); if ((err = ffurl_open(&uc, node_uri, flags, &h->interrupt_callback, NULL)) < 0) break; if ((size = ffurl_size(uc)) < 0) { ffurl_close(uc); err = AVERROR(ENOSYS); break; } nodes[i].uc = uc; nodes[i].size = size; } av_free(node_uri); data->length = i; if (err < 0) concat_close(h); else if ((err = av_reallocp(&nodes, data->length * sizeof(*nodes))) < 0) concat_close(h); else data->nodes = nodes; return err; }
1threat
static void vnc_dpy_copy(DisplayChangeListener *dcl, int src_x, int src_y, int dst_x, int dst_y, int w, int h) { VncDisplay *vd = container_of(dcl, VncDisplay, dcl); VncState *vs, *vn; uint8_t *src_row; uint8_t *dst_row; int i, x, y, pitch, inc, w_lim, s; int cmp_bytes; vnc_refresh_server_surface(vd); QTAILQ_FOREACH_SAFE(vs, &vd->clients, next, vn) { if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { vs->force_update = 1; vnc_update_client(vs, 1, true); pitch = vnc_server_fb_stride(vd); src_row = vnc_server_fb_ptr(vd, src_x, src_y); dst_row = vnc_server_fb_ptr(vd, dst_x, dst_y); y = dst_y; inc = 1; if (dst_y > src_y) { src_row += pitch * (h-1); dst_row += pitch * (h-1); pitch = -pitch; y = dst_y + h - 1; inc = -1; w_lim = w - (VNC_DIRTY_PIXELS_PER_BIT - (dst_x % VNC_DIRTY_PIXELS_PER_BIT)); if (w_lim < 0) { w_lim = w; } else { w_lim = w - (w_lim % VNC_DIRTY_PIXELS_PER_BIT); for (i = 0; i < h; i++) { for (x = 0; x <= w_lim; x += s, src_row += cmp_bytes, dst_row += cmp_bytes) { if (x == w_lim) { if ((s = w - w_lim) == 0) break; } else if (!x) { s = (VNC_DIRTY_PIXELS_PER_BIT - (dst_x % VNC_DIRTY_PIXELS_PER_BIT)); s = MIN(s, w_lim); } else { s = VNC_DIRTY_PIXELS_PER_BIT; cmp_bytes = s * VNC_SERVER_FB_BYTES; if (memcmp(src_row, dst_row, cmp_bytes) == 0) continue; memmove(dst_row, src_row, cmp_bytes); QTAILQ_FOREACH(vs, &vd->clients, next) { if (!vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { set_bit(((x + dst_x) / VNC_DIRTY_PIXELS_PER_BIT), vs->dirty[y]); src_row += pitch - w * VNC_SERVER_FB_BYTES; dst_row += pitch - w * VNC_SERVER_FB_BYTES; y += inc; QTAILQ_FOREACH(vs, &vd->clients, next) { if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { vnc_copy(vs, src_x, src_y, dst_x, dst_y, w, h);
1threat
How to add multiple exists fields with OR operation in elasticsearch : <p>I have the following query:</p> <pre><code>{ "query": { "exists": { "field": "field1" } } } </code></pre> <p>I would like my query to be modified in a way that I could add another filter with existing field having 'OR' operation between them.</p> <p>Any idea how to do so?</p> <p>Thanks.</p>
0debug
How to extract linked images out of a html page with PHP/regexp : <p>I'm looking for some PHP code or a rexeg expression (i'm not that skilled about regexp) to extract from a html file just the linked images. In other words, just the chunk of html that looks like:</p> <pre><code>&lt;a href=...&gt;&lt;img src=...&gt;&lt;/a&gt; </code></pre> <p>I know how to extract images and links separately </p> <pre><code>$links = $dom-&gt;getElementsByTagName('a'); $images = $dom-&gt;getElementsByTagName('img'); </code></pre> <p>but not how to extract the two tags one inside the other. I have also not found anything by googling it. So is it maybe uncommon or very difficult what I want to do? </p> <p>Could you help me? Thanks.</p>
0debug
static void check_pred4x4(H264PredContext *h, uint8_t *buf0, uint8_t *buf1, int codec, int chroma_format, int bit_depth) { if (chroma_format == 1) { uint8_t *topright = buf0 + 2*16; int pred_mode; for (pred_mode = 0; pred_mode < 15; pred_mode++) { if (check_pred_func(h->pred4x4[pred_mode], "4x4", pred4x4_modes[codec][pred_mode])) { randomize_buffers(); call_ref(src0, topright, (ptrdiff_t)12*SIZEOF_PIXEL); call_new(src1, topright, (ptrdiff_t)12*SIZEOF_PIXEL); if (memcmp(buf0, buf1, BUF_SIZE)) fail(); bench_new(src1, topright, (ptrdiff_t)12*SIZEOF_PIXEL); } } } }
1threat
Jquery's .split() not converting a string : I have made an ajax search field. Ajax search works and items are being successfully added. When I remove the added search items. I am getting the clicked on added search values. Converting them to an array and then I will do inarray and remove the matched ones. But the problem is when I use **split** for jquery. It isnt converting a simple string to an array. Here is the HTML. <span class="search-field supplier-ajax"> <div class="placeholder"> <input type="search" id="woocommerce-product-supplier-field" class="supplier-field field form-control valid" autocomplete="off" aria-invalid="false"> <ul class="placeholder-items"> <li class="supplier-ajax-placeholder" id="726" slug="bottle">Bottle</li> </ul> </div> <i class="fa fa-search" aria-hidden="true"></i> <div class="hidden" id="suggesstion-box"> <ul> <li id="726" slug="bottle">Bottle</li> <li id="1011" slug="eurobottle">Eurobottle</li> <li id="612" slug="bottle-promotions">Bottle Promotions</li> </ul> <i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw hidden"></i> </div> <input type="hidden" id="supplier-nonce" name="" value="93b8e7346b"> <input type="hidden" id="product_supplier" name="supplier" value="bottle"> </span> In this input field, I am running the following jquery $('.placeholder').on( "click", "li", function() { parent = jQuery('.supplier-ajax'); // Parent id = jQuery(this).attr('id'); slug = jQuery(this).attr('slug'); supplierval = parent.find('#product_supplier').val(); console.log(parent); console.log('placeholderclick'); console.log(slug); console.log(id); console.log(supplierval); console.log(typeof supplierval) supplierarray = $(supplierval).toString().split(","); console.log(supplierarray); }); The console outputs placeholderclick bottle 726 bottle string ["[object Object]"]0: "[object Object]"length: 1__proto__: Array(0) The typeof the supplierval is string but still **split** does not work. I have tried removing .toString() from supplierarray but then it gives a .split(); function not found error. I dont know what is the problem. Why isn't split working on a simple string who's typeof is also string.
0debug
static uint32_t cmos_ioport_read(void *opaque, uint32_t addr) { RTCState *s = opaque; int ret; if ((addr & 1) == 0) { return 0xff; } else { switch(s->cmos_index) { case RTC_SECONDS: case RTC_MINUTES: case RTC_HOURS: case RTC_DAY_OF_WEEK: case RTC_DAY_OF_MONTH: case RTC_MONTH: case RTC_YEAR: ret = s->cmos_data[s->cmos_index]; break; case RTC_REG_A: ret = s->cmos_data[s->cmos_index]; break; case RTC_REG_C: ret = s->cmos_data[s->cmos_index]; qemu_irq_lower(s->irq); #ifdef TARGET_I386 if(s->irq_coalesced) { apic_reset_irq_delivered(); qemu_irq_raise(s->irq); if (apic_get_irq_delivered()) s->irq_coalesced--; break; } #endif s->cmos_data[RTC_REG_C] = 0x00; break; default: ret = s->cmos_data[s->cmos_index]; break; } #ifdef DEBUG_CMOS printf("cmos: read index=0x%02x val=0x%02x\n", s->cmos_index, ret); #endif return ret; } }
1threat
How to change Cookie Processor to LegacyCookieProcessor in tomcat 8 : <p>My code is working on tomcat 8 version 8.0.33 but on 8.5.4 i get : An invalid domain [.mydomain] was specified for this cookie.</p> <p>I have found that Rfc6265CookieProcessor is introduced in tomcat 8 latest versions.</p> <p>It says on official doc that this can be reverted to LegacyCookieProcessor in context.xml but i don't know how.</p> <p>Please let me know how to do this.</p> <p>Thanks</p>
0debug
Calculate folder size for multiple folders : <p>I would like to build a script which does:</p> <ul> <li>Calculate total folder size for specific paths;</li> <li>Display folder size per path in MB's (recursive sub-folders included, not displayed);</li> <li>Calculate total size of all listed folders.</li> </ul> <p>This will be used in a back-up/restore script. Prior to making the back-up we would like to know the total size of the back-up, and also in which folders contains large amounts of data.</p> <p>Output would be something like:</p> <pre><code>Total size: 1456MB C:/folder1 100MB C:/folder2 123MB C:/folder3/folder1 1233MB </code></pre> <p>Perhaps something very simple for some of you. I have searched and tried for a couple of hours but never got what I need.. Any suggestions which code language to use, or specific scripts would help!</p>
0debug
static uint8_t *read_huffman_tables(FourXContext *f, uint8_t * const buf){ int frequency[512]; uint8_t flag[512]; int up[512]; uint8_t len_tab[257]; int bits_tab[257]; int start, end; uint8_t *ptr= buf; int j; memset(frequency, 0, sizeof(frequency)); memset(up, -1, sizeof(up)); start= *ptr++; end= *ptr++; for(;;){ int i; for(i=start; i<=end; i++){ frequency[i]= *ptr++; } start= *ptr++; if(start==0) break; end= *ptr++; } frequency[256]=1; while((ptr - buf)&3) ptr++; for(j=257; j<512; j++){ int min_freq[2]= {256*256, 256*256}; int smallest[2]= {0, 0}; int i; for(i=0; i<j; i++){ if(frequency[i] == 0) continue; if(frequency[i] < min_freq[1]){ if(frequency[i] < min_freq[0]){ min_freq[1]= min_freq[0]; smallest[1]= smallest[0]; min_freq[0]= frequency[i];smallest[0]= i; }else{ min_freq[1]= frequency[i];smallest[1]= i; } } } if(min_freq[1] == 256*256) break; frequency[j]= min_freq[0] + min_freq[1]; flag[ smallest[0] ]= 0; flag[ smallest[1] ]= 1; up[ smallest[0] ]= up[ smallest[1] ]= j; frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0; } for(j=0; j<257; j++){ int node; int len=0; int bits=0; for(node= j; up[node] != -1; node= up[node]){ bits += flag[node]<<len; len++; if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); } bits_tab[j]= bits; len_tab[j]= len; } init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab , 1, 1, bits_tab, 4, 4); return ptr; }
1threat
Angular material textarea : How to scale height of textarea (mat-form-field) to 100% of the content? I tried height: 100% in every element inside directive, and it does not work.
0debug
def sort_tuple(tup): n = len(tup) for i in range(n): for j in range(n-i-1): if tup[j][0] > tup[j + 1][0]: tup[j], tup[j + 1] = tup[j + 1], tup[j] return tup
0debug
What is a Factor in R and why do we need it : <p>I am new to R language and am not able to understand the need to use/have Factors in R and its killing me. I read a lot but still have not found the satisfactory answer. Any help would be much appreciated. Thank you.</p>
0debug
Fastest way to compute image dataset channel wise mean and standard deviation in Python : <p>I have a huge image dataset that does not fit in memory. I want to compute the <code>mean</code> and <code>standard deviation</code>, loading images from disk.</p> <p>I'm currently trying to use this algorithm found on <a href="https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance" rel="noreferrer">wikipedia</a>.</p> <pre><code># for a new value newValue, compute the new count, new mean, the new M2. # mean accumulates the mean of the entire dataset # M2 aggregates the squared distance from the mean # count aggregates the amount of samples seen so far def update(existingAggregate, newValue): (count, mean, M2) = existingAggregate count = count + 1 delta = newValue - mean mean = mean + delta / count delta2 = newValue - mean M2 = M2 + delta * delta2 return existingAggregate # retrieve the mean and variance from an aggregate def finalize(existingAggregate): (count, mean, M2) = existingAggregate (mean, variance) = (mean, M2/(count - 1)) if count &lt; 2: return float('nan') else: return (mean, variance) </code></pre> <p>This is my current implementation (computing just for the red channel):</p> <pre><code>count = 0 mean = 0 delta = 0 delta2 = 0 M2 = 0 for i, file in enumerate(tqdm(first)): image = cv2.imread(file) for i in range(224): for j in range(224): r, g, b = image[i, j, :] newValue = r count = count + 1 delta = newValue - mean mean = mean + delta / count delta2 = newValue - mean M2 = M2 + delta * delta2 print('first mean', mean) print('first std', np.sqrt(M2 / (count - 1))) </code></pre> <p>This implementation works close enough on a subset of the dataset I tried.</p> <p>The problem is that it is extremely slow and therefore nonviable.</p> <ul> <li><p>Is there a standard way of doing this?</p></li> <li><p>How can I adapt this for faster result or compute the RGB mean and standard deviation for all the dataset without loading it all in memory at the same time and at reasonable speed?</p></li> </ul>
0debug
Ansible dictionnary lookup : I'm trying to generate some nginx config to implement a reverse proxy setup for various docker containers. The nginx config generation is, tentatively, generated using the below ansible playbooks. The first block is a dictionnary which contains some metadata for my containers. The second block is a list of task which is included (see third block) and looped over. I can see, at the level of my second debug msg, that I'v an issue with my rproxy_fe record since the debug returns nothing. Any advise on how I should properly write this would be greatly appreciated! net_containers: named: ipv6_range: "ipv6_prefix:AAAA:AAAA:1::/118" ipv6_container: "ipv6_prefix:AAAA:AAAA:1:2" ipv6_gw: "ipv6_prefix:AAAA:AAAA:1:1" ipv4_range: "192.168.11.64/30" ipv4_container: "192.168.11.66" ipv4_gw: "192.168.11.65" parent_nic: "{{ net_int_dmz_trusted }}" rproxy_be : "mx.example.net" rproxy_fe : null rproxy_url: null rproxy_restrict: null hass: ipv6_range: "ipv6_prefix:AAAA:AAAA:3::/118" ipv6_container: "ipv6_prefix:AAAA:AAAA:3:2" ipv6_gw: "ipv6_prefix:AAAA:AAAA:3:1" ipv4_range: "192.168.11.72/30" ipv4_container: "192.168.11.74" ipv4_gw: "192.168.11.73" parent_nic: "{{ net_int_dmz_trusted }}" rproxy_fe : "home.example.net" rproxy_be : "hass-container.example.net" rproxy_url: "http://hass-container.example.net:8123" rproxy_restrict: "true" This is the list of tasks on which we loop: - name: Starting the processing of one new reverse proxied site debug: msg="{{ item.key }}" - name: Checking on the dictionnary lookups debug: msg="{{ net_containers[ item.key].rproxy_fe }}" - name: Install nginx site for letsencrypt requests vars: rproxy_fe: "{{ net_containers[ item.key].rproxy_fe }}" template: src: templates/nginx-le.j2 dest: /etc/nginx/sites-enabled/le-{{ net_containers[ item.key].rproxy_fe }} when: net_containers[ item.key].rproxy_fe is defined - name: Install nginx site for specified site vars: rproxy_fe: "{{ net_containers[ item.key].rproxy_fe }}" rproxy_url: "{{ net_containers[ item.key].rproxy_url }}" rproxy_restrict: "{{ net_containers[ item.key].rproxy_restrict }}" template: src: templates/nginx-http.j2 dest: /etc/nginx/sites-enabled/http-{{ net_containers[ item.key].rproxy_fe }} when: net_containers[ item.key].rproxy_fe is defined - name: Check if we've generated a cert already stat: path=/etc/letsencrypt/live/{{ net_containers[ item.key].rproxy_fe }}/fullchain.pem register: cert_stats - name: Create letsencrypt certificate shell: letsencrypt certonly -n --webroot -w /var/www/letsencrypt -m {{ sysadmin_email }} --agree-tos -d {{ net_containers[ item.key ].rproxy_fe }} args: creates: /etc/letsencrypt/live/{{ net_containers[ item.key].rproxy_fe }} when: net_containers[ item.key].rproxy_fe is defined and cert_stats.stat.exists == False - name: Add letsencrypt cronjob for cert renewal cron: name: letsencrypt_renewal {{ net_containers[ item.key].rproxy_fe }} special_time: weekly job: letsencrypt --renew certonly -n --webroot -w /var/www/letsencrypt -m {{ sysadmin_email }} --agree-tos -d {{ net_containers[ item.key].rproxy_fe }} when: net_containers[ item.key].rproxy_fe is defined This is the import of the task list and the loop: - include_tasks: add_domain.yml loop: "{{ lookup('dict', net_containers)}}"
0debug
How to add dictionaries to a DataFrame as a row? : <p>I have a <code>DataFrame</code> with following columns:</p> <pre><code>columns = ['Autor', 'Preţul', 'Suprafaţa totală', 'Etaj', 'Etaje', 'Tipul casei', 'Tipul de camere','Numărul de camere','Starea apartamentului', 'Planificare', 'Tipul clădirii', 'Sectorul', 'Strada', 'Numărul casei'] df = pd.DataFrame(columns=columns) </code></pre> <p>I want to add to this <code>DataFrame</code> a number of dictionaries row by row, for instance for the first row I want to ad this dictionary:</p> <pre><code>{'Autor': nan, 'Balcon/lojă': '2', 'Etaj': '1', 'Grup sanitar': 'separat', 'Locul de amplasare în casă': 'In mijlocul casei', 'Numărul casei': nan, 'Numărul de camere': '4 şi mai multe camere', 'Parcare': 'deschisă', 'Preţul': nan, 'Sectorul': nan, 'Strada': nan, 'Suprafaţa totală': '90 m²', 'Tipul clădirii': 'Dat în exploatare'} </code></pre> <p>The values of the keys of the dictionary that are not in the <code>DataFrame</code> columns should be set as <code>NaN</code> values. The dictionaries had only a part of the columns names as keys. </p> <p>for instance the second dict:</p> <pre><code>{'Autor': nan, 'Numărul casei': nan, 'Numărul de camere': '3 camere', 'Preţul': nan, 'Sectorul': nan, 'Strada': nan, 'Suprafaţa totală': '103 m²', 'Tipul clădirii': 'Dat în exploatare'} </code></pre> <p>The dictionaries are results of a for loop and they should be added as unique row.</p>
0debug
Changing the order of the array contents by performing arithmetic operations in PHP : <p>I have the following array output. </p> <pre><code> Array ( [0] =&gt; Array ( [student_id] =&gt; 39 [scored] =&gt; 50 [out_of] =&gt; 100 ) [1] =&gt; Array ( [student_id] =&gt; 40 [scored] =&gt; 80 [out_of] =&gt; 100 ) ) </code></pre> <p>I want to calculate the percentage of the student and want to show the student on top whose percentage is higher. how do i do it? Can i change the order in the array itself? please help</p> <p>I want the array to be like this </p> <pre><code>Array ( [0] =&gt; Array ( [student_id] =&gt; 40 [scored] =&gt; 80 [out_of] =&gt; 100 ) [1] =&gt; Array ( [student_id] =&gt; 39 [scored] =&gt; 50 [out_of] =&gt; 100 ) ) </code></pre>
0debug
Testing if blocks with Mockito : <p>I have void function that does not return return anything with a if block inside. Is there a way while unit testing to verify if the "if" block is touched? </p> <p>for example to test the "if" inside the following funtion: </p> <pre><code>public void doSomething(){ if(someCondition){ int foo = doThis(); } // ---- // remaining code } private int doThis(){ return 100; } </code></pre>
0debug
int avio_open2(AVIOContext **s, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options) { URLContext *h; int err; err = ffurl_open(&h, filename, flags, int_cb, options); if (err < 0) return err; err = ffio_fdopen(s, h); if (err < 0) { ffurl_close(h); return err; } return 0; }
1threat
static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) { switch (buf[0] >> 5) { case 0: cmd->xfer = buf[4]; cmd->len = 6; break; case 1: case 2: cmd->xfer = lduw_be_p(&buf[7]); cmd->len = 10; break; case 4: cmd->xfer = ldl_be_p(&buf[10]) & 0xffffffffULL; cmd->len = 16; break; case 5: cmd->xfer = ldl_be_p(&buf[6]) & 0xffffffffULL; cmd->len = 12; break; default: return -1; } switch (buf[0]) { case TEST_UNIT_READY: case REWIND: case START_STOP: case SET_CAPACITY: case WRITE_FILEMARKS: case WRITE_FILEMARKS_16: case SPACE: case RESERVE: case RELEASE: case ERASE: case ALLOW_MEDIUM_REMOVAL: case VERIFY_10: case SEEK_10: case SYNCHRONIZE_CACHE: case SYNCHRONIZE_CACHE_16: case LOCATE_16: case LOCK_UNLOCK_CACHE: case SET_CD_SPEED: case SET_LIMITS: case WRITE_LONG_10: case MOVE_MEDIUM: case UPDATE_BLOCK: case RESERVE_TRACK: case SET_READ_AHEAD: case PRE_FETCH: case PRE_FETCH_16: case ALLOW_OVERWRITE: cmd->xfer = 0; break; case MODE_SENSE: break; case WRITE_SAME_10: case WRITE_SAME_16: cmd->xfer = dev->blocksize; break; case READ_CAPACITY_10: cmd->xfer = 8; break; case READ_BLOCK_LIMITS: cmd->xfer = 6; break; case SEND_VOLUME_TAG: if (dev->type == TYPE_ROM) { cmd->xfer = buf[10] | (buf[9] << 8); } else { cmd->xfer = buf[9] | (buf[8] << 8); } break; case WRITE_6: if (cmd->xfer == 0) { cmd->xfer = 256; } case WRITE_10: case WRITE_VERIFY_10: case WRITE_12: case WRITE_VERIFY_12: case WRITE_16: case WRITE_VERIFY_16: cmd->xfer *= dev->blocksize; break; case READ_6: case READ_REVERSE: if (cmd->xfer == 0) { cmd->xfer = 256; } case READ_10: case RECOVER_BUFFERED_DATA: case READ_12: case READ_16: cmd->xfer *= dev->blocksize; break; case FORMAT_UNIT: if (dev->type == TYPE_ROM && (buf[1] & 16)) { cmd->xfer = 12; } else { cmd->xfer = (buf[1] & 16) == 0 ? 0 : (buf[1] & 32 ? 8 : 4); } break; case INQUIRY: case RECEIVE_DIAGNOSTIC: case SEND_DIAGNOSTIC: cmd->xfer = buf[4] | (buf[3] << 8); break; case READ_CD: case READ_BUFFER: case WRITE_BUFFER: case SEND_CUE_SHEET: cmd->xfer = buf[8] | (buf[7] << 8) | (buf[6] << 16); break; case PERSISTENT_RESERVE_OUT: cmd->xfer = ldl_be_p(&buf[5]) & 0xffffffffULL; break; case ERASE_12: if (dev->type == TYPE_ROM) { cmd->xfer = scsi_get_performance_length(buf[9] | (buf[8] << 8), buf[10], buf[1] & 0x1f); } break; case MECHANISM_STATUS: case READ_DVD_STRUCTURE: case SEND_DVD_STRUCTURE: case MAINTENANCE_OUT: case MAINTENANCE_IN: if (dev->type == TYPE_ROM) { cmd->xfer = buf[9] | (buf[8] << 8); } break; } return 0; }
1threat
How to list nearby bluetooth devices : <p>What is the easiest way to list nearby bluetooth devices. I am using xamarin c# for an android application.</p>
0debug
static void tcg_out_tlb_check (TCGContext *s, int r0, int r1, int r2, int addr_reg, int addr_reg2, int s_bits, int offset1, int offset2, uint8_t **label_ptr) { uint16_t retranst; tcg_out32 (s, (RLWINM | RA (r0) | RS (addr_reg) | SH (32 - (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS)) | MB (32 - (CPU_TLB_BITS + CPU_TLB_ENTRY_BITS)) | ME (31 - CPU_TLB_ENTRY_BITS) ) ); tcg_out32 (s, ADD | RT (r0) | RA (r0) | RB (TCG_AREG0)); tcg_out32 (s, (LWZU | RT (r1) | RA (r0) | offset1 ) ); tcg_out32 (s, (RLWINM | RA (r2) | RS (addr_reg) | SH (0) | MB ((32 - s_bits) & 31) | ME (31 - TARGET_PAGE_BITS) ) ); tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1)); #if TARGET_LONG_BITS == 64 tcg_out32 (s, LWZ | RT (r1) | RA (r0) | 4); tcg_out32 (s, CMP | BF (6) | RA (addr_reg2) | RB (r1)); tcg_out32 (s, CRAND | BT (7, CR_EQ) | BA (6, CR_EQ) | BB (7, CR_EQ)); #endif *label_ptr = s->code_ptr; retranst = ((uint16_t *) s->code_ptr)[1] & ~3; tcg_out32(s, BC | BI(7, CR_EQ) | retranst | BO_COND_FALSE | LK); tcg_out32 (s, (LWZ | RT (r0) | RA (r0) | offset2 ) ); tcg_out32 (s, ADD | RT (r0) | RA (r0) | RB (addr_reg)); }
1threat
Inserting the data into database but it store the null value : EmpDao.java package com.javatpoint; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import com.javatpoint.Emp; public class EmpDao { JdbcTemplate template; public void setTemplate(JdbcTemplate template) { this.template = template; } public int save(Emp p){ String sql="insert into empp(name,salary,designation) values('"+p.getName()+"',"+p.getSalary()+",'"+p.getDesignation()+"')"; return template.update(sql); } public int update(Emp p){ String sql="update empp set name='"+p.getName()+"', salary="+p.getSalary()+", designation='"+p.getDesignation()+"' where id="+p.getId()+""; return template.update(sql); } public int delete(int id){ String sql="delete from empp where id="+id+""; return template.update(sql); } public Emp getEmpById(int id){ String sql="select * from empp where name=?"; return template.queryForObject(sql, new Object[]{id},new BeanPropertyRowMapper<Emp>(Emp.class)); } public List<Emp> getEmployees(){ return template.query("select * from empp",new RowMapper<Emp>(){ public Emp mapRow(ResultSet rs, int row) throws SQLException { Emp e=new Emp(); e.setName(rs.getString(1)); e.setSalary(rs.getFloat(2)); e.setDesignation(rs.getString(3)); return e; } }); } } EmpController.java package com.javatpoint; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.javatpoint.Emp; import com.javatpoint.EmpDao; @Controller public class EmpController { @Autowired EmpDao dao;//will inject dao from xml file /*It displays a form to input data, here "command" is a reserved request attribute *which is used to display object data into form */ @RequestMapping("/empform") public ModelAndView showform(){ return new ModelAndView("empform","command",new Emp()); } /*It saves object into database. The @ModelAttribute puts request data * into model object. You need to mention RequestMethod.POST method * because default request is GET*/ @RequestMapping(value="/save",method = RequestMethod.POST) public ModelAndView save(@ModelAttribute("emp") Emp emp){ dao.save(emp); return new ModelAndView("redirect:/viewemp.jsp");//will redirect to viewemp request mapping } /* It provides list of employees in model object */ @RequestMapping("/viewemp") public ModelAndView viewemp(){ List<Emp> list=dao.getEmployees(); return new ModelAndView("viewemp","list",list); } /* It displays object data into form for the given id. * The @PathVariable puts URL data into variable.*/ @RequestMapping(value="/editemp/{id}") public ModelAndView edit(@PathVariable int id){ Emp emp=dao.getEmpById(id); return new ModelAndView("empeditform","command",emp); } /* It updates model object. */ @RequestMapping(value="/editsave",method = RequestMethod.POST) public ModelAndView editsave(@ModelAttribute("emp") Emp emp){ dao.update(emp); return new ModelAndView("redirect:/viewemp"); } /* It deletes record for the given id in URL and redirects to /viewemp */ @RequestMapping(value="/deleteemp/{id}",method = RequestMethod.GET) public ModelAndView delete(@PathVariable int id){ dao.delete(id); return new ModelAndView("redirect:/viewemp"); } } Emp.java package com.javatpoint; public class Emp { private int id; private String name; private float salary; private String designation; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getSalary() { return salary; } public void setSalary(float salary) { this.salary = salary; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } } empform.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <h1>Add New Employee</h1> <form method="post" action="save"> <table > <tr> <td>Name : </td> <td><input path="name" /></td> </tr> <tr> <td>Salary :</td> <td><input path="salary" /></td> </tr> <tr> <td>Designation :</td> <td><input path="designation" /></td> </tr> <tr> <td> </td> <td><input type="submit" value="Save" /></td> </tr> </table> <form> </body> </html> Database table empp +-------+--------+-------------+ | name | salary | designation | +-------+--------+-------------+ | null | 0 | null | | null | 0 | null | | srinu | 5000 | test | | null | 0 | null | | null | 0 | null | | null | 0 | null | +-------+--------+-------------+ hiii I am trying to insert the data into database table but it store the null values. database table names are name varchar salary int designation varchar. please provide the solution. thank you.
0debug
static int parse_optional_info(DCACoreDecoder *s) { DCAContext *dca = s->avctx->priv_data; int ret = -1; if (s->ts_present) skip_bits_long(&s->gb, 32); if (s->aux_present && (ret = parse_aux_data(s)) < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return ret; if (ret < 0) s->prim_dmix_embedded = 0; if (s->ext_audio_present && !dca->core_only) { int sync_pos = FFMIN(s->frame_size / 4, s->gb.size_in_bits / 32) - 1; int last_pos = get_bits_count(&s->gb) / 32; int size, dist; switch (s->ext_audio_type) { case EXT_AUDIO_XCH: if (dca->request_channel_layout) break; for (; sync_pos >= last_pos; sync_pos--) { if (AV_RB32(s->gb.buffer + sync_pos * 4) == DCA_SYNCWORD_XCH) { s->gb.index = (sync_pos + 1) * 32; size = get_bits(&s->gb, 10) + 1; dist = s->frame_size - sync_pos * 4; if (size >= 96 && (size == dist || size - 1 == dist) && get_bits(&s->gb, 7) == 0x08) { s->xch_pos = get_bits_count(&s->gb); break; } } } if (s->avctx->err_recognition & AV_EF_EXPLODE) { av_log(s->avctx, AV_LOG_ERROR, "XCH sync word not found\n"); return AVERROR_INVALIDDATA; } break; case EXT_AUDIO_X96: for (; sync_pos >= last_pos; sync_pos--) { if (AV_RB32(s->gb.buffer + sync_pos * 4) == DCA_SYNCWORD_X96) { s->gb.index = (sync_pos + 1) * 32; size = get_bits(&s->gb, 12) + 1; dist = s->frame_size - sync_pos * 4; if (size >= 96 && size == dist) { s->x96_pos = get_bits_count(&s->gb); break; } } } if (s->avctx->err_recognition & AV_EF_EXPLODE) { av_log(s->avctx, AV_LOG_ERROR, "X96 sync word not found\n"); return AVERROR_INVALIDDATA; } break; case EXT_AUDIO_XXCH: if (dca->request_channel_layout) break; for (; sync_pos >= last_pos; sync_pos--) { if (AV_RB32(s->gb.buffer + sync_pos * 4) == DCA_SYNCWORD_XXCH) { s->gb.index = (sync_pos + 1) * 32; size = get_bits(&s->gb, 6) + 1; if (size >= 11 && !ff_dca_check_crc(&s->gb, (sync_pos + 1) * 32, sync_pos * 32 + size * 8)) { s->xxch_pos = sync_pos * 32; break; } } } if (s->avctx->err_recognition & AV_EF_EXPLODE) { av_log(s->avctx, AV_LOG_ERROR, "XXCH sync word not found\n"); return AVERROR_INVALIDDATA; } break; } } return 0; }
1threat
static int coroutine_fn blkreplay_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { uint64_t reqid = request_id++; int ret = bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, flags); block_request_create(reqid, bs, qemu_coroutine_self()); qemu_coroutine_yield(); return ret; }
1threat
How to configure 3 way merge feature on compare in Visual Studio 2015 : <p><strong>Problem:</strong> The default diff/ merge tool in visual studio 2015 (and previous versions) does not allow merging when you compare a file. It only allows you to see differences. The only occasion I'm aware of the 3 way merge option being enabled is when there is a merge conflict.</p> <p>I want to see the 3 way merge option on every instance of the diff tool in Visual Studio.</p> <p><strong>Notes:</strong> I'm definitely not looking for an alternative tool or a 'work around' on this. I have been happily using <a href="http://blog.degree.no/2013/12/using-winmerge-as-the-default-diffmerge-tool-in-visual-studio-2012/" rel="noreferrer">WinMerge</a> as my merge tool which allows merging anytime you compare. I really like the vs diff tool's 3 way option and being able to use it any time I want would be a nice boost to my work flow.</p> <p>Thanks!</p>
0debug
def replace_blank(str1,char): str2 = str1.replace(' ', char) return str2
0debug
Error: "No module named _markerlib" when installing some packages on virtualenv : <p>I can't install some packages on virtualenv because of this error.</p> <p>I tried to install:</p> <pre><code>pip install pyups==0.4.4 </code></pre> <p>and </p> <pre><code>pip install --upgrade distribute </code></pre> <p>and they give me the error:</p> <pre><code>Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; File "/tmp/pip-build-tLx1oC/distribute/setup.py", line 58, in &lt;module&gt; setuptools.setup(**setup_params) File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "setuptools/command/egg_info.py", line 177, in run writer = ep.load(installer=installer) File "pkg_resources.py", line 2241, in load if require: self.require(env, installer) File "pkg_resources.py", line 2254, in require working_set.resolve(self.dist.requires(self.extras),env,installer))) File "pkg_resources.py", line 2471, in requires dm = self._dep_map File "pkg_resources.py", line 2682, in _dep_map self.__dep_map = self._compute_dependencies() File "pkg_resources.py", line 2699, in _compute_dependencies from _markerlib import compile as compile_marker ImportError: No module named _markerlib </code></pre> <p>I tried also to install markerlib with </p> <pre><code>pip install markerlib </code></pre> <p>But the error continues.</p>
0debug
Continue the loop elsewhere in the site : <p>this code causes the images to be displayed on a rotating basis on the site.</p> <pre><code>&lt;?php $myImagesList = array ( 'image1.png' , 'image2.png' , 'image3.png' , 'image4.png' , 'image5.png' , 'image6.png' , 'image7.png' , 'image8.png' , 'image9.png' , 'image10.png' ); shuffle ($myImagesList); echo '&lt;div style = "background: #0600ff" class = "div02"&gt;'; for ($i=0; $i&lt;10; $i++) { if ($i &lt; 5) { echo '' . $myImagesList[$i] . ''; } if ($i == 5) { echo '&lt;/div&gt;'; echo '&lt;div style = "background: #0600ff" class = "div02"&gt;'; } if ($i &gt; 5) { echo '' . $myImagesList[$i] . ''; } } echo '&lt;/div&gt;'; ?&gt; </code></pre> CONTENT <p><strong>It is that way in html page</strong> <a href="https://i.stack.imgur.com/3pQXf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3pQXf.png" alt="enter image description here"></a></p> <p>But how to break this code so that the loop with rotating images continues elsewhere on the site?</p> <p><strong>something like this</strong></p> <pre><code>&lt;?php RANDOM IMAGES ?&gt; XXX HTML CODE XXX &lt;?php CONTINUOUS RANDOM IMAGE ?&gt; </code></pre> <p><strong>imagem:</strong> <a href="https://i.stack.imgur.com/Ix31A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ix31A.png" alt="enter image description here"></a></p>
0debug
install django setup file in python 2.7 : i am install diango setup up file than eroor is hari@hari-HP-Pavilion-g6-Notebook-PC:~/Downloads/django-master$ sudo python setup.py install Traceback (most recent call last): File "setup.py", line 32, in <module> version = __import__('django').get_version() File "/home/hari/Downloads/django-master/django/__init__.py", line 1, in <module> from django.utils.version import get_version File "/home/hari/Downloads/django-master/django/utils/version.py", line 60, in <module> @functools.lru_cache() AttributeError: 'module' object has no attribute 'lru_cache' how to fix this error plz help me....
0debug
Clear all queryParams with new Router v3 Angular2 : <p>I'm trying to figure out how to use the Angular2 router navigation (router 3.0.0-alpha.7) with query parameters.</p> <p>I can easily navigate to a route with a queryParam with this line:</p> <pre><code>this._router.navigate(['/login'], {queryParams: {redirect: 'route1'}}); </code></pre> <p>In the '/login' component, I do some login which will redirect to the <code>redirect</code> route, namely route1 here. However, after the redirection, the <code>redirect</code> query parameters stays in the URL, i.e. I'm now at page <code>/route1?redirect=route1</code>. I want to remove the redirect parameter here.</p> <p>Moreover, if I then navigate to another page with the same <code>redirect</code> queryParam, it doesn't overwrite the previous one, but adds another <code>?redirect=...</code> in the url. Namely:</p> <pre><code>this._router.navigate(['/another-route'], {queryParams: {redirect:'route2'}}); </code></pre> <p>leads me to <code>/another-route?redirect=route2?redirect=route1</code></p> <p>Is it possible to clear the queryParams when navigating between routes? I tried <code>this._router.navigate(['/route1'], {queryParams: {redirect: null}});</code>, or <code>{queryParams: null}</code> etc but no success.</p>
0debug
How to answer this? : <p>Two persons are studying for a test.</p> <p>X’s chances of getting a “B” are 80%. Y’s chances of getting a “B” are 90%.</p> <p>The probability of at least one of them getting a “B” is 91%.</p> <p>a. What is the probability that only X gets a “B”?</p> <p>b. What is the probability that only Y gets a “B”?</p> <p>c. What is the probability that both won’t get a “B”?</p>
0debug
int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout) { int ret; int reuse = 1; struct pollfd lp = { fd, POLLIN, 0 }; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); ret = bind(fd, addr, addrlen); if (ret) return ff_neterrno(); ret = listen(fd, 1); if (ret) return ff_neterrno(); ret = poll(&lp, 1, timeout >= 0 ? timeout : -1); if (ret <= 0) return AVERROR(ETIMEDOUT); ret = accept(fd, NULL, NULL); if (ret < 0) return ff_neterrno(); closesocket(fd); ff_socket_nonblock(ret, 1); return ret; }
1threat
Is the Json.NET JsonSerializer threadsafe? : <p>I'm trying to reduce the amount of garbage my web service generates, and I noticed that we're creating a new Json.NET <code>JsonSerializer</code> instance for each request. It is not the most lightweight object ever, so I'm wondering if I can just create a single instance and reuse it for all requests. Primarily this requires that it be threadsafe during serialization and deserialization.</p> <p><a href="http://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_JsonSerializer.htm">The documentation</a> doesn't say whether it's threadsafe or not. </p> <p>Inspecting <a href="https://github.com/JamesNK/Newtonsoft.Json/blob/ce2a08dba228341742d96e8c8edfede6748d5bdc/Src/Newtonsoft.Json/JsonSerializer.cs">the code</a> it appears that the serialization and deserialization methods are threadsafe, as long as you don't change any settings on the object at the same time. However, it's a complex class so I'm not 100% sure of my analysis. </p> <p>Has anyone tried reusing instances of <code>JsonSerializer</code> and had it work or not? Are there any known problems with reusing it?</p>
0debug