problem
stringlengths
26
131k
labels
class label
2 classes
document.write('<script src="evil.js"></script>');
1threat
void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1) { if (SAL_REG1_INVALID(reg1) || reg1 & 0x000000000000ffff) { program_interrupt(&cpu->env, PGM_OPERAND, 2); } }
1threat
npm install that requires node-gyp fails on Windows : <p>I have a NPM project that uses <code>bufferutils</code> and <code>utf-8-validate</code>, both requiring node-gyp to install them. When I do <code>npm install</code>, I get following error:</p> <pre><code>&gt; bufferutil@1.2.1 install C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil &gt; node-gyp rebuild C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil {git}{hg} {lamb} if not defined npm_config_node_gyp (node "C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\bin\node-g yp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. bufferutil.cc C:\Users\Marek\.node-gyp\5.1.1\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory [C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil\build\bufferutil.vcx proj] gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\node_modules\nod e-gyp\lib\build.js:276:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Windows_NT 10.0.10586 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Marek\\AppData\\Roaming\\npm\\node_modules\\ npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil gyp ERR! node -v v5.1.1 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild` npm WARN install:bufferutil@1.2.1 Exit status 1 </code></pre> <p>Previously it failed because of Python 2.7 not installed, now it is this. It's causing me headaches. What should I do about this?</p>
0debug
static void calxeda_init(MachineState *machine, enum cxmachines machine_id) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; DeviceState *dev = NULL; SysBusDevice *busdev; qemu_irq pic[128]; int n; qemu_irq cpu_irq[4]; MemoryRegion *sysram; MemoryRegion *dram; MemoryRegion *sysmem; char *sysboot_filename; if (!cpu_model) { switch (machine_id) { case CALXEDA_HIGHBANK: cpu_model = "cortex-a9"; break; case CALXEDA_MIDWAY: cpu_model = "cortex-a15"; break; } } for (n = 0; n < smp_cpus; n++) { ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); Object *cpuobj; ARMCPU *cpu; Error *err = NULL; if (!oc) { error_report("Unable to find CPU definition"); exit(1); } cpuobj = object_new(object_class_get_name(oc)); cpu = ARM_CPU(cpuobj); if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { error_report_err(err); exit(1); } } if (object_property_find(cpuobj, "reset-cbar", NULL)) { object_property_set_int(cpuobj, MPCORE_PERIPHBASE, "reset-cbar", &error_abort); } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { error_report_err(err); exit(1); } cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ); } sysmem = get_system_memory(); dram = g_new(MemoryRegion, 1); memory_region_init_ram(dram, NULL, "highbank.dram", ram_size, &error_abort); memory_region_add_subregion(sysmem, 0, dram); sysram = g_new(MemoryRegion, 1); memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000, &error_abort); memory_region_add_subregion(sysmem, 0xfff88000, sysram); if (bios_name != NULL) { sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (sysboot_filename != NULL) { uint32_t filesize = get_image_size(sysboot_filename); if (load_image_targphys("sysram.bin", 0xfff88000, filesize) < 0) { hw_error("Unable to load %s\n", bios_name); } g_free(sysboot_filename); } else { hw_error("Unable to find %s\n", bios_name); } } switch (machine_id) { case CALXEDA_HIGHBANK: dev = qdev_create(NULL, "l2x0"); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xfff12000); dev = qdev_create(NULL, "a9mpcore_priv"); break; case CALXEDA_MIDWAY: dev = qdev_create(NULL, "a15mpcore_priv"); break; } qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); qdev_prop_set_uint32(dev, "num-irq", NIRQ_GIC); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE); for (n = 0; n < smp_cpus; n++) { sysbus_connect_irq(busdev, n, cpu_irq[n]); } for (n = 0; n < 128; n++) { pic[n] = qdev_get_gpio_in(dev, n); } dev = qdev_create(NULL, "sp804"); qdev_prop_set_uint32(dev, "freq0", 150000000); qdev_prop_set_uint32(dev, "freq1", 150000000); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xfff34000); sysbus_connect_irq(busdev, 0, pic[18]); sysbus_create_simple("pl011", 0xfff36000, pic[20]); dev = qdev_create(NULL, "highbank-regs"); qdev_init_nofail(dev); busdev = SYS_BUS_DEVICE(dev); sysbus_mmio_map(busdev, 0, 0xfff3c000); sysbus_create_simple("pl061", 0xfff30000, pic[14]); sysbus_create_simple("pl061", 0xfff31000, pic[15]); sysbus_create_simple("pl061", 0xfff32000, pic[16]); sysbus_create_simple("pl061", 0xfff33000, pic[17]); sysbus_create_simple("pl031", 0xfff35000, pic[19]); sysbus_create_simple("pl022", 0xfff39000, pic[23]); sysbus_create_simple("sysbus-ahci", 0xffe08000, pic[83]); if (nd_table[0].used) { qemu_check_nic_model(&nd_table[0], "xgmac"); dev = qdev_create(NULL, "xgmac"); qdev_set_nic_properties(dev, &nd_table[0]); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff50000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[77]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[78]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[79]); qemu_check_nic_model(&nd_table[1], "xgmac"); dev = qdev_create(NULL, "xgmac"); qdev_set_nic_properties(dev, &nd_table[1]); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff51000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[80]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[81]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[82]); } highbank_binfo.ram_size = ram_size; highbank_binfo.kernel_filename = kernel_filename; highbank_binfo.kernel_cmdline = kernel_cmdline; highbank_binfo.initrd_filename = initrd_filename; highbank_binfo.board_id = -1; highbank_binfo.nb_cpus = smp_cpus; highbank_binfo.loader_start = 0; highbank_binfo.write_secondary_boot = hb_write_secondary; highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary; arm_load_kernel(ARM_CPU(first_cpu), &highbank_binfo); }
1threat
int32_t helper_fqtoi(CPUSPARCState *env) { int32_t ret; clear_float_exceptions(env); ret = float128_to_int32_round_to_zero(QT1, &env->fp_status); check_ieee_exceptions(env); return ret; }
1threat
Unexpected template string expression in Vue.js : <p>everytime I code like this ${row.name}, I get this error "eslint.org/docs/rules/no-template-curly-in-string Unexpected template string expression". </p> <p>Any help? </p> <p><a href="https://i.stack.imgur.com/FO7IG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FO7IG.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/fx6zk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fx6zk.png" alt=""></a></p>
0debug
static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size) { int i, x, y; i=0; x=0; y=0; while(i<buf_size) { int run_length, color; if (buf[i] & 0x80) { run_length = 1; color = buf[i]; i++; }else{ run_length = (buf[i] & 0x7f) + 2; color = buf[i+1]; i+=2; } if (half_horiz) run_length *=2; if (color) { memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); if (half_vert) memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length); } x+= run_length; if (x >= s->avctx->width) { x=0; y += half_vert ? 2 : 1; } } }
1threat
React-Native another VirtualizedList-backed container : <p>After upgrading to react-native 0.61 i get a lot of warnings like that:</p> <pre><code>VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead. </code></pre> <p>What is the other <code>VirtualizedList-backed container</code> that i should use, and why is it now advised not to use like that?</p>
0debug
static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride, int is4tap) { LOAD_PIXELS int a, f1, f2; const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; a = 3 * (q0 - p0); if (is4tap) a += clip_int8(p1 - q1); a = clip_int8(a); f1 = FFMIN(a + 4, 127) >> 3; f2 = FFMIN(a + 3, 127) >> 3; p[-1 * stride] = cm[p0 + f2]; p[ 0 * stride] = cm[q0 - f1]; if (!is4tap) { a = (f1 + 1) >> 1; p[-2 * stride] = cm[p1 + a]; p[ 1 * stride] = cm[q1 - a]; } }
1threat
C# : Parse line arguments : i'm currently working on a console app and I would like to parse a line that a user could give to the program. I tried some code from https://stackoverflow.com/questions/298830/split-string-containing-command-line-parameters-into-string-in-c-sharp but it isn't this that I want to do. These scripts works if I enter something like that `-push "test"`, but the user can enter something like that `-push $a 75 $c 5`. I would like a script who, if the user enter this command line : `-p $a 75 $c 5 -p $t "test test" &c 1 -p $c 5 $a 75 $a 76`, the parse function would return : `{ { "PUSH", { { "A", 75 }, { "C", 5 } } }, { "PUSH", { { "T", "test test" }, { "C", 1 } } }, { "PUSH", { { "C", 5 }, { "A", 75 }, { "A", 76 } } } }` Then, I would like a modulable script where I could add a command like `WAIT` and arguments like `$ms [int]`. (If possible)
0debug
int qemu_file_rate_limit(QEMUFile *f) { if (qemu_file_get_error(f)) { return 1; } if (f->xfer_limit > 0 && f->bytes_xfer > f->xfer_limit) { return 1; } return 0; }
1threat
Compile .vue file into .js file without webpack or browserify : <p>Is there any way to compile .vue file into .js file without webpack or browserify? I know the goodness of webpack or browserify but I just want the simplest way to compile the .vue file. For example, I have a single file component <code>comp.vue</code> complied into <code>comp.js</code> (the compiler should be able to compile sass and pug in .vue file) and then I can use it in my app like below:</p> <pre><code>&lt;head&gt; &lt;script src="vue.min.js"&gt;&lt;/script&gt; &lt;script src="comp.js"&gt;&lt;/script&gt; //it may pack the whole component into variable comp and add the style &lt;script&gt; Vue.component('comp', comp); window.onload = function() { new Vue({el: '#app'}); } &lt;/script&gt; &lt;/head&gt; &lt;body id='app'&gt; &lt;comp&gt;&lt;/comp&gt; &lt;/body&gt; </code></pre> <p>or other similar/simpler way?</p>
0debug
Xcode Swift 3.0 user Authentication : ok, guys, I know this is silly but I'm having a bit of a trouble shooting and need help. I created a log out button to log users out of the account but when touching the log out button I get an error showing this `libc++abi.dylib: terminating with uncaught exception of type NSException ` [my Error][1] [Logout btoon][2] [1]: https://i.stack.imgur.com/rkCFU.png [2]: https://i.stack.imgur.com/XbAgp.png Is there a way to fix this problem? Thanks to anyone helping.
0debug
CSV reader fails to return Strings : <p>I have a CSV file that has following form. </p> <p>I read the CSV using CSV reader. It outputs the objects in following form instead of the string.</p> <h2>Output</h2> <p>[Ljava.lang.String;@138617da</p> <p>**</p> <p>This is my code. What is wrong with code?</p> <pre><code> public void readFeatures () throws IOException{ File(classLoader.getResource(filename).getFile()); CSVReader reader = new CSVReader(new FileReader(file)); List myEntries = reader.readAll(); for( int i = 0; i&lt; myEntries.size(); i ++){ System.out.println(myEntries.get(i).toString()); } } </code></pre>
0debug
static void qpeg_decode_inter(uint8_t *src, uint8_t *dst, int size, int stride, int width, int height, int delta, uint8_t *ctable, uint8_t *refdata) { int i, j; int code; int filled = 0; uint8_t *blkdata; for(i = 0; i < height; i++) memcpy(refdata + (i * width), dst + (i * stride), width); blkdata = src - 0x86; height--; dst = dst + height * stride; while(size > 0) { code = *src++; size--; if(delta) { while((code & 0xF0) == 0xF0) { if(delta == 1) { int me_idx; int me_w, me_h, me_x, me_y; uint8_t *me_plane; int corr, val; me_idx = code & 0xF; me_w = qpeg_table_w[me_idx]; me_h = qpeg_table_h[me_idx]; corr = *src++; size--; val = corr >> 4; if(val > 7) val -= 16; me_x = val; val = corr & 0xF; if(val > 7) val -= 16; me_y = val; me_plane = refdata + (filled + me_x) + (height - me_y) * width; for(j = 0; j < me_h; j++) { for(i = 0; i < me_w; i++) dst[filled + i - (j * stride)] = me_plane[i - (j * width)]; } } code = *src++; size--; } } if(code == 0xE0) break; if(code > 0xE0) { int p; code &= 0x1F; p = *src++; size--; for(i = 0; i <= code; i++) { dst[filled++] = p; if(filled >= width) { filled = 0; dst -= stride; height--; } } } else if(code >= 0xC0) { code &= 0x1F; for(i = 0; i <= code; i++) { dst[filled++] = *src++; if(filled >= width) { filled = 0; dst -= stride; height--; } } size -= code + 1; } else if(code >= 0x80) { int skip; code &= 0x3F; if(!code) skip = (*src++) + 64; else if(code == 1) skip = (*src++) + 320; else skip = code; filled += skip; while( filled >= width) { filled -= width; dst -= stride; height--; } } else { if(code) dst[filled++] = ctable[code & 0x7F]; else filled++; if(filled >= width) { filled = 0; dst -= stride; height--; } } } }
1threat
How to enable PHP redis extension on Travis : <p>I'm running Travis CI for running my tests. I'm using the Trusty container with php v5.6.</p> <p>Here is my entire .travis.yml file:</p> <pre><code>language: php dist: trusty php: - '5.4' before_script: - phpenv config-rm xdebug.ini - before_script: echo "extension = redis.so" &gt;&gt; ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini sudo: required install: - npm install -g gulp - composer install env: - APP_ENV=circleci script: - gulp test </code></pre> <p>The <code>before_script:</code> syntax is copied directly from <a href="https://docs.travis-ci.com/user/languages/php#Enabling-preinstalled-PHP-extensions">the travis documentation</a> but my builds fail with a composer error saying:</p> <pre><code>- The requested PHP extension ext-redis * is missing from your system. Install or enable PHP's redis extension. </code></pre>
0debug
static void xvid_idct_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block) { ff_xvid_idct(block); ff_put_pixels_clamped(block, dest, line_size); }
1threat
Please add sorting symbol to the given table : var html = "<table id='TimeLogtbleInfo' class='table table-bordered table-striped '><thead style='background-color: #3d556d; color: white'><tr><th >SNO</th><th>Emp Name</th><th>Task</th><th>Date</th><th>Time</th><th>Client Name</th><th>Project Name</th><th>Category Name</th><th>ProjectType Name</th><th>SubCategory Name</th></tr></thead><tbody>"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0debug
access data from ajax function in another function : <p>My MWE data.js looks like this:</p> <pre><code>var data = []; function initdata(){ $.ajax({ ... success: function(data){ data.push("test"); }, ... }); } $(document).ready(function(){ initdata(); console.log(data.length); console.log(data[0]); } </code></pre> <p>But the console says, <code>data.length</code> is <code>0</code> and <code>data[0]</code> is <code>undefined</code>. How can I access data from an ajax function in another function?</p>
0debug
I need help Regarding c language as my lab task khow to id print all name s in one loop : This code is about 'struct' in C.. I created a struct with the properties name,roll etc.. By using the for-loop I let the user to create the struct objects. they are named as student,employee, faculty the problem is the objects are created. But I can use them only inside the for-loop. If I want to get the value of all names in main function, it doesn't work. How can I solve it?How do i print all names in the code in only one loop #include<stdio.h> #include<conio.h> struct student { int std; char fee[90]; //Collect Data of students int rollno; char name[15]; char sub[100]; }; main() { int x; printf("******Enter the total number of Student from HOD*******:\n"); scanf("%d",&x); struct student a[x]; for(int i=0;i<x;i++) { printf("\nEnter Rollno:\t"); scanf("%d",&a[x].rollno); printf("\nEnter name:\t"); scanf("%s",&a[x].name); printf("\nIs Fee Submitted:\t"); scanf("%s",&a[x].fee); printf("\nEnter Subject name:\t"); scanf("%s",a[x].sub); } printf("\n****Display All Student names****"); for(int i=0;i<x;i++) { printf("\n%s",a[x].name); } //Faculty struct faculty { char Fname[100]; char Sname[100]; }; int y; printf("\n\n********Please HOD enter the total faculty members********\n"); scanf("%d",&y); struct faculty b[y]; for(int j=0;j<y;j++) { printf("\nEnter Faculty Member Name:\t"); scanf("%s",&b[y].Fname); printf("\nEnter their Subjects:\t"); scanf("%s",&b[y].Sname); } printf("\n****Display all Faculty Member Name****"); for(int j=0;j<y;j++) { printf("\n%s",b[y].Fname); } // Employes struct employes { char ename[100]; char rank[100]; }; int z; printf("\n\n********please HOD enter the total no of Employes*******:\n"); scanf("%s",&z); struct employes c[z]; for(int j=0;j<y;j++) { printf("\nEnter the Employe name:\t"); scanf("%s",&c[y].ename); printf("\n and enter their ranks:\t"); scanf("%s",&c[y].rank); } printf("\n****Display all Employe names****"); for(int j=0;j<y;j++) { printf("%s\n",c[y].ename); } }
0debug
static inline int check_fit_tl(tcg_target_long val, unsigned int bits) { return (val << ((sizeof(tcg_target_long) * 8 - bits)) >> (sizeof(tcg_target_long) * 8 - bits)) == val; }
1threat
static uint64_t musicpal_gpio_read(void *opaque, target_phys_addr_t offset, unsigned size) { musicpal_gpio_state *s = opaque; switch (offset) { case MP_GPIO_OE_HI: return s->lcd_brightness & MP_OE_LCD_BRIGHTNESS; case MP_GPIO_OUT_LO: return s->out_state & 0xFFFF; case MP_GPIO_OUT_HI: return s->out_state >> 16; case MP_GPIO_IN_LO: return s->in_state & 0xFFFF; case MP_GPIO_IN_HI: return s->in_state >> 16; case MP_GPIO_IER_LO: return s->ier & 0xFFFF; case MP_GPIO_IER_HI: return s->ier >> 16; case MP_GPIO_IMR_LO: return s->imr & 0xFFFF; case MP_GPIO_IMR_HI: return s->imr >> 16; case MP_GPIO_ISR_LO: return s->isr & 0xFFFF; case MP_GPIO_ISR_HI: return s->isr >> 16; default: return 0; } }
1threat
How to make map show to my current location automatically on opening my application? : <p>I am developing an application in which I am using maps. I want that as soon a I open my application it should automatically zoom in to show my location on map, but currently what is happening is that map is visible but current location is not shown automatically. It is shown after I click on MyLocationButton on top right side. So how to incorporate the above mentioned functionality in my code</p>
0debug
Evaluation of assignment in C# : <p>In C++ you can evaluate assignment as a condition, as shown here: <a href="https://stackoverflow.com/questions/2003895/in-c-what-causes-an-assignment-to-evaluate-as-true-or-false-when-used-in-a-con">In C++ what causes an assignment to evaluate as true or false when used in a control structure?</a></p> <p>I tried the same thing in C# and it doesn't seem to work.</p> <pre><code>public class Solution { static int _x = 0; public static bool DoStuff() { if (_x &gt; 10) { return false; } else { ++_x; return true; } } public static void Main(string[] args) { bool didStuff = false; while (didStuff = DoStuff()) { Console.WriteLine("You shouldn't see this more than 10 times..."); } if( didStuff) { Console.WriteLine("Girl, you know it's true."); } } } </code></pre> <p>Output:</p> <pre><code>You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... You shouldn't see this more than 10 times... </code></pre> <p>I expected to see, "Girl, you know it's true.", as the last line in the console window.</p> <p>The while seems to evaluate to true, but something is amiss with the assignment. Can anyone explain why I did not see the final output to console?</p>
0debug
Concatenating Dictionaries gives wrong output - Python : I just Started learning python and I am trying to concatenate dictionaries in python using this code : dict1= {1: 10, 2: 203, 3: 1456} dict2 = {1: 34, 2: 2034, 3: 176} dict3 = {1: 134, 2: 2340, 3: 126} finaldict = {**dict1,**dict2,**dict3} print(finaldict) but it is printing only `{1: 134, 2: 2340, 3: 126}` What is wrong with this .
0debug
void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs) { TCGOpcode op; TCGOpDef *def; const char *ct_str; int i, nb_args; for(;;) { if (tdefs->op == (TCGOpcode)-1) break; op = tdefs->op; assert(op >= 0 && op < NB_OPS); def = &tcg_op_defs[op]; #if defined(CONFIG_DEBUG_TCG) assert(!def->used); def->used = 1; #endif nb_args = def->nb_iargs + def->nb_oargs; for(i = 0; i < nb_args; i++) { ct_str = tdefs->args_ct_str[i]; assert(ct_str != NULL); tcg_regset_clear(def->args_ct[i].u.regs); def->args_ct[i].ct = 0; if (ct_str[0] >= '0' && ct_str[0] <= '9') { int oarg; oarg = ct_str[0] - '0'; assert(oarg < def->nb_oargs); assert(def->args_ct[oarg].ct & TCG_CT_REG); def->args_ct[i] = def->args_ct[oarg]; def->args_ct[oarg].ct = TCG_CT_ALIAS; def->args_ct[oarg].alias_index = i; def->args_ct[i].ct |= TCG_CT_IALIAS; def->args_ct[i].alias_index = oarg; } else { for(;;) { if (*ct_str == '\0') break; switch(*ct_str) { case 'i': def->args_ct[i].ct |= TCG_CT_CONST; ct_str++; break; default: if (target_parse_constraint(&def->args_ct[i], &ct_str) < 0) { fprintf(stderr, "Invalid constraint '%s' for arg %d of operation '%s'\n", ct_str, i, def->name); exit(1); } } } } } assert(i == TCG_MAX_OP_ARGS || tdefs->args_ct_str[i] == NULL); sort_constraints(def, 0, def->nb_oargs); sort_constraints(def, def->nb_oargs, def->nb_iargs); #if 0 { int i; printf("%s: sorted=", def->name); for(i = 0; i < def->nb_oargs + def->nb_iargs; i++) printf(" %d", def->sorted_args[i]); printf("\n"); } #endif tdefs++; } #if defined(CONFIG_DEBUG_TCG) i = 0; for (op = 0; op < ARRAY_SIZE(tcg_op_defs); op++) { if (op < INDEX_op_call || op == INDEX_op_debug_insn_start) { if (tcg_op_defs[op].used) { fprintf(stderr, "Invalid op definition for %s\n", tcg_op_defs[op].name); i = 1; } } else { if (!tcg_op_defs[op].used) { fprintf(stderr, "Missing op definition for %s\n", tcg_op_defs[op].name); i = 1; } } } if (i == 1) { tcg_abort(); } #endif }
1threat
SQL select all query to return only MAX seqno : Below query returns multiple rows as you can see in the image below. I want to know how to return only one row with MAX seqno on it. Appreciate you help. `SELECT * FROM dbo.SALESORD_HDR HD JOIN dbo.SALESORDHIST AS HI ON HD.SEQNO = HI.HEADER_SOURCE_SEQ AND hi.FILEURL <> '' AND HI.EVENT_TYPE='D' ` [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/KYFMk.jpg
0debug
static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; print_atom("mdhd", atom); get_byte(pb); get_byte(pb); get_byte(pb); get_byte(pb); get_be32(pb); get_be32(pb); c->streams[c->total_streams]->time_scale = get_be32(pb); #ifdef DEBUG printf("track[%i].time_scale = %i\n", c->fc->nb_streams-1, c->streams[c->total_streams]->time_scale); #endif get_be32(pb); get_be16(pb); get_be16(pb); return 0; }
1threat
Can firefox inspector change files on server? : i'm playing around with firefox inspector and change some things on a web page. Now the web hoster write me the webpage will be hacked. I watch the page via www, dont have any passwords or so. Is this coincidence or can a realy make changes on server with the inspector? The hoster write the affected file was a /cache_ac67f2ce3f.php Thanks for your help
0debug
create this list [[2], [3], [4], [3], [4], [5], [4], [5], [6]] using Python List Compression : i want to generate below output using List compression technique in Python Output: [[2], [3], [4], [3], [4], [5], [4], [5], [6]]
0debug
static void pci_indirect(void) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *vqpci; QGuestAllocator *alloc; QVirtioBlkReq req; QVRingIndirectDesc *indirect; void *addr; uint64_t req_addr; uint64_t capacity; uint32_t features; uint32_t free_head; uint8_t status; char *data; bus = test_start(); dev = virtio_blk_init(bus); addr = dev->addr + QVIRTIO_DEVICE_SPECIFIC_NO_MSIX; capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, addr); g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512); features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); g_assert_cmphex(features & QVIRTIO_F_RING_INDIRECT_DESC, !=, 0); features = features & ~(QVIRTIO_F_BAD_FEATURE | QVIRTIO_F_RING_EVENT_IDX | QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); alloc = pc_alloc_init(); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev, alloc, 0); qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev); req.type = QVIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 0; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); indirect = qvring_indirect_desc_setup(&dev->vdev, alloc, 2); qvring_indirect_desc_add(indirect, req_addr, 528, false); qvring_indirect_desc_add(indirect, req_addr + 528, 1, true); free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); g_assert(qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT)); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); g_free(indirect); guest_free(alloc, req_addr); req.type = QVIRTIO_BLK_T_IN; req.ioprio = 1; req.sector = 0; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); indirect = qvring_indirect_desc_setup(&dev->vdev, alloc, 2); qvring_indirect_desc_add(indirect, req_addr, 16, false); qvring_indirect_desc_add(indirect, req_addr + 16, 513, true); free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); g_assert(qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT)); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); data = g_malloc0(512); memread(req_addr + 16, data, 512); g_assert_cmpstr(data, ==, "TEST"); g_free(data); g_free(indirect); guest_free(alloc, req_addr); guest_free(alloc, vqpci->vq.desc); qvirtio_pci_device_disable(dev); g_free(dev); test_end(); }
1threat
Method for displaying binary number [C] : <p>Not sure why, but the number being outputted is:</p> <pre><code>101101 </code></pre> <p>Instead of </p> <pre><code>1011010 </code></pre> <p>Any ideas why?</p> <p>Here's my code:</p> <pre><code>typedef unsigned short bitSet; int main() { bitSet bits = makeBitSet(); displayBitSet(bits); } bitSet makeBitSet() { bitSet bits = 90; return bits; } displayBitSet(bitSet bs) { int i; for (i = 0; i &lt; 16; i++) { printf("%d", ((bs &amp; (int)pow(2, (16-1))) &gt;&gt; (16-i))); } } </code></pre>
0debug
Converting randomly generated list of numbers into integers : <pre><code>elif a == "other": numbers = [randrange(33, 126) for _ in range(8)] for n in numbers: print(n) print(chr(n)) sum(numbers) numbercomp = numbers /8 -32 </code></pre> <p>I am trying to convert the list of numbers that are randomly generated into a integer so I can divide them by 8 and minus 32.</p>
0debug
I am very new to Python, and unable to print any thing when i use a class. however i use a normal code without class it works : for the simplest code class Dog(): def __init__(self, color, height, breed): self.color = color self.height = height self.breed = breed my_dog = Kolin(color='brown', height='1 feet', breed='german shephered') print(type(my_dog)) print(my_dog.color) Process finished with exit code 0 and nothing is printed Note: it is on selenium python setup
0debug
find the key of groupby in linq C# : var aaa = newList.GroupBy(o => o.Date).Select(o => new { o }).ToList(); //There is a error of `Key` var bbb = aaa.Select(o => o.Key).ToList(); does that mean the `Key` is only allowed for the original List after `GroupBy`. Is it possible to obtain the `Key` for any `Select` after `GroupBy`?(Surely, we can storge the `Key = o.Key` in the `Select` )
0debug
static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno) { TCGv tmp; int data; switch (regno) { case 255: gen_helper_tbia(cpu_env); break; case 254: gen_helper_tbis(cpu_env, vb); break; case 253: tmp = tcg_const_i64(1); tcg_gen_st32_i64(tmp, cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, halted)); return gen_excp(ctx, EXCP_HALTED, 0); case 252: gen_helper_halt(vb); return EXIT_PC_STALE; case 251: gen_helper_set_alarm(cpu_env, vb); break; case 7: tcg_gen_st_i64(vb, cpu_env, offsetof(CPUAlphaState, palbr)); gen_helper_tb_flush(cpu_env); return EXIT_PC_STALE; case 32 ... 39: regno = regno == 39 ? 25 : regno - 32 + 8; tcg_gen_mov_i64(cpu_std_ir[regno], vb); break; case 0: st_flag_byte(vb, ENV_FLAG_PS_SHIFT); break; case 1: st_flag_byte(vb, ENV_FLAG_FEN_SHIFT); break; default: data = cpu_pr_data(regno); if (data != 0) { if (data & PR_LONG) { tcg_gen_st32_i64(vb, cpu_env, data & ~PR_LONG); } else { tcg_gen_st_i64(vb, cpu_env, data); } } break; } return NO_EXIT; }
1threat
Hexagon grid shortest path weighted tiles : <p>I'm not a programmer by trade (Chemical Engineer) but I'm working on some hobby code for a kid's science Olympics. </p> <p>Essentially, there is a Catan like (hexagonal) board with different tiles (8 types) with a start tile and end tile. Movement has no cost but moving through a tile incurs the tile's cost (example: moving to the tile A would incur a cost of 2). you can move in 6 directions through the sides of the hexagon (you don't ride the edge like Catan).</p> <p>The goal of the game is to get the lowest score for your path at the end.</p> <p><strong>What I've researched and tried</strong></p> <p>So far I've tried to code a shortest path algorithm using matlab and dijkstra. However, I'm finding I have to do a lot of work because there are 250 nodes and each require 6 exiting lines that are weighted. I don't know how to place these nodes in a space and essentially say, "alright, you're worth X amount and can travel to any adjacent space" without manually coding each line. </p> <p>FWIW i'm using matlab and was trying to adapt <a href="http://www.mathworks.com/matlabcentral/fileexchange/20025-dijkstra-s-minimum-cost-path-algorithm" rel="nofollow">this code</a> but am struggling on populating the table for E3 and V, less so V but mostly an easy way to say "okay, here are the tiles that are worth X."</p> <p>Thanks in advance,</p>
0debug
int tcg_gen_code(TCGContext *s, TranslationBlock *tb) { #ifdef CONFIG_PROFILER TCGProfile *prof = &s->prof; #endif int i, oi, oi_next, num_insns; #ifdef CONFIG_PROFILER { int n; n = s->gen_op_buf[0].prev + 1; atomic_set(&prof->op_count, prof->op_count + n); if (n > prof->op_count_max) { atomic_set(&prof->op_count_max, n); } n = s->nb_temps; atomic_set(&prof->temp_count, prof->temp_count + n); if (n > prof->temp_count_max) { atomic_set(&prof->temp_count_max, n); } } #endif #ifdef DEBUG_DISAS if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP) && qemu_log_in_addr_range(tb->pc))) { qemu_log_lock(); qemu_log("OP:\n"); tcg_dump_ops(s); qemu_log("\n"); qemu_log_unlock(); } #endif #ifdef CONFIG_PROFILER atomic_set(&prof->opt_time, prof->opt_time - profile_getclock()); #endif #ifdef USE_TCG_OPTIMIZATIONS tcg_optimize(s); #endif #ifdef CONFIG_PROFILER atomic_set(&prof->opt_time, prof->opt_time + profile_getclock()); atomic_set(&prof->la_time, prof->la_time - profile_getclock()); #endif liveness_pass_1(s); if (s->nb_indirects > 0) { #ifdef DEBUG_DISAS if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_IND) && qemu_log_in_addr_range(tb->pc))) { qemu_log_lock(); qemu_log("OP before indirect lowering:\n"); tcg_dump_ops(s); qemu_log("\n"); qemu_log_unlock(); } #endif if (liveness_pass_2(s)) { liveness_pass_1(s); } } #ifdef CONFIG_PROFILER atomic_set(&prof->la_time, prof->la_time + profile_getclock()); #endif #ifdef DEBUG_DISAS if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT) && qemu_log_in_addr_range(tb->pc))) { qemu_log_lock(); qemu_log("OP after optimization and liveness analysis:\n"); tcg_dump_ops(s); qemu_log("\n"); qemu_log_unlock(); } #endif tcg_reg_alloc_start(s); s->code_buf = tb->tc.ptr; s->code_ptr = tb->tc.ptr; #ifdef TCG_TARGET_NEED_LDST_LABELS s->ldst_labels = NULL; #endif #ifdef TCG_TARGET_NEED_POOL_LABELS s->pool_labels = NULL; #endif num_insns = -1; for (oi = s->gen_op_buf[0].next; oi != 0; oi = oi_next) { TCGOp * const op = &s->gen_op_buf[oi]; TCGOpcode opc = op->opc; oi_next = op->next; #ifdef CONFIG_PROFILER atomic_set(&prof->table_op_count[opc], prof->table_op_count[opc] + 1); #endif switch (opc) { case INDEX_op_mov_i32: case INDEX_op_mov_i64: tcg_reg_alloc_mov(s, op); break; case INDEX_op_movi_i32: case INDEX_op_movi_i64: tcg_reg_alloc_movi(s, op); break; case INDEX_op_insn_start: if (num_insns >= 0) { s->gen_insn_end_off[num_insns] = tcg_current_code_size(s); } num_insns++; for (i = 0; i < TARGET_INSN_START_WORDS; ++i) { target_ulong a; #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS a = deposit64(op->args[i * 2], 32, 32, op->args[i * 2 + 1]); #else a = op->args[i]; #endif s->gen_insn_data[num_insns][i] = a; } break; case INDEX_op_discard: temp_dead(s, arg_temp(op->args[0])); break; case INDEX_op_set_label: tcg_reg_alloc_bb_end(s, s->reserved_regs); tcg_out_label(s, arg_label(op->args[0]), s->code_ptr); break; case INDEX_op_call: tcg_reg_alloc_call(s, op); break; default: tcg_debug_assert(tcg_op_supported(opc)); tcg_reg_alloc_op(s, op); break; } #ifdef CONFIG_DEBUG_TCG check_regs(s); #endif if (unlikely((void *)s->code_ptr > s->code_gen_highwater)) { return -1; } } tcg_debug_assert(num_insns >= 0); s->gen_insn_end_off[num_insns] = tcg_current_code_size(s); #ifdef TCG_TARGET_NEED_LDST_LABELS if (!tcg_out_ldst_finalize(s)) { return -1; } #endif #ifdef TCG_TARGET_NEED_POOL_LABELS if (!tcg_out_pool_finalize(s)) { return -1; } #endif flush_icache_range((uintptr_t)s->code_buf, (uintptr_t)s->code_ptr); return tcg_current_code_size(s); }
1threat
int net_init_vde(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevVdeOptions *vde; assert(opts->type == NET_CLIENT_OPTIONS_KIND_VDE); vde = opts->u.vde; if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group, vde->has_mode ? vde->mode : 0700) == -1) { return -1; } return 0; }
1threat
static void ccw_init(MachineState *machine) { int ret; VirtualCssBus *css_bus; s390_sclp_init(); s390_memory_init(machine->ram_size); s390_init_cpus(machine); s390_flic_init(); css_bus = virtual_css_bus_init(); s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, machine->initrd_filename, "s390-ccw.img", "s390-netboot.img", true); if (s390_has_feat(S390_FEAT_ZPCI)) { DeviceState *dev = qdev_create(NULL, TYPE_S390_PCI_HOST_BRIDGE); object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE, OBJECT(dev), NULL); qdev_init_nofail(dev); } virtio_ccw_register_hcalls(); s390_enable_css_support(s390_cpu_addr2state(0)); if (css_bus->squash_mcss) { ret = css_create_css_image(0, true); } else { ret = css_create_css_image(VIRTUAL_CSSID, true); } assert(ret == 0); s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw"); register_savevm_live(NULL, "todclock", 0, 1, &savevm_gtod, NULL); }
1threat
void migration_set_incoming_channel(MigrationState *s, QIOChannel *ioc) { QEMUFile *f = qemu_fopen_channel_input(ioc); process_incoming_migration(f); }
1threat
What does the "operation name" reference? : <p>I'm learning about GraphQL and I'm very interested in the <code>operation name</code> the part of the query that comes after the <code>query</code> or <code>mutation</code> (depending on the root query type). I found a couple of code examples using the operation name, and I'm confused as to where they come from? There seems to be no references in the code about them, and they seem completely arbitrary.</p> <pre><code>query Welcome { echo (email: "hi@example.com") } </code></pre> <p>and</p> <pre><code>query HeroNameQuery { hero { name } } </code></pre> <p>I don't understand why a given schema can't just contain the queries and types that follow (eg. <code>user</code>, <code>article</code>, <code>order</code>, etc.), and I don't understand the namespacing system and the operation name provides any sort of advantage.</p> <p><a href="https://github.com/mugli/learning-graphql/blame/master/7.%20Deep%20Dive%20into%20GraphQL%20Type%20System.md#L436" rel="noreferrer">https://github.com/mugli/learning-graphql/blame/master/7.%20Deep%20Dive%20into%20GraphQL%20Type%20System.md#L436</a></p> <p><a href="http://graphql.org/docs/queries/" rel="noreferrer">http://graphql.org/docs/queries/</a></p>
0debug
Split string when ";" appears : <p>I need to split the string everytime <code>;</code> shows up.</p> <pre><code>words = "LightOn;LightOff;LightStatus;LightClientHello;" </code></pre> <p>Output should be something like this:</p> <pre><code>LightOn LightOff LightStatus LightClientHello </code></pre> <p>Simply, everytime it finds <code>;</code> in a string, it has to split it.</p> <p>Thank you for help</p>
0debug
static uint64_t exynos4210_pwm_read(void *opaque, target_phys_addr_t offset, unsigned size) { Exynos4210PWMState *s = (Exynos4210PWMState *)opaque; uint32_t value = 0; int index; switch (offset) { case TCFG0: case TCFG1: index = (offset - TCFG0) >> 2; value = s->reg_tcfg[index]; break; case TCON: value = s->reg_tcon; break; case TCNTB0: case TCNTB1: case TCNTB2: case TCNTB3: case TCNTB4: index = (offset - TCNTB0) / 0xC; value = s->timer[index].reg_tcntb; break; case TCMPB0: case TCMPB1: case TCMPB2: case TCMPB3: index = (offset - TCMPB0) / 0xC; value = s->timer[index].reg_tcmpb; break; case TCNTO0: case TCNTO1: case TCNTO2: case TCNTO3: case TCNTO4: index = (offset == TCNTO4) ? 4 : (offset - TCNTO0) / 0xC; value = ptimer_get_count(s->timer[index].ptimer); break; case TINT_CSTAT: value = s->reg_tint_cstat; break; default: fprintf(stderr, "[exynos4210.pwm: bad read offset " TARGET_FMT_plx "]\n", offset); break; } return value; }
1threat
The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid : <p>I am using Spring Boot 1.5.13 version.</p> <p>I got the exception message like below.</p> <pre><code>Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid </code></pre> <p>I founded out this issue in Spring Github Issues. <a href="https://github.com/spring-projects/spring-boot/issues/9616" rel="noreferrer">https://github.com/spring-projects/spring-boot/issues/9616</a></p> <p>But I still have questions of that.</p> <ol> <li>I am not using File Upload things in my app. But the log says that "Could not parse multipart servlet request" why is that? (I got the exception when my app uses RestTemplate (Post method)</li> <li>To solve the exception, I rebooted my app but It did not work right away. Although i rebooted my app, it had referenced the tomcat directory which was not exist. After a day after rebooting, it worked. I guess the directory was cached in somewhere in Spring or else..?</li> </ol> <p>Please Help me out!</p>
0debug
static int rtsp_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { RTSPState *rt = s->priv_data; rt->seek_timestamp = av_rescale_q(timestamp, s->streams[stream_index]->time_base, AV_TIME_BASE_Q); switch(rt->state) { default: case RTSP_STATE_IDLE: break; case RTSP_STATE_PLAYING: if (rtsp_read_pause(s) != 0) return -1; rt->state = RTSP_STATE_SEEKING; if (rtsp_read_play(s) != 0) return -1; break; case RTSP_STATE_PAUSED: rt->state = RTSP_STATE_IDLE; break; } return 0; }
1threat
How can I make a video from array of images in matplotlib? : <p>I have a couple of images that show how something changes in time. I visualize them as many images on the same plot with the following code:</p> <pre><code>import matplotlib.pyplot as plt import matplotlib.cm as cm img = [] # some array of images fig = plt.figure() for i in xrange(6): fig.add_subplot(2, 3, i + 1) plt.imshow(img[i], cmap=cm.Greys_r) plt.show() </code></pre> <p>and get something like:<a href="https://i.stack.imgur.com/QX5Jm.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/QX5Jm.jpg" alt="enter image description here"></a></p> <p>Which is ok, but I would rather animate them to get <a href="https://kaggle2.blob.core.windows.net/competitions/kaggle/4729/media/heartbeat_cropped.mp4" rel="noreferrer">something like this video</a>. How can I achieve this with python and preferably (not necessarily) with matplotlib</p>
0debug
NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor conflits on Elastic Search jar : <p>While creating Elasticsearch Client, I'm getting the exception java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor; After some lookup, seams like the Guava-18 is being overwrite by an older version at runtime, and Guava-18 only works during compile task. </p> <p>My Maven configuration is the follow: </p> <pre><code> &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.0&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.7&lt;/source&gt; &lt;target&gt;1.7&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt; &lt;version&gt;2.4.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;shade&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;transformers&gt; &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/&gt; &lt;/transformers&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>How can i force the Guava-18 version at execution time?</p>
0debug
How to fix "Unable to acquire lock after 15 seconds" errors in Wildfly : <p>I have a web application that is <code>&lt;distributable/&gt;</code>, but also deployed to stand alone instances of Wildfly for local development work. Sometimes we have calls to the backend that can stall for a few seconds, which often leads to exceptions like the one shown below.</p> <p>How can I fix this given that I have no control over long running backend requests?</p> <pre><code>14:55:04,808 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (default task-6) ISPN000136: Error executing command LockControlCommand, writing keys []: org.infinispan.util.concurrent.TimeoutException: ISPN000299: Unable to acquire lock after 15 seconds for key LA6Q5r9L1q-VF2tyKE9Pc_bO9yYtzXu8dYt8l-BQ and requestor GlobalTransaction:&lt;null&gt;:37:local. Lock is held by GlobalTransaction:&lt;null&gt;:36:local at org.infinispan.util.concurrent.locks.impl.DefaultLockManager$KeyAwareExtendedLockPromise.lock(DefaultLockManager.java:236) at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lockAllAndRecord(AbstractLockingInterceptor.java:199) at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.checkPendingAndLockAllKeys(AbstractTxLockingInterceptor.java:199) at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockAllOrRegisterBackupLock(AbstractTxLockingInterceptor.java:165) at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitLockControlCommand(PessimisticLockingInterceptor.java:184) at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:110) at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99) at org.infinispan.interceptors.TxInterceptor.invokeNextInterceptorAndVerifyTransaction(TxInterceptor.java:157) at org.infinispan.interceptors.TxInterceptor.visitLockControlCommand(TxInterceptor.java:215) at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:110) at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99) at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:107) at org.infinispan.interceptors.InvocationContextInterceptor.visitLockControlCommand(InvocationContextInterceptor.java:81) at org.infinispan.commands.control.LockControlCommand.acceptVisitor(LockControlCommand.java:110) at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:336) at org.infinispan.cache.impl.CacheImpl.lock(CacheImpl.java:828) at org.infinispan.cache.impl.CacheImpl.lock(CacheImpl.java:810) at org.infinispan.cache.impl.AbstractDelegatingAdvancedCache.lock(AbstractDelegatingAdvancedCache.java:177) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionMetaDataFactory.getValue(InfinispanSessionMetaDataFactory.java:84) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionMetaDataFactory.findValue(InfinispanSessionMetaDataFactory.java:69) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionMetaDataFactory.findValue(InfinispanSessionMetaDataFactory.java:39) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:61) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionFactory.findValue(InfinispanSessionFactory.java:40) at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:234) at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:140) at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:726) at io.undertow.servlet.spec.HttpServletRequestImpl.getSession(HttpServletRequestImpl.java:370) at au.com.agic.settings.listener.SessionInvalidatorListener.clearSession(SessionInvalidatorListener.java:57) at au.com.agic.settings.listener.SessionInvalidatorListener.requestInitialized(SessionInvalidatorListener.java:52) at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:245) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:283) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) 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
What are the possible ways that test cases can be written for Set() type of method : I'm completely new to writing unit test cases for the code using ```xUnit```. I'm unsure of what else can be tested for my method ```TranslateResponse()``` . It basically checks the type of translator and calls the translator's associated ```set()``` method. ``` public async Task TranslateResponse(Policy response) { foreach (var t in await _translatorFactory.BuildTranslators()) { var policyTranslator = t as IPolicyAwareTranslator; policyTranslator?.SetPolicy(response); var additionalInterestTranslator = t as IAdditionalInterestAwareTranslator; additionalInterestTranslator?.SetAdditionalInterests(response.AdditionalInterests); var locationsTranslator = t as ILocationsAwareTranslator; locationsTranslator?.SetLocations(response.Locations); } } ``` I'm writing test cases for the ```TranslateResponse()``` method. As far as I figured out, I'm verifying that the calls to respective methods happens based on the provided type of translator. The test case lines ``` Mock<ITranslator> mockedTranslator = new Mock<ITranslator>(); mockedTranslator.Setup(t => t.Translate(_translatorDataAccessor.Object)); var mockedPolicyTranslator = mockedTranslator.As<IPolicyAwareTranslator>(); mockedPolicyTranslator.Setup(t => t.SetPolicy(It.IsAny<Policy>())); mockedPolicyTranslator.Verify(t => t.SetPolicy(It.IsAny<Policy>()), Times.AtLeastOnce); ``` My concerns are 1. I'm curious to know whether I can test something more than verifying calls? 2. Should I test for the logic of the set() method here or in it's own class? Even, then I'm not able to figure out what to Assert in the test case for the ```Set()``` which will set the private field with the passed in argument. ``` public class PolicyTranslator : ITranslator, IPolicyAwareTranslator { private Policy _policy; public void SetPolicy(Policy policy) { _policy = policy; } //translate() }
0debug
create-react-app: how to use https instead of http? : <p>I was wondering if anyone knows how to use https on dev for the 'create-react-app' environment. I can't see anything about that in the README or quick googling. I just want either the <a href="https://localhost:3000" rel="noreferrer">https://localhost:3000</a> to work, or else <a href="https://localhost:3001" rel="noreferrer">https://localhost:3001</a>.</p>
0debug
Difference between interpolation and property binding : <p>I have a component which defines an <code>imageUrl</code> property and in my template I use this property to set the url of an image. I tried this using interpolation and using property binding, both work, but I cannot find any differences between the two, or when to use the one over the other. Does anyone know the difference?</p> <pre><code>&lt;img [src]='imageUrl' &gt; &lt;img src= {{ imageUrl }} &gt; </code></pre>
0debug
def decimal_to_Octal(deciNum): octalNum = 0 countval = 1; dNo = deciNum; while (deciNum!= 0): remainder= deciNum % 8; octalNum+= remainder*countval; countval= countval*10; deciNum //= 8; return (octalNum)
0debug
I AM NOT ABLE TO RETRIEVE MY LOG IN CREDENTIALS.in laravel? : I know this might sound easy, I downloaded a bootstrap admin template to make my work easier but am not able to work around the log in page. I am trying to retrieve information i inserted but can't be able to do so and I dont know why. I get the error undefined index:name and i dont understand why its picking the insert function instead of the store function, here is my code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <form id="login-form" method="POST" action="{{route('/login')}}"> <div class="form-group"> <label for="email">Email:</label> <input type="email" class="form-control" id="email" name="email" required class="input-material"> </div> <div class="form-group"> <label for="password">Password:</label> <input type="password" class="form-control" id="password" name="password" required class="input-material" > </div> <div class="form-group"> <button type="submit" class="btn btn-primary">Login</button> </div> <div class="col-md-8 col-md-offset-2"> @if(Session::has('danger')) <div class="alert alert-danger"> {{ Session::get('danger') }} </div> @endif </div> <!-- This should be submit button but I replaced it with <a> for demo purposes--> </form><a href="#" class="forgot-pass">Forgot Password?</a><br><small>Do not have an account? </small><a href="{{route('register')}}" class="signup">Signup</a> <!-- end snippet --> <!-- begin snippet: js hide: false console: true babel: false --> <!-- My controller --> public function store(){ $rules = array( 'email' => 'required|email', // make sure the email is an actual email 'password' => 'required|alphaNum|min:6' // password can only be alphanumeric and has to be greater than 6 characters ); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to('login') ->withErrors($validator) // send back all errors to the login form ->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form } else { // create our user data for the authentication $userdata = array( 'email' => Input::get('email'), 'password' => Input::get('password') ); // attempt to do the login if (Auth::attempt($userdata)) { return redirect::to('home'); } else { // validation not successful, send back to form return Redirect::to('login'); } } } <!-- end snippet -->
0debug
Python please don't muck with my number : <p>I'm writing a testing tool in python that downloads REST data, tosses the return value through json.loads() and then compares the value returned from the DB with an expected value. Unfortunately trying to print out that value or compare that value fails. Even though the pretty print of the JSON / Rest data is correct and has the full value. So something as simple as the example below prints lesser precision </p> <p>Example:</p> <pre><code>print 1.414213562373095 1.41421356237 </code></pre> <p>Note the reduced precision. Running an equal compare does not work either. In both cases I'm coercing the value to a string since comparing two numbers such as 1.13337 and 1.133333333333337 compare as the same number. Although technically correct we want to be sure that the output from the DB is at the promised precision. I would be grateful for any solutions out there. Thanks in advance.</p>
0debug
How can I change the finder background color on mac Yosemite 10.10.5 : <p>Every post I've seen says to open a finder, click view > Show View Options, and there is a background section to change the color of thew background. But when I go into show view options all it has is arrange by:, sort by: and text size. </p> <p>Did the background option get moved? If not what can I do to make it show?</p>
0debug
static void vfio_pci_size_rom(VFIODevice *vdev) { uint32_t orig, size = cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK); off_t offset = vdev->config_offset + PCI_ROM_ADDRESS; char name[32]; if (vdev->pdev.romfile || !vdev->pdev.rom_bar) { return; } if (pread(vdev->fd, &orig, 4, offset) != 4 || pwrite(vdev->fd, &size, 4, offset) != 4 || pread(vdev->fd, &size, 4, offset) != 4 || pwrite(vdev->fd, &orig, 4, offset) != 4) { error_report("%s(%04x:%02x:%02x.%x) failed: %m", __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); return; } size = ~(le32_to_cpu(size) & PCI_ROM_ADDRESS_MASK) + 1; if (!size) { return; } DPRINTF("%04x:%02x:%02x.%x ROM size 0x%x\n", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function, size); snprintf(name, sizeof(name), "vfio[%04x:%02x:%02x.%x].rom", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); memory_region_init_io(&vdev->pdev.rom, OBJECT(vdev), &vfio_rom_ops, vdev, name, size); pci_register_bar(&vdev->pdev, PCI_ROM_SLOT, PCI_BASE_ADDRESS_SPACE_MEMORY, &vdev->pdev.rom); vdev->pdev.has_rom = true; }
1threat
My Question is to capitalise the first word of a string in hacker rank and I am getting an error regarding the EOF error : You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. I had tried in online compiler like repl.it I am getting correct answer but am getting when I am trying in hacker rank. flag = True while(flag): try: S = input() g = (S.title()) print(g) except EOFError: flag = False Traceback (most recent call last): File "solution.py", line 26, in <module> s = input() EOFError: EOF when reading a line
0debug
static void slavio_timer_irq(void *opaque) { TimerContext *tc = opaque; SLAVIO_TIMERState *s = tc->s; CPUTimerState *t = &s->cputimer[tc->timer_index]; slavio_timer_get_out(t); DPRINTF("callback: count %x%08x\n", t->counthigh, t->count); t->reached = TIMER_REACHED; if (!slavio_timer_is_user(tc) && t->limit != 0) { qemu_irq_raise(t->irq); } }
1threat
void test_segs(void) { struct modify_ldt_ldt_s ldt; long long ldt_table[3]; int res, res2; char tmp; struct { uint32_t offset; uint16_t seg; } __attribute__((packed)) segoff; ldt.entry_number = 1; ldt.base_addr = (unsigned long)&seg_data1; ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); ldt.entry_number = 2; ldt.base_addr = (unsigned long)&seg_data2; ldt.limit = (sizeof(seg_data2) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); modify_ldt(0, &ldt_table, sizeof(ldt_table)); #if 0 { int i; for(i=0;i<3;i++) printf("%d: %016Lx\n", i, ldt_table[i]); } #endif asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); seg_data1[1] = 0xaa; seg_data2[1] = 0x55; asm volatile ("fs movzbl 0x1, %0" : "=r" (res)); printf("FS[1] = %02x\n", res); asm volatile ("pushl %%gs\n" "movl %1, %%gs\n" "gs movzbl 0x1, %0\n" "popl %%gs\n" : "=r" (res) : "r" (MK_SEL(2))); printf("GS[1] = %02x\n", res); tmp = 0xa5; asm volatile ("pushl %%ebp\n\t" "pushl %%ds\n\t" "movl %2, %%ds\n\t" "movl %3, %%ebp\n\t" "movzbl 0x1, %0\n\t" "movzbl (%%ebp), %1\n\t" "popl %%ds\n\t" "popl %%ebp\n\t" : "=r" (res), "=r" (res2) : "r" (MK_SEL(1)), "r" (&tmp)); printf("DS[1] = %02x\n", res); printf("SS[tmp] = %02x\n", res2); segoff.seg = MK_SEL(2); segoff.offset = 0xabcdef12; asm volatile("lfs %2, %0\n\t" "movl %%fs, %1\n\t" : "=r" (res), "=g" (res2) : "m" (segoff)); printf("FS:reg = %04x:%08x\n", res2, res); TEST_LR("larw", "w", MK_SEL(2), 0x0100); TEST_LR("larl", "", MK_SEL(2), 0x0100); TEST_LR("lslw", "w", MK_SEL(2), 0); TEST_LR("lsll", "", MK_SEL(2), 0); TEST_LR("larw", "w", 0xfff8, 0); TEST_LR("larl", "", 0xfff8, 0); TEST_LR("lslw", "w", 0xfff8, 0); TEST_LR("lsll", "", 0xfff8, 0); TEST_ARPL("arpl", "w", 0x12345678 | 3, 0x762123c | 1); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 3); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 1); }
1threat
How to extend styled component without passing props to underlying DOM element? : <p>I have a styled component that is extending a third-party component:</p> <pre><code>import Resizable from 're-resizable'; ... const ResizableSC = styled(Resizable)``; export const StyledPaneContainer = ResizableSC.extend` flex: 0 0 ${(props) =&gt; props.someProp}px; `; const PaneContainer = ({ children, someProp }) =&gt; ( &lt;StyledPaneContainer someProp={someProp} &gt; {children} &lt;/StyledPaneContainer&gt; ); export default PaneContainer; </code></pre> <p>This resulted in the following error in the browser console:</p> <blockquote> <p>Warning: React does not recognize the <code>someProp</code> prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase <code>someProp</code> instead. If you accidentally passed it from a parent component, remove it from the DOM element</p> </blockquote> <p>So, I changed the prop to have a <code>data-*</code> attribute name:</p> <pre><code>import Resizable from 're-resizable'; ... const ResizableSC = styled(Resizable)``; export const StyledPaneContainer = ResizableSC.extend` flex: 0 0 ${(props) =&gt; props['data-s']}px; `; const PaneContainer = ({ children, someProp }) =&gt; ( &lt;StyledPaneContainer data-s={someProp} &gt; {children} &lt;/StyledPaneContainer&gt; ); export default PaneContainer; </code></pre> <p>This works, but I was wondering if there was a native way to use props in the styled component without them being passed down to the DOM element (?)</p>
0debug
int tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp) { s->get_error = socket_errno; s->write = socket_write; s->close = tcp_close; s->fd = inet_connect(host_port, false, errp); if (!error_is_set(errp)) { migrate_fd_connect(s); } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) { DPRINTF("connect in progress\n"); qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s); } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) { DPRINTF("connect failed\n"); return -1; } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) { DPRINTF("connect failed\n"); migrate_fd_error(s); return -1; } else { DPRINTF("unknown error\n"); return -1; } return 0; }
1threat
static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) { uint8_t byte; if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); c->nreslevels = bytestream_get_byte(&s->buf) + 1; if (c->nreslevels > JPEG2000_MAX_RESLEVELS) return AVERROR_INVALIDDATA; if (c->nreslevels < s->reduction_factor) c->nreslevels2decode = 1; else c->nreslevels2decode = c->nreslevels - s->reduction_factor; c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 || c->log2_cblk_width + c->log2_cblk_height > 12) { av_log(s->avctx, AV_LOG_ERROR, "cblk size invalid\n"); return AVERROR_INVALIDDATA; } c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0) { avpriv_request_sample(s->avctx, "Support for extra cblk styles"); return AVERROR_PATCHWELCOME; } c->transform = bytestream_get_byte(&s->buf); if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97)) c->transform = FF_DWT97_INT; if (c->csty & JPEG2000_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) { byte = bytestream_get_byte(&s->buf); c->log2_prec_widths[i] = byte & 0x0F; c->log2_prec_heights[i] = (byte >> 4) & 0x0F; } } return 0; }
1threat
static int get_bits(J2kDecoderContext *s, int n) { int res = 0; if (s->buf_end - s->buf < ((n - s->bit_index) >> 8)) return AVERROR(EINVAL); while (--n >= 0){ res <<= 1; if (s->bit_index == 0){ s->bit_index = 7 + (*s->buf != 0xff); s->buf++; } s->bit_index--; res |= (*s->buf >> s->bit_index) & 1; } return res; }
1threat
Android daily function exacute and upload to server : I want to create daily game for my puzzle game, I want to exacute function that creates "The Grid" of my game every 24 hour on the same time each day upload the result of the function to any server I can read from with my app.<br/> I'm using Firebase with my app so I prefer solution with firebase, What is the best way to do so?
0debug
uint32_t helper_float_cvtw_s(CPUMIPSState *env, uint32_t fst0) { uint32_t wt2; wt2 = float32_to_int32(fst0, &env->active_fpu.fp_status); update_fcr31(env, GETPC()); if (get_float_exception_flags(&env->active_fpu.fp_status) & (float_flag_invalid | float_flag_overflow)) { wt2 = FP_TO_INT32_OVERFLOW; } return wt2; }
1threat
Remember-me not working .. throws java.lang.IllegalStateException: UserDetailsService is required : <p>Following the guidlines of below tutorial I implemented remember-me functionality</p> <pre><code>http://www.baeldung.com/spring-security-remember-me </code></pre> <p>But when I run the program it throws <strong>java.lang.IllegalStateException: UserDetailsService is required.</strong> whereas UserDetails service is implemented properly. Below is the configure method and registration of userDetailsWebService.</p> <pre><code>@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http .authorizeRequests() .antMatchers("/", "/home","/login","/adduser","/verifyemail", "/baduser", "/resetmypassword","/resetpasswordlink").permitAll() .antMatchers("/tasks").hasAnyAuthority("APP_USER","APP_TENURED_USER","ADMIN") .antMatchers("/resetpasswordpage","/resetpassword").hasAuthority(TaskFirstConstants.RESET_PASSWORD_ACCESS) .antMatchers("/resetpasswordpage","/resetpassword").hasRole("") .anyRequest().authenticated() .and().rememberMe().key("uniqueAndSecret") // -- here .and() .formLogin() .loginProcessingUrl("/perform_login") .loginPage("/login") .defaultSuccessUrl("/tasks") .permitAll() .and() .logout() .permitAll() .logoutSuccessUrl("/login"); // @formatter:on } @Bean @Autowired public DaoAuthenticationProvider authenticationProvider(PasswordEncoder passwordEncoder, UserDetailsService userDetailsService ){ DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(); daoAuthenticationProvider.setPasswordEncoder(passwordEncoder); daoAuthenticationProvider.setUserDetailsService(userDetailsService); return daoAuthenticationProvider; } </code></pre> <p>Complete error log is below .. </p> <pre><code>java.lang.IllegalStateException: UserDetailsService is required. at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$UserDetailsServiceDelegator.loadUserByUsername(WebSe curityConfigurerAdapter.java:455) ~[spring-security-config-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices.processAutoLoginCookie(TokenBasedRememberMeServices.java:1 23) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.autoLogin(AbstractRememberMeServices.java:130) ~[spring-secu rity-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:98) ~[sprin g-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[s pring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-4.2.3.RELEAS E.jar:4.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~ [spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3. RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) ~[spring-security-web-4.2.3.RELEASE.jar:4. 2.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-we b-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4 .2.3.RELEASE] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEAS E] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE ] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) ~[spring-web-4.3.10.RELEASE.jar:4.3.10 .RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELE ASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.R ELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) ~[spring-boot-actuator-1.5.6.RELEASE.jar:1.5 .6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.10.RELEASE.jar:4.3.10.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) [tomcat-embed-core-8.5.16.jar:8.5.16] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.16.jar:8.5.16] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.16.jar:8.5.16] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144] </code></pre> <p>To have a look at complete code, please check <a href="https://github.com/vikashsaini01/TaskFirst/" rel="noreferrer">https://github.com/vikashsaini01/TaskFirst/</a></p>
0debug
bash print 10 odd numbers then 10 even numbers : <p>How can I print 10 odd numbers and then the 10 even numbers then the next 10 odd numbers then the next 10 even numbers and so on. Something like this: </p> <p>1 3 5 7 9 11 13 15 17 19 2 4 6 8 10 12 14 16 18 20</p> <p>21 23 25 27 29 31 33 35 37 39 22 24 26 28 30 32 34 36 38 40 ...</p> <p>I know how to print each apart but combined I have no idea how to start.</p>
0debug
random numbers from to C++ : I want it to display random numbers from to the value it writes but something is not working properly there is code #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int draw(int from_to, int to_from) { return (rand()%to_from)+from_to; } int main() { srand(time(NULL)); int start,stop; cout << "First number: " << endl; cin >> start; cout << "Last number: " << endl; cin >> stop; int x=20; do { cout << draw(start,stop) << endl; x--; } while(x>0); return 0; }
0debug
syntax error, unexpected end of file in ... on line 31 : <p>I didn't have any code here on line 31 in this code so what do you think what's the problem here? :)</p> <pre><code>&lt;?php require('config.php'); if(isset($_POST['submit'])) { $uname = mysqli_real_escape_string($con, $_POST['uname']); $pass = mysqli_real_escape_string($con, $_POST['pass']); $sql = mysqli_query($con, "SELECT * FROM users WHERE uname = '$uname' AND pass = '$pass'"); if (mysqli_num_rows($sql) &gt; 0) { echo "You are now logged in."; exit(); } } else { $form = &lt;&lt;&lt;EOT &lt;form action="login.php" method="POST"&gt; Username: &lt;input type="text" name="uname" /&gt;&lt;/br&gt; Password: &lt;input type="password" name="pass" /&gt;&lt;/br&gt; &lt;input type="submit" name="submit" value="Log in" /&gt; &lt;/form&gt; EOT; echo $form; } ?&gt; </code></pre> <p>I think that all my brackets are fine :D</p>
0debug
static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, BdrvRequestFlags flags) { if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { return -EINVAL; } return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, qiov, flags); }
1threat
CSS Transform & Transition which prefixes (e.g. -o-) are necessary? : <p>Is there any up to date documentation that lists which out of the following prefixes are required for transforms and transitions and for which browser version? Or could anyone sum it up for me?</p> <p>Do I need to use all of these for transform?</p> <pre><code> -webkit-transform: -moz-transform: -ms-transform: -o-transform: transform: </code></pre> <p>And all of these for transition?</p> <pre><code> -webkit-transition: all 0.4s ease; -moz-transition: all 0.4s ease; -ms-transition: all 0.4s ease; -o-transition: all 0.4s ease; transition: all 0.4s ease; </code></pre> <p>Just to be safe?</p>
0debug
static void gen_load_exclusive(DisasContext *s, int rt, int rt2, TCGv_i32 addr, int size) { TCGv_i32 tmp = tcg_temp_new_i32(); s->is_ldex = true; switch (size) { case 0: gen_aa32_ld8u(tmp, addr, get_mem_index(s)); break; case 1: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; case 2: case 3: gen_aa32_ld32u(tmp, addr, get_mem_index(s)); break; default: abort(); } if (size == 3) { TCGv_i32 tmp2 = tcg_temp_new_i32(); TCGv_i32 tmp3 = tcg_temp_new_i32(); tcg_gen_addi_i32(tmp2, addr, 4); gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s)); tcg_temp_free_i32(tmp2); tcg_gen_concat_i32_i64(cpu_exclusive_val, tmp, tmp3); store_reg(s, rt2, tmp3); } else { tcg_gen_extu_i32_i64(cpu_exclusive_val, tmp); } store_reg(s, rt, tmp); tcg_gen_extu_i32_i64(cpu_exclusive_addr, addr); }
1threat
static int write_elf64_load(DumpState *s, MemoryMapping *memory_mapping, int phdr_index, hwaddr offset) { Elf64_Phdr phdr; int ret; int endian = s->dump_info.d_endian; memset(&phdr, 0, sizeof(Elf64_Phdr)); phdr.p_type = cpu_convert_to_target32(PT_LOAD, endian); phdr.p_offset = cpu_convert_to_target64(offset, endian); phdr.p_paddr = cpu_convert_to_target64(memory_mapping->phys_addr, endian); if (offset == -1) { phdr.p_filesz = 0; } else { phdr.p_filesz = cpu_convert_to_target64(memory_mapping->length, endian); } phdr.p_memsz = cpu_convert_to_target64(memory_mapping->length, endian); phdr.p_vaddr = cpu_convert_to_target64(memory_mapping->virt_addr, endian); ret = fd_write_vmcore(&phdr, sizeof(Elf64_Phdr), s); if (ret < 0) { dump_error(s, "dump: failed to write program header table.\n"); return -1; } return 0; }
1threat
static void fw_cfg_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = fw_cfg_realize; dc->no_user = 1; dc->reset = fw_cfg_reset; dc->vmsd = &vmstate_fw_cfg; dc->props = fw_cfg_properties; }
1threat
"Cannot access static method in non-static context" : I've just recently started my intermediate course in C# programming and I'm learning how to create multiple classes and creating methods to use in my program. It's a very new topic to me so I apologize if it's something very obvious or stupid. I keep getting the message "Cannot access static method in non-static context" in all of my methods. Code in method class: public static int Add(params int[] numbers) { var sum = 0; foreach (var n in numbers) { sum += n; } return sum; } public static int Subtract(params int[] numbers) { var sum = 0; foreach (var n in numbers) { sum -= n; } return sum; } public static int Multiply(params int[] numbers) { var sum = 0; foreach (var n in numbers) { sum *= n; } return sum; } public static int Divide(params int[] numbers) { var sum = 0; foreach (var n in numbers) { sum /= n; } return sum; } public static string[] CheckingOfSomeSort(string userInput, int value, bool isAddition, bool isSubtraction, bool isDivision, bool isMultiplication) { if (userInput.Contains("+")) { var addition = userInput.Split('+'); value = 1; isAddition = true; return addition; } else if (userInput.Contains("-")) { var subtraction = userInput.Split('-'); value = 2; isSubtraction = true; return subtraction; } else if (userInput.Contains("*")) { var multiplication = userInput.Split('*'); value = 3; isMultiplication = true; return multiplication; } else if (userInput.Contains("/")) { var division = userInput.Split('/'); value = 4; isDivision = true; return division; } return null; } I am attempting to create a calculator (which I have already done, however I'm trying to use methods now)
0debug
Can you solve my below Scenario? : I had a little different scenario while I'm work with Excel Work sheet, that is Column A1 contains value like "2 * 3" or "2 x 4", here what is my problem is i have to calculate A value by applying following formula in Column B i.e =(A1), so similarly looks like "=(2 * 3)" or "=(2 x 4)" right. But my case it does not works well. If I'm directly put something like "=(2 * 3)" in column A1, then its works fine i.e my resultant value would be 6. But my scenario it can't be done why, What am wrong with that ? Can anybody understand my scenario, help me pleassseeeee.!!!
0debug
How do I use interface{} as a Struct with json? : ``` var a interface{} a = xxStruct json.Unmarshal(jsonData,&a) ``` The "a" become to be a map, not a struct. For java, I could do it like this: ``` Object obj = new XXObject(); String json = JSON.toJSONString(obj); obj = JSON.parse(json,obj.getClass()) ``` What should I do?
0debug
How to populate a dictionary's value with a list using for loop while? : <p>I wonder how to populate a dictionary's value, for example, having a list with 1000 values or even up to 1000, using for loops while</p> <pre><code>dict = {} values= [1,1,1,1,1,1,1,1,1,1,..,1] dict={'x':[1,1,1,1,1,1,1,1,1,1,..,1]} </code></pre>
0debug
Xcode 11 - Simulator won't respond : <p>Ever since I updated to Xcode 11, the simulator freezes intermittently. Specially when the keyboard is brought to focus. I don't think it has anything to do with memory or any hardware specs of my Mac since it does not crashes, just doesn't respond to any events.</p> <p>The only solution so far is to rebuild again and again the app until the touch on the textfield magically responds again.</p> <p>Has anyone faced the same problem? Any ideias on what might be causing it?</p> <p>Thank you!</p>
0debug
Inheriting Python class methods? : <p>Still don't undertstand Python inheritance, I feel... thanks for tips!</p> <p>I want a subclass's instance to execute the superclass's class method. Tried this:</p> <pre><code>class SuperClass() @classmethod def aClassMethod(cls) pass class SubClass(SuperClass) def aMethod(self) self.__class__.aClassMethod() instance = SubClass() instance.aMethod() </code></pre> <p>But Python tells me that "SubClass" does not have attribute "aClassMethod". Yes, sure, I know, but how can I make the superclass's class method accessible to the subclass instance? </p>
0debug
Cannot create an element in react component dynamically : <p>Im not able to create a React component dynamically. I see blank page with no errors with below code.</p> <p>1) Trying to create an element named "PieChart" </p> <p>2) Below are the Two errors im seeing in console.</p> <pre><code>1. Warning: &lt;PieChart /&gt; is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements. 2. Warning: The tag &lt;PieChart/&gt; is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter. </code></pre> <p>3) Im Already using Pascal case "PieChart"</p> <pre><code>import PieChart from "../component/PieChart"; class App extends Component { render() { const GraphWidget = React.createElement("PieChart"); return ( &lt;div&gt; {GraphWidget} &lt;/div&gt; ) } } export default App; </code></pre>
0debug
How can I sequence LEDs to music using C? : <p>I was just wondering, how could I be able to make a couple leds blink to music from an audio file using C? Is there any specific library in C that could help me? I’m not very experienced when it comes to programming with C.</p>
0debug
void qmp_change_backing_file(const char *device, const char *image_node_name, const char *backing_file, Error **errp) { BlockBackend *blk; BlockDriverState *bs = NULL; AioContext *aio_context; BlockDriverState *image_bs = NULL; Error *local_err = NULL; bool ro; int open_flags; int ret; blk = blk_by_name(device); if (!blk) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", device); return; } aio_context = blk_get_aio_context(blk); aio_context_acquire(aio_context); if (!blk_is_available(blk)) { error_setg(errp, "Device '%s' has no medium", device); goto out; } bs = blk_bs(blk); image_bs = bdrv_lookup_bs(NULL, image_node_name, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; } if (!image_bs) { error_setg(errp, "image file not found"); goto out; } if (bdrv_find_base(image_bs) == image_bs) { error_setg(errp, "not allowing backing file change on an image " "without a backing file"); goto out; } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_CHANGE, errp)) { goto out; } if (!bdrv_chain_contains(bs, image_bs)) { error_setg(errp, "'%s' and image file are not in the same chain", device); goto out; } open_flags = image_bs->open_flags; ro = bdrv_is_read_only(image_bs); if (ro) { bdrv_reopen(image_bs, open_flags | BDRV_O_RDWR, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; } } ret = bdrv_change_backing_file(image_bs, backing_file, image_bs->drv ? image_bs->drv->format_name : ""); if (ret < 0) { error_setg_errno(errp, -ret, "Could not change backing file to '%s'", backing_file); } if (ro) { bdrv_reopen(image_bs, open_flags, &local_err); if (local_err) { error_propagate(errp, local_err); } } out: aio_context_release(aio_context); }
1threat
Why does Math.min([]) evaluate to 0? : <p>Why does <code>Math.min([])</code> evaluate to <code>0</code>?</p> <p>I would expect that it would evaluate to <code>NaN</code> since <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min" rel="noreferrer">MDN's manpage for Math.min</a> states "If at least one of the arguments cannot be converted to a number, NaN is returned."</p> <p>So I guess the refined question is why does [] coerce to 0? Especially considering that <code>[]</code> is truthy (i.e. <code>!![] === true</code>) and <code>Math.min(true) === 1</code>. I am thinking about this wrong?</p> <p>Tested on Node v7.0.0 </p>
0debug
Error:Execution failed for task ':app:preDebugAndroidTestBuild' , when tried to run java program in android studio : <p>Getting the below error at the time of running java program in android studio.</p> <p>Error:Execution failed for task ':<strong>app:preDebugAndroidTestBuild</strong>'.</p> <blockquote> <p>Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See <a href="https://d.android.com/r/tools/test-apk-dependency-conflicts.html" rel="noreferrer">https://d.android.com/r/tools/test-apk-dependency-conflicts.html</a> for details.</p> </blockquote> <p>Any solution please. ?</p>
0debug
static int process_input(int file_index) { InputFile *ifile = input_files[file_index]; AVFormatContext *is; InputStream *ist; AVPacket pkt; int ret, i, j; int64_t duration; int64_t pkt_dts; is = ifile->ctx; ret = get_input_packet(ifile, &pkt); if (ret == AVERROR(EAGAIN)) { ifile->eagain = 1; return ret; } if (ret < 0 && ifile->loop) { if ((ret = seek_to_start(ifile, is)) < 0) return ret; ret = get_input_packet(ifile, &pkt); } if (ret < 0) { if (ret != AVERROR_EOF) { print_error(is->filename, ret); if (exit_on_error) exit_program(1); } for (i = 0; i < ifile->nb_streams; i++) { ist = input_streams[ifile->ist_index + i]; if (ist->decoding_needed) { ret = process_input_packet(ist, NULL, 0); if (ret>0) return 0; } for (j = 0; j < nb_output_streams; j++) { OutputStream *ost = output_streams[j]; if (ost->source_index == ifile->ist_index + i && (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE)) finish_output_stream(ost); } } ifile->eof_reached = 1; return AVERROR(EAGAIN); } reset_eagain(); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= ifile->nb_streams) { report_new_stream(file_index, &pkt); goto discard_packet; } ist = input_streams[ifile->ist_index + pkt.stream_index]; ist->data_size += pkt.size; ist->nb_packets++; if (ist->discard) goto discard_packet; if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) { av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->filename, pkt.stream_index); exit_program(1); } if (debug_ts) { av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s " "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n", ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type), av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q), av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q), av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base), av_ts2str(input_files[ist->file_index]->ts_offset), av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q)); } if(!ist->wrap_correction_done && is->start_time != AV_NOPTS_VALUE && ist->st->pts_wrap_bits < 64){ int64_t stime, stime2; if ( ist->next_dts == AV_NOPTS_VALUE && ifile->ts_offset == -is->start_time && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t new_start_time = INT64_MAX; for (i=0; i<is->nb_streams; i++) { AVStream *st = is->streams[i]; if(st->discard == AVDISCARD_ALL || st->start_time == AV_NOPTS_VALUE) continue; new_start_time = FFMIN(new_start_time, av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q)); } if (new_start_time > is->start_time) { av_log(is, AV_LOG_VERBOSE, "Correcting start time by %"PRId64"\n", new_start_time - is->start_time); ifile->ts_offset = -new_start_time; } } stime = av_rescale_q(is->start_time, AV_TIME_BASE_Q, ist->st->time_base); stime2= stime + (1ULL<<ist->st->pts_wrap_bits); ist->wrap_correction_done = 1; if(stime2 > stime && pkt.dts != AV_NOPTS_VALUE && pkt.dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) { pkt.dts -= 1ULL<<ist->st->pts_wrap_bits; ist->wrap_correction_done = 0; } if(stime2 > stime && pkt.pts != AV_NOPTS_VALUE && pkt.pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) { pkt.pts -= 1ULL<<ist->st->pts_wrap_bits; ist->wrap_correction_done = 0; } } if (ist->nb_packets == 1) { if (ist->st->nb_side_data) av_packet_split_side_data(&pkt); for (i = 0; i < ist->st->nb_side_data; i++) { AVPacketSideData *src_sd = &ist->st->side_data[i]; uint8_t *dst_data; if (av_packet_get_side_data(&pkt, src_sd->type, NULL)) continue; if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX) continue; dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size); if (!dst_data) exit_program(1); memcpy(dst_data, src_sd->data, src_sd->size); } } if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && pkt_dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts && (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) { int64_t delta = pkt_dts - ifile->last_ts; if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE || delta > 1LL*dts_delta_threshold*AV_TIME_BASE){ ifile->ts_offset -= delta; av_log(NULL, AV_LOG_DEBUG, "Inter stream timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, ifile->ts_offset); pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) { pkt.pts += duration; ist->max_pts = FFMAX(pkt.pts, ist->max_pts); ist->min_pts = FFMIN(pkt.pts, ist->min_pts); } if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += duration; pkt_dts = av_rescale_q_rnd(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && pkt_dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE && !copy_ts) { int64_t delta = pkt_dts - ist->next_dts; if (is->iformat->flags & AVFMT_TS_DISCONT) { if (delta < -1LL*dts_delta_threshold*AV_TIME_BASE || delta > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts + AV_TIME_BASE/10 < FFMAX(ist->pts, ist->dts)) { ifile->ts_offset -= delta; av_log(NULL, AV_LOG_DEBUG, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, ifile->ts_offset); pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } else { if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE || delta > 1LL*dts_error_threshold*AV_TIME_BASE) { av_log(NULL, AV_LOG_WARNING, "DTS %"PRId64", next:%"PRId64" st:%d invalid dropping\n", pkt.dts, ist->next_dts, pkt.stream_index); pkt.dts = AV_NOPTS_VALUE; } if (pkt.pts != AV_NOPTS_VALUE){ int64_t pkt_pts = av_rescale_q(pkt.pts, ist->st->time_base, AV_TIME_BASE_Q); delta = pkt_pts - ist->next_dts; if ( delta < -1LL*dts_error_threshold*AV_TIME_BASE || delta > 1LL*dts_error_threshold*AV_TIME_BASE) { av_log(NULL, AV_LOG_WARNING, "PTS %"PRId64", next:%"PRId64" invalid dropping st:%d\n", pkt.pts, ist->next_dts, pkt.stream_index); pkt.pts = AV_NOPTS_VALUE; } } } } if (pkt.dts != AV_NOPTS_VALUE) ifile->last_ts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n", ifile->ist_index + pkt.stream_index, av_get_media_type_string(ist->dec_ctx->codec_type), av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ist->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ist->st->time_base), av_ts2str(input_files[ist->file_index]->ts_offset), av_ts2timestr(input_files[ist->file_index]->ts_offset, &AV_TIME_BASE_Q)); } sub2video_heartbeat(ist, pkt.pts); process_input_packet(ist, &pkt, 0); discard_packet: av_packet_unref(&pkt); return 0; }
1threat
How retrieve list of object from database in my JSP Page Without submitting the form? : <p>Hello Java EE developers;</p> <p>Please I need to have a list of object ( ArrayList ) from database in my JSP when I refresh the page, that mean without submitting the form. In my " myJsp.jsp " I have a select with options are the Id of all Employee in the database.</p> <p>i.e -> I want when The page is opened I want see all Ids of Employee in the option without submitting the form ?</p> <p>I could do it just by submitting the form to the servlet and the servlet return back the response (list of object ) .</p> <p>Please is there a solution for that and how Could I solve it ?</p> <p>Thank you in Advance </p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = preadv(fs->fd, iov, iovcnt, offset); #else ret = lseek(fs->fd, offset, SEEK_SET); if (ret >= 0) { ret = readv(fs->fd, iov, iovcnt); } #endif return ret; }
1threat
i am getting error with the for each loop in php : <?php $messages = get_msg(); foreach ($messages as $message) { echo '<strong>'.$message['sender'].'Sent</strong></br>'; echo $message['message'].'<br/></br>'; } ?> getting this erorr :( Warning: Invalid argument supplied for foreach() in C:\xamp\htdocs\chatbox\index.php
0debug
C priting number 2^31-1 or -2^31+1 : I have to submit this code , the intention is to count the digits of a number and print it(range can be 2^31-1 or -2^31+1) and the result ust be present as a single number (ex number 234 is printed 3) #include <stdio.h> #include <stdlib.h> int main() { long int num_ins; int contador = 0; printf("Inserir numero desejado a avaliar?\n"); // asking the number scanf("%lu", &num_ins); if (num_ins == 0){ printf("%d", 1); } else{ while(num_ins!=0){ num_ins = num_ins/10; contador++; } printf("%d", contador); //contador is count } } But the submission keep giving me an error, that there are some number who isn't right, and i can't figure it
0debug
PHP Convert dinamic variable array to tree array : I have an array like: array( 0 => array("a", "b", "c", ... n), 1 => array("a", "b", "d", ... n), 2 => array("e", "b", "c", ... n), . n ); With n lenght right and down. I want an tree array like: a { b { c {null} d {null} } } e { b { c {null} } } Extactly, something like: http://stackoverflow.com/questions/3663096/how-to-convert-array-to-tree but in PHP code and for 'n' lenght array
0debug
void FUNCC(ff_h264_luma_dc_dequant_idct)(int16_t *_output, int16_t *_input, int qmul){ #define stride 16 int i; int temp[16]; static const uint8_t x_offset[4]={0, 2*stride, 8*stride, 10*stride}; dctcoef *input = (dctcoef*)_input; dctcoef *output = (dctcoef*)_output; for(i=0; i<4; i++){ const int z0= input[4*i+0] + input[4*i+1]; const int z1= input[4*i+0] - input[4*i+1]; const int z2= input[4*i+2] - input[4*i+3]; const int z3= input[4*i+2] + input[4*i+3]; temp[4*i+0]= z0+z3; temp[4*i+1]= z0-z3; temp[4*i+2]= z1-z2; temp[4*i+3]= z1+z2; } for(i=0; i<4; i++){ const int offset= x_offset[i]; const int z0= temp[4*0+i] + temp[4*2+i]; const int z1= temp[4*0+i] - temp[4*2+i]; const int z2= temp[4*1+i] - temp[4*3+i]; const int z3= temp[4*1+i] + temp[4*3+i]; output[stride* 0+offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); output[stride* 1+offset]= ((((z1 + z2)*qmul + 128 ) >> 8)); output[stride* 4+offset]= ((((z1 - z2)*qmul + 128 ) >> 8)); output[stride* 5+offset]= ((((z0 - z3)*qmul + 128 ) >> 8)); } #undef stride }
1threat
Typescript loader throws multiple 'Duplicate identifier ..' error when compiling : <p>I moved a project from my workstation to my home pc today and now I can't compile it anymore.</p> <p>Whenever I'm running 'webpack', I'm getting the following errors:</p> <pre><code>TS2300: Duplicate identifier 'Request'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9360:13 TS2300: Duplicate identifier 'Request'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9365:11 TS2300: Duplicate identifier 'Response'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9376:13 TS2300: Duplicate identifier 'Response'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14893:18 TS2451: Cannot redeclare block-scoped variable 'fetch'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14898:6 TS2300: Duplicate identifier 'BodyInit'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14919:6 TS2300: Duplicate identifier 'HeadersInit'. ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14929:6 TS2300: Duplicate identifier 'RequestInfo'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:11:13 TS2451: Cannot redeclare block-scoped variable 'fetch'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:13:14 TS2300: Duplicate identifier 'HeadersInit'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:14:15 TS2300: Duplicate identifier 'Headers'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:31:14 TS2300: Duplicate identifier 'BodyInit'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:43:14 TS2300: Duplicate identifier 'RequestInfo'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:44:15 TS2300: Duplicate identifier 'Request'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:64:11 TS2300: Duplicate identifier 'Request'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:70:5 TS2403: Subsequent variable declarations must have the same type. Variable 'referrerPolicy' must be of type 'string', but here has type 'ReferrerPolicy'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:71:5 TS2403: Subsequent variable declarations must have the same type. Variable 'mode' must be of type 'string', but here has type 'RequestMode'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:72:5 TS2403: Subsequent variable declarations must have the same type. Variable 'credentials' must be of type 'string', but here has type 'RequestCredentials'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:73:5 TS2403: Subsequent variable declarations must have the same type. Variable 'cache' must be of type 'string', but here has type 'RequestCache'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:74:5 TS2403: Subsequent variable declarations must have the same type. Variable 'redirect' must be of type 'string', but here has type 'RequestRedirect'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:76:5 TS2403: Subsequent variable declarations must have the same type. Variable 'window' must be of type 'any', but here has type 'null'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:88:15 TS2300: Duplicate identifier 'Response'. ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:107:11 TS2300: Duplicate identifier 'Response'. ERROR in [at-loader] node_modules\@types\whatwg-streams\index.d.ts:32:15 TS2300: Duplicate identifier 'ReadableStream'. </code></pre> <p>I've removed and re-installed all node_modules (and types), tried installing Typescript locally and globally and switched from ts-loader to awesome-typescript-loader (which at least solved some other errors I had).</p> <p><strong>tsconfig.json</strong></p> <pre><code>{ "compilerOptions": { "baseUrl": "app", "moduleResolution": "node", "module": "commonjs", "target": "es6", "jsx": "preserve", "noImplicitAny": false, "sourceMap": true, "lib": [ "es6", "dom" ], "emitDecoratorMetadata": true, "experimentalDecorators": true }, "exclude": [ "node_modules" ] } </code></pre> <p><strong>webpack.config.js</strong></p> <pre><code>var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); const { CheckerPlugin } = require('awesome-typescript-loader') var TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin; module.exports = { entry: { 'vendor': [ 'react', 'react-dom', 'react-router', 'react-bootstrap', 'react-router-bootstrap', 'react-datetime' ], 'client': [ 'webpack-dev-server/client?http://0.0.0.0:8080', // WebpackDevServer host and port 'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors './app/boot-client.tsx' ], }, output: { filename: '[name].bundle.js', path: './app/', }, resolve: { plugins: [ new TsConfigPathsPlugin('./tsconfig.json') ], extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss'] }, module: { loaders: [ { test: /\.tsx?$/, include: /app/, loaders: 'babel-loader', query: { presets: ['es2015'] } }, { test: /\.tsx?$/, include: /app/, loaders: 'awesome-typescript-loader' }, { test: /\.scss$/, loaders: ['style-loader', 'css-loader', 'sass-loader'] } ] }, plugins: [ new webpack.optimize.CommonsChunkPlugin('vendor'), new HtmlWebpackPlugin({ inject: 'body', template: 'app/index_template.html', filename: 'index.html' }), new webpack.HotModuleReplacementPlugin(), new CheckerPlugin() ], devServer: { contentBase: "./app", port: 8080 }, }; </code></pre> <p>Unfortunately I'm not very experienced in this area, so what am I missing here?</p>
0debug
static void create_gic(const VirtBoardInfo *vbi, qemu_irq *pic) { DeviceState *gicdev; SysBusDevice *gicbusdev; const char *gictype = "arm_gic"; int i; if (kvm_irqchip_in_kernel()) { gictype = "kvm-arm-gic"; } gicdev = qdev_create(NULL, gictype); qdev_prop_set_uint32(gicdev, "revision", 2); qdev_prop_set_uint32(gicdev, "num-cpu", smp_cpus); qdev_prop_set_uint32(gicdev, "num-irq", NUM_IRQS + 32); qdev_init_nofail(gicdev); gicbusdev = SYS_BUS_DEVICE(gicdev); sysbus_mmio_map(gicbusdev, 0, vbi->memmap[VIRT_GIC_DIST].base); sysbus_mmio_map(gicbusdev, 1, vbi->memmap[VIRT_GIC_CPU].base); for (i = 0; i < smp_cpus; i++) { DeviceState *cpudev = DEVICE(qemu_get_cpu(i)); int ppibase = NUM_IRQS + i * 32; qdev_connect_gpio_out(cpudev, 0, qdev_get_gpio_in(gicdev, ppibase + 30)); qdev_connect_gpio_out(cpudev, 1, qdev_get_gpio_in(gicdev, ppibase + 27)); sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); } for (i = 0; i < NUM_IRQS; i++) { pic[i] = qdev_get_gpio_in(gicdev, i); } fdt_add_gic_node(vbi); }
1threat
Filtering Array of JSON objects : <p>I am attempting to filter an array of JSON objects. I am new to JavaScript and trying to do it in coding languages that I used to. Basically, I want to take the following array of objects.</p> <pre><code> var result = [ { date : '2016-11-21', name: 'Bob', score: 0.1034947 }, { date : '2016-10-21', name: 'Bill', score: 0.2081911}, { date : '2016-10-21', name: 'Mary', score: 0.234947 }, { date : '2016-10-21', name: 'Bob', score: 0.1034947 }, { date : '2016-11-21', name: 'Bill', score: 0.2081911}, { date : '2016-11-21', name: 'Mary', score: 0.234947 }, { date : '2016-12-21', name: 'Bob', score: 0.1034947 }, { date : '2016-12-21', name: 'Bill', score: 0.2081911}, { date : '2016-12-21', name: 'Mary', score: 0.234947 } ] </code></pre> <p>I then want to filter based on objects. So for example.</p> <pre><code>var selected_Names = ['Bob','Mary'] </code></pre> <p>I want to return Bob and Mary's information only in this scenario.</p> <pre><code> [ { date : '2016-11-21', name: 'Bob', score: 0.1034947 }, { date : '2016-10-21', name: 'Mary', score: 0.234947 }, { date : '2016-10-21', name: 'Bob', score: 0.1034947 }, { date : '2016-11-21', name: 'Mary', score: 0.234947 }, { date : '2016-12-21', name: 'Bob', score: 0.1034947 }, { date : '2016-12-21', name: 'Mary', score: 0.234947 } ] </code></pre> <p>Thanks!</p>
0debug
Can't install urllib2 for python 2.7 : <p>I try to install module urllib2 for python 2.7 (I as usual use command pip install), but have an error</p> <p>No matching distribution found for urllib2.. </p> <p>What should I do? </p>
0debug
How to take screenshots of a web page and make a video of them using coding(any language)? : <p>I have a table on my web-page with thousands of entries and it shows 20 entries at a time. I want to take screenshots of all the entries page by page and then create a video of them using code. What would be the best language and method to do this task? I know nothing of this thing so I am open to any language like python, Java, Go, etc.</p>
0debug
file not found exception even there is a image in that location : <p>i am reading a image from a server using <strong>java (spring mvc)</strong> following code</p> <pre><code>if(imagePath != null &amp;&amp; imagePath.length() &gt; 0 ) { byte fileContent[] = new byte[3000]; try (FileInputStream fin = new FileInputStream(new File(imagePath))) {// here is the Exception while(fin.read(fileContent) &gt;= 0) { // Base64.encodeBase64(fileContent); } } } </code></pre> <p><strong>path</strong> </p> <pre><code>/var/sentora/hostdata/campusguru/public_html/resources/images/bharath.png </code></pre> <p>there is image in that location but im getting following exception</p> <pre><code>java.io.FileNotFoundException: \var\sentora\hostdata\campusguru\public_html\resources\images\bharath.png (The system cannot find the path specified) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at com.rasvek.cms.controller.StudentController.getStudentAdmissionByAdmissionId(StudentController.java:696) at com.rasvek.cms.controller.StudentController$$FastClassBySpringCGLIB$$cb2af793.invoke(&lt;generated&gt;) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at com.rasvek.cms.controller.StudentController$$EnhancerBySpringCGLIB$$bbc517cf.getStudentAdmissionByAdmissionId(&lt;generated&gt;) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) </code></pre> <p>if the path is on windows i am getting any exception (in local system )</p> <p>but on the network server which is <strong>linux</strong> i am geeting file not found exception.</p> <p>please help me ,thank you .</p>
0debug