problem
stringlengths
26
131k
labels
class label
2 classes
es6 modules with node : My package json is configured ok to import es6 modules using babel: "scripts": { "start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2", "build": "babel src -d dist", "serve": "node dist/index.js" }, This is my index file: import test from './test' console.log(test) console.log(test()) test file: let test = () => console.log('test'); export default When I run the code, I got: [Function: test] test undefined Where does the undefined come from?
0debug
How is applied croston method to the dataset : I have dataset which shows monthly demands for 250 products. I want to apply croston method this dataset and write the results on file but i don't know how i can apply formula row by row and transfer to the file.
0debug
What is this identifier in my ubuntu terminal? : <p>I recently got my office machine whith Ubuntu 16.04 and created a new account on it since my machine belonged to a previous employee. My machine has Terminator as default terminal emulator. However, in the account of the previous employee, his terminator and terminal both have a fancy identifier of sorts which can tell you the branch you're on git. </p> <p>What is this? How can i install it on my Terminator? (the blue and yellow arrow)</p> <p>Here's how it looks on Terminator</p> <p><a href="https://i.stack.imgur.com/dT5LF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dT5LF.png" alt="Terminator"></a></p> <p>Here's how it look on Terminal</p> <p><a href="https://i.stack.imgur.com/Q5Hcc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q5Hcc.png" alt="Terminal"></a></p>
0debug
How to read from stdin int using c++ skipping "," and "Space" till "\n" : <p>I want to read integers from STDIN, 1,2,3,4</p> <pre><code>vector&lt;int&gt; r; cin &gt;&gt; is; stringstream iss(is); int n; while(iss &gt;&gt; n) { r.push_back(n); } </code></pre> <p>but stops reading after "," is there a way other than splitting and directly read Integers only.</p>
0debug
how to sum the value of hashes in array with condition : I have a array of hashes like `records = [{"number"=>5000, "status"=>true}, {"number"=>5000, "status"=>true},{"number"=>5000, "status"=>false}]` I want to sum the value of number which status is true.
0debug
Encryption in URL : <p>I have an URL. My URL type: "<a href="http://myweb.com/id=W5OAGejZ1HpuHri7BB1c%2BXHSYs2c47eyJFhpmroalPXZ5SUIgeUbqu7hJUVFVwPOA0xRI3ILJVHQ5QgBwtWpE1x0%2Fq10VVrmduMU5PiYguW1cXog4azzDvjcbb3%2BVpMDKe5QmvjLgJ9M4TXosTYR%2FOVzIPvXD%2BjeTEFtIM2g6siUcPBOeK5ubQh1QYB%2FCSbgnFsh2mpx3r%2FXBXI09I4q%2Be7hDSITcyIeYzFf1LoovBKotYcYSxhrZkbtIz2utl8PbpGa5G49EAwcKyossEo21dumTfkfJFoXUfmhH7amGcqbKUBOvtmhRwaMqrqoR6Vjd%2FKBCLrszpCRXX%2FdY6Kg0A7AUUNWdedizKCiDYdYL1IMUZ12od7HZNuHCruWPe43uhoxhjyhzx9oFl4rf6f8aM58b6KDtgiBbDwZNiICltUHq6htdzq2KwPRz8tl0WvZaaV3UC7vkfzfH%2FsRrv%2BB8MlsPrW6YfDOwupf0ax%2BJjc8oy%2BD%2BXv53swU5%2BS0dKQv94sgPNoQKG05oi4%2BO7M4gcw5Otp7O6qDFv5yhYnywJD8F6CXWUmHU9WoFRGoQnwdDwoMySYsiM4jCT9aq4s08%2Bx2m8EngPHr36aN7xJbc1yVgJUJjmCea5xCl4Hp6X3h%2BJMvUm25jbzi9ZXOFHHsp2lboLgXY1cM0b%2F1azWMaEgWLEXXbhIL36fC%2FQCQTk%2FvNnFZJLeye2LVbxBWVpyKxvC9ire1lxm0OrugnhhJle0lDFpl5O1cJwwORx2eUqwdmAJvWqh6SxBPyoxISKoIO6t4gRN%2BWMCHrwylBTsLvVKqwHdv2ulv88a3HHpOvTWuDlUb%2B0ADjnhAZ2jnVadSgX3r%2FQTaWVswD4rfRTPqdzmmHmIdC%2B%2BmOiUuMRL9qDXei4kxfeyODgkVJ4P9yEplsB2HfVM9cHU1ks4oq8bXIRb9j%2FqE%2FRsEFuQs%2FfQvBZXjEQK%2FnUiIHJ%2BZQcVTEPgsBPcewNjH85vc61WKd%2B3R6mbFuY4%2BJUdIt%2BaUjRohUP8P7R4Bh5WWA%2F%2B2odAn1fT5Xkn07XCWmoE5MBBTyFRXQBU6HImYDJ2Gk95xVn65jGrs5XbsKUjYEis1MQe4N59RjA%3D%3D" rel="nofollow">http://myweb.com/id=W5OAGejZ1HpuHri7BB1c%2BXHSYs2c47eyJFhpmroalPXZ5SUIgeUbqu7hJUVFVwPOA0xRI3ILJVHQ5QgBwtWpE1x0%2Fq10VVrmduMU5PiYguW1cXog4azzDvjcbb3%2BVpMDKe5QmvjLgJ9M4TXosTYR%2FOVzIPvXD%2BjeTEFtIM2g6siUcPBOeK5ubQh1QYB%2FCSbgnFsh2mpx3r%2FXBXI09I4q%2Be7hDSITcyIeYzFf1LoovBKotYcYSxhrZkbtIz2utl8PbpGa5G49EAwcKyossEo21dumTfkfJFoXUfmhH7amGcqbKUBOvtmhRwaMqrqoR6Vjd%2FKBCLrszpCRXX%2FdY6Kg0A7AUUNWdedizKCiDYdYL1IMUZ12od7HZNuHCruWPe43uhoxhjyhzx9oFl4rf6f8aM58b6KDtgiBbDwZNiICltUHq6htdzq2KwPRz8tl0WvZaaV3UC7vkfzfH%2FsRrv%2BB8MlsPrW6YfDOwupf0ax%2BJjc8oy%2BD%2BXv53swU5%2BS0dKQv94sgPNoQKG05oi4%2BO7M4gcw5Otp7O6qDFv5yhYnywJD8F6CXWUmHU9WoFRGoQnwdDwoMySYsiM4jCT9aq4s08%2Bx2m8EngPHr36aN7xJbc1yVgJUJjmCea5xCl4Hp6X3h%2BJMvUm25jbzi9ZXOFHHsp2lboLgXY1cM0b%2F1azWMaEgWLEXXbhIL36fC%2FQCQTk%2FvNnFZJLeye2LVbxBWVpyKxvC9ire1lxm0OrugnhhJle0lDFpl5O1cJwwORx2eUqwdmAJvWqh6SxBPyoxISKoIO6t4gRN%2BWMCHrwylBTsLvVKqwHdv2ulv88a3HHpOvTWuDlUb%2B0ADjnhAZ2jnVadSgX3r%2FQTaWVswD4rfRTPqdzmmHmIdC%2B%2BmOiUuMRL9qDXei4kxfeyODgkVJ4P9yEplsB2HfVM9cHU1ks4oq8bXIRb9j%2FqE%2FRsEFuQs%2FfQvBZXjEQK%2FnUiIHJ%2BZQcVTEPgsBPcewNjH85vc61WKd%2B3R6mbFuY4%2BJUdIt%2BaUjRohUP8P7R4Bh5WWA%2F%2B2odAn1fT5Xkn07XCWmoE5MBBTyFRXQBU6HImYDJ2Gk95xVn65jGrs5XbsKUjYEis1MQe4N59RjA%3D%3D</a>"</p> <p>I want to need decode the line behind the id "W5OAGejZ1HpuHri7BB.....9RjA%3D%3D". I think it encryption base 64. But when I decode it, it not true. If you know about it, please tell me more info it. Thank you..</p>
0debug
Everything is wrong placed in Android Studio, while running it : <p>If I try to run a normal quiz application from Android Studio everything like buttons are placed in one corner. Does anybody knows how to solve that problem.</p>
0debug
javascript access property of just creating object : <p>I would like to initialize property of object using another property of the same object which is just created using object literal:</p> <pre><code>var result = { a : 1, b : a }; </code></pre> <p>The result should be</p> <pre><code>{ a:1, b:1 } </code></pre> <p>Is there any way to do this without first creating object? Using some kind of this?</p>
0debug
How to fill a C++ container using a (lambda) function? : <p>I want to initialize a container with pointers to objects. I currently have a loop like this:</p> <pre><code>for(int i=0;i &lt; n;i++) { container.push_back(new Object()); } </code></pre> <p>Which C++ operation (i.e. similar to <code>std::transform</code>) is the right to replace this loop and initialize a container with <code>n</code> newly created objects?</p>
0debug
static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; old_mask = cpu->interrupt_request; cpu->interrupt_request |= mask; if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); return; } if (use_icount) { cpu->icount_decr.u16.high = 0xffff; if (!cpu->can_do_io && (mask & ~old_mask) != 0) { cpu_abort(cpu, "Raised interrupt while not in I/O function"); } } else { cpu->tcg_exit_req = 1; } }
1threat
`tiny_malloc_from_free_list` made my pointer `NULL`? : <p>I am working on code that includes <code>bllipparser</code> Python module, among other things. Feeding it the same dataset, it will intermittently crash (maybe once in three to ten runs). Going through <code>lldb</code>, I found that the public field <code>weights</code> of <code>RerankerModel</code> (<a href="https://github.com/BLLIP/bllip-parser/blob/f34db61f5414fe780cc7ff36d6af7a6692a513c6/second-stage/programs/features/simple-api.cc#L60" rel="noreferrer">source</a>), that is apparently only set once (in the constructor), randomly becomes <code>NULL</code> (I only have one <code>RerankerModel</code> for the duration of my run, so there should be exactly one <code>weights</code>, that persists unchanged throughout). So I set up an ambush (I mean, a watchpoint: I stopped the code in the constructor and <code>watchpoint set expression -w write -- &amp;weights</code>), and apparently the culprit that nulls the pointer is <code>tiny_malloc_from_free_list</code> from <code>libsystem_malloc.dylib</code>. Here's the relevant top of the backtrace:</p> <pre><code>* thread #1, queue = 'com.apple.main-thread', stop reason = watchpoint 4 * frame #0: 0x00007fff61caf22a libsystem_malloc.dylib`tiny_malloc_from_free_list + 151 frame #1: 0x00007fff61cae3bf libsystem_malloc.dylib`szone_malloc_should_clear + 422 frame #2: 0x00007fff61cae1bd libsystem_malloc.dylib`malloc_zone_malloc + 103 frame #3: 0x00007fff61cad4c7 libsystem_malloc.dylib`malloc + 24 frame #4: 0x00007fff5faac628 libc++abi.dylib`operator new(unsigned long) + 40 frame #5: 0x00000001133c904c _CharniakParser.cpython-36m-darwin.so`std::__1::__split_buffer&lt;short, std::__1::allocator&lt;short&gt;&amp;&gt;::__split_buffer(unsigned long, unsigned long, std::__1::allocator&lt;short&gt;&amp;) [inlined] std::__1::__allocate(__size=4) at new:226 frame #6: 0x00000001133c9040 _CharniakParser.cpython-36m-darwin.so`std::__1::__split_buffer&lt;short, std::__1::allocator&lt;short&gt;&amp;&gt;::__split_buffer(unsigned long, unsigned long, std::__1::allocator&lt;short&gt;&amp;) [inlined] std::__1::allocator&lt;short&gt;::allocate(this=0x0000000135316448, __n=2, (null)=0x0000000000000000) at memory:1747 frame #7: 0x00000001133c8f44 _CharniakParser.cpython-36m-darwin.so`std::__1::__split_buffer&lt;short, std::__1::allocator&lt;short&gt;&amp;&gt;::__split_buffer(unsigned long, unsigned long, std::__1::allocator&lt;short&gt;&amp;) [inlined] std::__1::allocator_traits&lt;std::__1::allocator&lt;short&gt; &gt;::allocate(__a=0x0000000135316448, __n=2) at memory:1502 frame #8: 0x00000001133c8f16 _CharniakParser.cpython-36m-darwin.so`std::__1::__split_buffer&lt;short, std::__1::allocator&lt;short&gt;&amp;&gt;::__split_buffer(this=0x00007ffeefbf3b48, __cap=2, __start=1, __a=0x0000000135316448) at __split_buffer:311 frame #9: 0x00000001133c878d _CharniakParser.cpython-36m-darwin.so`std::__1::__split_buffer&lt;short, std::__1::allocator&lt;short&gt;&amp;&gt;::__split_buffer(this=0x00007ffeefbf3b48, __cap=2, __start=1, __a=0x0000000135316448) at __split_buffer:310 frame #10: 0x00000001133c869b _CharniakParser.cpython-36m-darwin.so`void std::__1::vector&lt;short, std::__1::allocator&lt;short&gt; &gt;::__push_back_slow_path&lt;short const&gt;(this=0x0000000135316438 size=1, __x=0x00007ffeefbf3caa) at vector:1567 frame #11: 0x00000001133c4446 _CharniakParser.cpython-36m-darwin.so`Val::extendTrees(Bst&amp;, int) [inlined] std::__1::vector&lt;short, std::__1::allocator&lt;short&gt; &gt;::push_back(this=0x0000000135316438 size=1, __x=0x00007ffeefbf3caa) at vector:1588 </code></pre> <p>I am very much not an expert on C++, but... How is the allocator NULLing the pointer? How does the allocator even know where the pointer is? <em>Why</em> is the allocator NULLing the pointer? I mean, I can see how I might run out of memory, what I was doing wasn't exactly memory-light, but I'd much sooner expect allocator to fail to allocate than to randomly deallocate something - and I had no idea it could NULL a pointer. Can anyone explain to me exactly how this works, why it happened, how it happened, why is it always the same pointer in a code that has lots and lots of other juicy pointers, and what I can do to make it not happen?</p> <p>Addendum if needed: Here's where the actual NULLing takes place, the code of <code>tiny_malloc_from_free_list</code>, if anyone can make sense of it...</p> <pre><code>libsystem_malloc.dylib`tiny_malloc_from_free_list: 0x7fff61caf193 &lt;+0&gt;: pushq %rbp 0x7fff61caf194 &lt;+1&gt;: movq %rsp, %rbp 0x7fff61caf197 &lt;+4&gt;: pushq %r15 0x7fff61caf199 &lt;+6&gt;: pushq %r14 0x7fff61caf19b &lt;+8&gt;: pushq %r13 0x7fff61caf19d &lt;+10&gt;: pushq %r12 0x7fff61caf19f &lt;+12&gt;: pushq %rbx 0x7fff61caf1a0 &lt;+13&gt;: pushq %rax 0x7fff61caf1a1 &lt;+14&gt;: movl %edx, %r15d 0x7fff61caf1a4 &lt;+17&gt;: movq %rsi, %r14 0x7fff61caf1a7 &lt;+20&gt;: movq %rdi, %r12 0x7fff61caf1aa &lt;+23&gt;: leal -0x1(%r15), %ecx 0x7fff61caf1ae &lt;+27&gt;: movq 0x18(%r14,%rcx,8), %r13 0x7fff61caf1b3 &lt;+32&gt;: testq %r13, %r13 0x7fff61caf1b6 &lt;+35&gt;: je 0x7fff61caf22f ; &lt;+156&gt; 0x7fff61caf1b8 &lt;+37&gt;: movq 0x8(%r13), %rdx 0x7fff61caf1bc &lt;+41&gt;: movq %rdx, %rax 0x7fff61caf1bf &lt;+44&gt;: shlq $0x4, %rax 0x7fff61caf1c3 &lt;+48&gt;: shrq $0x3c, %rdx 0x7fff61caf1c7 &lt;+52&gt;: movq 0x278(%r12), %rsi 0x7fff61caf1cf &lt;+60&gt;: xorq %rax, %rsi 0x7fff61caf1d2 &lt;+63&gt;: movq %rsi, %rdi 0x7fff61caf1d5 &lt;+66&gt;: shrq $0x8, %rdi 0x7fff61caf1d9 &lt;+70&gt;: addl %esi, %edi 0x7fff61caf1db &lt;+72&gt;: movq %rsi, %rbx 0x7fff61caf1de &lt;+75&gt;: shrq $0x10, %rbx 0x7fff61caf1e2 &lt;+79&gt;: addl %edi, %ebx 0x7fff61caf1e4 &lt;+81&gt;: movq %rsi, %rdi 0x7fff61caf1e7 &lt;+84&gt;: shrq $0x18, %rdi 0x7fff61caf1eb &lt;+88&gt;: addl %ebx, %edi 0x7fff61caf1ed &lt;+90&gt;: movq %rsi, %rbx 0x7fff61caf1f0 &lt;+93&gt;: shrq $0x20, %rbx 0x7fff61caf1f4 &lt;+97&gt;: addl %edi, %ebx 0x7fff61caf1f6 &lt;+99&gt;: movq %rsi, %rdi 0x7fff61caf1f9 &lt;+102&gt;: shrq $0x28, %rdi 0x7fff61caf1fd &lt;+106&gt;: addl %ebx, %edi 0x7fff61caf1ff &lt;+108&gt;: movq %rsi, %rbx 0x7fff61caf202 &lt;+111&gt;: shrq $0x30, %rbx 0x7fff61caf206 &lt;+115&gt;: addl %edi, %ebx 0x7fff61caf208 &lt;+117&gt;: shrq $0x38, %rsi 0x7fff61caf20c &lt;+121&gt;: addl %ebx, %esi 0x7fff61caf20e &lt;+123&gt;: andl $0xf, %esi 0x7fff61caf211 &lt;+126&gt;: cmpq %rsi, %rdx 0x7fff61caf214 &lt;+129&gt;: jne 0x7fff61caf602 ; &lt;+1135&gt; 0x7fff61caf21a &lt;+135&gt;: testq %rax, %rax 0x7fff61caf21d &lt;+138&gt;: je 0x7fff61caf2de ; &lt;+331&gt; 0x7fff61caf223 &lt;+144&gt;: movq (%r13), %rdx 0x7fff61caf227 &lt;+148&gt;: movq %rdx, (%rax) -&gt; 0x7fff61caf22a &lt;+151&gt;: jmp 0x7fff61caf2f2 ; &lt;+351&gt; 0x7fff61caf22f &lt;+156&gt;: movq $-0x1, %rax 0x7fff61caf236 &lt;+163&gt;: shlq %cl, %rax 0x7fff61caf239 &lt;+166&gt;: andq 0x818(%r14), %rax 0x7fff61caf240 &lt;+173&gt;: je 0x7fff61caf4f9 ; &lt;+870&gt; 0x7fff61caf246 &lt;+179&gt;: bsfq %rax, %rcx 0x7fff61caf24a &lt;+183&gt;: cmpq $0x3f, %rcx 0x7fff61caf24e &lt;+187&gt;: je 0x7fff61caf39d ; &lt;+522&gt; 0x7fff61caf254 &lt;+193&gt;: movq 0x18(%r14,%rcx,8), %r13 0x7fff61caf259 &lt;+198&gt;: testq %r13, %r13 0x7fff61caf25c &lt;+201&gt;: je 0x7fff61caf39d ; &lt;+522&gt; 0x7fff61caf262 &lt;+207&gt;: movq 0x8(%r13), %rdx 0x7fff61caf266 &lt;+211&gt;: movq %rdx, %rax 0x7fff61caf269 &lt;+214&gt;: shlq $0x4, %rax 0x7fff61caf26d &lt;+218&gt;: shrq $0x3c, %rdx 0x7fff61caf271 &lt;+222&gt;: movq 0x278(%r12), %rsi 0x7fff61caf279 &lt;+230&gt;: xorq %rax, %rsi 0x7fff61caf27c &lt;+233&gt;: movq %rsi, %rdi 0x7fff61caf27f &lt;+236&gt;: shrq $0x8, %rdi 0x7fff61caf283 &lt;+240&gt;: addl %esi, %edi 0x7fff61caf285 &lt;+242&gt;: movq %rsi, %rbx 0x7fff61caf288 &lt;+245&gt;: shrq $0x10, %rbx 0x7fff61caf28c &lt;+249&gt;: addl %edi, %ebx 0x7fff61caf28e &lt;+251&gt;: movq %rsi, %rdi 0x7fff61caf291 &lt;+254&gt;: shrq $0x18, %rdi 0x7fff61caf295 &lt;+258&gt;: addl %ebx, %edi 0x7fff61caf297 &lt;+260&gt;: movq %rsi, %rbx 0x7fff61caf29a &lt;+263&gt;: shrq $0x20, %rbx 0x7fff61caf29e &lt;+267&gt;: addl %edi, %ebx 0x7fff61caf2a0 &lt;+269&gt;: movq %rsi, %rdi 0x7fff61caf2a3 &lt;+272&gt;: shrq $0x28, %rdi 0x7fff61caf2a7 &lt;+276&gt;: addl %ebx, %edi 0x7fff61caf2a9 &lt;+278&gt;: movq %rsi, %rbx 0x7fff61caf2ac &lt;+281&gt;: shrq $0x30, %rbx 0x7fff61caf2b0 &lt;+285&gt;: addl %edi, %ebx 0x7fff61caf2b2 &lt;+287&gt;: shrq $0x38, %rsi 0x7fff61caf2b6 &lt;+291&gt;: addl %ebx, %esi 0x7fff61caf2b8 &lt;+293&gt;: andl $0xf, %esi 0x7fff61caf2bb &lt;+296&gt;: cmpq %rsi, %rdx 0x7fff61caf2be &lt;+299&gt;: jne 0x7fff61caf602 ; &lt;+1135&gt; 0x7fff61caf2c4 &lt;+305&gt;: movq %rax, 0x18(%r14,%rcx,8) 0x7fff61caf2c9 &lt;+310&gt;: testq %rax, %rax 0x7fff61caf2cc &lt;+313&gt;: je 0x7fff61caf59f ; &lt;+1036&gt; 0x7fff61caf2d2 &lt;+319&gt;: movq (%r13), %rcx 0x7fff61caf2d6 &lt;+323&gt;: movq %rcx, (%rax) 0x7fff61caf2d9 &lt;+326&gt;: jmp 0x7fff61caf5b2 ; &lt;+1055&gt; 0x7fff61caf2de &lt;+331&gt;: movl $0xfffffffe, %edx ; imm = 0xFFFFFFFE 0x7fff61caf2e3 &lt;+336&gt;: roll %cl, %edx 0x7fff61caf2e5 &lt;+338&gt;: movl %ecx, %esi 0x7fff61caf2e7 &lt;+340&gt;: shrl $0x5, %esi 0x7fff61caf2ea &lt;+343&gt;: andl %edx, 0x818(%r14,%rsi,4) 0x7fff61caf2f2 &lt;+351&gt;: movq %rax, 0x18(%r14,%rcx,8) 0x7fff61caf2f7 &lt;+356&gt;: incl 0x850(%r14) 0x7fff61caf2fe &lt;+363&gt;: movzwl %r15w, %esi 0x7fff61caf302 &lt;+367&gt;: movl %esi, %ecx 0x7fff61caf304 &lt;+369&gt;: shll $0x4, %ecx 0x7fff61caf307 &lt;+372&gt;: addq %rcx, 0x858(%r14) 0x7fff61caf30e &lt;+379&gt;: movq %r13, %rax 0x7fff61caf311 &lt;+382&gt;: andq $-0x100000, %rax ; imm = 0xFFF00000 0x7fff61caf317 &lt;+388&gt;: addl 0xfc098(%rax), %ecx 0x7fff61caf31d &lt;+394&gt;: movl %ecx, 0xfc098(%rax) 0x7fff61caf323 &lt;+400&gt;: cmpl $0xbd060, %ecx ; imm = 0xBD060 0x7fff61caf329 &lt;+406&gt;: jb 0x7fff61caf335 ; &lt;+418&gt; 0x7fff61caf32b &lt;+408&gt;: movl $0x0, 0xfc090(%rax) 0x7fff61caf335 &lt;+418&gt;: cmpl $0x2, %esi 0x7fff61caf338 &lt;+421&gt;: jb 0x7fff61caf344 ; &lt;+433&gt; 0x7fff61caf33a &lt;+423&gt;: movq %r13, %rdi 0x7fff61caf33d &lt;+426&gt;: callq 0x7fff61cc5eaa ; set_tiny_meta_header_in_use 0x7fff61caf342 &lt;+431&gt;: jmp 0x7fff61caf38b ; &lt;+504&gt; 0x7fff61caf344 &lt;+433&gt;: movq %r13, %rcx 0x7fff61caf347 &lt;+436&gt;: shrq $0x4, %rcx 0x7fff61caf34b &lt;+440&gt;: movl %r13d, %edx 0x7fff61caf34e &lt;+443&gt;: shrl $0x8, %edx 0x7fff61caf351 &lt;+446&gt;: andl $0xffe, %edx ; imm = 0xFFE 0x7fff61caf357 &lt;+452&gt;: movl $0x1, %esi 0x7fff61caf35c &lt;+457&gt;: movl $0x1, %edi 0x7fff61caf361 &lt;+462&gt;: shll %cl, %edi 0x7fff61caf363 &lt;+464&gt;: orl %edi, 0xfc0a0(%rax,%rdx,4) 0x7fff61caf36a &lt;+471&gt;: orl $0x1, %edx 0x7fff61caf36d &lt;+474&gt;: orl %edi, 0xfc0a0(%rax,%rdx,4) 0x7fff61caf374 &lt;+481&gt;: leal 0x1(%rcx), %ecx 0x7fff61caf377 &lt;+484&gt;: movl %ecx, %edx 0x7fff61caf379 &lt;+486&gt;: shrl $0x4, %edx 0x7fff61caf37c &lt;+489&gt;: andl $0xffe, %edx ; imm = 0xFFE 0x7fff61caf382 &lt;+495&gt;: shll %cl, %esi 0x7fff61caf384 &lt;+497&gt;: orl %esi, 0xfc0a0(%rax,%rdx,4) 0x7fff61caf38b &lt;+504&gt;: movq %r13, %rax 0x7fff61caf38e &lt;+507&gt;: addq $0x8, %rsp 0x7fff61caf392 &lt;+511&gt;: popq %rbx 0x7fff61caf393 &lt;+512&gt;: popq %r12 0x7fff61caf395 &lt;+514&gt;: popq %r13 0x7fff61caf397 &lt;+516&gt;: popq %r14 0x7fff61caf399 &lt;+518&gt;: popq %r15 0x7fff61caf39b &lt;+520&gt;: popq %rbp 0x7fff61caf39c &lt;+521&gt;: retq 0x7fff61caf39d &lt;+522&gt;: movq 0x210(%r14), %r13 0x7fff61caf3a4 &lt;+529&gt;: testq %r13, %r13 0x7fff61caf3a7 &lt;+532&gt;: je 0x7fff61caf4f9 ; &lt;+870&gt; 0x7fff61caf3ad &lt;+538&gt;: movq %r13, %rdi 0x7fff61caf3b0 &lt;+541&gt;: callq 0x7fff61cb05ab ; get_tiny_free_size 0x7fff61caf3b5 &lt;+546&gt;: movq 0x8(%r13), %rcx 0x7fff61caf3b9 &lt;+550&gt;: movq %rcx, %r8 0x7fff61caf3bc &lt;+553&gt;: shlq $0x4, %r8 0x7fff61caf3c0 &lt;+557&gt;: shrq $0x3c, %rcx 0x7fff61caf3c4 &lt;+561&gt;: movq 0x278(%r12), %rsi 0x7fff61caf3cc &lt;+569&gt;: movq %r8, %rdi 0x7fff61caf3cf &lt;+572&gt;: xorq %rsi, %rdi 0x7fff61caf3d2 &lt;+575&gt;: movq %rdi, %rbx 0x7fff61caf3d5 &lt;+578&gt;: shrq $0x8, %rbx 0x7fff61caf3d9 &lt;+582&gt;: addl %edi, %ebx 0x7fff61caf3db &lt;+584&gt;: movq %rdi, %rdx 0x7fff61caf3de &lt;+587&gt;: shrq $0x10, %rdx 0x7fff61caf3e2 &lt;+591&gt;: addl %ebx, %edx 0x7fff61caf3e4 &lt;+593&gt;: movq %rdi, %rbx 0x7fff61caf3e7 &lt;+596&gt;: shrq $0x18, %rbx 0x7fff61caf3eb &lt;+600&gt;: addl %edx, %ebx 0x7fff61caf3ed &lt;+602&gt;: movq %rdi, %rdx 0x7fff61caf3f0 &lt;+605&gt;: shrq $0x20, %rdx 0x7fff61caf3f4 &lt;+609&gt;: addl %ebx, %edx 0x7fff61caf3f6 &lt;+611&gt;: movq %rdi, %rbx 0x7fff61caf3f9 &lt;+614&gt;: shrq $0x28, %rbx 0x7fff61caf3fd &lt;+618&gt;: addl %edx, %ebx 0x7fff61caf3ff &lt;+620&gt;: movq %rdi, %rdx 0x7fff61caf402 &lt;+623&gt;: shrq $0x30, %rdx 0x7fff61caf406 &lt;+627&gt;: addl %ebx, %edx 0x7fff61caf408 &lt;+629&gt;: shrq $0x38, %rdi 0x7fff61caf40c &lt;+633&gt;: addl %edx, %edi 0x7fff61caf40e &lt;+635&gt;: andl $0xf, %edi 0x7fff61caf411 &lt;+638&gt;: cmpq %rdi, %rcx 0x7fff61caf414 &lt;+641&gt;: jne 0x7fff61caf602 ; &lt;+1135&gt; 0x7fff61caf41a &lt;+647&gt;: movzwl %ax, %edi 0x7fff61caf41d &lt;+650&gt;: subl %r15d, %edi 0x7fff61caf420 &lt;+653&gt;: cmpl $0x40, %edi 0x7fff61caf423 &lt;+656&gt;: jl 0x7fff61caf58a ; &lt;+1015&gt; 0x7fff61caf429 &lt;+662&gt;: movl %r15d, %eax 0x7fff61caf42c &lt;+665&gt;: shll $0x4, %eax 0x7fff61caf42f &lt;+668&gt;: addq %r13, %rax 0x7fff61caf432 &lt;+671&gt;: movq %rax, 0x210(%r14) 0x7fff61caf439 &lt;+678&gt;: movq %rax, %rcx 0x7fff61caf43c &lt;+681&gt;: shrq $0x4, %rcx 0x7fff61caf440 &lt;+685&gt;: testq %r8, %r8 0x7fff61caf443 &lt;+688&gt;: je 0x7fff61caf48e ; &lt;+763&gt; 0x7fff61caf445 &lt;+690&gt;: xorq %rax, %rsi 0x7fff61caf448 &lt;+693&gt;: movq %rsi, %rdx 0x7fff61caf44b &lt;+696&gt;: shrq $0x8, %rdx 0x7fff61caf44f &lt;+700&gt;: addl %esi, %edx 0x7fff61caf451 &lt;+702&gt;: movq %rsi, %rbx 0x7fff61caf454 &lt;+705&gt;: shrq $0x10, %rbx 0x7fff61caf458 &lt;+709&gt;: addl %edx, %ebx 0x7fff61caf45a &lt;+711&gt;: movq %rsi, %rdx 0x7fff61caf45d &lt;+714&gt;: shrq $0x18, %rdx 0x7fff61caf461 &lt;+718&gt;: addl %ebx, %edx 0x7fff61caf463 &lt;+720&gt;: movq %rsi, %rbx 0x7fff61caf466 &lt;+723&gt;: shrq $0x20, %rbx 0x7fff61caf46a &lt;+727&gt;: addl %edx, %ebx 0x7fff61caf46c &lt;+729&gt;: movq %rsi, %rdx 0x7fff61caf46f &lt;+732&gt;: shrq $0x28, %rdx 0x7fff61caf473 &lt;+736&gt;: addl %ebx, %edx 0x7fff61caf475 &lt;+738&gt;: movq %rsi, %rbx 0x7fff61caf478 &lt;+741&gt;: shrq $0x30, %rbx 0x7fff61caf47c &lt;+745&gt;: addl %edx, %ebx 0x7fff61caf47e &lt;+747&gt;: shrq $0x38, %rsi 0x7fff61caf482 &lt;+751&gt;: addl %ebx, %esi 0x7fff61caf484 &lt;+753&gt;: shlq $0x3c, %rsi 0x7fff61caf488 &lt;+757&gt;: orq %rcx, %rsi 0x7fff61caf48b &lt;+760&gt;: movq %rsi, (%r8) 0x7fff61caf48e &lt;+763&gt;: movq (%r13), %rdx 0x7fff61caf492 &lt;+767&gt;: movq %rdx, (%rax) 0x7fff61caf495 &lt;+770&gt;: movq 0x8(%r13), %rdx 0x7fff61caf499 &lt;+774&gt;: movq %rdx, 0x8(%rax) 0x7fff61caf49d &lt;+778&gt;: movq %rax, %rdx 0x7fff61caf4a0 &lt;+781&gt;: andq $-0x100000, %rdx ; imm = 0xFFF00000 0x7fff61caf4a7 &lt;+788&gt;: movl %eax, %esi 0x7fff61caf4a9 &lt;+790&gt;: shrl $0x8, %esi 0x7fff61caf4ac &lt;+793&gt;: andl $0xffe, %esi ; imm = 0xFFE 0x7fff61caf4b2 &lt;+799&gt;: andl $0x1f, %ecx 0x7fff61caf4b5 &lt;+802&gt;: movl $0x1, %ebx 0x7fff61caf4ba &lt;+807&gt;: shll %cl, %ebx 0x7fff61caf4bc &lt;+809&gt;: orl %ebx, 0xfc0a0(%rdx,%rsi,4) 0x7fff61caf4c3 &lt;+816&gt;: movl $0xfffffffe, %ebx ; imm = 0xFFFFFFFE 0x7fff61caf4c8 &lt;+821&gt;: roll %cl, %ebx 0x7fff61caf4ca &lt;+823&gt;: orl $0x1, %esi 0x7fff61caf4cd &lt;+826&gt;: andl %ebx, 0xfc0a0(%rdx,%rsi,4) 0x7fff61caf4d4 &lt;+833&gt;: movzwl %di, %ecx 0x7fff61caf4d7 &lt;+836&gt;: cmpl $0x2, %ecx 0x7fff61caf4da &lt;+839&gt;: jb 0x7fff61caf5ee ; &lt;+1115&gt; 0x7fff61caf4e0 &lt;+845&gt;: movl %edi, %ecx 0x7fff61caf4e2 &lt;+847&gt;: shll $0x4, %ecx 0x7fff61caf4e5 &lt;+850&gt;: andl $0xffff0, %ecx ; imm = 0xFFFF0 0x7fff61caf4eb &lt;+856&gt;: movw %di, -0x2(%rax,%rcx) 0x7fff61caf4f0 &lt;+861&gt;: movw %di, 0x10(%rax) 0x7fff61caf4f4 &lt;+865&gt;: jmp 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf4f9 &lt;+870&gt;: movq 0x838(%r14), %rcx 0x7fff61caf500 &lt;+877&gt;: movl %r15d, %eax 0x7fff61caf503 &lt;+880&gt;: shll $0x4, %eax 0x7fff61caf506 &lt;+883&gt;: movq %rcx, %rdx 0x7fff61caf509 &lt;+886&gt;: subq %rax, %rdx 0x7fff61caf50c &lt;+889&gt;: jae 0x7fff61caf516 ; &lt;+899&gt; 0x7fff61caf50e &lt;+891&gt;: xorl %r13d, %r13d 0x7fff61caf511 &lt;+894&gt;: jmp 0x7fff61caf38b ; &lt;+504&gt; 0x7fff61caf516 &lt;+899&gt;: movl $0xfc080, %r13d ; imm = 0xFC080 0x7fff61caf51c &lt;+905&gt;: subq %rcx, %r13 0x7fff61caf51f &lt;+908&gt;: addq 0x848(%r14), %r13 0x7fff61caf526 &lt;+915&gt;: movq %rdx, 0x838(%r14) 0x7fff61caf52d &lt;+922&gt;: testq %rdx, %rdx 0x7fff61caf530 &lt;+925&gt;: je 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf536 &lt;+931&gt;: addq %r13, %rax 0x7fff61caf539 &lt;+934&gt;: movq %rax, %rdx 0x7fff61caf53c &lt;+937&gt;: andq $-0x100000, %rdx ; imm = 0xFFF00000 0x7fff61caf543 &lt;+944&gt;: movq %rax, %rcx 0x7fff61caf546 &lt;+947&gt;: shrq $0x4, %rcx 0x7fff61caf54a &lt;+951&gt;: shrl $0x8, %eax 0x7fff61caf54d &lt;+954&gt;: andl $0xffe, %eax ; imm = 0xFFE 0x7fff61caf552 &lt;+959&gt;: movl $0x1, %esi 0x7fff61caf557 &lt;+964&gt;: movl $0x1, %edi 0x7fff61caf55c &lt;+969&gt;: shll %cl, %edi 0x7fff61caf55e &lt;+971&gt;: orl %edi, 0xfc0a0(%rdx,%rax,4) 0x7fff61caf565 &lt;+978&gt;: orl $0x1, %eax 0x7fff61caf568 &lt;+981&gt;: orl %edi, 0xfc0a0(%rdx,%rax,4) 0x7fff61caf56f &lt;+988&gt;: leal 0x1(%rcx), %ecx 0x7fff61caf572 &lt;+991&gt;: movl %ecx, %eax 0x7fff61caf574 &lt;+993&gt;: shrl $0x4, %eax 0x7fff61caf577 &lt;+996&gt;: andl $0xffe, %eax ; imm = 0xFFE 0x7fff61caf57c &lt;+1001&gt;: shll %cl, %esi 0x7fff61caf57e &lt;+1003&gt;: orl %esi, 0xfc0a0(%rdx,%rax,4) 0x7fff61caf585 &lt;+1010&gt;: jmp 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf58a &lt;+1015&gt;: testq %r8, %r8 0x7fff61caf58d &lt;+1018&gt;: je 0x7fff61caf596 ; &lt;+1027&gt; 0x7fff61caf58f &lt;+1020&gt;: movq (%r13), %rcx 0x7fff61caf593 &lt;+1024&gt;: movq %rcx, (%r8) 0x7fff61caf596 &lt;+1027&gt;: movq %r8, 0x210(%r14) 0x7fff61caf59d &lt;+1034&gt;: jmp 0x7fff61caf5ba ; &lt;+1063&gt; 0x7fff61caf59f &lt;+1036&gt;: movl $0xfffffffe, %eax ; imm = 0xFFFFFFFE 0x7fff61caf5a4 &lt;+1041&gt;: roll %cl, %eax 0x7fff61caf5a6 &lt;+1043&gt;: shrq $0x5, %rcx 0x7fff61caf5aa &lt;+1047&gt;: andl %eax, 0x818(%r14,%rcx,4) 0x7fff61caf5b2 &lt;+1055&gt;: movq %r13, %rdi 0x7fff61caf5b5 &lt;+1058&gt;: callq 0x7fff61cb05ab ; get_tiny_free_size 0x7fff61caf5ba &lt;+1063&gt;: leal -0x1(%rax), %ecx 0x7fff61caf5bd &lt;+1066&gt;: cmpw %r15w, %cx 0x7fff61caf5c1 &lt;+1070&gt;: jae 0x7fff61caf5cc ; &lt;+1081&gt; 0x7fff61caf5c3 &lt;+1072&gt;: movw %ax, %r15w 0x7fff61caf5c7 &lt;+1076&gt;: jmp 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf5cc &lt;+1081&gt;: subl %r15d, %eax 0x7fff61caf5cf &lt;+1084&gt;: movl %r15d, %ecx 0x7fff61caf5d2 &lt;+1087&gt;: shll $0x4, %ecx 0x7fff61caf5d5 &lt;+1090&gt;: movq %r13, %rdx 0x7fff61caf5d8 &lt;+1093&gt;: addq %rcx, %rdx 0x7fff61caf5db &lt;+1096&gt;: movzwl %ax, %ecx 0x7fff61caf5de &lt;+1099&gt;: movq %r12, %rdi 0x7fff61caf5e1 &lt;+1102&gt;: movq %r14, %rsi 0x7fff61caf5e4 &lt;+1105&gt;: callq 0x7fff61cafe1b ; tiny_free_list_add_ptr 0x7fff61caf5e9 &lt;+1110&gt;: jmp 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf5ee &lt;+1115&gt;: testw %di, %di 0x7fff61caf5f1 &lt;+1118&gt;: jne 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf5f7 &lt;+1124&gt;: movw $0x0, 0x10(%rax) 0x7fff61caf5fd &lt;+1130&gt;: jmp 0x7fff61caf2f7 ; &lt;+356&gt; 0x7fff61caf602 &lt;+1135&gt;: addq $0x8, %r13 0x7fff61caf606 &lt;+1139&gt;: movl 0x26c(%r12), %edi 0x7fff61caf60e &lt;+1147&gt;: movq %r13, %rsi 0x7fff61caf611 &lt;+1150&gt;: callq 0x7fff61cc5505 ; free_list_checksum_botch.352 0x7fff61caf616 &lt;+1155&gt;: ud2 0x7fff61caf618 &lt;+1157&gt;: nop </code></pre> <p>The offender is <code>0x7fff61caf227 &lt;+148&gt;: movq %rdx, (%rax)</code>, where <code>rax</code> is the address of my <code>weights</code> pointer that gets nulled, and <code>rdx</code> is 0.</p>
0debug
static int scsi_disk_emulate_command(SCSIDiskReq *r) { SCSIRequest *req = &r->req; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint64_t nb_sectors; uint8_t *outbuf; int buflen = 0; if (!r->iov.iov_base) { if (req->cmd.xfer > 65536) { goto illegal_request; } r->buflen = MAX(4096, req->cmd.xfer); r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen); } outbuf = r->iov.iov_base; switch (req->cmd.buf[0]) { case TEST_UNIT_READY: assert(!s->tray_open && bdrv_is_inserted(s->qdev.conf.bs)); break; case INQUIRY: buflen = scsi_disk_emulate_inquiry(req, outbuf); if (buflen < 0) { goto illegal_request; } break; case MODE_SENSE: case MODE_SENSE_10: buflen = scsi_disk_emulate_mode_sense(r, outbuf); if (buflen < 0) { goto illegal_request; } break; case READ_TOC: buflen = scsi_disk_emulate_read_toc(req, outbuf); if (buflen < 0) { goto illegal_request; } break; case RESERVE: if (req->cmd.buf[1] & 1) { goto illegal_request; } break; case RESERVE_10: if (req->cmd.buf[1] & 3) { goto illegal_request; } break; case RELEASE: if (req->cmd.buf[1] & 1) { goto illegal_request; } break; case RELEASE_10: if (req->cmd.buf[1] & 3) { goto illegal_request; } break; case START_STOP: if (scsi_disk_emulate_start_stop(r) < 0) { return -1; } break; case ALLOW_MEDIUM_REMOVAL: s->tray_locked = req->cmd.buf[4] & 1; bdrv_lock_medium(s->qdev.conf.bs, req->cmd.buf[4] & 1); break; case READ_CAPACITY_10: memset(outbuf, 0, 8); bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); if (!nb_sectors) { scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY)); return -1; } if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) { goto illegal_request; } nb_sectors /= s->qdev.blocksize / 512; nb_sectors--; s->qdev.max_lba = nb_sectors; if (nb_sectors > UINT32_MAX) { nb_sectors = UINT32_MAX; } outbuf[0] = (nb_sectors >> 24) & 0xff; outbuf[1] = (nb_sectors >> 16) & 0xff; outbuf[2] = (nb_sectors >> 8) & 0xff; outbuf[3] = nb_sectors & 0xff; outbuf[4] = 0; outbuf[5] = 0; outbuf[6] = s->qdev.blocksize >> 8; outbuf[7] = 0; buflen = 8; break; case REQUEST_SENSE: buflen = scsi_build_sense(NULL, 0, outbuf, r->buflen, (req->cmd.buf[1] & 1) == 0); break; case MECHANISM_STATUS: buflen = scsi_emulate_mechanism_status(s, outbuf); if (buflen < 0) { goto illegal_request; } break; case GET_CONFIGURATION: buflen = scsi_get_configuration(s, outbuf); if (buflen < 0) { goto illegal_request; } break; case GET_EVENT_STATUS_NOTIFICATION: buflen = scsi_get_event_status_notification(s, r, outbuf); if (buflen < 0) { goto illegal_request; } break; case READ_DVD_STRUCTURE: buflen = scsi_read_dvd_structure(s, r, outbuf); if (buflen < 0) { goto illegal_request; } break; case SERVICE_ACTION_IN_16: if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { DPRINTF("SAI READ CAPACITY(16)\n"); memset(outbuf, 0, req->cmd.xfer); bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); if (!nb_sectors) { scsi_check_condition(r, SENSE_CODE(LUN_NOT_READY)); return -1; } if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) { goto illegal_request; } nb_sectors /= s->qdev.blocksize / 512; nb_sectors--; s->qdev.max_lba = nb_sectors; outbuf[0] = (nb_sectors >> 56) & 0xff; outbuf[1] = (nb_sectors >> 48) & 0xff; outbuf[2] = (nb_sectors >> 40) & 0xff; outbuf[3] = (nb_sectors >> 32) & 0xff; outbuf[4] = (nb_sectors >> 24) & 0xff; outbuf[5] = (nb_sectors >> 16) & 0xff; outbuf[6] = (nb_sectors >> 8) & 0xff; outbuf[7] = nb_sectors & 0xff; outbuf[8] = 0; outbuf[9] = 0; outbuf[10] = s->qdev.blocksize >> 8; outbuf[11] = 0; outbuf[12] = 0; outbuf[13] = get_physical_block_exp(&s->qdev.conf); if (s->qdev.conf.discard_granularity) { outbuf[14] = 0x80; } buflen = req->cmd.xfer; break; } DPRINTF("Unsupported Service Action In\n"); goto illegal_request; case VERIFY_10: break; default: scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE)); return -1; } buflen = MIN(buflen, req->cmd.xfer); return buflen; illegal_request: if (r->req.status == -1) { scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); } return -1; }
1threat
Store in the database from twig Symfony 2 : <p>I would like to now if there is a way to store in my database somes values displayed on twig ? the values was calculated with javascript/jason, and i dont want to do the same script on symfony or php ...</p> <p>Thank you ! </p>
0debug
Is it possible to use greater than equal to operator in group by? : <p>Please suggest me the way to use greater than equal to operator in group by in sql.</p>
0debug
How to store tokens on the client side using node js on backend? : <p>I'm using passport.js for local authentication and express-session for managing session of a user but express-session is storing cookies on the client side. Since cookies are less secure, I want to send and receive jwt tokens in the client side but I don't know how to do that. I'm using mongodb for the database, express framework and node js</p>
0debug
how to apply url validator in asp textbox feild : <p>I am new to asp.net &amp; my client needs to fill the url in text box &amp; without proper url the form should not be submitted. Can anybody know how to apply url validator in textbox fields in asp.net. Please let me know about it thanks</p>
0debug
Is std::byte well defined? : <p>C++17 introduces the <code>std::byte</code> type. A library type that can (supposedly) be used to access raw memory, but stands separate from the character types and represents a mere lump of bits.</p> <p>So far so good. But the definition has me slightly worried. As given in <a href="http://eel.is/c++draft/cstddef.syn#lib:byte" rel="noreferrer">[cstddef.syn]</a>:</p> <pre><code>enum class byte : unsigned char {}; </code></pre> <p>I have seen two answers on SO which seem to imply different things about the robustness of the above. <a href="https://stackoverflow.com/a/44508267/817643">This answer</a> argues (without reference) that an enumeration with an underlying type has the same size and alignment requirements as said type. Intuitively this seems correct, since specifying an underlying type allows for opaque enum declarations.</p> <p>However, <a href="https://stackoverflow.com/a/45056142/817643">this answer</a> argues that the standard only guarantees that two enumerations with the same underlying type are layout compatible, and no more.</p> <p>When reading <a href="http://eel.is/c++draft/dcl.enum" rel="noreferrer">[dcl.enum]</a> I couldn't help but notice that indeed, the underlying type is only used to specify the range of the enumerators. There is no mention of size or alignment requirements.</p> <p>What am I missing?</p>
0debug
static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc, int q_dc, int q_ac1, int q_ac2) { int code, pattern; code = get_vlc2(gb, rvlc->first_pattern[fc].table, 9, 2); pattern = code & 0x7; code >>= 3; decode_subblock3(dst, code, 0, gb, &rvlc->coefficient, q_dc, q_ac1, q_ac2); if(pattern & 4){ code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2); decode_subblock(dst + 2, code, 0, gb, &rvlc->coefficient, q_ac2); } if(pattern & 2){ code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2); decode_subblock(dst + 8*2, code, 1, gb, &rvlc->coefficient, q_ac2); } if(pattern & 1){ code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2); decode_subblock(dst + 8*2+2, code, 0, gb, &rvlc->coefficient, q_ac2); } }
1threat
Which code design pattern should I use in nodejs? How to design good data base? : <p>I have experience in games development(C/C++/C#) but recently I started writing automated test and I wanted to learn some backend stuff. I'm writin platform for automated backups, making builds from git repo and testing. I decide to write server in Node.js with PostgreSQL. I have 0 experience in web development. Never ever have I use a database or javascript. I think homemade project like that will be a good starting point. I want to ask two questions. First: Which code design patter will be the best for learning Node.js? Second - Could you please tell me if this pre-alpha database concept is currently good or should I change it?<a href="https://i.stack.imgur.com/GRkNa.png" rel="nofollow noreferrer">database</a></p>
0debug
why output is not printing in python when used print (iterable) : (py 2.7) In the following code, I am not getting why output is not printed for case 1. and in second case after using list() its working . Can anyone help me with the concept. thank you. **case one:** s='india' print(reversed(s)) *reversed object at 0x032ECF10* **case two:** s='india' print(list(reversed(s))) *['a', 'i', 'd', 'n', 'i']*
0debug
Confussed on how notes = JSON.parse(noteString); : var addnote = function (title, body) { var notes = []; var note = { title: title, body: body } need explanation on the two lines under try ------------------------------------------- try { var noteString = fs.readFileSync("data.json"); notes = JSON.parse(noteString); } catch (e) { } And explanation on how duplicateNotes works .. ---------------------------------------------- var duplicateNotes = notes.filter(function(note){ return note.title === title }) if (duplicateNotes.length === 0) { notes.push(note); fs.writeFileSync("data.json", JSON.stringify(notes)); } }
0debug
int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size) { const CodecMime *mime = ff_id3v2_mime_tags; enum AVCodecID id = AV_CODEC_ID_NONE; AVBufferRef *data = NULL; uint8_t mimetype[64], *desc = NULL; AVIOContext *pb = NULL; AVStream *st; int type, width, height; int len, ret = 0; pb = avio_alloc_context(buf, buf_size, 0, NULL, NULL, NULL, NULL); if (!pb) return AVERROR(ENOMEM); type = avio_rb32(pb); if (type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types) || type < 0) { av_log(s, AV_LOG_ERROR, "Invalid picture type: %d.\n", type); if (s->error_recognition & AV_EF_EXPLODE) { ret = AVERROR_INVALIDDATA; goto fail; } type = 0; } len = avio_rb32(pb); if (len <= 0 || avio_read(pb, mimetype, FFMIN(len, sizeof(mimetype) - 1)) != len) { av_log(s, AV_LOG_ERROR, "Could not read mimetype from an attached " "picture.\n"); if (s->error_recognition & AV_EF_EXPLODE) ret = AVERROR_INVALIDDATA; goto fail; } mimetype[len] = 0; while (mime->id != AV_CODEC_ID_NONE) { if (!strncmp(mime->str, mimetype, sizeof(mimetype))) { id = mime->id; break; } mime++; } if (id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n", mimetype); if (s->error_recognition & AV_EF_EXPLODE) ret = AVERROR_INVALIDDATA; goto fail; } len = avio_rb32(pb); if (len > 0) { if (!(desc = av_malloc(len + 1))) { ret = AVERROR(ENOMEM); goto fail; } if (avio_read(pb, desc, len) != len) { av_log(s, AV_LOG_ERROR, "Error reading attached picture description.\n"); if (s->error_recognition & AV_EF_EXPLODE) ret = AVERROR(EIO); goto fail; } desc[len] = 0; } width = avio_rb32(pb); height = avio_rb32(pb); avio_skip(pb, 8); len = avio_rb32(pb); if (len <= 0) { av_log(s, AV_LOG_ERROR, "Invalid attached picture size: %d.\n", len); if (s->error_recognition & AV_EF_EXPLODE) ret = AVERROR_INVALIDDATA; goto fail; } if (!(data = av_buffer_alloc(len))) { ret = AVERROR(ENOMEM); goto fail; } if (avio_read(pb, data->data, len) != len) { av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n"); if (s->error_recognition & AV_EF_EXPLODE) ret = AVERROR(EIO); goto fail; } st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } av_init_packet(&st->attached_pic); st->attached_pic.buf = data; st->attached_pic.data = data->data; st->attached_pic.size = len; st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; st->disposition |= AV_DISPOSITION_ATTACHED_PIC; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = id; st->codec->width = width; st->codec->height = height; av_dict_set(&st->metadata, "comment", ff_id3v2_picture_types[type], 0); if (desc) av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); av_freep(&pb); return 0; fail: av_buffer_unref(&data); av_freep(&desc); av_freep(&pb); return ret; }
1threat
Binary file output for fixed fixed length string vb.net : I am trying to write a binary file which also has a string which i want to have as fixed length in vb.net. I tried lset, padleft in debug, the value returned is correct but in the output file, the first character before the string is the fixed length i specified. why does the binary writer write the additional char ?
0debug
Does Node run all the code inside required modules? : <p>Are node modules run when they are required?</p> <p>For example: You have a file foo.js that contains some code and some exports.</p> <p>When I import the file by running the following code</p> <pre><code>var foo = require(./foo.js); </code></pre> <p>is all the code inside the file foo.js run and only exported after that?</p>
0debug
send a mail notification when clicking submit button..wen i click submit button : send a mail notification when clicking submit button..wen i click submit button..label is showing your message has been sent..but when i check my mail..i did nt get that here my code it is protected void btnSubmit_Click(object sender, EventArgs e) { try { //Create the msg object to be sent MailMessage msg = new MailMessage(); //Add your email address to the recipients msg.To.Add("sathishsatu222@gmail.com"); //Configure the address we are sending the mail from **- NOT SURE IF I NEED THIS OR NOT?** MailAddress address = new MailAddress("satheezkumar93@gmail.com"); msg.From = address; //Append their name in the beginning of the subject msg.Subject = "hy"; msg.Body = "hy hw ru?"; SmtpClient client = new SmtpClient("smtp-mail.gmail.com", 25); NetworkCredential credentials = new NetworkCredential("satheezkumar93@gmail.com", "mypassword here"); client.Credentials = credentials; client.Host = "smtp-mail.gmail.com"; client.Port = 25; client.EnableSsl = true; //Configure an SmtpClient to send the mail. //Display some feedback to the user to let them know it was sent lblResult.Text = "Your message was sent!"; } catch { //If the message failed at some point, let the user know lblResult.Text = "Your message failed to send, please try again."; } }
0debug
Best practise: Drawing shape over Background : I'm making a design in flutter and would like to have a wave shape over my background at the bottom (like in the image attached). What is best practise to do it (even for example in html - css). Is it better to overlay a image shape to the bottom of the background e.g. a white wave-shape or to achieve the effect by drawing the wave-shape programmaticaly - ( In flutter for example by using the path widget. Or in css by drawing it)? Img: https://imgur.com/a/0hwF7Sy
0debug
right-to-left (RTL) in flutter : <p>I was using Flutter more than a week, and wanted to create an Arabic (right-to-left) app.</p> <p>I was reading <a href="https://flutter.io/tutorials/internationalization/" rel="noreferrer">Internationalizing Flutter Apps</a>, but it didn't mention how to set the layout direction.</p> <p>So, how to show right-to-left (RTL) layout in Flutter?</p>
0debug
def and_tuples(test_tup1, test_tup2): res = tuple(ele1 & ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
0debug
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s) { int bin, bnd, ch, i; uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS]; float rms_energy[SPX_MAX_BANDS]; bin = s->spx_dst_start_freq; num_copy_sections = 0; for (bnd = 0; bnd < s->num_spx_bands; bnd++) { int copysize; int bandsize = s->spx_band_sizes[bnd]; if (bin + bandsize > s->spx_src_start_freq) { copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; bin = s->spx_dst_start_freq; wrapflag[bnd] = 1; } for (i = 0; i < bandsize; i += copysize) { if (bin == s->spx_src_start_freq) { copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; bin = s->spx_dst_start_freq; } copysize = FFMIN(bandsize - i, s->spx_src_start_freq - bin); bin += copysize; } } copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; for (ch = 1; ch <= s->fbw_channels; ch++) { if (!s->channel_uses_spx[ch]) continue; bin = s->spx_src_start_freq; for (i = 0; i < num_copy_sections; i++) { memcpy(&s->transform_coeffs[ch][bin], &s->transform_coeffs[ch][s->spx_dst_start_freq], copy_sizes[i]*sizeof(float)); bin += copy_sizes[i]; } bin = s->spx_src_start_freq; for (bnd = 0; bnd < s->num_spx_bands; bnd++) { int bandsize = s->spx_band_sizes[bnd]; float accum = 0.0f; for (i = 0; i < bandsize; i++) { float coeff = s->transform_coeffs[ch][bin++]; accum += coeff * coeff; } rms_energy[bnd] = sqrtf(accum / bandsize); } if (s->spx_atten_code[ch] >= 0) { const float *atten_tab = ff_eac3_spx_atten_tab[s->spx_atten_code[ch]]; bin = s->spx_src_start_freq - 2; for (bnd = 0; bnd < s->num_spx_bands; bnd++) { if (wrapflag[bnd]) { float *coeffs = &s->transform_coeffs[ch][bin]; coeffs[0] *= atten_tab[0]; coeffs[1] *= atten_tab[1]; coeffs[2] *= atten_tab[2]; coeffs[3] *= atten_tab[1]; coeffs[4] *= atten_tab[0]; } bin += s->spx_band_sizes[bnd]; } } bin = s->spx_src_start_freq; for (bnd = 0; bnd < s->num_spx_bands; bnd++) { float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN); float sscale = s->spx_signal_blend[ch][bnd]; for (i = 0; i < s->spx_band_sizes[bnd]; i++) { float noise = nscale * (int32_t)av_lfg_get(&s->dith_state); s->transform_coeffs[ch][bin] *= sscale; s->transform_coeffs[ch][bin++] += noise; } } } }
1threat
static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref) { AResampleContext *aresample = inlink->dst->priv; const int n_in = insamplesref->audio->nb_samples; int n_out = FFMAX(n_in * aresample->ratio * 2, 1); AVFilterLink *const outlink = inlink->dst->outputs[0]; AVFilterBufferRef *outsamplesref = ff_get_audio_buffer(outlink, AV_PERM_WRITE, n_out); int ret; avfilter_copy_buffer_ref_props(outsamplesref, insamplesref); outsamplesref->format = outlink->format; outsamplesref->audio->channel_layout = outlink->channel_layout; outsamplesref->audio->sample_rate = outlink->sample_rate; if(insamplesref->pts != AV_NOPTS_VALUE) { int64_t inpts = av_rescale(insamplesref->pts, inlink->time_base.num * (int64_t)outlink->sample_rate * inlink->sample_rate, inlink->time_base.den); int64_t outpts= swr_next_pts(aresample->swr, inpts); aresample->next_pts = outsamplesref->pts = (outpts + inlink->sample_rate/2) / inlink->sample_rate; } else { outsamplesref->pts = AV_NOPTS_VALUE; } n_out = swr_convert(aresample->swr, outsamplesref->extended_data, n_out, (void *)insamplesref->extended_data, n_in); if (n_out <= 0) { avfilter_unref_buffer(outsamplesref); avfilter_unref_buffer(insamplesref); return 0; } outsamplesref->audio->nb_samples = n_out; ret = ff_filter_samples(outlink, outsamplesref); aresample->req_fullfilled= 1; avfilter_unref_buffer(insamplesref); return ret; }
1threat
how to support in in the device language swift? : I'm creating an app and need to support the language of the device and I haven't found any info' online regarding that, how to get to the device language support and present it in swift?
0debug
how can i change the Read Only mode in some classes to read and write in java? : i have a jar file with classes in it attached to my project but i cant instanciate object from those classes because the constructors are private and i cant change that because those files are in read only mode can someone help me in java ? [ `private DicomImageViewer(String title,int w,int h) { } /** * @param title */ private DicomImageViewer(String title) { } `][1] [1]: https://i.stack.imgur.com/usxk1.png
0debug
problem with implemnting stackoverflow-like tag search bar? : First of all, sorry for the weirdly phrased question. My problem is that when the tags overflow the container you can't see the search anymore and I want it to kind of move everything back in the search and slide the search forward like in the image below https://imgur.com/a/QqXbNgt what's actually happening https://gyazo.com/6c0e0064ad13d9fe4cfd6e05c20c72e8 My html code <div id = "home-search" class="searchbar"> <span class = "taglist"> <!-- these are just mvc tag helpers --> <Tag tag-text = "sql-server"></Tag> <Tag tag-text = "CSharp"></Tag> <Tag tag-text = "life-drawing"></Tag> <Tag tag-text = "game-dev"></Tag> </span> <span class = "searchbox"><input class = "" placeholder="Search..." name=""></span> </div> Thanks in advance.
0debug
JSP Form action and onsubmit : After I submit the form, the form will ignore the onsubmit whether the return is true or false, the form will directly go to form action. What I want is to validate the input, if it is null it will remain at the same page and pop up an alert. This is my JSP javascript <script> function validLogin() { if (document.login.username.value == "") { alert("Please enter Login Name."); document.loginform.userName.focus(); return false; } if (document.login.password.value == "") { alert("Please enter password."); document.userform.password.focus(); return false; } alert("Welcome User"); return false; } </script> This is my JSP Form <form action="Login" method="post" name="login" onsubmit="return validLogin();">
0debug
int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx) { int i, ret = 0; jclass last_clazz = NULL; for (i = 0; jfields_mapping[i].name; i++) { int mandatory = jfields_mapping[i].mandatory; enum FFJniFieldType type = jfields_mapping[i].type; if (type == FF_JNI_CLASS) { jclass clazz; last_clazz = NULL; clazz = (*env)->FindClass(env, jfields_mapping[i].name); if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { goto done; last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) = global ? (*env)->NewGlobalRef(env, clazz) : clazz; } else { if (!last_clazz) { ret = AVERROR_EXTERNAL; break; switch(type) { case FF_JNI_FIELD: { jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { goto done; *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = field_id; break; case FF_JNI_STATIC_FIELD: { jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { goto done; *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = field_id; break; case FF_JNI_METHOD: { jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { goto done; *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = method_id; break; case FF_JNI_STATIC_METHOD: { jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { goto done; *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = method_id; break; default: av_log(log_ctx, AV_LOG_ERROR, "Unknown JNI field type\n"); ret = AVERROR(EINVAL); goto done; ret = 0; done: if (ret < 0) { ff_jni_reset_jfields(env, jfields, jfields_mapping, global, log_ctx); return ret;
1threat
int qemu_poll_ns(GPollFD *fds, guint nfds, int64_t timeout) { #ifdef CONFIG_PPOLL if (timeout < 0) { return ppoll((struct pollfd *)fds, nfds, NULL, NULL); } else { struct timespec ts; ts.tv_sec = timeout / 1000000000LL; ts.tv_nsec = timeout % 1000000000LL; return ppoll((struct pollfd *)fds, nfds, &ts, NULL); } #else return g_poll(fds, nfds, qemu_timeout_ns_to_ms(timeout)); #endif }
1threat
jenkins keeps throwing Bad Message 431 reason: Request Header Fields Too Large : <p>I have recently upgraded to jenkins 2.89.4(jdk8). I am continuously getting below error on a redirected page whenever I go into the configuration tab of any jenkins job.</p> <pre><code>Bad Message 431 reason: Request Header Fields Too Large </code></pre> <p>There is not enough help available on jenkins pages. The workaround I have is to go and remove the cookies but I see the same page again after 2-3 redirection.</p>
0debug
how fix textcleaner script : hellow dear i try fix textcleaner script from Fred's ImageMagick Scripts http://www.fmwconcepts.com/imagemagick/textcleaner/index.php but i have following error > File "./textcleaner", line 200 > { > ^ >IndentationError: unexpected indent usage1() { echo >&2 "" echo >&2 "$PROGNAME:" "$@" sed >&2 -e '1,/^####/d; /^###/g; /^#/!q; s/^#//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME" } usage2() { echo >&2 "" echo >&2 "$PROGNAME:" "$@" sed >&2 -e '1,/^####/d; /^######/g; /^#/!q; s/^#*//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME" }
0debug
How to change the data type of all variables to factor at once : <p>I want to change the data type to factor. The data shown in the example below has only three variables. So, if you want to change the data type to factor, you can type code 3times like this.</p> <pre><code>&gt;str(zxc2) 'data.frame': 50000 obs. of 3 variables: $ CA0000005: int 1 1 2 2 1 1 2 1 5 1 ... $ CA0000008: int 1 0 2 2 1 1 2 1 1 0 ... $ CA0000602: int 0 832 3077 3155 0 0 0 0 995 2712 ... &gt;zxc2$CA0000005&lt;-as.factor(zxc2$CA0000005) &gt;zxc2$CA0000008&lt;-as.factor(zxc2$CA0000008) &gt;zxc2$CA0000602&lt;-as.factor(zxc2$CA0000602) </code></pre> <p>However, if there are a lot of variables, it is hard to input each one as above. If all variables need to be changed to factor, how can i change them at once?</p> <p>Thanks in advance for your reply.</p>
0debug
static int gif_read_close(AVFormatContext *s1) { GifState *s = s1->priv_data; av_free(s->image_buf); return 0; }
1threat
static int gif_read_image(GifState *s) { int left, top, width, height, bits_per_pixel, code_size, flags; int is_interleaved, has_local_palette, y, pass, y1, linesize, n, i; uint8_t *ptr, *spal, *palette, *ptr1; left = bytestream_get_le16(&s->bytestream); top = bytestream_get_le16(&s->bytestream); width = bytestream_get_le16(&s->bytestream); height = bytestream_get_le16(&s->bytestream); flags = bytestream_get_byte(&s->bytestream); is_interleaved = flags & 0x40; has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; av_dlog(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height); if (has_local_palette) { bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel)); palette = s->local_palette; } else { palette = s->global_palette; bits_per_pixel = s->bits_per_pixel; } if (left + width > s->screen_width || top + height > s->screen_height) return AVERROR(EINVAL); n = (1 << bits_per_pixel); spal = palette; for(i = 0; i < n; i++) { s->image_palette[i] = (0xff << 24) | AV_RB24(spal); spal += 3; } for(; i < 256; i++) s->image_palette[i] = (0xff << 24); if (s->transparent_color_index >= 0) s->image_palette[s->transparent_color_index] = 0; code_size = bytestream_get_byte(&s->bytestream); ff_lzw_decode_init(s->lzw, code_size, s->bytestream, s->bytestream_end - s->bytestream, FF_LZW_GIF); linesize = s->picture.linesize[0]; ptr1 = s->picture.data[0] + top * linesize + left; ptr = ptr1; pass = 0; y1 = 0; for (y = 0; y < height; y++) { ff_lzw_decode(s->lzw, ptr, width); if (is_interleaved) { switch(pass) { default: case 0: case 1: y1 += 8; ptr += linesize * 8; if (y1 >= height) { y1 = pass ? 2 : 4; ptr = ptr1 + linesize * y1; pass++; } break; case 2: y1 += 4; ptr += linesize * 4; if (y1 >= height) { y1 = 1; ptr = ptr1 + linesize; pass++; } break; case 3: y1 += 2; ptr += linesize * 2; break; } } else { ptr += linesize; } } ff_lzw_decode_tail(s->lzw); s->bytestream = ff_lzw_cur_ptr(s->lzw); return 0; }
1threat
commitAllowingStateLoss() and commit() fragment : <p>I want commit a fragment after network background operation. I was calling commit() after successful network operation but in case activity goes to pause or stop state it was crashing app saying IllegalState exception.</p> <p>SO I tried using commitAllowingStateLoss() and its working fine now.</p> <p>I gone through few blogs and articles it says commitAllowingStateLoss() is not good to use.</p> <p>Whats the way to handle commit fragment after network operation handling activity pause and stop state?</p>
0debug
how to make all android library compatible with all android versions? : My android application is not working on android versions like kitkat and below versions. Please any one can help me for a solution.App get unfortunately stopped on kitkat
0debug
static void sun4uv_init(ram_addr_t RAM_size, const char *boot_devices, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, const struct hwdef *hwdef) { CPUState *env; m48t59_t *nvram; unsigned int i; long initrd_size, kernel_size; PCIBus *pci_bus, *pci_bus2, *pci_bus3; qemu_irq *irq; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; void *fw_cfg; env = cpu_devinit(cpu_model, hwdef); ram_init(0, RAM_size); prom_init(hwdef->prom_addr, bios_name); irq = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, irq, &pci_bus2, &pci_bus3); isa_mem_base = VGA_BASE; pci_vga_init(pci_bus, 0, 0); pci_ebus_init(pci_bus, -1); i = 0; if (hwdef->console_serial_base) { serial_mm_init(hwdef->console_serial_base, 0, NULL, 115200, serial_hds[i], 1); i++; } for(; i < MAX_SERIAL_PORTS; i++) { if (serial_hds[i]) { serial_isa_init(i, serial_hds[i]); } } for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { parallel_init(i, parallel_hds[i]); } } for(i = 0; i < nb_nics; i++) pci_nic_init(&nd_table[i], "ne2k_pci", NULL); if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { fprintf(stderr, "qemu: too many IDE bus\n"); exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } pci_cmd646_ide_init(pci_bus, hd, 1); isa_create_simple("i8042"); for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } fdctrl_init_isa(fd); nvram = m48t59_init_isa(0x0074, NVRAM_SIZE, 59); initrd_size = 0; kernel_size = sun4u_load_kernel(kernel_filename, initrd_filename, ram_size, &initrd_size); sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", RAM_size, boot_devices, KERNEL_LOAD_ADDR, kernel_size, kernel_cmdline, INITRD_LOAD_ADDR, initrd_size, 0, graphic_width, graphic_height, graphic_depth, (uint8_t *)&nd_table[0].macaddr); fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); if (kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_devices[0]); fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_SPARC64_DEPTH, graphic_depth); qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); }
1threat
_eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags, size_t rthdr_offset, struct ip6_ext_hdr *ext_hdr, struct in6_address *dst_addr) { struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr; if ((rthdr->rtype == 2) && (rthdr->len == sizeof(struct in6_address) / 8) && (rthdr->segleft == 1)) { size_t input_size = iov_size(pkt, pkt_frags); size_t bytes_read; if (input_size < rthdr_offset + sizeof(*ext_hdr)) { return false; } bytes_read = iov_to_buf(pkt, pkt_frags, rthdr_offset + sizeof(*ext_hdr), dst_addr, sizeof(*dst_addr)); return bytes_read == sizeof(dst_addr); } return false; }
1threat
Android Studio is using this JDK location ... which is different to what Gradle uses by default : <p>After Android Studio sync my gradle project, I see the following message in the event log:</p> <blockquote> <p>Android Studio is using this JDK location: <code>/path/to/my/project/specific/jdk</code> which is different to what Gradle uses by default: <code>/path/to/android/studio/embedded/jdk</code> Using different locations may spawn multiple Gradle daemons if Gradle tasks are run from command line while using Android Studio. Set Android Studio to use the same JDK as Gradle and sync project</p> </blockquote> <p>I have <code>/path/to/my/project/specific/jdk</code> set in <code>Project Structure</code>-><code>SDK Location</code> -> <code>JDK Location</code> -> <code>Other</code> <a href="https://i.stack.imgur.com/8v3YH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8v3YH.png" alt="Project Structure -&gt; SDK Location -&gt; JDK Location -&gt; Other"></a></p> <p>I have the following in my <code>.bash_profile</code>:</p> <pre><code>export JAVA_HOME=/path/to/my/project/specific/jdk </code></pre> <p>and the <a href="https://developer.android.com/studio/command-line/variables#studio_jdk" rel="noreferrer"><code>STUDIO_JDK</code> documentation</a> says:</p> <blockquote> <p>Sets the location of the JDK with which to run Studio. When you launch Android Studio, it checks the <code>STUDIO_JDK</code>, <code>JDK_HOME</code>, and <code>JAVA_HOME</code> environment variables in that order.</p> </blockquote> <p>So I would expect that Android Studio would find <code>/path/to/my/project/specific/jdk</code>, but it doesn't. Is there a special JDK setting specifically for gradle?</p>
0debug
void *colo_process_incoming_thread(void *opaque) { MigrationIncomingState *mis = opaque; QEMUFile *fb = NULL; QIOChannelBuffer *bioc = NULL; uint64_t total_size; uint64_t value; Error *local_err = NULL; migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); failover_init_state(); mis->to_src_file = qemu_file_get_return_path(mis->from_src_file); if (!mis->to_src_file) { error_report("COLO incoming thread: Open QEMUFile to_src_file failed"); goto out; } qemu_file_set_blocking(mis->from_src_file, true); bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE); fb = qemu_fopen_channel_input(QIO_CHANNEL(bioc)); object_unref(OBJECT(bioc)); colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_READY, &local_err); if (local_err) { goto out; } while (mis->state == MIGRATION_STATUS_COLO) { int request; colo_wait_handle_message(mis->from_src_file, &request, &local_err); if (local_err) { goto out; } assert(request); if (failover_get_state() != FAILOVER_STATUS_NONE) { error_report("failover request"); goto out; } colo_send_message(mis->to_src_file, COLO_MESSAGE_CHECKPOINT_REPLY, &local_err); if (local_err) { goto out; } colo_receive_check_message(mis->from_src_file, COLO_MESSAGE_VMSTATE_SEND, &local_err); if (local_err) { goto out; } value = colo_receive_message_value(mis->from_src_file, COLO_MESSAGE_VMSTATE_SIZE, &local_err); if (local_err) { goto out; } if (value > bioc->capacity) { bioc->capacity = value; bioc->data = g_realloc(bioc->data, bioc->capacity); } total_size = qemu_get_buffer(mis->from_src_file, bioc->data, value); if (total_size != value) { error_report("Got %" PRIu64 " VMState data, less than expected" " %" PRIu64, total_size, value); goto out; } bioc->usage = total_size; qio_channel_io_seek(QIO_CHANNEL(bioc), 0, 0, NULL); colo_send_message(mis->to_src_file, COLO_MESSAGE_VMSTATE_RECEIVED, &local_err); if (local_err) { goto out; } qemu_mutex_lock_iothread(); qemu_system_reset(VMRESET_SILENT); if (qemu_loadvm_state(fb) < 0) { error_report("COLO: loadvm failed"); qemu_mutex_unlock_iothread(); goto out; } qemu_mutex_unlock_iothread(); colo_send_message(mis->to_src_file, COLO_MESSAGE_VMSTATE_LOADED, &local_err); if (local_err) { goto out; } } out: if (local_err) { error_report_err(local_err); } if (fb) { qemu_fclose(fb); } if (mis->to_src_file) { qemu_fclose(mis->to_src_file); } migration_incoming_exit_colo(); return NULL; }
1threat
How do I convert the the middle number coming from an presser in vb.net to asterisk in form of an account number : <p>Am working on a banking app and I want to send sms to the users and I want the account number to be in this form 2719**5849 and the account number is coming from a textbox </p>
0debug
D3 line or area chart with series that cross over each other : <p>I'm trying to make a chart to visualize our product backlog over time. My idea is to show a line (a "series") for each work item, with each line having a width according to its estimate, and each line stacked on all the other work items that are ahead of it (as of each day). So on any given day, a line be at a Y-axis height representing how much work is ahead of it on the backlog.</p> <p>The problem is that the ordering changes day by day, so I'd need to have the series cross over each other, and I haven't been able to find a charting tool that will let me do it. </p> <p>(I'm trying to demonstrate the high-level "flow" of work items - the ones near the top of the queue will keep getting done, but the ones near the back of the queue will just sit there for a long time. New ones will be introduced periodically, and old ones will be canceled. I imagine the rendered chart will look like streaks of wind, if you will.)</p> <p>Is there a way to do it in D3, maybe? </p>
0debug
void ff_put_h264_qpel4_mc01_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_qrt_4w_msa(src - (stride * 2), stride, dst, stride, 4, 0); }
1threat
Python replace value in text file Problem : I have a settings file which is test.py. in this file i have to replace some values like ORDER_PAIRS = 10 to --> ORDER_PAIRS = new value and overwrite to the test.py file again how can i do that? thanks.. FileName = "test.py" # Open file and replace line with open(FileName) as f: updatedString = f.read().replace("ORDER_PAIRS = 10", "ORDER_PAIRS = " + str(6)) # Write updated string to file with open(FileName, "w") as f: f.write(updatedString)
0debug
Grab the instance of an class_based_view : Django documentation specify `as_view` method in [class-based-views](https://docs.djangoproject.com/en/1.11/topics/class-based-views/intro/) > as_view() class method creates **an instance** of the class and calls its dispatch() method. I attept to print the instance. For illustration: # urls.py from django.conf.urls import url from myapp.views import MyView urlpatterns = [ url(r'^about/$', MyView.as_view()), ] #views.py from django.http import HttpResponse from django.views import View class MyView(View): def get(self, request): # <view logic> return HttpResponse('result') I add `print` statement to `views.py` class MyView(View): print(self) def get(self, request): # <view logic> return HttpResponse('result') It reports `NameError` How to fetch the instance created by class 'View'
0debug
Invalid HTTP method: PATCH > executing PATCH : Caused by: feign.RetryableException: : <p>we are using netflix feign to make call to restful web service. For patch request it looks like PATCH request is not supported.</p> <blockquote> <p>Caused by: feign.RetryableException: Invalid HTTP method: PATCH executing PATCH <a href="https://projects.dev.xyz.com/projects/v1/users/" rel="noreferrer">https://projects.dev.xyz.com/projects/v1/users/</a>{uid}/projects/{guid} at feign.FeignException.errorExecuting(FeignException.java:66) at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:100) at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74) at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:54) at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)</p> </blockquote>
0debug
One domain multiple servers : <p>I have a domain <strong>mydomain.com</strong></p> <p>I need to use this domain on multiple servers. I have greengeeks shared hosting as well as AWS with few EC2 machines for my web applications.</p> <p>mydomain.com is hosting a marketing site via greengeeks hosting and it also provides my email server. </p> <p>I want one sub domain app.mydomain.com that will point to one of my ec2 instance, another subdomain appadmin.mydomain.com point to another ec2 instance, What is the best way to setup domains and sub-domains like this. (currently i am using different domain (mydomain.org) for my aws instance, which isn't elegant)</p> <p>As my mail server is on greengeeks, and I programatically send email from my ec2 app server using an email id app@mydomain.com, some email clients shows warning as "cannot verify email origin" and some pushes it in spam folder, is there a solution to it, I read about MX and SPF record but I am confused how to create them and where to put them.</p> <p>Thanks, K</p>
0debug
Unary operator '--' cannot be applied to an operand of type '@lvalue Int?' (aka '@lvalue Optional<Int>') : <p>I just updated my app's code to the latest version of Swift and I have this function:</p> <pre><code>func setupGraphDisplay() { //Use 7 days for graph - can use any number, //but labels and sample data are set up for 7 days //let noOfDays:Int = 7 //1 - replace last day with today's actual data graphView.graphPoints[graphView.graphPoints.count-1] = counterView.counter //2 - indicate that the graph needs to be redrawn graphView.setNeedsDisplay() maxLabel.text = "\((graphView.graphPoints).max()!)" print((graphView.graphPoints).max()!) //3 - calculate average from graphPoints let average = graphView.graphPoints.reduce(0, +) / graphView.graphPoints.count averageWaterDrunk.text = "\(average)" //set up labels //day of week labels are set up in storyboard with tags //today is last day of the array need to go backwards //4 - get today's day number //let dateFormatter = NSDateFormatter() let calendar = Calendar.current let componentOptions:NSCalendar.Unit = .weekday let components = (calendar as NSCalendar).components(componentOptions, from: Date()) var weekday = components.weekday let days = ["S", "S", "M", "T", "W", "T", "F"] //5 - set up the day name labels with correct day for i in (1...days.count).reversed() { if let labelView = graphView.viewWithTag(i) as? UILabel { if weekday == 7 { weekday = 0 } labelView.text = days[(weekday--)!] if weekday! &lt; 0 { weekday = days.count - 1 } } } } </code></pre> <p>However I am getting an error message at the following line:</p> <pre><code>labelView.text = days[(weekday--)!] </code></pre> <p>Where Xcode is giving me the following error:</p> <pre><code>Unary operator '--' cannot be applied to an operand of type '@lvalue Int?' (aka '@lvalue Optional&lt;Int&gt;') </code></pre> <p>I tried searching online for answers but I still couldn't find anything that would help me fix this error. </p> <p>I was also curious what the error message exactly means by type <code>@lvalue Int (aka '@lvalue Optional&lt;Int&gt;')</code>? I have never seen this data type before and don't know how to solve the problem accordingly.</p> <p>Thanks in advance. </p>
0debug
void HELPER(vfp_set_fpscr)(CPUState *env, uint32_t val) { int i; uint32_t changed; changed = env->vfp.xregs[ARM_VFP_FPSCR]; env->vfp.xregs[ARM_VFP_FPSCR] = (val & 0xffc8ffff); env->vfp.vec_len = (val >> 16) & 7; env->vfp.vec_stride = (val >> 20) & 3; changed ^= val; if (changed & (3 << 22)) { i = (val >> 22) & 3; switch (i) { case 0: i = float_round_nearest_even; break; case 1: i = float_round_up; break; case 2: i = float_round_down; break; case 3: i = float_round_to_zero; break; } set_float_rounding_mode(i, &env->vfp.fp_status); } if (changed & (1 << 24)) set_flush_to_zero((val & (1 << 24)) != 0, &env->vfp.fp_status); if (changed & (1 << 25)) set_default_nan_mode((val & (1 << 25)) != 0, &env->vfp.fp_status); i = vfp_exceptbits_to_host(val); set_float_exception_flags(i, &env->vfp.fp_status); }
1threat
How to enable Live Visual Tree and Live Property Explorer in Visual Studio : <p>I'm running a .Net 4.5 WPF application in Visual Studio 2015 Update 1 in a Debug build configuration.</p> <p>In Tools > Options > Debugging > General I have checked Enable UI Debugging Toos for XAML and Preview selected elements in Live Visual Tree.</p> <p>However, when I run my application, both the Live Property Explorer and Live Visual Tree Windows display the following message.</p> <p>UI Debugging is either disabled, not supported by the current application or the application execution is paused.</p> <p>What am I missing?</p>
0debug
How Do We Inherit Test Classes Across Android Library Modules? : <p>I have an Android Studio project with two library modules: <code>foo-module</code> and <code>bar-module</code>. Each implements a library, with <code>foo-module</code> defining a strategy interface and <code>bar-module</code> depending upon <code>foo-module</code> and implementing such a strategy. <code>foo-module</code> has instrumentation tests (<code>foo-module/src/androidTest/</code>) to test its core code, using a stub strategy implementation, and <code>bar-module</code> should have its own instrumentation tests.</p> <p>I defined an <code>AbstractTests</code> class in <code>foo-module/src/androidTest/</code> that does most of the actual testing. I also have a <code>StubTests</code> class in <code>foo-module/src/androidTest/</code> that extends <code>AbstractTests</code> and implements the necessary <code>abstract</code> methods to complete the test case (providing an implementation of the strategy, etc.). This all works great.</p> <p>In <code>bar-module/src/androidTest/</code>, I created a <code>BarStrategyTests</code> class, designed to mirror <code>StubTests</code>, but provide the strategy implemented in <code>bar-module</code>. However, <code>BarStrategyTests</code> cannot see <code>AbstractTests</code>, even though I have <code>compile project(':foo-module')</code> in my <code>build.gradle</code> file, and the main (non-test) classes in <code>bar-module</code> can work fine with the main (non-test) classes in <code>foo-module</code>. IOW, while the <code>project()</code> dependency handles regular code, it does not handle <code>androidTest/</code> code. I get "error: package com.commonsware.foo.test does not exist".</p> <p>I tried also adding <code>androidTestCompile project(':foo-module')</code>, with the same result.</p> <p>What is the recipe for sharing instrumentation test code between modules?</p> <p>Temporarily, I can clone <code>AbstractTests</code>, but that's not a great long-term solution.</p> <p><a href="https://stackoverflow.com/q/31814812/115145">This SO question</a> covers similar ground for ordinary Java. Has anyone tried the options in <a href="https://stackoverflow.com/a/32780697/115145">the one answer</a> and gotten them to work for Android instrumentation tests? The first option (move the common testing code into yet another module as regular non-test code) seems plausible, but I have no idea if the other two will work well with the <code>com.android.library</code> plugin instead of the <code>java</code> plugin.</p>
0debug
Create time lapse video from other video : <p>Using avconv (or even ffmpeg, so I can use as a reference), how can I create a time lapse video by taking only anchor/reference frames from another video? Most information I find is on how to create a time lapse video by combining images, and I'd like to do it by extracting frames from a video. Say, if a video is 30 seconds long at 30 FPS, I'd like to take 60 out of those 900 frames (900/60 = every 15 seconds) to produce a 2 second video.</p>
0debug
static void omap_clkm_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; uint16_t diff; omap_clk clk; static const char *clkschemename[8] = { "fully synchronous", "fully asynchronous", "synchronous scalable", "mix mode 1", "mix mode 2", "bypass mode", "mix mode 3", "mix mode 4", }; if (size != 2) { return omap_badwidth_write16(opaque, addr, value); } switch (addr) { case 0x00: diff = s->clkm.arm_ckctl ^ value; s->clkm.arm_ckctl = value & 0x7fff; omap_clkm_ckctl_update(s, diff, value); return; case 0x04: diff = s->clkm.arm_idlect1 ^ value; s->clkm.arm_idlect1 = value & 0x0fff; omap_clkm_idlect1_update(s, diff, value); return; case 0x08: diff = s->clkm.arm_idlect2 ^ value; s->clkm.arm_idlect2 = value & 0x07ff; omap_clkm_idlect2_update(s, diff, value); return; case 0x0c: s->clkm.arm_ewupct = value & 0x003f; return; case 0x10: diff = s->clkm.arm_rstct1 ^ value; s->clkm.arm_rstct1 = value & 0x0007; if (value & 9) { qemu_system_reset_request(); s->clkm.cold_start = 0xa; } if (diff & ~value & 4) { omap_mpui_reset(s); omap_tipb_bridge_reset(s->private_tipb); omap_tipb_bridge_reset(s->public_tipb); } if (diff & 2) { clk = omap_findclk(s, "dsp_ck"); omap_clk_canidle(clk, (~value >> 1) & 1); } return; case 0x14: s->clkm.arm_rstct2 = value & 0x0001; return; case 0x18: if ((s->clkm.clocking_scheme ^ (value >> 11)) & 7) { s->clkm.clocking_scheme = (value >> 11) & 7; printf("%s: clocking scheme set to %s\n", __FUNCTION__, clkschemename[s->clkm.clocking_scheme]); } s->clkm.cold_start &= value & 0x3f; return; case 0x1c: diff = s->clkm.arm_ckout1 ^ value; s->clkm.arm_ckout1 = value & 0x003f; omap_clkm_ckout1_update(s, diff, value); return; case 0x20: default: OMAP_BAD_REG(addr); } }
1threat
int nbd_client_co_flush(BlockDriverState *bs) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_FLUSH }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) { return 0; } request.from = 0; request.len = 0; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
1threat
int ff_h264_queue_decode_slice(H264Context *h, const H2645NAL *nal) { H264SliceContext *sl = h->slice_ctx + h->nb_slice_ctx_queued; int first_slice = sl == h->slice_ctx && !h->current_slice; int ret; sl->gb = nal->gb; ret = h264_slice_header_parse(h, sl, nal); if (ret < 0) return ret; if (sl->redundant_pic_count > 0) return 0; if (sl->first_mb_addr == 0 || !h->current_slice) { if (h->setup_finished) { av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n"); return AVERROR_INVALIDDATA; } } if (sl->first_mb_addr == 0) { if (h->current_slice) { if (h->nb_slice_ctx_queued) { H264SliceContext tmp_ctx; ret = ff_h264_execute_decode_slices(h); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; memcpy(&tmp_ctx, h->slice_ctx, sizeof(tmp_ctx)); memcpy(h->slice_ctx, sl, sizeof(tmp_ctx)); memcpy(sl, &tmp_ctx, sizeof(tmp_ctx)); sl = h->slice_ctx; } if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) { ret = ff_h264_field_end(h, h->slice_ctx, 1); if (ret < 0) return ret; } else if (h->cur_pic_ptr && !FIELD_PICTURE(h) && !h->first_field && h->nal_unit_type == H264_NAL_IDR_SLICE) { av_log(h, AV_LOG_WARNING, "Broken frame packetizing\n"); ret = ff_h264_field_end(h, h->slice_ctx, 1); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); h->cur_pic_ptr = NULL; if (ret < 0) return ret; } else return AVERROR_INVALIDDATA; } if (!h->first_field) { if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); } h->cur_pic_ptr = NULL; } } if (!h->current_slice) av_assert0(sl == h->slice_ctx); if (h->current_slice == 0 && !h->first_field) { if ( (h->avctx->skip_frame >= AVDISCARD_NONREF && !h->nal_ref_idc) || (h->avctx->skip_frame >= AVDISCARD_BIDIR && sl->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_frame >= AVDISCARD_NONINTRA && sl->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_frame >= AVDISCARD_NONKEY && h->nal_unit_type != H264_NAL_IDR_SLICE && h->sei.recovery_point.recovery_frame_cnt < 0) || h->avctx->skip_frame >= AVDISCARD_ALL) { return 0; } } if (!first_slice) { const PPS *pps = (const PPS*)h->ps.pps_list[sl->pps_id]->data; if (h->ps.pps->sps_id != pps->sps_id || h->ps.pps->transform_8x8_mode != pps->transform_8x8_mode ) { av_log(h->avctx, AV_LOG_ERROR, "PPS changed between slices\n"); return AVERROR_INVALIDDATA; } if (h->ps.sps != (const SPS*)h->ps.sps_list[h->ps.pps->sps_id]->data) { av_log(h->avctx, AV_LOG_ERROR, "SPS changed in the middle of the frame\n"); return AVERROR_INVALIDDATA; } } if (h->current_slice == 0) { ret = h264_field_start(h, sl, nal, first_slice); if (ret < 0) return ret; } else { if (h->picture_structure != sl->picture_structure || h->droppable != (nal->ref_idc == 0)) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", h->picture_structure, sl->picture_structure); return AVERROR_INVALIDDATA; } else if (!h->cur_pic_ptr) { av_log(h->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", h->current_slice + 1); return AVERROR_INVALIDDATA; } } ret = h264_slice_init(h, sl, nal); if (ret < 0) return ret; h->nb_slice_ctx_queued++; return 0; }
1threat
Configure Postfix to Use Gmail SMTP on Ubuntu : <p>I'm using <a href="https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/" rel="noreferrer">this online guide here</a> to enable simple mail sending from linux (ubuntu) terminal with postfix through some gmail account. I've done the steps listed there:</p> <pre><code>sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules vim /etc/postfix/main.cf </code></pre> <p>And add these lines:</p> <pre><code>relayhost = [smtp.gmail.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem smtp_use_tls = yes </code></pre> <p>Then edit this file:</p> <pre><code>vim /etc/postfix/sasl_passwd </code></pre> <p>To add the lines like it says in the guide:</p> <pre><code>[smtp.gmail.com]:587 USERNAME@gmail.com:PASSWORD </code></pre> <p>(Of course with my own mail and password) then finally:</p> <pre><code>sudo chmod 400 /etc/postfix/sasl_passwd sudo postmap /etc/postfix/sasl_passwd </code></pre> <p>And then:</p> <pre><code>sudo /etc/init.d/postfix reload </code></pre> <p>When I try to send a simple mail nothing happens:</p> <pre><code>echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com </code></pre> <p>(Of course here too with some other valid email)</p> <p>What am I doing wrong? Thanks!</p>
0debug
Shared library in containers : <p>For two processes A and B, the both use the library libc.so, libc.so is loaded into memory only once. This is a normal situation when A and B both run on the same host and the same rootfs.</p> <p>When it comes to container, if A and B are running in different containers, are A and B sharing same memory area?</p> <p>for example</p> <p>imageA</p> <p>--libc.so</p> <p>--programA</p> <p>imageB</p> <p>--libc.so</p> <p>--programB</p> <p>we use <strong>chroot</strong> to run A and B in different rootfs. The two libc.so are same. Will libc.so be loaded into memory twice?</p>
0debug
Get Backstack status using android navigation component : <p>I want to implement backpress behaviour such that it prompts a confirmation popup when you press back with the backstack empty, otherwise it pops the next fragment in the stack.</p> <p>I'm trying to get the backstack count, but i always get 0 from both fragment managers</p> <pre><code> getSupportFragmentManager().getBackStackEntryCount(); getFragmentManager().getBackStackEntryCount(); </code></pre> <p>I guess it should work since i checked the google code of fragment navigator and it adds to backstack through the canonical fragment transaction:</p> <p>FragmentNavigator.java:</p> <pre><code> if (initialNavigation || isClearTask) { backStackEffect = BACK_STACK_DESTINATION_ADDED; } else if (isSingleTopReplacement) { // Single Top means we only want one instance on the back stack if (mBackStack.size() &gt; 1) { // If the Fragment to be replaced is on the FragmentManager's // back stack, a simple replace() isn't enough so we // remove it from the back stack and put our replacement // on the back stack in its place mFragmentManager.popBackStack(); ft.addToBackStack(Integer.toString(destId)); mIsPendingBackStackOperation = true; } backStackEffect = BACK_STACK_UNCHANGED; } else { ft.addToBackStack(Integer.toString(destId)); mIsPendingBackStackOperation = true; backStackEffect = BACK_STACK_DESTINATION_ADDED; } ft.setReorderingAllowed(true); ft.commit(); </code></pre> <p>I didn't find any API to retrieve this information through NavController or Navigator neither.</p> <p>Thanks</p>
0debug
PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) { VirtIONet *n; static int virtio_net_id; n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000, 0, VIRTIO_ID_NET, 0x02, 0x00, 0x00, 6, sizeof(VirtIONet)); if (!n) return NULL; n->vdev.get_config = virtio_net_update_config; n->vdev.get_features = virtio_net_get_features; n->vdev.set_features = virtio_net_set_features; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); memcpy(n->mac, nd->macaddr, 6); n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n); qemu_format_nic_info_str(n->vc, n->mac); n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; register_savevm("virtio-net", virtio_net_id++, 2, virtio_net_save, virtio_net_load, n); return (PCIDevice *)n; }
1threat
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[7], int bsi, int qp ) { int index_a = qp + h->slice_alpha_c0_offset; int alpha = alpha_table[index_a]; int beta = beta_table[qp + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]] + 1; tc[1] = tc0_table[index_a][bS[1*bsi]] + 1; tc[2] = tc0_table[index_a][bS[2*bsi]] + 1; tc[3] = tc0_table[index_a][bS[3*bsi]] + 1; h->h264dsp.h264_h_loop_filter_chroma_mbaff(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_h_loop_filter_chroma_mbaff_intra(pix, stride, alpha, beta); } }
1threat
How to create multi environment DB's with Firestore : <p>I've been looking how to create multiple Firestore instances in Firebase, I need different Db's for prod, staging and development. I read the documentation and seems that I only need to modify the "Google-services.json" file in the applications. what I don't get is what should I modify and how that would look in the console. </p> <ul> <li><p>Am I going to see different instances in the same project?</p></li> <li><p>I need to create different projects for every environment and modify those values in the file?</p></li> <li><p>If I need to test something that requires testing in all environments and all of them require Blaze to run that test do I have to pay Triple?</p></li> </ul> <p>Thanks in advance</p>
0debug
static inline void horizX1Filter(uint8_t *src, int stride, int QP) { int y; static uint64_t *lut= NULL; if(lut==NULL) { int i; lut = av_malloc(256*8); for(i=0; i<256; i++) { int v= i < 128 ? 2*i : 2*(i-256); uint64_t a= (v/16) & 0xFF; uint64_t b= (v*3/16) & 0xFF; uint64_t c= (v*5/16) & 0xFF; uint64_t d= (7*v/16) & 0xFF; uint64_t A= (0x100 - a)&0xFF; uint64_t B= (0x100 - b)&0xFF; uint64_t C= (0x100 - c)&0xFF; uint64_t D= (0x100 - c)&0xFF; lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) | (D<<24) | (C<<16) | (B<<8) | (A); } } for(y=0; y<BLOCK_SIZE; y++){ int a= src[1] - src[2]; int b= src[3] - src[4]; int c= src[5] - src[6]; int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0); if(d < QP){ int v = d * FFSIGN(-b); src[1] +=v/8; src[2] +=v/4; src[3] +=3*v/8; src[4] -=3*v/8; src[5] -=v/4; src[6] -=v/8; } src+=stride; } }
1threat
void virtio_queue_set_align(VirtIODevice *vdev, int n, int align) { BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { error_report("tried to modify queue alignment for virtio-1 device"); return; } assert(k->has_variable_vring_alignment); vdev->vq[n].vring.align = align; virtio_queue_update_rings(vdev, n); }
1threat
void helper_slbie(CPUPPCState *env, target_ulong addr) { PowerPCCPU *cpu = ppc_env_get_cpu(env); ppc_slb_t *slb; slb = slb_lookup(cpu, addr); if (!slb) { return; } if (slb->esid & SLB_ESID_V) { slb->esid &= ~SLB_ESID_V; env->tlb_need_flush |= TLB_NEED_LOCAL_FLUSH; } }
1threat
Object reference not set to instance of object in array : <p>I am making a random object spawn system for my game. The error I'm running into is when assigning the spawns and objects to an array. I am doing this so that a random number generator can pick one from the array to use. However I am getting the error message </p> <p><code>NullReferenceException: Object reference not set to an instance of an object RandomSpawn.Start () (at Assets/RandomSpawn.cs:26) </code></p> <p>The area that it is coming up in is my start function where I am assigning the spawns and objects to their arrays.</p> <pre><code>public Transform spawn1; public Transform spawn2; public Transform spawn3; public GameObject obj1; public GameObject obj2; public GameObject obj3; private Transform[] spawns; private GameObject[] objects; private bool[] spawnUsed; private bool[] objectUsed; private int randomRun = 0; void Start() { spawns[0] = spawn1; spawns[1] = spawn2; spawns[2] = spawn3; objects[0] = obj1; objects[1] = obj2; objects[2] = obj3; } </code></pre> <p>I am not sure why I am getting the error as I cannot see any mistakes in how I am assigning them. The variables are the same variables as the arrays that I am assigning them too. I have made sure that they are all attached to the correct part of the script in Unity too.</p>
0debug
int sclp_service_call(CPUS390XState *env, uint32_t sccb, uint64_t code) { int r = 0; int shift = 0; #ifdef DEBUG_HELPER printf("sclp(0x%x, 0x%" PRIx64 ")\n", sccb, code); #endif if (sccb & ~0x7ffffff8ul) { fprintf(stderr, "KVM: invalid sccb address 0x%x\n", sccb); r = -1; goto out; } switch(code) { case SCLP_CMDW_READ_SCP_INFO: case SCLP_CMDW_READ_SCP_INFO_FORCED: while ((ram_size >> (20 + shift)) > 65535) { shift++; } stw_phys(sccb + SCP_MEM_CODE, ram_size >> (20 + shift)); stb_phys(sccb + SCP_INCREMENT, 1 << shift); stw_phys(sccb + SCP_RESPONSE_CODE, 0x10); if (kvm_enabled()) { #ifdef CONFIG_KVM kvm_s390_interrupt_internal(env, KVM_S390_INT_SERVICE, sccb & ~3, 0, 1); #endif } else { env->psw.addr += 4; ext_interrupt(env, EXT_SERVICE, sccb & ~3, 0); } break; default: #ifdef DEBUG_HELPER printf("KVM: invalid sclp call 0x%x / 0x%" PRIx64 "x\n", sccb, code); #endif r = -1; break; } out: return r; }
1threat
#C [Warning] assignment from incompatible pointer type : this is my school project and i only make skeleton but compiler says "[Warning] assignment from incompatible pointer type" i change some pointers but it cant works anyone can help me? #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int *col_num,*row_num,**matrix; double k,l; int i,j; printf("Enter your column number:\n"); scanf("%d",&col_num); printf("Enter your row number:\n"); scanf("%d",&row_num); matrix[*col_num] = (int **)malloc(*col_num * sizeof(int)); if (matrix[*col_num]==NULL) printf("No free Memory!"); matrix[*row_num] = (int **)malloc(*row_num * sizeof(int)); if(matrix[*row_num]==NULL) printf("No free Memory!"); for(i=0;i<*col_num;i++) for(j=0;j<*row_num;j++){ printf("Please Enter %d%d matrix:",i+1,j+1); scanf("%lf",&matrix[i][j]); } for(i=0; i<*col_num; i++){ for(j=0; j<*row_num; j++){ printf("%d ", matrix[i][j]); } printf("\n"); } free(matrix); return 0; }
0debug
Mathematical expressions with Floating points : <p>Hello I'm a sort of newbie in Python 2.What is the simplest way to take input and print the result of a mathematical expression which has decimals? For some reason i keep getting a syntax error.Here's the code im trying to run to calculate the mean:</p> <pre><code>a = input() b = input() c = input() print "MEDIA = %.1f\n"%(((a*2)+(b*3)+(c*5))/(10))) </code></pre>
0debug
int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename) { AVFormatContext *s = avformat_alloc_context(); int ret = 0; *avctx = NULL; if (!s) goto nomem; if (!oformat) { if (format) { oformat = av_guess_format(format, NULL, NULL); if (!oformat) { av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); ret = AVERROR(EINVAL); goto error; } } else { oformat = av_guess_format(NULL, filename, NULL); if (!oformat) { ret = AVERROR(EINVAL); av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename); goto error; } } } s->oformat = oformat; if (s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); if (!s->priv_data) goto nomem; if (s->oformat->priv_class) { *(const AVClass**)s->priv_data= s->oformat->priv_class; av_opt_set_defaults(s->priv_data); } } else s->priv_data = NULL; if (filename) av_strlcpy(s->filename, filename, sizeof(s->filename)); *avctx = s; return 0; nomem: av_log(s, AV_LOG_ERROR, "Out of memory\n"); ret = AVERROR(ENOMEM); error: avformat_free_context(s); return ret; }
1threat
Changing integer into object for submission(Python) : [enter image description here][1] [1]: https://i.stack.imgur.com/0hsYy.png For submission I want to convert the second column in categorical data . I tried for for i in column: if i==0: return i='Orange'
0debug
Convert arrays of string in R : I have an array of string as given below, I want to convert both array in data frame to use in R. Can anyone help me/ suggest me How can I do it?s str1=["6203811823616", "0", "6196564066304", "0", "6196564066304", "0", "6196564066304", "0", "6196564066304", "0", "6196564066304", "0", "6196564066304", "0", "6196564066304", "0", "6203811823616"] str2=["6203811823616, 0, 6196564066304, 0, 6196564066304, 0, 6196564066304, 0, 6196564066304, 0, 6196564066304, 0, 6196564066304, 0, 6196564066304, 0"]
0debug
What is the true maximum (and minimum) value of Random.nextGaussian()? : <p>In theory, the bounds for <code>nextGaussian</code> are meant to be positive and negative infinity. But since <code>Random.nextDouble</code>, which is used to calculate the Gaussian random number, doesn't come infinitely close to 0 and 1, there is a practical limit to <code>nextGaussian</code>. And <code>Random.next</code> is also not a perfectly uniform distribution.</p> <p>It was theorised that the maximum should be about 2.2042*10^17 and related to the 53 bit shift of <code>nextDouble</code> (<a href="https://media.discordapp.net/attachments/508317357228294146/545718295408541716/unknown.png" rel="noreferrer">reference</a>), but that is likely just an upper bound.</p> <p>The answer probably depends on the distribution of <code>Random.next</code> and the exact implementation of <code>StrictMath.sqrt</code> and <code>StrictMath.log</code>. I couldn't find much information about either.</p> <p>And yes, I know that the outer values are extremely unlikely, but it can be relevant, for example in the context of RNG manipulation in games.</p>
0debug
Python is stopping before running a loop : <p>I'm having trouble with this code. It will run normally until it gets to the loop (def Game) and just stops there. I did have it as an if statement but that still didn't work. Please note that this may be a bit messy.</p> <pre><code>import random import time GameInProgress = ("Yes") TutorialDone = ("No") ReplayGame = ("Yes") #Test purposes PlayerName = ("Lewis") print ("Welcome to 'Guess The Word!") def Game(): GameInProgress = ("Yes") TutorialDone = ("No") ReplayGame = ("Yes") #Test purposes PlayerName = ("Lewis") print ("Welcome to 'Guess The Word!") WordSelected=("No") LettersGuessed=0 print (TutorialDone) EnterName = input("Would you like to enter your name?").title() </code></pre>
0debug
Create a sql sequence programmatically in Java : <p>I need to create a sql sequence in sql server programmatically from Java and I should be able to retrieve the continuous value from the sequence to program. First of all can I do so? If so how?</p>
0debug
How to get the name of a created object (not the class itself) in Python 3.X : <p>I've always wondered if when you define a variable, you can somehow get the name you defined it with, and manipulate it as a string. I am trying to make some code more efficient in doing this.</p> <p>I looked this up and didn't seem to hit the spot with what I found. I found some code that can retrieve the name of the class itself, but not the name of the created object.</p> <pre><code>class A: @classmethod def getname(cls): return cls.__name__ def usename(self): return self.getname() &gt;&gt; example = A() &gt;&gt; print (example.usename()) A </code></pre> <p>I thought I would get a result looking like this: </p> <pre><code>example </code></pre> <p>It being literally the name of the object, not the class.</p> <p>Is there a way of doing this? If there is, I would really appreciate it. </p> <p>PS: if this question turns out to be a duplicate, sorry, would love it if ya'll point me to the answer :) and not delete this.</p>
0debug
static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { vorbis_enc_context *venc = avctx->priv_data; int i, ret, need_more; int frame_size = 1 << (venc->log2_blocksize[1] - 1); vorbis_enc_mode *mode; vorbis_enc_mapping *mapping; PutBitContext pb; if (frame) { if ((ret = ff_af_queue_add(&venc->afq, frame)) < 0) return ret; ff_bufqueue_add(avctx, &venc->bufqueue, av_frame_clone(frame)); } else if (!venc->afq.remaining_samples) return 0; need_more = venc->bufqueue.available * avctx->frame_size < frame_size; need_more = frame && need_more; if (need_more) return 0; if (!frame) { if (venc->bufqueue.available * avctx->frame_size < frame_size) { int frames_needed = (frame_size/avctx->frame_size) - venc->bufqueue.available; int i; for (i = 0; i < frames_needed; i++) { AVFrame *empty = spawn_empty_frame(avctx, venc->channels); if (!empty) return AVERROR(ENOMEM); ff_bufqueue_add(avctx, &venc->bufqueue, empty); } } } move_audio(venc, avctx->frame_size); if (!apply_window_and_mdct(venc)) return 0; if ((ret = ff_alloc_packet2(avctx, avpkt, 8192, 0)) < 0) return ret; init_put_bits(&pb, avpkt->data, avpkt->size); if (pb.size_in_bits - put_bits_count(&pb) < 1 + ilog(venc->nmodes - 1)) { av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n"); return AVERROR(EINVAL); } put_bits(&pb, 1, 0); put_bits(&pb, ilog(venc->nmodes - 1), 1); mode = &venc->modes[1]; mapping = &venc->mappings[mode->mapping]; if (mode->blockflag) { put_bits(&pb, 1, 1); put_bits(&pb, 1, 1); } for (i = 0; i < venc->channels; i++) { vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]]; uint16_t posts[MAX_FLOOR_VALUES]; floor_fit(venc, fc, &venc->coeffs[i * frame_size], posts, frame_size); if (floor_encode(venc, fc, &pb, posts, &venc->floor[i * frame_size], frame_size)) { av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n"); return AVERROR(EINVAL); } } for (i = 0; i < venc->channels * frame_size; i++) venc->coeffs[i] /= venc->floor[i]; for (i = 0; i < mapping->coupling_steps; i++) { float *mag = venc->coeffs + mapping->magnitude[i] * frame_size; float *ang = venc->coeffs + mapping->angle[i] * frame_size; int j; for (j = 0; j < frame_size; j++) { float a = ang[j]; ang[j] -= mag[j]; if (mag[j] > 0) ang[j] = -ang[j]; if (ang[j] < 0) mag[j] = a; } } if (residue_encode(venc, &venc->residues[mapping->residue[mapping->mux[0]]], &pb, venc->coeffs, frame_size, venc->channels)) { av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n"); return AVERROR(EINVAL); } flush_put_bits(&pb); avpkt->size = put_bits_count(&pb) >> 3; ff_af_queue_remove(&venc->afq, frame_size, &avpkt->pts, &avpkt->duration); if (frame_size > avpkt->duration) { uint8_t *side = av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10); if (!side) return AVERROR(ENOMEM); AV_WL32(&side[4], frame_size - avpkt->duration); } *got_packet_ptr = 1; return 0; }
1threat
static void usb_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); k->bus_type = TYPE_USB_BUS; k->init = usb_qdev_init; k->unplug = qdev_simple_unplug_cb; k->exit = usb_qdev_exit; k->props = usb_props; }
1threat
How to iterate through this three dimensional array : <p>Assuming I have three arrays:</p> <pre><code>array1 = [1,2,3,4]; array2 = [5,6,7]; array3 = [8,9,10,11]; </code></pre> <p>and would like to get an output like this:</p> <pre><code>1,5,8,2,6,9,3,7,10,4,11 </code></pre> <p>Therefore outputting the items in the array vertically. </p> <pre><code>|---------------------| | 1 2 3 4 | | 5 6 7 | | 8 9 10 11 | |---------------------| </code></pre> <p>What is the most efficient way to get the output?</p>
0debug
void qmp_drive_mirror(const char *device, const char *target, bool has_format, const char *format, bool has_node_name, const char *node_name, bool has_replaces, const char *replaces, enum MirrorSyncMode sync, bool has_mode, enum NewImageMode mode, bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, bool has_unmap, bool unmap, Error **errp) { BlockBackend *blk; BlockDriverState *bs; BlockDriverState *source, *target_bs; AioContext *aio_context; BlockDriver *drv = NULL; Error *local_err = NULL; QDict *options = NULL; int flags; int64_t size; int ret; if (!has_speed) { speed = 0; } if (!has_on_source_error) { on_source_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_on_target_error) { on_target_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_mode) { mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } if (!has_granularity) { granularity = 0; } if (!has_buf_size) { buf_size = 0; } if (!has_unmap) { unmap = true; } if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "a value in range [512B, 64MB]"); return; } if (granularity & (granularity - 1)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2"); return; } blk = blk_by_name(device); if (!blk) { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", device); return; } bs = blk_bs(blk); aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); if (!bdrv_is_inserted(bs)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); goto out; } if (!has_format) { format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name; } if (format) { drv = bdrv_find_format(format); if (!drv) { error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format); goto out; } } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_MIRROR, errp)) { goto out; } flags = bs->open_flags | BDRV_O_RDWR; source = bs->backing_hd; if (!source && sync == MIRROR_SYNC_MODE_TOP) { sync = MIRROR_SYNC_MODE_FULL; } if (sync == MIRROR_SYNC_MODE_NONE) { source = bs; } size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); goto out; } if (has_replaces) { BlockDriverState *to_replace_bs; AioContext *replace_aio_context; int64_t replace_size; if (!has_node_name) { error_setg(errp, "a node-name must be provided when replacing a" " named node of the graph"); goto out; } to_replace_bs = check_to_replace_node(replaces, &local_err); if (!to_replace_bs) { error_propagate(errp, local_err); goto out; } replace_aio_context = bdrv_get_aio_context(to_replace_bs); aio_context_acquire(replace_aio_context); replace_size = bdrv_getlength(to_replace_bs); aio_context_release(replace_aio_context); if (size != replace_size) { error_setg(errp, "cannot replace image with a mirror image of " "different size"); goto out; } } if ((sync == MIRROR_SYNC_MODE_FULL || !source) && mode != NEW_IMAGE_MODE_EXISTING) { assert(format && drv); bdrv_img_create(target, format, NULL, NULL, NULL, size, flags, &local_err, false); } else { switch (mode) { case NEW_IMAGE_MODE_EXISTING: break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: bdrv_img_create(target, format, source->filename, source->drv->format_name, NULL, size, flags, &local_err, false); break; default: abort(); } } if (local_err) { error_propagate(errp, local_err); goto out; } if (has_node_name) { options = qdict_new(); qdict_put(options, "node-name", qstring_from_str(node_name)); } target_bs = NULL; ret = bdrv_open(&target_bs, target, NULL, options, flags | BDRV_O_NO_BACKING, drv, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto out; } bdrv_set_aio_context(target_bs, aio_context); mirror_start(bs, target_bs, has_replaces ? replaces : NULL, speed, granularity, buf_size, sync, on_source_error, on_target_error, unmap, block_job_cb, bs, &local_err); if (local_err != NULL) { bdrv_unref(target_bs); error_propagate(errp, local_err); goto out; } out: aio_context_release(aio_context); }
1threat
how to make generator link with javascript, example like autoddl.com site : i want make generator link with javascript, example like this site is autoddl.com. but I just want to change the domain only, for example: **www.qwerty.com**/detail/dsa8e2w2a1 to **www.download.com**/detail/dsa8e2w2a1 ~ > /detail/dsa8e2w2a1 < is unchanged, only the primary domain being changed. help please im tired search on google, but idk the keyword.
0debug
static void device_set_realized(Object *obj, bool value, Error **errp) { DeviceState *dev = DEVICE(obj); DeviceClass *dc = DEVICE_GET_CLASS(dev); HotplugHandler *hotplug_ctrl; BusState *bus; Error *local_err = NULL; bool unattached_parent = false; static int unattached_count; if (dev->hotplugged && !dc->hotpluggable) { error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj)); return; } if (value && !dev->realized) { if (!obj->parent) { gchar *name = g_strdup_printf("device[%d]", unattached_count++); object_property_add_child(container_get(qdev_get_machine(), "/unattached"), name, obj, &error_abort); unattached_parent = true; g_free(name); } hotplug_ctrl = qdev_get_hotplug_handler(dev); if (hotplug_ctrl) { hotplug_handler_pre_plug(hotplug_ctrl, dev, &local_err); if (local_err != NULL) { goto fail; } } if (dc->realize) { dc->realize(dev, &local_err); } if (local_err != NULL) { goto fail; } DEVICE_LISTENER_CALL(realize, Forward, dev); if (hotplug_ctrl) { hotplug_handler_plug(hotplug_ctrl, dev, &local_err); } if (local_err != NULL) { goto post_realize_fail; } if (qdev_get_vmsd(dev)) { vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev, dev->instance_id_alias, dev->alias_required_for_version, NULL); } QLIST_FOREACH(bus, &dev->child_bus, sibling) { object_property_set_bool(OBJECT(bus), true, "realized", &local_err); if (local_err != NULL) { goto child_realize_fail; } } if (dev->hotplugged) { device_reset(dev); } dev->pending_deleted_event = false; } else if (!value && dev->realized) { Error **local_errp = NULL; QLIST_FOREACH(bus, &dev->child_bus, sibling) { local_errp = local_err ? NULL : &local_err; object_property_set_bool(OBJECT(bus), false, "realized", local_errp); } if (qdev_get_vmsd(dev)) { vmstate_unregister(dev, qdev_get_vmsd(dev), dev); } if (dc->unrealize) { local_errp = local_err ? NULL : &local_err; dc->unrealize(dev, local_errp); } dev->pending_deleted_event = true; DEVICE_LISTENER_CALL(unrealize, Reverse, dev); } if (local_err != NULL) { goto fail; } dev->realized = value; return; child_realize_fail: QLIST_FOREACH(bus, &dev->child_bus, sibling) { object_property_set_bool(OBJECT(bus), false, "realized", NULL); } if (qdev_get_vmsd(dev)) { vmstate_unregister(dev, qdev_get_vmsd(dev), dev); } post_realize_fail: if (dc->unrealize) { dc->unrealize(dev, NULL); } fail: error_propagate(errp, local_err); if (unattached_parent) { object_unparent(OBJECT(dev)); unattached_count--; } }
1threat
How to encapsulate .NET Stateless state machine : <p>I have a project where there is a mostly linear workflow. I'm attempting to use the .NET Stateless <a href="https://github.com/dotnet-state-machine/stateless" rel="noreferrer">library</a> to act as workflow engine/state machine. The number of examples out there is limited, but I've put together the following code:</p> <pre><code>private StateMachine&lt;WorkflowStateType, WorkflowStateTrigger&gt; stateMachine; private StateMachine&lt;WorkflowStateType, WorkflowStateTrigger&gt;.TriggerWithParameters&lt;Guid, DateTime&gt; registrationTrigger; private Patient patient; public Patient RegisterPatient(DateTime dateOfBirth) { configureStateMachine(WorkflowState.Unregistered); stateMachine.Fire&lt;DateTime&gt;(registrationTrigger, dateOfBirth); logger.Info("State changed to: " + stateMachine.State); return patient; } private void configureStateMachine(WorkflowState state) { stateMachine = new StateMachine&lt;WorkflowState, WorkflowTrigger&gt;(state); registrationTrigger = stateMachine.SetTriggerParameters&lt;DateTime&gt;(WorkflowTrigger.Register); stateMachine.Configure(WorkflowState.Unregistered) .Permit(WorkflowTrigger.Register, WorkflowStateType.Registered); stateMachine.Configure(WorkflowState.Registered) .Permit(WorkflowTrigger.ScheduleSampling, WorkflowState.SamplingScheduled) .OnEntryFrom(registrationTrigger, (dateOfBirth) =&gt; registerPatient(dateOfBirth)); } private void registerPatient(DateTime dateOfBirth) { //Registration code } </code></pre> <p>As you can see, I'm using the Stateless Fire() overload that allows me to pass in a trigger. This is so I can have the state machine process business logic, in this case, code to register a new patient.</p> <p>This all works, but now I'd like to move all the state machine code into another class to encapsulate it and I'm having trouble doing this. The challenges I've had in doing this are:</p> <ul> <li>instantiating a <code>StateMachine</code> object requires you to specify state and <code>State</code> is a readonly property that can only be set at instantiation.</li> <li>my <code>registrationTrigger</code> has to be instantiated during state machine configuration and also has to be available by the calling class.</li> </ul> <p>How can I overcome these items and encapsulate the state machine code?</p>
0debug
Java performs the increment operation after return on object references : <p>I have this code : </p> <pre><code>public class counter { public static void main(String[] args){ double[] array = new double[10]; for(int i=0;i&lt;array.length;i++) array[i] = i; printArray(array); double result = doSomething(array); printArray(array); } public static void printArray(double[] arr){ for(double d : arr) System.out.println(d); } public static double doSomething(double[] array){ return array[0]++; } } </code></pre> <p>I have learned that after the return statement no more code is executed and the increment++ increments the value at the next expression. So it seems logical to me that the the first element of the array <code>array[0]</code> should not be incremented.</p> <p>However the output array is {1,1,2,3,4,5,6,7,8,9} </p>
0debug
Composer uses wrong php version, but php -v shows the correct one (Ubuntu) : <p>I'm trying to install my composer packages, but it gives me this:</p> <p><code>This package requires php &gt;=7.0.0 but your PHP version (5.5.9)</code></p> <p>But <code>php -v</code> gives me this: <code>PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )</code></p> <p>I am running an Ubuntu 16.04.3 LTS machine, I found some soultions for Mac and Windows, but nobody seems to have the issue on Linux?</p>
0debug
Change spacing of dashes in dashed line in matplotlib : <p>In Python, using matplotlib, is there a way to change the distance of the dashes for different linestyles, for example, using the following command:</p> <pre><code>plt.plot(x,y,linestyle='--') </code></pre>
0debug
How many IN, OUT and IN OUT parameters can be used in pl sql function and procedure? : <p>I want to know how many IN, OUT and IN OUT parameters can be used in a function and how many in a procedure?</p>
0debug
How does C++ proceed for += with a variable without value? : <p>i am currently learning C++ and i had a question about some "weird" things i noticed while testing what i have learnt.</p> <p>So i use this :</p> <pre><code>int marc[9]; int sum = 0; for (int x =0; x &lt; 9; x++) { marc[x] = x*4; sum += marc[x]; } cout &lt;&lt; sum &lt;&lt; endl; </code></pre> <p>And i get a normal result which is 144</p> <p>However, if i changed</p> <pre><code>int sum = 0; </code></pre> <p>to </p> <pre><code>int sum; </code></pre> <p>I got a crazy result like 19557555002</p> <p>So i was wondering what is happening in the second case?</p> <p>Thanks for your answer :)</p>
0debug
object oriented approach in simple program : <p>I'm trying to make a simple program with Student class and several methods in main class doing job (list, create and Write to file, del item, add item, search and sort items). it's running good but, I wish to have it in more 'clean way' or 'object oriented' way so to speak. Any ideas how to improve it a bit? Below is the code. Thanks for any suggestions!</p> <pre><code>public class SimpleDB { static FileWriter fstream; static BufferedWriter out; public static ArrayList&lt;Student&gt; students; static Scanner menuSc; static File file; static Scanner nameOfFile; static FileWriter wr; static Scanner addNameAndEmail; static Scanner sort; static Scanner search; public static void createWriteToFile() { try { String aktDir = System.getProperty("user.dir");// the directory where app (java) was started (working dir) //System.out.println("Aktual dir&gt;" + aktDir); System.out.println("Please enter name of file ...\n"); nameOfFile = new Scanner(System.in); String nof = nameOfFile.nextLine(); file = new File(nof); if (!file.exists()) { System.out.println("Creating new file : " + nof); } try { //create new file file.createNewFile(); } catch (IOException ex) { Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("Writing to file " + nof); try { wr = new FileWriter(nof); } catch (IOException ex) { Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex); } for (Student stu : students) { try { wr.write(stu.toString()); } catch (IOException ex) { Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex); } } wr.close(); } catch (IOException ex) { Logger.getLogger(SimpleDB.class.getName()).log(Level.SEVERE, null, ex); } } public static void sort() { boolean b = true; while (true) { System.out.println("Sorting&gt; by name: type N, by email: type E, for exit: type X \n"); sort = new Scanner(System.in); String s = sort.nextLine(); switch (s) { case "N": System.out.println("Sorting by name....: \n"); students.sort((Student s1, Student s2) -&gt; { return s1.getName().compareToIgnoreCase(s2.getName()); }); System.out.println("Sorted by name&gt; \n" + students); break; case "E": System.out.println("Sorting by mail....: \n"); students.sort((Student s1, Student s2) -&gt; { return s1.getEmail().compareToIgnoreCase(s2.getEmail()); }); System.out.println("Sorted list&gt; \n" + students); break; case "X": System.out.println("Returning to main menu..."); b = false; return; default: System.out.println("Please enter correct choice! "); break; } } } public static void search() { System.out.println("Enter a name you want to search&gt; \n"); search = new Scanner(System.in); boolean bol = false; String se = search.next(); for (int i = 0; i &lt; students.size(); i++) { if (se.equalsIgnoreCase(students.get(i).getName())) { bol = true; break; } } if (bol) { System.out.println("found"); } else { System.out.println("not found"); } } private static void add() { addNameAndEmail = new Scanner(System.in); System.out.println("Please enter a name: "); String n = addNameAndEmail.nextLine(); System.out.println("Please enter an email: "); String e = addNameAndEmail.nextLine(); students.add(new Student(n, e)); System.out.println("\n" + "new student " + students); } public static void list() { System.out.println("List of Students&gt; "); String l = null; for (Student stu : students) { System.out.println(stu); } } public static char menu() { System.out.println("" + " 'A' list, 'B' add, 'C' save to file, 'D' search, 'E' sort data, 'F' exit from program &gt; "); menuSc = new Scanner(System.in); String c = menuSc.nextLine(); if (c.isEmpty()) { return ' '; } //Files.copy(null, null, options) return c.toUpperCase().charAt(0); } public static void main(String[] args) throws IOException { // some students added students = new ArrayList&lt;&gt;(); students.add(new Student("alan", "alan@gmail.com")); students.add(new Student("michael", "michael@gmail.com")); students.add(new Student("peter", "peter@gmail.com")); students.add(new Student("andrew", "andrew@gmail.com")); boolean a = true; while (a = true) { char c = menu(); switch (c) { case 'A': list(); break; case 'B': add(); break; case 'C': createWriteToFile(); break; case 'E': sort(); break; case 'D': search(); break; case 'F': System.out.println("Good Bye!"); a = false; return; } } } } </code></pre>
0debug
How to stop a running query? : <p>I use RODBC to send queries to an SQL-Server. Sometimes they take too much time to run, so I need to cancel them.</p> <p>Clicking the red "stop" button in RStudio yields this error message:</p> <blockquote> <p>R is not responding to your request to interrupt processing so to stop the current operation you may need to terminate R entirely.</p> <p>Terminating R will cause your R session to immediately abort. Active computations will be interrupted and unsaved source file changes and workspace objects will be discarded.</p> <p>Do you want to terminate R now?</p> </blockquote> <p>And if I click yes my session is indeed terminated. (note: using Rgui instead of RStudio doesn't make things better)</p> <p>However:</p> <ul> <li><p>when I use another software (named "Query ExPlus") to connect to this same SQL-Server, I have a similar stop button, and clicking it instantly interrupts the query, without any crash.</p></li> <li><p>when I connect to a PostgreSQL database using the RPostgres package I can also interrupt the query at any time.</p></li> </ul> <p>These two points lead me to think that there should be a way to solve my problem. What can I do?</p> <p>So far my workaround is:</p> <pre><code>library(RODBC) library(R.utils) withTimeout(mydf &lt;- sqlQuery(myconnection, myquery), timeout=120) </code></pre> <p><strong>Note:</strong> I don't have permission to kill queries from the database side.</p>
0debug
void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, unsigned priority) { sysbus_mmio_map_common(dev, n, addr, true, priority); }
1threat
Git hooks in Visual Studio? : <p>I would like to implement client-side git hook (type of commit-msg) to validate commit message. I have done a working hook - it works perfectly when using git console. But Visual Studio 2015 git build-in plugin (Team Explorer) seems not to take it into account and simply skip those hooks.</p> <p>Has anyone tried to do the same with success? I read the Internet and it seems the problem is not solved, but I believie in You! :) </p> <p>I want to check if commit message contain jira issue key. </p>
0debug
Keras early stopping callback error, val_loss metric not available : <p>I am training a Keras (Tensorflow backend, Python, on MacBook) and am getting an error in the early stopping callback in fit_generator function. The error is as follows:</p> <pre><code>RuntimeWarning: Early stopping conditioned on metric `val_loss` which is not available. Available metrics are: (self.monitor, ','.join(list(logs.keys()))), RuntimeWarning: Can save best model only with val_acc available, skipping. 'skipping.' % (self.monitor), RuntimeWarning [local-dir]/lib/python3.6/site-packages/keras/callbacks.py:497: RuntimeWarning: Early stopping conditioned on metric `val_loss` which is not available. Available metrics are: (self.monitor, ','.join(list(logs.keys()))), RuntimeWarning [local-dir]/lib/python3.6/site-packages/keras/callbacks.py:406: RuntimeWarning: Can save best model only with val_acc available, skipping. 'skipping.' % (self.monitor), RuntimeWarning) Traceback (most recent call last): : [my-code] : File "[local-dir]/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "[local-dir]/lib/python3.6/site-packages/keras/engine/training.py", line 2213, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "[local-dir]/lib/python3.6/site-packages/keras/callbacks.py", line 76, in on_epoch_end callback.on_epoch_end(epoch, logs) File "[local-dir]/lib/python3.6/site-packages/keras/callbacks.py", line 310, in on_epoch_end self.progbar.update(self.seen, self.log_values, force=True) AttributeError: 'ProgbarLogger' object has no attribute 'log_values' </code></pre> <p>My code is as follows (which looks OK):</p> <pre><code>: ES = EarlyStopping(monitor="val_loss", min_delta=0.001, patience=3, mode="min", verbose=1) : self.model.fit_generator( generator = train_batch, validation_data = valid_batch, validation_steps = validation_steps, steps_per_epoch = steps_per_epoch, epochs = epochs, callbacks = [ES], verbose = 1, workers = 3, max_queue_size = 8) </code></pre> <p>The error message appears to relate to the early stopping callback but the callback looks OK. Also the error states that the val_loss is not appropriate, but I am not sure why... one more unusual thing about this is that the error only occurs when I use smaller data sets.</p> <p>Any help is appreciated.</p>
0debug
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe) { SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; int start = 0, count = 0, w, w2, g, i; const float freq_mult = avctx->sample_rate/(1024.0f/sce0->ics.num_windows)/2.0f; if (!cpe->common_window) return; for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; for (g = 0; g < sce0->ics.num_swb; g++) { if (start*freq_mult > INT_STEREO_LOW_LIMIT*(s->lambda/170.0f) && cpe->ch[0].band_type[w*16+g] != NOISE_BT && !cpe->ch[0].zeroes[w*16+g] && cpe->ch[1].band_type[w*16+g] != NOISE_BT && !cpe->ch[1].zeroes[w*16+g]) { float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; struct AACISError ph_err1, ph_err2, *erf; if (sce0->band_type[w*16+g] == NOISE_BT || sce1->band_type[w*16+g] == NOISE_BT) { start += sce0->ics.swb_sizes[g]; continue; } for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { float coef0 = fabsf(sce0->pcoeffs[start+(w+w2)*128+i]); float coef1 = fabsf(sce1->pcoeffs[start+(w+w2)*128+i]); ener0 += coef0*coef0; ener1 += coef1*coef1; ener01 += (coef0 + coef1)*(coef0 + coef1); } } ph_err1 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, -1); ph_err2 = ff_aac_is_encoding_err(s, cpe, start, w, g, ener0, ener1, ener01, 0, +1); erf = ph_err1.error < ph_err2.error ? &ph_err1 : &ph_err2; if (erf->pass) { cpe->is_mask[w*16+g] = 1; cpe->ch[0].is_ener[w*16+g] = sqrt(ener0/ener01); cpe->ch[1].is_ener[w*16+g] = ener0/ener1; cpe->ch[1].band_type[w*16+g] = erf->phase ? INTENSITY_BT : INTENSITY_BT2; count++; } } start += sce0->ics.swb_sizes[g]; } } cpe->is_mode = !!count; }
1threat