problem
stringlengths
26
131k
labels
class label
2 classes
How Do I Read Filenames from a Folder and Add Them Into an Arraylist Without Having to Make an Array and Looping all the Answers Into the Arraylist? : For example, say I have a list of .txt files in a folder. What do I need to do in order for Java to read through each of the names of each file and add them into a string array list without having to do a String[] like other answers have suggested?
0debug
Android Gradle CompilationFailedException after Android Studio Update : <p>I'm getting the following error when I build my project:</p> <pre><code>org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details. at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:50) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:35) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:98) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:51) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:37) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilationFinalizer.execute(IncrementalCompilationFinalizer.java:39) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilationFinalizer.execute(IncrementalCompilationFinalizer.java:24) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:207) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:133) at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(AndroidJavaCompile.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) </code></pre> <p>Java compiler:</p> <pre><code>Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details. </code></pre> <p>This is my project level build.gradle:</p> <pre><code>buildscript { repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.google.gms:google-services:3.1.1' } } allprojects { repositories { google() jcenter() maven { url "https://maven.google.com" } maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } </code></pre> <p>Does anybody know how to fix this?</p>
0debug
I wana to get all in mysql : I want fetch all rows in mysql column but it return only 1 is have try this out while($info=mysql_fetch_all($query2, mysql_assoc)) { but not working please help me out
0debug
How Replace string with php : <p>I need to replace this kind of a string:</p> <pre><code>https://r2---sn-vgqs7nez.c.docs.google.com/ https://r2---sn-testne4.c.docs.google.com/ https://r5---sn-vfghtgh.c.docs.google.com/ </code></pre> <p>to this</p> <pre><code>https://redirector.googlevideo.com/ </code></pre> <p>using php, help me please</p>
0debug
int qemu_paio_error(struct qemu_paiocb *aiocb) { ssize_t ret = qemu_paio_return(aiocb); if (ret < 0) ret = -ret; else ret = 0; return ret; }
1threat
Creating a symptom checker on Dialogflow : <p>Can a symptom checker, such as WebMd's be created in Dialogflow. Can dialog flow connect different user inputs (symptoms) to one output (disease) or do i need to use a different kind of framework for this?</p>
0debug
C# make an image the background and take up the entire web page : So I'm working on a website and I want to add an image as the background and have it take up the entire web page so if there's scrolling the image is still available, but I'm lost at how I would do this. Can anyone help me out Thanks!
0debug
static void slavio_set_irq(void *opaque, int irq, int level) { SLAVIO_INTCTLState *s = opaque; DPRINTF("Set cpu %d irq %d level %d\n", s->target_cpu, irq, level); if (irq < 32) { uint32_t mask = 1 << irq; uint32_t pil = s->intbit_to_level[irq]; if (pil > 0) { if (level) { s->intregm_pending |= mask; s->intreg_pending[s->target_cpu] |= 1 << pil; slavio_check_interrupts(s); } else { s->intregm_pending &= ~mask; s->intreg_pending[s->target_cpu] &= ~(1 << pil); } } } }
1threat
Does exists "with" keyword (or default method) on java? : I'm working on a code when I notice the following "with" keyword on the constructor and I wanted to know what kind of constructor (or technique) is this, and how to use it. public static Database with(String key) { if (sInstance == null) { sInstance = new Database(key); } return sInstance; } And one usage of this is: mDatabase = Database.with(User.listAll(User.class).get(0).getKey());
0debug
How can I have an image on the same line as text in html : <p>I am in HTML, and I want to make a professional header. My problem is that when I put my logo into my div and then put some links also in that div it splits them onto different lines. Is there a way to get around this?</p>
0debug
Visual Leak Detector with Visual Studio 2017: no source code line numbers : <p>I try to use Visual Leak Detector with Visual Studio 2017 with Platform Toolset "Visual Studio 2017" I have set the include directory and the library directory. Generating debug infos is on. Symbols for the exe are loaded.</p> <p>(It works if i change the platform toolset to "Visual Studio 2013")</p> <p>With Toolset "Visual Studio 2017" VLD is detecting leaks but do not resolve the line numbers:</p> <pre><code>Visual Leak Detector read settings from: C:\Program Files (x86)\Visual Leak Detector\vld.ini Visual Leak Detector Version 2.5.1 installed. WARNING: Visual Leak Detector detected memory leaks! ---------- Block 1 at 0x005ECDB8: 400 bytes ---------- Leak Hash: 0x36672640, Count: 1, Total 400 bytes Call Stack (TID 6284): ucrtbased.dll!malloc() ConsoleApplication6.exe!0x00361FAD() ConsoleApplication6.exe!0x003618BC() ConsoleApplication6.exe!0x00361828() ConsoleApplication6.exe!0x00361883() ConsoleApplication6.exe!0x00361F7E() ConsoleApplication6.exe!0x00361DE0() ConsoleApplication6.exe!0x00361C7D() ConsoleApplication6.exe!0x00361F98() kernel32.dll!BaseThreadInitThunk() + 0x12 bytes ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes </code></pre> <p>Maybe somebody know a way to enable line number resolution.</p> <p>Thanks</p>
0debug
Extract title from name in c# : <p>How do I extract title from name as Mr. from Mr.ABC or Dr. from Dr.XYZ or M/S. from M/S. PQR in C#?</p>
0debug
from collections import Counter def sort_counter(dict1): x = Counter(dict1) sort_counter=x.most_common() return sort_counter
0debug
static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax, int32_t *data, int n, int pred_order) { int i; uint64_t bits[MAX_PARTITION_ORDER+1]; int opt_porder; RiceContext tmp_rc; uint32_t *udata; uint64_t sums[MAX_PARTITION_ORDER + 1][MAX_PARTITIONS] = { { 0 } }; assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER); assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER); assert(pmin <= pmax); tmp_rc.coding_mode = rc->coding_mode; udata = av_malloc(n * sizeof(uint32_t)); for (i = 0; i < n; i++) udata[i] = (2*data[i]) ^ (data[i]>>31); calc_sums(pmin, pmax, udata, n, pred_order, sums); opt_porder = pmin; bits[pmin] = UINT32_MAX; for (i = pmin; i <= pmax; i++) { bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums[i], n, pred_order); if (bits[i] <= bits[opt_porder]) { opt_porder = i; *rc = tmp_rc; } } av_freep(&udata); return bits[opt_porder]; }
1threat
Python - merging 2 list together without overwriting duplicate values : for example a = [a,b,c,d,a,b,c,d] b = [1,2,3,4,5,6,7,8] wanted output for dict: dict = {'a':6, 'b':8, 'c':10, 'd':12} tried using zip but it just overwrites
0debug
Part of code execute every 5 minutes C++ : I am try to implement wait in c++. I cannot use sleep since it stop the current execution. For eg. do { if(something) { //Do something } if(something) { //Do something } if(every 5 minutes) { //Do something only once after 5 minutes } } while(true) I cannot use sleep since it will stop the execution. Can you help me with this since I need to implement this in this do while loop. I would have used threads with detach but I want to this 1 a single do while loop.
0debug
static void build_pci_bus_end(PCIBus *bus, void *bus_state) { AcpiBuildPciBusHotplugState *child = bus_state; AcpiBuildPciBusHotplugState *parent = child->parent; GArray *bus_table = build_alloc_array(); DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX); DECLARE_BITMAP(slot_device_present, PCI_SLOT_MAX); DECLARE_BITMAP(slot_device_system, PCI_SLOT_MAX); DECLARE_BITMAP(slot_device_vga, PCI_SLOT_MAX); DECLARE_BITMAP(slot_device_qxl, PCI_SLOT_MAX); uint8_t op; int i; QObject *bsel; GArray *method; bool bus_hotplug_support = false; if (bus->parent_dev && (!child->pcihp_bridge_en || DEVICE(bus->parent_dev)->hotplugged)) { build_free_array(bus_table); build_pci_bus_state_cleanup(child); g_free(child); return; } if (bus->parent_dev) { op = 0x82; build_append_namestring(bus_table, "S%.02X", bus->parent_dev->devfn); build_append_byte(bus_table, 0x08); build_append_namestring(bus_table, "_SUN"); build_append_int(bus_table, PCI_SLOT(bus->parent_dev->devfn)); build_append_byte(bus_table, 0x08); build_append_namestring(bus_table, "_ADR"); build_append_int(bus_table, (PCI_SLOT(bus->parent_dev->devfn) << 16) | PCI_FUNC(bus->parent_dev->devfn)); } else { op = 0x10; ; build_append_namestring(bus_table, "PCI0"); } bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL); if (bsel) { build_append_byte(bus_table, 0x08); build_append_namestring(bus_table, "BSEL"); build_append_int(bus_table, qint_get_int(qobject_to_qint(bsel))); memset(slot_hotplug_enable, 0xff, sizeof slot_hotplug_enable); } else { memset(slot_hotplug_enable, 0x00, sizeof slot_hotplug_enable); } memset(slot_device_present, 0x00, sizeof slot_device_present); memset(slot_device_system, 0x00, sizeof slot_device_present); memset(slot_device_vga, 0x00, sizeof slot_device_vga); memset(slot_device_qxl, 0x00, sizeof slot_device_qxl); for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) { DeviceClass *dc; PCIDeviceClass *pc; PCIDevice *pdev = bus->devices[i]; int slot = PCI_SLOT(i); bool bridge_in_acpi; if (!pdev) { continue; } set_bit(slot, slot_device_present); pc = PCI_DEVICE_GET_CLASS(pdev); dc = DEVICE_GET_CLASS(pdev); bridge_in_acpi = pc->is_bridge && child->pcihp_bridge_en && !DEVICE(pdev)->hotplugged; if (pc->class_id == PCI_CLASS_BRIDGE_ISA || bridge_in_acpi) { set_bit(slot, slot_device_system); } if (pc->class_id == PCI_CLASS_DISPLAY_VGA) { set_bit(slot, slot_device_vga); if (object_dynamic_cast(OBJECT(pdev), "qxl-vga")) { set_bit(slot, slot_device_qxl); } } if (!dc->hotpluggable || bridge_in_acpi) { clear_bit(slot, slot_hotplug_enable); } } for (i = 0; i < PCI_SLOT_MAX; i++) { bool can_eject = test_bit(i, slot_hotplug_enable); bool present = test_bit(i, slot_device_present); bool vga = test_bit(i, slot_device_vga); bool qxl = test_bit(i, slot_device_qxl); bool system = test_bit(i, slot_device_system); if (can_eject) { void *pcihp = acpi_data_push(bus_table, ACPI_PCIHP_SIZEOF); memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF); patch_pcihp(i, pcihp); bus_hotplug_support = true; } else if (qxl) { void *pcihp = acpi_data_push(bus_table, ACPI_PCIQXL_SIZEOF); memcpy(pcihp, ACPI_PCIQXL_AML, ACPI_PCIQXL_SIZEOF); patch_pciqxl(i, pcihp); } else if (vga) { void *pcihp = acpi_data_push(bus_table, ACPI_PCIVGA_SIZEOF); memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF); patch_pcivga(i, pcihp); } else if (system) { } else if (present) { void *pcihp = acpi_data_push(bus_table, ACPI_PCINOHP_SIZEOF); memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF); patch_pcinohp(i, pcihp); } } if (bsel) { method = build_alloc_method("DVNT", 2); for (i = 0; i < PCI_SLOT_MAX; i++) { GArray *notify; uint8_t op; if (!test_bit(i, slot_hotplug_enable)) { continue; } notify = build_alloc_array(); op = 0xA0; build_append_byte(notify, 0x7B); build_append_byte(notify, 0x68); build_append_int(notify, 0x1U << i); build_append_byte(notify, 0x00); build_append_byte(notify, 0x86); build_append_namestring(notify, "S%.02X", PCI_DEVFN(i, 0)); build_append_byte(notify, 0x69); build_package(notify, op); build_append_array(method, notify); build_free_array(notify); } build_append_and_cleanup_method(bus_table, method); } if (bus_hotplug_support || child->notify_table->len || !bus->parent_dev) { method = build_alloc_method("PCNT", 0); if (bsel) { build_append_byte(method, 0x70); build_append_int(method, qint_get_int(qobject_to_qint(bsel))); build_append_namestring(method, "BNUM"); build_append_namestring(method, "DVNT"); build_append_namestring(method, "PCIU"); build_append_int(method, 1); build_append_namestring(method, "DVNT"); build_append_namestring(method, "PCID"); build_append_int(method, 3); } build_append_array(method, child->notify_table); build_append_and_cleanup_method(bus_table, method); build_append_array(bus_table, child->device_table); if (bus->parent_dev) { build_extop_package(bus_table, op); } else { build_package(bus_table, op); } build_append_array(parent->device_table, bus_table); if (bus->parent_dev) { build_append_namestring(parent->notify_table, "^PCNT.S%.02X", bus->parent_dev->devfn); } } qobject_decref(bsel); build_free_array(bus_table); build_pci_bus_state_cleanup(child); g_free(child); }
1threat
static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) { switch(biCompression) { case BI_BITFIELDS: case BI_RGB: switch(biBitCount) { case 1: return AV_PIX_FMT_MONOWHITE; case 4: return AV_PIX_FMT_RGB4; case 8: return AV_PIX_FMT_RGB8; case 16: return AV_PIX_FMT_RGB555; case 24: return AV_PIX_FMT_BGR24; case 32: return AV_PIX_FMT_0RGB32; } } return avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, biCompression); }
1threat
static int vid_probe(AVProbeData *p) { if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('V', 'I', 'D', 0)) return 0; return AVPROBE_SCORE_MAX; }
1threat
calling a parameterized constructor using 'this' instance c# : class manning { public int i = 0; public manning() : this(this.i)//why is this not possible. { this.i++; Console.WriteLine(i); } public manning(int i) { i++; Console.WriteLine(i); } } 1.Hi in the above code while calling the parameterized constructor why can't i can use 'this' keyword as the way it is declared. 2.it actually gives me an error stating that-"An object reference is required for the non-static field, method, or property".which can resolve by making 'i' declaration static.but 'i' variable got initialize when constructor is invoked using new. please help me understand why above code is not possible. thanks.
0debug
uninitialized float pointer (c++) : > so basically, I have this pointer in a struct, and it is used to fill the values of an array. it works as it should, but the visual studio keeps giving the same warning, saying that is uninitialized, and it's a NULL pointer, when it isn't. Can anyone explain/help? struct Sinal { int freq_amostra=0; int quant_amos_recol=0; float *val_amos; }; void p() { system("pause"); }; Sinal lerficheiro(); int main() { Sinal amostra; Sinal saida_rmo; Sinal saida_roc; Sinal saida_frc; int i,n; int opc_1, opc_2; char menu[6][50] = {{"Abrir ficheiro de amostras "},{"Aplicar retifica‡„o de meia onda "},{"Aplicar retifica‡„o de onda completa "},{"Aplicar filtro RC "},{"Guardar ficheiro de resultados "},{" Sair do programa "} }; do { system("cls"); printf("\t"); printf("%c", 201); { for (i = 0; i < 11; i++) { printf("%c", 205); } printf("%c \n", 187); printf("\t"); printf("%c", 186); printf(" Menu "); printf("%c \n", 186); printf("\t"); printf("%c", 200); } for (i = 0; i < 11; i++) { printf("%c", 205); } printf("%c", 188); printf("\n"); printf("%c", 201); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 203); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 187); for (n= 0; n < 6; n++) { if (n == 5) { printf("%c", 186); printf(" %d %c", n + 1, 186); printf("%s", menu[0, n]); printf("%c\n", 186); } else { printf("%c", 186); printf(" %d %c %s", n + 1, 186, menu[0, n]); printf("%c \n", 186); printf("%c", 204); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 206); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 185); } } printf("%c", 200); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 202); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 188); printf(" \n\n\n"); scanf_s("%d", &opc_1); printf(" \n\n"); switch (opc_1) { case 1: // ler ficheiro { amostra=lerficheiro(); printf(" \n"); break; } case 2: //retificação de meia onda { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { saida_rmo.freq_amostra = amostra.freq_amostra; saida_rmo.quant_amos_recol = amostra.quant_amos_recol; saida_rmo.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); for (int i = 0; i < amostra.quant_amos_recol; i++) { if (amostra.val_amos[i] > 0) { saida_rmo.val_amos[i] = amostra.val_amos[i]; } else { saida_rmo.val_amos[i] = 0; } } } break; } case 3: // retificação de onda completa {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { saida_roc.freq_amostra = amostra.freq_amostra; saida_roc.quant_amos_recol = amostra.quant_amos_recol; saida_roc.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); for (i = 0; i < amostra.quant_amos_recol; i++) { if (amostra.val_amos[i] >= 0) { saida_roc.val_amos[i] = amostra.val_amos[i]; } else if (amostra.val_amos[i] < 0) { saida_roc.val_amos[i] = -amostra.val_amos[i]; } } } break; } case 4: // aplicação de filtro RC {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { float res; float cond; double constante; double K1 = 0, K2 = 0; saida_frc.freq_amostra = amostra.freq_amostra; saida_frc.quant_amos_recol = amostra.quant_amos_recol; saida_frc.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); constante = 1.0/ saida_frc.freq_amostra; do { printf("\nIndique o valor de resistencia:"); scanf_s("%f", &res); printf("\nIndique o valor do condensador:"); scanf_s("%f", &cond); } while (res== 0 || cond == 0); double frac_res_cond = (1.0/res)*(1.0/cond); for (int i = 1; i < amostra.quant_amos_recol; i++) { //K1 = (float)(frac_res_cond *((amostra.val_amos[i - 1]) - (saida_frc.val_amos[i - 1]))); K1 = frac_res_cond *amostra.val_amos[i - 1] - frac_res_cond * saida_frc.val_amos[i - 1]; //K2 = (float)(frac_res_cond *(amostra.val_amos[i] - saida_frc.val_amos[i - 1] + (K1 * constante))); K2 = frac_res_cond * amostra.val_amos[i] - frac_res_cond * saida_frc.val_amos[i - 1] + frac_res_cond * (K1 * constante); saida_frc.val_amos[i] = (saida_frc.val_amos[i - 1] + (constante*K1 + constante*K2) / 2); } } break; } case 5: // guardar ficheiro {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { FILE* fich_save; float* freq; char nome_fich_guardar[50]; nome_fich_guardar[0] = '\0'; char nome[30]; char menu2[][50] = { { "Ficheiro de retifica‡„o de meia onda "},{"Ficheiro de retifica‡„o de onda completa "},{ "Ficheiro de aplica‡„o de filtro RC "}}; do { printf("Nome do ficheiro a guardar: \n"); scanf_s(" %s", nome_fich_guardar, 50); } while (strlen(nome_fich_guardar) < 1); strcpy(nome, nome_fich_guardar); strcat(nome, ".csv"); printf("\n %s \n", nome); fich_save = fopen(nome, "w"); freq = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); freq[0] = (0.0 / amostra.freq_amostra); for (int i = 1; i < amostra.quant_amos_recol; i++) { freq[i] = (1.0 / amostra.freq_amostra) + (freq[i - 1]); } do { system("cls"); do { printf("\t"); printf("%c", 201); { for (i = 0; i < 32; i++) { printf("%c", 205); } printf("%c \n", 187); printf("\t"); printf("%c", 186); printf(" Que ficheiro pretende guardar? "); printf("%c \n", 186); printf("\t"); printf("%c", 200); } for (i = 0; i < 32; i++) { printf("%c", 205); } printf("%c", 188); printf("\n"); printf("%c", 201); for (i = 0; i <3; i++) { printf("%c", 205); } printf("%c", 203); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 187); for (n = 0; n < 3; n++) { if (n == 2) { printf("%c", 186); printf(" %d %c", n + 1, 186); printf("%s", menu2[0, n]); printf("%c\n", 186); } else { printf("%c", 186); printf(" %d %c %s", n + 1, 186, menu2[0, n]); printf("%c \n", 186); printf("%c", 204); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 206); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 185); } } printf("%c", 200); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 202); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 188); printf(" \n\n\n"); scanf_s(" %d", &opc_2); } while (opc_2 < 1 || 3 < opc_2); switch (opc_2) { case 1: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 2!\n"); p(); } else { if (amostra.quant_amos_recol == saida_rmo.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_rmo.val_amos[i]); } } else { exit(1); } } break; } case 2: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 3!\n"); p(); } else { if (amostra.quant_amos_recol == saida_roc.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_roc.val_amos[i]); } } else { exit(1); } } break; } case 3: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 4!\n"); p(); } else { if (amostra.quant_amos_recol == saida_frc.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_frc.val_amos[i]); } } else { exit(1); } } break; } } } while (opc_2 < 1 || 4 < opc_2); fclose(fich_save); printf("\n"); } break; } case 6: { exit(1); break; } } } while (1); } Sinal lerficheiro() { Sinal amostra; char local_fichlet[50]; local_fichlet[0] = '\0'; FILE* fichleitura; do { do { printf("Nome/localiza%c%co do ficheiro: ", 135, 132); scanf_s("%s", local_fichlet, 50); } while (strlen(local_fichlet) < 5); fichleitura = fopen(local_fichlet, "r"); if (fichleitura == NULL) { printf("Erro ao abrir o ficheiro: %s \n", local_fichlet); system("pause"); } } while (fichleitura == NULL); fscanf_s(fichleitura, "%d", &amostra.freq_amostra); fscanf_s(fichleitura, "%d", &amostra.quant_amos_recol); amostra.val_amos = (float*)malloc(amostra.quant_amos_recol*sizeof(float)); for (int i = 0; i < amostra.quant_amos_recol; i++) { fscanf_s(fichleitura, "%f", &amostra.val_amos[i]); } fclose(fichleitura); return amostra; } > C26495 Variable 'Sinal::val_amos' is uninitialized. Always initialize a member variable (type.6).
0debug
void vfio_put_group(VFIOGroup *group) { if (!QLIST_EMPTY(&group->device_list)) { return; } vfio_kvm_device_del_group(group); vfio_disconnect_container(group); QLIST_REMOVE(group, next); trace_vfio_put_group(group->fd); close(group->fd); g_free(group); if (QLIST_EMPTY(&vfio_group_list)) { qemu_unregister_reset(vfio_reset_handler, NULL); } }
1threat
PHP - use of variable : <p>I want my PHP code to display one out of N .txt files on my webpage. (If I visit example.com/index.php?l=1 it should display 1.txt) I´m using a variable for the numbers called $m. $m is defined correctly as it is working on other pages.</p> <p>My problem is that I can´t define the location of "1.txt" with a variable. My code is:</p> <pre><code> $filename = "C:\xampp\project\Logs\.$m.'.txt'; if (file_exists($filename)) { if (is_readable($filename)) { $handle = fopen($filename, 'r'); if (filesize($filename) &gt; 0) { $contents = fread($handle, filesize($filename)); fclose($handle); $contents = str_replace('\r\n', "\r\n", $contents); echo ' &lt;textarea data-autoresize class="form-control vresize" id="info" rows="20"&gt;'.$contents.'&lt;/textarea&gt;'; } else { echo ' &lt;textarea data-autoresize class="form-control vresize" id="info" rows="20"&gt;&lt;/textarea&gt;'; } } } else { echo '&lt;br&gt;&lt;font color=red&gt;Cant get any Logs for ID: '.$m.'&lt;/font&gt;'; } </code></pre> <p>I tried a few different things but nothing worked out for me because $m does not get resolved in $filename.</p> <p>Was anybody able to follow my description and understands my problem? Help is very appreciated!</p>
0debug
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, MemTxAttrs attrs) { ARMCPU *cpu = s->cpu; switch (offset) { case 0xd04: if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI); } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK); } break; case 0xd08: cpu->env.v7m.vecbase[attrs.secure] = value & 0xffffff80; break; case 0xd0c: if ((value >> 16) == 0x05fa) { if (value & 4) { qemu_irq_pulse(s->sysresetreq); } if (value & 2) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & 1) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup = extract32(value, 8, 3); nvic_irq_update(s); } break; case 0xd10: qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); cpu->env.v7m.ccr = value; break; case 0xd24: s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; nvic_irq_update(s); break; case 0xd28: cpu->env.v7m.cfsr &= ~value; break; case 0xd2c: cpu->env.v7m.hfsr &= ~value; break; case 0xd30: cpu->env.v7m.dfsr &= ~value; break; case 0xd34: cpu->env.v7m.mmfar = value; return; case 0xd38: cpu->env.v7m.bfar = value; return; case 0xd3c: qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: return; case 0xd94: if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr = value; } break; case 0xd9c: case 0xda4: case 0xdac: case 0xdb4: { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr = region; } else { region = cpu->env.pmsav7.rnr; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: case 0xda8: case 0xdb0: case 0xdb8: { int region = cpu->env.pmsav7.rnr; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair0[attrs.secure] = value; } break; case 0xdc4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair1[attrs.secure] = value; } break; case 0xf00: { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
1threat
static inline TCGv *compute_ldst_addr(DisasContext *dc, TCGv *t) { unsigned int extimm = dc->tb_flags & IMM_FLAG; int stackprot = 0; if (dc->ra == 1) { stackprot = 1; } if (!dc->type_b) { if (dc->ra == 0) { return &cpu_R[dc->rb]; } else if (dc->rb == 0) { return &cpu_R[dc->ra]; } if (dc->rb == 1) { stackprot = 1; } *t = tcg_temp_new(); tcg_gen_add_tl(*t, cpu_R[dc->ra], cpu_R[dc->rb]); if (stackprot) { gen_helper_stackprot(cpu_env, *t); } return t; } if (!extimm) { if (dc->imm == 0) { return &cpu_R[dc->ra]; } *t = tcg_temp_new(); tcg_gen_movi_tl(*t, (int32_t)((int16_t)dc->imm)); tcg_gen_add_tl(*t, cpu_R[dc->ra], *t); } else { *t = tcg_temp_new(); tcg_gen_add_tl(*t, cpu_R[dc->ra], *(dec_alu_op_b(dc))); } if (stackprot) { gen_helper_stackprot(cpu_env, *t); } return t; }
1threat
"Undo" canvas transformations for writing text : <p>When applying a transformation with canvas, the resulting text is also (obviously) transformed. Is there a way to prevent certain transformations, such as reflection, of affecting text?</p> <p>For example, I set a global transformation matrix so the Y-axis points upwards, X-axis to the right, and the <code>(0, 0)</code> point is in the center of the screen (what you'd expect of a mathematical coordinate system).</p> <p>However, this also makes the text upside-down. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>const size = 200; const canvas = document.getElementsByTagName('canvas')[0] canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); ctx.setTransform(1, 0, 0, -1, size / 2, size / 2); const triangle = [ {x: -70, y: -70, label: 'A'}, {x: 70, y: -70, label: 'B'}, {x: 0, y: 70, label: 'C'}, ]; // draw lines ctx.beginPath(); ctx.strokeStyle = 'black'; ctx.moveTo(triangle[2].x, triangle[2].y); triangle.forEach(v =&gt; ctx.lineTo(v.x, v.y)); ctx.stroke(); ctx.closePath(); // draw labels ctx.textAlign = 'center'; ctx.font = '24px Arial'; triangle.forEach(v =&gt; ctx.fillText(v.label, v.x, v.y - 8));</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas&gt;&lt;/canvas&gt;</code></pre> </div> </div> </p> <p>Is there a "smart" way to get the text in "correct" orientation, apart from manually resetting transformation matrices?</p>
0debug
python logging dictConfig custom formatter is not being called : <p>i have the following ColoeredFormatter in my Module.</p> <p>But The Formatter does not get called. I expect "hi" on the console, but i get "This is an info of the root logger".</p> <p>i've already deleted all .pyc files, but it did not help.</p> <p><strong>MyModule/__init__.py</strong></p> <pre><code>from MyModule.ColoredFormatter import ColoredFormatter __all__ = ('ColoredFormatter') </code></pre> <p><strong>MyModule/ColoredFormatter.py</strong></p> <pre><code>import logging class ColoredFormatter(logging.Formatter): def __init__(self, default): self.default = default def format(self, record): print("hi") record.msg = "hi" return self.default.format(record) </code></pre> <p><strong>My Script</strong></p> <pre><code>import logging, logging.config, yaml conf=""" logging: version: 1 disable_existing_loggers: true root: level: !!python/name:logging.NOTSET handlers: [console] handlers: console: class: logging.StreamHandler stream: ext://sys.stdout formatter: myFormatter level: !!python/name:logging.NOTSET formatters: myFormatter: class: !!python/name:MyModule.ColoredFormatter """ dict = yaml.parse(conf) logging.config.dictConfig(dict["logging"]) logging.info("This is an info of the root logger") </code></pre>
0debug
def lcm(x, y): if x > y: z = x else: z = y while(True): if((z % x == 0) and (z % y == 0)): lcm = z break z += 1 return lcm
0debug
How to add values dynamically/randomly in two different Tables in java and sqlite : When user input some values it should be added either in table1 or table2(Database) dynamically/randomly/automatically. i am using java and sqlite can anyone help me please??
0debug
Regexp - Delete the one word before XXX, remove XXX too : <p>I need to remove a word XXX in a string and also one word before XXX.</p> <p>How I can do that with C# Regexp?</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
void kbd_put_keycode(int keycode) { QEMUPutKbdEntry *entry = QTAILQ_FIRST(&kbd_handlers); if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { return; } if (entry) { entry->put_kbd(entry->opaque, keycode); } }
1threat
Can you change this code into jquery? : <p>I need help to change pure javascript code into jquery code</p> <pre><code>document.getElementById('type').onchange = function (){ if(this.value == "Student"){ $("#cls").prop({disabled: false}); $("#sec").prop({disabled: false}); $('.cls').show(); $('.sec').show(); } else{ $("#cls").prop({disabled: true}); $("#sec").prop({disabled: true}); $('.cls').hide(); $('.sec').hide(); } } </code></pre>
0debug
static void sigp_cpu_reset(void *arg) { CPUState *cpu = arg; S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); cpu_synchronize_state(cpu); scc->cpu_reset(cpu); cpu_synchronize_post_reset(cpu); }
1threat
What's wrong? Why pointer stays constant? : <p>I learn C programming for a while and I had to create a program, which contains a function void hello() displays word 'Hello :)' and the number, how many time the function hello() was called. The code bellow displays 'Hello' but the number of function calling stays constant. I just want to know, what's wrong and why it isn't working as it should. </p> <pre><code>#include &lt;stdio.h&gt; int main(void) { void hello(int *p_number); int number = 1, i; int* p_number = number; for (i = 1; i &lt;= 10; i++){ hello(&amp;p_number); printf("Number in cyclus = %d\n", number); number++; } return 0; } void hello(int *p_number){ printf("number of calling = %d, Hello :)\n", *p_number); } </code></pre>
0debug
static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BDRVQuorumState *s = bs->opaque; QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num, nb_sectors, cb, opaque); int i; acb->is_read = true; for (i = 0; i < s->num_children; i++) { acb->qcrs[i].buf = qemu_blockalign(s->bs[i], qiov->size); qemu_iovec_init(&acb->qcrs[i].qiov, qiov->niov); qemu_iovec_clone(&acb->qcrs[i].qiov, qiov, acb->qcrs[i].buf); } for (i = 0; i < s->num_children; i++) { bdrv_aio_readv(s->bs[i], sector_num, &acb->qcrs[i].qiov, nb_sectors, quorum_aio_cb, &acb->qcrs[i]); } return &acb->common; }
1threat
What is ViewModelStore and viewModelStoreOwner? : <p>I am very confused due to this new ViewModelProvider api(ViewModelProviders is deprecated) </p> <p>As with the new changes there are new Constructors also (Source code). </p> <h3>#1</h3> <pre><code>public ViewModelProvider(@NonNull ViewModelStoreOwner owner) { this(owner.getViewModelStore(), owner instanceof HasDefaultViewModelProviderFactory ? ((HasDefaultViewModelProviderFactory) owner).getDefaultViewModelProviderFactory() : NewInstanceFactory.getInstance()); } </code></pre> <h3>#2</h3> <pre><code>public ViewModelProvider(@NonNull ViewModelStoreOwner owner, @NonNull Factory factory) { this(owner.getViewModelStore(), factory); } </code></pre> <h3>#3</h3> <pre><code> public ViewModelProvider(@NonNull ViewModelStore store, @NonNull Factory factory) { mFactory = factory; mViewModelStore = store; } </code></pre> <h3>Gradle Depenedency:</h3> <pre><code>implementation "androidx.lifecycle:lifecycle-extensions:2.2.0-rc02" </code></pre> <p>So These Constructor's require <code>ViewModelStore</code> and <code>viewModelStoreOwner</code>.</p> <h3>Doc:</h3> <blockquote> <p>@param store {@code ViewModelStore} where ViewModels will be stored.</p> <p>@param owner a {@code ViewModelStoreOwner} whose {@link ViewModelStore} will be used to retain {@code ViewModels}</p> </blockquote> <hr> <p><strong>Can anyone define them and how to use them and what they really mean to us developer's?</strong></p> <hr> <p><strong>is ViewModelStoreOwner==activity/fragment?</strong></p>
0debug
static void ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=16; i<16+8; i++){ if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride); } }
1threat
int rom_add_file(const char *file, const char *fw_dir, target_phys_addr_t addr, int32_t bootindex) { Rom *rom; int rc, fd = -1; char devpath[100]; rom = g_malloc0(sizeof(*rom)); rom->name = g_strdup(file); rom->path = qemu_find_file(QEMU_FILE_TYPE_BIOS, rom->name); if (rom->path == NULL) { rom->path = g_strdup(file); } fd = open(rom->path, O_RDONLY | O_BINARY); if (fd == -1) { fprintf(stderr, "Could not open option rom '%s': %s\n", rom->path, strerror(errno)); goto err; } if (fw_dir) { rom->fw_dir = g_strdup(fw_dir); rom->fw_file = g_strdup(file); } rom->addr = addr; rom->romsize = lseek(fd, 0, SEEK_END); rom->data = g_malloc0(rom->romsize); lseek(fd, 0, SEEK_SET); rc = read(fd, rom->data, rom->romsize); if (rc != rom->romsize) { fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n", rom->name, rc, rom->romsize); goto err; } close(fd); rom_insert(rom); if (rom->fw_file && fw_cfg) { const char *basename; char fw_file_name[56]; basename = strrchr(rom->fw_file, '/'); if (basename) { basename++; } else { basename = rom->fw_file; } snprintf(fw_file_name, sizeof(fw_file_name), "%s/%s", rom->fw_dir, basename); fw_cfg_add_file(fw_cfg, fw_file_name, rom->data, rom->romsize); snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name); } else { snprintf(devpath, sizeof(devpath), "/rom@" TARGET_FMT_plx, addr); } add_boot_device_path(bootindex, NULL, devpath); return 0; err: if (fd != -1) close(fd); g_free(rom->data); g_free(rom->path); g_free(rom->name); g_free(rom); return -1; }
1threat
static void machine_numa_validate(MachineState *machine) { int i; GString *s = g_string_new(NULL); MachineClass *mc = MACHINE_GET_CLASS(machine); const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine); assert(nb_numa_nodes); for (i = 0; i < possible_cpus->len; i++) { const CPUArchId *cpu_slot = &possible_cpus->cpus[i]; if (!cpu_slot->props.has_node_id) { char *cpu_str = cpu_slot_to_string(cpu_slot); g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "", i, cpu_str); g_free(cpu_str); } } if (s->len) { error_report("warning: CPU(s) not present in any NUMA nodes: %s", s->str); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future"); } g_string_free(s, true); }
1threat
int qemu_get_thread_id(void) { #if defined (__linux__) return syscall(SYS_gettid); #else return getpid(); #endif }
1threat
void qemu_notify_event(void) { CPUState *env = cpu_single_env; qemu_event_increment (); if (env) { cpu_exit(env); } if (next_cpu && env != next_cpu) { cpu_exit(next_cpu); } exit_request = 1; }
1threat
Angular 2 - angular-cli: set global variable on build : <p>This is my first time trying to deploy an Angular2 application. I want to set the URL of an API endpoint, and I would like for it to be different in every environment.</p> <p>Is there a way to make ng build or any other tools that would allow set this for me prior to deployment?</p>
0debug
Google App Engine 502 (Bad Gateway) with NodeJS : <p>I have a full web application using NodeJS, MongoDB (Mongoose as the driver) and ExpressJS.</p> <p>The project works perfectly on my local machine. Today I decided to move everything to production. I'm using Google App Engine to host my application, and Compose (formally MongoHQ) to host my database.</p> <p>App Engine servers my application perfectly, although my API does not seem to work. My API is served from <code>example.com/api</code>, and each request (<code>GET</code>, <code>POST</code>, <code>DELETE</code> and <code>PUT</code>) all returns a 502 (Bad Gateway) error.</p> <p>I tried running my application on my local machine while connected to my remote MongoDB database and that worked perfectly fine. So it must be a problem with App Engine or NodeJS, not with MongoDB.</p> <p>I have tried checking all error logs within Google Cloud, although there are no errors.</p> <p>Why is App Engine/NodeJS serving my application's static content perfectly fine, although not allowing any requests to my API?</p>
0debug
Detach ItemTouchHelper from RecyclerView : <p>I have a RecyclerView with a working ItemTouchHelper. Everything works great, but I am wondering if there is a way I can detach the ItemTouchHelper from the RecyclerView without re-creating the list? For fun, this is the code I'm using to attach:</p> <pre><code>ItemTouchHelper.Callback callback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { ... }; mItemTouchHelper = new ItemTouchHelper(callback); mItemTouchHelper.attachToRecyclerView(mPasswordList); </code></pre> <p>Ideally, I'd like to check a preference in say <code>onResume()</code> of the Activity this RecyclerView lives in and detach the ItemTouchHelper based on that.</p>
0debug
What is the return type hint of a generator function? : <p>I'm trying to write a <code>:rtype:</code> type hint for a generator function. What is the type it returns? </p> <p>For example, say I have this functions which yields strings:</p> <pre><code>def read_text_file(fn): """ Yields the lines of the text file one by one. :param fn: Path of text file to read. :type fn: str :rtype: ???????????????? &lt;======================= what goes here? """ with open(fn, 'rt') as text_file: for line in text_file: yield line </code></pre> <p>The return type isn't just a string, it's some kind of iterable of strings? So I can't just write <code>:rtype: str</code>. What's the right hint?</p>
0debug
Getting DOM node text with Puppeteer and headless Chrome : <p>I'm trying to use headless Chrome and Puppeteer to run our Javascript tests, but I can't extract the results from the page. Based on <a href="https://stackoverflow.com/a/45799744/4794">this answer</a>, it looks like I should use <a href="https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args" rel="noreferrer"><code>page.evaluate()</code></a>. That section even has an example that looks like what I need.</p> <pre><code>const bodyHandle = await page.$('body'); const html = await page.evaluate(body =&gt; body.innerHTML, bodyHandle); await bodyHandle.dispose(); </code></pre> <p>As a full example, I tried to convert that to a script that will extract my name from my user profile on Stack Overflow. Our project is using Node 6, so I converted the <code>await</code> expressions to use <code>.then()</code>.</p> <pre><code>const puppeteer = require('puppeteer'); puppeteer.launch().then(function(browser) { browser.newPage().then(function(page) { page.goto('https://stackoverflow.com/users/4794').then(function() { page.$('h2.user-card-name').then(function(heading_handle) { page.evaluate(function(heading) { return heading.innerText; }, heading_handle).then(function(result) { console.info(result); browser.close(); }, function(error) { console.error(error); browser.close(); }); }); }); }); }); </code></pre> <p>When I run that, I get this error:</p> <pre><code>$ node get_user.js TypeError: Converting circular structure to JSON at Object.stringify (native) at args.map.x (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/helper.js:30:43) at Array.map (native) at Function.evaluationString (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/helper.js:30:29) at Frame.&lt;anonymous&gt; (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/FrameManager.js:376:31) at next (native) at step (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/FrameManager.js:355:24) at Promise (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/FrameManager.js:373:12) at fn (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/FrameManager.js:351:10) at Frame._rawEvaluate (/mnt/data/don/git/Kive/node_modules/puppeteer/node6/FrameManager.js:375:3) </code></pre> <p>The problem seems to be with serializing the input parameter to <code>page.evaluate()</code>. I can pass in strings and numbers, but not element handles. Is the example wrong, or is it a problem with Node 6? How can I extract the text of a DOM node?</p>
0debug
Cordova: Cannot find plugin.xml : <p>I am trying to remove this plugin from my coordova file and I am getting this issues</p> <pre><code>Error: Cannot find plugin.xml for plugin 'org.apache.cordova.file-transfer'. Please try adding it again. </code></pre> <p>This is the cordova command to remove the plugin</p> <pre><code>cordova plugin rm cordova-plugin-file-transfer </code></pre> <p>Please assist on why I cannot be able to remove this plugin. Thank you</p>
0debug
static int msmpeg4v12_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbp, code, i; uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) { s->mb_intra = 0; for(i=0;i<6;i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = 1; *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; return 0; } } if(s->msmpeg4_version==2) code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1); else code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if(code<0 || code>7){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y); return -1; } s->mb_intra = code >>2; cbp = code & 0x3; } else { s->mb_intra = 1; if(s->msmpeg4_version==2) cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1); else cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1); if(cbp<0 || cbp>3){ av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } } if (!s->mb_intra) { int mx, my, cbpy; cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(cbpy<0){ av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } cbp|= cbpy<<2; if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C; ff_h263_pred_motion(s, 0, 0, &mx, &my); mx= msmpeg4v2_decode_motion(s, mx, 1); my= msmpeg4v2_decode_motion(s, my, 1); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mv[0][0][0] = mx; s->mv[0][0][1] = my; *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { if(s->msmpeg4_version==2){ s->ac_pred = get_bits1(&s->gb); cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; } else{ s->ac_pred = 0; cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; if(s->pict_type==AV_PICTURE_TYPE_P) cbp^=0x3C; } *mb_type_ptr = MB_TYPE_INTRA; } s->bdsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; } } return 0; }
1threat
static uint32_t sm501_palette_read(void *opaque, target_phys_addr_t addr) { SM501State * s = (SM501State *)opaque; SM501_DPRINTF("sm501 palette read addr=%x\n", (int)addr); assert(0 <= addr && addr < 0x400 * 3); return *(uint32_t*)&s->dc_palette[addr]; }
1threat
Why warnings prevent us from writing optimized programs? : <p>Check out this code:</p> <pre><code>#include &lt;stdio.h&gt; unsigned short GetShort_With_Warning( unsigned long long val ) { return *(unsigned short*)&amp;val; // mov ax,word ptr [val] // That's it. Elegance } unsigned short GetShort_Without_Warning( unsigned long long val ) { unsigned short* shv = (unsigned short*)&amp;val; // lea eax,[val] // mov dword ptr [shv],eax return *shv; // mov eax,dword ptr [shv] // mov ax,word ptr [eax] } int main( void ) { printf( "%04x\n", GetShort_With_Warning ( 0x101234ULL ) ); printf( "%04x\n", GetShort_Without_Warning( 0x101234ULL ) ); return 0; } </code></pre> <p>This is just an example...<br> There are two functions that do the same, but one gives a warning and the other does not. The assembler code is shown with a comment. Can it be made that the 'elegant' decision does not give a warning?</p> <p>It's compiled with g++:</p> <pre><code>g++ -Wall -O3 -s -I. -c -o main.o main.cc </code></pre> <p>The following warning appears:</p> <pre><code>main.cc:4:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return *(unsigned short*)&amp;val; ^~~ </code></pre> <p>I know what the warning wants to say me.<br> I know that with today's CPU power this case is not a problem.</p> <p>Anyway... My question is why the warnings don't allow me to optimize my code?</p>
0debug
Sum of a range? : I am very new to Python. I am trying to find the sum of all numbers less that 1000 divisible by 3 and 5. I have this so far: ```for i in range(0, 1000): if i % 3 == 0: print i elif i % 5 == 0: print i b = sum(i) print b``` I get a TypeError: 'int' object is not iterable (referring to b = sum(i))
0debug
Sorting array not sorting : <p>I must set an array to accept 7 numbers from the user, then send the array to be sorted in ascending order. the array is not being sorted and its just given the values back the exact way they were entered.</p> <pre><code>import java.util.Scanner; public class arraySorted { public static void main(String[] args) { Scanner in = new Scanner(System.in); int [] enterednumbers = new int[7]; System.out.println("Enter 7 numbers in any order"); for( int i =0; i &lt; enterednumbers.length; i++) { enterednumbers[i] = in.nextInt(); } for (int d = 0; d &lt; enterednumbers.length; d++) { System.out.print(enterednumbers[d] + " "); } } public static void sort(int enterednumbers[]) { int n = 7; int temp = 0; for (int i = 0; i &lt;n; i++) { for (int j = i + 1; j&lt;n; j++) { if (enterednumbers[i] &gt; enterednumbers[j]) { temp = enterednumbers[i]; enterednumbers[i] = enterednumbers[j]; enterednumbers[j] = temp; } } } } } </code></pre> <p>The input read as:</p> <p>Enter 7 numbers in any order 8 4 8 9 7 5 7</p> <p>than the output is: 8 4 8 9 7 5 7 </p>
0debug
C# with windows form application : How can u add data to a specific row in a database from a windows form using the where clause I used "Insert into table1 (name, address) values ('"+textbox1.Text+"', '"+textbox2.Text+"') where (name ='"+textbox1.Text+"')", con Thus did not work
0debug
How do you add migrate an existing database with alembic/flask-migrate if you did not start off with it? : <p>This is the chain of events that has and is happening</p> <ul> <li>Day 0: I developed and deployed my app </li> <li>Day 1: I create the new database </li> <li>Day 3: I realized I wanted to add a new row to my existing table. I found flask-migrate and I want to use it to migrate my database.</li> </ul> <p>Currently I am at Day 3</p> <p>There are plenty of documentations on how to get Flask-migrate running if you start from Day 0. You just call <code>flask db init</code>, <code>flask db migrate</code> and <code>flask db upgrade</code>. </p> <p>However, for my case, it's a bit different. I ran the commands, and my first version of migration is <em>empty</em>. Then I modified my database schema and generated a new migration. Now my latest migration only has 1 line of migration which is adding the new row to the table. </p> <p>I realized that none of my migrations have the actual schema to create the database, which is supposed to be the first migration you see if you start flask-migrate on day 1.</p> <p><strong>If I were to clone my repo from scratch:</strong> </p> <p><code>flask db migrate</code> will result in <code>alembic.util.exc.CommandError: Target database is not up to date.</code>. </p> <p><code>flask db upgrade</code> will result in <code>sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) relation "offer" does not exist</code>. </p> <p>What can I do to fix this? </p>
0debug
VB.net What does the Of() keyword do for declarations of non-generic non-collection classes? : <p>I am looking at the following class declaration in VB.net code:</p> <pre><code>Public Class ClassB(Of ClassA) </code></pre> <p>ClassB is not a collection of ClassA.</p> <p>What does the (Of ClassA) do?</p>
0debug
static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) { VGACommonState *vga = &qxl->vga; DisplaySurface *surface; int i; if (qxl->guest_primary.resized) { qxl->guest_primary.resized = 0; qxl->guest_primary.data = qxl_phys2virt(qxl, qxl->guest_primary.surface.mem, MEMSLOT_GROUP_GUEST); if (!qxl->guest_primary.data) { return; } qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects = 1; trace_qxl_render_guest_primary_resized( qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.qxl_stride, qxl->guest_primary.bytes_pp, qxl->guest_primary.bits_pp); if (qxl->guest_primary.qxl_stride > 0) { surface = qemu_create_displaysurface_from (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height, qxl->guest_primary.bits_pp, qxl->guest_primary.abs_stride, qxl->guest_primary.data, false); } else { surface = qemu_create_displaysurface (qxl->guest_primary.surface.width, qxl->guest_primary.surface.height); } dpy_gfx_replace_surface(vga->con, surface); } if (!qxl->guest_primary.data) { return; } for (i = 0; i < qxl->num_dirty_rects; i++) { if (qemu_spice_rect_is_empty(qxl->dirty+i)) { break; } if (qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || qxl->dirty[i].right > qxl->guest_primary.surface.width || qxl->dirty[i].bottom > qxl->guest_primary.surface.height) { continue; } qxl_blit(qxl, qxl->dirty+i); dpy_gfx_update(vga->con, qxl->dirty[i].left, qxl->dirty[i].top, qxl->dirty[i].right - qxl->dirty[i].left, qxl->dirty[i].bottom - qxl->dirty[i].top); } qxl->num_dirty_rects = 0; }
1threat
what do lseek and offset do : <p>Can someone explain me what does this program do? I can't understand. I created a file named "FILE" and I wrote a five-letter word on it. Now, what does this program do? I don't understand what the offset is... Please explain me, I know it's easy concepts but I can't seem to understand it... Thanks.</p> <pre><code>#include &lt;sys/types.h&gt; #include &lt;fcntl.h&gt; #include &lt;sys/stat.h&gt; #include &lt;unistd.h&gt; int main(void) { int fd,i; fd=open("FILE",O_RDONLY); i=lseek(fd,50,SEEK_CUR); exit(0); } </code></pre>
0debug
alert('Hello ' + user_input);
1threat
Read input file until certain line c++ : <p>I'm new to programming, so I was wondering...</p> <p>If I have an input file consisting of 100 lines, how do I read only up to line 50 and print out each line?</p> <p>Thanks.</p>
0debug
Visual Studio 2015 Update 3 - Setup Blocked : <p>I am trying to install Visual Studio 2015 Update 3 from offline installer (iso file) and get this error:</p> <p><a href="https://i.stack.imgur.com/9Mwsb.png"><img src="https://i.stack.imgur.com/9Mwsb.png" alt="enter image description here"></a></p> <p>I am running on window seven an i do have Visual Studio 2013 Update 2013 on my system.</p> <p>Here is some log:</p> <pre><code> [0E68:1238][2016-07-05T17:24:07]i000: MUX: Detect Completed [0E68:1238][2016-07-05T17:24:07]i000: MUX: Wait for View to be loaded [0E68:1238][2016-07-05T17:24:07]i000: MUX: View loaded [0E68:1238][2016-07-05T17:24:07]i000: MUX: Checking for update... [0E68:1238][2016-07-05T17:24:07]i000: MUX: Setup update feature is enabled. Evaluating conditions to determine whether to run setup update. [0E68:1238][2016-07-05T17:24:07]i000: MUX: Checking http://go.microsoft.com/fwlink/?LinkID=659005 for update. [0E68:1238][2016-07-05T17:24:11]i000: MUX: Failed to download the update xml file from http://go.microsoft.com/fwlink/?LinkID=659005 Setup will not be updated. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition 'NOT (CurrentOperation = "Uninstall")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i052: Condition '(CurrentOperation = "Install") OR (CurrentOperation = "Repair")' evaluates to true. [0E68:1238][2016-07-05T17:24:11]i000: MUX: Configuring feed... [0E68:1238][2016-07-05T17:24:11]i000: MUX: Stop Block: NoApplicableUpdates : Update 3 requires a member of the Visual Studio 2015 family to be present or is blocked by another condition on your computer. [0E68:1238][2016-07-05T17:24:11]i000: MUX: Online feed url authoring not found [0E68:1238][2016-07-05T17:24:11]i000: MUX: Stop Block: NoApplicableUpdates : Update 3 requires a member of the Visual Studio 2015 family to be present or is blocked by another condition on your computer. [0E68:1238][2016-07-05T17:24:11]i000: MUX: Go to Blocker page. [0E68:1238][2016-07-05T17:24:11]i199: Detect complete, result: 0x0 </code></pre>
0debug
python pandas sum by hour of day : <p>I'm working with the following dataset with hourly counts (df): The datframe has 8784 rows (for the year 2016, hourly).</p> <p><a href="https://i.stack.imgur.com/4wvBM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4wvBM.png" alt="dataframe (df)"></a></p> <p>I'd like to see if there are daily trends (e.g if there is an increase in the morning hours. For this i'd like to create a plot that has the hour of the day (from 0 to 24) on the x-axis and number of cyclists on the y axis (something like in the picture below from <a href="http://ofdataandscience.blogspot.co.uk/2013/03/capital-bikeshare-time-series-clustering.html" rel="noreferrer">http://ofdataandscience.blogspot.co.uk/2013/03/capital-bikeshare-time-series-clustering.html</a>). </p> <p><a href="https://i.stack.imgur.com/vo2Qo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vo2Qo.png" alt="enter image description here"></a></p> <p>I experimented with differet ways of <code>pivot</code>, <code>resample</code> and <code>set_index</code> and plotting it with matplotlib, without success. In other words, i couldn't find a way to sum up every observation at a certain hour and then plot those for each weekday</p> <p>Any ideas how to do this? Thanks in advance!</p>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
static inline void gen_405_mulladd_insn(DisasContext *ctx, int opc2, int opc3, int ra, int rb, int rt, int Rc) { TCGv t0, t1; t0 = tcg_temp_local_new(); t1 = tcg_temp_local_new(); switch (opc3 & 0x0D) { case 0x05: tcg_gen_ext16s_tl(t0, cpu_gpr[ra]); tcg_gen_sari_tl(t1, cpu_gpr[rb], 16); tcg_gen_ext16s_tl(t1, t1); break; case 0x04: tcg_gen_ext16u_tl(t0, cpu_gpr[ra]); tcg_gen_shri_tl(t1, cpu_gpr[rb], 16); tcg_gen_ext16u_tl(t1, t1); break; case 0x01: tcg_gen_sari_tl(t0, cpu_gpr[ra], 16); tcg_gen_ext16s_tl(t0, t0); tcg_gen_sari_tl(t1, cpu_gpr[rb], 16); tcg_gen_ext16s_tl(t1, t1); break; case 0x00: tcg_gen_shri_tl(t0, cpu_gpr[ra], 16); tcg_gen_ext16u_tl(t0, t0); tcg_gen_shri_tl(t1, cpu_gpr[rb], 16); tcg_gen_ext16u_tl(t1, t1); break; case 0x0D: tcg_gen_ext16s_tl(t0, cpu_gpr[ra]); tcg_gen_ext16s_tl(t1, cpu_gpr[rb]); break; case 0x0C: tcg_gen_ext16u_tl(t0, cpu_gpr[ra]); tcg_gen_ext16u_tl(t1, cpu_gpr[rb]); break; } if (opc2 & 0x04) { tcg_gen_mul_tl(t1, t0, t1); if (opc2 & 0x02) { tcg_gen_sub_tl(t0, cpu_gpr[rt], t1); } else { tcg_gen_add_tl(t0, cpu_gpr[rt], t1); } if (opc3 & 0x12) { int l1 = gen_new_label(); if (opc3 & 0x10) { tcg_gen_movi_tl(cpu_ov, 0); } if (opc3 & 0x01) { tcg_gen_xor_tl(t1, cpu_gpr[rt], t1); tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1); tcg_gen_xor_tl(t1, cpu_gpr[rt], t0); tcg_gen_brcondi_tl(TCG_COND_LT, t1, 0, l1); if (opc3 & 0x02) { tcg_gen_sari_tl(t0, cpu_gpr[rt], 31); tcg_gen_xori_tl(t0, t0, 0x7fffffff); } } else { tcg_gen_brcond_tl(TCG_COND_GEU, t0, t1, l1); if (opc3 & 0x02) { tcg_gen_movi_tl(t0, UINT32_MAX); } } if (opc3 & 0x10) { tcg_gen_movi_tl(cpu_ov, 1); tcg_gen_movi_tl(cpu_so, 1); } gen_set_label(l1); tcg_gen_mov_tl(cpu_gpr[rt], t0); } } else { tcg_gen_mul_tl(cpu_gpr[rt], t0, t1); } tcg_temp_free(t0); tcg_temp_free(t1); if (unlikely(Rc) != 0) { gen_set_Rc0(ctx, cpu_gpr[rt]); } }
1threat
FindBugs IDEA - ClassNotFoundException com.google.wireless.android.sdk.stats.IntellijIndexingStats : <p>FindBugs IDEA v1.0.1 Android Studio 3.4</p> <p>I get this error when running FindBugs. I don't use com.google.wireless.android.sdk anywhere in the app.</p> <pre><code>Error:Internal error: (java.lang.ClassNotFoundException) com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index java.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.intellij.util.indexing.counters.IndexCounters.&lt;clinit&gt;(IndexCounters.java:34) at com.intellij.util.indexing.impl.MapReduceIndex.&lt;init&gt;(MapReduceIndex.java:86) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.&lt;init&gt;(CompilerReferenceIndex.java:214) at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.&lt;init&gt;(CompilerReferenceIndex.java:73) at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.&lt;init&gt;(JavaCompilerBackwardReferenceIndex.java:12) at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:74) at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexBuilder.buildStarted(JavaBackwardReferenceIndexBuilder.java:40) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:358) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:229) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) </code></pre>
0debug
How to use servlet 3.1 in spring mvc? : <p>There are 2 different features available:</p> <ol> <li><p><strong>servlet 3.0</strong> allows to process request in a thread different from the container thread.</p></li> <li><p><strong>servlet 3.1</strong> allows to read/write into socket without blocking reading/writing thread</p></li> </ol> <p>There are a lot of examples in the internet about servlet 3.0 feature. We can use it in Spring very easily. We just have to return <code>DefferedResult</code> or <code>CompletableFuture</code></p> <p>But I can't find example of usage servlet 3.1 in spring. As far as I know we have to register <code>WriteListener</code> and <code>ReadListener</code> and do dome dirty work inside. But I can't find the example of that Listeners. I believe it is not very easy.</p> <p>Could you please provide example of servlet 3.1 feature in spring with explanation of Listener implementaion ?</p>
0debug
C++ beginner - trying to write a function but getting a identifier...is undefined : I am a student and am tasked with creating a program that will determine if a person is rich or not. My code is below and I keep getting an error that "identifier "isRich" is undefined. Can someone help me figure out where I went wrong? The instructions are: We want to determine if someone is “rich.” The definition of being rich depends upon a number of factors such as age, number of dependents, amount of debt, etc., as well as other subjective factors. Write a program that incorporates the use of functions: In the main() function , display a pleasing banner of your choosing From the main function, call a user-defined function calcWealth() which prompts the user for his age, amount of cash on hand, number of dependents, and amount of money owed to creditors. You should use an ‘int’ to represent age and number of dependents but use a ‘long’ to represent amount of cash on hand and amount owed. Next, from the main() function, call a user-defined boolean function, isRich(), which accepts as arguments the age, cash on hand, number of dependents, and amount owed. isRich() will calculate the “true cash value” and then determine if someone is rich. Here are the criteria for isRich(): The amount owed must be subtracted from the cash on hand to determine a preliminary “true cash value” If a person is has no dependents and a true cash value of $1 million or more, he can be considered rich – regardless of age. If a person is < 40 years old, subtract $150,000 from his true cash value for each dependent (e.g., if a person has three dependents, subtract $450,000) If a person is 40-50 years old, subtract $75,000 from his true cash value for each dependent If a person > 50 years old, subtract $25,000 from his true cash value for each dependent Return the value of ‘true’ to main() is the person’s true cash value >= $1 million; otherwise, return a value of ‘false’ The main() function receives the boolean value from isRich() and displays a message indicating whether a person is rich or not. #include "stdafx.h" #include <iostream> //for input and output #include "Cusick Project 5.h" using namespace std; void calcWealth(int age, long cash, int dependants, long debt) { cout << "Please enter your age: "; cin >> age; cout << "Please enter the amount of cash on hand: "; cin >> cash; cout << "Please enter the amount of dependents you have: "; cin >> dependants; cout << "Please enter the amount of money you owe"; cin >> debt; bool isRich(int *age, long *cash, int *dependants, long *debt); { long trueCash; bool status = false; trueCash = cash - debt; if (dependants == 0) { if (trueCash >= 1000000) { status = true; } else status = false; } else if (age < 40) { trueCash = trueCash - (dependants * 150000); if (trueCash >= 1000000) { status = true; } else status = false; } else if (age > 39 && age < 51) { trueCash = trueCash - (dependants * 75000); if (trueCash >= 1000000) { status = true; } else status = false; } else { trueCash = trueCash - (dependants * 25000); if (trueCash >= 1000000) { status = true; } else status = false; } } } int main() { int age; long cash; int dependants; long debt; bool status; cout << "Welcome to the wealth indicator..." << endl; calcWealth(age, cash, dependants, debt); if (isRich(status) = true) { cout << "Congratulations! We consider you as being \"rich.\"" << endl; } else { cout << "I am sorry! You are not yet \"rich.\"" << endl; } }
0debug
How do I get the `hanami routes` command to include additional objects? : In the [overview documentation for routes][1] there are examples of objects being used for route resolution such as `get '/rack-app', to: RackApp.new` and it works as advertised with code like this: `options '/*', to: MyApp::CORSRequestHandler.new` From the console and the server commands, everything does what you would expect. However, when executing the command `hanami routes`, I get the following error: `/path/to/gems/hanami-1.0.0/lib/hanami/config/mapper.rb:28:in `eval': uninitialized constant Hanami::Config::Mapper::MyApp (NameError)` The problem is that the `routes` command is clearly not loading the entire app (which is good) but also problematic in this case. I had originally tried just using `require_relative` from `routes.rb` but since the file is eval'ed this fails miserably. (And, that just felt wrong.) Being new to the framework I'm trying to figure how to best get this class definition included for the `routes` command in a way that's most consistent with Hanami itself. [1]: http://hanamirb.org/guides/routing/overview/#rack
0debug
static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s) { int f_code; int mv; for(f_code=1; f_code<=MAX_FCODE; f_code++){ for(mv=-MAX_MV; mv<=MAX_MV; mv++){ int len; if(mv==0) len= ff_mvtab[0][1]; else{ int val, bit_size, code; bit_size = f_code - 1; val=mv; if (val < 0) val = -val; val--; code = (val >> bit_size) + 1; if(code<33){ len= ff_mvtab[code][1] + 1 + bit_size; }else{ len= ff_mvtab[32][1] + av_log2(code>>5) + 2 + bit_size; } } mv_penalty[f_code][mv+MAX_MV]= len; } } for(f_code=MAX_FCODE; f_code>0; f_code--){ for(mv=-(16<<f_code); mv<(16<<f_code); mv++){ fcode_tab[mv+MAX_MV]= f_code; } } for(mv=0; mv<MAX_MV*2+1; mv++){ umv_fcode_tab[mv]= 1; } }
1threat
static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx, int next, const uint8_t **buf, int *buf_size) { int parse_timing_info = (s->pts == AV_NOPTS_VALUE && s->dts == AV_NOPTS_VALUE); DiracParseContext *pc = s->priv_data; if (pc->overread_index) { memmove(pc->buffer, pc->buffer + pc->overread_index, pc->index - pc->overread_index); pc->index -= pc->overread_index; pc->overread_index = 0; if (*buf_size == 0 && pc->buffer[4] == 0x10) { *buf = pc->buffer; *buf_size = pc->index; return 0; } } if (next == -1) { void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, pc->index + (*buf_size - pc->sync_offset)); if (!new_buffer) return AVERROR(ENOMEM); pc->buffer = new_buffer; memcpy(pc->buffer + pc->index, (*buf + pc->sync_offset), *buf_size - pc->sync_offset); pc->index += *buf_size - pc->sync_offset; return -1; } else { DiracParseUnit pu1, pu; void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, pc->index + next); if (!new_buffer) return AVERROR(ENOMEM); pc->buffer = new_buffer; memcpy(pc->buffer + pc->index, *buf, next); pc->index += next; if (!unpack_parse_unit(&pu1, pc, pc->index - 13) || !unpack_parse_unit(&pu, pc, pc->index - 13 - pu1.prev_pu_offset) || pu.next_pu_offset != pu1.prev_pu_offset || pc->index < pc->dirac_unit_size + 13LL + pu1.prev_pu_offset ) { pc->index -= 9; *buf_size = next - 9; pc->header_bytes_needed = 9; return -1; } pc->dirac_unit = pc->buffer + pc->index - 13 - pu1.prev_pu_offset - pc->dirac_unit_size; pc->dirac_unit_size += pu.next_pu_offset; if ((pu.pu_type & 0x08) != 0x08) { pc->header_bytes_needed = 9; *buf_size = next; return -1; } if (parse_timing_info) { uint8_t *cur_pu = pc->buffer + pc->index - 13 - pu1.prev_pu_offset; int pts = AV_RB32(cur_pu + 13); if (s->last_pts == 0 && s->last_dts == 0) s->dts = pts - 1; else s->dts = s->last_dts + 1; s->pts = pts; if (!avctx->has_b_frames && (cur_pu[4] & 0x03)) avctx->has_b_frames = 1; } if (avctx->has_b_frames && s->pts == s->dts) s->pict_type = AV_PICTURE_TYPE_B; *buf = pc->dirac_unit; *buf_size = pc->dirac_unit_size; pc->dirac_unit_size = 0; pc->overread_index = pc->index - 13; pc->header_bytes_needed = 9; } return next; }
1threat
Passing array to component property in React : <p>How can I pass an array to a component as a property. Neither of the following achieve what I am looking for. I want to pass the array of items through, manipulate them in the component and output in the render method. </p> <pre><code>&lt;List columns=['one', 'two', 'three', 'four'] /&gt; // unexpected token &lt;List columns="['one', 'two', 'three', 'four']" /&gt; // passed through as string not array </code></pre> <p>Is there a standard syntax or best practice for this kind of thing?</p>
0debug
How to get height of UITableView when cells are dynamically sized? : <p>I have a UITableView with cells that are dynamically sized. That means I have set:</p> <pre><code>tableView.estimatedRowHeight = 50.0 tableView.rowHeight = UITableViewAutomaticDimension </code></pre> <p>Now I want to get the height of the whole table view. I tried getting it through <code>tableView.contentSize.height</code> but that only returns the estimated row height, and not the actual dynamic height of the table view.</p> <p>How do I get the dynamic height of the whole table view?</p>
0debug
static void avi_read_nikon(AVFormatContext *s, uint64_t end) { while (avio_tell(s->pb) < end) { uint32_t tag = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'): { uint64_t tag_end = avio_tell(s->pb) + size; while (avio_tell(s->pb) < tag_end) { uint16_t tag = avio_rl16(s->pb); uint16_t size = avio_rl16(s->pb); const char *name = NULL; char buffer[64] = { 0 }; if (avio_tell(s->pb) + size > tag_end) size = tag_end - avio_tell(s->pb); size -= avio_read(s->pb, buffer, FFMIN(size, sizeof(buffer) - 1)); switch (tag) { case 0x03: name = "maker"; break; case 0x04: name = "model"; break; case 0x13: name = "creation_time"; if (buffer[4] == ':' && buffer[7] == ':') buffer[4] = buffer[7] = '-'; break; } if (name) av_dict_set(&s->metadata, name, buffer, 0); avio_skip(s->pb, size); } break; } default: avio_skip(s->pb, size); break; } } }
1threat
static void avc_luma_vt_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height) { int32_t loop_cnt; int16_t filt_const0 = 0xfb01; int16_t filt_const1 = 0x1414; int16_t filt_const2 = 0x1fb; v16i8 src0, src1, src2, src3, src4, src7, src8, src9, src10; v16i8 src10_r, src32_r, src76_r, src98_r; v16i8 src21_r, src43_r, src87_r, src109_r; v8i16 out0_r, out1_r, out2_r, out3_r; v16i8 filt0, filt1, filt2; v16u8 out0, out1; filt0 = (v16i8) __msa_fill_h(filt_const0); filt1 = (v16i8) __msa_fill_h(filt_const1); filt2 = (v16i8) __msa_fill_h(filt_const2); LD_SB5(src, src_stride, src0, src1, src2, src3, src4); src += (5 * src_stride); XORI_B5_128_SB(src0, src1, src2, src3, src4); ILVR_B4_SB(src1, src0, src2, src1, src3, src2, src4, src3, src10_r, src21_r, src32_r, src43_r); for (loop_cnt = (height >> 2); loop_cnt--;) { LD_SB4(src, src_stride, src7, src8, src9, src10); src += (4 * src_stride); XORI_B4_128_SB(src7, src8, src9, src10); ILVR_B4_SB(src7, src4, src8, src7, src9, src8, src10, src9, src76_r, src87_r, src98_r, src109_r); out0_r = DPADD_SH3_SH(src10_r, src32_r, src76_r, filt0, filt1, filt2); out1_r = DPADD_SH3_SH(src21_r, src43_r, src87_r, filt0, filt1, filt2); out2_r = DPADD_SH3_SH(src32_r, src76_r, src98_r, filt0, filt1, filt2); out3_r = DPADD_SH3_SH(src43_r, src87_r, src109_r, filt0, filt1, filt2); SRARI_H4_SH(out0_r, out1_r, out2_r, out3_r, 5); SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7); out0 = PCKEV_XORI128_UB(out0_r, out1_r); out1 = PCKEV_XORI128_UB(out2_r, out3_r); ST8x4_UB(out0, out1, dst, dst_stride); dst += (4 * dst_stride); src10_r = src76_r; src32_r = src98_r; src21_r = src87_r; src43_r = src109_r; src4 = src10; } }
1threat
static int sctp_write(URLContext *h, const uint8_t *buf, int size) { SCTPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = sctp_wait_fd(s->fd, 1); if (ret < 0) return ret; } if (s->max_streams) { struct sctp_sndrcvinfo info = { 0 }; info.sinfo_stream = AV_RB16(buf); if (info.sinfo_stream > s->max_streams) abort(); ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR); } else ret = send(s->fd, buf, size, 0); return ret < 0 ? ff_neterrno() : ret; }
1threat
How to configure ASP.NET Core 1.0 to use Local IIS instead of IIS Express? : <p>How can I setup a <strong>.Net Core 1.0</strong> project to use <strong>Local IIS</strong> instead of <strong>IIS Express</strong> when debugging?</p> <p>I have tried modifying <strong>launchSettings.json</strong> file in various ways. For example, replacing all occurrences of <strong>IIS Express</strong> with <strong>Local IIS</strong> and updating the <strong>applicationUrl</strong> and <strong>launchUrl</strong> to use my custom localhost <a href="http://sample.local">http://sample.local</a> (I have updated the host file and configured IIS manager already) but not happy. </p> <p>Default settings of <strong>Properties/launchSettings.json</strong> file:</p> <pre><code>{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:38601/", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "SampleApp": { "commandName": "Project", "launchBrowser": true, "launchUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } </code></pre>
0debug
How do I send a message to someone mentioned using discord.js? : title Oh yeah, and here's the code for me trying to do said title. [self-explanatory, please tell me what is wrong][1] [1]: https://i.stack.imgur.com/zborb.png
0debug
How to scrape a table with rvest and xpath? : <p>using the following <a href="http://www.r-bloggers.com/using-rvest-to-scrape-an-html-table/" rel="noreferrer">documentation</a> i have been trying to scrape a series of tables from marketwatch.com </p> <p>here is the one represented by the code bellow: </p> <p><a href="https://i.stack.imgur.com/ak9iH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ak9iH.png" alt="enter image description here"></a></p> <p>The link and xpath are already included in the code:</p> <pre><code>url &lt;- "http://www.marketwatch.com/investing/stock/IRS/profile" valuation &lt;- url %&gt;% html() %&gt;% html_nodes(xpath='//*[@id="maincontent"]/div[2]/div[1]') %&gt;% html_table() valuation &lt;- valuation[[1]] </code></pre> <p>I get the following error: </p> <pre><code>Warning message: 'html' is deprecated. Use 'read_html' instead. See help("Deprecated") </code></pre> <p>Thanks in advance. </p>
0debug
static VncServerInfo *vnc_server_info_get(VncDisplay *vd) { VncServerInfo *info; Error *err = NULL; info = g_malloc(sizeof(*info)); info->base = g_malloc(sizeof(*info->base)); vnc_init_basic_info_from_server_addr(vd->lsock, info->base, &err); info->has_auth = true; info->auth = g_strdup(vnc_auth_name(vd)); if (err) { qapi_free_VncServerInfo(info); info = NULL; error_free(err); } return info; }
1threat
keycloak bearer-only clients: why do they exist? : <p>I am trying to wrap my head around the concept of <code>bearer-only</code> clients in Keycloak.</p> <p>I understand the concept of public vs confidential and the concept of service accounts and the <code>grant_type=client_credentials</code> stuff. But with <code>bearer-only</code>, I'm stuck.</p> <p>Googling only reveals fragments of discussions saying:</p> <blockquote> <p>You cannot obtain a token from keycloak with a <code>bearer-only</code> client.</p> </blockquote> <p>The docs are unclear as well. All they say is:</p> <blockquote> <p>Bearer-only access type means that the application only allows bearer token requests.</p> </blockquote> <p>Ok, if my app only allows bearer token requests, how do I obtain this token if I cannot get it from Keycloak using client id / client secret?</p> <p>And if you can't obtain a token, what can you at all? Why do these clients exist? Can somebody please provide an example of using this type of client? </p>
0debug
static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in) { int x, y, w, h; AVFilterContext *ctx = inlink->dst; PaletteUseContext *s = ctx->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { av_frame_free(&in); return NULL; } av_frame_copy_props(out, in); set_processing_window(s->diff_mode, s->last_in, in, s->last_out, out, &x, &y, &w, &h); av_frame_free(&s->last_in); av_frame_free(&s->last_out); s->last_in = av_frame_clone(in); s->last_out = av_frame_clone(out); if (!s->last_in || !s->last_out || av_frame_make_writable(s->last_in) < 0) { av_frame_free(&in); av_frame_free(&out); return NULL; } ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n", w, h, x, y, x+w, y+h, in->width, in->height); if (s->set_frame(s, out, in, x, y, w, h) < 0) { av_frame_free(&out); return NULL; } memcpy(out->data[1], s->palette, AVPALETTE_SIZE); if (s->calc_mean_err) debug_mean_error(s, in, out, inlink->frame_count_out); av_frame_free(&in); return out; }
1threat
static int blkdebug_debug_remove_breakpoint(BlockDriverState *bs, const char *tag) { BDRVBlkdebugState *s = bs->opaque; BlkdebugSuspendedReq *r, *r_next; BlkdebugRule *rule, *next; int i, ret = -ENOENT; for (i = 0; i < BLKDBG__MAX; i++) { QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) { if (rule->action == ACTION_SUSPEND && !strcmp(rule->options.suspend.tag, tag)) { remove_rule(rule); ret = 0; } } } QLIST_FOREACH_SAFE(r, &s->suspended_reqs, next, r_next) { if (!strcmp(r->tag, tag)) { qemu_coroutine_enter(r->co, NULL); ret = 0; } } return ret; }
1threat
Making a math equation for overtime : <p>right now i have an employee who is getting 500 dollars overtime when he works 40 hours and his basic salary is 3500 dollars, i need to have an equation to calculate the amount of dollars when he work any other amount of hours different salary or with basic salary 4000 dollars. Thanks</p>
0debug
struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base) { int iomemtype; struct pxa2xx_pcmcia_s *s; s = (struct pxa2xx_pcmcia_s *) qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s)); s->io_base = base | 0x00000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn, pxa2xx_pcmcia_io_writefn, s); cpu_register_physical_memory(s->io_base, 0x03ffffff, iomemtype); s->attr_base = base | 0x08000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn, pxa2xx_pcmcia_attr_writefn, s); cpu_register_physical_memory(s->attr_base, 0x03ffffff, iomemtype); s->common_base = base | 0x0c000000; iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn, pxa2xx_pcmcia_common_writefn, s); cpu_register_physical_memory(s->common_base, 0x03ffffff, iomemtype); if (base == 0x30000000) s->slot.slot_string = "PXA PC Card Socket 1"; else s->slot.slot_string = "PXA PC Card Socket 0"; s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0]; pcmcia_socket_register(&s->slot); return s; }
1threat
Matrix, how to solve? : <p>Given the matrix M x N. How to print the number of the line containing the maximum number of identical elements? </p> <pre><code>import random n = int(input('Введите кол-во столбцов матрицы: ')) m = int(input('Введите кол-во строк матрицы: ')) matrix = [[random.randrange(0, 10) for y in range(n)] for x in range(m)] print(matrix) max_x = 0 for i in range(n): for j in range(m): if max_x &lt; matrix[i].count(matrix[i][j]): print(matrix.index(matrix[i])) max_x = matrix[i].count(matrix[i][j]) else: break </code></pre>
0debug
How to get the response of AJAX from JQUERY : <p>I know this question has been asked many times but the guys who asked before me had a slightly different issue. I have a [simple page to upload photo][1]. This one is placed on my localhost. I can select file and upload image into upload folder. I can get response and using Firefox console - "Net" tab - I can see the response - which is printed as html code. I could get the DOM using JQuery $("#message").html() function. However what I wanted to try is this. Instead of printing tags or JSON structure data just send error code. echo 0; for success. Echo -1; for failure. The live code is place [here][2]. Now what I tried with php file ajax_php_file.php is this:</p> <pre><code>&lt;?php if(isset($_FILES["file"]["type"])) { $validextensions = array("jpeg", "jpg", "png"); $temporary = explode(".", $_FILES["file"]["name"]); $file_extension = end($temporary); if ((($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/jpeg") ) AND $_FILES["file"]["size"] &lt; 128000 AND // 125kb files can be uploaded. in_array($file_extension, $validextensions)) { if ($_FILES["file"]["error"] &gt; 0) echo '-1'; else { echo '-2'; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo '-3'; } else { $sourcePath = $_FILES['file']['tmp_name']; // Storing source path of the file in a variable $targetPath = "upload/".$_FILES['file']['name']; // Target path where file is to be stored move_uploaded_file($sourcePath,$targetPath) ; // Moving Uploaded file echo '0'; } } } else { echo '-3'; } } ?&gt; [1]: http://stackoverflow.com/questions/36183350/why-jquery-image-uploader-doesnt-upload-image [2]: http://kod.djpw.cz/vpvb </code></pre> <p>So no html is send, just a 1 or two characters. When I check Firefox console on "Net" tab I see Just JSON but nothing more. So I have two questions here. Why I see no response, why I don't se the "0" when the file has been successfully uploaded? And then - how to fix the JS code to get the number or string without using any tags. Is this possible? My goal is to start functions which will print reports "File successly loaded" if the value is "0", or some error message if the value is less then 0.</p>
0debug
Can anyone help me how to creat a c program prints the center of the words inside a sentance? : <p>Example: My name is ray => ( a )</p> <p>Another example : Hello the world. =>. ( l h r )</p>
0debug
void ff_proresdsp_x86_init(ProresDSPContext *dsp) { #if ARCH_X86_64 && HAVE_YASM int flags = av_get_cpu_flags(); if (flags & AV_CPU_FLAG_SSE2) { dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; dsp->idct_put = ff_prores_idct_put_10_sse2; } if (flags & AV_CPU_FLAG_SSE4) { dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; dsp->idct_put = ff_prores_idct_put_10_sse4; } #if HAVE_AVX if (flags & AV_CPU_FLAG_AVX) { dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; dsp->idct_put = ff_prores_idct_put_10_avx; } #endif #endif }
1threat
Duplicating (and modifying) discrete axis in ggplot2 : <p>I want to duplicate the left-side Y-axis on a ggplot2 plot onto the right side, and then change the tick labels for a discrete (categorical) axis.</p> <p>I've read the answer to <a href="https://stackoverflow.com/questions/40134648/duplicating-discrete-axis-in-ggplot2">this question</a>, however as can be seen <a href="https://github.com/wilkelab/cowplot/blob/d10f9cad3123594e2925e680b8b2b59856c8833f/vignettes/axis_position.Rmd" rel="noreferrer">on the package's repo page</a>, the <code>switch_axis_position()</code> function has been removed from the <code>cowplot</code> package (the author cited (forthcoming?) native functionality in ggplot2).</p> <p>I've seen the <a href="http://ggplot2.tidyverse.org/reference/sec_axis.html" rel="noreferrer">reference</a> page on secondary axes in ggplot2, however all the examples in that document use <code>scale_y_continuous</code> rather than <code>scale_y_discrete</code>. And, indeed, when I try to use the discrete function, I get the error:</p> <pre><code>Error in discrete_scale(c("y", "ymin", "ymax", "yend"), "position_d", : unused argument (sec.axis = &lt;environment&gt;) </code></pre> <p>Is there anyway to do this with ggplot2? Even a completely hacked solution will suffice for me. Thanks in advance. (MREs below)</p> <pre><code>library(ggplot2) # Working continuous plot with 2 axes ggplot(mtcars, aes(cyl, mpg)) + geom_point() + scale_y_continuous(sec.axis = sec_axis(~.+10)) # Working discrete plot with 1 axis ggplot(mtcars, aes(cyl, as.factor(mpg))) + geom_point() # Broken discrete plot with 2 axes ggplot(mtcars, aes(cyl, as.factor(mpg))) + geom_point() + scale_y_discrete(sec.axis = sec_axis(~.+10)) </code></pre>
0debug
inline static void RENAME(hcscale)(uint16_t *dst, int dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer) { if(srcFormat==IMGFMT_YUY2) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_BGR32) { RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_BGR24) { RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_BGR16) { RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_BGR15) { RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_RGB32) { RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(srcFormat==IMGFMT_RGB24) { RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+2048; } else if(isGray(srcFormat)) { return; } #ifdef HAVE_MMX if(!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if(!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #ifdef ARCH_X86 #ifdef HAVE_MMX2 int i; if(canMMX2BeUsed) { asm volatile( "pxor %%mm7, %%mm7 \n\t" "pxor %%mm2, %%mm2 \n\t" "movd %5, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "movq %%mm6, %%mm2 \n\t" "psllq $16, %%mm2 \n\t" "paddw %%mm6, %%mm2 \n\t" "psllq $16, %%mm2 \n\t" "paddw %%mm6, %%mm2 \n\t" "psllq $16, %%mm2 \n\t" "movq %%mm2, %%mm4 \n\t" "movd %4, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "xorl %%eax, %%eax \n\t" "movl %0, %%esi \n\t" "movl %1, %%edi \n\t" "movl %3, %%edx \n\t" "xorl %%ecx, %%ecx \n\t" "xorl %%ebx, %%ebx \n\t" "movw %4, %%bx \n\t" #define FUNNYUVCODE \ PREFETCH" 1024(%%esi) \n\t"\ PREFETCH" 1056(%%esi) \n\t"\ PREFETCH" 1088(%%esi) \n\t"\ "call *%7 \n\t"\ "movq %%mm4, %%mm2 \n\t"\ "xorl %%ecx, %%ecx \n\t" FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE "xorl %%eax, %%eax \n\t" "movl %6, %%esi \n\t" "movl %1, %%edi \n\t" "addl $4096, %%edi \n\t" FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE FUNNYUVCODE :: "m" (src1), "m" (dst), "m" (dstWidth), "m" ((xInc*4)>>16), "m" ((xInc*4)&0xFFFF), "m" (xInc&0xFFFF), "m" (src2), "m" (funnyUVCode) : "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" ); for(i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { dst[i] = src1[srcW-1]*128; dst[i+2048] = src2[srcW-1]*128; } } else { #endif asm volatile( "xorl %%eax, %%eax \n\t" "xorl %%ebx, %%ebx \n\t" "xorl %%ecx, %%ecx \n\t" ".balign 16 \n\t" "1: \n\t" "movl %0, %%esi \n\t" "movzbl (%%esi, %%ebx), %%edi \n\t" "movzbl 1(%%esi, %%ebx), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "movl %1, %%edi \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%edi, %%eax, 2) \n\t" "movzbl (%5, %%ebx), %%edi \n\t" "movzbl 1(%5, %%ebx), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "movl %1, %%edi \n\t" "shrl $9, %%esi \n\t" "movw %%si, 4096(%%edi, %%eax, 2)\n\t" "addw %4, %%cx \n\t" "adcl %3, %%ebx \n\t" "addl $1, %%eax \n\t" "cmpl %2, %%eax \n\t" " jb 1b \n\t" :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc>>16), "m" (xInc&0xFFFF), "r" (src2) : "%eax", "%ebx", "%ecx", "%edi", "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for(i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc; } #endif } }
1threat
While loop inside While working just once in ruby? : <p>I am using while statement in ruby and another child while statement in that parent while to print :</p> <pre><code>z = 0 i = 0 while z &lt; 2 puts "hi coding" while i &lt; 4 do puts "hello" i +=1 end z +=1 end </code></pre> <p>I want first ("hi coding") is printed and then ("hello,hello,hello,hello" four times) , and this total chunk printed twice but what is happening is that hi coding is printed twice and ( 4 times hello just once ): so my output is like :</p> <pre><code>hi coding hello hello hello hello hi coding ************************* </code></pre> <p>but i want it as :</p> <pre><code>hi coding hello hello hello hello hi coding hello hello hello hello ************************* </code></pre> <p>what am I doing wrong here ?</p>
0debug
How to mock middleware in Express to skip authentication for unit test? : <p>I have the following in Express</p> <pre><code> //index.js var service = require('./subscription.service'); var auth = require('../auth/auth.service'); var router = express.Router(); router.post('/sync', auth.isAuthenticated, service.synchronise); module.exports = router; </code></pre> <p>I want to override or mock isAuthenticated to return this</p> <pre><code>auth.isAuthenticated = function(req, res, next) { return next(); } </code></pre> <p>Here is my unit test:</p> <pre><code>it('it should return a 200 response', function(done) { //proxyquire here? request(app).post('/subscriptions/sync') .set('Authorization','Bearer '+ authToken) .send({receipt: newSubscriptionReceipt }) .expect(200,done); }); </code></pre> <p>I have tried mocking index.js using proxyquire - I think I need to stub the router? I have also tried to override in the test </p> <pre><code>app.use('/subscriptions', require('./api/subscription')); </code></pre> <p>There must be a simple way to mock this out so I don't need to authenticate the request. Any ideas?</p>
0debug
int vnc_tls_validate_certificate(VncState *vs) { int ret; unsigned int status; const gnutls_datum_t *certs; unsigned int nCerts, i; time_t now; VNC_DEBUG("Validating client certificate\n"); if ((ret = gnutls_certificate_verify_peers2 (vs->tls.session, &status)) < 0) { VNC_DEBUG("Verify failed %s\n", gnutls_strerror(ret)); return -1; } if ((now = time(NULL)) == ((time_t)-1)) { return -1; } if (status != 0) { if (status & GNUTLS_CERT_INVALID) VNC_DEBUG("The certificate is not trusted.\n"); if (status & GNUTLS_CERT_SIGNER_NOT_FOUND) VNC_DEBUG("The certificate hasn't got a known issuer.\n"); if (status & GNUTLS_CERT_REVOKED) VNC_DEBUG("The certificate has been revoked.\n"); if (status & GNUTLS_CERT_INSECURE_ALGORITHM) VNC_DEBUG("The certificate uses an insecure algorithm\n"); return -1; } else { VNC_DEBUG("Certificate is valid!\n"); } if (gnutls_certificate_type_get(vs->tls.session) != GNUTLS_CRT_X509) return -1; if (!(certs = gnutls_certificate_get_peers(vs->tls.session, &nCerts))) return -1; for (i = 0 ; i < nCerts ; i++) { gnutls_x509_crt_t cert; VNC_DEBUG ("Checking certificate chain %d\n", i); if (gnutls_x509_crt_init (&cert) < 0) return -1; if (gnutls_x509_crt_import(cert, &certs[i], GNUTLS_X509_FMT_DER) < 0) { gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_expiration_time (cert) < now) { VNC_DEBUG("The certificate has expired\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (gnutls_x509_crt_get_activation_time (cert) > now) { VNC_DEBUG("The certificate is not yet activated\n"); gnutls_x509_crt_deinit (cert); return -1; } if (i == 0) { size_t dnameSize = 1024; vs->tls.dname = g_malloc(dnameSize); requery: if ((ret = gnutls_x509_crt_get_dn (cert, vs->tls.dname, &dnameSize)) != 0) { if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) { vs->tls.dname = g_realloc(vs->tls.dname, dnameSize); goto requery; } gnutls_x509_crt_deinit (cert); VNC_DEBUG("Cannot get client distinguished name: %s", gnutls_strerror (ret)); return -1; } if (vs->vd->tls.x509verify) { int allow; if (!vs->vd->tls.acl) { VNC_DEBUG("no ACL activated, allowing access"); gnutls_x509_crt_deinit (cert); continue; } allow = qemu_acl_party_is_allowed(vs->vd->tls.acl, vs->tls.dname); VNC_DEBUG("TLS x509 ACL check for %s is %s\n", vs->tls.dname, allow ? "allowed" : "denied"); if (!allow) { gnutls_x509_crt_deinit (cert); return -1; } } } gnutls_x509_crt_deinit (cert); } return 0; }
1threat
How to save the xml file in the directory I want (android studio) : <p>There is some filled document <code>xml Document doc = builder.newDocument ();</code> which I want to save to the <code>assets</code> folder of my application, how can I do this? I climbed to the Internet, but I could not find information, I was probably looking bad (</p>
0debug
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg) { const uint8_t type_code[] = { [GDB_BREAKPOINT_HW] = 0x0, [GDB_WATCHPOINT_WRITE] = 0x1, [GDB_WATCHPOINT_ACCESS] = 0x3 }; const uint8_t len_code[] = { [1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2 }; int n; if (kvm_sw_breakpoints_active(env)) dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP; if (nb_hw_breakpoint > 0) { dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP; dbg->arch.debugreg[7] = 0x0600; for (n = 0; n < nb_hw_breakpoint; n++) { dbg->arch.debugreg[n] = hw_breakpoint[n].addr; dbg->arch.debugreg[7] |= (2 << (n * 2)) | (type_code[hw_breakpoint[n].type] << (16 + n*4)) | ((uint32_t)len_code[hw_breakpoint[n].len] << (18 + n*4)); } } env->xcr0 = 1; }
1threat
Couldnt execute long sql statement in python? : <p>I have defined my sql statement as follows ( note the line breaks)</p> <pre><code> def getTankSystemIds(): sql='select tt.TankSystemId,ts.sitecode,tt.productid ' \ 'from [dbo].[TankSystems] tt' \ 'left join [dbo].sites ts on tt.siteid=ts.siteid where ts.companyid=8' \ 'and ProductId in (10,4,2,3,11,4)' cursor = connectDB() cursor.execute(sql) records = cursor.fetchall() </code></pre> <p>When calling this method, I get following error. I changed single quote to " and ''',""" but all gave same error What Im doing wrong here? I tried providing the sql statement in a single long line too. But same error</p> <pre><code>SyntaxError: Non-ASCII character '\xef' in file /Users/ratha/PycharmProjects/Processor/Utilities/DbConnector.py on line 86, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details </code></pre>
0debug
Need the SQL Query to find out the below Result : below is the source table with data PARENT_ID PARENT_NAME CHILD_GENDER 1111 AAA M 1111 AAA F 1234 BBB M 1234 BBB M 1235 CCC M 1236 DDD F 1236 DDD F 1236 DDD M 1237 EEE M 1237 EEE M 1237 EEE F 1238 FFF F 1239 GGG F 1239 GGG F And I need to find out the Parent_ID , who has Childs both M & F the required output is as below PARENT_ID PARENT_NAME CHILD_GENDER 1111 AAA M 1111 AAA F 1236 DDD F 1236 DDD F 1236 DDD M 1237 EEE M 1237 EEE M 1237 EEE F What is the SQL Query
0debug
int bdrv_commit(BlockDriverState *bs) { BlockDriver *drv = bs->drv; int64_t sector, total_sectors; int n, ro, open_flags; int ret = 0; uint8_t *buf; char filename[1024]; if (!drv) return -ENOMEDIUM; if (!bs->backing_hd) { return -ENOTSUP; } if (bdrv_in_use(bs) || bdrv_in_use(bs->backing_hd)) { return -EBUSY; } ro = bs->backing_hd->read_only; strncpy(filename, bs->backing_hd->filename, sizeof(filename)); open_flags = bs->backing_hd->open_flags; if (ro) { if (bdrv_reopen(bs->backing_hd, open_flags | BDRV_O_RDWR, NULL)) { return -EACCES; } } total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; buf = g_malloc(COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZE); for (sector = 0; sector < total_sectors; sector += n) { if (bdrv_is_allocated(bs, sector, COMMIT_BUF_SECTORS, &n)) { if (bdrv_read(bs, sector, buf, n) != 0) { ret = -EIO; goto ro_cleanup; } if (bdrv_write(bs->backing_hd, sector, buf, n) != 0) { ret = -EIO; goto ro_cleanup; } } } if (drv->bdrv_make_empty) { ret = drv->bdrv_make_empty(bs); bdrv_flush(bs); } if (bs->backing_hd) bdrv_flush(bs->backing_hd); ro_cleanup: g_free(buf); if (ro) { bdrv_reopen(bs->backing_hd, open_flags & ~BDRV_O_RDWR, NULL); } return ret; }
1threat
Smth is wrong with index (System.NullReferenceException) : <p>Need help to figure it out what's wrong with my code. I get this error: System.NullReferenceException: 'Object reference not set to an instance of an object.' at this line:</p> <pre><code>post[0].Author = "Author at post 0"; </code></pre> <p>The Code:</p> <pre><code>class Logg { public string Title { get; set; } public string Text { get; set; } public string Author { get; set; } public DateTime Date { get; set; } public static int Count = 0; //Count += 1 from Main } class Program { static void Main(string[] args) { List&lt;Logg[]&gt; LoggBok = new List&lt;Logg[]&gt;(); Logg[] post = new Logg[10]; LoggBok.Add(post); post[0].Author = "Author at post 0"; post[0].Title = "Titel at post 0"; post[0].Text = "My text at post 0"; post[0].Date = DateTime.Now; post[1].Author = "Author 1 at post 1"; post[1].Title = "Titel 1 at post 1"; post[1].Text = "My text 1 at post 1"; post[1].Date = DateTime.Now; post[2].Author = "Author 2 at post 2"; post[2].Title = "Titel 2 at post 2"; post[2].Text = "My text 2 at post 2"; post[2].Date = DateTime.Now; Logg.Count = 3; </code></pre>
0debug
static void init_proc_401x2 (CPUPPCState *env) { }
1threat