problem
stringlengths
26
131k
labels
class label
2 classes
static XICSState *xics_system_init(MachineState *machine, int nr_servers, int nr_irqs) { XICSState *icp = NULL; if (kvm_enabled()) { Error *err = NULL; if (machine_kernel_irqchip_allowed(machine)) { icp = try_create_xics(TYPE_KVM_XICS, nr_servers, nr_irqs, &err); } if (machine_kernel_irqchip_required(machine) && !icp) { error_report("kernel_irqchip requested but unavailable: %s", error_get_pretty(err)); } } if (!icp) { icp = try_create_xics(TYPE_XICS, nr_servers, nr_irqs, &error_abort); } return icp; }
1threat
static void tftp_send_error(struct tftp_session *spt, uint16_t errorcode, const char *msg, struct tftp_t *recv_tp) { struct sockaddr_in saddr, daddr; struct mbuf *m; struct tftp_t *tp; m = m_get(spt->slirp); if (!m) { goto out; } memset(m->m_data, 0, m->m_size); m->m_data += IF_MAXLINKHDR; tp = (void *)m->m_data; m->m_data += sizeof(struct udpiphdr); tp->tp_op = htons(TFTP_ERROR); tp->x.tp_error.tp_error_code = htons(errorcode); pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); saddr.sin_addr = recv_tp->ip.ip_dst; saddr.sin_port = recv_tp->udp.uh_dport; daddr.sin_addr = spt->client_ip; daddr.sin_port = spt->client_port; m->m_len = sizeof(struct tftp_t) - 514 + 3 + strlen(msg) - sizeof(struct ip) - sizeof(struct udphdr); udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY); out: tftp_session_terminate(spt); }
1threat
void cpu_ppc_store_decr (CPUPPCState *env, uint32_t value) { PowerPCCPU *cpu = ppc_env_get_cpu(env); _cpu_ppc_store_decr(cpu, cpu_ppc_load_decr(env), value, 0); }
1threat
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int i, ret; uint8_t *buf; if (!desc) return AVERROR(EINVAL); if ((ret = av_image_check_size(w, h, 0, NULL)) < 0) return ret; if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, align>7 ? FFALIGN(w, 8) : w)) < 0) return ret; for (i = 0; i < 4; i++) linesizes[i] = FFALIGN(linesizes[i], align); if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0) return ret; buf = av_malloc(ret + align); if (!buf) return AVERROR(ENOMEM); if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) { av_free(buf); return ret; if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); return ret;
1threat
How do you dynamically control react apollo-client query initiation? : <p>A react component wrapped with an <a href="http://dev.apollodata.com/react/queries.html#basics" rel="noreferrer">apollo-client</a> query will automatically initiate a call to the server for data.</p> <p>I would like to fire off a request for data only on a specific user input.</p> <p><a href="http://dev.apollodata.com/react/queries.html#graphql-skip" rel="noreferrer">You can pass the skip option in the query options</a> - but this means the refetch() function is not provided as a prop to the component; and it appears that the value of skip is not assessed dynamically on prop update.</p> <p>My use is case is a map component. I only want data for markers to be loaded when the user presses a button, but not on initial component mount or location change.</p> <p>A code sample below:</p> <pre><code>// GraphQL wrapping Explore = graphql(RoutesWithinQuery, { options: ({ displayedMapRegion }) =&gt; ({ variables: { scope: 'WITHIN', targetRegion: mapRegionToGeoRegionInputType(displayedMapRegion) }, skip: ({ targetResource, searchIsAllowedForMapArea }) =&gt; { const skip = Boolean(!searchIsAllowedForMapArea || targetResource != 'ROUTE'); return skip; }, }), props: ({ ownProps, data: { loading, viewer, refetch }}) =&gt; ({ routes: viewer &amp;&amp; viewer.routes ? viewer.routes : [], refetch, loading }) })(Explore); </code></pre>
0debug
static void leon3_generic_hw_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; SPARCCPU *cpu; CPUSPARCState *env; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *prom = g_new(MemoryRegion, 1); int ret; char *filename; qemu_irq *cpu_irqs = NULL; int bios_size; int prom_size; ResetData *reset_info; if (!cpu_model) { cpu_model = "LEON3"; } cpu = cpu_sparc_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n"); exit(1); } env = &cpu->env; cpu_sparc_set_id(env, 0); reset_info = g_malloc0(sizeof(ResetData)); reset_info->cpu = cpu; reset_info->sp = 0x40000000 + ram_size; qemu_register_reset(main_cpu_reset, reset_info); grlib_irqmp_create(0x80000200, env, &cpu_irqs, MAX_PILS, &leon3_set_pil_in); env->qemu_irq_ack = leon3_irq_manager; if ((uint64_t)ram_size > (1UL << 30)) { fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum 1G\n", (unsigned int)(ram_size / (1024 * 1024))); exit(1); } memory_region_init_ram(ram, NULL, "leon3.ram", ram_size, &error_abort); vmstate_register_ram_global(ram); memory_region_add_subregion(address_space_mem, 0x40000000, ram); prom_size = 8 * 1024 * 1024; memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_abort); vmstate_register_ram_global(prom); memory_region_set_readonly(prom, true); memory_region_add_subregion(address_space_mem, 0x00000000, prom); if (bios_name == NULL) { bios_name = PROM_FILENAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = get_image_size(filename); if (bios_size > prom_size) { fprintf(stderr, "qemu: could not load prom '%s': file too big\n", filename); exit(1); } if (bios_size > 0) { ret = load_image_targphys(filename, 0x00000000, bios_size); if (ret < 0 || ret > prom_size) { fprintf(stderr, "qemu: could not load prom '%s'\n", filename); exit(1); } } else if (kernel_filename == NULL && !qtest_enabled()) { fprintf(stderr, "Can't read bios image %s\n", filename); exit(1); } if (kernel_filename != NULL) { long kernel_size; uint64_t entry; kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, 1 , ELF_MACHINE, 0); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (bios_size <= 0) { env->pc = entry; env->npc = entry + 4; reset_info->entry = entry; } } grlib_gptimer_create(0x80000300, 2, CPU_CLK, cpu_irqs, 6); if (serial_hds[0]) { grlib_apbuart_create(0x80000100, serial_hds[0], cpu_irqs[3]); } }
1threat
Progress Bar for simple backup script : <p>I am not a programmer at all, however I am teaching myself bash scripting and I have a need for a backup script to backup my VMs (I am using KVM/QEMU). I know that you can do snapshots but I need something more permanent a hard copy of the VM if you will and be able to put these on my ZFS Storage system. So I was thinking to write a backup script that runs via cron once a week or so. The file is of course qcow2 or whatever file system is chosen. So far I have a good start on the script.</p> <p>Some parts of this script has been borrowed from another author</p> <pre><code>### kvm-backup.0.0.1 ### #!/bin/bash # Get the date # BACKUPTIME=`date +%b-%d-%y` # Affixing the date # Create the backup file and cp to Destination for backups # DESTINATION=/mnt/backups/backup-$BACKUPTIME.tar.gz # Need to define the source folder # SOURCEFOLDER=/mnt/VMs/ # create backup now # tar -cpzf $DESTINATION $SOURCEFOLDER </code></pre> <p><strong>### Right here I need a progress bar but I am not sure how put it all together I know the code above will have to be fitted in to one of the progress bar scripts. I am just not smart enough to put it all together. ###</strong></p> <p>Could someone help me out a little bit, Thanks, Michael</p>
0debug
void ff_h264_v_lpf_luma_inter_msa(uint8_t *data, int img_width, int alpha, int beta, int8_t *tc) { uint8_t bs0 = 1; uint8_t bs1 = 1; uint8_t bs2 = 1; uint8_t bs3 = 1; if (tc[0] < 0) bs0 = 0; if (tc[1] < 0) bs1 = 0; if (tc[2] < 0) bs2 = 0; if (tc[3] < 0) bs3 = 0; avc_loopfilter_luma_inter_edge_hor_msa(data, bs0, bs1, bs2, bs3, tc[0], tc[1], tc[2], tc[3], alpha, beta, img_width); }
1threat
Ubuntu 16.04, CUDA 8 - CUDA driver version is insufficient for CUDA runtime version : <p>I've installed the latest nvidia drivers (375.26) manually, and installed CUDA using cuda_8.0.44_linux.run (skipping the driver install there, since the bundled drivers are older, 367 I think).</p> <p>Running the deviceQuery in CUDA samples produces the following error however:</p> <pre><code>~/cudasamples/NVIDIA_CUDA-8.0_Samples/1_Utilities/deviceQuery$ ./deviceQuery ./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) cudaGetDeviceCount returned 35 -&gt; CUDA driver version is insufficient for CUDA runtime version Result = FAIL </code></pre> <p>Version info:</p> <p>$ nvcc --version</p> <pre><code>nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Sun_Sep__4_22:14:01_CDT_2016 Cuda compilation tools, release 8.0, V8.0.44 $ nvidia-smi Sat Dec 31 17:25:03 2016 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 375.26 Driver Version: 375.26 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 1080 Off | 0000:01:00.0 On | N/A | | 0% 39C P8 11W / 230W | 464MiB / 8110MiB | 1% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 974 G /usr/lib/xorg/Xorg 193MiB | | 0 1816 G compiz 172MiB | | 0 2178 G ...ignDownloads/Enabled/MaterialDesignUserMa 96MiB | +-----------------------------------------------------------------------------+ $ cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX x86_64 Kernel Module 375.26 Thu Dec 8 18:36:43 PST 2016 GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) </code></pre> <p>The anwer to similar problems has been updating the nvidia display drivers, though in my case this is already done. Does anyone have any ideas? Thanks.</p>
0debug
static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, const char *desc_file_path, Error **errp) { int ret; char access[11]; char type[11]; char fname[512]; const char *p = desc; int64_t sectors = 0; int64_t flat_offset; char extent_path[PATH_MAX]; BlockDriverState *extent_file; BDRVVmdkState *s = bs->opaque; VmdkExtent *extent; while (*p) { flat_offset = -1; ret = sscanf(p, "%10s %" SCNd64 " %10s \"%511[^\n\r\"]\" %" SCNd64, access, &sectors, type, fname, &flat_offset); if (ret < 4 || strcmp(access, "RW")) { goto next_line; } else if (!strcmp(type, "FLAT")) { if (ret != 5 || flat_offset < 0) { error_setg(errp, "Invalid extent lines: \n%s", p); return -EINVAL; } } else if (!strcmp(type, "VMFS")) { flat_offset = 0; } else if (ret != 4) { error_setg(errp, "Invalid extent lines: \n%s", p); return -EINVAL; } if (sectors <= 0 || (strcmp(type, "FLAT") && strcmp(type, "SPARSE") && strcmp(type, "VMFS") && strcmp(type, "VMFSSPARSE")) || (strcmp(access, "RW"))) { goto next_line; } path_combine(extent_path, sizeof(extent_path), desc_file_path, fname); ret = bdrv_file_open(&extent_file, extent_path, NULL, bs->open_flags, errp); if (ret) { return ret; } if (!strcmp(type, "FLAT") || !strcmp(type, "VMFS")) { ret = vmdk_add_extent(bs, extent_file, true, sectors, 0, 0, 0, 0, 0, &extent, errp); if (ret < 0) { return ret; } extent->flat_start_offset = flat_offset << 9; } else if (!strcmp(type, "SPARSE") || !strcmp(type, "VMFSSPARSE")) { ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, errp); if (ret) { bdrv_unref(extent_file); return ret; } extent = &s->extents[s->num_extents - 1]; } else { error_setg(errp, "Unsupported extent type '%s'", type); return -ENOTSUP; } extent->type = g_strdup(type); next_line: while (*p) { if (*p == '\n') { p++; break; } p++; } } return 0; }
1threat
Jekyll Code snippet copy-to-clipboard button : <h1>The Problem</h1> <p>I am building a Jekyll site with the <a href="https://github.com/jekyll/minima" rel="noreferrer">minima</a> theme to publish some tutorial online. The tutorial pages contain many code snippets, for example:</p> <pre><code>```javascript /* Global scope: this code is executed once */ const redis = require('redis'); const host = &lt;HOSTNAME&gt;; const port = &lt;PORT&gt;; const password = &lt;PASSWORD&gt;; ... ``` </code></pre> <p>I would like to add a "copy to clipboard" button to each code snippet (<a href="https://clipboardjs.com/#example-target" rel="noreferrer">example</a>), but not sure what's the right way to do it in Jekyll.</p> <h1>What have I tried</h1> <ul> <li>Using <a href="https://clipboardjs.com/#example-target" rel="noreferrer">clipboardjs.com</a>. It requires a unique ID for each snippet, and I'm not sure how to implement this in Jekyll/Markdown.</li> <li>STFW</li> </ul> <h1>My question</h1> <p><strong>How can I add a "Copy to Clipboard" button for code snippets in Jekyll?</strong></p>
0debug
Other css box is moving when im writing to the one im using : <p>So when im trying to add a paragraph to my box, the other one moves.. Ive been looking to see if its something wrong with the margin or so, but not that i can see. I have absolutely no idea how to fix it. This is how it looks before i do something: <a href="https://imgur.com/a/lZZq4" rel="nofollow noreferrer">https://imgur.com/a/lZZq4</a> This is how it looks after i add some text or whatever to the box <a href="https://imgur.com/a/FXkrf" rel="nofollow noreferrer">https://imgur.com/a/FXkrf</a></p> <p>As you can see, the other box is moving, and the more i write, the further down its going. Would appreciate some explanation here.</p> <p>HTML CODE:</p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Inlamningsuppgift 1&lt;/title&gt; &lt;link rel="stylesheet" href="css.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;header&gt; &lt;h1&gt; Inlamningsuppgift 1 &lt;/h1&gt; &lt;/header&gt; &lt;nav id="firstnav"&gt; &lt;a href="start.html" id="start"&gt; Start &lt;/a&gt; &lt;a href="filmer.html" id="filmer"&gt; Filmer &lt;/a&gt; &lt;a href="bildspel.html" id="bildspel"&gt; Bildspel &lt;/a&gt; &lt;select&gt; &lt;option value="Blue"&gt; Blå &lt;/option&gt; &lt;option value="Red"&gt; Röd &lt;/option&gt; &lt;option value="Violet"&gt; Lila &lt;/option&gt; &lt;/select&gt; &lt;/nav&gt; &lt;section&gt; &lt;h3&gt; Välkommen till min webbplats! &lt;/h3&gt; &lt;article id="presentation"&gt; &lt;h4&gt; Vem är skaparen av sidan? &lt;/h4&gt; &lt;/article&gt; &lt;article id="anledning"&gt; &lt;h4&gt; Anledning till att jag gör denna sidan &lt;/h4&gt; &lt;p&gt; hej &lt;/article&gt; &lt;article id="utmaningar"&gt; &lt;h4&gt; Tre saker jag tyckt varit utmanande med uppgiften &lt;/h4&gt; &lt;ul&gt; &lt;li&gt; Sak 1 &lt;/li&gt; &lt;li&gt; Sak 2 &lt;/li&gt; &lt;li&gt; Sak 3 &lt;/li&gt; &lt;/ul&gt; &lt;/article&gt; &lt;/section&gt; &lt;footer&gt; &lt;/footer&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS CODE:</p> <pre><code> #wrapper{ margin-left:auto; margin-right:auto; width:970px; } header{ background-color: grey; text-align: center; padding: 10px; } #firstnav{ background-color: black; padding: 10px; } #start{ margin-right: 250px; text-decoration: none; color: white; } #filmer{ margin-right: 150px; text-decoration: none; color: white; } #bildspel{ text-decoration: none; color: white; } nav select{ float: right; width:250px; } section{ background-color: grey; padding-top: 1px; padding-bottom: 40px; } section h3{ text-align: center; padding-bottom: 12px; } #presentation{ width: 350px; height: 100px; background-color: white; display: inline-block; margin-left: 75px; padding-left: 20px; clear: both; } #presentation img{ width: 40px; height: 40px; } #anledning{ display: inline-block; height: 100px; background-color: white; width: 350px; margin-left: 70px; padding-left: 20px; clear: both; } #utmaningar{ background-color: white; width: 850px; margin-left: 70px; } #utmaningar &gt; h4{ padding-left: 10px; padding-top: 8px; } footer{ text-align: center; background-color: black; color: white; padding: 10px; } </code></pre> <p>Its the id with #presentation and #anledning which are moving.</p>
0debug
NgModule vs Component : <p>So I'm learning angular2 now and reading ngbook2 about the modules. Modules contain components, but also can import different modules with their public components.</p> <p>And the question is: What is the scope of the module component (in this meaning scope as parts of an application, not the reach of variables inside). Is module the whole application or just some part like header, containing its components?</p> <p>What is the typicaly used convention?</p>
0debug
URLProtocol *ffurl_protocol_next(const URLProtocol *prev) { return prev ? prev->next : first_protocol; }
1threat
Multiple Constructors in Java, : <p>In Java when you create a new object with multiple constructors, does it basically go in order? For example, what if you had a constructor with multiple ints? Or what if you wanted to skip a constructor argument? Would it even execute?</p>
0debug
What are the problems with mixing .NET Framework and .NET CORE? : <p>I have a load of middle and back end components (repositories, services etc) that were written against the .NET Framework 4 but that are still relevant to a new project that I'm now working on. The front end of this new project will be written in ASP .NET CORE2.2. What should I do - recreate all components in .NET CORE or keep the back end running against .NET Framework while the front end runs against CORE? What are the considerations in terms of e.g. performance?</p>
0debug
Graph programm in C : I want to write a code in which i want to know how much time is needed to move from one point to another . Input 1) First line(input) is showing the maximum time required to reach 2) Second line(second and third input) shows the intial position. 3)Third line(fourth and fifth input) shows the final position. 4)fourth line shows the time taken to travel one step in left , right , up and down . Output an integer denoting the time needs to reach, if not able to reach in time output a string Valar Codulis. Output the answer of each testcase on newline. But my programm is not running like this . why? #include<stdio.h> #include<stdlib.h> int main() { int c,d,e,f,b; scanf("%d",&b); printf("\n"); scanf("%d",&c); scanf("%d",&d); printf("\n"); scanf("%d",&e); scanf("%d",&f); printf("\n"); int g,h,i,j; scanf("%d",&g); scanf("%d",&h); scanf("%d",&i); scanf("%d",&j); int k,l,m,n,o; e-c==k; f-d==l; if(e-c>=0,f-d>=0) { m=k*h; n=l*i; } else if(e-c<=0,f-d>=0) { m=k*g; n=l*i; } else if(k>=0,l<=0) { m=k*h; n=l*j; } else { m=k*g; n=l*j; } o=m+n; if(b>=o) { printf("\n %d",o); } else { printf("Valar Codulis"); } }
0debug
How to ask user for username or other data with vs code extension API : <p>I want to receive some input from the user, such as <code>username</code> and use it in the code. How to achieve that?</p>
0debug
static void qdev_print_devinfo(ObjectClass *klass, void *opaque) { DeviceClass *dc; bool *show_no_user = opaque; dc = (DeviceClass *)object_class_dynamic_cast(klass, TYPE_DEVICE); if (!dc || (show_no_user && !*show_no_user && dc->no_user)) { return; } error_printf("name \"%s\"", object_class_get_name(klass)); if (dc->bus_info) { error_printf(", bus %s", dc->bus_info->name); } if (dc->alias) { error_printf(", alias \"%s\"", dc->alias); } if (dc->desc) { error_printf(", desc \"%s\"", dc->desc); } if (dc->no_user) { error_printf(", no-user"); } error_printf("\n"); }
1threat
void bdrv_parent_drained_end(BlockDriverState *bs) { BdrvChild *c; QLIST_FOREACH(c, &bs->parents, next_parent) { if (c->role->drained_end) { c->role->drained_end(c); } } }
1threat
@Input() value is always undefined : <p>I have created a <code>user photo component</code> which takes an <code>@Input()</code> value, this value is the userId. If the value is passed in then I retrieve information from <code>Firebase</code> linking to this userId, if it doesn't then I do something else.</p> <p>My user-photo component</p> <pre><code>import { Component, OnInit, OnDestroy, Input } from '@angular/core'; @Component({ selector: 'user-photos', templateUrl: './user-photos.component.html', styleUrls: ['./user-photos.component.css'] }) export class UserPhotoComponent implements OnInit { @Input() userId: string; constructor() { console.log('userId is:',this.userId); } ngOnInit() { } ngOnDestroy() { } } </code></pre> <p>As you can see I have declared the userId as <code>@Input()</code>, now on my <code>edit-profile component</code> I have the following:</p> <pre><code>&lt;user-photos [userId]="TestingInput"&gt;&lt;/user-photos&gt; </code></pre> <p>Now the User Photo component gets rendered as I see the <code>h1</code> tag appearing, however the userId is always undefined ?</p> <p>No errors are appearing in the developer console, so I'm not entirely sure what I've done wrong. </p>
0debug
Updating a string with string.replace in JS : <p>I have the following question: I have an array ['cd', 'ef', 'kl'] and a string 'ab(AA)ef(LL)ij(EX)'. I'd like to replace the text between parentheses (AA)s with 'cd', 'ef' and 'ij' respectively to make it 'ab(cd)ef(gh)ij(kl)'. I've written a code to find text between brackets</p> <pre><code>var s = 'ab(cd)ef(gh)ij(kl)'; var regExp = /\((.+?)\)/g; var found = [], r; while(r = regExp.exec(s)) { found.push(r[1]); } </code></pre> <p>but what should I do next? String.replace(re, found[x]) replaces all brackets with just the first one, as it should, and if I remove /g flag, it finds only the first occurrence (again, as it should). A bit stuck here, could you give me a hint please?</p>
0debug
Find battery temperature using Arduino Uno or Feather M0 : <p>I want to run my project using battery. I am using Adafruit Feather M0 Bluefruit LE. I want to know can I face any issue with battery temperature and how can I keep a trace on the battery temperature. If somebody knows how to solve this problem if I use Arduino boards please inform. I think same solution can work for Feather M0.</p> <p>Any HELP would be appreciated!</p> <p>Thanks in advance!</p>
0debug
save pictures while i scrap them from website using vb.net : hi guys i find a code on youtube when i use it on my visual basic and debug it and find pictures but when i want to save them software gives me this message [enter image description here][1] [1]: http://i.stack.imgur.com/EJhK7.jpg and this is code i use Private Sub btnSaveImages_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ btnSaveImages.Click Dim dir_name As String = txtDirectory.Text If Not dir_name.EndsWith("\") Then dir_name &= "\" For Each pic As PictureBox In flpPictures.Controls Dim bm As Bitmap = pic.Image Dim filename As String = pic.Tag filename = _ filename.Substring(filename.LastIndexOf("/") + _ 1) Dim ext As String = _ filename.Substring(filename.LastIndexOf(".")) Dim full_name As String = dir_name & filename Select Case ext Case ".bmp" bm.Save(full_name, Imaging.ImageFormat.Bmp) Case ".gif" bm.Save(full_name, Imaging.ImageFormat.Gif) Case ".jpg", "jpeg" bm.Save(full_name, Imaging.ImageFormat.Jpeg) Case ".png" bm.Save(full_name, Imaging.ImageFormat.Png) Case ".tiff" bm.Save(full_name, Imaging.ImageFormat.Tiff) Case Else MessageBox.Show( _ "Unknown file type " & ext & _ " in file " & filename, _ "Unknown File Type", _ MessageBoxButtons.OK, _ MessageBoxIcon.Error) End Select Next pic Beep() End Sub
0debug
Couple of questions about python : <p>i'm currently a computer engineering student and i have a couple of quick questions pertaining to a homework i'm not quite sure i understand.</p> <p>The first one is "is python a proprietary language" I'm not sure if that's translated correctly so apologies in advance</p> <p>The secon one is "is python free software" technicaly it's a programming language right? Does it count as software?</p> <p>Thank you for your time.</p>
0debug
Error "Get https://registry-1.docker.io/v2/: net/http: request canceled" while building image : <p>I am getting the below error while building an image</p> <pre><code>Step 1/10 : FROM ubuntu:14.04 Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) </code></pre>
0debug
static void apply_motion_4x4(RoqContext *ri, int x, int y, unsigned char mv, signed char mean_x, signed char mean_y) { int i, hw, mx, my; unsigned char *pa, *pb; mx = x + 8 - (mv >> 4) - mean_x; my = y + 8 - (mv & 0xf) - mean_y; pa = ri->current_frame.data[0] + (y * ri->y_stride) + x; pb = ri->last_frame.data[0] + (my * ri->y_stride) + mx; for(i = 0; i < 4; i++) { pa[0] = pb[0]; pa[1] = pb[1]; pa[2] = pb[2]; pa[3] = pb[3]; pa += ri->y_stride; pb += ri->y_stride; } #if 0 pa = ri->current_frame.data[1] + (y/2) * (ri->c_stride) + x/2; pb = ri->last_frame.data[1] + (my/2) * (ri->c_stride) + (mx + 1)/2; for(i = 0; i < 2; i++) { pa[0] = pb[0]; pa[1] = pb[1]; pa += ri->c_stride; pb += ri->c_stride; } pa = ri->current_frame.data[2] + (y/2) * (ri->c_stride) + x/2; pb = ri->last_frame.data[2] + (my/2) * (ri->c_stride) + (mx + 1)/2; for(i = 0; i < 2; i++) { pa[0] = pb[0]; pa[1] = pb[1]; pa += ri->c_stride; pb += ri->c_stride; } #else hw = ri->y_stride/2; pa = ri->current_frame.data[1] + (y * ri->y_stride)/4 + x/2; pb = ri->last_frame.data[1] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; for(i = 0; i < 2; i++) { switch(((my & 0x01) << 1) | (mx & 0x01)) { case 0: pa[0] = pb[0]; pa[1] = pb[1]; pa[hw] = pb[hw]; pa[hw+1] = pb[hw+1]; break; case 1: pa[0] = avg2(pb[0], pb[1]); pa[1] = avg2(pb[1], pb[2]); pa[hw] = avg2(pb[hw], pb[hw+1]); pa[hw+1] = avg2(pb[hw+1], pb[hw+2]); break; case 2: pa[0] = avg2(pb[0], pb[hw]); pa[1] = avg2(pb[1], pb[hw+1]); pa[hw] = avg2(pb[hw], pb[hw*2]); pa[hw+1] = avg2(pb[hw+1], pb[(hw*2)+1]); break; case 3: pa[0] = avg4(pb[0], pb[1], pb[hw], pb[hw+1]); pa[1] = avg4(pb[1], pb[2], pb[hw+1], pb[hw+2]); pa[hw] = avg4(pb[hw], pb[hw+1], pb[hw*2], pb[(hw*2)+1]); pa[hw+1] = avg4(pb[hw+1], pb[hw+2], pb[(hw*2)+1], pb[(hw*2)+1]); break; } pa = ri->current_frame.data[2] + (y * ri->y_stride)/4 + x/2; pb = ri->last_frame.data[2] + (my/2) * (ri->y_stride/2) + (mx + 1)/2; } #endif }
1threat
When is necessary to add class for semantics? : I want to write semantic beautiful no-nonsense HTML. When is the right time to include class and when it's not? Should I add class on every element of my HTML? To write semantic markup, we must use HTML tags correctly so that our markup is both human-readable and machine-readable. When we write semantic markup we can no longer select HTML elements based on visual presentation. Instead, we select HTML elements based on their semantic meaning, and then use CSS to define the visual presentation of our content. When writing semantic markup, the presentation of web page elements is kept completely separate and distinct from the markup of the content itself. <body> <ul class="post"> <li class="title"> <h3>Title of Post</h3> </li> <li class="content"><p> Lorem Ipsum bla bla..</p></li> <li class="hastag"><a href="site.come/hash/samplepost">#samplepost </a> </li> </ul> </body> <style> .title{code} .content{code} .hashtag{code} </style> or <body> <ul class="post"> <li> <h3>Title of Post</h3> </li> <li><p>Ipsum bla bla..</p></li> <li><a href="site.come/hash/samplepost">#samplepost </a></li> </ul> </body> <style> .post > li > h3{code} .post > li > p {code} .post > li > a {code} </style> Which of these is more semantic? Should we use class on everything or only when necessary?
0debug
how to add same columns in table in mysql? : I have one table named **tripdetails**: **table structure:** **trip no** **invoice no** **total balance** 111 1 500 111 2 800 i want to add these two invoices **total balance**...means 500+800=1300....
0debug
retrive data from three table in sqlserver : Question : Concatenate values from multiple coloumns of 3 tables and display in one coloumn.HERE date field is datetime. I have 3 tables: table1 date amt1 ----------------- 1-1-2016 111 2-2-2016 222 3-4-2016 111 table2: date amt2 ----------------- 1-1-2016 101 2-2-2016 333 2-3-2016 444 3-3-2016 456 1-4-2016 101 3-4-2016 111 table3: date amt3 ----------------- 2-2-2016 001 2-3-2016 002 3-3-2016 003 1-4-2016 555 2-4-2016 666 3-4-2016 777 Output Desired: date amt1 amt2 amt3 ---------------------------------- 1-1-2016 111 101 NULL 2-2-2016 222 333 001 2-3-2016 NULL 444 002 3-3-2016 NULL 456 003 1-4-2016 NULL 101 555 2-4-2016 NULL NULL 666 3-4-2016 111 111 777 ------------------------------------ TOTAL 333 1546 2004
0debug
static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al, const uint8_t *mb_bitmask, const AVFrame *reference){ int i, mb_x, mb_y; uint8_t* data[MAX_COMPONENTS]; const uint8_t *reference_data[MAX_COMPONENTS]; int linesize[MAX_COMPONENTS]; GetBitContext mb_bitmask_gb; if (mb_bitmask) { init_get_bits(&mb_bitmask_gb, mb_bitmask, s->mb_width*s->mb_height); if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE) { av_log(s->avctx, AV_LOG_ERROR, "Can not flip image with CODEC_FLAG_EMU_EDGE set!\n"); s->flipped = 0; for(i=0; i < nb_components; i++) { int c = s->comp_index[i]; data[c] = s->picture_ptr->data[c]; reference_data[c] = reference ? reference->data[c] : NULL; linesize[c]=s->linesize[c]; s->coefs_finished[c] |= 1; if(s->flipped) { int offset = (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 )); data[c] += offset; reference_data[c] += offset; linesize[c] *= -1; for(mb_y = 0; mb_y < s->mb_height; mb_y++) { for(mb_x = 0; mb_x < s->mb_width; mb_x++) { const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb); if (s->restart_interval && !s->restart_count) s->restart_count = s->restart_interval; for(i=0;i<nb_components;i++) { uint8_t *ptr; int n, h, v, x, y, c, j; int block_offset; n = s->nb_blocks[i]; c = s->comp_index[i]; h = s->h_scount[i]; v = s->v_scount[i]; x = 0; y = 0; for(j=0;j<n;j++) { block_offset = (((linesize[c] * (v * mb_y + y) * 8) + (h * mb_x + x) * 8) >> s->avctx->lowres); if(s->interlaced && s->bottom_field) block_offset += linesize[c] >> 1; ptr = data[c] + block_offset; if(!s->progressive) { if (copy_mb) { mjpeg_copy_block(ptr, reference_data[c] + block_offset, linesize[c], s->avctx->lowres); } else { s->dsp.clear_block(s->block); if(decode_block(s, s->block, i, s->dc_index[i], s->ac_index[i], s->quant_matrixes[ s->quant_index[c] ]) < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); s->dsp.idct_put(ptr, linesize[c], s->block); } else { int block_idx = s->block_stride[c] * (v * mb_y + y) + (h * mb_x + x); DCTELEM *block = s->blocks[c][block_idx]; if(Ah) block[0] += get_bits1(&s->gb) * s->quant_matrixes[ s->quant_index[c] ][0] << Al; else if(decode_dc_progressive(s, block, i, s->dc_index[i], s->quant_matrixes[ s->quant_index[c] ], Al) < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); if (++x == h) { x = 0; y++; if (s->restart_interval && !--s->restart_count) { align_get_bits(&s->gb); skip_bits(&s->gb, 16); for (i=0; i<nb_components; i++) s->last_dc[i] = 1024; return 0;
1threat
how to get the json response back in the front end that I am sending from my backend? : I am sending this from the backend. ``` return res.status(404).json({ message: "User does not exist" }); ``` and handling the error on the frontend within the catch of my axios, but when I log the 'err' I get a network error rather than the message. How do I get the message? ``` .catch(err => { console.log(err) } ```
0debug
envlist_setenv(envlist_t *envlist, const char *env) { struct envlist_entry *entry = NULL; const char *eq_sign; size_t envname_len; if ((envlist == NULL) || (env == NULL)) return (EINVAL); if ((eq_sign = strchr(env, '=')) == NULL) return (EINVAL); envname_len = eq_sign - env + 1; for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { if (strncmp(entry->ev_var, env, envname_len) == 0) break; } if (entry != NULL) { QLIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); } else { envlist->el_count++; } if ((entry = malloc(sizeof (*entry))) == NULL) return (errno); if ((entry->ev_var = strdup(env)) == NULL) { free(entry); return (errno); } QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); return (0); }
1threat
static void start_tcg_kick_timer(void) { if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); } }
1threat
Get value from input JQuery : I am trying to get the value from the first name input and pass it to the bootstrap alert when the user clicks the submit button, but can't manage to do that. Here is my snippet: <div id="myAlert" class="alert alert-success collapse"> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> $(document).ready(function () { $("#submit-button").click(function () { $("#myAlert").show("fade"), $("#fname").attr("value"); event.preventDefault(); }); }); <!-- language: lang-html --> <div id="myAlert" class="alert alert-success collapse"> <a href="#" class="close" data-dismiss="alert">&times;</a>Thank you for contacting us, </div> <!-- end snippet -->
0debug
static always_inline void gen_bcond (DisasContext *ctx, int type) { uint32_t bo = BO(ctx->opcode); int l1 = gen_new_label(); TCGv target; ctx->exception = POWERPC_EXCP_BRANCH; if (type == BCOND_LR || type == BCOND_CTR) { target = tcg_temp_local_new(); if (type == BCOND_CTR) tcg_gen_mov_tl(target, cpu_ctr); else tcg_gen_mov_tl(target, cpu_lr); } if (LK(ctx->opcode)) gen_setlr(ctx, ctx->nip); l1 = gen_new_label(); if ((bo & 0x4) == 0) { TCGv temp = tcg_temp_new(); if (unlikely(type == BCOND_CTR)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1); #if defined(TARGET_PPC64) if (!ctx->sf_mode) tcg_gen_ext32u_tl(temp, cpu_ctr); else #endif tcg_gen_mov_tl(temp, cpu_ctr); if (bo & 0x2) { tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1); tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1); } tcg_temp_free(temp); } if ((bo & 0x10) == 0) { uint32_t bi = BI(ctx->opcode); uint32_t mask = 1 << (3 - (bi & 0x03)); TCGv_i32 temp = tcg_temp_new_i32(); if (bo & 0x8) { tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_EQ, temp, 0, l1); tcg_gen_andi_i32(temp, cpu_crf[bi >> 2], mask); tcg_gen_brcondi_i32(TCG_COND_NE, temp, 0, l1); } tcg_temp_free_i32(temp); } if (type == BCOND_IM) { target_ulong li = (target_long)((int16_t)(BD(ctx->opcode))); if (likely(AA(ctx->opcode) == 0)) { gen_goto_tb(ctx, 0, ctx->nip + li - 4); gen_goto_tb(ctx, 0, li); } gen_set_label(l1); gen_goto_tb(ctx, 1, ctx->nip); #if defined(TARGET_PPC64) if (!(ctx->sf_mode)) tcg_gen_andi_tl(cpu_nip, target, (uint32_t)~3); else #endif tcg_gen_andi_tl(cpu_nip, target, ~3); tcg_gen_exit_tb(0); gen_set_label(l1); #if defined(TARGET_PPC64) if (!(ctx->sf_mode)) tcg_gen_movi_tl(cpu_nip, (uint32_t)ctx->nip); else #endif tcg_gen_movi_tl(cpu_nip, ctx->nip); tcg_gen_exit_tb(0); } }
1threat
static void set_pixel_format(VncState *vs, int bits_per_pixel, int depth, int big_endian_flag, int true_color_flag, int red_max, int green_max, int blue_max, int red_shift, int green_shift, int blue_shift) { int host_big_endian_flag; #ifdef WORDS_BIGENDIAN host_big_endian_flag = 1; #else host_big_endian_flag = 0; #endif if (!true_color_flag) { fail: vnc_client_error(vs); return; } if (bits_per_pixel == 32 && host_big_endian_flag == big_endian_flag && red_max == 0xff && green_max == 0xff && blue_max == 0xff && red_shift == 16 && green_shift == 8 && blue_shift == 0) { vs->depth = 4; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_32; } else if (bits_per_pixel == 16 && host_big_endian_flag == big_endian_flag && red_max == 31 && green_max == 63 && blue_max == 31 && red_shift == 11 && green_shift == 5 && blue_shift == 0) { vs->depth = 2; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_16; } else if (bits_per_pixel == 8 && red_max == 7 && green_max == 7 && blue_max == 3 && red_shift == 5 && green_shift == 2 && blue_shift == 0) { vs->depth = 1; vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_8; } else { if (bits_per_pixel != 8 && bits_per_pixel != 16 && bits_per_pixel != 32) goto fail; vs->depth = 4; vs->red_shift = red_shift; vs->red_max = red_max; vs->red_shift1 = 24 - compute_nbits(red_max); vs->green_shift = green_shift; vs->green_max = green_max; vs->green_shift1 = 16 - compute_nbits(green_max); vs->blue_shift = blue_shift; vs->blue_max = blue_max; vs->blue_shift1 = 8 - compute_nbits(blue_max); vs->pix_bpp = bits_per_pixel / 8; vs->pix_big_endian = big_endian_flag; vs->write_pixels = vnc_write_pixels_generic; vs->send_hextile_tile = send_hextile_tile_generic; } vnc_dpy_resize(vs->ds, vs->ds->width, vs->ds->height); memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height); vga_hw_invalidate(); vga_hw_update(); }
1threat
Can't call setState (or forceUpdate) on an unmounted component : <p>I'm trying to fetch the data from the server after component has been updated but I couldn't manage to do that. As far as I understand <code>componentWillUnmount</code> is called when component is about to be destroyed, but I never need to destroy it so it's useless to me. What would be solution for this? When I should set the state?</p> <pre><code>async componentDidUpdate(prevProps, prevState) { if (this.props.subject.length &amp;&amp; prevProps.subject !== this.props.subject) { let result = await this.getGrades({ student: this.props.id, subject: this.props.subject }); this.setState({ subject: this.props.subject, grades: result }); } } async getGrades(params) { let response, body; if (params['subject'].length) { response = await fetch(apiRequestString.gradesBySubject(params)); body = await response.json(); } else { response = await fetch(apiRequestString.grades(params)); body = await response.json(); } if (response.status !== 200) throw Error(body.message); return body; } </code></pre> <p>Full error:</p> <pre><code>Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. </code></pre>
0debug
Android Google Sign In: check if User is signed in : <p>I am looking for a way to check if my user already signed in with Google Sign In.</p> <p>I support several logging APIs (Facebook, Google, custom), so I would like to build a static helper method like: <code>User.isUserLoggedIn()</code></p> <p>With Facebook I use: </p> <pre><code>if AccessToken.getCurrentAccessToken() != null { return true } </code></pre> <p>to check if the user is logged via Facebook.</p> <p>On iOS I use the following to check if the user is logged via Google Sign In:</p> <pre><code>GIDSignIn.sharedInstance().hasAuthInKeychain() </code></pre> <p><strong>My question: Is there an equivalent on Android to the iOS method :</strong> </p> <p><code>GIDSignIn.sharedInstance().hasAuthInKeychain()</code> ?</p> <p>I am looking for a method that doesn’t involve a callback. </p> <p>Thanks! Max</p>
0debug
NodeJS Express encodes the URL - how to decode : <p>I'm using NodeJS with Express, and when I use foreign characters in the URL, they automatically get encoded.</p> <p><strong>How do I decode it back to the original string?</strong></p> <p>Before calling NodeJS, I escape characters.</p> <p>So the string: <code>אובמה</code></p> <p>Becomes <code>%u05D0%u05D5%u05D1%u05DE%u05D4</code></p> <p>The entire URL now looks like: <code>http://localhost:32323/?query=%u05D0%u05D5%u05D1%u05DE%u05D4</code></p> <p>Now in my NodeJS, I get the escaped string <code>%u05D0%u05D5%u05D1%u05DE%u05D4</code>.</p> <p>This is the relevant code:</p> <pre><code>var url_parts = url.parse(req.url, true); var params = url_parts.query; var query = params.query; // '%u05D0%u05D5%u05D1%u05DE%u05D4' </code></pre> <p>I've tried <code>url</code> and <code>querystring</code> libraries but nothing seems to fit my case.</p> <pre><code>querystring.unescape(query); // still '%u05D0%u05D5%u05D1%u05DE%u05D4' </code></pre>
0debug
How to mock environment files import in unit tests : <p>In our angular app, we use environment files to load some config. </p> <p>environment.ts</p> <pre><code>export const environment = { production: false, defaultLocale: 'en_US', }; </code></pre> <p>We then use it in one of our service:</p> <pre><code>import { environment } from '../../environments/environment'; import { TranslateService } from './translate.service'; @Injectable() export class LocaleService { constructor(private translateService: TranslateService){} useDefaultLocaleAsLang(): void { const defaultLocale = environment.defaultLocale; this.translateService.setUsedLang(defaultLocale); } } </code></pre> <p>So I use the values in environment file in a service method.</p> <p>In our test file, we can of course Spy on the translateService:</p> <p><code>translateService = jasmine.createSpyObj('translateService', ['setUsedLang']);</code></p> <p>But I don't know how to mock the environment values in my testing file (in a <code>beforeEach</code> for example). Or even transform it, for testing purpose, to a <code>Subject</code> so I can change it and test different behaviors.</p> <p>More generally speaking, how can you mock such imports values in tests to be sure not to use real values? </p>
0debug
how to calculate the ΔT between some dates : i need to know the way to calculate the ΔT between some dates for example 2011-01-18 21:49:36 2011-01-21 15:31:12 2011-01-19 20:58:34 this dates give ΔT=-1/3 any one can help me how to get calculate this value
0debug
Cannot read property 'previous' of undefined : <p>Functions in firebase throws me this error:</p> <pre><code>TypeError: Cannot read property 'previous' of undefined at exports.sendNotifications.functions.database.ref.onWrite (/srv/index.js:5:19) at cloudFunction (/srv/node_modules/firebase-functions/lib/cloud-functions.js:131:23) at /worker/worker.js:825:24 at &lt;anonymous&gt; at process._tickDomainCallback (internal/process/next_tick.js:229:7) </code></pre> <p>And my code is this:</p> <pre><code>exports.sendNotifications=functions.database.ref('/notifications/{notificationId}').onWrite((event)=&gt;{ if(event.data.previous.val()){ return; } if(!event.data.exists()){ return; } }) </code></pre> <p>Any idea how to fix this?</p>
0debug
I want to reverse my string as dd/mm/yyy to yyyy/mm/dd : <p>I need to reverse my date from <strong>10/21/2016</strong> to <strong>2016/10/21</strong> how can I possible to do this?</p>
0debug
static int config_output(AVFilterLink *outlink) { static const char hdcd_baduse[] = "The HDCD filter is unlikely to produce a desirable result in this context."; AVFilterContext *ctx = outlink->src; HDCDContext *s = ctx->priv; AVFilterLink *lk = outlink; while(lk != NULL) { AVFilterContext *nextf = lk->dst; if (lk->type == AVMEDIA_TYPE_AUDIO) { if (lk->format == AV_SAMPLE_FMT_S16 || lk->format == AV_SAMPLE_FMT_U8) { av_log(ctx, AV_LOG_WARNING, "s24 output is being truncated to %s at %s.\n", av_get_sample_fmt_name(lk->format), (nextf->name) ? nextf->name : "<unknown>" ); s->bad_config = 1; break; } } lk = (nextf->outputs) ? nextf->outputs[0] : NULL; } if (s->bad_config) av_log(ctx, AV_LOG_WARNING, "%s\n", hdcd_baduse); return 0; }
1threat
How to bind Kibana to multiple host names / IPs : <p>Is there a way to bind Kibana to more than one IP address using kibana's config file: <code>kibana.yml</code>? Right now, if I modify the line<br> <code>server.host: "127.0.0.1"</code><br> to<br> <code>server.host: ["127.0.0.1","123.45.67.89"]</code><br> which is valid YML, I get an error.<br> Is there any way to accomplish this from within Kibana or do I need to do it through a proxy/nginx?</p>
0debug
Phonebook in C++ won't work : I need to do a phonebook, and so far I've done this: #include<stdio.h> #include<malloc.h> typedef struct { char Name[10]; char Address[10]; long Phone_number; }Phonebook; void main() { int Counter, Number = 0; long Number_of_residents; Phonebook *Information = (Phonebook*)malloc(sizeof(Phonebook)); scanf("%ld", &Number_of_residents); for (Counter = 0; Counter < Number_of_residents; Counter++) { Information = (Phonebook*)realloc(Information, sizeof(Phonebook)*(Counter + 1)); gets(Information[Number].Name); Number++; gets(Information[Number].Address); Number++; scanf("%ld", &Information[Number].Phone_number); Number++; } } Problem is, when I type in "Address" it stops working. What did I do wrong here? Thank you.
0debug
how to find a record between two values : <p>I have the following <a href="https://i.stack.imgur.com/pSWaz.jpg" rel="nofollow noreferrer">table</a> where there are two relevant fields for searching, this is 'from' and 'to' and represents the range of employees and then the field 'InitialQMSDays' represents the value that I want to return.</p> <p>So if I have a search value of say 6, it would look at that value and find it between the 6 - 10 row, and return 2. </p> <p>any ideas?</p>
0debug
How to return array in a variable with multiple object layer : <p>I haw the two following variables: </p> <pre><code>'ecommerce': { 'checkout': { 'actionField': {'step': 4}, 'products': [{ 'name': 'Spirit Pack', 'id': '12345', 'price': '55', }] } } 'ecommerce': { 'purchase': { 'actionField': {'step': 4}, 'products': [{ 'name': 'Spirit Pack', 'id': '12345', 'price': '55', }] } } </code></pre> <p>How can I return the array named <code>products</code> when the second level of layer object is different. </p>
0debug
static void check_pred8x8(H264PredContext *h, uint8_t *buf0, uint8_t *buf1, int codec, int chroma_format, int bit_depth) { int pred_mode; for (pred_mode = 0; pred_mode < 11; pred_mode++) { if (check_pred_func(h->pred8x8[pred_mode], (chroma_format == 2) ? "8x16" : "8x8", pred8x8_modes[codec][pred_mode])) { randomize_buffers(); call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL); call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); if (memcmp(buf0, buf1, BUF_SIZE)) fail(); bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL); } } }
1threat
static int serial_parse(const char *devname) { static int index = 0; char label[32]; if (strcmp(devname, "none") == 0) return 0; if (index == MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); exit(1); } snprintf(label, sizeof(label), "serial%d", index); serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { fprintf(stderr, "qemu: could not connect serial device" " to character backend '%s'\n", devname); return -1; } index++; return 0; }
1threat
How to restart a game?(tkinter) : I'm making a game with tkinter where the player must dodge acid rain. I'm almost done with it, I'm just needing a way of restarting the whole game after the Up key is pressed. I already made a function that's being called after rain hit the player. This function checks with an event if the up key is pressed and triggers than the restart function in which the code for restarting the game comes. All inside the Game class. Here's the code: import random import time from winsound import * from tkinter import * class Game(): def __init__(self): self.high_file = open('HIGHSCORE.txt','r') self.high = self.high_file.read() self.tk = Tk() self.tk.title('DeadlyRain') self.tk.resizable(0,1) self.tk.wm_attributes('-topmost',1) self.canvas = Canvas(self.tk,width=400,height=500,highlightthickness=0) self.canvas.pack() self.tk.update() self.bg = PhotoImage(file="bg.gif") self.canvas.create_image(0,0,image=self.bg,anchor='nw') self.score_txt = self.canvas.create_text(320,12,text='Score: 0', \ fill='white',font=('Fixedsys',17)) self.high_txt = self.canvas.create_text(310,30, \ text='HighScore: %s' % self.high,\ fill='white',font=('Fixedsys',16)) self.player_img = PhotoImage(file='player\\player0.gif') self.player = self.canvas.create_image(150,396, \ image=self.player_img, anchor='nw') self.rain_img = [PhotoImage(file='rain\\rain1.gif'), PhotoImage(file='rain\\rain2.gif'), PhotoImage(file='rain\\rain3.gif')] self.images_left = [ PhotoImage(file="player\\playerL1.gif"), PhotoImage(file="player\\playerL2.gif"), PhotoImage(file="player\\playerL3.gif")] self.images_right = [ PhotoImage(file="player\\playerR1.gif"), PhotoImage(file="player\\playerR2.gif"), PhotoImage(file="player\\playerR3.gif")] self.current_image = 0 self.current_image_add = 1 self.last_time = time.time() self.new_high = False self.player_x = 0 self.rain_drops = [] self.rain_count = 0 self.points = 0 self.speed = 2 self.list = list(range(0,9999)) self.needed_rain_count = 100 self.running = True self.canvas.bind_all('<KeyPress-Left>',self.left) self.canvas.bind_all('<KeyPress-Right>',self.right) def animate(self): if self.player_x != 0 : if time.time() - self.last_time > 0.1: self.last_time = time.time() self.current_image += self.current_image_add if self.current_image >= 2: self.current_image_add = -1 if self.current_image <= 0: self.current_image_add = 1 if self.player_x < 0: self.canvas.itemconfig(self.player, image=self.images_left[self.current_image]) elif self.player_x > 0: self.canvas.itemconfig(self.player, image=self.images_right[self.current_image]) def score(self): self.points += 1 if self.points > int(self.high): self.canvas.itemconfig(self.high_txt, \ text='HighScore: %s' % self.points) self.new_high = True self.canvas.itemconfig(self.score_txt, \ text='Score: %s' % self.points) if self.points >= 20 and self.points <= 34: self.needed_rain_count = 80 elif self.points >= 35 and self.points <= 49: self.needed_rain_count = 60 elif self.points >= 50 and self.points <= 64: self.needed_rain_count = 40 elif self.points >= 65 and self.points <= 79: self.needed_rain_count = 20 def gameover(self): self.running = False self.canvas.create_text(200,250,text='GAMEOVER') if self.new_high == True: new_high = open('HIGHSCORE.txt','w') new_high.write(str(self.points)) new_high.close() self.high_file.close() self.canvas.bind_all('<KeyPress-Up>',self.restart) #restart func is called self.high_file.close() def restart(self,evt): #insert code for restarting game here def left(self,evt): self.player_x = -2 def right(self,evt): self.player_x = 2 def move(self): self.animate() self.canvas.move(self.player,self.player_x,0) pos = self.canvas.coords(self.player) if pos[0] <= -8: self.player_x = 0 elif pos[0] >= self.canvas.winfo_width() - 40: self.player_x = 0 def rain(self): if self.rain_count == self.needed_rain_count: for x in self.list: x =self.canvas.create_image(random.randint(0,501), \ 0,image=random.choice(self.rain_img)) self.rain_drops.append(x) self.rain_count = 0 self.list.remove(x) break def rain_fall(self,id): co = self.canvas.coords(id) if co[1] > 500: self.rain_drops.remove(id) self.canvas.delete(id) self.score() self.canvas.move(id,0,self.speed) def rain_hit(self,id): rpos = self.canvas.coords(id) ppos = self.canvas.coords(self.player) if rpos[1] >= ppos[1] and rpos[1] <= ppos[1]+68: if rpos[0] >= ppos[0] and rpos[0] <= ppos[0]+48: self.gameover() def mainloop(self): PlaySound("sound\\rain.wav", SND_ASYNC) while 1: if self.running == True: self.rain_count += 1 self.move() self.rain() for rain in self.rain_drops: self.rain_hit(rain) self.rain_fall(rain) self.tk.update_idletasks() self.tk.update() time.sleep(0.01) g = Game() g.mainloop() Thank you in advance!
0debug
static void save_native_fp_fxsave(CPUState *env) { struct fpxstate *fp = &fpx1; int fptag, i, j; uint16_t fpuc; asm volatile ("fxsave %0" : : "m" (*fp)); env->fpuc = fp->fpuc; env->fpstt = (fp->fpus >> 11) & 7; env->fpus = fp->fpus & ~0x3800; fptag = fp->fptag ^ 0xff; for(i = 0;i < 8; i++) { env->fptags[i] = (fptag >> i) & 1; } j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 16], 10); j = (j + 1) & 7; } if (env->cpuid_features & CPUID_SSE) { env->mxcsr = fp->mxcsr; memcpy(env->xmm_regs, fp->xmm_regs, CPU_NB_REGS * 16); } asm volatile ("fninit"); fpuc = 0x037f | (env->fpuc & (3 << 10)); asm volatile("fldcw %0" : : "m" (fpuc)); }
1threat
Java count words repeated in string : <p>I Know this quetion has been asked quite few times already but I have a twist.</p> <p>I have a below string and I wan to check the count how many times given word is repeated in the string.</p> <pre><code>String randomText = "AbDdfSwapnilswapniljsdncdsbswapnil" </code></pre> <p>How to count the word <code>"swapnil"</code> is repeated?</p>
0debug
Convert decimal to unicode two digit : How can i convert this with javascript: a = 1; **TO** result = \x00\x00\x00\x01 Please help ! Sorry for my english
0debug
static bool block_is_active(void *opaque) { return block_mig_state.blk_enable == 1; }
1threat
How to Systematically use each item in a Vector : <p>I am currently creating a program that initializes a int Vector at the beginning of the program. As the program progresses, Prime numbers will be added to the Vector. Then, the program will check if the result of if the result of a given number % the first number in the Vector == 0. If not, the program will then check it against the second number. Is there a way to do this on C++ 11 and if so, how? Thank you for any time!</p>
0debug
Per Regular Expression to find $0.00 : Need to count the number of "$0.00" in a string. I'm using: my $zeroDollarCount = ("\Q$menu\E" =~ tr/\$0\.00//); but it doesn't work. Thanks
0debug
passing multiple arguments to promise resolution within setTimeout : <p>I was trying to follow along with the MDN <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="noreferrer">promise.all</a> example but it seems I cannot pass more arguments to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout" rel="noreferrer">setTimeout callback</a>. </p> <pre><code>var p1 = new Promise((resolve, reject) =&gt; { setTimeout(resolve, 200, 1,2,3); }); var p2 = new Promise((resolve, reject) =&gt; { setTimeout(resolve, 500, "two"); }); Promise.all([p1, p2]).then(value =&gt; { console.log(value); }, reason =&gt; { console.log(reason) }); </code></pre> <p>This prints <code>[1, "two"]</code>, where I would expect <code>[1, 2, 3, "two"]</code>. Doing this with <code>setTimeout</code> without promise fulfillment works as expected</p> <pre><code>setTimeout(cb, 100, 1, 2, 3); function cb(a, b, c){ console.log(a, b, c); } //=&gt;1 2 3 </code></pre> <p>Why doesn't this work with the promise? How can it be made to work with the promise?</p>
0debug
static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width) { int x, y; pixel *src = (pixel *)_src; ptrdiff_t srcstride = _srcstride / sizeof(pixel); pixel *dst = (pixel *)_dst; ptrdiff_t dststride = _dststride / sizeof(pixel); const int8_t *filter = ff_hevc_epel_filters[mx - 1]; int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; int16_t *tmp = tmp_array; int shift = 14 + 1 - BIT_DEPTH; int log2Wd = denom + shift - 1; src -= EPEL_EXTRA_BEFORE * srcstride; for (y = 0; y < height + EPEL_EXTRA; y++) { for (x = 0; x < width; x++) tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); src += srcstride; tmp += MAX_PB_SIZE; } tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; filter = ff_hevc_epel_filters[my - 1]; ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ox1 = ox1 * (1 << (BIT_DEPTH - 8)); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 + ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); tmp += MAX_PB_SIZE; dst += dststride; src2 += MAX_PB_SIZE; } }
1threat
Search through a vector? : I would like a method to search through my vector. Find a matching string when taken from the user's input. Then output using the second block of code. Here's my code: void Ingredient::database(Ingredient &object){ Ingredient item1("White Cap", "Weakness to Frost", "Fortify Heavy Armor", "Restore Magicka", "Ravage Magicka"); Ingredient item2("Wisp Wrappings", "Restore Stamina", "Fortify Destruction", "Fortify Carry Weight", "Resist Magic"); Ingredient item3("Yellow Mountain Flower", "Resist Poison", "Fortify Restoration", "Fortify Health", "Damage Stamina Regen"); std::vector< Ingredient* > satchel; satchel.push_back(&item1); satchel.push_back(&item2); satchel.push_back(&item3); } And here's the output I wish to display: > void Ingredient::displayItems(){ std::cout << '\n'; std::cout << "Ingredient: " << iName << '\n'; std::cout << "Primary Effect: " << pAttr << '\n'; std::cout << "Secondary Effect: " << sAttr << '\n'; std::cout << "Tertiary Effect: " << tAttr << '\n'; std::cout << "Quaternary Effect: " << qAttr << '\n'; }
0debug
When to use vector of smart pointers or vector of vector in C++? : I've been struggling with this for quite awhile, for example if I were to brainstorm an idea and I wouldn't know which should I use? Should I not think too much and work with vector of smart pointers? Please be detailed and maybe some code examples on why should I use which?
0debug
What does @ do, work and mean in PHP? : <p>Hey Stackoverflow community. I had some issues with my code yesterday and somehow solved it by adding @ in front of some of my statements such as this </p> <pre><code> if (@!empty($_SESSION["customer]) { //code } </code></pre> <p>I had never seen it before but it worked perfectly. I have searched for it on Google but i can't find any useful description about the @ in PHP. I want to hear if anyone knows what it does, how it works and mean in PHP. Thanks!</p>
0debug
Is Google In-app Subscriptions available in Egypt? : <p>I am going do develop new android app using google play services and I am asking Is Google In-app Subscriptions available in Egypt ? how it works for upgrading subscriptions pricing ? Thanks.</p>
0debug
I WANT SELECT DAYS IN MONTHS AND COUNT IN FOUR TIME RANGES GROUP BY DAYS : The problem is with range 'THREE', to count from 10 pm till 06 am next day, result to be in previous day, i have this query who give me wrong data report, any solutions please. select TRUNC (A.time)+06/24, count (distinct B.code)as FOUR, count(case when to_char(A.time,'HH24:MI:SS') between '06:00:00' and '14:00:00' then A.sn end) as ONE, count(case when to_char(A.time,'HH24:MI:SS') between '14:00:00' and '22:00:00' then A.sn end) as TWO, count(case when A.time between TO_DATE ('10:00:00 PM', 'hh:mi:ss AM') and TO_DATE ('10:00:00 PM', 'hh:mi:ss AM')+6/24 then A.sn end) as THREE from B inner join A on B.bol_id = A.bol_id where B.group = '9' and A.time between '01-JUN-18 06:00:00' and '25-JUN-18 06:00:00' GROUP BY TRUNC (A.time) i want structure be like this [example][1] [1]: https://i.stack.imgur.com/mxbu6.png
0debug
R ggplot2: Change the spacing between the legend and the panel : <p>How do I change the spacing between the legend area and the panel in <code>ggplot2 2.2.0</code>?</p> <p><a href="https://i.stack.imgur.com/sYPUL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sYPUL.png" alt="enter image description here"></a></p> <pre><code>library(ggplot2) library(dplyr) library(tidyr) dfr &lt;- data.frame(x=factor(1:20),y1=runif(n=20)) %&gt;% mutate(y2=1-y1) %&gt;% gather(variable,value,-x) ggplot(dfr,aes(x=x,y=value,fill=variable))+ geom_bar(stat="identity")+ theme(legend.position="top", legend.justification="right") </code></pre> <p>Changing <code>legend.margin</code> or <code>legend.box.margin</code> doesn't seem to do anything.</p> <pre><code>ggplot(dfr,aes(x=x,y=value,fill=variable))+ geom_bar(stat="identity")+ theme(legend.position="top", legend.justification="right", legend.margin=margin(0,0,0,0), legend.box.margin=margin(0,0,0,0)) </code></pre>
0debug
Java Optional: map to string from boolean : I'd like to re-write this code using `Optional`-like code: private Order buildOrder(String field) { if (field.startsWith("-")) { return Order.desc(field.substring(1)); } else { return Order.asc(field); } } Up to now, I've been able to code that: private Order buildOrder(String field) { return Optional.of(field.startsWith("-")) .filter(Boolean::booleanValue) .map(() -> field.substring(1)) <<<<1>>>> .orElse(field) .map(Order.desc(field.substring(1))) .orElse(Order.asc(field)); } But I'm getting this compilation error on `<<<<1>>>>`: > Lambda expression's signature does not match the signature of the functional interface method `apply(? super Boolean)` > Type mismatch: cannot convert from `String` to `? extends U`
0debug
NotificationManager getActiveNotifications() for older devices : <p>I want to be able to get active notifications from my Android app on demand. (actually I just need to know if there are any) I've been searching for this behavior and it seems, like I have only two options: <code>NotificationManager.getActiveNotifications()</code> which is exactly what I need, but is only available from SDK 23 or using a <code>NotificationService</code> but I really dislike this solution as I have to provide the permission to my app to read all notifications which is definitely an overkill. </p> <p>Does anybody know about any solution which would behave like <code>NotificationManager.getActiveNotifications()</code> and not require SDK >= 23?</p> <p>Thanks in advance!</p>
0debug
void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { BlockJob *job; if (bs->job || bdrv_in_use(bs)) { error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); return NULL; } bdrv_set_in_use(bs, 1); job = g_malloc0(job_type->instance_size); job->job_type = job_type; job->bs = bs; job->cb = cb; job->opaque = opaque; bs->job = job; return job; }
1threat
Perl: using unpack to split a string into fixed length - then reading the next line : I have an JSON Body of an http post that has to be split into 80 character double quoted strings - but - whenever I use unpack to read the first 80 characters, the string pointer in the source string (which is not CR/LF delimited at the end of each line yet) never changes - e.g. the loop below keeps reading the same string over and over: @row =unpack 'A80', $body; foreach $line (@row) { @row =unpack 'A80', $body; print '"'.$line.'"' ; }
0debug
Repository pattern - Do I "need" a service layer in REST API? : <p><em>Im making this question to get your opinions on the matter, and to see if I'm being dumb or pedantic.</em></p> <hr> <h1>Question (tl;dr;)</h1> <p>Do I "need" the service layer (for good practice) when the repository layer already can do most of the things (like FindUserByID) with queries in a faster way, when the service has to do all these things manually in a much more inefficient and super manual way?</p> <h1>Description (for those who want to read about my motives)</h1> <p>So, I've been dealing with Clean Architecture, which is great, but not for REST architecture. Since, Clean Architecture is literally made with a Controllers layer, and RPC is the one that handles controllers, not REST. REST handles resources. <strong>So, I removed the "controller" layer, and I'm also thinking if I really need a "service" layer as well.</strong></p> <p>So REST needs <strong>"services"</strong> and/or <strong>"repositories"</strong>. The strange thing, is that I think these two overlap. I know that <strong>services</strong> are supposed to <strong>handle "business rules"</strong>. But here's the thing:</p> <h2>Repositories can do the same job with services, but repositories can do the <strong>same job in a much more efficient way</strong>.</h2> <p>Since Repositories are allowed to have direct communication with the database, they can use database queries (sql, or nosql ones). Which are much more <strong>efficient to write</strong>, much more <strong>efficient to read</strong>, much more <strong>efficient on performance</strong>.</p> <h3>Service way:</h3> <p>Say, you need to find a user by his ID, and then pick a specific friend from his friendlist by his name.</p> <ul> <li>You get all the users from <strong>repository</strong></li> <li>You make a <strong>loop</strong> for all the users</li> <li>You make a <strong>condition</strong> where you check which user has the ID you want</li> <li>You make a <strong>loop</strong> for all his friends in the friendlist</li> <li>You make a <strong>condition</strong> to check the friend's name</li> </ul> <p><strong>Summary? Like 20-30 lines of code and slower performance?</strong></p> <h3>Repository way:</h3> <pre class="lang-golang prettyprint-override"><code>filter := bson.M{ "_id": id, "friendlist.name": friendsName, } projection := bson.M{ "friendlist": 1 } friend, err := mongoDb.find(filter, projection) </code></pre> <p><strong>Summary? Like 3-4 lines of code, and 99% database performance.</strong></p> <p>So, is there any real need for the "Service layer" part? Is there any real architectural benefit on splitting it to a service layer and a repository layer, when repository can already do all the jobs much more efficiently by itself?</p>
0debug
import { * } from "@angular" instead of "angular2" : <p>I am little confused here in angular2. Many example show like</p> <pre><code>import { Component } from "@angular/core" </code></pre> <p>But actually in <code>node_module</code> there is <code>angular2</code>directory exists. So logically it should be</p> <pre><code>import { Component } from "angular2/core" </code></pre> <p>What is the difference between this two ?</p>
0debug
static void audio_init (void) { size_t i; int done = 0; const char *drvname; VMChangeStateEntry *e; AudioState *s = &glob_audio_state; if (s->drv) { return; } QLIST_INIT (&s->hw_head_out); QLIST_INIT (&s->hw_head_in); QLIST_INIT (&s->cap_head); atexit (audio_atexit); s->ts = qemu_new_timer (vm_clock, audio_timer, s); if (!s->ts) { hw_error("Could not create audio timer\n"); } audio_process_options ("AUDIO", audio_options); s->nb_hw_voices_out = conf.fixed_out.nb_voices; s->nb_hw_voices_in = conf.fixed_in.nb_voices; if (s->nb_hw_voices_out <= 0) { dolog ("Bogus number of playback voices %d, setting to 1\n", s->nb_hw_voices_out); s->nb_hw_voices_out = 1; } if (s->nb_hw_voices_in <= 0) { dolog ("Bogus number of capture voices %d, setting to 0\n", s->nb_hw_voices_in); s->nb_hw_voices_in = 0; } { int def; drvname = audio_get_conf_str ("QEMU_AUDIO_DRV", NULL, &def); } if (drvname) { int found = 0; for (i = 0; i < ARRAY_SIZE (drvtab); i++) { if (!strcmp (drvname, drvtab[i]->name)) { done = !audio_driver_init (s, drvtab[i]); found = 1; break; } } if (!found) { dolog ("Unknown audio driver `%s'\n", drvname); dolog ("Run with -audio-help to list available drivers\n"); } } if (!done) { for (i = 0; !done && i < ARRAY_SIZE (drvtab); i++) { if (drvtab[i]->can_be_default) { done = !audio_driver_init (s, drvtab[i]); } } } if (!done) { done = !audio_driver_init (s, &no_audio_driver); if (!done) { hw_error("Could not initialize audio subsystem\n"); } else { dolog ("warning: Using timer based audio emulation\n"); } } if (conf.period.hertz <= 0) { if (conf.period.hertz < 0) { dolog ("warning: Timer period is negative - %d " "treating as zero\n", conf.period.hertz); } conf.period.ticks = 1; } else { conf.period.ticks = muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); if (!e) { dolog ("warning: Could not register change state handler\n" "(Audio can continue looping even after stopping the VM)\n"); } QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); }
1threat
Is it necessary to encrypt chat messages before storing it into firebase? : <p>As far as I know, Firebase sends data over an HTTPS connection, so that the data is already being encrypted. Although Firebase provides security rules to protect my data structure, I can still be able to see the string messages in the database.</p> <p>I'm just curious whether it is a good idea to encrypt messages before pushing the data to Firebase or not. Should I just move on from this topic to something else?</p> <p>Thank you.</p>
0debug
static int nuv_header(AVFormatContext *s) { NUVContext *ctx = s->priv_data; AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs, ret; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); avio_skip(pb, 5); avio_skip(pb, 3); width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_r8(pb); avio_skip(pb, 3); aspect = av_int2double(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; fps = av_int2double(avio_rl64(pb)); if (fps < 0.0f) { if (s->error_recognition & AV_EF_EXPLODE) { av_log(s, AV_LOG_ERROR, "Invalid frame rate %f\n", fps); return AVERROR_INVALIDDATA; } else { av_log(s, AV_LOG_WARNING, "Invalid frame rate %f, setting to 0.\n", fps); fps = 0.0f; } } v_packs = avio_rl32(pb); a_packs = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (v_packs) { vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); ctx->v_id = vst->index; ret = av_image_check_size(width, height, 0, s); if (ret < 0) return ret; vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; vst->codecpar->codec_id = AV_CODEC_ID_NUV; vst->codecpar->width = width; vst->codecpar->height = height; vst->codecpar->bits_per_coded_sample = 10; vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000); #if FF_API_R_FRAME_RATE vst->r_frame_rate = #endif vst->avg_frame_rate = av_d2q(fps, 60000); avpriv_set_pts_info(vst, 32, 1, 1000); } else ctx->v_id = -1; if (a_packs) { ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ctx->a_id = ast->index; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codecpar->channels = 2; ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; ast->codecpar->sample_rate = 44100; ast->codecpar->bit_rate = 2 * 2 * 44100 * 8; ast->codecpar->block_align = 2 * 2; ast->codecpar->bits_per_coded_sample = 16; avpriv_set_pts_info(ast, 32, 1, 1000); } else ctx->a_id = -1; if ((ret = get_codec_data(pb, vst, ast, is_mythtv)) < 0) return ret; ctx->rtjpg_video = vst && vst->codecpar->codec_id == AV_CODEC_ID_NUV; return 0; }
1threat
How to setup conditional relationship on Eloquent : <p>I have this (simplified) table structure:</p> <pre><code>users - id - type (institutions or agents) institutions_profile - id - user_id - name agents_profile - id - user_id - name </code></pre> <p>And I need to create a <code>profile</code> relationship on the <code>Users</code> model, but the following doesn't work:</p> <pre><code>class User extends Model { public function profile() { if ($this-&gt;$type === 'agents') return $this-&gt;hasOne('AgentProfile'); else return $this-&gt;hasOne('InstitutionProfile'); } } </code></pre> <p>How could I achieve something like that?</p>
0debug
void helper_ldqf(CPUSPARCState *env, target_ulong addr, int mem_idx) { CPU_QuadU u; helper_check_align(env, addr, 7); #if !defined(CONFIG_USER_ONLY) switch (mem_idx) { case MMU_USER_IDX: u.ll.upper = cpu_ldq_user(env, addr); u.ll.lower = cpu_ldq_user(env, addr + 8); QT0 = u.q; break; case MMU_KERNEL_IDX: u.ll.upper = cpu_ldq_kernel(env, addr); u.ll.lower = cpu_ldq_kernel(env, addr + 8); QT0 = u.q; break; #ifdef TARGET_SPARC64 case MMU_HYPV_IDX: u.ll.upper = cpu_ldq_hypv(env, addr); u.ll.lower = cpu_ldq_hypv(env, addr + 8); QT0 = u.q; break; #endif default: DPRINTF_MMU("helper_ldqf: need to check MMU idx %d\n", mem_idx); break; } #else u.ll.upper = ldq_raw(address_mask(env, addr)); u.ll.lower = ldq_raw(address_mask(env, addr + 8)); QT0 = u.q; #endif }
1threat
Android phones - digital compass without magnetic field sensor? : How is it possible, that a Phone have a digital compass but no magnetic field sensor? In the German data speciation below there a tow different sensors magnet field sensor (Magnetfeldsensor) and compass (Digitaler Kompass) listed. The Huawei P9 has a compass but no magnet field sensor. See under “Ortung/Sensoren”. http://www.sortierbar.de/smartphone/huawei-p9 What is are the differences between this sensor? Can I get from the compass magnet field data?
0debug
int av_base64_decode(uint8_t *out, const char *in, int out_size) { int i, v; uint8_t *dst = out; v = 0; for (i = 0; in[i] && in[i] != '='; i++) { unsigned int index= in[i]-43; if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff) return -1; v = (v << 6) + map2[index]; if (i & 3) { if (dst - out < out_size) { *dst++ = v >> (6 - 2 * (i & 3)); } } } return dst - out; }
1threat
How to validate username and navigate to another page : Trying to validate username and password let passwordInput = document.getElementById('password').value; let userName = document.getElementById('userName').value; function validateLogin(){ event.preventDefault(); // Set errors to an empty array let errors = []; // Conditions for password validation if(passwordInput.length < 8) { errors.push('Your password must be at least 8 characters long') } if(passwordInput.search(/[a-z]/) < 0) { errors.push('Your password must cotain at least one lowercase letter') } if(passwordInput.search(/[A-Z]/) < 0) { errors.push('Your password must conatin at least one uppercase letter') } if(passwordInput.search(/[0-9]/) < 0) { errors.push('Password must contain at least one number!') } if(passwordInput.search(/[\!\@\#\$\%\^\&\*\(\)\_\+\.\,\;\:\-]/) < 0) { errors.push("Your password must contain at least one special character.") } // Login if (errors.length > 0) { document.getElementById("errors").innerHTML = errors.join("<br>") return false; } else if(!errors && userName.value){ console.log('Youre logged in!') } }; ``
0debug
visual studio 2010 syntax error but compile successfully : I have many many syntax errors but my solution ando proyect compiled fine help me pleasee!!!!! adding doestn appear "clean solution" [enter image description here][1] [1]: http://i.stack.imgur.com/uFxo5.png
0debug
How to know if a file is a special file in linux? : As a beginner am asking how to recognize special files in linux ,; How to know if file is special in linux ? Some command would help. thanks
0debug
Call function based on template argument type : <p>There are two "C" functions: </p> <pre><code>void fooA(const char*); void fooW(const wchar_t*); </code></pre> <p>Then there is a wrapper template function:</p> <pre><code>template&lt;typename _TChar&gt; void foo(const _TChar* str) { // call fooA or fooB based on actual type of _TChar // std::conditional .. ? // fooA(str); // fooW(str); } </code></pre> <p>If the caller calls <code>foo("Abc")</code>, this template function should make a compile-time call to <code>fooA</code>. Similiarly, <code>foo(L"Abc")</code> should make the final call to <code>fooW</code>. </p> <p>How do I do that? I thought of using <code>std::conditional</code> but couldn't make it.</p> <p>I cannot make <code>fooA</code> or <code>fooB</code> overloaded, since these are C functions.</p>
0debug
static void xa_decode(short *out, const unsigned char *in, ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc) { int i, j; int shift,filter,f0,f1; int s_1,s_2; int d,s,t; for(i=0;i<4;i++) { shift = 12 - (in[4+i*2] & 15); filter = in[4+i*2] >> 4; f0 = xa_adpcm_table[filter][0]; f1 = xa_adpcm_table[filter][1]; s_1 = left->sample1; s_2 = left->sample2; for(j=0;j<28;j++) { d = in[16+i+j*4]; t = (signed char)(d<<4)>>4; s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6); s_2 = s_1; s_1 = av_clip_int16(s); *out = s_1; out += inc; } if (inc==2) { left->sample1 = s_1; left->sample2 = s_2; s_1 = right->sample1; s_2 = right->sample2; out = out + 1 - 28*2; } shift = 12 - (in[5+i*2] & 15); filter = in[5+i*2] >> 4; f0 = xa_adpcm_table[filter][0]; f1 = xa_adpcm_table[filter][1]; for(j=0;j<28;j++) { d = in[16+i+j*4]; t = (signed char)d >> 4; s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6); s_2 = s_1; s_1 = av_clip_int16(s); *out = s_1; out += inc; } if (inc==2) { right->sample1 = s_1; right->sample2 = s_2; out -= 1; } else { left->sample1 = s_1; left->sample2 = s_2; } } }
1threat
static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback) { #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \ CONFIG_H264_D3D11VA_HWACCEL + \ CONFIG_H264_VAAPI_HWACCEL + \ (CONFIG_H264_VDA_HWACCEL * 2) + \ CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \ CONFIG_H264_VDPAU_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; const enum AVPixelFormat *choices = pix_fmts; int i; switch (h->ps.sps->bit_depth_luma) { case 9: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP9; } else *fmt++ = AV_PIX_FMT_YUV444P9; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P9; else *fmt++ = AV_PIX_FMT_YUV420P9; break; case 10: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP10; } else *fmt++ = AV_PIX_FMT_YUV444P10; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P10; else *fmt++ = AV_PIX_FMT_YUV420P10; break; case 12: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP12; } else *fmt++ = AV_PIX_FMT_YUV444P12; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P12; else *fmt++ = AV_PIX_FMT_YUV420P12; break; case 14: if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) { *fmt++ = AV_PIX_FMT_GBRP14; } else *fmt++ = AV_PIX_FMT_YUV444P14; } else if (CHROMA422(h)) *fmt++ = AV_PIX_FMT_YUV422P14; else *fmt++ = AV_PIX_FMT_YUV420P14; break; case 8: #if CONFIG_H264_VDPAU_HWACCEL *fmt++ = AV_PIX_FMT_VDPAU; #endif if (CHROMA444(h)) { if (h->avctx->colorspace == AVCOL_SPC_RGB) *fmt++ = AV_PIX_FMT_GBRP; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ444P; else *fmt++ = AV_PIX_FMT_YUV444P; } else if (CHROMA422(h)) { if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ422P; else *fmt++ = AV_PIX_FMT_YUV422P; } else { #if CONFIG_H264_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_H264_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; #endif #if CONFIG_H264_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_H264_VDA_HWACCEL *fmt++ = AV_PIX_FMT_VDA_VLD; *fmt++ = AV_PIX_FMT_VDA; #endif #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif if (h->avctx->codec->pix_fmts) choices = h->avctx->codec->pix_fmts; else if (h->avctx->color_range == AVCOL_RANGE_JPEG) *fmt++ = AV_PIX_FMT_YUVJ420P; else *fmt++ = AV_PIX_FMT_YUV420P; } break; default: av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", h->ps.sps->bit_depth_luma); return AVERROR_INVALIDDATA; } *fmt = AV_PIX_FMT_NONE; for (i=0; choices[i] != AV_PIX_FMT_NONE; i++) if (choices[i] == h->avctx->pix_fmt && !force_callback) return choices[i]; return ff_thread_get_format(h->avctx, choices); }
1threat
Is NOT missing from SSE, AVX? : <p>Is it my imagination, or is a <code>PNOT</code> instruction missing from SSE and AVX? That is, an instruction which flips every bit in the vector.</p> <p>If yes, is there a better way of emulating it than <code>PXOR</code> with a vector of all 1s? Quite annoying since I need to set up a vector of all 1s to use that approach.</p>
0debug
Explain argument defination in c# : // Summary: // The text_phrase_prefix is the same as text_phrase, expect it allows for prefix // matches on the last term in the text public QueryContainer MatchPhrasePrefix(Func<MatchPhrasePrefixQueryDescriptor<T>, IMatchQuery> selector);
0debug
How Do choose to have an element removed from a list in R? : Say I have a list consisting of a range of integers from 1-10 with repetition and I want to remove all the 0s from that list, is there an easy way to go abouts doing that? Something like na.omit but for my choice of elements? Thank you
0debug
I want to edit this HTML design in ul li format but when I am converting its images are breakdown. I am newbie Please help me Thanks in advance : I want to edit this HTML design in ul li format but when i am trying to do that it goes breakdown. <!-- begin snippet: js hide: false --> <!-- language: lang-html --> <body> <table bgcolor="#fff" border="0" cellpadding="0" cellspacing="0" width="1132"><tbody><!------------------------------ START ONE -------------------------------------------------------------------------------------><tr><td valign="top"><table border="0" cellpadding="0" cellspacing="0" height="215" width="215"><tbody><tr><td style="padding:5px; background-color:#332F2C; border-bottom: 1px solid #292623;" valign="middle"><a href="http://www.fatkart.com/lehengas" style="text-align:center; font-size:16px; font-family:Verdana, Arial, Helvetica, sans-serif, 'Trebuchet MS'; color:#fff; text-decoration: none; padding-left: 23px; ">LEHENGA CHOLI</a></td></tr><tr><td style="padding:5px; background-color:#332F2C; border-bottom: 1px solid #292623;" valign="middle"><a href="http://www.fatkart.com/lehengas" style="text-decoration:none; font-size:12px;font-family:arial;padding-left:4px; color:#969696;" target="_blank">Designer Lehengas</a></td></tr><tr><td style="padding:5px; background-color:#332F2C; border-bottom: 1px solid #292623;" valign="middle"><a href="http://www.fatkart.com/bollywood-lehengas" style="text-decoration:none;font-size:12px;font-family:arial;padding-left:4px; color:#969696;" target="_blank">Bollywood Lehengas</a></td></tr><tr><td style="padding:5px; background-color:#332F2C; border-bottom: 1px solid #292623;" valign="middle"><a href="http://www.fatkart.com/lehenga-choli-below-3999" style="text-decoration:none;font-size:12px;font-family:arial;padding-left:4px; color:#969696;" target="_blank">Lehengas Below Rs.3999/-</a></td></tr><tr><td style="padding:5px; background-color:#332F2C; border-bottom: 1px solid #292623;" valign="middle"><a href="http://www.fatkart.com/lehenga-choli-below-4999" style="text-decoration:none;font-size:12px;font-family:arial;padding-left:4px;; color:#969696;" target="_blank">Lehengas Below Rs.4999/-</a></td></tr></tbody></table><!---------------------------------- End First COL------------------------------------------------------------------------><!------------------------------ START ----------------------------------------------------------------------></td><td bgcolor="#ffffff" style=" padding-left:10px;" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="185"><tbody><tr><td><a href="http://www.fatkart.com/esha-gupta" style="text-decoration:none" target="_blank"><img alt=" " border="0" height="" src="http://d66kn5h946avo.cloudfront.net//image/data/zas/menu/L1.jpg" style="display:block;color:#ffffff" title=" " width="185"></a></td></tr></tbody></table></td><!-----------------------------End-----------------------------------------------------------------------------><!------------------------------ START ----------------------------------------------------------------------><td bgcolor="#ffffff" style=" padding-left:10px" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="185"><tbody><tr><td><a href="http://www.fatkart.com/alia-bhatt" style="text-decoration:none" target="_blank"><img alt=" " border="0" height="" src="http://d66kn5h946avo.cloudfront.net//image/data/zas/menu/L2.jpg" style="display:block;color:#ffffff" title=" " width="185"></a></td></tr></tbody></table></td><!-----------------------------End-----------------------------------------------------------------------------><!------------------------------ START ----------------------------------------------------------------------><td bgcolor="#ffffff" style=" padding-left:10px" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="185"><tbody><tr><td><a href="http://www.fatkart.com/kriti-sanon" style="text-decoration:none" target="_blank"><img alt=" " border="0" height="" src="http://d66kn5h946avo.cloudfront.net//image/data/zas/menu/L3.jpg" style="display:block;color:#ffffff" title=" " width="185"></a></td></tr></tbody></table></td><!-----------------------------End-----------------------------------------------------------------------------><!------------------------------ START ----------------------------------------------------------------------><td bgcolor="#ffffff" style=" padding-left:10px" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="185"><tbody><tr><td><a href="http://www.fatkart.com/shraddha-kapoor" style="text-decoration:none" target="_blank"><img alt=" " border="0" height="" src="http://d66kn5h946avo.cloudfront.net//image/data/zas/menu/L4.jpg" style="display:block;color:#ffffff" title=" " width="185"></a></td></tr></tbody></table></td><!-----------------------------End-----------------------------------------------------------------------------></tr></tbody></table> </body> </html> <!-- end snippet -->
0debug
Creating date sequence between two given dates - fails on febuary : Im using the following method to create a date sequence between two given dates; public List<DateTime> dateSeq(DateTime startDate, DateTime endDate) { List<DateTime> allDates = new List<DateTime>(); for (DateTime date = startDate; date <= endDate; date = date.AddMonths(1)) allDates.Add(date); return allDates; } Creating a date sequence while incrementing 1 month, when the given date for example are: startDate: 2017-01-01 endDate: 2017-05-01 the sequence i get is fine: 2017-01-01 2017-02-01 2017-03-01 2017-04-01 2017-05-01 But when the given dates are: startDate: 2017-01-31 endDate: 2017-05-31 The sequence i get fail when passing febuary setting the rest of the months sequence on the 28th day: 2017-01-31 2017-02-28 2017-03-28 2017-04-28 2017-05-28 Can someone please explain why is that? Thanks!
0debug
Find index of minimum value in a vector using R : <p>Here is the example in Python which allows us to apply a function to a vector and then get the index of minimum values of function</p> <pre><code>import numpy as np x = np.array([ 0.0011125, 0.0135775, 0.0475375, 0.0399875, 0.0021075, 0.3492275, 0.0065675, 0.0593175, 0.0017225, 0.0007025]) x.argmin() # 9 </code></pre> <p>What's the R way of doing that</p>
0debug
Separate Nubers From A String : I Am Currently Working On An Artificial Intelligence ROBOT Named "PokeBOT". I Have Made It Purely In Java. I Have Successfully Made It's First Version (Check It Here -> https://www.youtube.com/watch?v=Fz9P3JIkHbM&feature=youtu.be). But It's Not Too Good. Now I Want To Upgrade It. That's Where I Need Your Help. I Want To Take An Input As String And Separate The Numbers From It.. Can I Do It ?? Here's What I Exactly Want To Do... INPUT: Add 25 And 25 OUTPUT : 50 INPUT: Subtract 50 From 100 OUTPUT: 50 Here I Can Use Input = Input.toUpperCase(); And The Input.contains("ADD"); Function To Detect Addition, Subtraction, etc. If This Is Possible, Then Please Help. Thanks In Advance!! PokemonGamer <PokemonGamer.pkmn@gmail.com>
0debug
Flutter: How to hide or show more text within certain length : <p>My Container having a description about movies. </p> <p>Initially i want to show only few lines of description. And below to that there should be a link (<strong>more...</strong>), After Tapping <strong>more...</strong> all content of description should be get displayed.</p> <p>For example check this <a href="https://www.jqueryscript.net/demo/Read-More-Less-Plugin-jQuery-Shorten/" rel="noreferrer">JQuery plugin</a>.</p>
0debug
static av_cold int vqa_decode_end(AVCodecContext *avctx) { VqaContext *s = avctx->priv_data; av_free(s->codebook); av_free(s->next_codebook_buffer); av_free(s->decode_buffer); if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); return 0; }
1threat
React js destructuring assignment : I have the following function. ``` returnStateElement = (...elements) => { const copy = Object.assign({}, this.state); return elements.reduce((obj, key) => ({ ...obj, [key]: copy[key] }), {}); }; ``` Work: ``` f = () => { const dataSender = this.returnStateElement('email', 'password'); let { email, password } = dataSender; console.log(dataSender,email,password); } ``` No work: ``` f2 = () => { const { email, password } = dataSender = this.returnStateElement('email', 'password'); console.log(dataSender,email,password); } ``` There is a way to make a more compact type of assignment like f2 (), but that works.
0debug
Why do i need to write (answers[random.randint(0, len(answers) - 1)] instead of random.choiche? : Hello everyone i learned the basics of python. I wanted to start a project on a magic8ball. it didnt worked so i searched a bit and found a working code. he uses this weird thing and i dont know why. can someone explain what this means
0debug
static int get_range_off(int *off, int *y_rng, int *uv_rng, enum AVColorRange rng, int depth) { switch (rng) { case AVCOL_RANGE_MPEG: *off = 16 << (depth - 8); *y_rng = 219 << (depth - 8); *uv_rng = 224 << (depth - 8); break; case AVCOL_RANGE_JPEG: *off = 0; *y_rng = *uv_rng = (256 << (depth - 8)) - 1; break; default: return AVERROR(EINVAL); } return 0; }
1threat
Texas Holdem odds evaluating package for Python : <p>I write my master thesis on "Estimation of poker skills value in late tournament phase". I encountered a problem because i can not find python package which would evaluate hand odds versus each other.</p> <p>What is satisfying for my is simply function: odds(AsAc, KsKc) which would return [% that AsAc wins, % that KsKc wins]</p> <p>I tried package PokerSleuth but it does not work on my pc. (<a href="http://www.barsoom.org/scriptable-equity-calculator" rel="nofollow">http://www.barsoom.org/scriptable-equity-calculator</a> - maybe it works for You)</p> <p>Do You happen to know any python holdem package with function of odds estimation or do You posses a table with all hands vs all hands odds value?</p> <p>Thanks in advance!</p>
0debug
In python i'm getting different answer after input same thing : <p>In python, why I'm getting a different answer after input same thing. if I input <code>print(2**2-2)</code> i'm getting output 2. If I input with power function <code>pow(2,2-2)</code> i'm getting output 1.</p>
0debug
Why do Azure Functions take an excessive time to "wake up"? : <p>We have a simple Azure Function that makes a DocumentDB query. It seems like the first time we call it there is a long wait to finish, and then successive calls are very fast.</p> <p>For example, I just opened our app and the first Function call took 10760ms, definitely noticeable by any end user. After this, all Function calls take approximately 100ms to process and are nearly imperceptible.</p> <p>It seems as though there is some "wake up" cycle in Azure Functions. Is there some way to minimize this, or better yet is this documented somewhere so we can understand what's really going on here?</p>
0debug