problem
stringlengths
26
131k
labels
class label
2 classes
static void icp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_icp_server; dc->realize = icp_realize; }
1threat
git: fatal: '--ours/--theirs' cannot be used with switching branches : <p>In a merge conflict, I'm trying to resolve all the merge conflicts in favour of a particular branch.</p> <p>I'm trying to do <code>git checkout --ours</code>, but I get the following error:</p> <pre><code>fatal: '--ours/--theirs' cannot be used with switching branches </code></pre> <p>How can I achieve what I'm trying to do?</p>
0debug
static void ppc_heathrow_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 = NULL; char *filename; qemu_irq *pic, **heathrow_irqs; int linux_boot, i; ram_addr_t ram_offset, bios_offset; uint32_t kernel_base, initrd_base, cmdline_base = 0; int32_t kernel_size, initrd_size; PCIBus *pci_bus; MacIONVRAMState *nvr; int bios_size; MemoryRegion *pic_mem, *dbdma_mem, *cuda_mem; MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1), *ide_mem[2]; uint16_t ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; void *dbdma; linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) cpu_model = "G3"; 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, 16600000UL); qemu_register_reset((QEMUResetHandler*)&cpu_reset, env); } if (ram_size > (2047 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } ram_offset = qemu_ram_alloc(NULL, "ppc_heathrow.ram", ram_size); cpu_register_physical_memory(0, ram_size, ram_offset); bios_offset = qemu_ram_alloc(NULL, "ppc_heathrow.bios", BIOS_SIZE); if (bios_name == NULL) bios_name = PROM_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM); if (filename) { bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } if (linux_boot) { uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED bswap_needed = 1; #else bswap_needed = 0; #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { hw_error("qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP); initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } cmdline_base = round_page(initrd_base + initrd_size); } else { initrd_base = 0; initrd_size = 0; cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP); } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; for (i = 0; boot_device[i] != '\0'; i++) { #if 0 if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } #else if (boot_device[i] >= 'c' && boot_device[i] <= 'd') { ppc_boot_device = boot_device[i]; break; } #endif } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for G3 Beige machine\n"); exit(1); } } isa_mmio_init(0xfe000000, 0x00200000); heathrow_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); heathrow_irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * 1); for (i = 0; i < smp_cpus; i++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: heathrow_irqs[i] = heathrow_irqs[0] + (i * 1); heathrow_irqs[i][0] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; break; default: hw_error("Bus model not supported on OldWorld Mac machine\n"); } } if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { hw_error("Only 6xx bus is supported on heathrow machine\n"); } pic = heathrow_pic_init(&pic_mem, 1, heathrow_irqs); pci_bus = pci_grackle_init(0xfec00000, pic, get_system_memory(), get_system_io()); pci_vga_init(pci_bus); escc_mem = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); memory_region_init_alias(escc_bar, "escc-bar", escc_mem, 0, memory_region_size(escc_mem)); for(i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL); ide_drive_get(hd, MAX_IDE_BUS); dbdma = DBDMA_init(&dbdma_mem); ide_mem[0] = NULL; ide_mem[1] = pmac_ide_init(hd, pic[0x0D], dbdma, 0x16, pic[0x02]); hd[0] = hd[MAX_IDE_DEVS]; hd[1] = hd[MAX_IDE_DEVS + 1]; hd[3] = hd[2] = NULL; pci_cmd646_ide_init(pci_bus, hd, 0); cuda_init(&cuda_mem, pic[0x12]); adb_kbd_init(&adb_bus); adb_mouse_init(&adb_bus); nvr = macio_nvram_init(0x2000, 4); pmac_format_nvram_partition(nvr, 0x2000); macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem, dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar); if (usb_enabled) { usb_ohci_init_pci(pci_bus, -1); } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) graphic_depth = 15; fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); if (kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); if (kvm_enabled()) { #ifdef CONFIG_KVM uint8_t *hypercall; fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq()); hypercall = g_malloc(16); kvmppc_get_hypercall(env, hypercall, 16); fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); #endif } else { fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, get_ticks_per_sec()); } qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); }
1threat
split string in ',' C++ : <p>I have a string like this: </p> <p><code>17, the day is beautiful , day</code></p> <p>. And I want to split this string in the first ','. For example I want to take 2 strings. one for <strong><em>17</em></strong> and two <strong><em>for the day is beautiful , day</em></strong></p>
0debug
Mysterious Http 408 errors in AWS elasticbeanstalk-access_log : <p>The elasticbeanstalk-access_log log-file in our AWS EBS instances are full of 408 errors, like these:</p> <pre><code>172.31.1.56 (-) - - [16/Mar/2016:10:16:31 +0000] "-" 408 - "-" "-" 172.31.1.56 (-) - - [16/Mar/2016:10:16:31 +0000] "-" 408 - "-" "-" 172.31.1.56 (-) - - [16/Mar/2016:10:16:31 +0000] "-" 408 - "-" "-" 172.31.1.56 (-) - - [16/Mar/2016:10:16:31 +0000] "-" 408 - "-" "-" 172.31.1.56 (-) - - [16/Mar/2016:10:16:31 +0000] "-" 408 - "-" "-" 172.31.1.56 (-) - - [16/Mar/2016:10:16:59 +0000] "-" 408 - "-" "-" </code></pre> <p>They appear randomly, sometimes there are a few minutes between them, sometimes there are 4-6 errors within a few seconds. These errors also happen on our non-public staging environment when there is no any real traffic on the server, so the source of these requests is probably one of AWS's own service.</p>
0debug
CBus *cbus_init(qemu_irq dat) { CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s)); s->dat_out = dat; s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0]; s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0]; s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0]; s->sel = 1; s->clk = 0; s->dat = 0; return &s->cbus; }
1threat
Android ActionBar Backbutton Default Padding : <p>I am creating a custom <code>ActionBar</code> using a <code>RelativeLayout</code> with an <code>ImageButton</code> to the left to <strong>replace</strong> it. I have downloaded the Back icon from google's website to use on the <code>ImageButton</code></p> <p>The problem is that I need to create a Back button to replace the original <code>ActionBar</code>'s Back Button, and I need it to be exactly identical to the original <code>ActionBar</code>'s back button.</p> <p><strong>I am wondering what is the system's default padding for the Back button image?</strong> </p>
0debug
Laravel generate a unique ID using Storage::put : <p>I use Laravel <code>Storage::putFile()</code> when I store uploaded files and I like the convenience of it's automatic unique file name and how it takes care of file extension. </p> <p>Now I want to get a file from a remote server (<code>file_get_contents($url)</code>) and store it like I did for uploaded files, but I don't find any equal method in the docs. </p> <p>In <a href="https://laravel.com/docs/5.5/filesystem#storing-files" rel="noreferrer">https://laravel.com/docs/5.5/filesystem#storing-files</a> in the <code>put</code> method, you have to specify the file name. </p>
0debug
static uint32_t cc_calc_abs_64(int64_t dst) { if ((uint64_t)dst == 0x8000000000000000ULL) { return 3; } else if (dst) { return 1; } else { return 0; } }
1threat
static void rc4030_realize(DeviceState *dev, Error **errp) { rc4030State *s = RC4030(dev); Object *o = OBJECT(dev); int i; s->periodic_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, "rc4030.chipset", 0x300); memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); memory_region_init_rom_device(&s->dma_tt, o, &rc4030_dma_tt_ops, s, "dma-table", MAX_TL_ENTRIES * sizeof(dma_pagetable_entry), NULL); memory_region_init(&s->dma_tt_alias, o, "dma-table-alias", 0); memory_region_init(&s->dma_mr, o, "dma", INT32_MAX); for (i = 0; i < MAX_TL_ENTRIES; ++i) { memory_region_init_alias(&s->dma_mrs[i], o, "dma-alias", get_system_memory(), 0, DMA_PAGESIZE); memory_region_set_enabled(&s->dma_mrs[i], false); memory_region_add_subregion(&s->dma_mr, i * DMA_PAGESIZE, &s->dma_mrs[i]); } address_space_init(&s->dma_as, &s->dma_mr, "rc4030-dma"); }
1threat
How could I make a calendar? : <p>I'm trying to make a calendar for a client's website. I was wondering how should I go about doing this. I want it to when someone taps on a day it would show a modal with a form for that day. This form would then submit a scheduled appointment for that day. I assume I could use JavaScript or PHP to change the days for the appropriate month and year. </p> <p>A good example of this is in windows 10 you have a calendar that lets you click on a day and you can set up an agenda or something. If anyone could point me in the direction of how I could start this please let me know. Thanks! </p>
0debug
Java 8 - add property of object to list : <p>I have an empty list of integers:</p> <pre><code>final List&lt;Integer&gt; reservedMarkers = new ArrayList&lt;&gt;(); </code></pre> <p>and I will fill this list with the marker property of a list of objects, such like this:</p> <pre><code>scheduleIntervalContainers.stream().forEach(s -&gt; s.getMarker(), reservedMarkers.add(s)); </code></pre> <p>My final target would be to get the highest marker number but actually I dont know a better way as getting all marker numbers, than sort it and than get the highest one.</p> <p>this does not work for sure, is there a possibility to do this in this way?</p>
0debug
def min_k(test_list, K): res = sorted(test_list, key = lambda x: x[1])[:K] return (res)
0debug
how to superimpose heatmap on a base image? : <p>Please look at this <a href="https://github.com/metalbubble/CAM" rel="noreferrer">github page</a>. I want to generate heat maps in this way using Python PIL,open cv or matplotlib library. Can somebody help me figure it out? <a href="https://i.stack.imgur.com/OYPSP.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/OYPSP.jpg" alt="Superimposed heatmaps"></a></p> <p>I could create a heat map for my network at the same size as the input, but I am not able superimpose them. The heatmap shape is (800,800) and the base image shape is (800,800,3)</p>
0debug
Should I use ref or findDOMNode to get react root dom node of an element? : <p>I'm on a situation where I want to make some dom-node size calculations (top, bottom and size properties of the rendered DOM node)</p> <p>What I'm doing right now, on the <code>componentDidUpdate</code> method is to call findDOMNode on this:</p> <pre><code> componentDidUpdate() { var node = ReactDOM.findDOMNode(this); this.elementBox = node.getBoundingClientRect(); this.elementHeight = node.clientHeight; // Make calculations and stuff } </code></pre> <p>This is working fine, but I'm a bit worried about performance, and react best practices. Several places talks about using <code>ref</code> property instead of findDOMNode, but all of them are for child dom elements, on my case I only want the root DOM node of my component. </p> <p>The alternative using ref may look like this:</p> <pre><code>render(){ return ( &lt;section // container ref={(n) =&gt; this.node = n}&gt; // Stuff &lt;/section&gt; } componentDidUpdate() { this.elementBox = this.node.getBoundingClientRect(); this.elementHeight = this.node.clientHeight; // Make calculations and stuff } </code></pre> <p>To be honest, attaching a ref callback to my root dom node just to get it's reference does not feel correct to me.</p> <p>What is considered the best practice on this case ? Which one has better performance ?</p>
0debug
struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **errp) { GuestFileHandle *gfh = guest_file_handle_find(handle, errp); GuestFileRead *read_data = NULL; guchar *buf; FILE *fh; size_t read_count; if (!gfh) { return NULL; } if (!has_count) { count = QGA_READ_COUNT_DEFAULT; } else if (count < 0) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); return NULL; } fh = gfh->fh; buf = g_malloc0(count+1); read_count = fread(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to read file"); slog("guest-file-read failed, handle: %" PRId64, handle); } else { buf[read_count] = 0; read_data = g_malloc0(sizeof(GuestFileRead)); read_data->count = read_count; read_data->eof = feof(fh); if (read_count) { read_data->buf_b64 = g_base64_encode(buf, read_count); } } g_free(buf); clearerr(fh); return read_data; }
1threat
Array iteration : <p>I have a question regarding the iteration of a 2d array. Why does this work with <strong>System.out.println(n)</strong> and not <strong>System.out.println(row[n])</strong>? I am trying to print all the numbers.</p> <pre><code>public class test { public static void main(String[] args){ int numbers[][] = {{1,2,3}, {4,5,6}}; for (int [] row : numbers){ for (int n: row){ System.out.println(n); } } } } </code></pre>
0debug
How to join two table in mysqli using php : how to join two table in mysqli using php i have two table 1st is checkin and 2nd is checkout and i am trying to merge two table with condition please help me to fix this issue here is my table structure checkin userid currentdate currenttime 60 08-03-2018 03:10 60 08-03-2018 05:50 60 08-03-2018 08:20 20 08-03-2018 01:04 60 09-03-2018 11:23 20 09-03-2018 10:24 checkout userid currentdate currenttime 60 08-03-2018 04:05 60 08-03-2018 06:10 60 08-03-2018 09:25 20 08-03-2018 07:30 60 09-03-2018 12:30 i want result like this Result Userid Date Time 60 08-03-2018 In:03:10 Out:04:05 In:05:50 Out:06:10 In:08:20 Out:09:25 20 08-03-2018 In:01:04 Out:07:30 60 09-03-2018 In:11:23 Out:12:30 20 09-03-2018 In:10:24 here is the php code <?php include 'db.php'; $sql = 'SELECT checkin.iduser as iduser,checkin.currentdate as currentdate, checkin.currenttime as currenttime, checkout.iduser as iduser2 , checkout.currentdate as currentdate2, checkout.currenttime as currenttime2 FROM checkin LEFT JOIN checkout ON checkin.iduser = checkout.iduser'; if($result = mysqli_query($con, $sql)) { if(mysqli_num_rows($result) > 0) { echo " <table class=\"table table-bordered\">"; echo "<tr>"; echo "<th>ID</th>"; echo "<th>Date</th>"; echo "<th>Time</th>"; echo "</tr>"; while($row = mysqli_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['iduser'] . "</td>"; echo "<td>" . $row['currentdate'] . "</td>"; echo "<td>In :" . $row['currenttime'] . " <br> Out:" . $row['currenttime2'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_free_result($result); } else { echo "No records matching your query were found."; } } else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($con); } mysqli_close($con); ?>
0debug
Minikube expose MySQL running on localhost as service : <p>I have minikube version v0.17.1 running on my machine. I want to simulate the environment I will have in AWS, where my MySQL instance will be outside of my Kubernetes cluster. </p> <p>Basically, how can I expose my local MySQL instance running on my machine to the Kubernetes cluster running via minikube?</p>
0debug
How to get current datetime with format Y-m-d H:M:S using node-datetime library of nodejs? : <p>I'm using <a href="https://www.npmjs.com/package/node-datetime/" rel="noreferrer">node-datetime</a> library. I want to get current datetime with format such as Year-month-day hour-minute-second </p> <p>ex : <em>2016-07-04 17:19:11</em></p> <pre><code>var dateTime = require('node-datetime'); var dt = dateTime.create(); dt.format('m/d/Y H:M:S'); console.log(new Date(dt.now())); </code></pre> <p>But my result such as:</p> <blockquote> <p>Mon Jul 04 2016 17:19:11 GMT+0700 (SE Asia Standard Time)</p> </blockquote>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
drawing VTK point on the real time : i'd like to draw a Point using VTK library on the real time. i have a little problem on doing this. my program is drawing the point on the but i can't see them until i click on my windows control. here is my code: private void Pointdessinateur() { // Create the geometry of the points (the coordinate) vtkPoints points = vtkPoints.New(); List<double> X = new List<double>(); // création de la liste List<double> Y = new List<double>(); List<double> Z = new List<double>(); // Create topology of the points (a vertex per point) vtkCellArray vertices = vtkCellArray.New(); int i = 0; X.Add(XCnorm); Y.Add(YCnorm); Z.Add(ZCnorm); int[] ids = new int[X.Count]; for (i = 0; i < X.Count; i++) ids[i] = points.InsertNextPoint(X[i], Y[i], Z[i]); int size = Marshal.SizeOf(typeof(int)) * X.Count; IntPtr pIds = Marshal.AllocHGlobal(size); Marshal.Copy(ids, 0, pIds, X.Count); vertices.InsertNextCell(X.Count, pIds); Marshal.FreeHGlobal(pIds); // Create a polydata object vtkPolyData pointPoly = vtkPolyData.New(); // Set the points and vertices we created as the geometry and topology of the polydata pointPoly.SetPoints(points); pointPoly.SetVerts(vertices); // Visualize vtkPolyDataMapper mapper = vtkPolyDataMapper.New(); mapper.SetInput(pointPoly); vtkActor actor = vtkActor.New(); actor.SetMapper(mapper); actor.GetProperty().SetPointSize(3); actor.GetProperty().SetColor(0.25, 0.0, 0.0); vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow; vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer(); renderer.AddActor(actor); }
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Convert java.util.Date to what “java.time” type? : <p>I have a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Date.html" rel="noreferrer"><code>java.util.Date</code></a> object, or a <code>java.util.Calendar</code> object. How do I convert that to the right type in <a href="http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html" rel="noreferrer">java.time</a> framework? </p> <p>I have heard that we should now be doing the bulk of our business logic with java.time types. When working with old code not yet updated for java.time I need to be able to convert back and forth. What types map to <code>java.util.Date</code> or <code>java.util.Calendar</code>?</p>
0debug
static int film_read_header(AVFormatContext *s) { FilmDemuxContext *film = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; unsigned char scratch[256]; int i, ret; unsigned int data_offset; unsigned int audio_frame_counter; film->sample_table = NULL; film->stereo_buffer = NULL; film->stereo_buffer_size = 0; if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); data_offset = AV_RB32(&scratch[4]); film->version = AV_RB32(&scratch[8]); if (film->version == 0) { if (avio_read(pb, scratch, 20) != 20) return AVERROR(EIO); film->audio_type = AV_CODEC_ID_PCM_S8; film->audio_samplerate = 22050; film->audio_channels = 1; film->audio_bits = 8; } else { if (avio_read(pb, scratch, 32) != 32) return AVERROR(EIO); film->audio_samplerate = AV_RB16(&scratch[24]); film->audio_channels = scratch[21]; if (!film->audio_channels || film->audio_channels > 2) { av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", film->audio_channels); return AVERROR_INVALIDDATA; } film->audio_bits = scratch[22]; if (scratch[23] == 2) film->audio_type = AV_CODEC_ID_ADPCM_ADX; else if (film->audio_channels > 0) { if (film->audio_bits == 8) film->audio_type = AV_CODEC_ID_PCM_S8; else if (film->audio_bits == 16) film->audio_type = AV_CODEC_ID_PCM_S16BE; else film->audio_type = AV_CODEC_ID_NONE; } else film->audio_type = AV_CODEC_ID_NONE; } if (AV_RB32(&scratch[0]) != FDSC_TAG) return AVERROR_INVALIDDATA; if (AV_RB32(&scratch[8]) == CVID_TAG) { film->video_type = AV_CODEC_ID_CINEPAK; } else if (AV_RB32(&scratch[8]) == RAW_TAG) { film->video_type = AV_CODEC_ID_RAWVIDEO; } else { film->video_type = AV_CODEC_ID_NONE; } if (film->video_type) { st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = film->video_type; st->codec->codec_tag = 0; st->codec->width = AV_RB32(&scratch[16]); st->codec->height = AV_RB32(&scratch[12]); if (film->video_type == AV_CODEC_ID_RAWVIDEO) { if (scratch[20] == 24) { st->codec->pix_fmt = AV_PIX_FMT_RGB24; } else { av_log(s, AV_LOG_ERROR, "raw video is using unhandled %dbpp\n", scratch[20]); return -1; } } } if (film->audio_type) { st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->audio_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = film->audio_type; st->codec->codec_tag = 1; st->codec->channels = film->audio_channels; st->codec->sample_rate = film->audio_samplerate; if (film->audio_type == AV_CODEC_ID_ADPCM_ADX) { st->codec->bits_per_coded_sample = 18 * 8 / 32; st->codec->block_align = st->codec->channels * 18; st->need_parsing = AVSTREAM_PARSE_FULL; } else { st->codec->bits_per_coded_sample = film->audio_bits; st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample / 8; } st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample; } if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); if (AV_RB32(&scratch[0]) != STAB_TAG) return AVERROR_INVALIDDATA; film->base_clock = AV_RB32(&scratch[8]); film->sample_count = AV_RB32(&scratch[12]); if(film->sample_count >= UINT_MAX / sizeof(film_sample)) return -1; film->sample_table = av_malloc(film->sample_count * sizeof(film_sample)); if (!film->sample_table) return AVERROR(ENOMEM); for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) avpriv_set_pts_info(st, 33, 1, film->base_clock); else avpriv_set_pts_info(st, 64, 1, film->audio_samplerate); } audio_frame_counter = 0; for (i = 0; i < film->sample_count; i++) { if (avio_read(pb, scratch, 16) != 16) { ret = AVERROR(EIO); goto fail; } film->sample_table[i].sample_offset = data_offset + AV_RB32(&scratch[0]); film->sample_table[i].sample_size = AV_RB32(&scratch[4]); if (film->sample_table[i].sample_size > INT_MAX / 4) { ret = AVERROR_INVALIDDATA; goto fail; } if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) { film->sample_table[i].stream = film->audio_stream_index; film->sample_table[i].pts = audio_frame_counter; if (film->audio_type == AV_CODEC_ID_ADPCM_ADX) audio_frame_counter += (film->sample_table[i].sample_size * 32 / (18 * film->audio_channels)); else if (film->audio_type != AV_CODEC_ID_NONE) audio_frame_counter += (film->sample_table[i].sample_size / (film->audio_channels * film->audio_bits / 8)); } else { film->sample_table[i].stream = film->video_stream_index; film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF; film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1; } } film->current_sample = 0; return 0; fail: film_read_close(s); return ret; }
1threat
Using spring embedded ldap to simulate active directory for integration tests : <p>I am using the Spring Security <code>ActiveDirectoryLdapAuthenticationProvider</code> with Spring Boot (annotation based config) to authenticate with Active Directory and generate tokens. All works fine. </p> <p>I wish to add some integration tests that simulate the whole process, and I was thinking of maybe using the Spring embedded LDAP server for that.</p> <p>I added this ldif file that I got from another example I found online. </p> <pre><code>#Actual test data dn: dc=test,dc=com objectclass: top objectclass: domain objectclass: extensibleObject dc: local # Organizational Units dn: ou=groups,dc=test,dc=com objectclass: top objectclass: organizationalUnit ou: groups dn: ou=people,dc=test,dc=com objectclass: top objectclass: organizationalUnit ou: people # Create People dn: uid=testuser,ou=people,dc=test,dc=com objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson cn: Test sn: User uid: testuser password: secret # Create Groups dn: cn=developers,ou=groups,dc=test,dc=com objectclass: top objectclass: groupOfUniqueNames cn: developers ou: developer uniqueMember: uid=testuser,ou=people,dc=test,dc=com dn: cn=managers,ou=groups,dc=test,dc=com objectclass: top objectclass: groupOfUniqueNames cn: managers ou: manager uniqueMember: uid=testuser,ou=people,dc=test,dc=com </code></pre> <p>But this of course does not include any of the Active Directory schema stuff. Each user needs to have a <code>sAMAccountName</code> and needs to have the <code>memberOf</code> attribute to determine which groups it is in.</p> <p>Is there any way to make this behave similar to active directory so that the Spring <code>ActiveDirectoryLdapAuthenticationProvider</code> binds to it with the user's username and password and gets its group membership to populate its authorities?</p> <p>Otherwise if this is not viable, is there any other way to mock this and have a proper test?</p>
0debug
Lisp finding all even numbers and adding them to new list : <p>Given a list (3 b 6 7 8), I'm trying to find all the even numbers and add them to a new list and then print this list. I am using a do loop to cdr through my list. Then using (if (evenp (car mylist))) and now I want to save the first even number onto a new list and then restart the if statement. The final print should be (6 8).</p>
0debug
void bdrv_disable_copy_on_read(BlockDriverState *bs) { assert(bs->copy_on_read > 0); bs->copy_on_read--; }
1threat
Is there a simple way to convert a list of integers to a formatted string in Python? : <p>I am writing a program which generates a list of integers, for example:</p> <pre><code>[2, 5, 6, 7, 8, 9, 10, 15, 18, 19, 20] </code></pre> <p>This list can be very long, but it contains many consecutive values, as seen in this example. </p> <p>In order to store it (in a database), I would like to convert it to a formatted string, in the following format:</p> <pre><code>"2,5-10,15,18-20" </code></pre> <p>I already have in mind a solution, which is iterating through the whole list to detect consecutive values and building the string.</p> <p>My question is: is there another, simpler way of doing this conversion in Python?</p>
0debug
Calculate average based on condition in r : I have a table Country ClaimId ClaimItem ClaimAmt IN C1 1 100 IN C1 2 200 US C2 1 100 US C2 2 100 US C2 3 100 US C3 1 100 US C3 2 100 UK C4 1 100 UK C4 2 200 UK C1 1 100 UK C1 2 200 Here I want to calculate average per claimID such that my expected table looks like Country ClaimId ClaimItem ClaimAmt Avg IN C1 1 100 300 IN C1 2 200 300 US C2 1 100 250 US C2 2 100 250 US C2 3 100 250 US C3 1 100 250 US C3 2 100 250 UK C4 1 100 300 UK C4 2 200 300 UK C1 1 100 300 UK C1 2 200 300 Any idea on how the expected table can be achieved. Thanks Here is the sample > dput(claims) structure(list(Country = structure(c(1L, 1L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L), .Label = c("IN", "UK", "US"), class = "factor"), ClaimId = structure(c(1L, 1L, 2L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L), .Label = c("C1", "C2", "C3", "C4"), class = "factor"), ClaimItem = c(1L, 2L, 1L, 2L, 3L, 1L, 2L, 1L, 2L, 1L, 2L), ClaimAmt = c(100L, 200L, 100L, 100L, 100L, 100L, 100L, 100L, 200L, 100L, 200L)), .Names = c("Country", "ClaimId", "ClaimItem", "ClaimAmt"), class = "data.frame", row.names = c(NA, -11L))
0debug
Using this and super() in java : <p>I am wanting to know what <code>this</code> and <code>super</code> do in the following code. I know that <code>this</code> refers to the current object and <code>super</code> is used to invoke overridden methods as well invoke a superclasses constructor. But I just can't figure out what the following code does when class <code>C</code> is executed.</p> <pre><code>public class A { public A(int id) { super(); this.id = id; System.out.println("A created"); } private int id = 0; @Override protected void finalize() throws Throwable { System.out.println("A finalised"); super.finalize(); } } public class B extends A { public B(int id) { super(id); System.out.println("B created"); } public B() { this(42); System.out.println("B created with default id 42"); } @Override protected void finalize() throws Throwable { System.out.println("B finalised"); super.finalize(); } } public class C { public static void main(String[] args) throws Exception{ new B(); System.gc(); Thread.sleep(1000); } } </code></pre> <p>I am referring mainly to <code>this(42)</code>, <code>super(id)</code> and <code>super.finalize()</code>in class <code>B</code></p> <p>-Does <code>this(42)</code> mean that <code>B</code> is instantiated with the value 42, as well as setting <code>A</code> id to 42?</p> <p>-Does <code>super(id)</code> pass whatever value that <code>B</code> is instantiated with to its superclass which is <code>A</code> ? effectively setting the value of <code>id</code> in <code>A</code> to 42?</p> <p>-Does <code>super.finalize()</code> call the garbage collector on to superclass <code>A</code> ?</p>
0debug
How do I get a PHP array to an angular variable? : <p>I'm coding a website that uses PHP to get information about a match from the database into an array. However, I want to display this information using angular. How could I get the array from the PHP to the angular? </p>
0debug
Regex Help extract url from javascript function : I tried to learn regex to do this simple task, I tested may patterns using regex101.com editor but with no success, so i will really appreciate some here. i want to extract this link (http://mp3lg4.tdf-cdn.com/9243/lag_164753.mp3) from this javascript text, please note that the links doesn't always end with mp3, it could end with anything. here is part of the javascript in which the link exist, the link looks like this ("streamUrls":[{"streamUrl":"http://mp3lg4.tdf-cdn.com/9243/lag_164753.mp3") {"continent":"Europe","country":"France","logo300x300":"http://static.radio.fr/images/broadcasts/15/43/8275/1/c300.png","city":"Paris","stationType":"radio_station","description":"Virgin Radio est une station de radio musicale privée Française. Elle a été créée en 2008, suite au changement de nom de la radio Europe 2, et fait partie du groupe Lagardère SCA. La radio cible une audience de jeunes adultes grâce aux hits Electro-Rock et Pop qu’elle propose. L’audience de la chaîne dépasse les 2,7 millions d’auditeurs quotidiens.\r\nCette radio FM est disponible dorénavant par internet grâce à ses flux de diffusion MP3 de 64 et 128 kbps.\r\nAprès son passage à vide du début des années 2010, Virgin Radio revient en force avec son son “Pop - Rock - Electro”.","language":["Français"],"logo100x100":"http://static.radio.fr/images/broadcasts/15/43/8275/1/c100.png","streamUrls":[{"streamUrl":"http://mp3lg4.tdf-cdn.com/9243/lag_164753.mp3","loadbalanced":false,"metaDataAvailable":false,"playingMode":"STEREO","type":"STREAM","sampleRate":44100,"streamContentFormat":"MP3","bitRate":128,"idBroadcast":8275,"sortOrder":0,"streamFormat":"ICECAST","id":47609,"streamStatus":"VALID","contentType":"audio/mpeg"},{"streamUrl":"http://mp3lg3.scdn.arkena.com/10490/virginradio.mp3","loadbalanced":false,"metaDataAvailable":false,"playingMode":"STEREO","type":"STREAM","sampleRate":44100,"streamContentFormat":"MP3","bitRate":64,"idBroadcast":8275,"sortOrder":1,"streamFormat":"ICECAST","id":57003,"streamStatus":"VALID","contentType":"audio/mpeg"}],"playable":"PLAYABLE","genres":["Pop","Rock"],"logo175x175":"http://static.radio.fr/images/broadcasts/15/43/8275/1/c175.png","adParams":{"st_city":["Paris"],"languages":["Français"],"genres":["Pop","Rock"],"topics":[],"st_cont":["Europe"],"station":["virginradio"],"family":["Virgin"],"st_region":[],"type":["radio_station"],"st_country":["France"]},"alias":"Virgin;;Virgin Radio;;103.5;;103,5;Pop Rock Electro","rank":8,"id":8275,"types":["Radio FM"],"website":"http://www.virginradio.fr/","topics":[],"shortDescription":"Virgin Radio propose d'écouter le meilleur des sons “Pop - Rock - Electro”","logo44x44":"http://static.radio.fr/images/broadcasts/15/43/8275/1/c44.png","numberEpisodes":0,"podcastUrls":[],"hideReferer":false,"name":"Virgin Radio Officiel","subdomain":"virginradio","lastModified":"2018-05-10T03:18:17.000Z","family":["Virgin"],"region":"","frequencies":[{"area":"Abbeville","broadcastId":8275,"frequencyType":"FM","cityId":0,"id":2299,"frequency":99.6},{"area":"Agen","broadcastId":8275,"frequencyType":"FM","cityId":4416,"id":2317,"frequency":89.8},{"area":"Ajaccio","broadcastId":8275,"frequencyType":"FM","cityId":165,"id":2370,"frequency":99.8},
0debug
void * g_malloc0(size_t size) { return g_malloc(size); }
1threat
"WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41" during "conda install" : <p>Starting today I get a lot of </p> <blockquote> <p>WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41</p> </blockquote> <p>warnings when I try to update or install packages using <code>conda install</code> or <code>conda update</code>. For example:</p> <pre><code>(...) C:\Users\...&gt; conda install numba Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\...: The following packages will be DOWNGRADED due to dependency conflicts: numba: 0.30.0-np111py35_0 --&gt; 0.30.1-np111py35_0 Proceed ([y]/n)? y numba-0.30.0-np111p35_0 100% |###############################| Time: 0:00:00 2.50 MB/s WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 WARNING conda.gateways.disk:exp_backoff_fn(47): Uncaught backoff with errno 41 </code></pre> <p>The packages are installed afterwards but all these Warnings seem to indicate that something doesn't work properly.</p> <pre><code>OS: Windows 10 64 bit conda: 4.3.4 </code></pre> <p>Could you tell what I need to do to fix these Warnings? Or can I ignore them?</p>
0debug
How can a const expr be evaluated so fast : <p>I have been trying out const expressions which are evaluated at compile time. But I played with an example that seems incredibly fast when executed at compile time.</p> <pre><code>#include&lt;iostream&gt; constexpr long int fib(int n) { return (n &lt;= 1)? n : fib(n-1) + fib(n-2); } int main () { long int res = fib(45); std::cout &lt;&lt; res; return 0; } </code></pre> <p>When I run this code it takes about 7 seconds to run. So far so good. But when I change <code>long int res = fib(45)</code> to <code>const long int res = fib(45)</code> it takes not even a second. To my understanding it is evaluated at compile time. <strong>But the compilation takes about 0.3 seconds</strong></p> <p>How can the compiler evaluate this so quickly, but at runtime it takes so much more time? I'm using gcc 5.4.0.</p>
0debug
static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ int v; v = h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] | h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit; if(h->list_count==2){ if(!v) v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] | h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit; if(v){ if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] | h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx]) return 1; return h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit | h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit; } } return v; }
1threat
Where should I save created files? : <p>I need to save users created pdf files somewhere. I wanted to save files to ClassPathResource (but I read that It is not a good idea), because I need one thing... Application must work on every computer... so I cannot save it directly on my disc... Any recommendation, where I could save pdf files to make it work as I need?</p>
0debug
Generating an evenly sized matrix by a given number in python? : I have a python list containing `n` items. I would like to place the items in an (nearly) evenly sized matrix. I mean, if number of elements is 2, then matrix size would be 1*1, number of items 4, matrix size: 2*2 number of items 5, matrix size: 3*2 number of items 6, matrix size: 3*2 number of items 7, matrix size: 3*3 I hope you understood the problem.
0debug
Optymalize autohotkey code / send keyboard code : I'm impressed what autohotkey can do. How can i Optymalize that code? What I need to know? SetTitleMatchMode RegEx ; ::/act1:: Send {LControl down} Send {LShift down} Send {m} Send {LControl up} Send {LShift up} Send {Left 3} Send {LShift down} Send {Home} Send {LShift up} Send {LControl down} Send {c} Send {LControl up} WinActivate WidnowA Send {LControl down} Send {Home} Send {LControl up} Send {Down 1} Send {Right 12} Send {LControl down}+{v} Send {LControl up} Send {,} Send {Space} Send {LControl down} Send {s} Send {LControl up} CoordMode, Mouse, Screen x := 150 y := 1420 Click %x% %Y% Send {Right 3} return I think that no need to describe the sections, but.. can I write it another (easiest) way? Thanks
0debug
How can I get the text input from the user and count the words i am searching : <p>I am using fgets to get a sentence from the user and i am trying to get words and count on c code then print it. Exapmle: i want to count "Hello". When the program starts user write "Hello World Hello" and then the program prints "Hello used 2 times".</p>
0debug
VueJS v-if = array[index] is not working : <p>I wanted to make a component which gets text-box when mouse is over the image.</p> <p>Below is HTML template.</p> <pre><code>&lt;section class="item-container" v-for="(item, index) in items"&gt; &lt;div class="image-box" @mouseenter="changeStatus(index)"&gt; &lt;img class="image" src="item.link" alt&gt; &lt;/div&gt; &lt;div class="text-box" @mouseleave="changeStatus(index)" v-if="show[index]"&gt; &lt;h4&gt;{{ item.name }}&lt;/h4&gt; &lt;p&gt;{{ item.content }}&lt;/p&gt; &lt;/div&gt; &lt;/section&gt; </code></pre> <p>And below is app.js</p> <pre><code>new Vue({ el: '#app', data: { show: [false, false, false], items: [ { name: 'Author 1', content: 'Content 1' }, { name: 'Author 2', content: 'Content 2' }, { name: 'Author 3', content: 'Content 3' } ] }, methods: { changeStatus: function(index) { this.show[index] = !this.show[index]; console.log(this.show); console.log(this.show[index]); // console gets it as expected } } }); </code></pre> <p>When I execute above codes, I can find that the show property has changed. However, v-if is not updated. Can't we use array[index] for v-if or is there other reason for it?</p>
0debug
Bundle display name missing space characters : <p>When I give Bundle display name with space as "A B C D", I get the app name as "ABCD". This happens only on the iOS 11.I tried override name"CFBundleDisplayName" in my InfoPlist.string and use special unicode character \U00A0 (No-break space) and it doesn't help me.</p>
0debug
android mkdirs not working : <p>i need to save an image from camera on android. i used the write external storage permission in manifest and i am using this code</p> <pre><code>File dir = new File(Environment.getExternalStorageDirectory(), "Test"); if (!dir.exists() || !dir.isDirectory()) dir.mkdirs(); String path = dir.getAbsolutePath(); Log.d(TAG, path); //log show the path File file = new File(dir.getAbsolutePath() + "/Pic.jpg"); Log.d(TAG, file.getAbsolutePath()); //again path is shown here outStream = new FileOutputStream(file); outStream.write(bytes); outStream.close(); Log.d(TAG, "onPictureTaken - wrote bytes: " + bytes.length); //fail here } catch (FileNotFoundException e) { Log.d(TAG, "not done"); //error is here (this exception is thrown) } catch (IOException e) { Log.d(TAG, "not"); } finally { } </code></pre> <p>i also tried mkdir() instead of mkdirs() same result.</p> <p>any idea what went wrong in the code? </p> <p>thanks</p>
0debug
static void cmd646_cmd_write(void *opaque, target_phys_addr_t addr, uint64_t data, unsigned size) { CMD646BAR *cmd646bar = opaque; if (addr != 2 || size != 1) { return; } ide_cmd_write(cmd646bar->bus, addr + 2, data); }
1threat
Macro to generate several instances by editing the master copy : https://www.dropbox.com/s/v4zpig6i58...pture.JPG?dl=0 Above is a screenshot of what I would like to change. In the picture the ### needs to be replaced by N01 N02 N10 etc this will be specified as required because it wont be in an order (can be N01, N05, N12 etc) and the rest needs to be copy pasted. This needs to be generated in a new worksheet. The newly generated worksheet will have all the instances of N01, N02 etc populated together. Screenshot of the required result is given below https://www.dropbox.com/s/7h9a5cvubo...ure12.JPG?dl=0
0debug
Parallel for loop in c++ :     Parallel.For(<your starting value >,<End criteria for loop>, delegate(int < your variable Name>)                 {                     // Your own code        });  Here above showing example code in c#. I am want similar functionality in c++
0debug
Variable assigned but never used : <pre><code>int price; if (listBox1.Text == "Regular McYum") { price = 70; } </code></pre> <p>How come the 'price' variable is assigned but never used? </p>
0debug
looping thought dict inside list in python : can someone help me learn how to loop through the items listed below? I am getting a dict inside a list. Trying to learn how to get each item by itself `This is the results that i get when I connect` `[ { "Index": "NASDAQ", "ExtHrsChange": "-0.22", "LastTradePrice": "972.92", "LastTradeWithCurrency": "972.92", } ] `
0debug
How to calculate percentage of count to specific condition? : <p>I have data which look something like this.</p> <pre><code>company date auditor change count A 2016 ZXY 0 1 A 2015 ZXY 0 2 A 2014 ZXY 0 3 A 2013 FPQ 1 4 A 2012 ZXY 1 5 B 2017 ERW 0 1 B 2016 ERW 0 2 B 2015 ERW 0 3 B 2014 ERW 0 4 B 2013 ERW 0 5 . . . . </code></pre> <p>This data tells whether auditor has switched in last five year. If there is switch then change value is '1'. I want to calculate</p> <p>1) Percentage of companies who had switch in last year (count=1).</p> <p>2) Percentage of companies who had no switch in last five year (change=0 for count=1,2,3,4,5).</p> <p>3) Percentage of companies who experienced change more than once in five year (change=1 for count= more than once)</p> <p>I just want the logic of how to do it.</p>
0debug
static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn) { int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); int imm9 = sextract32(insn, 12, 9); int opc = extract32(insn, 22, 2); int size = extract32(insn, 30, 2); int idx = extract32(insn, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (idx == 2); bool is_vector = extract32(insn, 26, 1); bool post_index; bool writeback; TCGv_i64 tcg_addr; if (is_vector) { size |= (opc & 2) << 1; if (size > 4 || is_unpriv) { unallocated_encoding(s); return; } is_store = ((opc & 1) == 0); if (!fp_access_check(s)) { return; } } else { if (size == 3 && opc == 2) { if (is_unpriv) { unallocated_encoding(s); return; } return; } if (opc == 3 && size > 1) { unallocated_encoding(s); return; } is_store = (opc == 0); is_signed = opc & (1<<1); is_extended = (size < 3) && (opc & 1); } switch (idx) { case 0: case 2: post_index = false; writeback = false; break; case 1: post_index = true; writeback = true; break; case 3: post_index = false; writeback = true; break; } if (rn == 31) { gen_check_sp_alignment(s); } tcg_addr = read_cpu_reg_sp(s, rn, 1); if (!post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } if (is_vector) { if (is_store) { do_fp_st(s, rt, tcg_addr, size); } else { do_fp_ld(s, rt, tcg_addr, size); } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); int memidx = is_unpriv ? 1 : get_mem_index(s); if (is_store) { do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx); } else { do_gpr_ld_memidx(s, tcg_rt, tcg_addr, size, is_signed, is_extended, memidx); } } if (writeback) { TCGv_i64 tcg_rn = cpu_reg_sp(s, rn); if (post_index) { tcg_gen_addi_i64(tcg_addr, tcg_addr, imm9); } tcg_gen_mov_i64(tcg_rn, tcg_addr); } }
1threat
Hide website from users browser history : <p>I am about to begin work on an information and support services website for victims of domestic and sexual abuse. Naturally, the user's visit to this website is sensitive and the repercussions of their abuser finding out that they have could be devastating. Therefore, I am seeking a way to keep the user's visit as discreet as possible.</p> <p>I cannot assume the technical knowledge of each user and there are likely to be users of a wide variety of languages. Also, there is the possibility they will need to exit the site quickly (I have the solution for this) and perhaps may not be able to return to the computer before being discovered. So, while the most obvious solution is to have a page educating users on how to clear their browsing history - this may not be the most foolproof method in practice. Because of all the variables in play, a blanket solution would be the best solution.</p> <p>So far, I can think of two solutions to this but am hitting a wall with both:</p> <p>Firstly, simply not have the website recorded in the browsers' search history. From what I have read this is going to be problematic between browsers if not impossible to implement. </p> <p>The second would be to have a landing page at an innocuous domain name that wouldn't draw suspicion and then have a button that automatically loaded the website through a Private or Incognito browser (I could simply write instructions, 'Right Click on the Button and Select 'Open in an Incognito Browser' - but I am searching for a more foolproof solution if possible).</p> <p>While some incarnation of the second solution seems more plausible - I need to consider that abusers searching through browser history is a possibility and therefore, the first solution is the most desirable.</p> <p>Any ideas on either of these two methods or anything more ideas you have would be most welcomed.</p>
0debug
int av_read_play(AVFormatContext *s) { if (s->iformat->read_play) return s->iformat->read_play(s); if (s->pb && s->pb->read_pause) return av_url_read_fpause(s->pb, 0); return AVERROR(ENOSYS); }
1threat
static int write_reftable_entry(BlockDriverState *bs, int rt_index) { BDRVQcowState *s = bs->opaque; uint64_t buf[RT_ENTRIES_PER_SECTOR]; int rt_start_index; int i, ret; rt_start_index = rt_index & ~(RT_ENTRIES_PER_SECTOR - 1); for (i = 0; i < RT_ENTRIES_PER_SECTOR; i++) { buf[i] = cpu_to_be64(s->refcount_table[rt_start_index + i]); } ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT & ~QCOW2_OL_REFCOUNT_TABLE, s->refcount_table_offset + rt_start_index * sizeof(uint64_t), sizeof(buf)); if (ret < 0) { return ret; } BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_UPDATE); ret = bdrv_pwrite_sync(bs->file, s->refcount_table_offset + rt_start_index * sizeof(uint64_t), buf, sizeof(buf)); if (ret < 0) { return ret; } return 0; }
1threat
float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) { float q; int qmin, qmax; float br_compensation; double diff; double short_term_q; double fps; int picture_number = s->picture_number; int64_t wanted_bits; RateControlContext *rcc = &s->rc_context; AVCodecContext *a = s->avctx; RateControlEntry local_rce, *rce; double bits; double rate_factor; int var; const int pict_type = s->pict_type; Picture * const pic = &s->current_picture; emms_c(); #if CONFIG_LIBXVID if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) return ff_xvid_rate_estimate_qscale(s, dry_run); #endif get_qminmax(&qmin, &qmax, s, pict_type); fps = get_fps(s->avctx); if (picture_number > 2 && !dry_run) { const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; av_assert1(s->frame_bits >= s->stuffing_bits); update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits - s->stuffing_bits); } if (s->flags & CODEC_FLAG_PASS2) { assert(picture_number >= 0); if (picture_number >= rcc->num_entries) { av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); return -1; } rce = &rcc->entry[picture_number]; wanted_bits = rce->expected_bits; } else { Picture *dts_pic; rce = &local_rce; if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) dts_pic = s->current_picture_ptr; else dts_pic = s->last_picture_ptr; if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); else wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f.pts / fps); } diff = s->total_bits - wanted_bits; br_compensation = (a->bit_rate_tolerance - diff) / a->bit_rate_tolerance; if (br_compensation <= 0.0) br_compensation = 0.001; var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; short_term_q = 0; if (s->flags & CODEC_FLAG_PASS2) { if (pict_type != AV_PICTURE_TYPE_I) assert(pict_type == rce->new_pict_type); q = rce->new_qscale / br_compensation; av_dlog(s, "%f %f %f last:%d var:%d type:%d br_compensation, s->frame_bits, var, pict_type); } else { rce->pict_type = rce->new_pict_type = pict_type; rce->mc_mb_var_sum = pic->mc_mb_var_sum; rce->mb_var_sum = pic->mb_var_sum; rce->qscale = FF_QP2LAMBDA * 2; rce->f_code = s->f_code; rce->b_code = s->b_code; rce->misc_bits = 1; bits = predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var)); if (pict_type == AV_PICTURE_TYPE_I) { rce->i_count = s->mb_num; rce->i_tex_bits = bits; rce->p_tex_bits = 0; rce->mv_bits = 0; } else { rce->i_count = 0; rce->i_tex_bits = 0; rce->p_tex_bits = bits * 0.9; rce->mv_bits = bits * 0.1; } rcc->i_cplx_sum[pict_type] += rce->i_tex_bits * rce->qscale; rcc->p_cplx_sum[pict_type] += rce->p_tex_bits * rce->qscale; rcc->mv_bits_sum[pict_type] += rce->mv_bits; rcc->frame_count[pict_type]++; bits = rce->i_tex_bits + rce->p_tex_bits; rate_factor = rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum * br_compensation; q = get_qscale(s, rce, rate_factor, picture_number); if (q < 0) return -1; assert(q > 0.0); q = get_diff_limited_q(s, rce, q); assert(q > 0.0); if (pict_type == AV_PICTURE_TYPE_P || s->intra_only) { rcc->short_term_qsum *= a->qblur; rcc->short_term_qcount *= a->qblur; rcc->short_term_qsum += q; rcc->short_term_qcount++; q = short_term_q = rcc->short_term_qsum / rcc->short_term_qcount; } assert(q > 0.0); q = modify_qscale(s, rce, q, picture_number); rcc->pass1_wanted_bits += s->bit_rate / fps; assert(q > 0.0); } if (s->avctx->debug & FF_DEBUG_RC) { av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " "size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n", av_get_picture_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits / 1000, (int)s->total_bits / 1000, br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate / 1000, (int)fps); } if (q < qmin) q = qmin; else if (q > qmax) q = qmax; if (s->adaptive_quant) adaptive_quantization(s, q); else q = (int)(q + 0.5); if (!dry_run) { rcc->last_qscale = q; rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum; rcc->last_mb_var_sum = pic->mb_var_sum; } return q; }
1threat
static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int fd = -1; int is_listen; int is_waitconnect; int do_nodelay; int is_unix; int is_telnet; is_listen = qemu_opt_get_bool(opts, "server", 0); is_waitconnect = qemu_opt_get_bool(opts, "wait", 1); is_telnet = qemu_opt_get_bool(opts, "telnet", 0); do_nodelay = !qemu_opt_get_bool(opts, "delay", 1); is_unix = qemu_opt_get(opts, "path") != NULL; if (!is_listen) is_waitconnect = 0; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); if (is_unix) { if (is_listen) { fd = unix_listen_opts(opts); } else { fd = unix_connect_opts(opts); } } else { if (is_listen) { fd = inet_listen_opts(opts, 0, NULL); } else { fd = inet_connect_opts(opts, true, NULL, NULL); } } if (fd < 0) { goto fail; } if (!is_waitconnect) socket_set_nonblock(fd); s->connected = 0; s->fd = -1; s->listen_fd = -1; s->msgfd = -1; s->is_unix = is_unix; s->do_nodelay = do_nodelay && !is_unix; chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; if (is_listen) { s->listen_fd = fd; qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); if (is_telnet) s->do_telnetopt = 1; } else { s->connected = 1; s->fd = fd; socket_set_nodelay(fd); tcp_chr_connect(chr); } chr->filename = g_malloc(256); if (is_unix) { snprintf(chr->filename, 256, "unix:%s%s", qemu_opt_get(opts, "path"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else if (is_telnet) { snprintf(chr->filename, 256, "telnet:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else { snprintf(chr->filename, 256, "tcp:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } if (is_listen && is_waitconnect) { printf("QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(chr); socket_set_nonblock(s->listen_fd); } return chr; fail: if (fd >= 0) closesocket(fd); g_free(s); g_free(chr); return NULL; }
1threat
Sum unique names of column with thouthands of rows : <p>Hello I'm trying all the unique different names and amounts on a sheet, I'm trying to create a macro that collects all the names and sums the payments next to it. Names are in column A and payiments on column B and I need the sum in columns C-Name and D-Total.</p> <p>How is this done in VBA.</p> <p>Thank you.</p>
0debug
Undefined function 'STR_TO_DATE' in expression c# : i get the following error System.Data.OleDb.OleDbException (0x80040E14): Undefined function 'STR_TO_DATE' in expression. in access database when i run this query SELECT ProductCode, Description, SUM(Quantity) as Quantity, STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') as DateIn FROM Product as P, StockIn as S WHERE S.ProductNo = P.ProductNo AND STR_TO_DATE(REPLACE(DateIn, '-', '/'), '%m/%d/%Y') BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + EndDate.ToString("yyyy-MM-dd") + "' GROUP BY P.ProductNo, DateIN ORDER BY DateIn, Description";
0debug
How to change default browser with VS Code's "open with live server"? : <p>It defaults to my safari but would like to change it to chrome. I looked in preferences, but there doesn't seem to be an option for that. Any ideas? </p>
0debug
void HELPER(stfl)(CPUS390XState *env) { uint64_t words[MAX_STFL_WORDS]; do_stfle(env, words); cpu_stl_data(env, 200, words[0] >> 32); }
1threat
Passing data to PageKeyedDataSource : <p>I am using <a href="https://developer.android.com/reference/android/arch/paging/PageKeyedDataSource.LoadInitialCallback" rel="noreferrer">PageKeyedDataSource</a> to make paging by calling an API and using Retrofit.</p> <p>And I am using <strong>Dagger 2</strong> to make the dependency injection.</p> <pre><code>@Provides Repository provideRepository(...) { ... } @Provides PageKeyedVideosDataSource providePageKeyeVideosDataSource(Repository repository) { ... } @Provides VideoDataSourceFactory provideVideoDataSourceFactory(PageKeyedHomeVideosDataSource pageKeyedHomeVideosDataSource) { ... } @Provides ViewModelFactory provideViewModelFactory(Repository repository, VideoDataSourceFactory videoDataSourceFactory) { ... } </code></pre> <p>Now, I need to do the same thing, however my call needs a new parameter: an id. </p> <pre><code>@GET(Urls.VIDEOS_BY_CATEGORY) Observable&lt;RequestVideo&gt; getVideosByCategory( @Path("id") int categoryId, // &lt;-- Now I need this new parameter @Query("per-page") int perPage, @Query("page") int page); </code></pre> <p>Before, my PageKeyedVideosDataSource needed only the page and the per-page to make the call, it was easy. However, now I need to put this new parameter id dynamically inside the PageKeyedDataSource.</p> <p>I saw <a href="https://github.com/googlesamples/android-architecture-components/tree/master/PagingWithNetworkSample" rel="noreferrer">PagingWithNetworkSample</a> and figured it out that they put a new parameter in PagedKeyedDataSource by adding it in the constructor. Then, I thought about doing this:</p> <pre><code>public PageKeyedCategoryVideosDataSource(int categoryId, Repository repository) { this.categoryId = categoryId; this.repository = repository; } </code></pre> <p>However, if I add the id in the constructor, I think I'll not be able to use dagger 2 anymore because by using dagger 2 the PageKeyedVideosDataSource is not created dynamically, therefore, I can't keep changing the value of the id.</p> <p>I need to create the PageKeyedDataSource dynamically like this:</p> <pre><code>int categoryId = getCategoryId(); PageKeyedVideosDataSource dataSource = new PageKeyedVideosDataSource(categoryId, repository); </code></pre> <ul> <li>Should I do this and not use Dagger 2?</li> <li>Is it possible to dynamically create the DataSource still using Dagger 2?</li> </ul>
0debug
static int old_codec47(SANMVideoContext *ctx, int top, int left, int width, int height) { int i, j, seq, compr, new_rot, tbl_pos, skip; int stride = ctx->pitch; uint8_t *dst = ((uint8_t*)ctx->frm0) + left + top * stride; uint8_t *prev1 = (uint8_t*)ctx->frm1; uint8_t *prev2 = (uint8_t*)ctx->frm2; uint32_t decoded_size; tbl_pos = bytestream2_tell(&ctx->gb); seq = bytestream2_get_le16(&ctx->gb); compr = bytestream2_get_byte(&ctx->gb); new_rot = bytestream2_get_byte(&ctx->gb); skip = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 9); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); if (decoded_size > height * stride - left - top * stride) { decoded_size = height * stride - left - top * stride; av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } if (skip & 1) bytestream2_skip(&ctx->gb, 0x8080); if (!seq) { ctx->prev_seq = -1; memset(prev1, 0, ctx->height * stride); memset(prev2, 0, ctx->height * stride); } av_dlog(ctx->avctx, "compression %d\n", compr); switch (compr) { case 0: if (bytestream2_get_bytes_left(&ctx->gb) < width * height) return AVERROR_INVALIDDATA; for (j = 0; j < height; j++) { bytestream2_get_bufferu(&ctx->gb, dst, width); dst += stride; } break; case 1: if (bytestream2_get_bytes_left(&ctx->gb) < ((width + 1) >> 1) * ((height + 1) >> 1)) return AVERROR_INVALIDDATA; for (j = 0; j < height; j += 2) { for (i = 0; i < width; i += 2) { dst[i] = dst[i + 1] = dst[stride + i] = dst[stride + i + 1] = bytestream2_get_byteu(&ctx->gb); } dst += stride * 2; } break; case 2: if (seq == ctx->prev_seq + 1) { for (j = 0; j < height; j += 8) { for (i = 0; i < width; i += 8) { if (process_block(ctx, dst + i, prev1 + i, prev2 + i, stride, tbl_pos + 8, 8)) return AVERROR_INVALIDDATA; } dst += stride * 8; prev1 += stride * 8; prev2 += stride * 8; } } break; case 3: memcpy(ctx->frm0, ctx->frm2, ctx->pitch * ctx->height); break; case 4: memcpy(ctx->frm0, ctx->frm1, ctx->pitch * ctx->height); break; case 5: if (rle_decode(ctx, dst, decoded_size)) return AVERROR_INVALIDDATA; break; default: av_log(ctx->avctx, AV_LOG_ERROR, "subcodec 47 compression %d not implemented\n", compr); return AVERROR_PATCHWELCOME; } if (seq == ctx->prev_seq + 1) ctx->rotate_code = new_rot; else ctx->rotate_code = 0; ctx->prev_seq = seq; return 0; }
1threat
void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp) { long k, n8, n4, n2, n; const uint16_t *revtab = s->fft.revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)tmp; n = 1 << s->nbits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; asm volatile ("movaps %0, %%xmm7\n\t"::"m"(*p1m1p1m1)); in1 = input; in2 = input + n2 - 4; for (k = 0; k < n4; k += 2) { asm volatile ( "movaps %0, %%xmm0 \n\t" "movaps %1, %%xmm3 \n\t" "movlps %2, %%xmm1 \n\t" "movlps %3, %%xmm2 \n\t" "shufps $95, %%xmm0, %%xmm0 \n\t" "shufps $160,%%xmm3, %%xmm3 \n\t" "unpcklps %%xmm2, %%xmm1 \n\t" "movaps %%xmm1, %%xmm2 \n\t" "xorps %%xmm7, %%xmm2 \n\t" "mulps %%xmm1, %%xmm0 \n\t" "shufps $177,%%xmm2, %%xmm2 \n\t" "mulps %%xmm2, %%xmm3 \n\t" "addps %%xmm3, %%xmm0 \n\t" ::"m"(in2[-2*k]), "m"(in1[2*k]), "m"(tcos[k]), "m"(tsin[k]) ); asm ( "movlps %%xmm0, %0 \n\t" "movhps %%xmm0, %1 \n\t" :"=m"(z[revtab[k]]), "=m"(z[revtab[k + 1]]) ); } ff_fft_calc_sse(&s->fft, z); asm volatile ("movaps %0, %%xmm7\n\t"::"m"(*p1m1p1m1)); for (k = 0; k < n4; k += 2) { asm ( "movaps %0, %%xmm0 \n\t" "movlps %1, %%xmm1 \n\t" "movaps %%xmm0, %%xmm3 \n\t" "movlps %2, %%xmm2 \n\t" "shufps $160,%%xmm0, %%xmm0 \n\t" "shufps $245,%%xmm3, %%xmm3 \n\t" "unpcklps %%xmm2, %%xmm1 \n\t" "movaps %%xmm1, %%xmm2 \n\t" "xorps %%xmm7, %%xmm2 \n\t" "mulps %%xmm1, %%xmm0 \n\t" "shufps $177,%%xmm2, %%xmm2 \n\t" "mulps %%xmm2, %%xmm3 \n\t" "addps %%xmm3, %%xmm0 \n\t" "movaps %%xmm0, %0 \n\t" :"+m"(z[k]) :"m"(tcos[k]), "m"(tsin[k]) ); } k = 16-n; asm volatile("movaps %0, %%xmm7 \n\t"::"m"(*m1m1m1m1)); asm volatile( "1: \n\t" "movaps -16(%4,%0), %%xmm1 \n\t" "neg %0 \n\t" "movaps (%4,%0), %%xmm0 \n\t" "xorps %%xmm7, %%xmm0 \n\t" "movaps %%xmm0, %%xmm2 \n\t" "shufps $141,%%xmm1, %%xmm0 \n\t" "shufps $216,%%xmm1, %%xmm2 \n\t" "shufps $156,%%xmm0, %%xmm0 \n\t" "shufps $156,%%xmm2, %%xmm2 \n\t" "movaps %%xmm0, (%1,%0) \n\t" "movaps %%xmm2, (%2,%0) \n\t" "neg %0 \n\t" "shufps $27, %%xmm0, %%xmm0 \n\t" "xorps %%xmm7, %%xmm0 \n\t" "shufps $27, %%xmm2, %%xmm2 \n\t" "movaps %%xmm0, -16(%2,%0) \n\t" "movaps %%xmm2, -16(%3,%0) \n\t" "add $16, %0 \n\t" "jle 1b \n\t" :"+r"(k) :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8) :"memory" ); }
1threat
static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, RBDAIOCmd cmd) { RBDAIOCB *acb; RADOSCB *rcb; rbd_completion_t c; int64_t off, size; char *buf; int r; BDRVRBDState *s = bs->opaque; acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque); acb->cmd = cmd; acb->qiov = qiov; if (cmd == RBD_AIO_DISCARD) { acb->bounce = NULL; } else { acb->bounce = qemu_blockalign(bs, qiov->size); } acb->ret = 0; acb->error = 0; acb->s = s; acb->cancelled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; if (cmd == RBD_AIO_WRITE) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); } buf = acb->bounce; off = sector_num * BDRV_SECTOR_SIZE; size = nb_sectors * BDRV_SECTOR_SIZE; s->qemu_aio_count++; rcb = g_malloc(sizeof(RADOSCB)); rcb->done = 0; rcb->acb = acb; rcb->buf = buf; rcb->s = acb->s; rcb->size = size; r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, &c); if (r < 0) { goto failed; } switch (cmd) { case RBD_AIO_WRITE: r = rbd_aio_write(s->image, off, size, buf, c); break; case RBD_AIO_READ: r = rbd_aio_read(s->image, off, size, buf, c); break; case RBD_AIO_DISCARD: r = rbd_aio_discard_wrapper(s->image, off, size, c); break; default: r = -EINVAL; } if (r < 0) { goto failed; } return &acb->common; failed: g_free(rcb); s->qemu_aio_count--; qemu_aio_release(acb); return NULL; }
1threat
static void next(DBDMA_channel *ch) { uint32_t cp; ch->regs[DBDMA_STATUS] &= cpu_to_be32(~BT); cp = be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]); ch->regs[DBDMA_CMDPTR_LO] = cpu_to_be32(cp + sizeof(dbdma_cmd)); dbdma_cmdptr_load(ch); }
1threat
can't run vagrant for laravel homestead : <p>i want to use laravel/homestead. i do all steps one by one according to below url <a href="https://medium.com/@eaimanshoshi/i-am-going-to-write-down-step-by-step-procedure-to-setup-homestead-for-laravel-5-2-17491a423aa" rel="nofollow noreferrer">https://medium.com/@eaimanshoshi/i-am-going-to-write-down-step-by-step-procedure-to-setup-homestead-for-laravel-5-2-17491a423aa</a></p> <p>but when i send this command -> 'vagrant up' i get these warnings and errors</p> <p>C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:68: warning: already initialized constant Win32::WCHAR C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:68: warning: previous definition of WCHAR was here C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:69: warning: already initialized constant Win32::WCHAR_NUL C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:69: warning: previous definition of WCHAR_NUL was here C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:70: warning: already initialized constant Win32::WCHAR_CR C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:70: warning: previous definition of WCHAR_CR was here C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:71: warning: already initialized constant Win32::WCHAR_SIZE C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:71: warning: previous definition of WCHAR_SIZE was here C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/win32/registry.rb:72:in `find': unknown encoding name - CP720 (ArgumentError)</p>
0debug
Find if word exist in array or string PHP : <p>I am trying to find if any of the string inside an array exist in array of words.</p> <p>For example:</p> <pre><code>$key = ["sun","clouds"]; $results = ["Sun is hot","Too many clouds"]; </code></pre> <p>If any of <code>$key</code> exists in <code>$results</code> to return <code>true</code></p> <p>With below script I get the result I want but only if word in <code>$results</code> is exact like the word in <code>$key</code>.</p> <pre><code>function contain($key = [], $results){ $record_found = false; if(is_array($results)){ // Loop through array foreach ($results as $result) { $found = preg_match_all("/\b(?:" .join($key, '|'). ")\b/i", $result, $matches); if ($found) { $record_found = true; } } } else { // Scan string to find word $found = preg_match_all("/\b(?:" .join($key, '|'). ")\b/i", $results, $matches); if ($found) { $record_found = true; } } return $record_found; } </code></pre> <p>If the word in <code>$results</code> is <code>Enjoy all year round **sunshine**</code> my function returns <code>false</code> as can not find word sun. How can I change my function to return true if string contain that string as part of word?</p> <p>I want the word <code>sun</code> to match even with <code>sun</code> or <code>sunshine</code>.</p> <p>TIA</p>
0debug
How does string works in c#? : <p>I know strings are inmutable, once created we cannot change it, I've read that if we create a new string object and we assign a value to it and then we assign another value to the same string object internally there is actually another object created and assigned with the new value. Let's say I have:</p> <pre><code>string str = "dog"; str = "cat"; </code></pre> <p>If I write <code>Console.WriteLine(str);</code> it returns <code>cat</code>. So internally there are two objects? But they have the same name? How does it works? I've made some research on google but I have not find yet something convincing enough to me so I can clarify my thoughts about this. I know strings are reference types, so we have an object in the stack with a reference to a value in the heap, what's happening in this case?(see code above).</p> <p>I've upload a picture, apologize me if I'm wrong about the idea of the stack and the heap that's why I'm asking this question. Does the picture reflects what happens in the first line of code(<code>string str = "dog";</code>)? And then what should happen in the second line of code?? The <code>dog</code> value in the heap changes? And then a new object in the stack is created referencing it? Then what happens with the object that was there before? Do they have the same name? I'm sorry for so many questions but I think that is very important to understand this correctly and to know what's happening behind the scenes...<a href="https://i.stack.imgur.com/3laO8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3laO8.png" alt="enter image description here"></a></p>
0debug
why do I get an ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0? : <p>I keep an error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0" even though i've referenced this array bounds in the method.</p> <pre><code>`public class USCrimeLibrary public static void main(String[] args) { Scanner scan = new Scanner(System.in); USCrimeObject crimeObject = new USCrimeObject(args[0]); ` </code></pre> <p>and the reference object:</p> <pre><code>`public class USCrimeObject { private Crime[] crimes; String fileName = "/Users/jpl/Developer/Java/CMIS141/WK8/Crime.csv"; public USCrimeObject(String fileName) { this.crimes = new Crime[20]; readFile(fileName); }` </code></pre>
0debug
static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) { const AVPixFmtDescriptor *desc; mfxSession session = NULL; int iopattern = 0; mfxVideoParam param = { { 0 } }; int frame_width = avctx->coded_width; int frame_height = avctx->coded_height; int ret; desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); if (!desc) return AVERROR_BUG; if (!q->async_fifo) { q->async_fifo = av_fifo_alloc((1 + q->async_depth) * (sizeof(mfxSyncPoint*) + sizeof(QSVFrame*))); if (!q->async_fifo) return AVERROR(ENOMEM); } if (avctx->pix_fmt == AV_PIX_FMT_QSV && avctx->hwaccel_context) { AVQSVContext *user_ctx = avctx->hwaccel_context; session = user_ctx->session; iopattern = user_ctx->iopattern; q->ext_buffers = user_ctx->ext_buffers; q->nb_ext_buffers = user_ctx->nb_ext_buffers; } if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; if (!iopattern) { if (frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME) iopattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY; else if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY; } frame_width = frames_hwctx->surfaces[0].Info.Width; frame_height = frames_hwctx->surfaces[0].Info.Height; } if (!iopattern) iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; q->iopattern = iopattern; ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n"); return ret; } ret = ff_qsv_codec_id_to_mfx(avctx->codec_id); if (ret < 0) return ret; param.mfx.CodecId = ret; param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile); param.mfx.CodecLevel = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level; param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; param.mfx.FrameInfo.FourCC = q->fourcc; param.mfx.FrameInfo.Width = frame_width; param.mfx.FrameInfo.Height = frame_height; param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; switch (avctx->field_order) { case AV_FIELD_PROGRESSIVE: param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; break; case AV_FIELD_TT: param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF; break; case AV_FIELD_BB: param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_BFF; break; default: param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_UNKNOWN; break; } param.IOPattern = q->iopattern; param.AsyncDepth = q->async_depth; param.ExtParam = q->ext_buffers; param.NumExtParam = q->nb_ext_buffers; ret = MFXVideoDECODE_Init(q->session, &param); if (ret < 0) return ff_qsv_print_error(avctx, ret, "Error initializing the MFX video decoder"); q->frame_info = param.mfx.FrameInfo; return 0; }
1threat
Splitting a CamelCased text : <p>I need to split a <strong>camelCased</strong> text containing only <strong>lowerCase</strong> and <strong>UpperCase</strong> letters. How to do it using regular expression?</p> <p><strong>Example text:</strong> ThisTextIsToBeSplitted</p> <p><strong>Output:</strong> This Text Is To Be Splitted</p>
0debug
how to make two divs next to each other : <p>unfortunately i dont know how to make these divs(Boxes) next to each other like the picture and put the images of the cars like the image , can anyone please help me </p> <p>if there is a way with tables or divs please help me to do it</p> <p><a href="https://i.stack.imgur.com/4PpUl.jpg" rel="nofollow noreferrer">here is the image</a></p>
0debug
Retrieve original value of an md5() variable : <p>What's exactly the solution on how to retrieve the original value of a variable that undergoes md5 function?</p> <p>Thanks.</p>
0debug
static void event_notifier_dummy_cb(EventNotifier *e) { }
1threat
int ff_raw_video_read_header(AVFormatContext *s) { AVStream *st; FFRawVideoDemuxerContext *s1 = s->priv_data; AVRational framerate; int ret = 0; st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = s->iformat->raw_codec_id; st->need_parsing = AVSTREAM_PARSE_FULL; if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) { av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate); goto fail; } st->r_frame_rate = st->avg_frame_rate = framerate; avpriv_set_pts_info(st, 64, framerate.den, framerate.num); fail: return ret; }
1threat
static int raw_pread(BlockDriverState *bs, int64_t offset, uint8_t *buf, int count) { BDRVRawState *s = bs->opaque; int size, ret, shift, sum; sum = 0; if (s->aligned_buf != NULL) { if (offset & 0x1ff) { shift = offset & 0x1ff; size = (shift + count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset - shift, s->aligned_buf, size); if (ret < 0) return ret; size = 512 - shift; if (size > count) size = count; memcpy(buf, s->aligned_buf + shift, size); buf += size; offset += size; count -= size; sum += size; if (count == 0) return sum; } if (count & 0x1ff || (uintptr_t) buf & 0x1ff) { while (count) { size = (count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset, s->aligned_buf, size); if (ret < 0) return ret; size = ret; if (size > count) size = count; memcpy(buf, s->aligned_buf, size); buf += size; offset += size; count -= size; sum += size; } return sum; } } return raw_pread_aligned(bs, offset, buf, count) + sum; }
1threat
Crud operation in single Store procedure in c# : ALTER PROCEDURE dbo.bicrudlogin ( @id int, @username nvarchar(50), @password nvarchar(50), @type varchar(50), @status varchar(50) ) AS if(@status='insert') Begin insert into tbllogin values(@username,@password,@type) End if(@status='select') Begin select username,password,type from tbllogin where id=@id End if(@status='update') Begin update tbllogin set username=@username,password=@password,type=@type where id=@id End if(@status='delete') Begin delete from tbllogin where id=@id End RETURN and code for accessing data using store procedure cmd = new SqlCommand("bicrudregistration",con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@username",txtusername.Text); cmd.Parameters.AddWithValue("@password",txtpassword.Text); cmd.Parameters.AddWithValue("@status","find"); dr=cmd.ExecuteReader(); if this is wrong way, then tell me how to do it. rather than writing separate store procedure for every operation.
0debug
Types of property 'length' are incompatible. Type '4' is not assignable to type '1' : <p>I'm learning typescript / angular at the moment and can't work out why TSLint is throwing this up as an error, however the code itself works and displays in a browser.</p> <pre><code>export class GreetingComponent implements OnInit { names: [{ name: string }] = [{ name: 'Tom' }, { name: 'Dave' }, { name: 'Katie' }, { name: 'John' }]; constructor() { } ngOnInit() { } </code></pre> <p>Specifically the line:</p> <pre><code> names: [{ name: string }] = [{ name: 'Tom' }, { name: 'Dave' }, { name: 'Katie' }, { name: 'John' }]; </code></pre> <p>Full Error:</p> <pre><code>[ts] Type '[{ name: string; }, { name: string; }, { name: string; }, { name: string; }]' is not assignable to type '[{ name: string; }]'. Types of property 'length' are incompatible. Type '4' is not assignable to type '1'. (property) GreetingComponent.names: [{ name: string; }] </code></pre>
0debug
Run MobileFirst7.1 Project in ANdroid Studio : Hello everyone I want to run my MobileFirst (7.1) Project in android studio and i see some errors with the gradle compatibility. I have to Transform the project in to a gradle project,but i don't even know how to do that. Thank you so much.
0debug
How do I make this calculator work? (Ruby) : #I just wanted to work on one method then replicate it to the rest. which is why one method is really only done. (kinda) puts "Welcome to My Calculator! " print "Please place in the numbers. " first_number = gets.to_i print "Second number. " second_number = gets.to_i puts "What operation? " operation_selection = gets if(operation_selection == "add") addition_function puts"#{result}" end def addition_function result = first_number + second_number end def subtraction_function result = first_number - second_number end def divison_function result = first_number / second_number end def multiplication_function result = first_number * second_number end
0debug
I have a database with primary key set to auto increment. But can't enter form data from a post method in php. Can anyone help me? : Here's the code. I have logins table in users database. Also a form whose action is set to below code. <?php if(isset($_POST['signup'])){ if (isset($_POST['Full-name']) && isset($_POST['psd']) && isset($_POST['email'])) { $link2 = @mysqli_connect('localhost', 'root', '') or die("Oops! Can't connect"); @mysqli_select_db($link2, 'users') or die("Can't find Database"); $fullname = $_POST['Full-name']; $email2 = $_POST['email']; $newpassword = $_POST['psd']; echo $fullname.$email2.$newpassword; //print sucessfully $query2 = mysqli_query($link2, "INSERT INTO logins VALUES (NULL, $email2, $newpassword)"); if ($query2) { echo "You have signed up successfully"; } else { echo "Error: "; //query prints this statement } mysqli_close($link2); } } ?>
0debug
Changing state without changing browser history in angular ui-router : <p>Assume that we have a logic like this:</p> <ul> <li>From state A, change to state B.</li> <li>Whenever we arrive to state B, the app always redirect us to state C by calling <code>$state.go(stateC)</code></li> <li>Now we are in state C</li> </ul> <p>My question is how to go back to state A from state C (given the fact that state A can be any state we don't know at run-time, meaning user can access state B from any other states)</p>
0debug
static void omap_mpui_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; if (size != 4) { return omap_badwidth_write32(opaque, addr, value); } switch (addr) { case 0x00: s->mpui_ctrl = value & 0x007fffff; break; case 0x04: case 0x08: case 0x0c: case 0x10: case 0x14: OMAP_RO_REG(addr); case 0x18: case 0x1c: break; default: OMAP_BAD_REG(addr); } }
1threat
SSL error while recording android app using jmeter : Below is the error I am getting while I try to record mobile app - Android. Problem with SSL certificate for 'Application URL'? Ensure browser is set to accept the JMeter proxy cert: Received fatal alert: certificate_unknown. Below are the things I have taken care of: 1. I have installed the certificate on the device. 2. Jmeter & App are running on the same network. Anybody has faced the same issue, please help. Thanks, Bhavya
0debug
Vue.js scroll to top of page for same route : <p>I can set scrolling behaviour to Vue.js Router like this:</p> <pre><code>const router = new Router({ mode: 'history', routes: [ { path: '/', name: 'index', component: Main }, { path: '/some-path', name: 'some-path', component: SomePath } ], scrollBehavior() { return {x: 0, y: 0} } }) </code></pre> <p>This works perfectly when you click on the link with some page which is not current. When I click on the link which is already rendered, i.e. in the footer, nothing happens. Vue Router assumes there is no state transition. What is the preferred way to scroll up in this case?</p>
0debug
Ping send with PHP : <p>I have an application to develop for the university. Something simple. But I'm inexperienced on how to do it. It's exactly what I want to do; If I send ping 50 IP addresses at 3 minute intervals, I would like the IP address to write on the admin panel off if it is turned off and open if it is turned on. (red and green button maybe ) How ı can do it exactly? Since the servers belong to us, I want the commands to work correctly. What exactly do I want to show on the screen if Ping is successful?</p>
0debug
Resizing images with batch script using Imagemagick : Trying to write a batch file to resize all the images in a directory to 640 Pixel wide, placing the resized images into a sub-directory called "web-img" and the original pictures should be unchanged. This was the code I wrote, but it is not working. rem shu chetluru @echo off if not exist "C:\Users\Asus\Desktop\proj.uti.1\websize\web-img\nul" md "C:\Users\Asus\Desktop\proj.uti.1\websize\web-img" mogrify -path "C:\Desktop\proj\websize*.jpg" -resize 640@ "C:\Desktop\proj\websize\web-img" Can someone please help me to complete and make the code work?? Thank you so much in advance.
0debug
How to resolve external packages with spark-shell when behind a corporate proxy? : <p>I would like to run spark-shell with a external package behind a corporate proxy. Unfortunately external packages passed via <code>--packages</code> option are not resolved.</p> <p>E.g., when running</p> <pre><code>bin/spark-shell --packages datastax:spark-cassandra-connector:1.5.0-s_2.10 </code></pre> <p>the cassandra connector package is not resolved (stuck at last line):</p> <pre><code>Ivy Default Cache set to: /root/.ivy2/cache The jars for the packages stored in: /root/.ivy2/jars :: loading settings :: url = jar:file:/opt/spark/lib/spark-assembly-1.6.1-hadoop2.6.0.jar!/org/apache/ivy/core/settings/ivysettings.xml datastax#spark-cassandra-connector added as a dependency :: resolving dependencies :: org.apache.spark#spark-submit-parent;1.0 confs: [default] </code></pre> <p>After some time the connection times out containing error messages like this:</p> <pre><code>:::: ERRORS Server access error at url https://repo1.maven.org/maven2/datastax/spark-cassandra-connector/1.5.0-s_2.10/spark-cassandra-connector-1.5.0-s_2.10.pom (java.net.ConnectException: Connection timed out) </code></pre> <p>When i deactivate the VPN with the corporate proxy the package gets resolved and downloaded immediately.</p> <p>What i tried so far:</p> <p>Exposing proxies as environment variables:</p> <pre><code>export http_proxy=&lt;proxyHost&gt;:&lt;proxyPort&gt; export https_proxy=&lt;proxyHost&gt;:&lt;proxyPort&gt; export JAVA_OPTS="-Dhttp.proxyHost=&lt;proxyHost&gt; -Dhttp.proxyPort=&lt;proxyPort&gt;" export ANT_OPTS="-Dhttp.proxyHost=&lt;proxyHost&gt; -Dhttp.proxyPort=&lt;proxyPort&gt;" </code></pre> <p>Running spark-shell with extra java options:</p> <pre><code>bin/spark-shell --conf "spark.driver.extraJavaOptions=-Dhttp.proxyHost=&lt;proxyHost&gt; -Dhttp.proxyPort=&lt;proxyPort&gt;" --conf "spark.executor.extraJavaOptions=-Dhttp.proxyHost=&lt;proxyHost&gt; -Dhttp.proxyPort=&lt;proxyPort&gt;" --packages datastax:spark-cassandra-connector:1.6.0-M1-s_2.10 </code></pre> <p>Is there some other configuration possibility i am missing?</p>
0debug
static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features) { VirtIONet *n = VIRTIO_NET(vdev); int i; virtio_net_set_multiqueue(n, __virtio_has_feature(features, VIRTIO_NET_F_MQ)); virtio_net_set_mrg_rx_bufs(n, __virtio_has_feature(features, VIRTIO_NET_F_MRG_RXBUF), __virtio_has_feature(features, VIRTIO_F_VERSION_1)); if (n->has_vnet_hdr) { n->curr_guest_offloads = virtio_net_guest_offloads_by_features(features); virtio_net_apply_guest_offloads(n); } for (i = 0; i < n->max_queues; i++) { NetClientState *nc = qemu_get_subqueue(n->nic, i); if (!get_vhost_net(nc->peer)) { continue; } vhost_net_ack_features(get_vhost_net(nc->peer), features); } if (__virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) { memset(n->vlans, 0, MAX_VLAN >> 3); } else { memset(n->vlans, 0xff, MAX_VLAN >> 3); } }
1threat
Arrow function inside map operator/method in javascript explanation e => e.target.value : <p>I am following a tutorial in javascript/angular2 and I know it is a novice question, but if someone could please explain what exactly is this piece of code doing. I have read at various places and in the Mozilla docs, but I am still confused about it. I am aware that: <em>map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results</em>,but what exactly is the code doing in this context:</p> <pre><code>map(e =&gt; e.target.value) </code></pre>
0debug
int bdrv_create(BlockDriver *drv, const char* filename, QEMUOptionParameter *options) { int ret; Coroutine *co; CreateCo cco = { .drv = drv, .filename = g_strdup(filename), .options = options, .ret = NOT_DONE, }; if (!drv->bdrv_create) { return -ENOTSUP; } if (qemu_in_coroutine()) { bdrv_create_co_entry(&cco); } else { co = qemu_coroutine_create(bdrv_create_co_entry); qemu_coroutine_enter(co, &cco); while (cco.ret == NOT_DONE) { qemu_aio_wait(); } } ret = cco.ret; g_free(cco.filename); return ret; }
1threat
how is 'finally' implemented in C# or Java? : <p>I would like to port some c# code to a language that doesn't have the finally construct. What alternative approach can I use to mimic it? If you know how it is implemented, perhaps I can create this...</p>
0debug
static void init_vlcs() { static int done = 0; if (!done) { done = 1; init_vlc(&dc_lum_vlc, DC_VLC_BITS, 12, vlc_dc_lum_bits, 1, 1, vlc_dc_lum_code, 2, 2); init_vlc(&dc_chroma_vlc, DC_VLC_BITS, 12, vlc_dc_chroma_bits, 1, 1, vlc_dc_chroma_code, 2, 2); init_vlc(&mv_vlc, MV_VLC_BITS, 17, &mbMotionVectorTable[0][1], 2, 1, &mbMotionVectorTable[0][0], 2, 1); init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36, &mbAddrIncrTable[0][1], 2, 1, &mbAddrIncrTable[0][0], 2, 1); init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 63, &mbPatTable[0][1], 2, 1, &mbPatTable[0][0], 2, 1); init_vlc(&mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7, &table_mb_ptype[0][1], 2, 1, &table_mb_ptype[0][0], 2, 1); init_vlc(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1); init_rl(&rl_mpeg1); init_rl(&rl_mpeg2); init_2d_vlc_rl(&rl_mpeg1); init_2d_vlc_rl(&rl_mpeg2); } }
1threat
How to select section in regular experssion : I have these lines delete = \account user\ admin add = \ nothing no out inout edit = permission bob admin alice I want to select a section for example: add = \ nothing no out inout I like do it with regular expression. Thanks
0debug
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = AVMEDIA_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } video_enc->codec_id = codec_id; set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; choose_pixel_fmt(st, codec); if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; if (video_language) { av_metadata_set2(&st->metadata, "language", video_language, 0); av_freep(&video_language); } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; frame_pix_fmt = PIX_FMT_NONE; }
1threat
void qtest_init(const char *qtest_chrdev, const char *qtest_log) { CharDriverState *chr; chr = qemu_chr_new("qtest", qtest_chrdev, NULL); qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr); qemu_chr_fe_set_echo(chr, true); inbuf = g_string_new(""); if (qtest_log) { if (strcmp(qtest_log, "none") != 0) { qtest_log_fp = fopen(qtest_log, "w+"); } } else { qtest_log_fp = stderr; } qtest_chr = chr; }
1threat
How to convert Php CURL request to command line curl : <p>How to translate following php curl request to curl executable command.</p> <pre><code> $curlOpts = array( CURLOPT_PORT =&gt; "3000", CURLOPT_URL =&gt; 'www.example.com', CURLOPT_RETURNTRANSFER =&gt; true, CURLOPT_HTTPHEADER =&gt; array("Cookie: connect.sid=aASD234SDFfds", "content-type:application/json"), CURLOPT_POST =&gt; true, CURLOPT_POSTFIELDS =&gt; {"email": "test.com", "password": "123456"}, ); curl_setopt_array($ch, $curlOpts); $output = curl_exec($ch); </code></pre> <p>Respected Curl command which I want</p> <pre><code>curl -X GET --header 'Accept: application/json' 'http://www.example.com?sort=clicks&amp;order=des' curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ "email": "test.com", \ "password": "123456" \ }' 'http://example.com/login' </code></pre> <p>Please help me for the same.</p>
0debug
Mongodb : why show dbs does not show my databases? : <p>I have setup mongodb 64bits on Windows. I ran server and client successfully.</p> <p>But when I type:</p> <pre><code>show dbs </code></pre> <p>Output is</p> <pre><code>local 0.000GB </code></pre> <p>Why ? show dbs is supposed to list all databases at least the default one "test" am I wrong ?</p>
0debug
Textview is not showing up in the scrollview - Swift 4 : I have a view controller named as TeamDetailsViewController. I added scroll view to the view controller programmatically and added image view, nameLabel, and UITextview as the subview of the scroll view. imageview and NameLabel are showing up but Text View is not showing up for an unknown reason. Please help. Here is my code. class TeamDetailsController: UIViewController { override func viewDidLoad() { super.viewDidLoad() setupViews() print(textView.text) } lazy var scrollView: UIScrollView = { let sv = UIScrollView(frame: self.view.bounds) sv.backgroundColor = .white sv.translatesAutoresizingMaskIntoConstraints = false sv.layer.borderWidth = 5 return sv }() let profileImageView: UIImageView = { let imageView = UIImageView() imageView.image = UIImage(named: "team-tony") imageView.contentMode = .scaleAspectFill imageView.layer.cornerRadius = 50 imageView.layer.masksToBounds = true imageView.clipsToBounds = true imageView.translatesAutoresizingMaskIntoConstraints = false return imageView }() let nameLabel: UILabel = { let label = UILabel() label.text = "Jared 'Donald' Dunn" label.font = UIFont.systemFont(ofSize: 20, weight: .bold) label.translatesAutoresizingMaskIntoConstraints = false return label }() let textView: UITextView = { var tv = UITextView() tv.translatesAutoresizingMaskIntoConstraints = false tv.textColor = .black tv.font = UIFont.systemFont(ofSize: 16) tv.isEditable = false return tv }() func setupViews() { view.backgroundColor = .white view.addSubview(scrollView) scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0).isActive = true scrollView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0).isActive = true scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: 0).isActive = true scrollView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0).isActive = true scrollView.addSubview(profileImageView) profileImageView.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor).isActive = true profileImageView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 20).isActive = true scrollView.addSubview(nameLabel) nameLabel.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor).isActive = true nameLabel.topAnchor.constraint(equalTo: profileImageView.bottomAnchor, constant: 10).isActive = true scrollView.addSubview(textView) textView.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor).isActive = true textView.topAnchor.constraint(equalTo: nameLabel.bottomAnchor).isActive = true } }
0debug
Is there an function which return from a given list a list with position of element : I'm trying to make a python function in which i give a certain list and it return a list with position of element (not starting with 0) . For exemple: list = [9,3,4,1] function(list) = [4,2,3,1] or list = [2,2,6,5] function(list) = [1,1,3,2]
0debug