problem
stringlengths
26
131k
labels
class label
2 classes
static int open_f(BlockBackend *blk, int argc, char **argv) { int flags = BDRV_O_UNMAP; int readonly = 0; bool writethrough = true; int c; QemuOpts *qopts; QDict *opts; bool force_share = false; while ((c = getopt(argc, argv, "snro:kt:d:U")) != -1) { switch (c) { case 's': flags |= BDRV_O_SNAPSHOT; break; case 'n': flags |= BDRV_O_NOCACHE; writethrough = false; break; case 'r': readonly = 1; break; case 'k': flags |= BDRV_O_NATIVE_AIO; break; case 't': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { error_report("Invalid cache option: %s", optarg); qemu_opts_reset(&empty_opts); return 0; } break; case 'd': if (bdrv_parse_discard_flags(optarg, &flags) < 0) { error_report("Invalid discard option: %s", optarg); qemu_opts_reset(&empty_opts); return 0; } break; case 'o': if (imageOpts) { printf("--image-opts and 'open -o' are mutually exclusive\n"); qemu_opts_reset(&empty_opts); return 0; } if (!qemu_opts_parse_noisily(&empty_opts, optarg, false)) { qemu_opts_reset(&empty_opts); return 0; } break; case 'U': force_share = true; break; default: qemu_opts_reset(&empty_opts); return qemuio_command_usage(&open_cmd); } } if (!readonly) { flags |= BDRV_O_RDWR; } if (imageOpts && (optind == argc - 1)) { if (!qemu_opts_parse_noisily(&empty_opts, argv[optind], false)) { qemu_opts_reset(&empty_opts); return 0; } optind++; } qopts = qemu_opts_find(&empty_opts, NULL); opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL; qemu_opts_reset(&empty_opts); if (optind == argc - 1) { openfile(argv[optind], flags, writethrough, force_share, opts); } else if (optind == argc) { openfile(NULL, flags, writethrough, force_share, opts); } else { QDECREF(opts); qemuio_command_usage(&open_cmd); } return 0; }
1threat
How to replace ".then" from Angularjs2 in Angularjs4 : I have an angularjs2 project where i want to update to angularjs4 loginUser(): void { console.log("login.component.loginUser called"); this.loginService.getTokenInfo(this.userCredentials.userName, this.userCredentials.password) .then(tokenInfo => this.tokenInfo = tokenInfo) .then(tokenInfo => myGlobals.authToken = tokenInfo.token) .then(() => { this.redirectToFuPage(); }); } How do I change this to work for Angularjs4
0debug
How can i find excactly how many lowercases come after an uppercase? : For example: "He Is a small man" has 2 lowercases come after an uppercase. I have tried google but i haven't found anything similar there.
0debug
How can I style a Stripe Elements input with Bootstrap? : <p>I'm building a simple website that will process payments with Stripe. I'm using Bootstrap for my styling. When I use Stripe Elements to insert the payment fields, they aren't styled with Bootstrap. How can I apply Bootstrap's styling to the Elements payment fields?</p>
0debug
When writing code for a TCP socket server, what's the best library (C/C++) to use for multiple asynchronous connections? : <p>I'm writing C/C++ code for a TCP Socket Server that will be running on a Windows machine. I've come across the Winsock library but I'm wondering whether or not it is good enough to handle, say 100-150 simultaneous connections. Any help is appreciated!</p>
0debug
static void sdl_mouse_mode_change(Notifier *notify, void *data) { if (kbd_mouse_is_absolute()) { if (!absolute_enabled) { sdl_hide_cursor(); if (gui_grab) { sdl_grab_end(); } absolute_enabled = 1; } } else if (absolute_enabled) { sdl_show_cursor(); absolute_enabled = 0; } }
1threat
Binding the value in a textarea : <p>I'm trying to do the simplest two way binding in Angular2. I would like to share a variable between my component and it's template.</p> <p>My template is:</p> <pre><code>&lt;textarea [(ngModel)]="currentQuery"&gt;&lt;/textarea&gt; </code></pre> <p>And my component is:</p> <pre><code>import { Component } from '@angular/core'; import { ViewChild } from '@angular/core'; import { OnInit } from '@angular/core'; @Component({ moduleId: module.id, selector: 'vs-home', templateUrl: 'home.component.html' }) export class HomeComponent { private currentQuery: string = ''; } </code></pre> <p>According to the docs this should work but I'm getting:</p> <pre><code>Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'textarea'. (" &lt;div class="query-bar-container"&gt; &lt;textarea [ERROR -&gt;][(ngModel)]="currentQuery"&gt;&lt;/textarea&gt; &lt;!-- &lt;button type="button" class="btn btn-default" (click"): HomeComponent@2:15 </code></pre>
0debug
int qemu_fsdev_add(QemuOpts *opts) { struct FsTypeListEntry *fsle; int i; if (qemu_opts_id(opts) == NULL) { fprintf(stderr, "fsdev: No id specified\n"); return -1; } for (i = 0; i < ARRAY_SIZE(FsTypes); i++) { if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) { break; } } if (i == ARRAY_SIZE(FsTypes)) { fprintf(stderr, "fsdev: fstype %s not found\n", qemu_opt_get(opts, "fstype")); return -1; } fsle = qemu_malloc(sizeof(*fsle)); fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts)); fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path")); fsle->fse.ops = FsTypes[i].ops; QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next); return 0; }
1threat
how to check awscli and compatible botocore package is installed : <p>I am trying to learn python for aws using boto3 so I was trying to execute code given here <a href="https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html" rel="noreferrer">https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html</a> I got errors <code>module boto3 not found</code><br> so I upgraded to boto3 based on an answer here <a href="https://stackoverflow.com/questions/33388555/unable-to-install-boto3">Unable to install boto3</a> mentioned to use <code>pip3 install boto3</code> issuing of this command gives me following output</p> <pre><code>C:\Users\DEEL&gt;pip3 install boto3 Collecting boto3 Downloading https://files.pythonhosted.org/packages/c9/cd/d48602dc99ecb52876cf 741477f15c874b631e5776723f27092693a5b535/boto3-1.7.80-py2.py3-none-any.whl (128k B) 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 133kB 160kB/s Collecting botocore&lt;1.11.0,&gt;=1.10.80 (from boto3) Downloading https://files.pythonhosted.org/packages/5e/cf/b97f44993766af17bf64 aeddadf66f63b6ebf3d700565cc7ee7b13cd0067/botocore-1.10.80-py2.py3-none-any.whl ( 4.5MB) 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4.5MB 1.3MB/s Requirement already satisfied: jmespath&lt;1.0.0,&gt;=0.7.1 in e:\installation2\python 3\lib\site-packages (from boto3) (0.9.3) Requirement already satisfied: s3transfer&lt;0.2.0,&gt;=0.1.10 in e:\installation2\pyt hon3\lib\site-packages (from boto3) (0.1.13) Requirement already satisfied: docutils&gt;=0.10 in e:\installation2\python3\lib\si te-packages (from botocore&lt;1.11.0,&gt;=1.10.80-&gt;boto3) (0.14) Requirement already satisfied: python-dateutil&lt;3.0.0,&gt;=2.1; python_version &gt;= "2 .7" in e:\installation2\python3\lib\site-packages (from botocore&lt;1.11.0,&gt;=1.10.8 0-&gt;boto3) (2.7.3) Requirement already satisfied: six&gt;=1.5 in e:\installation2\python3\lib\site-pac kages (from python-dateutil&lt;3.0.0,&gt;=2.1; python_version &gt;= "2.7"-&gt;botocore&lt;1.11. 0,&gt;=1.10.80-&gt;boto3) (1.11.0) awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10. 80 which is incompatible. Installing collected packages: botocore, boto3 Found existing installation: botocore 1.10.79 Uninstalling botocore-1.10.79: Successfully uninstalled botocore-1.10.79 </code></pre> <p>in this output there is a line <code>awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10. 80 which is incompatible.</code></p> <p>so based on link here <a href="https://stackoverflow.com/questions/36969391/how-to-upgrade-aws-cli-to-the-latest-version">How to upgrade AWS CLI to the latest version?</a> I upgraded awscli <code>pip3 install –upgrade awscli</code> got following output on screen</p> <pre><code>C:\Users\DEEL&gt;pip3 install --upgrade awscli Collecting awscli Downloading https://files.pythonhosted.org/packages/6b/fa/89c248eaacccd816fdea 88206060a7cd221f227855782ff7b0ffb80d725a/awscli-1.15.81-py2.py3-none-any.whl (1. 3MB) 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.3MB 198kB/s Requirement already satisfied, skipping upgrade: rsa&lt;=3.5.0,&gt;=3.1.2 in e:\instal lation2\python3\lib\site-packages (from awscli) (3.4.2) Requirement already satisfied, skipping upgrade: PyYAML&lt;=3.13,&gt;=3.10 in e:\insta llation2\python3\lib\site-packages (from awscli) (3.13) Requirement already satisfied, skipping upgrade: colorama&lt;=0.3.9,&gt;=0.2.5 in e:\i nstallation2\python3\lib\site-packages (from awscli) (0.3.9) Requirement already satisfied, skipping upgrade: botocore==1.10.80 in e:\install ation2\python3\lib\site-packages (from awscli) (1.10.80) Requirement already satisfied, skipping upgrade: s3transfer&lt;0.2.0,&gt;=0.1.12 in e: \installation2\python3\lib\site-packages (from awscli) (0.1.13) Requirement already satisfied, skipping upgrade: docutils&gt;=0.10 in e:\installati on2\python3\lib\site-packages (from awscli) (0.14) Requirement already satisfied, skipping upgrade: pyasn1&gt;=0.1.3 in e:\installatio n2\python3\lib\site-packages (from rsa&lt;=3.5.0,&gt;=3.1.2-&gt;awscli) (0.4.4) Requirement already satisfied, skipping upgrade: jmespath&lt;1.0.0,&gt;=0.7.1 in e:\in stallation2\python3\lib\site-packages (from botocore==1.10.80-&gt;awscli) (0.9.3) Requirement already satisfied, skipping upgrade: python-dateutil&lt;3.0.0,&gt;=2.1; py thon_version &gt;= "2.7" in e:\installation2\python3\lib\site-packages (from botoco re==1.10.80-&gt;awscli) (2.7.3) Requirement already satisfied, skipping upgrade: six&gt;=1.5 in e:\installation2\py thon3\lib\site-packages (from python-dateutil&lt;3.0.0,&gt;=2.1; python_version &gt;= "2. 7"-&gt;botocore==1.10.80-&gt;awscli) (1.11.0) Installing collected packages: awscli Found existing installation: awscli 1.15.80 Uninstalling awscli-1.15.80: Successfully uninstalled awscli-1.15.80 Successfully installed awscli-1.15.81 </code></pre> <p><strong>my question is</strong> what is that incompatibility message which I got when installing boto3 <code>awscli 1.15.80 has requirement botocore==1.10.79, but you'll have botocore 1.10. 80 which is incompatible.</code> how do I check the compatibility of awscli and botocore installations and <strong>what should be done on my machine so that I don't face problems in further development work.</strong></p> <p>pip3 list shows following</p> <pre><code>C:\Users\DEEL&gt;pip3 list Package Version --------------- ------- awscli 1.15.81 boto3 1.7.80 botocore 1.10.80 colorama 0.3.9 docutils 0.14 jmespath 0.9.3 pip 18.0 pyasn1 0.4.4 python-dateutil 2.7.3 PyYAML 3.13 rsa 3.4.2 s3transfer 0.1.13 setuptools 39.0.1 six 1.11.0 </code></pre> <p>What should I do now so that awscli and botocore are compatible? </p> <p>However I would like to mention the code which I was trying from <a href="https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html" rel="noreferrer">https://boto3.readthedocs.io/en/latest/guide/s3-example-creating-buckets.html</a> executed successfully after all this work.</p>
0debug
void bmdma_cmd_writeb(void *opaque, uint32_t addr, uint32_t val) { BMDMAState *bm = opaque; #ifdef DEBUG_IDE printf("%s: 0x%08x\n", __func__, val); #endif if ((val & BM_CMD_START) != (bm->cmd & BM_CMD_START)) { if (!(val & BM_CMD_START)) { if (bm->bus->dma->aiocb) { qemu_aio_flush(); #ifdef DEBUG_IDE if (bm->bus->dma->aiocb) printf("ide_dma_cancel: aiocb still pending\n"); if (bm->status & BM_STATUS_DMAING) printf("ide_dma_cancel: BM_STATUS_DMAING still pending\n"); #endif } } else { bm->cur_addr = bm->addr; if (!(bm->status & BM_STATUS_DMAING)) { bm->status |= BM_STATUS_DMAING; if (bm->dma_cb) bm->dma_cb(bmdma_active_if(bm), 0); } } } bm->cmd = val & 0x09; }
1threat
i keep receiving this error: Call to undefined method mysqli_result::fetch_both()... can somebody please answer this for me : **im trying to create a dummy login page as practice. i keep getting this error: Call to undefined method mysqli_result::fetch_both() ** <?php if (isset($_POST['LOGIN'])){ $EMAIL = $_POST['loginusernameinput']; $PASS = $_POST['loginpasswordinput']; $result = $conn->query("SELECT * FROM userinformationtbl WHERE Email ='$EMAIL' AND password ='$PASS'"); $row = $result -> fetch_both(MYSQLI_BOTH); session_start(); $_SESSION["userID"] = $row["userID"]; header ('location: account.php'); } ?>
0debug
SwiftUI View and @FetchRequest predicate with variable that can change : <p>I have a view showing messages in a team that are filtered using @Fetchrequest with a fixed predicate 'Developers'.</p> <pre><code>struct ChatView: View { @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Message.createdAt, ascending: true)], predicate: NSPredicate(format: "team.name == %@", "Developers"), animation: .default) var messages: FetchedResults&lt;Message&gt; @Environment(\.managedObjectContext) var viewContext var body: some View { VStack { List { ForEach(messages, id: \.self) { message in VStack(alignment: .leading, spacing: 0) { Text(message.text ?? "Message text Error") Text("Team \(message.team?.name ?? "Team Name Error")").font(.footnote) } }... </code></pre> <p>I want to make this predicate dynamic so that when the user switches team the messages of that team are shown. The code below gives me the following error </p> <blockquote> <p>Cannot use instance member 'teamName' within property initializer; property initializers run before 'self' is available</p> </blockquote> <pre><code>struct ChatView: View { @Binding var teamName: String @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Message.createdAt, ascending: true)], predicate: NSPredicate(format: "team.name == %@", teamName), animation: .default) var messages: FetchedResults&lt;Message&gt; @Environment(\.managedObjectContext) var viewContext ... </code></pre> <p>I can use some help with this, so far I'm not able to figure this out on my own.</p>
0debug
set list as value in a column of a pandas dataframe : <p>Let's say I have a dataframe <code>df</code> and I would like to create a new column filled with 0, I use:</p> <pre><code>df['new_col'] = 0 </code></pre> <p>This far, no problem. But if the value I want to use is a list, it doesn't work:</p> <pre><code>df['new_col'] = my_list ValueError: Length of values does not match length of index </code></pre> <p>I understand why this doesn't work (pandas is trying to assign one value of the list per cell of the column), but how can we avoid this behavior? (if it isn't clear I would like every cell of my new column to contain the same predefined list)</p> <p>Note: I also tried: <code>df.assign(new_col = my_list)</code>, same problem</p>
0debug
Empty span dissappeared : I have this html: <div class="panel panel-info"> <div class="panel-heading">Person</div> <div class="panel-body"> <div class="data"> <p class="keys"> <label>Name: </label> <label>Family: </label> </p> <p> <span ng-bind="name"></span> <span ng-bind="family"></span> </p> </div> </div> </div> .data { display: flex; } .keys, .values { display: flex; flex-direction: column; margin: 0; } For some reason, if my first span is empty, the second one will appear instead. I dont want the empty span to disappear. First time it happens to me!
0debug
AWS Elastic Beanstalk 504 Gateway Timeout : <p>I have a Node server running on AWS Elastic Beanstalk. One of my endpoints accepts a huge payload and the function itself is pretty slow and lengthy, and can take upwards of 10+ minutes.</p> <p>Due to business requirements it must remain as a single HTTP POST and cannot be split up to be any smaller.</p> <p>On larger calls I am getting a 504 GATEWAY TIMEOUT, always around the 60 second mark. I have tried toying with the timeout settings in Elastic Beanstalk Load Balancer section to no avail, it seems the longest timeout duration is 60 second anyway.</p> <p>I did see one promising solution in the docs at <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html" rel="noreferrer">https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-idle-timeout.html</a></p> <blockquote> <p>To ensure that lengthy operations such as file uploads have time to complete, send at least 1 byte of data before each idle timeout period elapses</p> </blockquote> <p>This sounds like exactly what I need, but I do not know how to accomplish</p> <p><strong>1)</strong> How can I "send at least 1 byte of data" from my Node app to ensure the session is kept alive and doesn't timeout after one minutes</p>
0debug
stripping capital letters from everything in a collum in the database : I know lots of people have answered this question but i am following the guides but im getting nowhere im currently using UPDATE buinesses SET BusinessType=LOWER(BusinessType) I have want to stip all of the caps from the business names for example: I would like 'Cafe and Post Office' to be 'cafe and post office' Hope someone can help I would do this manually but i have over 500 business types in my database Thank you for any help
0debug
NavigationBarItem: BackButtonItem in Google Maps Navigation Bar : <p>I just completed an map app that uses the Google Maps, Google Places, and Google Place Picker API frameworks. Quick question, though. How do a create a back button within my Google Maps Navigation Bar so that I can dismiss to the previous View Controller that performed the segue to the Google Map View Controller in the first place?</p> <p>Thanks!</p>
0debug
static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &sdhci_vmstate; dc->props = sdhci_sysbus_properties; dc->realize = sdhci_sysbus_realize; dc->reset = sdhci_poweron_reset; }
1threat
Calendar time convertation : <p>Something strange happens when I am trying to convert date to a milliseconds. Maybe someone can explain my this:</p> <pre><code> Calendar calendar = Calendar.getInstance(); calendar.set(2017, 9, 3, 4, 50); SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd hh:mm:ss", Locale.getDefault()); Log.i("tag", formatter.format(calendar.getTime())); </code></pre> <blockquote> <p>and logcat logs my out:</p> <p>I/tag: 2017.10.03 04:50:34</p> </blockquote> <p>Why months are different ?</p>
0debug
static void vexpress_a9_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; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *lowram = g_new(MemoryRegion, 1); MemoryRegion *vram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *hackram = g_new(MemoryRegion, 1); DeviceState *dev, *sysctl, *pl041; SysBusDevice *busdev; qemu_irq *irqp; qemu_irq pic[64]; int n; qemu_irq cpu_irq[4]; uint32_t proc_id; uint32_t sys_id; ram_addr_t low_ram_size, vram_size, sram_size; target_phys_addr_t *map = motherboard_legacy_map; if (!cpu_model) { cpu_model = "cortex-a9"; } for (n = 0; n < smp_cpus; n++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } irqp = arm_pic_init_cpu(env); cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ]; } if (ram_size > 0x40000000) { fprintf(stderr, "vexpress: cannot model more than 1GB RAM\n"); exit(1); } memory_region_init_ram(ram, "vexpress.highmem", ram_size); vmstate_register_ram_global(ram); low_ram_size = ram_size; if (low_ram_size > 0x4000000) { low_ram_size = 0x4000000; } memory_region_init_alias(lowram, "vexpress.lowmem", ram, 0, low_ram_size); memory_region_add_subregion(sysmem, 0x0, lowram); memory_region_add_subregion(sysmem, 0x60000000, ram); dev = qdev_create(NULL, "a9mpcore_priv"); qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); qdev_init_nofail(dev); busdev = sysbus_from_qdev(dev); vexpress_binfo.smp_priv_base = 0x1e000000; sysbus_mmio_map(busdev, 0, vexpress_binfo.smp_priv_base); for (n = 0; n < smp_cpus; n++) { sysbus_connect_irq(busdev, n, cpu_irq[n]); } for (n = 0; n < 64; n++) { pic[n] = qdev_get_gpio_in(dev, n); } sys_id = 0x1190f500; proc_id = 0x0c000191; sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", sys_id); qdev_prop_set_uint32(sysctl, "proc_id", proc_id); qdev_init_nofail(sysctl); sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, map[VE_SYSREGS]); pl041 = qdev_create(NULL, "pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); qdev_init_nofail(pl041); sysbus_mmio_map(sysbus_from_qdev(pl041), 0, map[VE_PL041]); sysbus_connect_irq(sysbus_from_qdev(pl041), 0, pic[11]); dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL); qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT)); qdev_connect_gpio_out(dev, 1, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN)); sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]); sysbus_create_simple("pl050_mouse", map[VE_KMI1], pic[13]); sysbus_create_simple("pl011", map[VE_UART0], pic[5]); sysbus_create_simple("pl011", map[VE_UART1], pic[6]); sysbus_create_simple("pl011", map[VE_UART2], pic[7]); sysbus_create_simple("pl011", map[VE_UART3], pic[8]); sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]); sysbus_create_simple("pl031", map[VE_RTC], pic[4]); sysbus_create_simple("pl111", 0x10020000, pic[44]); sysbus_create_simple("sp804", 0x100e4000, pic[48]); sysbus_create_varargs("l2x0", 0x1e00a000, NULL); sram_size = 0x2000000; memory_region_init_ram(sram, "vexpress.sram", sram_size); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, map[VE_SRAM], sram); vram_size = 0x800000; memory_region_init_ram(vram, "vexpress.vram", vram_size); vmstate_register_ram_global(vram); memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram); if (nd_table[0].vlan) { lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]); } memory_region_init_ram(hackram, "vexpress.hack", 0x1000); vmstate_register_ram_global(hackram); memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, hackram); vexpress_binfo.ram_size = ram_size; vexpress_binfo.kernel_filename = kernel_filename; vexpress_binfo.kernel_cmdline = kernel_cmdline; vexpress_binfo.initrd_filename = initrd_filename; vexpress_binfo.nb_cpus = smp_cpus; vexpress_binfo.board_id = VEXPRESS_BOARD_ID; vexpress_binfo.loader_start = 0x60000000; vexpress_binfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30; arm_load_kernel(first_cpu, &vexpress_binfo); }
1threat
C# Checking if split method is empty : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace switchStatementExercise { class Program { static void Main(string[] args) { String response; Console.WriteLine("Please Vote for your president out of the 7 following, Joseph Mason, James Long, Ben Harding, Georgia Mason, Keith Webb, Mark Grimley, Max Gridley"); response = Console.ReadLine(); string fullNameJoe = response; var names = fullNameJoe.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries); string firstName = names[0]; string lastName = names[1]; Console.WriteLine(lastName); if (response.Equals(fullNameJoe) || response.Equals(firstName) || response.Equals(lastName)) { Console.WriteLine("You have voted for " + fullNameJoe); Console.WriteLine(fullNameJoe); } else if (fullNameJoe.Length > 1 && lastName == null) { Console.WriteLine("You need a last name"); } else { Console.WriteLine("Please enter a first name and last name"); } } } } So what i'm trying to do is check if the last name is empty it was all the user to enter a last name, but I am getting this error. Please Vote for your president out of the 7 following, Joseph Mason, James Long, Ben Harding, Georgia Mason, Keith Webb, Mark Grimley, Max Gridley Joe Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. at switchStatementExercise.Program.Main(String[] args) in C:\Users\Joe\Desktop\cSharpWeek1\switchStatementExercise\switchStatementExercise\Program.cs:line 21 Any help or redirection to the answer would be great!
0debug
Use reselect selector with parameters : <p>How do I pass additional parameters to combined selectors? I am trying to</p> <p>β€’ Get data</p> <p>β€’ Filter data</p> <p>β€’ Add custom value to my data set / group data by myValue</p> <pre><code>export const allData = state =&gt; state.dataTable export const filterText = state =&gt; state.filter.get('text') export const selectAllData = createSelector( allData, (data) =&gt; data ) export const selectAllDataFiltered = createSelector( [ selectAllData, filterText ], (data, text) =&gt; { return data.filter(item =&gt; { return item.name === text }) } ) export const selectWithValue = createSelector( [ selectAllDataFiltered ], (data, myValue) =&gt; { console.log(myValue) return data } ) let data = selectWithValue(state, 'myValue') </code></pre> <p><code>console.log(myValue)</code> returns <code>undefined</code></p>
0debug
static void spectral_to_sample(AACContext *ac) { int i, type; void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce); switch (ac->oc[1].m4ac.object_type) { case AOT_ER_AAC_LD: imdct_and_window = imdct_and_windowing_ld; break; case AOT_ER_AAC_ELD: imdct_and_window = imdct_and_windowing_eld; break; default: imdct_and_window = ac->imdct_and_windowing; } for (type = 3; type >= 0; type--) { for (i = 0; i < MAX_ELEM_ID; i++) { ChannelElement *che = ac->che[type][i]; if (che && che->present) { if (type <= TYPE_CPE) apply_channel_coupling(ac, che, type, i, BEFORE_TNS, AAC_RENAME(apply_dependent_coupling)); if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) { if (che->ch[0].ics.predictor_present) { if (che->ch[0].ics.ltp.present) ac->apply_ltp(ac, &che->ch[0]); if (che->ch[1].ics.ltp.present && type == TYPE_CPE) ac->apply_ltp(ac, &che->ch[1]); } } if (che->ch[0].tns.present) ac->apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1); if (che->ch[1].tns.present) ac->apply_tns(che->ch[1].coeffs, &che->ch[1].tns, &che->ch[1].ics, 1); if (type <= TYPE_CPE) apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, AAC_RENAME(apply_dependent_coupling)); if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) { imdct_and_window(ac, &che->ch[0]); if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) ac->update_ltp(ac, &che->ch[0]); if (type == TYPE_CPE) { imdct_and_window(ac, &che->ch[1]); if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) ac->update_ltp(ac, &che->ch[1]); } if (ac->oc[1].m4ac.sbr > 0) { AAC_RENAME(ff_sbr_apply)(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret); } } if (type <= TYPE_CCE) apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, AAC_RENAME(apply_independent_coupling)); #if USE_FIXED { int j; for(j = 0; j<2048; j++){ che->ch[0].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[0].ret[j]<<7)+0x8000; che->ch[1].ret[j] = (int32_t)av_clipl_int32((int64_t)che->ch[1].ret[j]<<7)+0x8000; } } #endif che->present = 0; } else if (che) { av_log(ac->avctx, AV_LOG_VERBOSE, "ChannelElement %d.%d missing \n", type, i); } } } }
1threat
Set checked checkbox from array : <p>I have 2 set of array which represent all data and selected data</p> <pre><code>$all_data = ["admin","member","editor"]; $selected = ["admin","member"]; </code></pre> <p>I want to make all list of data that have checked if $all_data value = $selected value What the best method to make it possible?</p>
0debug
Function which have diffrent behavior dependable on amount of input args : I want to create a function which will check if it is correct hour to make an action, but I want it to be flexible and check condition for every pair of args given as an input to fuction. I wrote some code how it should like in theory and now im trying to figure out how to write this in code. def report_time(greater_than1=0, lower_than1=24, greater_than2=0, lower_than2=24, greater_than3=0, lower_than3=24 ... lower_thanN=24, greater_thanN=0): if greater_than1 < datetime.now().hour < lower_than1: logger.info('Hour is correct') return True if greater_than2 < datetime.now().hour < lower_than2: logger.info('Hour is correct') return True if greater_than3 < datetime.now().hour < lower_than3: logger.info('Hour is correct') return True ... if greater_thanN < datetime.now().hour < lower_thanN: logger.info('Hour is correct') return True Examples of usage: foo = report_time(16, 18) foo = report_time(16, 18, 23, 24) foo = report_time(16, 18, 23, 24, ..., 3-5)
0debug
pygame elipse has gone wrong : I am trying to make a simple pygame Tic Tac Toe game. the following code is not finished. all its supposed to do is to draw a 3*3 grid, where each rectangle is filled with a red X and a green ellipse. import pygame import random from pygame.locals import * table = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # Define some colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) pygame.init() # Set the width and height of the screen [width, height] window_size = [500, 500] screen = pygame.display.set_mode(window_size, HWSURFACE | DOUBLEBUF | RESIZABLE) pygame.display.set_caption("My Game") # Loop until the user clicks the close button. done = False # Used to manage how fast the screen updates clock = pygame.time.Clock() # -------- Main Program Loop ----------- while not done: # --- Main event loop mouse_pos = [0, 0] mouse_click = 0 for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.MOUSEBUTTONUP: mouse_pos = event.pos mouse_click = event.button elif event.type == VIDEORESIZE: window_size = event.dict['size'] screen = pygame.display.set_mode(event.dict['size'], HWSURFACE | DOUBLEBUF | RESIZABLE) # --- Game logic should go here if mouse_click == 1: for i in xrange(0, 2, 1): for a in xrange(0, 2, 1): if a+window_size[0]/3 > mouse_pos[1] > a and i+window_size[1]/3 > mouse_pos[0] > i: table[i][a] = 1 # --- Screen-clearing code goes here # Here, we clear the screen to white. Don't put other drawing commands # above this, or they will be erased with this command. # If you want a background image, replace this clear with blit'ing the # background image. screen.fill(WHITE) # --- Drawing code should go here for i in xrange(0, window_size[1], window_size[1]/3): for a in xrange(0, window_size[0], window_size[0]/3): pygame.draw.rect(screen, BLACK, [a, i, a+window_size[0]/3, i+window_size[1]/3], 5) pygame.draw.line(screen, RED, [a, i], [a+window_size[0]/3, i+window_size[1]/3], 5) pygame.draw.line(screen, RED, [a+window_size[0]/3, i], [a, i+window_size[1]/3], 5) pygame.draw.ellipse(screen, GREEN, [a, i, a+window_size[0]/3, i+window_size[1]/3], 5) # --- Go ahead and update the screen with what we've drawn. pygame.display.flip() # --- Limit to 60 frames per second clock.tick(60) # Close the window and quit. pygame.quit() for some weird reason, i jast dont get the ellipse right and I dont know why.
0debug
find first and last value within a sequence in r : <p>I have a sequence and then times that are recorded within each sequence. I am trying to find the max value of time that is recorded with its corresponding sequence. Example below:</p> <pre><code> Seq seconds 1 1 1 2 1 2 3 1 3 4 1 4 5 2 1 6 2 2 7 3 1 8 3 2 9 3 3 10 3 4 11 3 5 </code></pre> <p>I would like a result that tells me the max time that was recorded in each sequence. </p> <pre><code>Seq Time 1 4 2 2 3 5 </code></pre>
0debug
static void pxa2xx_pcmcia_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = pxa2xx_pcmcia_realize; }
1threat
C# search textfile after specific search term and change the result in the output : I have a textfile in the format > Name Harry.Potter > Number 123.123234 > Name Lisa.Simpson > Number +44.123234 If the line starts with the word Name I want the dot (.) to be exchanged to a blankspace ( ). How can I change only the dots in the lines starting with Name and NOT Number? I use System.IO.File.WriteAllLines and System.IO.File.ReadAllLines in other parts of the code so it would be nice from my part if this function could be done in similar way. Thanks in advance.
0debug
static inline uint64_t ucf64_dtoi(float64 d) { union { uint64_t i; float64 d; } v; v.d = d; return v.i; }
1threat
Convert class 'pandas.indexes.numeric.Int64Index' to numpy : <p>I am isolating some row ids from a Pandas dataframe, like this: </p> <pre><code>data = df.loc[df.cell == id] rows = df.index print(type(rows)) &lt; class 'pandas.indexes.numeric.Int64Index'&gt; </code></pre> <p>I want to convert rows to a numpy array so I can save it to a mat file using sio.savemat. This is returning an error though:</p> <pre><code>row_mat = rows.as_matrix() AttributeError: 'Int64Index' object has no attribute 'as_matrix' </code></pre> <p>What is the correct way, please? Thanks</p>
0debug
static void bdrv_detach_child(BdrvChild *child) { if (child->next.le_prev) { QLIST_REMOVE(child, next); child->next.le_prev = NULL; } bdrv_replace_child(child, NULL, false); g_free(child->name); g_free(child); }
1threat
Clion C++ fatal error: 'process.h' file not found : When I use clion to compile c++ code for highlight removal in a single image. there is an error shows that [enter image description here][1] please help me fix it. thanks very much [1]: https://i.stack.imgur.com/8GTyr.png
0debug
Control Java maximum Heap size in Centos 7 : <p>I need to minimize the JVM MaxHeapSize. My program keeps freezing on executing. I am using Centos 7. My JVM MaxHeapSize=2G When applying the following command:</p> <pre><code>java -Xmx1024m </code></pre> <p>I get this error:</p> <pre><code> Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM The default VM is server, because you are running on a server-class machine. </code></pre> <p>How to change jvm to a client, and how to avoid this error. With many thanks </p>
0debug
SendGrid development environment : <p>What is the best approach for SendGrid development QA environments? We'd like non Production environments that we can store and test our email templates via the API. The SendGrid sandbox setting doesn't allow emails to actually be sent.</p> <p>Unless there is a better approach, we plan on creating new SendGrid basic accounts for $9.95 a month which allows up-to 40K emails. with this approach, our Dev and QA environments will have different accounts that we can test and deploy with.</p>
0debug
static int bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv, const char *node_name, QDict *options, int open_flags, Error **errp) { Error *local_err = NULL; int ret; bdrv_assign_node_name(bs, node_name, &local_err); if (local_err) { error_propagate(errp, local_err); return -EINVAL; } bs->drv = drv; bs->read_only = !(bs->open_flags & BDRV_O_RDWR); bs->opaque = g_malloc0(drv->instance_size); if (drv->bdrv_file_open) { assert(!drv->bdrv_needs_filename || bs->filename[0]); ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); } else if (drv->bdrv_open) { ret = drv->bdrv_open(bs, options, open_flags, &local_err); } else { ret = 0; } if (ret < 0) { if (local_err) { error_propagate(errp, local_err); } else if (bs->filename[0]) { error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename); } else { error_setg_errno(errp, -ret, "Could not open image"); } goto free_and_fail; } ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { error_setg_errno(errp, -ret, "Could not refresh total sector count"); goto free_and_fail; } bdrv_refresh_limits(bs, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto free_and_fail; } assert(bdrv_opt_mem_align(bs) != 0); assert(bdrv_min_mem_align(bs) != 0); assert(is_power_of_2(bs->bl.request_alignment)); return 0; free_and_fail: g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; }
1threat
How to Access Clipboard data using Java in Windows? : <p>I want to Access Clipboard data/text in my Java Program in Windows 10 system targeted program. Any code snippets or Class that is used to access the clipboard data?</p>
0debug
Create APFS RAM disk on macOS High Sierra : <p>usually creating RAM disks works with the following commands</p> <pre><code>hdid -nomount ram://&lt;blocksize&gt; </code></pre> <p>Returns e.g. /dev/disk2 Then I would format the disk, with say </p> <pre><code>newfs_hfs /dev/disk2 </code></pre> <p>followed by mounting it:</p> <pre><code>mount -t hfs /dev/disk2 /some/mount/target </code></pre> <p>This procedure doesn't seem to work with APFS. I'm on High Sierra beta 9. The mount command doesn't output any error, but the path is not mounted.</p> <p>In my case, after the <code>hdid</code> command finished, <code>newfs_apfs -i /dev/disk2</code> yields</p> <pre><code>nx_kernel_mount:1364: checkpoint search: largest xid 1, best xid 1 @ 1 nx_kernel_mount:1422: sanity checking all nx state... please be patient. spaceman_metazone_init:278: no metazone for device 0, of size 209715200 bytes, block_size 4096 apfs_newfs:18075: FS will NOT be encrypted. </code></pre> <p>When I then enter <code>mount -t apfs /dev/disk2 /some/target/path</code> then the mount commands seems to work for 2 seconds, doesn't give any output and the mount was NOT succesful.</p> <p>Can anyone tell me how to actually make a APFS RAM disk s.t. it works? :p</p> <p>PS: I've also tried something like <code>diskutil partitionDisk /dev/disk2 GPT APFS myvolumename 0b</code> which does mount the volume to <code>/Volumes/myvolumename</code> but creates yet another disk (<code>disk3</code> in this case) which seems odd to me!</p>
0debug
ΒΏHow to change the background Black to Transparent of an image with PHP? : How to resize png and gif image and store transparent background using php? This is my code Your will resize the image to 200x200 px and climb to PIE dir. It's a good job. But when used with png or gif image (transparent bg). It will change bg to black. How can I make srote transparent bg after resizing the image? **Original:** http://imgur.com/a/8FicX **Copy:** http://imgur.com/a/7yQo8 include 'compressImage.php'; <?php $widthArray = array(200); foreach($widthArray as $newwidth) { compressImage($ext,$tmp,$path,$userID.$actual_image_name,$newwidth); } ?> **compressImage.php:** <?php //Compress Image function compressImage($ext,$uploadedfile,$path,$actual_image_name,$newwidth) { if($ext=="jpg" || $ext=="jpeg" ) { $src = imagecreatefromjpeg($uploadedfile); } else if($ext=="png") { $src = imagecreatefrompng($uploadedfile); } else if($ext=="gif") { $src = imagecreatefromgif($uploadedfile); } else { $src = imagecreatefrombmp($uploadedfile); } list($width,$height)=getimagesize($uploadedfile); $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = $path.$newwidth.'_'.$actual_image_name; imagejpeg($tmp,$filename,100); imagedestroy($tmp); return $filename; } ?> [1]: https://i.stack.imgur.com/5YwZv.png
0debug
Exam results processing : <p>I am trying to process around 8000 exam results I have put these in a datatable.</p> <p>What I would like to know is how you would go about processing this data from a statistical point of view.</p> <p>I have looked at averages and Max/min using summary in r. I have used to scatter plot to plot the data. I have used the ridgeline graph generation in ggplot to get understanding of the density/histogram within the various exam subjects.</p> <p>I would love to hear if people had processed such data before and what tests they used, any recommendations on plots that I could use to help our users understand the data would also be very helpful</p> <p>Please send on any links or relevant information or papers that you might feel relevant.</p> <p>Thanks P</p>
0debug
Javascript do both If and Else condition (PHP) : <p>I have a weird question about Javascript and PHP.</p> <p>These are my codes</p> <pre><code>&lt;script&gt; &lt;?php $servername = "localhost"; $username = "root"; $password = "rootroot"; $dbname = "onlinerecruitment"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn-&gt;connect_error) { die("Connection failed: " . $conn-&gt;connect_error); } $s_id = NULL; $pos_id = $_POST['position']; $s_name = $_POST['skill_name']; $s_wg = $_POST['skill_weight']; $click = $_POST['clicks']; $sum = array_sum($s_wg); ?&gt; var sum = '&lt;?php array_sum($s_wg); ?&gt;'; if( sum != 10){ alert("Weight-score is over or lower than 10."); }else{ &lt;?php for($i=0; $i &lt;= $click; $i++){ $sql = ("INSERT INTO required_skills VALUES ('".$s_id."' , '".$pos_id."' , '".$s_name[$i]."' ,'".$s_wg[$i]."')"); $resultt = ""; if ($conn-&gt;query($sql) == TRUE) { $resultt = "FINISH"; } else { $resultt = "ERROR"; } } $conn-&gt;close(); ?&gt; var Message = ' &lt;?php echo $resultt; ?&gt;'; if((Message + "") == "ERROR"){ alert("Something wrong, please contract web admin."); }else{ alert("Weight-score setup successful."); location.href = "Weight_Score_Setup.php" } } </code></pre> <p></p> <p>As you can see there is If and Else conditions, which I test this page to get the "If" condition. The result turns to be "If" but INSERT query also working which it should not to because they are all in "Else" condition. I have no idea how to fix this. Please help.</p>
0debug
JS Generators: How is `return yield` different from `yield`? : <pre><code>function* foo() { yield 123 }; // - - - function* foo() { return yield 123 }; </code></pre> <p>I can’t seem to demonstrate the difference between the two.</p> <ul> <li>Is there a demonstrable difference?</li> <li>Should <code>return</code> be used in a generator?</li> </ul>
0debug
static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int next_dir=-1; LOAD_COMMON LOAD_COMMON2 unsigned map_generation = c->map_generation; cmpf = s->mecc.me_cmp[size]; chroma_cmpf = s->mecc.me_cmp[size + 1]; { const unsigned key = (best[1]<<ME_MAP_MV_BITS) + best[0] + map_generation; const int index= ((best[1]<<ME_MAP_SHIFT) + best[0])&(ME_MAP_SIZE-1); if(map[index]!=key){ score_map[index]= cmp(s, best[0], best[1], 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[index]= key; } } for(;;){ int d; const int dir= next_dir; const int x= best[0]; const int y= best[1]; next_dir=-1; if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0) if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1) if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2) if(dir!=1 && y<ymax) CHECK_MV_DIR(x , y+1, 3) if(next_dir==-1){ return dmin; } } }
1threat
What is pycryptodomex and how does it differ from pycryptodome? : <p>Today I saw PySNMP installing pycryptodomex. The <code>x</code> in that name looked suspicious and surprising.</p> <p>I tried to track it down, but it looks like both <a href="https://pypi.org/project/pycryptodome" rel="noreferrer">pycryptodome</a> and <a href="https://pypi.org/project/pycryptodomex" rel="noreferrer">pycryptodomex</a> are owned by the same account and point back to the <a href="https://github.com/Legrandin/pycryptodome" rel="noreferrer">same Github repository</a>.</p> <p>Especially because a cryptography library is a core security feature, I'm suspicious of the duplication.</p> <p>What's the purpose of this duplication? Could I have discovered this information from open sources?</p>
0debug
Is using keyword a preprocesor directive? : Is using directive a preprocessor directive?. Is it handled by the preprocessor or the compiler? Also, what is a directive? Is 'using' a directive or a keyword?
0debug
void lm4549_write(lm4549_state *s, target_phys_addr_t offset, uint32_t value) { uint16_t *regfile = s->regfile; assert(offset < 128); DPRINTF("write [0x%02x] = 0x%04x\n", offset, value); switch (offset) { case LM4549_Reset: lm4549_reset(s); break; case LM4549_PCM_Front_DAC_Rate: regfile[LM4549_PCM_Front_DAC_Rate] = value; DPRINTF("DAC rate change = %i\n", value); struct audsettings as; as.freq = value; as.nchannels = 2; as.fmt = AUD_FMT_S16; as.endianness = 0; s->voice = AUD_open_out( &s->card, s->voice, "lm4549.out", s, lm4549_audio_out_callback, &as ); break; case LM4549_Powerdown_Ctrl_Stat: value &= ~0xf; value |= regfile[LM4549_Powerdown_Ctrl_Stat] & 0xf; regfile[LM4549_Powerdown_Ctrl_Stat] = value; break; case LM4549_Ext_Audio_ID: case LM4549_Vendor_ID1: case LM4549_Vendor_ID2: DPRINTF("Write to read-only register 0x%x\n", (int)offset); break; default: regfile[offset] = value; break; } }
1threat
How do I cause a "post" request based on text field change? (without the use of a submit button) : I want to have an app where a user types into a text field. After the user is done, the form automatically "submits" a post request (there should be a delay of say, 2 seconds after the user stops typing). I don't know how to do this--I imagine it requires some java-script or more machinery. I'm working in flask/Python. I've extensively searched through SO for these solutions but can't find somewhere to get started.
0debug
AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission) { AVRational q; int j; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { q = (AVRational){1, st->codec->sample_rate}; } else { q = st->codec->time_base; } for (j=2; j<2000; j+= 1+(j>2)) while (q.den / q.num < min_precission && q.num % j == 0) q.num /= j; while (q.den / q.num < min_precission && q.den < (1<<24)) q.den <<= 1; return q; }
1threat
Use collect_list and collect_set in Spark SQL : <p>According to the <a href="http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions$" rel="noreferrer">docs</a>, the <code>collect_set</code> and <code>collect_list</code> functions should be available in Spark SQL. However, I cannot get it to work. I'm running Spark 1.6.0 using a <a href="https://github.com/sequenceiq/docker-spark" rel="noreferrer">Docker image</a>. </p> <p>I'm trying to do this in Scala: </p> <pre><code>import org.apache.spark.sql.functions._ df.groupBy("column1") .agg(collect_set("column2")) .show() </code></pre> <p>And receive the following error at runtime: </p> <pre><code>Exception in thread "main" org.apache.spark.sql.AnalysisException: undefined function collect_set; </code></pre> <p>Also tried it using <code>pyspark</code>, but it also fails. The docs state these functions are aliases of Hive UDAFs, but I can't figure out to enable these functions.</p> <p>How to fix this? Thanx!</p>
0debug
def even_bit_set_number(n): count = 0;res = 0;temp = n while(temp > 0): if (count % 2 == 1): res |= (1 << count) count+=1 temp >>= 1 return (n | res)
0debug
PHP Crypt Function with User input : <p>So I was looking at the <a href="http://php.net/manual/en/function.crypt.php" rel="nofollow">PHP Crypt Function</a></p> <p>and I was wondering if you could make this into a user input form type deal.</p> <p>Like <a href="http://i.stack.imgur.com/KmvkV.png" rel="nofollow">This</a> so when they submit the whatever they entered it will output the crpyt() function after they submit it and crpyt whatever they entered (eg. Like a password or something.) </p> <p>Sorry if this was answered before, I couldn't seem to find it! Any help on this would be great! Thanks.</p>
0debug
What does Dot "." operator use for in swift? is it to call a function? : <p>Just wanna know the usage of Dot operator in swift...</p> <p>public func append(_ value: T) {</p> <pre><code> let newNode = Node(value: value) guard let tailNode = tail else { head = newNode tail = newNode return } newNode.previous = tailNode tailNode.next = newNode tail = newNode } </code></pre>
0debug
Selling my own PHP script : <p>Right now I'm learning how to program in PHP. I'm trying to reach a point where I can build something such as a calendar, chat box, comment section, ext and sell it on a site such as code canyon. I talked to an "Advisor" on Codecademy and he said that it would be very hard to do that without working with a team. Is there any validity to that? I don't see why I could not build my own calendar to schedule appointments on that I built by myself once I have been working with PHP for six months to a year. </p>
0debug
static void unset_dirty_tracking(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { aio_context_acquire(blk_get_aio_context(bmds->blk)); bdrv_release_dirty_bitmap(blk_bs(bmds->blk), bmds->dirty_bitmap); aio_context_release(blk_get_aio_context(bmds->blk)); } }
1threat
unsigned int qemu_get_be16(QEMUFile *f) { unsigned int v; v = qemu_get_byte(f) << 8; v |= qemu_get_byte(f); return v; }
1threat
Calculation on multiple hits in a panda data frame : <p>Hi, I want to know if it's possible to do the following calculation in a panda data frame in python. I have a single data frame with the below columns</p> <p>City | Zone | (B/s) | Total</p> <p>Cardiff | 1 | Buy | 1000</p><p> Cardiff | 1 | Sell | 500</p><p> Cardiff | 2 | Buy | 100</p><p> Bristol | 1 | Buy | 200</p><p> Bristol | 1 | Sell | 100 </p><p></p> What I need if possible is, when City and Zone match and there is both a Buy and Sell for that pair, then do a calculation. So in the above case I would like to do a calculation only on Cardiff Zone 1 and Bristol Zone 1 (as Cardiff Zone 2 only has one line). The calculation is to aggregate the two, so if there is more sells than buys, I only want the sell line but want to do Total Sell - Total Buy to get a net of the two.
0debug
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm0, %%mm4 \n\t" "movq %%mm2, %%mm6 \n\t" "punpcklbw %%mm3, %%mm0 \n\t" "punpckhbw %%mm3, %%mm4 \n\t" "punpcklbw %%mm5, %%mm2 \n\t" "punpckhbw %%mm5, %%mm6 \n\t" MOVNTQ" %%mm0, (%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if HAVE_FAST_64BIT int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i += 2) { uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++) { #if HAVE_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #if COMPILE_TEMPLATE_MMX __asm__(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
1threat
setting Global variable not working in Symfony : I could not access `$result` outside the foreach loop .when I use ` dump($results);` inside the loop I'm getting result but when I'm using ` dump($results);` outside the loop result is empty. $results=array(); foreach ( $menu as $menus) { $mid = $menus->getId(); $em = $this->getDoctrine()->getManager(); $connection = $em->getConnection(); $statement = $connection->prepare("SELECT s.subtitle,m.* FROM submenu as s,menu as m where s.menu_id=m.id and m.id=:data"); $statement->bindValue('data', $mid); $statement->execute(); $results = $statement->fetchAll(); } dump($results)
0debug
static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->props = xlnx_zynqmp_props; dc->realize = xlnx_zynqmp_realize; }
1threat
static inline void downmix_stereo_to_mono(float *samples) { int i; for (i = 0; i < 256; i++) { samples[i] += samples[i + 256]; samples[i + 256] = 0; } }
1threat
Android: API with HttpURLConnection: android.os.NetworkOnMainThreadException : <p>I would like create Android meteo app. So, I use web API to get weather with HttpURLConnection method:</p> <pre><code>package com.example.monlouis.myapplication; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class WeatherAPI { /* Liste des informations utiles Γ  rΓ©cupΓ©rer : TempΓ©rature actuelle Kelvin : main-&gt;temp TempΓ©rature min Kelvin : main-&gt;temp_min TempΓ©rature max Kelvin : main-&gt;temp_max HumiditΓ© actuelle : main-&gt;humidity CoordonnΓ©es GPS (longitude) : coord-&gt;lon CoordonnΓ©es GPS (latitude) : coord-&gt;lat Nom de la ville : name Pays : sys-&gt;country Description courte du temps : weather-&gt;0-&gt;main Description longue du temps : weather-&gt;0-&gt;description */ private static String API_URL = "http://api.openweathermap.org/data/2.5/weather"; private static String API_KEY = "b1b15e88fa797225412429c1c50c122a1"; // Recherche de la mΓ©tΓ©o par code postal + code du pays (fr, en...) public String getWeatherByZipCode(String zipCode, String countryCode) { HttpURLConnection con = null; InputStream is = null; try { con = (HttpURLConnection) ( new URL(API_URL + "?zip=" + zipCode + "," + countryCode + "&amp;appid=" + API_KEY)).openConnection(); con.setRequestMethod("GET"); con.setDoInput(true); con.setDoOutput(true); con.connect(); StringBuffer buffer = new StringBuffer(); is = con.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while( (line = br.readLine()) != null) { buffer.append(line + "\r\n"); } is.close(); con.disconnect(); return buffer.toString(); } catch(Throwable t) { t.printStackTrace(); } finally { try { is.close(); } catch(Throwable t) {} try { con.disconnect(); } catch(Throwable t) {} } return null; } // Recherche de la mΓ©tΓ©o par nom de la ville + code du pays (fr, en...) public static String getWeatherByCityName(String cityName, String countryCode) { HttpURLConnection con = null; InputStream is = null; try { System.out.println(cityName); System.out.println(countryCode); con = (HttpURLConnection) ( new URL(API_URL + "?q=" + cityName + "," + countryCode + "&amp;appid=" + API_KEY)).openConnection(); con.setRequestMethod("GET"); con.setDoInput(true); con.setDoOutput(true); con.connect(); StringBuffer buffer = new StringBuffer(); is = con.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while( (line = br.readLine()) != null) { buffer.append(line + "\r\n"); } is.close(); con.disconnect(); return buffer.toString(); } catch(Throwable t) { t.printStackTrace(); } finally { try { is.close(); } catch(Throwable t) {} try { con.disconnect(); } catch(Throwable t) {} } return null; } // Recherche de la mΓ©tΓ©o par coordonΓ©es GPS public String getWeatherByCoord(double lat, double lon) { HttpURLConnection con = null; InputStream is = null; try { con = (HttpURLConnection) ( new URL(API_URL + "?lat=" + String.valueOf(lat) + "&amp;lon=" + String.valueOf(lon) + "&amp;appid=" + API_KEY)).openConnection(); con.setRequestMethod("GET"); con.setDoInput(true); con.setDoOutput(true); con.connect(); StringBuffer buffer = new StringBuffer(); is = con.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while( (line = br.readLine()) != null) { buffer.append(line + "\r\n"); } is.close(); con.disconnect(); return buffer.toString(); } catch(Throwable t) { t.printStackTrace(); } finally { try { is.close(); } catch(Throwable t) {} try { con.disconnect(); } catch(Throwable t) {} } return null; } } </code></pre> <p>And, I call my API on the MainActivity:</p> <pre><code>package com.example.monlouis.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class MainActivity extends AppCompatActivity implements View.OnClickListener { EditText mContenuText; Button valider; @RequiresApi(api = Build.VERSION_CODES.N) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button bouton = (Button) findViewById(R.id.ValideButton); valider = (Button) findViewById(R.id.ValideButton); mContenuText = (EditText)findViewById(R.id.editText); valider.setOnClickListener(this); //System.out.println(strDate); } public void onClick(View v) { // TODO Auto-generated method stub String chaine = mContenuText.getText().toString(); Log.v("Essai",chaine); String infoAPI = WeatherAPI.getWeatherByCityName(chaine, "fr"); System.out.println(infoAPI); ((TextView)findViewById(R.id.textView3)).setText("Ville: " + chaine); Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MMMM/d/E", Locale.FRANCE); // Set your locale! String strDate = sdf.format(cal.getTime()); System.out.println(strDate); } } </code></pre> <p>I add the permission in the AndroidManifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.monlouis.myapplication"&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"&gt; &lt;activity android:name=".MainActivity"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>But I have this error when I want execute the app on my smartphone (console):</p> <pre><code>03-18 15:07:14.093 27210-27210/com.example.monlouis.myapplication I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 03-18 15:07:14.093 27210-27210/com.example.monlouis.myapplication I/System.out: (HTTPLog)-Static: isShipBuild true 03-18 15:07:14.093 27210-27210/com.example.monlouis.myapplication I/System.out: (HTTPLog)-Thread-1-982556185: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false 03-18 15:07:14.093 27210-27210/com.example.monlouis.myapplication I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 03-18 15:07:14.103 27210-27210/com.example.monlouis.myapplication W/System.err: android.os.NetworkOnMainThreadException 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:418) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:215) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:367) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:295) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.example.monlouis.myapplication.WeatherAPI.getWeatherByCityName(WeatherAPI.java:75) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.example.monlouis.myapplication.MainActivity.onClick(MainActivity.java:46) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.view.View.performClick(View.java:5197) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.view.View$PerformClick.run(View.java:20926) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.os.Handler.handleCallback(Handler.java:739) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.os.Looper.loop(Looper.java:145) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5951) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at java.lang.reflect.Method.invoke(Native Method) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 03-18 15:07:14.113 27210-27210/com.example.monlouis.myapplication W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) </code></pre> <p>Why? Can you help me please?</p> <p>Thanks!</p>
0debug
static int check_refcounts_l1(BlockDriverState *bs, BdrvCheckResult *res, uint16_t *refcount_table, int refcount_table_size, int64_t l1_table_offset, int l1_size, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l1_table, l2_offset, l1_size2; int i, ret; l1_size2 = l1_size * sizeof(uint64_t); inc_refcounts(bs, res, refcount_table, refcount_table_size, l1_table_offset, l1_size2); if (l1_size2 == 0) { l1_table = NULL; } else { l1_table = g_malloc(l1_size2); if (bdrv_pread(bs->file, l1_table_offset, l1_table, l1_size2) != l1_size2) goto fail; for(i = 0;i < l1_size; i++) be64_to_cpus(&l1_table[i]); } for(i = 0; i < l1_size; i++) { l2_offset = l1_table[i]; if (l2_offset) { l2_offset &= L1E_OFFSET_MASK; inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_offset, s->cluster_size); if (offset_into_cluster(s, l2_offset)) { fprintf(stderr, "ERROR l2_offset=%" PRIx64 ": Table is not " "cluster aligned; L1 entry corrupted\n", l2_offset); res->corruptions++; } ret = check_refcounts_l2(bs, res, refcount_table, refcount_table_size, l2_offset, flags); if (ret < 0) { goto fail; } } } g_free(l1_table); return 0; fail: fprintf(stderr, "ERROR: I/O error in check_refcounts_l1\n"); res->check_errors++; g_free(l1_table); return -EIO; }
1threat
Quartz: number of times trigger has executed - C# : I'm trying to save the number of times a trigger has fired into a database table but I can't find anything in the quartz-scheduler.net regarding this. Is there any method I can invoke to achieve this?
0debug
How do I update MySQL 5.7 to the new MySQL 8.0? : <p>How do I <strong>update</strong> to MySQL 8.0 from the default version (5.7)? </p> <p>It's important for me for it to make an update and not re-install MySQL so all my data won't be corrupt. </p> <p>There is not a lot of info regarding this issue since it was only released not long ago with <a href="https://mysqlserverteam.com/whats-new-in-mysql-8-0-generally-available/" rel="noreferrer">tons of awesome new features!</a></p> <p><a href="https://blog.softhints.com/how-to-install-mysql-8-on-ubuntu-16-04/" rel="noreferrer">This is what I have found</a> that seems like it will only update and not destroy my data. I'm not going to proceed until I'm sure. </p>
0debug
static int xan_wc3_decode_frame(XanContext *s) { int width = s->avctx->width; int height = s->avctx->height; int total_pixels = width * height; unsigned char opcode; unsigned char flag = 0; int size = 0; int motion_x, motion_y; int x, y; unsigned char *opcode_buffer = s->buffer1; unsigned char *opcode_buffer_end = s->buffer1 + s->buffer1_size; int opcode_buffer_size = s->buffer1_size; const unsigned char *imagedata_buffer = s->buffer2; const unsigned char *huffman_segment; const unsigned char *size_segment; const unsigned char *vector_segment; const unsigned char *imagedata_segment; int huffman_offset, size_offset, vector_offset, imagedata_offset, imagedata_size; if (s->size < 8) return AVERROR_INVALIDDATA; huffman_offset = AV_RL16(&s->buf[0]); size_offset = AV_RL16(&s->buf[2]); vector_offset = AV_RL16(&s->buf[4]); imagedata_offset = AV_RL16(&s->buf[6]); if (huffman_offset >= s->size || size_offset >= s->size || vector_offset >= s->size || imagedata_offset >= s->size) return AVERROR_INVALIDDATA; huffman_segment = s->buf + huffman_offset; size_segment = s->buf + size_offset; vector_segment = s->buf + vector_offset; imagedata_segment = s->buf + imagedata_offset; if (xan_huffman_decode(opcode_buffer, opcode_buffer_size, huffman_segment, s->size - huffman_offset) < 0) return AVERROR_INVALIDDATA; if (imagedata_segment[0] == 2) { xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size); imagedata_size = s->buffer2_size; } else { imagedata_size = s->size - imagedata_offset - 1; imagedata_buffer = &imagedata_segment[1]; } x = y = 0; while (total_pixels && opcode_buffer < opcode_buffer_end) { opcode = *opcode_buffer++; size = 0; switch (opcode) { case 0: flag ^= 1; continue; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: size = opcode; break; case 12: case 13: case 14: case 15: case 16: case 17: case 18: size += (opcode - 10); break; case 9: case 19: size = *size_segment++; break; case 10: case 20: size = AV_RB16(&size_segment[0]); size_segment += 2; break; case 11: case 21: size = AV_RB24(size_segment); size_segment += 3; break; } if (size > total_pixels) break; if (opcode < 12) { flag ^= 1; if (flag) { xan_wc3_copy_pixel_run(s, x, y, size, 0, 0); } else { if (imagedata_size < size) break; xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size); imagedata_buffer += size; imagedata_size -= size; } } else { motion_x = sign_extend(*vector_segment >> 4, 4); motion_y = sign_extend(*vector_segment & 0xF, 4); vector_segment++; xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y); flag = 0; } total_pixels -= size; y += (x + size) / width; x = (x + size) % width; } return 0; }
1threat
where is the name of Android stagefright media framework? : And is it developed by Google or is it contributed by other open source company(like OpenCore is contributed by PacketVideo)? Anyone knows this history?
0debug
React-native: How to build for ios from windows : <p>We are starting to work with react-native at my company. We have one mac and the rest of the team is running on windows. </p> <p>Is there a way to write the app on windows with the ios device connected to the windows machine or local wifi. Then launch the build on the mac (from the windows pc) and get the app launched on the ios device ? So it would like using the mac only as a build/package server.</p> <p>Hope i am clear enought.</p> <p>Thanks.</p>
0debug
How to open .rdl file in visual studio : <p>I am new with reporting.</p> <p>I have a .rdl file in my system. I needed to open this rdl file in visual studio. When i try to open this file i got a XML file, and unable to see the designer format. </p> <p>I don't know which version of visual studio is used to create this rdl file.</p> <p>Now my question is </p> <p>Is it possible to open a random rdl file in visual studio?</p> <p>if it is not possible then what is the reason for that?</p> <p>if it is possible then why i can't open the file?</p> <p>and is any other files are needed to open this file?</p> <p>please..... </p> <p>thanks in advance</p>
0debug
Need Urgent Help To Retrieve image in datagridview : Here is my code, string constring = @"Data Source=MUZAFFAR_ALI801\SQLSERVER;Initial Catalog=imageform;Integrated Security=True;"; SqlConnection condatabase = new SqlConnection(constring); SqlCommand sc = new SqlCommand(@"SELECT id, Source, Channel, Category, Image, url, Keyword1, Keyword2, Keyword3 FROM Uploads", condatabase); try { SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = sc; DataTable dt = new DataTable(); sda.Fill(dt); BindingSource bSource = new BindingSource(); bSource.DataSource = dt; dataGridView1.DataSource = bSource; sda.Update(dt); } catch (Exception ex) { MessageBox.Show(ex.Message); } i have a database with image column i want to retrieve image in datagridview like i saved in SQL Database in numbers but i faced the error plz help me
0debug
What is the difference between `TabBarView` and `PageView` in Flutter? : <p>What is the difference between <code>TabBarView</code> and <code>PageView</code> in Flutter?</p> <p>I want to implement like this. And I know both can do.</p> <p><a href="https://i.stack.imgur.com/RPxy5.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/RPxy5.gif" alt="enter image description here"></a></p> <p>From <a href="https://github.com/nisrulz/flutter-examples/tree/master/using_bottom_nav_bar" rel="noreferrer">flutter-examples</a></p>
0debug
why is the output of this program 0 in c? : In this code i am trying to pass a pointer to the structure and then using this pointer to work on the structure members but why the output is always showing 0 ? #include<stdio.h> #include<string.h> struct student { int go; }s; void m(); void main() { m(&s); printf("%d",s.go); } void m(struct student *ptr) { ptr->go; }
0debug
Data frame object has no attribute "plt" : <p>I am trying to do some machine learning work in python but i cant plot anything using matplotlib. When i try to run the program, i get the error as shown in the screenshot. <a href="https://i.stack.imgur.com/3Ogdz.png" rel="nofollow noreferrer">error</a></p> <p>Here is the code that i am trying to run. I am using Spyder IDE.</p> <pre><code>import pandas as pd import numpy as np import matplotlib.pyplot as plt dataset=pd.read_csv('student_scores.csv') print(dataset.shape) print(dataset.describe()) dataset.plt(x='Hours',y='Scores',style='o') plt.title('Hours vs Scores') plt.xlabel('Hours Studied') plt.ylable('Score obtained') plt.show() </code></pre> <p>I have tried to uninstall matplotlib and installed it again but it did not work. Can someone help?</p>
0debug
static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf) { AVFilterContext *ctx = inlink->dst; AlphaMergeContext *merge = ctx->priv; int is_alpha = (inlink == ctx->inputs[1]); struct FFBufQueue *queue = (is_alpha ? &merge->queue_alpha : &merge->queue_main); ff_bufqueue_add(ctx, queue, buf); while (1) { AVFilterBufferRef *main_buf, *alpha_buf; if (!ff_bufqueue_peek(&merge->queue_main, 0) || !ff_bufqueue_peek(&merge->queue_alpha, 0)) break; main_buf = ff_bufqueue_get(&merge->queue_main); alpha_buf = ff_bufqueue_get(&merge->queue_alpha); merge->frame_requested = 0; draw_frame(ctx, main_buf, alpha_buf); ff_filter_frame(ctx->outputs[0], avfilter_ref_buffer(main_buf, ~0)); avfilter_unref_buffer(alpha_buf); } return 0; }
1threat
static void slirp_init_once(void) { static int initialized; struct hostent *he; char our_name[256]; #ifdef _WIN32 WSADATA Data; #endif if (initialized) { return; } initialized = 1; #ifdef _WIN32 WSAStartup(MAKEWORD(2,0), &Data); atexit(winsock_cleanup); #endif loopback_addr.s_addr = htonl(INADDR_LOOPBACK); if (gethostname(our_name, sizeof(our_name)) == 0) { he = gethostbyname(our_name); if (he) { our_addr = *(struct in_addr *)he->h_addr; } } if (our_addr.s_addr == 0) { our_addr = loopback_addr; } if (get_dns_addr(&dns_addr) < 0) { dns_addr = loopback_addr; } }
1threat
Can someone please help me on how can i start work on database in Hybrid app : I am a beginner to Ionic framework..I have gone through the crash course available at the http://ionicframework.com/ Can you help me on how can i start using the Sqlite DB in my hybrid app.
0debug
Why cant I use the three method startLeScan,stopLeScan : [enter image description here][1] [1]: http://i.stack.imgur.com/svly5.png Why cant I use the three method startLeScan,stopLeScan and how to solve it
0debug
Seg Fault Depending on Order of Pointer Assignment : <p>Consider the following code:</p> <pre><code>#include &lt;iostream&gt; int main() { // ok by itself int *ptr1; int a = 3; *ptr1 = a; // ok by itself int *ptr2 = new int(4); delete ptr2; } </code></pre> <p>This results in a seg fault, and I can't figure out why. If either of the blocks are commented, it's okay. If the second block is placed above the first block, it's also okay. What's going on here?</p>
0debug
My Email Validation is not working in java?Please see the screen shots below i attached : [***This is my working screen shot1*** ][1] [***When Am trying to put .(dot) in front email address its still showing Email send successfully**][2] [1]: https://i.stack.imgur.com/81VCa.jpg [2]: https://i.stack.imgur.com/vndTP.png **Am putting my validation code:** package com.file; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Validation { public static boolean isValidEmail(String email) { String ePattern = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$"; Pattern p = java.util.regex.Pattern.compile(ePattern); Matcher m = p.matcher(email); return m.matches(); } }
0debug
I'm trying to create a function that will take in one argument as a string, and delete that string from an array. : I'm trying to create a function that will take in one argument as a string, and delete that string from an array. I've looked and tried 'remove(at:)' but this is not working. I need the function to take in the droid's name, and delete it from the array. It's so simple, but I can't find anything anywhere that would help. I keep finding things that specify a certain place in the array as an Int, but I need the function to work with a string. var starWarsDroids: [String] = ["R2-D2", "C-3P0", "IG-88", "BB-8"] func removeDroid(droid:String) { starWarsDroids.remove(at:0) } removeDroid(droid: "C-3P0") print(starWarsDroids) This is all I could come up with, and I know it doesn't work, so please don't tell me it doesn't. There has to be a way to do this without specifying a place in the array with an Int.
0debug
Program to print following pattern in C++ : <p>How can I produce the following pattern in C++ considering the input has odd digits.</p> <pre><code>P M R A O R G O R R A P M </code></pre> <p>I tried the following code but I don't know how to proceed with it.</p> <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt; using namespace std; int main() { char word[100]; int len, temp; cout &lt;&lt; "Input word with odd letters: \n"; cin &gt;&gt; word; len = strlen(word); cout &lt;&lt; "Entered word was : "&lt;&lt; word &lt;&lt; " and of size: " &lt;&lt; strlen(word) &lt;&lt; "\n"; if(len % 2==0) { cout &lt;&lt; "Please enter a word with odd number of letters!"; } else { int mid; mid = (len - 1)/2; cout &lt;&lt; "The middle number is : " &lt;&lt; mid+1 &lt;&lt; " and character is " &lt;&lt; word[mid] &lt;&lt; "\n"; temp = len - 1; for(int i=0; i&lt;len; i++) { // Some logic to display it just like above } cout &lt;&lt; "done" &lt;&lt; endl; } } </code></pre>
0debug
How to generate unique ids in C : <p>I am developing an app which requires to generate an id for new users I want to do it with the smallest number of characters that allows me to create 100 billion diferent possible ids so how should I do that and how to avoid giving two users the same it? Should I look if that id exists? Should I use a random id generator or give ids in order like 001 002 and so on?</p>
0debug
Best merge or join function in r : <p>I have two dataframes df1 and df2. Both have a common identifier column.</p> <p>df1 has unique lines for each identifier. But has identifier values that are not in df2.</p> <p>df2 has multiple lines for each identifier value.</p> <p>I want to merge the two so that I preserve the number of rows of df2, but map the (repeating) relevant ID rows from df1 into df2.</p> <p>Is is best to use merge or join or something else? What arguments?</p> <p>Thanks :)</p>
0debug
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h; GetBitContext *gb = &h->HEVClc->gb; SliceHeader *sh = &h->sh; const uint8_t *buf_end = buf + buf_size; int state = -1, i; HEVCNAL *nal; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; if (!buf_size) return 0; if (h->nals_allocated < 1) { HEVCNAL *tmp = av_realloc_array(h->nals, 1, sizeof(*tmp)); if (!tmp) return AVERROR(ENOMEM); h->nals = tmp; memset(h->nals, 0, sizeof(*tmp)); h->nals_allocated = 1; } nal = &h->nals[0]; for (;;) { int src_length, consumed; buf = avpriv_find_start_code(buf, buf_end, &state); if (--buf + 2 >= buf_end) break; src_length = buf_end - buf; h->nal_unit_type = (*buf >> 1) & 0x3f; h->temporal_id = (*(buf + 1) & 0x07) - 1; if (h->nal_unit_type <= NAL_CRA_NUT) { if (src_length > 20) src_length = 20; } consumed = ff_hevc_extract_rbsp(h, buf, src_length, nal); if (consumed < 0) return consumed; init_get_bits8(gb, nal->data + 2, nal->size); switch (h->nal_unit_type) { case NAL_VPS: ff_hevc_decode_nal_vps(h); break; case NAL_SPS: ff_hevc_decode_nal_sps(h); break; case NAL_PPS: ff_hevc_decode_nal_pps(h); break; case NAL_SEI_PREFIX: case NAL_SEI_SUFFIX: ff_hevc_decode_nal_sei(h); break; case NAL_TRAIL_N: case NAL_TRAIL_R: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: sh->first_slice_in_pic_flag = get_bits1(gb); s->picture_structure = h->picture_struct; s->field_order = h->picture_struct; if (IS_IRAP(h)) { s->key_frame = 1; sh->no_output_of_prior_pics_flag = get_bits1(gb); } sh->pps_id = get_ue_golomb(gb); if (sh->pps_id >= MAX_PPS_COUNT || !h->pps_list[sh->pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } h->pps = (HEVCPPS*)h->pps_list[sh->pps_id]->data; if (h->pps->sps_id >= MAX_SPS_COUNT || !h->sps_list[h->pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", h->pps->sps_id); return AVERROR_INVALIDDATA; } if (h->sps != (HEVCSPS*)h->sps_list[h->pps->sps_id]->data) { h->sps = (HEVCSPS*)h->sps_list[h->pps->sps_id]->data; h->vps = (HEVCVPS*)h->vps_list[h->sps->vps_id]->data; } if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (h->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); else sh->dependent_slice_segment_flag = 0; slice_address_length = av_ceil_log2_c(h->sps->ctb_width * h->sps->ctb_height); sh->slice_segment_addr = get_bits(gb, slice_address_length); if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) { av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } } else sh->dependent_slice_segment_flag = 0; if (sh->dependent_slice_segment_flag) break; for (i = 0; i < h->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(h->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (h->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (h->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(h)) { sh->pic_order_cnt_lsb = get_bits(gb, h->sps->log2_max_poc_lsb); s->output_picture_number = h->poc = ff_hevc_compute_poc(h, sh->pic_order_cnt_lsb); } else s->output_picture_number = h->poc = 0; if (h->temporal_id == 0 && h->nal_unit_type != NAL_TRAIL_N && h->nal_unit_type != NAL_TSA_N && h->nal_unit_type != NAL_STSA_N && h->nal_unit_type != NAL_RADL_N && h->nal_unit_type != NAL_RASL_N && h->nal_unit_type != NAL_RADL_R && h->nal_unit_type != NAL_RASL_R) h->pocTid0 = h->poc; return 0; } buf += consumed; } av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; }
1threat
Mount a volume in docker-compose conditionally : <p>I have a <code>docker-compose.yml</code> configuration. One of the containers there is a Tomcat server and it has some default <code>.war</code> file deployed in <code>webapps</code> directory.</p> <p>I want to have the ability to pass (override) the <code>war</code> archive to be deployed by some which resides on the host machine. I think the best would be to have ability somehow switch / override starting <code>docker-compose</code>: as a default, I want to run the webapp (<code>war</code> file) which is inside the container, but I want to have a possibility to mount a directory from my host (for example during development / debugging) if need be.</p> <p>Currently, I have the following line in my <code>docker-compose.yml</code>, which is commented out if I need the default. </p> <pre><code>volumes: # By default, there is the latest version of the application already present in the container # If you want to provider the container with your own .war file, uncomment the following line # - ./application/webapps:/usr/local/tomcat/webapps </code></pre> <p>Is there a better way how to achieve that?</p>
0debug
void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra) { r4k_tlb_t *tlb; target_ulong addr; target_ulong end; uint8_t ASID = env->CP0_EntryHi & 0xFF; target_ulong mask; tlb = &env->tlb->mmu.r4k.tlb[idx]; if (tlb->G == 0 && tlb->ASID != ASID) { return; } if (use_extra && env->tlb->tlb_in_use < MIPS_TLB_MAX) { env->tlb->mmu.r4k.tlb[env->tlb->tlb_in_use] = *tlb; env->tlb->tlb_in_use++; return; } mask = tlb->PageMask | ~(TARGET_PAGE_MASK << 1); if (tlb->V0) { addr = tlb->VPN & ~mask; #if defined(TARGET_MIPS64) if (addr >= (0xFFFFFFFF80000000ULL & env->SEGMask)) { addr |= 0x3FFFFF0000000000ULL; } #endif end = addr | (mask >> 1); while (addr < end) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } if (tlb->V1) { addr = (tlb->VPN & ~mask) | ((mask >> 1) + 1); #if defined(TARGET_MIPS64) if (addr >= (0xFFFFFFFF80000000ULL & env->SEGMask)) { addr |= 0x3FFFFF0000000000ULL; } #endif end = addr | mask; while (addr < end) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } }
1threat
Trying to install easy_install or pip for gjango : I try to install django and here is what i get when i try to instal pip => " Fatal error in launcher: Unable to create process using '"' When i enter de command => python -m pip install XXX it does not work. Any help ?
0debug
static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr, Error **errp) { QIOChannelSocket *sioc; Error *local_err = NULL; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client"); qio_channel_socket_connect_sync(sioc, saddr, &local_err); if (local_err) { error_propagate(errp, local_err); return NULL; } qio_channel_set_delay(QIO_CHANNEL(sioc), false); return sioc; }
1threat
ASP.NET: display count of Viewbag list items : Hi is there a way to display a viewbag list and show count Like: <br/> United Arab Emirates(8)<br/> Angola(4)<br/> Argentina(7)<br/> Austria(0)<br/> Belgium(11)<br/> Currently i have a Checkboxlist(costume helper) in view @Html.CheckBoxList("checkedLocation", (ViewBag.country_list as MultiSelectList)) Only countries are displayed. Wud be great if the same list has counts Basically i have a company table with country fields. Just wanna show that in Brazil, ten companies are available like <b>Brazil(10)</b>
0debug
document.write('<script src="evil.js"></script>');
1threat
how to find the solution for to find the difference between last two entries in Mysql : I need a solution regarding the Fine the difference between the last two entries difference in mysql SELECT DATE_FORMAT(order_datetime,'%m/%Y') as date, SUM(order_total_after_tax) as number FROM tbl_order where status='Confirmed' GROUP BY DATE_FORMAT(order_datetime,'%Y/%m') Limit 2 OutPut : date number 02/2019 2345.01 03/2019 103751.05 But i need exact soltion is i need to find difference between the last 2 result 2345.01 -103751.05 Result : -101406.04 how to do in mysql What is the Query ?
0debug
getting 2 classes next to each other : i am trying to get 2 classes that are under each other to get next to each other, here is a screenshot of the 2 classes: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/V0tLL.png The right class is .testm_boxes1 The left class is .testm_boxes2 and here is the css : <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .testm_boxes1{ text-align: center; float: right !important; } .testm_boxes2{ text-align: center; float: left !important; } <!-- end snippet --> thanks in advance.
0debug
Why do I get a System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error? : <p>I've got an essential skills program which is very simple. The question is within the code. I want the question to be loaded from a text file. </p> <p>I have already added some questions to the text file.</p> <p>I have a list index where a random question will be picked from the text file and it will load as a label. </p> <p>The issue is when I try to load the question I get a: <strong>System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error</strong></p> <p>Here is my code: </p> <pre><code> private void LoadQuestions() { if(Globals.intQuestionNumber == 11) { MessageBox.Show("Quiz complete - Redirecting", "Quiz Complete"); var fileStream = new FileStream(@"H:\(4)Programming\Assignments\EssentialSkills - Optimised\EssentialSkills\Numeracy\QuestionsLvl0.txt", FileMode.Open, FileAccess.Read); using (var streamReader = new StreamReader(fileStream, Encoding.UTF8)) { string line; while ((line = streamReader.ReadLine()) != null) { stringAllInfo.Add(line); MessageBox.Show(line); } } char[] delimiterChars = { ',' }; foreach (string l in stringAllInfo) { string[] words = l.Split(delimiterChars); strQuestion.Add(words[0]); strAnswer.Add(words[1]); Console.WriteLine(words[0]); Console.WriteLine(words[1]); } Menus.Summary sum = new Menus.Summary(); sum.Show(); this.Hide(); } else { lblCountdownval.Visible = false; lblCountdown.Visible = false; Globals.intQuestionNumber += 0; lblQuestionsNumber.Text = "Question Number: " + Globals.intQuestionNumber.ToString(); Random random = new Random(); Globals.listIndex = random.Next(0, strAnswer.Count - 1); lblQuestion.Text = strQuestion.ElementAt(Globals.listIndex); Globals.listQuestonsAsked.Add(strQuestion.ElementAt(Globals.listIndex)); btnCorrect.Text = strAnswer.ElementAt(Globals.listIndex).ToString(); btnAnswer1.Text = random.Next(200).ToString(); btnAnswer3.Text = random.Next(200).ToString(); int locationIndex = random.Next(0, 3); btnCorrect.Location = points.ElementAt(locationIndex); locationIndex = random.Next(0, 3); btnAnswer1.Location = points.ElementAt(locationIndex); while ((btnAnswer1.Location == btnCorrect.Location)) { locationIndex = random.Next(0, 3); btnAnswer1.Location = points.ElementAt(locationIndex); } locationIndex = random.Next(0, 3); btnAnswer3.Location = points.ElementAt(locationIndex); while ((btnAnswer3.Location == btnCorrect.Location) || (btnAnswer3.Location == btnAnswer1.Location)) { locationIndex = random.Next(0, 3); btnAnswer3.Location = points.ElementAt(locationIndex); } btnAnswer1.Show(); btnCorrect.BackColor = Color.White; btnAnswer3.Show(); } } </code></pre> <p>and here are my Lists:</p> <pre><code> public List&lt;string&gt; strQuestion = new List&lt;string&gt;(); public List&lt;string&gt; strAnswer = new List&lt;string&gt;(); public List&lt;string&gt; stringAllInfo = new List&lt;string&gt;(); </code></pre> <p>I want the question from the text file to a label but I get that error. </p> <p>Any advice?</p> <p>Thanks. </p>
0debug
Failed to find DRM Plugin : <p>I'm trying to run my app with Gmail Login on genymotion emulator. But I keep getting a Failed to find DRM plugin error. I have added the ARM translation zip to the emulator and gApps for the given device. The app runs perfectly on real devices(HTC desire 500 and a Nexus 5). The emulator is a Nexus 5 with Lollipop 5.1.</p> <pre><code>02-20 05:27:13.292 1693-2186/? E/Drm: Failed to find drm plugin 02-20 05:27:13.292 3684-3868/? W/DG.WV: Widevine DRM not supported on this device 02-20 05:27:13.292 3684-3868/? W/DG.WV: android.media.UnsupportedSchemeException: Failed to instantiate drm object. 02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.native_setup(Native Method) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.&lt;init&gt;(MediaDrm.java:180) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at com.google.android.gms.droidguard.q.run(SourceFile:99) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.lang.Thread.run(Thread.java:818) 02-20 05:27:13.300 2686-3863/? V/BaseAuthAsyncOperation: access token request successful 02-20 05:27:13.301 3684-3735/? I/GoogleURLConnFactory: Using platform SSLCertificateSocketFactory 02-20 05:27:13.742 3471-3471/? I/adfjksf: Status{statusCode=INTERNAL_ERROR, resolution=null} 02-20 05:27:13.814 3471-3492/? W/EGL_emulation: eglSurfaceAttrib not implemented 02-20 05:27:13.814 3471-3492/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3ee7840, error=EGL_SUCCESS 02-20 05:27:14.837 2279-3867/? W/GLSUser: [AppCertManager] IOException while requesting key: </code></pre>
0debug
uint32_t qpci_io_readl(QPCIDevice *dev, void *data) { uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { return dev->bus->pio_readl(dev->bus, addr); } else { uint32_t val; dev->bus->memread(dev->bus, addr, &val, sizeof(val)); return le32_to_cpu(val); } }
1threat
static int xen_pt_cmd_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint16_t *val, uint16_t dev_value, uint16_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint16_t writable_mask = 0; uint16_t throughable_mask = 0; uint16_t emu_mask = reg->emu_mask; if (s->is_virtfn) { emu_mask |= PCI_COMMAND_MEMORY; } writable_mask = ~reg->ro_mask & valid_mask; cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask); throughable_mask = ~emu_mask & valid_mask; if (*val & PCI_COMMAND_INTX_DISABLE) { throughable_mask |= PCI_COMMAND_INTX_DISABLE; } else { if (s->machine_irq) { throughable_mask |= PCI_COMMAND_INTX_DISABLE; } } *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask); return 0; }
1threat
Can comments be started in the first line before a query in oracle sql : As in i just want to execute a query with a comment: Ex: /*Selects all columns and rows*/ SELECT * FROM "SNAPLOGIC"."CUSTCOMM1" or -- comment select * from "SNAPLOGIC"."CUSTCOMM1" Can we execute in oracle sql? Note: These statement can be executed in tools like dbeaver etc.,
0debug
Why does this function not return anything? : <p>I have the following function written in python 3</p> <pre><code>def nullstelle(f,a,b,counter=0,TOL=10 ** -4): counter = counter + 1 if counter &lt;= 100: g = f((a + b)/2) if f(a) * g &lt;= 0: b = (a + b)/2 else: a = (a + b)/2 if abs(a-b) &lt;= 2*TOL: return (a,b) else: nullstelle(f,a,b,counter,TOL) else: return (a,b) </code></pre> <p>my problem is, that for the input</p> <pre><code>def f(x): return x ** 3 -2 nullstelle(f,0,3) </code></pre> <p>it does not return anything. I really do not understand how this is possibly.</p> <p><em>Im sorry if this looks like a trivial question to you guys, but programming is absolutely not my main field of interest and I know nearly nothing about it (yet).</em></p>
0debug
int ff_h264_decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type_nos != FF_I_TYPE){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); else predict_field_decoding_flag(h); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); } h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type_nos == FF_B_TYPE){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type_nos == FF_P_TYPE){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type_nos == FF_I_TYPE); if(h->slice_type == FF_SI_TYPE && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ unsigned int x; align_get_bits(&s->gb); for(x=0; x < (CHROMA ? 384 : 256); x++){ ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8); } s->current_picture.qscale_table[mb_xy]= 0; memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if(IS_INTRA(mb_type)){ int pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } ff_h264_write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } if(CHROMA){ pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb)); if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; } }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type_nos == FF_B_TYPE){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0]) || IS_DIRECT(h->sub_mb_type[1]) || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { ff_h264_pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type_nos == FF_P_TYPE); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ unsigned int tmp; if(ref_count == 1){ tmp= 0; }else if(ref_count == 2){ tmp= get_bits1(&s->gb)^1; }else{ tmp= get_ue_golomb_31(&s->gb); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list)){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ ff_h264_pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, val, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ if(h->ref_count[list] == 1){ val= 0; }else if(h->ref_count[list] == 2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ optimize if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(CHROMA){ if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp [cbp]; }else{ if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp]; else cbp= golomb_to_inter_cbp_gray[cbp]; } } h->cbp = cbp; if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ if(get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; h->cbp_table[mb_xy]= cbp; } } s->current_picture.mb_type[mb_xy]= mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i8x8, i4x4, chroma_idx; int dquant; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8, *dc_scan; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } dquant= get_se_golomb(&s->gb); if( dquant > 25 || dquant < -26 ){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } s->qscale += dquant; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if(IS_INTRA16x16(mb_type)){ if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){ return -1; continue if partitioned and other return -1 too } assert((cbp&15) == 0 || (cbp&15) == 15); if(cbp&15){ for(i8x8=0; i8x8<4; i8x8++){ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } }else{ for(i8x8=0; i8x8<4; i8x8++){ if(cbp & (1<<i8x8)){ if(IS_8x8DCT(mb_type)){ DCTELEM *buf = &h->mb[64*i8x8]; uint8_t *nnz; for(i4x4=0; i4x4<4; i4x4++){ if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 ) return -1; } nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] += nnz[1] + nnz[8] + nnz[9]; }else{ for(i4x4=0; i4x4<4; i4x4++){ const int index= i4x4 + 4*i8x8; if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 4*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } }else{ uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
1threat
static void subpage_ram_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { ram_addr_t raddr = addr; void *ptr = qemu_get_ram_ptr(raddr); switch (size) { case 1: return stb_p(ptr, value); case 2: return stw_p(ptr, value); case 4: return stl_p(ptr, value); default: abort(); } }
1threat
moment.js - switch language to local : <p>I try to switch the language to german, but it doesn't work :S</p> <p>JS:</p> <pre><code>$(solutions[0]).html(moment().locale('de').subtract({h: 2, m: 10}).format('DD. MMMM YYYY')); </code></pre> <p>Here is my fiddle: <a href="https://jsfiddle.net/yo57jnbj/" rel="nofollow noreferrer">https://jsfiddle.net/yo57jnbj/</a></p>
0debug