problem
stringlengths
26
131k
labels
class label
2 classes
Why am I getting an error on this one line? : <p>Why am I getting an error on the line that says <code>userInput = (EditText) findViewById(R.id.editText);</code>? I feel like this work, the IDs match in both files.</p> <p>Here's the <code>MainActivity.java</code> file</p> <pre><code>package org.example.someone.tamsky; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.*; public class MainActivity extends AppCompatActivity { private EditText userInput; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } userInput = (EditText) findViewById(R.id.editText); } </code></pre> <p>Here's the <code>activity_main.xml</code> file</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="org.example.garen.tamsky.MainActivity"&gt; &lt;TextView android:text="Welcome to WOMP!" android:layout_width="125dp" android:layout_height="17dp" tools:layout_editor_absoluteY="8dp" android:id="@+id/textView" android:layout_marginStart="16dp" app:layout_constraintLeft_toLeftOf="parent" android:layout_marginLeft="16dp" android:layout_marginEnd="16dp" app:layout_constraintRight_toRightOf="parent" android:layout_marginRight="16dp"/&gt; &lt;EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="Name" android:ems="10" android:id="@+id/editText" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView" app:layout_constraintLeft_toLeftOf="parent"/&gt; &lt;EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="Password" android:ems="10" android:id="@+id/editText2" app:layout_constraintRight_toRightOf="parent" android:layout_marginTop="8dp" app:layout_constraintTop_toBottomOf="@+id/editText" app:layout_constraintLeft_toLeftOf="parent"/&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre>
0debug
JQUERY + POST METHOD PHP : I've write these 2 simple php code, to test php with jqeury: **FILE aaa.php** <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <form action="bbb.php" method="POST"> <p>Il tuo Nome: <input type="text" name="name" value="" /></p> <p>La tua et: <input type="text" name="age" value ="" /></p> <p><input type="submit"></p> </form> </body> </html> **FILE bbb.php** Ciao <?php echo htmlspecialchars($_POST['name']); ?>. La tua eta e di <?php echo (int)$_POST['age']; ?> anni. But it dosen't works, because i don't receive any variable on bbb.php.... Someone could explain me why? Thanks mb
0debug
Best performance: count in a loop or outside? : <p>Perhaps this question has been asked several times but I can't find a proper answer here or in Google so apologies if this is a dupe or something like that but here I go... </p> <p>What's the best way to achieve performance in a loop:</p> <ol> <li><p><code>count($var)</code> each time</p> <pre><code>for ($i=0;$i&lt;count($var);$i++) { // do something } </code></pre></li> <li><p>put a var outside and use that var:</p> <pre><code>$cnt = count($var); for ($i=0;$i&lt;$var;$i++) { // do something } </code></pre></li> </ol> <p>Is there any PHP script or code to show execution times and so on? I mean something for benchmark and see the results on this cases?</p>
0debug
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually : <p>Im using Cordova in Linux mint 17 </p> <p>I installed android sdk , cordova , android studio , nodejs 4 </p> <p>problem is here when i wanna build app in codova and run this on terminal :</p> <p>sudo cordova build android</p> <p>it shows </p> <pre><code>Running command: /home/tnt/hello12/platforms/android/cordova/build [Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.] ERROR building one of the platforms: Error: /home/tnt/hello12/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /home/tnt/hello12/platforms/android/cordova/build: Command failed with exit code 2 </code></pre> <p>I put this code </p> <pre><code> export HOME="/home/tnt" export ANDROID_HOME="$HOME/android/sdk/tools" export ANDROID_PLATFORM_TOOLS="$HOME/android/sdk/platform-tools" export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH" export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64" export ANT_HOME="/usr/share/ant" export PATH="$ANT_HOME/bin:$PATH" export ANDROID_HOME="/home/tnt/android/sdk/tools" </code></pre> <p>on my </p> <pre><code>/home/tnt/.bash_profile /home/tnt/.bashrc /home/tnt/.profile /root/.bash_profile /root/.bashrc /root/.profile </code></pre> <p>but it wont works</p>
0debug
Finding the index position of an array : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var cars = ["BMW", "BENZ", "LAMB", "AUDI"]; var abc = cars.indexOf("BMW"); document.getElementById("demo").innerHTML = abc;</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p id="demo"&gt;&lt;/p&gt;</code></pre> </div> </div> </p> <p>This is the code where it displays the position but I want reverse of this that is if I enter a position it should display the array value. How to get that?</p>
0debug
I am working on android so that i am coding to the edit text. after the code the text is just like something blinded in it. what i want to do for that : [enter image description here][1] As in my attachment the text is just overriding on borders. So please help me out to get free space in edit text like below one[enter image description here][2] [1]: https://i.stack.imgur.com/u4OeG.png [2]: https://i.stack.imgur.com/1K5iy.png
0debug
Protractor - Wait for multiple elements : <p>I am trying to wait for multiple elements on the page, I don't know how many there could be but there will be at least one. I understand waiting for a single element using the following, which works fine.</p> <pre><code>var EC = protractor.ExpectedConditions; browser.wait(EC.presenceOf(element(by.css("h3[title='Test Form']"))), 10000); expect(element(by.css("h3[title='Test Form']")).isPresent()).toBeTruthy(); </code></pre> <p>I wanted to change this slightly to wait for multiple elements and so tried the below (adding .all to element).</p> <pre><code>var EC = protractor.ExpectedConditions; browser.wait(EC.presenceOf(element.all(by.css("h3[title='Test Form']"))), 10000); expect(element.all(by.css("h3[title='Test Form']")).isPresent()).toBeTruthy(); </code></pre> <p>Unfortunately when I try this I get </p> <pre><code>Cannot read property 'bind' of undefined </code></pre> <p>Any help on this would be very much appreciated.</p> <p>p.s. Newbie to Protracor and its quirks. </p>
0debug
Need to delete large no files : I need to deletea large no files in a folder (wc is around 2392934). The folder contains files of year 2015 & year 2016. I want to delete files for year 2015 only and for that I have created a script below:- echo 'going to gived path' cd /usr/local/nagios/var/spool/xidpe/ pwd b=$(ls -lrt | grep '2015' | awk '{print $9}') echo 'listen tail outcome' echo 'going to del' rm -rf $b exit but it gives error :- ./test.sh: line 10: /bin/rm: Argument list too long. I have tried xargs also : b=$(ls -lrt | xargs '2016' | awk '{print $9}') gives error:- xargs: 2016: No such file or directory Is there any changes need to be done in my script or any other ways to delete these files(only for year 2015).
0debug
How to Remove an Array from String object? : <pre><code>[{"id":"MGA - MMD","text":"MGA - MMD"},{"id":"MGA - WIE","text":"MGA - WIE"},{"id":"MGA - YP","text":"MGA - YP"}],MGA - MMD,MGA - WIE,MGA - YP </code></pre> <p>I want result like <code>MGA - MMD,MGA - WIE,MGA - YP</code></p> <p>Thanks in advance</p>
0debug
ionic 4 ios fails to build due to swift version 3 : <p>After upgrading to xcode 10.2 my ionic for ios project stopped building using below command</p> <p>ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"</p> <p>i tried to upgrade cordova-ios@5.0.0 and remove and readd ios platform but no luck.</p> <pre><code>The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor. Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2' ** ARCHIVE FAILED ** The following build commands failed: Check dependencies (1 failure) xcodebuild: Command failed with exit code 65 [ERROR] An error occurred while running subprocess cordova. cordova build ios --buildFlag=-UseModernBuildSystem=0 exited with exit code 65. Re-running this command with the --verbose flag may provide more information. </code></pre>
0debug
Laravel difference between Events, Listeners, Jobs, Queues : <p>It sounds extremely confusing to me, what are the differences? Can someone please do an ELI5?</p>
0debug
Override method with different argument types in extended class - Typescript : <p>I want to override a method and pass different argument types to it:</p> <pre><code>class Base { public myMethod(myString: string): undefined { return; } } class Child extends Base { public myMethod(myNumber: number): undefined { return super.myMethod(String(myNumber)); } } </code></pre> <p>Yet this yields a typescript error:</p> <blockquote> <p>Property 'myMethod' in type 'Child' is not assignable to the same property in base type 'Base'. Type '(myNumber: number) => undefined' is not assignable to type '(myString: string) => undefined'. Types of parameters 'myNumber' and 'myString' are incompatible. Type 'string' is not assignable to type 'number'.</p> </blockquote> <p>Is there a way to do this without creating a typescript error?</p>
0debug
static inline void memcpy_tofs(void * to, const void * from, unsigned long n) { memcpy(to, from, n); }
1threat
What's difference between "reduce" and "scan" : <p>I'm studying RXJS and stuck with the problem: the same code with operators "reduce" and "scan" works in different ways, but I think that must return equal result. Example below. Please help.</p> <pre><code>const txtElement1 = document.getElementById('txt1'); const txtElement2 = document.getElementById('txt2'); const txtElement3 = document.getElementById('txt3'); // function return Observable function get(array, initValue) { return Rx.Observable.create(observer =&gt; { let timer = initValue; array.forEach(item =&gt; { setTimeout(() =&gt; observer.next(item), timer); timer += 1000; }); }); } // 1) don't work with "reduce" var stream1$ = get(['John', 'Ann', 'Bob']) .reduce(function(acc, x) { return acc + ` ${x}`; }, 'first - '); stream1$.subscribe(text =&gt; txtElement1.innerHTML = text); // 2) the same code, but with "scan" - working var stream2$ = get(['John', 'Ann', 'Bob']) .scan(function(acc, x) { return acc + ` ${x}`; }, 'second - '); stream2$.subscribe(text =&gt; txtElement2.innerHTML = text); // 3) and the simple Observable with "reduce" - working var stream3$ = Rx.Observable.from(['John', 'Ann', 'Bob']) .reduce(function(acc, x) { return acc + ` ${x}`; }, 'third - '); stream3$.subscribe(text =&gt; txtElement3.innerHTML = text); </code></pre>
0debug
Can I add cookies to a webpack dev server proxy? : <p>I'm trying to set up a proxy within my webpack dev server. The issue is that I don't control the server I'm connecting to, and I need to authenticate the request.</p> <p>Is there a way I can add cookies on to the request I send to the proxy server? I've looked through the <a href="https://webpack.github.io/docs/webpack-dev-server.html#proxy">webpack dev server proxy server page</a>, and the <a href="https://github.com/nodejitsu/node-http-proxy#options">node-http-proxy</a> page it links to, and I don't see any mention of cookies. I'm also not sure if there's a way for me to see these forwarded requests, so I can't tell if anything I'm trying is doing anything.</p> <p>Any ideas?</p>
0debug
node.js multiple app without multiple server : <p><strong>I want my app to be example.com but the dashboard to be dashboard.example.com</strong>, how do I do that with one server running? I can easily spin up 2 express app and connect to the same db, and configure ngix config but I feel that is not a proper way to do things.</p> <p>Any clue? I'm using express.js anyway.</p>
0debug
What does the '$' in CSS mean? : <p>I saw an animated project with a bunch of '$' in it. I have no idea what dollar signs are used for in CSS. I'm guessing it is for animations. Here is a sample of some of the code I was looking at:</p> <pre><code>$emoji-base-color: #FFDA6A; $emoji-like-color: #548DFF; .emoji--like { background: $emoji-like-color; &amp;:after { content: 'Like'; } </code></pre> <p>Here's a link to the entire project: <a href="https://codepen.io/AshBardhan/pen/dNKwXz" rel="noreferrer">https://codepen.io/AshBardhan/pen/dNKwXz</a></p>
0debug
def heap_sort(arr): heapify(arr) end = len(arr) - 1 while end > 0: arr[end], arr[0] = arr[0], arr[end] shift_down(arr, 0, end - 1) end -= 1 return arr def heapify(arr): start = len(arr) // 2 while start >= 0: shift_down(arr, start, len(arr) - 1) start -= 1 def shift_down(arr, start, end): root = start while root * 2 + 1 <= end: child = root * 2 + 1 if child + 1 <= end and arr[child] < arr[child + 1]: child += 1 if child <= end and arr[root] < arr[child]: arr[root], arr[child] = arr[child], arr[root] root = child else: return
0debug
How to create dropdown list that offers cities with its first letters : <p>I am creating a geographical application: I have two editText fields for "From" and "To" points. I want to make it so, that when first letters are added to the editText, dropdown list appears suggesting cities, countries, etc. For example if I write "new" - New York, New Jersey, New Orleans appears. So, I want the same, as realised in Google Mapps app.</p> <p>Sorry if not clear, I am new to android, even have no idea how to name this.</p>
0debug
NameError: name 'exit' is not defined : <p>I used cxfreeze to create a Windows executable from planrequest.py. It seemed to work ok, but when I run the exe file I get <code>NameError: name 'exit' is not defined</code></p> <p><a href="https://stackoverflow.com/questions/30144893/name-exit-is-not-defined-in-python">name exit is not defined in python</a> states that the fix is to use <code>import sys</code>. However, I use import sys. The code runs fine as a python script (as in, I extensively tested the command line arguments before compiling to an executable.)</p> <pre><code>import socket import sys if len(sys.argv) == 1: print("Usage:") print("PlanRequest [Request String] [Server IP (optional: assumes 127.0.0.1 if omitted)]") exit() #[do stuff with the request] </code></pre>
0debug
i am just trying to jquery value in php variable : there is the button of modal containing post id: `<button onclick='getValue("<?=$id?>");' data-toggle="modal" name="submit" data-target="#squarespaceModal">Purchase Now</button>` And when i alert this id it comes properly but i need this id in php variable `function getValue(id){ alert(id); // i am trying this but not done // <?php $xyz =?> id ; }` also i am trying using this `$.post` but in modal the data is not coming like `$.post( "<?=$current_url;?>", function( id ) { // $( "#div1" ).html( id ); //alert(id); });` plz help how can i set jquery value in php variable most of the example i have seen opposite example like `var x =<?php echo $y;?>` but i need opposite
0debug
What is the difference between layout gravity and gravity in android? : <p>I always struggled when and where to use layout_gravity and gravity. Pleaae help me</p>
0debug
Mocking a singleton with mockito : <p>I need to test some legacy code, which uses a singleton in a a method call. The purpose of the test is to ensure that the clas sunder test makes a call to singletons method. I have seen similar questions on SO, but all the answers require other dependencies (different test frameworks) - I'm unfortunately limited to using Mockito and JUnit, but this should be perfectly possible with such popular framework.</p> <p>The singleton:</p> <pre><code>public class FormatterService { private static FormatterService INSTANCE; private FormatterService() { } public static FormatterService getInstance() { if (INSTANCE == null) { INSTANCE = new FormatterService(); } return INSTANCE; } public String formatTachoIcon() { return "URL"; } } </code></pre> <p>The class under test:</p> <pre><code>public class DriverSnapshotHandler { public String getImageURL() { return FormatterService.getInstance().formatTachoIcon(); } } </code></pre> <p>The unit test:</p> <pre><code>public class TestDriverSnapshotHandler { private FormatterService formatter; @Before public void setUp() { formatter = mock(FormatterService.class); when(FormatterService.getInstance()).thenReturn(formatter); when(formatter.formatTachoIcon()).thenReturn("MockedURL"); } @Test public void testFormatterServiceIsCalled() { DriverSnapshotHandler handler = new DriverSnapshotHandler(); handler.getImageURL(); verify(formatter, atLeastOnce()).formatTachoIcon(); } } </code></pre> <p>The idea was to configure the expected behaviour of the dreaded singleton, since the class under test will call it's getInstance and then formatTachoIcon methods. Unfortunately this fails with an error message:</p> <pre><code>when() requires an argument which has to be 'a method call on a mock'. </code></pre>
0debug
static void static_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { #ifdef SPY printf("%s: value %08lx written at " PA_FMT "\n", __FUNCTION__, value, offset); #endif }
1threat
Invalid digits on Redshift : <p>I'm trying to load some data from stage to relational environment and something is happening I can't figure out.</p> <p>I'm trying to run the following query:</p> <pre><code>SELECT CAST(SPLIT_PART(some_field,'_',2) AS BIGINT) cmt_par FROM public.some_table; </code></pre> <p>The some_field is a column that has data with two numbers joined by an underscore like this:</p> <pre><code>some_field -&gt; 38972691802309_48937927428392 </code></pre> <p>And I'm trying to get the second part.</p> <p>That said, here is the error I'm getting:</p> <pre><code>[Amazon](500310) Invalid operation: Invalid digit, Value '1', Pos 0, Type: Long Details: ----------------------------------------------- error: Invalid digit, Value '1', Pos 0, Type: Long code: 1207 context: query: 1097254 location: :0 process: query0_99 [pid=0] -----------------------------------------------; Execution time: 2.61s Statement 1 of 1 finished 1 statement failed. </code></pre> <p>It's literally saying some numbers are not valid digits. I've already tried to get the exactly data which is throwing the error and it appears to be a normal field like I was expecting. It happens even if I throw out NULL fields.</p> <p>I thought it would be an encoding error, but I've not found any references to solve that. Anyone has any idea?</p> <p>Thanks everybody.</p>
0debug
summing list using java 8 streams : I have List<Pocket> pockets; and public class Pocket { String name; Double amount; } pockets list contains: [ {"pocket1", 280}, {"pocket2", 320}, {"pocket3", 100}, {"pocket4", 125}, {"pocket5", 150}, {"pocket6", 175} ] I need to get 650 from first pockets, What I want to receive in the end is: [ {"pocket1", 280}, {"pocket2", 320}, {"pocket3", 50} ] How to implement it with Java Streams/Lamda? Thanks in advance.
0debug
Remove Grey Box : I'm very new to learning very basic HTML. I can't figure out how to remove the grey lines around my follow buttons. Any help is appreciated. Thank you! [Here's a screenshot of the grey boxes][1] <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <html> <head> <title>social follow bar</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body bgcolor="#00FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- Save for Web Slices (social follow bar.psd) --> <table id="Table_01" width="250" height="40" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td rowspan="2"> <a href="https://www.pinterest.com/wherefoodtakesus/pins/"> <img src="https://wherefoodtakesus.com/wp-content/uploads/Home-Page/Buttons/Social-Sharing-Buttons/Pinterest_button.png" width="40" height="40" border="0" alt="Pinterest-Follow_button"></a></td> <td rowspan="2"> <a href="https://www.instagram.com/wherefoodtakesusblog/"> <img src="https://wherefoodtakesus.com/wp-content/uploads/Home-Page/Buttons/Social-Sharing-Buttons/Instagram_button.png" width="40" height="40" border="0" alt="Instagram-Follow_button"></a></td> <td rowspan="2"> <a href="https://wherefoodtakesus.com/feed/"> <img src="https://wherefoodtakesus.com/wp-content/uploads/Home-Page/Buttons/Social-Sharing-Buttons/RSS_button.png" width="40" height="40" border="0" alt="RSS-Follow_button"></a></td> <td rowspan="2"> <a href="https://mix.com/wherefoodtakesus"> <img src="https://wherefoodtakesus.com/wp-content/uploads/Home-Page/Buttons/Social-Sharing-Buttons/Mix_button.png" width="40" height="40" border="0" alt="Mix-Follow_button"></a></td> <td rowspan="2"> <a href="mailto:wherefoodtakesus@gmail.com"> <img src="https://wherefoodtakesus.com/wp-content/uploads/Home-Page/Buttons/Social-Sharing-Buttons/Email_button.png" width="40" height="40" border="0" alt="Email_button"></a></td> </tr> </table> <!-- End Save for Web Slices --> </body> </html> <!-- end snippet --> [1]: https://i.stack.imgur.com/Kp9Kx.png
0debug
static void lan9118_16bit_mode_write(void *opaque, target_phys_addr_t offset, uint64_t val, unsigned size) { switch (size) { case 2: lan9118_writew(opaque, offset, (uint32_t)val); return; case 4: lan9118_writel(opaque, offset, val, size); return; } hw_error("lan9118_write: Bad size 0x%x\n", size); }
1threat
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx) { HEVCParserContext *ctx = s->priv_data; int ret, i; ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, 0, 0, AV_CODEC_ID_HEVC); if (ret < 0) return ret; for (i = 0; i < ctx->pkt.nb_nals; i++) { H2645NAL *nal = &ctx->pkt.nals[i]; switch (nal->type) { case NAL_VPS: ff_hevc_decode_nal_vps(&nal->gb, avctx, &ctx->ps); break; case NAL_SPS: ff_hevc_decode_nal_sps(&nal->gb, avctx, &ctx->ps, 1); break; case NAL_PPS: ff_hevc_decode_nal_pps(&nal->gb, avctx, &ctx->ps); break; case NAL_TRAIL_R: case NAL_TRAIL_N: case NAL_TSA_N: case NAL_TSA_R: case NAL_STSA_N: case NAL_STSA_R: case NAL_BLA_W_LP: case NAL_BLA_W_RADL: case NAL_BLA_N_LP: case NAL_IDR_W_RADL: case NAL_IDR_N_LP: case NAL_CRA_NUT: case NAL_RADL_N: case NAL_RADL_R: case NAL_RASL_N: case NAL_RASL_R: if (buf == avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", nal->type); return AVERROR_INVALIDDATA; } hevc_parse_slice_header(s, nal, avctx); break; } } return 0; }
1threat
static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb) { int i, j, k; int coding_mode; int motion_x[6]; int motion_y[6]; int last_motion_x = 0; int last_motion_y = 0; int prior_last_motion_x = 0; int prior_last_motion_y = 0; int current_macroblock; int current_fragment; debug_vp3(" vp3: unpacking motion vectors\n"); if (s->keyframe) { debug_vp3(" keyframe-- there are no motion vectors\n"); } else { memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); coding_mode = get_bits1(gb); debug_vectors(" using %s scheme for unpacking motion vectors\n", (coding_mode == 0) ? "VLC" : "fixed-length"); for (i = 0; i < s->u_superblock_start; i++) { for (j = 0; j < 4; j++) { current_macroblock = s->superblock_macroblocks[i * 4 + j]; if ((current_macroblock == -1) || (s->macroblock_coding[current_macroblock] == MODE_COPY)) continue; if (current_macroblock >= s->macroblock_count) { av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad macroblock number (%d >= %d)\n", current_macroblock, s->macroblock_count); return 1; } current_fragment = s->macroblock_fragments[current_macroblock * 6]; if (current_fragment >= s->fragment_count) { av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d\n", current_fragment, s->fragment_count); return 1; } switch (s->macroblock_coding[current_macroblock]) { case MODE_INTER_PLUS_MV: case MODE_GOLDEN_MV: if (coding_mode == 0) { motion_x[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; motion_y[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; } else { motion_x[0] = fixed_motion_vector_table[get_bits(gb, 6)]; motion_y[0] = fixed_motion_vector_table[get_bits(gb, 6)]; } for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } if (s->macroblock_coding[current_macroblock] == MODE_INTER_PLUS_MV) { prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; } break; case MODE_INTER_FOURMV: prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; motion_x[4] = motion_y[4] = 0; for (k = 0; k < 4; k++) { if (coding_mode == 0) { motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; motion_y[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)]; } else { motion_x[k] = fixed_motion_vector_table[get_bits(gb, 6)]; motion_y[k] = fixed_motion_vector_table[get_bits(gb, 6)]; } last_motion_x = motion_x[k]; last_motion_y = motion_y[k]; motion_x[4] += motion_x[k]; motion_y[4] += motion_y[k]; } motion_x[5]= motion_x[4]= RSHIFT(motion_x[4], 2); motion_y[5]= motion_y[4]= RSHIFT(motion_y[4], 2); break; case MODE_INTER_LAST_MV: motion_x[0] = last_motion_x; motion_y[0] = last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } break; case MODE_INTER_PRIOR_LAST: motion_x[0] = prior_last_motion_x; motion_y[0] = prior_last_motion_y; for (k = 1; k < 6; k++) { motion_x[k] = motion_x[0]; motion_y[k] = motion_y[0]; } prior_last_motion_x = last_motion_x; prior_last_motion_y = last_motion_y; last_motion_x = motion_x[0]; last_motion_y = motion_y[0]; break; default: memset(motion_x, 0, 6 * sizeof(int)); memset(motion_y, 0, 6 * sizeof(int)); break; } debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n", current_fragment, s->macroblock_coding[current_macroblock]); for (k = 0; k < 6; k++) { current_fragment = s->macroblock_fragments[current_macroblock * 6 + k]; if (current_fragment == -1) continue; if (current_fragment >= s->fragment_count) { av_log(s->avctx, AV_LOG_ERROR, " vp3:unpack_vectors(): bad fragment number (%d >= %d)\n", current_fragment, s->fragment_count); return 1; } s->all_fragments[current_fragment].motion_x = motion_x[k]; s->all_fragments[current_fragment].motion_y = motion_y[k]; debug_vectors(" vector %d: fragment %d = (%d, %d)\n", k, current_fragment, motion_x[k], motion_y[k]); } } } } return 0; }
1threat
What did This Query Do And How it Do : I Have A linq Query Which I am Not Able to Understand @Model.MenuItems.Where(t=>t.Category.Name.Equals(category.Name))
0debug
static int audio_decode_frame(VideoState *is) { int data_size, resampled_data_size; int64_t dec_channel_layout; int got_frame = 0; av_unused double audio_clock0; int wanted_nb_samples; AVRational tb; int ret; int reconfigure; if (!is->frame) if (!(is->frame = av_frame_alloc())) return AVERROR(ENOMEM); for (;;) { if (is->audioq.serial != is->auddec.pkt_serial) is->audio_buf_frames_pending = got_frame = 0; if (!got_frame) av_frame_unref(is->frame); if (is->paused) return -1; while (is->audio_buf_frames_pending || got_frame) { if (!is->audio_buf_frames_pending) { got_frame = 0; tb = (AVRational){1, is->frame->sample_rate}; #if CONFIG_AVFILTER dec_channel_layout = get_valid_channel_layout(is->frame->channel_layout, av_frame_get_channels(is->frame)); reconfigure = cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels, is->frame->format, av_frame_get_channels(is->frame)) || is->audio_filter_src.channel_layout != dec_channel_layout || is->audio_filter_src.freq != is->frame->sample_rate || is->auddec.pkt_serial != is->audio_last_serial; if (reconfigure) { char buf1[1024], buf2[1024]; av_get_channel_layout_string(buf1, sizeof(buf1), -1, is->audio_filter_src.channel_layout); av_get_channel_layout_string(buf2, sizeof(buf2), -1, dec_channel_layout); av_log(NULL, AV_LOG_DEBUG, "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n", is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, is->audio_last_serial, is->frame->sample_rate, av_frame_get_channels(is->frame), av_get_sample_fmt_name(is->frame->format), buf2, is->auddec.pkt_serial); is->audio_filter_src.fmt = is->frame->format; is->audio_filter_src.channels = av_frame_get_channels(is->frame); is->audio_filter_src.channel_layout = dec_channel_layout; is->audio_filter_src.freq = is->frame->sample_rate; is->audio_last_serial = is->auddec.pkt_serial; if ((ret = configure_audio_filters(is, afilters, 1)) < 0) return ret; } if ((ret = av_buffersrc_add_frame(is->in_audio_filter, is->frame)) < 0) return ret; #endif } #if CONFIG_AVFILTER if ((ret = av_buffersink_get_frame_flags(is->out_audio_filter, is->frame, 0)) < 0) { if (ret == AVERROR(EAGAIN)) { is->audio_buf_frames_pending = 0; continue; } if (ret == AVERROR_EOF) is->auddec.finished = is->auddec.pkt_serial; return ret; } is->audio_buf_frames_pending = 1; tb = is->out_audio_filter->inputs[0]->time_base; #endif data_size = av_samples_get_buffer_size(NULL, av_frame_get_channels(is->frame), is->frame->nb_samples, is->frame->format, 1); dec_channel_layout = (is->frame->channel_layout && av_frame_get_channels(is->frame) == av_get_channel_layout_nb_channels(is->frame->channel_layout)) ? is->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(is->frame)); wanted_nb_samples = synchronize_audio(is, is->frame->nb_samples); if (is->frame->format != is->audio_src.fmt || dec_channel_layout != is->audio_src.channel_layout || is->frame->sample_rate != is->audio_src.freq || (wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) { swr_free(&is->swr_ctx); is->swr_ctx = swr_alloc_set_opts(NULL, is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq, dec_channel_layout, is->frame->format, is->frame->sample_rate, 0, NULL); if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", is->frame->sample_rate, av_get_sample_fmt_name(is->frame->format), av_frame_get_channels(is->frame), is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels); break; } is->audio_src.channel_layout = dec_channel_layout; is->audio_src.channels = av_frame_get_channels(is->frame); is->audio_src.freq = is->frame->sample_rate; is->audio_src.fmt = is->frame->format; } if (is->swr_ctx) { const uint8_t **in = (const uint8_t **)is->frame->extended_data; uint8_t **out = &is->audio_buf1; int out_count = (int64_t)wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate + 256; int out_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, out_count, is->audio_tgt.fmt, 0); int len2; if (out_size < 0) { av_log(NULL, AV_LOG_ERROR, "av_samples_get_buffer_size() failed\n"); break; } if (wanted_nb_samples != is->frame->nb_samples) { if (swr_set_compensation(is->swr_ctx, (wanted_nb_samples - is->frame->nb_samples) * is->audio_tgt.freq / is->frame->sample_rate, wanted_nb_samples * is->audio_tgt.freq / is->frame->sample_rate) < 0) { av_log(NULL, AV_LOG_ERROR, "swr_set_compensation() failed\n"); break; } } av_fast_malloc(&is->audio_buf1, &is->audio_buf1_size, out_size); if (!is->audio_buf1) return AVERROR(ENOMEM); len2 = swr_convert(is->swr_ctx, out, out_count, in, is->frame->nb_samples); if (len2 < 0) { av_log(NULL, AV_LOG_ERROR, "swr_convert() failed\n"); break; } if (len2 == out_count) { av_log(NULL, AV_LOG_WARNING, "audio buffer is probably too small\n"); swr_init(is->swr_ctx); } is->audio_buf = is->audio_buf1; resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt); } else { is->audio_buf = is->frame->data[0]; resampled_data_size = data_size; } audio_clock0 = is->audio_clock; if (is->frame->pts != AV_NOPTS_VALUE) is->audio_clock = is->frame->pts * av_q2d(tb) + (double) is->frame->nb_samples / is->frame->sample_rate; else is->audio_clock = NAN; is->audio_clock_serial = is->auddec.pkt_serial; #ifdef DEBUG { static double last_clock; printf("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n", is->audio_clock - last_clock, is->audio_clock, audio_clock0); last_clock = is->audio_clock; } #endif return resampled_data_size; } if ((got_frame = decoder_decode_frame(&is->auddec, is->frame, NULL)) < 0) return -1; if (is->auddec.flushed) is->audio_buf_frames_pending = 0; } }
1threat
array value by jquery : I have an javascript array that has the following values, <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> let arr = ["2","4","6","8","10"]; <!-- end snippet --> I have a second array that has three integers, <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> let index = [1,5,9]; <!-- end snippet --> How would I use JQuery (or Javascript) to use the array to get the index from arr, and add it to a new array. I want to add these strings to a new array. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> indexArr = ["1","3","5"] <!-- end snippet --> Thanks
0debug
static void aw_emac_cleanup(NetClientState *nc) { AwEmacState *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
1threat
uint64_t helper_mulqv (uint64_t op1, uint64_t op2) { uint64_t tl, th; muls64(&tl, &th, op1, op2); if (unlikely((th + 1) > 1)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return tl; }
1threat
Trouble understanding yield in C# : <p>I'm hoping to get some clarification on a snippet that I've recently stepped through in the debugger, but simply cannot really understand.</p> <p>I'm taking a <strong>C#</strong> course on <strong>PluralSight</strong> and the current topic is on <code>yield</code> and returning a <code>IEnumerable&lt;T&gt;</code> with the keyword. </p> <p>I've got this overly basic function that returns an <code>IEnumerable</code> collection of <code>Vendors</code> (A simple class with <code>Id</code>, <code>CompanyName</code> and <code>Email</code>):</p> <pre><code>public IEnumerable&lt;Vendor&gt; RetrieveWithIterator() { this.Retrieve(); // &lt;-- I've got a breakpoint here foreach(var vendor in _vendors) { Debug.WriteLine($"Vendor Id: {vendor.VendorId}"); yield return vendor; } } </code></pre> <p>And I've got this code in a unit test that I'm using to test the function:</p> <pre><code>var vendorIterator = repository.RetrieveWithIterator(); // &lt;-- Why don't it enter function? foreach (var item in vendorIterator) // &lt;-- But starts here? { Debug.WriteLine(item); } var actual = vendorIterator.ToList(); </code></pre> <p>What I really can't seem to understand, and I'm sure a lot of beginners are having the same trouble, is why the initial call to <code>RetrieveWithIterator</code> doesn't initiate the function, but it rather starts when we start iterating through its returned <code>IEnumerable</code> collection (see the comments).</p>
0debug
What is the difference between continuous integration, continuous delivery and DevOps? : <p>I hear these terms together and wonder what is the difference? How are they related to continuous builds and continuous deployments?</p>
0debug
static void scsi_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); set_bit(DEVICE_CATEGORY_STORAGE, k->categories); k->bus_type = TYPE_SCSI_BUS; k->init = scsi_qdev_init; k->unplug = scsi_qdev_unplug; k->exit = scsi_qdev_exit; k->props = scsi_props; }
1threat
Can GitHub automatically merge branches? : <p>We want to automatically merge out from master to another long-lived branch whenever any changes are committed to master (at the moment, this is a manual process and people forget)</p> <p>I appreciate that it may not always be possible, owing to merge conflicts, but if it is possible, we'd like it to happen automatically.</p> <p>Is this possible?</p>
0debug
s For example when player is playing level 5 When die lock level 5 and level 4 Sorry for my bad English And thank all of you : I have 60 levels with buttons I want lock some levels when player is die With playerprefs For example when player is playing level 5 When die lock level 5 and level 4 Sorry for my bad English And thank all of you
0debug
WINDOW_FUNC(eight_short) { const float *swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; const float *in = audio + 448; float *out = sce->ret; for (int w = 0; w < 8; w++) { dsp->vector_fmul (out, in, w ? pwindow : swindow, 128); out += 128; in += 128; dsp->vector_fmul_reverse(out, in, swindow, 128); out += 128; } }
1threat
void aio_set_fd_handler(AioContext *ctx, int fd, bool is_external, IOHandler *io_read, IOHandler *io_write, AioPollFn *io_poll, void *opaque) { abort(); }
1threat
Need to Write BATCH file to replace the Values in web.config : <appSettings> <add key="abc" value="2"/> <add key="Application Name" value="AAAA"/> <add key="EntityID" value="2300"/> <add key="Version" value="1.38.11"/> <add key="AppEnv" value="Dev"/> </appSettings> enter code here Want to write a BATCH FILE where, web.config file will be picked from specific folder and In the Web.config Version's Value to be updated to new value.
0debug
static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id) { CirrusVGAState *s = opaque; int ret; if (version_id > 2) return -EINVAL; if (s->pci_dev && version_id >= 2) { ret = pci_device_load(s->pci_dev, f); if (ret < 0) return ret; } qemu_get_be32s(f, &s->latch); qemu_get_8s(f, &s->sr_index); qemu_get_buffer(f, s->sr, 256); qemu_get_8s(f, &s->gr_index); qemu_get_8s(f, &s->cirrus_shadow_gr0); qemu_get_8s(f, &s->cirrus_shadow_gr1); s->gr[0x00] = s->cirrus_shadow_gr0 & 0x0f; s->gr[0x01] = s->cirrus_shadow_gr1 & 0x0f; qemu_get_buffer(f, s->gr + 2, 254); qemu_get_8s(f, &s->ar_index); qemu_get_buffer(f, s->ar, 21); s->ar_flip_flop=qemu_get_be32(f); qemu_get_8s(f, &s->cr_index); qemu_get_buffer(f, s->cr, 256); qemu_get_8s(f, &s->msr); qemu_get_8s(f, &s->fcr); qemu_get_8s(f, &s->st00); qemu_get_8s(f, &s->st01); qemu_get_8s(f, &s->dac_state); qemu_get_8s(f, &s->dac_sub_index); qemu_get_8s(f, &s->dac_read_index); qemu_get_8s(f, &s->dac_write_index); qemu_get_buffer(f, s->dac_cache, 3); qemu_get_buffer(f, s->palette, 768); s->bank_offset=qemu_get_be32(f); qemu_get_8s(f, &s->cirrus_hidden_dac_lockindex); qemu_get_8s(f, &s->cirrus_hidden_dac_data); qemu_get_be32s(f, &s->hw_cursor_x); qemu_get_be32s(f, &s->hw_cursor_y); cirrus_update_memory_access(s); s->graphic_mode = -1; cirrus_update_bank_ptr(s, 0); cirrus_update_bank_ptr(s, 1); return 0; }
1threat
static void pc_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); PCMachineClass *pcmc = PC_MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); pcmc->get_hotplug_handler = mc->get_hotplug_handler; pcmc->pci_enabled = true; pcmc->has_acpi_build = true; pcmc->rsdp_in_ram = true; pcmc->smbios_defaults = true; pcmc->smbios_uuid_encoded = true; pcmc->gigabyte_align = true; pcmc->has_reserved_memory = true; pcmc->kvmclock_enabled = true; pcmc->enforce_aligned_dimm = true; pcmc->acpi_data_size = 0x20000 + 0x8000; pcmc->save_tsc_khz = true; mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_socket_id = pc_cpu_index_to_socket_id; mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids; mc->query_hotpluggable_cpus = pc_query_hotpluggable_cpus; mc->default_boot_order = "cad"; mc->hot_add_cpu = pc_hot_add_cpu; mc->max_cpus = 255; mc->reset = pc_machine_reset; hc->pre_plug = pc_machine_device_pre_plug_cb; hc->plug = pc_machine_device_plug_cb; hc->post_plug = pc_machine_device_post_plug_cb; hc->unplug_request = pc_machine_device_unplug_request_cb; hc->unplug = pc_machine_device_unplug_cb; nc->nmi_monitor_handler = x86_nmi; object_class_property_add(oc, PC_MACHINE_MEMHP_REGION_SIZE, "int", pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); object_class_property_set_description(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort); object_class_property_add(oc, PC_MACHINE_SMM, "OnOffAuto", pc_machine_get_smm, pc_machine_set_smm, NULL, NULL, &error_abort); object_class_property_set_description(oc, PC_MACHINE_SMM, "Enable SMM (pc & q35)", &error_abort); object_class_property_add(oc, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); object_class_property_set_description(oc, PC_MACHINE_VMPORT, "Enable vmport (pc & q35)", &error_abort); object_class_property_add_bool(oc, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm, pc_machine_set_nvdimm, &error_abort); }
1threat
How can I send a message to someone with my telegram bot using their Username : <p>I am using the telepot python library, I know that you can send a message when you have someone's UserID(Which is a number). I wanna know if it is possible to send a message to someone without having their UserID but only with their username(The one which starts with '@'), Also if there is a way to convert a username to a UserID.</p>
0debug
how do i call async property in Widget build method : <p>I'm new to Flutter and Dart, and I'm trying to build a Flutter app which displays the device information on the screen. For this purpose I'm trying to use this library: 'device_info' from here: <a href="https://pub.dartlang.org/packages/device_info#-readme-tab-" rel="noreferrer">https://pub.dartlang.org/packages/device_info#-readme-tab-</a></p> <p>In the 'build' method of the MyApp class, I am trying to instantiate the object from 'device_info' package and call a property which happens to be an async property. Since the default build method is not asynchronous, how do I call this property in the build method? Following is my code:</p> <pre><code>class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); AndroidDeviceInfo androidDeviceInfo = await deviceInfoPlugin.androidInfo; return MaterialApp( title: 'My Device Info', home: Scaffold( appBar: AppBar( title: Text('My Device Info'), ), body: Center( child: Text('Device model:' + 'Moto'), ), ), ); } } </code></pre>
0debug
static void do_interrupt_protected(int intno, int is_int, int error_code, unsigned int next_eip) { SegmentCache *dt; uint8_t *ptr, *ssp; int type, dpl, selector, ss_dpl; int has_error_code, new_stack, shift; uint32_t e1, e2, offset, ss, esp, ss_e1, ss_e2, push_size; uint32_t old_cs, old_ss, old_esp, old_eip; dt = &env->idt; if (intno * 8 + 7 > dt->limit) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); ptr = dt->base + intno * 8; e1 = ldl(ptr); e2 = ldl(ptr + 4); type = (e2 >> DESC_TYPE_SHIFT) & 0x1f; switch(type) { case 5: cpu_abort(env, "task gate not supported"); break; case 6: case 7: case 14: case 15: break; default: raise_exception_err(EXCP0D_GPF, intno * 8 + 2); break; } dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (is_int && dpl < env->cpl) raise_exception_err(EXCP0D_GPF, intno * 8 + 2); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, intno * 8 + 2); selector = e1 >> 16; offset = (e2 & 0xffff0000) | (e1 & 0x0000ffff); if ((selector & 0xfffc) == 0) raise_exception_err(EXCP0D_GPF, 0); if (load_segment(&e1, &e2, selector) != 0) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (dpl > env->cpl) raise_exception_err(EXCP0D_GPF, selector & 0xfffc); if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); if (!(e2 & DESC_C_MASK) && dpl < env->cpl) { get_ss_esp_from_tss(&ss, &esp, dpl); if ((ss & 0xfffc) == 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if ((ss & 3) != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (load_segment(&ss_e1, &ss_e2, ss) != 0) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); ss_dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (ss_dpl != dpl) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); if (!(ss_e2 & DESC_P_MASK)) raise_exception_err(EXCP0A_TSS, ss & 0xfffc); new_stack = 1; } else if ((e2 & DESC_C_MASK) || dpl == env->cpl) { new_stack = 0; } else { raise_exception_err(EXCP0D_GPF, selector & 0xfffc); new_stack = 0; } shift = type >> 3; has_error_code = 0; if (!is_int) { switch(intno) { case 8: case 10: case 11: case 12: case 13: case 14: case 17: has_error_code = 1; break; } } push_size = 6 + (new_stack << 2) + (has_error_code << 1); if (env->eflags & VM_MASK) push_size += 8; push_size <<= shift; if (new_stack) { old_esp = env->regs[R_ESP]; old_ss = env->segs[R_SS].selector; load_seg(R_SS, ss, env->eip); } else { old_esp = 0; old_ss = 0; esp = env->regs[R_ESP]; } if (is_int) old_eip = next_eip; else old_eip = env->eip; old_cs = env->segs[R_CS].selector; load_seg(R_CS, selector, env->eip); env->eip = offset; env->regs[R_ESP] = esp - push_size; ssp = env->segs[R_SS].base + esp; if (shift == 1) { int old_eflags; if (env->eflags & VM_MASK) { ssp -= 4; stl(ssp, env->segs[R_GS].selector); ssp -= 4; stl(ssp, env->segs[R_FS].selector); ssp -= 4; stl(ssp, env->segs[R_DS].selector); ssp -= 4; stl(ssp, env->segs[R_ES].selector); } if (new_stack) { ssp -= 4; stl(ssp, old_ss); ssp -= 4; stl(ssp, old_esp); } ssp -= 4; old_eflags = compute_eflags(); stl(ssp, old_eflags); ssp -= 4; stl(ssp, old_cs); ssp -= 4; stl(ssp, old_eip); if (has_error_code) { ssp -= 4; stl(ssp, error_code); } } else { if (new_stack) { ssp -= 2; stw(ssp, old_ss); ssp -= 2; stw(ssp, old_esp); } ssp -= 2; stw(ssp, compute_eflags()); ssp -= 2; stw(ssp, old_cs); ssp -= 2; stw(ssp, old_eip); if (has_error_code) { ssp -= 2; stw(ssp, error_code); } } if ((type & 1) == 0) { env->eflags &= ~IF_MASK; } env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK); }
1threat
static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); entries = avio_rb32(pb); av_dlog(c->fc, "keyframe_count = %d\n", entries); if (!entries) { sc->keyframe_absent = 1; if (!st->need_parsing) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(entries * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->keyframes[i] = avio_rb32(pb); } sc->keyframe_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; }
1threat
Switching to Camera2 in Android Vision API : <p>I saw that in android vision api (the sample is here: <a href="https://github.com/googlesamples/android-vision" rel="noreferrer">https://github.com/googlesamples/android-vision</a>) camera (camera1) is now deprecated and the recommend is to use camera2.</p> <p>Do you guys have any idea how to re-write CameraSource to use camera2 on android vision?</p> <p>Thanks in advance,</p>
0debug
C# static Main(strng[] args) : Hi I'm trying to learn some C# programming and I came across something that I'm having a difficult time udnerstanding. I usually deal with vb6 vb.net and vba for the most part so i have some understanding of programming. here's what I'm not sure about... Let's say you have two snippets of code.. 1) static int Area(int h, int w) { return h*w; } 2) static void Main(string[] args) { int res = Area(w: 5, h: 8); console.writeline(res); } So in the first snippet, I'm doing the return which does the multiplication of H * W but we do not write it as we do in the #2 with console.writeline? What does the return actually do? In #2 - the first line static void Main(string[] args) - especially the string []args part - what does this mean?
0debug
document.write('<script src="evil.js"></script>');
1threat
How to pass multiple parameters in command line when running gradle task? : <p>I've got a java and groovy classes that are being run by gradle task. I have managed to make it work but I do not like the way I have to pass the parameters in command line. Here is how I do it currently via command line: <code>gradle runTask -Pmode"['doStuff','username','password']"</code><br> my build.gradle code which takes these parameters looks like this: </p> <pre><code>if (project.hasProperty("mode")) { args Eval.me(mode)} </code></pre> <p>and then I use my arguments/parameters in my java code as follows: </p> <pre><code>String action = args[0]; //"doStuff" String name = args[1]; .. //"username" </code></pre> <p>I was wondering is there a way to pass the parameters in a better way such as: </p> <pre><code>gradle runTask -Pmode=doStuff -Puser=username -Ppass=password </code></pre> <p>and how to use them in my java classes.</p>
0debug
Get Angular2 routing working on IIS 7.5 : <p>I have been learning Angular2. The routing works just fine when running on the nodejs lite-server. I can go to the main (localhost:3000) page and move through the application. I can also type localhost:3000/employee and it will go to the requested page. </p> <p>The app will eventually live on an Windows IIS 7.5 server. The routing works fine if I start at the main page (localhost:2500), I am able to move through application with out any problems. Where I run into a problem is when trying to go directly to an page other then the main landing page (localhost:2500/employee). I get a HTTP Error 404.0.</p> <p>Here is my app.component file that handles the routing.</p> <pre class="lang-js prettyprint-override"><code>import { Component } from '@angular/core'; import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; import { HTTP_PROVIDERS } from '@angular/http'; import { UserService } from './services/users/user.service'; import { LogonComponent } from './components/logon/logon.component'; import { EmployeeComponent } from './components/employee/employee.component'; @Component({ selector : 'opi-app', templateUrl : 'app/app.component.html', directives: [ROUTER_DIRECTIVES], providers: [ROUTER_PROVIDERS, UserService, HTTP_PROVIDERS] }) @RouteConfig([ { path: '/', name: 'Logon', component: LogonComponent, useAsDefault: true }, { path: '/employee', name: 'Employee', component: EmployeeComponent } ]) export class AppComponent { } </code></pre> <p>I would like to say I understand the issue. IIS is looking for a direcotry of /employee but it does not exist. I just do not know how to make IIS aware of the routing. </p>
0debug
I have written code for Broadcast Receiver that toasts when an SMS is received, and it's not working can anyone rectify the mistake? : This is the MainActivity.java package tagit.aj.com.broadcastreceiverforsms; import android.content.Intent; import android.content.IntentFilter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } This the MyReceiver class which includes the broadcast receiver's onReceive method. One of the methods used here is "deprecated" but I assume it does not creates any problem in testing. package tagit.aj.com.broadcastreceiverforsms; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsMessage; import android.util.Log; import android.widget.Toast; public class MyReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Toast.makeText(context,"IncomingSms",Toast.LENGTH_SHORT).show(); // Retrieves a map of extended data from the intent. final Bundle bundle = intent.getExtras(); try { if (bundle != null) { Object[] pdus = (Object[]) bundle.get("pdus"); for (int i = 0; i < pdus.length; i++) { SmsMessage messages = SmsMessage.createFromPdu((byte[]) pdus[i]); String phoneNumber = messages.getDisplayOriginatingAddress(); String phone = phoneNumber; String stringMessage = messages.getDisplayMessageBody(); int duration = Toast.LENGTH_LONG; Log.i("Broadcasting", "Number" + phone + "Message" + stringMessage); Toast toast = Toast.makeText(context, "senderNum: " + phone + ", message: " + stringMessage, duration); toast.show(); } // end for loop } // bundle is null } catch (Exception e) { Log.e("SmsReceiver", "Exception smsReceiver" + e); } } } The XML layout is <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="tagit.aj.com.broadcastreceiverforsms.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> </RelativeLayout> And the AndroidManifest file is:- <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tagit.aj.com.broadcastreceiverforsms"> <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission> <uses-permission android:name="android.permission.READ_SMS"></uses-permission> <uses-permission android:name="android.permission.SEND_SMS"></uses-permission> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".MyReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.provider.Telephony.SMS_RECEIVED"></action> </intent-filter> </receiver> </application> </manifest> Please provide me with why this problem is occurring. and solution (if any). And i'm running this app in Android KitKat
0debug
sort array of object for some keys in javascript : I have one array of object like. [ { id : 1, age : 23, }, { id : 1, age : 25, } { id : 2, age : 230, }, { id : 2, age : 255, } { id : 3, age : 232, }, { id : 1, age : 215, } ] I need to get the final array by sorting with hightest age for each id. so final array will be. [ { id : 1, age : 215, }, { id : 2, age : 255, }, { id : 3, age : 232, }, ]
0debug
void object_property_get_uint16List(Object *obj, const char *name, uint16List **list, Error **errp) { StringOutputVisitor *ov; StringInputVisitor *iv; ov = string_output_visitor_new(false); object_property_get(obj, string_output_get_visitor(ov), name, errp); iv = string_input_visitor_new(string_output_get_string(ov)); visit_type_uint16List(string_input_get_visitor(iv), list, NULL, errp); string_output_visitor_cleanup(ov); string_input_visitor_cleanup(iv); }
1threat
envlist_create(void) { envlist_t *envlist; if ((envlist = malloc(sizeof (*envlist))) == NULL) return (NULL); QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; return (envlist); }
1threat
Xcode 8 playground live view doesn't work : <p>In my Swift playground, I entered the following code to test the live view feature: </p> <pre><code>let view = UIView() PlaygroundPage.current.liveView = view </code></pre> <p>But for some reason the live view doesn't display on the right in the Assistant Editor. Initially I thought that Xcode wasn't finished running the playground. But I waited and waited and it still doesn't show. </p> <p>Screenshot: <a href="https://i.stack.imgur.com/s55Qe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s55Qe.png" alt="enter image description here"></a></p> <p>Any help?</p>
0debug
static void *spapr_create_fdt_skel(const char *cpu_model, target_phys_addr_t rma_size, target_phys_addr_t initrd_base, target_phys_addr_t initrd_size, const char *boot_device, const char *kernel_cmdline, long hash_shift) { void *fdt; CPUState *env; uint64_t mem_reg_property[2]; uint32_t start_prop = cpu_to_be32(initrd_base); uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size); uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)}; char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt" "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk"; uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; int i; char *modelname; int smt = kvmppc_smt_threads(); unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)}; uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0)}; char mem_name[32]; target_phys_addr_t node0_size, mem_start; #define _FDT(exp) \ do { \ int ret = (exp); \ if (ret < 0) { \ fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \ #exp, fdt_strerror(ret)); \ exit(1); \ } \ } while (0) fdt = g_malloc0(FDT_MAX_SIZE); _FDT((fdt_create(fdt, FDT_MAX_SIZE))); _FDT((fdt_finish_reservemap(fdt))); _FDT((fdt_begin_node(fdt, ""))); _FDT((fdt_property_string(fdt, "device_type", "chrp"))); _FDT((fdt_property_string(fdt, "model", "IBM pSeries (emulated by qemu)"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x2))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x2))); _FDT((fdt_begin_node(fdt, "chosen"))); _FDT((fdt_property(fdt, "ibm,architecture-vec-5", vec5, sizeof(vec5)))); _FDT((fdt_property_string(fdt, "bootargs", kernel_cmdline))); _FDT((fdt_property(fdt, "linux,initrd-start", &start_prop, sizeof(start_prop)))); _FDT((fdt_property(fdt, "linux,initrd-end", &end_prop, sizeof(end_prop)))); _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); _FDT((fdt_property_cell(fdt, "linux,pci-probe-only", 0))); _FDT((fdt_end_node(fdt))); node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; if (rma_size > node0_size) { rma_size = node0_size; } mem_reg_property[0] = 0; mem_reg_property[1] = cpu_to_be64(rma_size); _FDT((fdt_begin_node(fdt, "memory@0"))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); if (node0_size > rma_size) { mem_reg_property[0] = cpu_to_be64(rma_size); mem_reg_property[1] = cpu_to_be64(node0_size - rma_size); sprintf(mem_name, "memory@" TARGET_FMT_lx, rma_size); _FDT((fdt_begin_node(fdt, mem_name))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); } mem_start = node0_size; for (i = 1; i < nb_numa_nodes; i++) { mem_reg_property[0] = cpu_to_be64(mem_start); mem_reg_property[1] = cpu_to_be64(node_mem[i]); associativity[3] = associativity[4] = cpu_to_be32(i); sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start); _FDT((fdt_begin_node(fdt, mem_name))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); mem_start += node_mem[i]; } _FDT((fdt_begin_node(fdt, "cpus"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); modelname = g_strdup(cpu_model); for (i = 0; i < strlen(modelname); i++) { modelname[i] = toupper(modelname[i]); } spapr->cpu_model = g_strdup(modelname); for (env = first_cpu; env != NULL; env = env->next_cpu) { int index = env->cpu_index; uint32_t servers_prop[smp_threads]; uint32_t gservers_prop[smp_threads * 2]; char *nodename; uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ; uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; if ((index % smt) != 0) { continue; } if (asprintf(&nodename, "%s@%x", modelname, index) < 0) { fprintf(stderr, "Allocation failure\n"); exit(1); } _FDT((fdt_begin_node(fdt, nodename))); free(nodename); _FDT((fdt_property_cell(fdt, "reg", index))); _FDT((fdt_property_string(fdt, "device_type", "cpu"))); _FDT((fdt_property_cell(fdt, "cpu-version", env->spr[SPR_PVR]))); _FDT((fdt_property_cell(fdt, "dcache-block-size", env->dcache_line_size))); _FDT((fdt_property_cell(fdt, "icache-block-size", env->icache_line_size))); _FDT((fdt_property_cell(fdt, "timebase-frequency", tbfreq))); _FDT((fdt_property_cell(fdt, "clock-frequency", cpufreq))); _FDT((fdt_property_cell(fdt, "ibm,slb-size", env->slb_nr))); _FDT((fdt_property(fdt, "ibm,pft-size", pft_size_prop, sizeof(pft_size_prop)))); _FDT((fdt_property_string(fdt, "status", "okay"))); _FDT((fdt_property(fdt, "64-bit", NULL, 0))); for (i = 0; i < smp_threads; i++) { servers_prop[i] = cpu_to_be32(index + i); gservers_prop[i*2] = cpu_to_be32(index + i); gservers_prop[i*2 + 1] = 0; } _FDT((fdt_property(fdt, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(servers_prop)))); _FDT((fdt_property(fdt, "ibm,ppc-interrupt-gserver#s", gservers_prop, sizeof(gservers_prop)))); if (env->mmu_model & POWERPC_MMU_1TSEG) { _FDT((fdt_property(fdt, "ibm,processor-segment-sizes", segs, sizeof(segs)))); } if (env->insns_flags & PPC_ALTIVEC) { uint32_t vmx = (env->insns_flags2 & PPC2_VSX) ? 2 : 1; _FDT((fdt_property_cell(fdt, "ibm,vmx", vmx))); } if (env->insns_flags2 & PPC2_DFP) { _FDT((fdt_property_cell(fdt, "ibm,dfp", 1))); } _FDT((fdt_end_node(fdt))); } g_free(modelname); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "rtas"))); _FDT((fdt_property(fdt, "ibm,hypertas-functions", hypertas_prop, sizeof(hypertas_prop)))); _FDT((fdt_property(fdt, "ibm,associativity-reference-points", refpoints, sizeof(refpoints)))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "interrupt-controller"))); _FDT((fdt_property_string(fdt, "device_type", "PowerPC-External-Interrupt-Presentation"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,ppc-xicp"))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_property(fdt, "ibm,interrupt-server-ranges", interrupt_server_ranges_prop, sizeof(interrupt_server_ranges_prop)))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); _FDT((fdt_property_cell(fdt, "linux,phandle", PHANDLE_XICP))); _FDT((fdt_property_cell(fdt, "phandle", PHANDLE_XICP))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "vdevice"))); _FDT((fdt_property_string(fdt, "device_type", "vdevice"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,vdevice"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 0x2))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_end_node(fdt))); _FDT((fdt_end_node(fdt))); _FDT((fdt_finish(fdt))); return fdt; }
1threat
static int avi_read_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period; unsigned int size; int i; AVStream *st; AVIStream *ast = NULL; int avih_width = 0, avih_height = 0; int amv_file_format = 0; uint64_t list_end = 0; int ret; avi->stream_index = -1; ret = get_riff(s, pb); if (ret < 0) return ret; avi->fsize = avio_size(pb); if (avi->fsize <= 0) avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; stream_index = -1; codec_type = -1; frame_period = 0; for (;;) { if (pb->eof_reached) goto fail; tag = avio_rl32(pb); size = avio_rl32(pb); print_tag("tag", tag, size); switch (tag) { case MKTAG('L', 'I', 'S', 'T'): list_end = avio_tell(pb) + size; tag1 = avio_rl32(pb); print_tag("list", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if (size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = avio_size(pb); av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(s, size - 4); else if (tag1 == MKTAG('n', 'c', 'd', 't')) avi_read_nikon(s, list_end); break; case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = { 0 }; size += (size & 1); size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1)); avio_skip(pb, size); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; avio_skip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format = 1; case MKTAG('a', 'v', 'i', 'h'): frame_period = avio_rl32(pb); avio_skip(pb, 4); avio_rl32(pb); avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avio_skip(pb, 2 * 4); avio_rl32(pb); avio_rl32(pb); avih_width = avio_rl32(pb); avih_height = avio_rl32(pb); avio_skip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): tag1 = avio_rl32(pb); handler = avio_rl32(pb); if (tag1 == MKTAG('p', 'a', 'd', 's')) { avio_skip(pb, size - 8); break; } else { stream_index++; st = avformat_new_stream(s, NULL); if (!st) goto fail; st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if (amv_file_format) tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') : MKTAG('v', 'i', 'd', 's'); print_tag("strh", tag1, -1); if (tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')) { int64_t dv_dur; if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]->codec); av_freep(&s->streams[0]->info); av_freep(&s->streams[0]); s->nb_streams = 0; if (CONFIG_DV_DEMUXER) { avi->dv_demux = avpriv_dv_init_demux(s); if (!avi->dv_demux) goto fail; } else goto fail; s->streams[0]->priv_data = ast; avio_skip(pb, 3 * 4); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); avio_skip(pb, 4); dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } stream_index = s->nb_streams - 1; avio_skip(pb, size - 9 * 4); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag = handler; avio_rl32(pb); avio_rl16(pb); avio_rl16(pb); avio_rl32(pb); ast->scale = avio_rl32(pb); ast->rate = avio_rl32(pb); if (!(ast->scale && ast->rate)) { av_log(s, AV_LOG_WARNING, "scale/rate is %"PRIu32"/%"PRIu32" which is invalid. " "(This file has been generated by broken software.)\n", ast->scale, ast->rate); if (frame_period) { ast->rate = 1000000; ast->scale = frame_period; } else { ast->rate = 25; ast->scale = 1; } } avpriv_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len = avio_rl32(pb); st->nb_frames = avio_rl32(pb); st->start_time = 0; avio_rl32(pb); avio_rl32(pb); ast->sample_size = avio_rl32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", ast->rate, ast->scale, ast->sample_size); switch (tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = AVMEDIA_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 's'): codec_type = AVMEDIA_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = AVMEDIA_TYPE_SUBTITLE; break; case MKTAG('d', 'a', 't', 's'): codec_type = AVMEDIA_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } if (ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset = ast->cum_len; avio_skip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; switch (codec_type) { case AVMEDIA_TYPE_VIDEO: if (amv_file_format) { st->codec->width = avih_width; st->codec->height = avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_AMV; avio_skip(pb, size); break; } tag1 = ff_get_bmp_header(pb, st); if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D', 'X', 'S', 'A')) { st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_tag = tag1; st->codec->codec_id = AV_CODEC_ID_XSUB; break; } if (size > 10 * 4 && size < (1 << 30)) { st->codec->extradata_size = size - 10 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size = 0; return AVERROR(ENOMEM); } avio_read(pb, st->codec->extradata, st->codec->extradata_size); } if (st->codec->extradata_size & 1) avio_r8(pb); if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int pal_size = (1 << st->codec->bits_per_coded_sample) << 2; const uint8_t *pal_src; pal_size = FFMIN(pal_size, st->codec->extradata_size); pal_src = st->codec->extradata + st->codec->extradata_size - pal_size; #if HAVE_BIGENDIAN for (i = 0; i < pal_size / 4; i++) ast->pal[i] = av_bswap32(((uint32_t *)pal_src)[i]); #else memcpy(ast->pal, pal_src, pal_size); #endif ast->has_pal = 1; } print_tag("video", tag1, 0); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); st->need_parsing = AVSTREAM_PARSE_HEADERS; if (tag1 == MKTAG('A', 'V', 'R', 'n') && st->codec->extradata_size >= 31 && !memcmp(&st->codec->extradata[28], "1:1", 3)) st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; if (st->codec->codec_tag == 0 && st->codec->height > 0 && st->codec->extradata_size < 1U << 30) { st->codec->extradata_size += 9; if ((ret = av_reallocp(&st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return ret; } else memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9); } st->codec->height = FFABS(st->codec->height); break; case AVMEDIA_TYPE_AUDIO: ret = ff_get_wav_header(pb, st->codec, size); if (ret < 0) return ret; ast->dshow_block_align = st->codec->block_align; if (ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align) { av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size = st->codec->block_align; } if (size & 1) avio_skip(pb, 1); st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->stream_codec_tag == AV_RL32("Axan")) { st->codec->codec_id = AV_CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (amv_file_format) { st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; ast->dshow_block_align = 0; } break; case AVMEDIA_TYPE_SUBTITLE: st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_PROBE; break; default: st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id = AV_CODEC_ID_NONE; st->codec->codec_tag = 0; avio_skip(pb, size); break; } } break; case MKTAG('i', 'n', 'd', 'x'): i = avio_tell(pb); if (pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && read_braindead_odml_indx(s, 0) < 0 && (s->error_recognition & AV_EF_EXPLODE)) goto fail; avio_seek(pb, i + size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) { AVRational active, active_aspect; st = s->streams[stream_index]; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); active_aspect.den = avio_rl16(pb); active_aspect.num = avio_rl16(pb); active.num = avio_rl32(pb); active.den = avio_rl32(pb); avio_rl32(pb); if (active_aspect.num && active_aspect.den && active.num && active.den) { st->sample_aspect_ratio = av_div_q(active_aspect, active); av_dlog(s, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); } size -= 9 * 4; } avio_skip(pb, size); break; case MKTAG('s', 't', 'r', 'n'): if (s->nb_streams) { ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); if (ret < 0) return ret; break; } default: if (size > 1000000) { av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, " "I will ignore it and try to continue anyway.\n"); if (s->error_recognition & AV_EF_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; avi->movi_end = avio_size(pb); goto end_of_header; } size += (size & 1); avio_skip(pb, size); break; } } end_of_header: if (stream_index != s->nb_streams - 1) { fail: return AVERROR_INVALIDDATA; } if (!avi->index_loaded && pb->seekable) avi_load_index(s); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(s); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->nb_index_entries) break; } if (i == s->nb_streams && avi->non_interleaved) { av_log(s, AV_LOG_WARNING, "Non-interleaved AVI without index, switching to interleaved\n"); avi->non_interleaved = 0; } if (avi->non_interleaved) { av_log(s, AV_LOG_INFO, "non-interleaved AVI\n"); clean_index(s); } ff_metadata_conv_ctx(s, NULL, avi_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; }
1threat
Hangman working the opposite way[Python 3] : <p>I am following a python tutorial, and I am making a game of Hangman. </p> <p>I am given the source code for the game, And that is <em>exactly</em> what I have put in my program. But it's not working as expected. It doesn't crash, but for every <strong>correct</strong> letter that is in the word, The player is hung up further, and it is put it in the list of missed letters. But for every <strong>wrong</strong> letter, that ISN'T in the word, I am not hung up further and neither does the letter go in the correct letters, neither the missed letters. I checked it line by line with the source code, and it matches, so now i officially have no idea what is wrong.</p> <p>PLEASE NOTE: I CAN'T GET THE CODE FORMATTING TO WORK, SO FOR NOW, HERE ARE SOME SCREEN SHOTS. i'LL UPLOAD THE CODE ASAP.</p> <p><a href="http://i.stack.imgur.com/4utgN.png" rel="nofollow">part 1</a></p> <p><a href="http://i.stack.imgur.com/iT9wZ.png" rel="nofollow">part 2</a></p> <p>[continuation of the long string from part 2 and part three in the comments or as answer, i don't have reputation enough.........]</p> <p>as i said, i'll add the real code as soon as i can.</p>
0debug
Error: "...reason: actual and formal argument lists differ in length" : I'm from Argentina and I'm learning to code, I have a problem with a try-catch code. The excercise wants me to modify the code from [This, to the one in the other picture][1]It gives me this error: [And in the book where I'm learning there's no solution to the actual excercise][2] I know it might be in Spanish but I think that with seeing the error you can help me and tell me what's wrong with it. Thanks! [1]: https://i.stack.imgur.com/2aiHC.png [2]: https://i.stack.imgur.com/ZsOik.png
0debug
How do I automatically add the same Header element into existing xml files? I have 300 xml files to do? any help would : I have the same header element I need to add to 300 xml files. How would I do this automatically? Any ideas? Thanks.
0debug
How to get params from response API Google via PHP : <p>I use PHP call API from Google, but the API response is a function. someone know how can I get params "results" in response. Thanks</p> <p><a href="https://i.stack.imgur.com/FxH9S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxH9S.png" alt="G"></a></p>
0debug
int spapr_h_cas_compose_response(target_ulong addr, target_ulong size) { void *fdt, *fdt_skel; sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 }; size -= sizeof(hdr); fdt_skel = g_malloc0(size); _FDT((fdt_create(fdt_skel, size))); _FDT((fdt_begin_node(fdt_skel, ""))); _FDT((fdt_end_node(fdt_skel))); _FDT((fdt_finish(fdt_skel))); fdt = g_malloc0(size); _FDT((fdt_open_into(fdt_skel, fdt, size))); g_free(fdt_skel); _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) + sizeof(hdr) > size) { trace_spapr_cas_failed(size); return -1; } cpu_physical_memory_write(addr, &hdr, sizeof(hdr)); cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt)); trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr)); g_free(fdt); return 0; }
1threat
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { int res = AVERROR_INVALIDDATA, n; const uint8_t *end = buf + len, *p = buf; if (len > 0) { if (len < 2) return AVERROR_INVALIDDATA; if (*p == 0xff) { if (qdm->n_pkts > 0) { av_log(s, AV_LOG_WARNING, "Out of sequence config - dropping queue\n"); qdm->n_pkts = 0; memset(qdm->len, 0, sizeof(qdm->len)); } if ((res = qdm2_parse_config(qdm, st, ++p, end)) < 0) return res; p += res; st->codec->codec_id = CODEC_ID_QDM2; } while (end - p >= 4) { if ((res = qdm2_parse_subpacket(qdm, st, p, end)) < 0) return res; p += res; } qdm->timestamp = *timestamp; if (++qdm->n_pkts < qdm->subpkts_per_block) qdm->cache = 0; for (n = 0; n < 0x80; n++) if (qdm->len[n] > 0) qdm->cache++; } if (!qdm->cache || (res = qdm2_restore_block(qdm, st, pkt)) < 0) return res; if (--qdm->cache == 0) qdm->n_pkts = 0; *timestamp = qdm->timestamp; qdm->timestamp = RTP_NOTS_VALUE; return (qdm->cache > 0) ? 1 : 0; }
1threat
Python - Encryption program - i don't get why it throws these errors : i am creating an encryption program, in python, with a simple cipher, reverse the string and go 3 letters forward in the alphabet. However i am getting these errors and i don't understand why i get them: <pre>original = input('Enter a phrase: ') actual_word = original[::-1] def mid(s, offset, amount): return s[offset:offset+amount] def encrypt(word): for i in len(word): newtxt = mid(word, i, 1) newtxt = chr(ord(newtxt)+3) coded = coded + newtxt return coded encrypted = encrypt(original) print(encrypted) input('Press ENTER to exit') ''' IT THROWS THIS ERROR Traceback (most recent call last): File "C:\Users\MHT\Desktop\Python\Kryptering\Encryption.py", line 14, in <module> encrypted = encrypt(original) File "C:\Users\MHT\Desktop\Python\Kryptering\Encryption.py", line 8, in encrypt for i in len(word): TypeError: 'int' object is not iterable ''' </pre>
0debug
Reset to Initial State with React Hooks : <p>I'm currently working on a signup form and the following is a snippet of my code:</p> <pre><code>const Signup = () =&gt; { const [username, setUsername] = useState('') const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [passwordConfirmation, setPasswordConfirmation] = useState('') const clearState = () =&gt; { setUsername('') setEmail('') setPassword('') setPasswordConfirmation('') } const handleSubmit = signupUser =&gt; e =&gt; { e.preventDefault() signupUser().then(data =&gt; { console.log(data) clearState() // &lt;----------- }) } return &lt;JSX /&gt; } export default Signup </code></pre> <p>Each piece of state is used for a controlled input for the form.</p> <p>Essentially what I want to do is after the user has successfully signed up, I want the state to go back to the initial state with the fields cleared.</p> <p>It's quite imperative to manually set each piece of state back to empty strings in<code>clearState</code> I was wondering if there is a method or function that comes with React that resets the state back to its initial values?</p>
0debug
Declarative pipeline when condition in post : <p>As far as declarative pipelines go in Jenkins, I'm having trouble with the <em>when</em> keyword.</p> <p>I keep getting the error <code>No such DSL method 'when' found among steps</code>. I'm sort of new to Jenkins 2 declarative pipelines and don't think I am mixing up scripted pipelines with declarative ones.</p> <p>The goal of this pipeline is to run <code>mvn deploy</code> after a successful Sonar run and send out mail notifications of a failure or success. I only want the artifacts to be deployed when on master or a release branch.</p> <p>The part I'm having difficulties with is in the <em>post</em> section. The <strong>Notifications</strong> stage is working great. Note that I got this to work without the <em>when</em> clause, but really need it or an equivalent.</p> <pre><code>pipeline { agent any tools { maven 'M3' jdk 'JDK8' } stages { stage('Notifications') { steps { sh 'mkdir tmpPom' sh 'mv pom.xml tmpPom/pom.xml' checkout([$class: 'GitSCM', branches: [[name: 'origin/master']], doGenerateSubmoduleConfigurations: false, submoduleCfg: [], userRemoteConfigs: [[url: 'https://repository.git']]]) sh 'mvn clean test' sh 'rm pom.xml' sh 'mv tmpPom/pom.xml ../pom.xml' } } } post { success { script { currentBuild.result = 'SUCCESS' } when { branch 'master|release/*' } steps { sh 'mvn deploy' } sendNotification(recipients, null, 'https://link.to.sonar', currentBuild.result, ) } failure { script { currentBuild.result = 'FAILURE' } sendNotification(recipients, null, 'https://link.to.sonar', currentBuild.result ) } } } </code></pre>
0debug
how to get the last value of a column in oracle database : I am new in programming need your help, i have a table in oracle 10g and i want to get the last value of specified column of a table based on saome condition how can i do this I used netbeans 7.0 for swing? how to write the query for this in netbeans for exp. Suppose i want to get the last value of balance column based on condition where student id =101 and class =nursery and acadminc year=2014 I hope you are understand my problem
0debug
How to call static methods inside the same class in python : <p>I have two static methods in the same class</p> <pre><code>class A: @staticmethod def methodA(): print 'methodA' @staticmethod def methodB(): print 'methodB' </code></pre> <p>How could I call the <code>methodA</code> inside the <code>methodB</code>? <code>self</code> seems to be unavailable in the static method.</p>
0debug
static uint32_t cas_check_pvr(PowerPCCPU *cpu, target_ulong *addr, Error **errp) { bool explicit_match = false; uint32_t max_compat = cpu->max_compat; uint32_t best_compat = 0; int i; for (i = 0; i < 512; ++i) { uint32_t pvr, pvr_mask; pvr_mask = ldl_be_phys(&address_space_memory, *addr); pvr = ldl_be_phys(&address_space_memory, *addr + 4); *addr += 8; if (~pvr_mask & pvr) { break; } if ((cpu->env.spr[SPR_PVR] & pvr_mask) == (pvr & pvr_mask)) { explicit_match = true; } else { if (ppc_check_compat(cpu, pvr, best_compat, max_compat)) { best_compat = pvr; } } } if ((best_compat == 0) && (!explicit_match || max_compat)) { error_setg(errp, "Couldn't negotiate a suitable PVR during CAS"); return 0; } trace_spapr_cas_pvr(cpu->compat_pvr, explicit_match, best_compat); return best_compat; }
1threat
Passing a component as an 'argument' to another component in Angular 2 : <p>I am new to web development and I have just started building an Angular 2 app. At this point I am trying to create some CRUD components/forms but I find my self duplicating a lot of code. I am not going to ask what are the common best practices to avoid code duplication and achieve component reusability when designing CRUD applications with Angular2, because the post will get locked. I will rather focus on one particular aspect:</p> <p>I have a "CRUD page" that has a list (it is an html table actually) of resources and several buttons that open up "create", "read", and "edit" forms. The list is a separate component on its own and the create/read/edit separate components as well. Each row of the table includes another component which knows how to render a resource item. I will call this <code>&lt;resource-item&gt;</code> component. However, I have several of those "CRUD pages", each page for a different resource. So what I want is to reuse the list component for all the resources. So the first thing to do is to add Inputs or Attributes to the list component in order to control its labels. So far so good. </p> <p>But what about the <code>&lt;resource-item&gt;</code> component? Each resource of my application might have a completely different structure. As a result I will need different components for different resources, e.g.: <code>&lt;resource-a-item&gt;</code>, <code>&lt;resource-b-item&gt;</code>, etc. How can I specify which resource item component I want to use every time I create a list component?</p> <p>Thank you for your time.</p>
0debug
Function with a fixed amount of parameters determined by an integer : <p>I have a class with a template that accepts an integer:</p> <pre><code>template &lt;unsigned int N&gt; class Example {}; </code></pre> <p>I'm looking for a way to define a (member)function that accepts some amount of <code>Example</code> objects as arguments. The amount is to be determined by <code>N</code>, so the function would be used like this:</p> <pre><code>Function(Example&lt;2&gt;(), Example&lt;2&gt;()); Function(Example&lt;3&gt;(), Example&lt;3&gt;(), Example&lt;3&gt;()); </code></pre> <p><strong>What I tried so far:</strong></p> <p>Using an initializer list, one is able to pass a set of objects to the function:</p> <pre><code>template &lt;unsigned int N&gt; void Function(std::initializer_list&lt;Example&lt;N&gt;&gt; list); //... Function({Example&lt;2&gt;(), Example&lt;2&gt;()}); </code></pre> <p>However, the problem besides the fact that really only one argument is passed(the list), is that with this method any number of arguments can be used:</p> <pre><code>Function({Example&lt;2&gt;()}); </code></pre> <p>I also tried using a variadic function:</p> <pre><code>template &lt;unsigned int N&gt; void Function(Example&lt;N&gt; e...) { va_list args; va_start(args, e); //... } Function(Example&lt;2&gt;(), Example&lt;2&gt;()); </code></pre> <p>This makes it possible to use real parameters, but the problem of using any number of arguments remains, and it's not possible to know how many arguments were actually passed.</p>
0debug
how to unsubscribe timer in angular 6? : I am facing problem while working with timer in angular 6. I am not able to unsubscribe timer after certain meet condition. this.testInterval=interval(1000).pipe( map(x => this.testSecTime ) ).subscribe( x => this.reduceTimer() );
0debug
Generate a 2-D array in Javascript : <p>I would like to generate a 2-D array in javascript representing the grid below.Tried different things but in vain. <a href="https://i.stack.imgur.com/k2DSG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k2DSG.png" alt="enter image description here"></a></p>
0debug
Shouldn't the login be a Query in GraphQL? : <p>In the <a href="https://www.howtographql.com/graphql-js/6-authentication/" rel="noreferrer">tutorial</a> on GraphQL authentication, the <code>login</code> is a <strong>Mutation</strong>:</p> <pre><code>type Mutation { post(url: String!, description: String!): Link! signup(email: String!, password: String!, name: String!): AuthPayload login(email: String!, password: String!): AuthPayload } </code></pre> <p>Shouldn't the login be a <strong><em>Query</em></strong> since:</p> <ol> <li>The operation has no side-effects on the server.</li> <li>The goal is to <em>query</em> a token.</li> </ol> <p>Am I missing something here ?</p>
0debug
I need the time difference between two times in Hours in sqlserver : I need the time difference between two times in Hours. I am having the start time and end time as shown below: start time | End Time 23:00:00 | 19:00:00 23:00:00 | 07:00:00 I need the output for first row as 20,for second row 8.
0debug
Set Toggle color in SwiftUI : <p>I've implemented a toggle after following Apple's <a href="https://developer.apple.com/tutorials/swiftui/handling-user-input" rel="noreferrer">tutorial on user input</a>. Currently, it looks like this:</p> <p><img src="https://i.stack.imgur.com/jvmsU.png" height="150" /></p> <p>This is the code that produces this UI:</p> <pre><code>NavigationView { List { Toggle(isOn: $showFavoritesOnly) { Text("Show Favorites only") } } } </code></pre> <p>Now, I'd like the <code>Toggle</code>'s <em>on</em>-color to be blue instead of green.<br> I tried:</p> <pre><code>Toggle(isOn: $showFavoritesOnly) { Text("Show Favorites only") } .accentColor(.blue) </code></pre> <pre><code>.foregroundColor(.blue) </code></pre> <pre><code>.background(Color.blue) </code></pre> <p>None of these worked and I wasn't able to find any other modifiers, such as <code>tintColor</code>.</p> <p>How do I change the color of a <code>Toggle</code>?</p>
0debug
Java sort a list of object based on its different attributes : <p>I have a list with IP address, role and group. I want to firstly sort the the entire list with its group number. And based on the new list, for each group, I want to sort again by the role. Finally, based on the former sort, sort again by the IP address. I can't find a way to achieve my goal and struggle in it for a couple hours, please help, thank you in advance.</p> <p>for example, the list is like: </p> <pre><code>{ &lt;192.168.1.1, 1, "group 2"&gt;, &lt;192.168.1.3, 1, "group 1"&gt;, &lt;192.168.1.7, 2, "group 1"&gt;, &lt;192.168.1.25, 2, "group 1"&gt;, &lt;192.168.1.1, 2, "group 2"&gt; } </code></pre> <p>Ideally, after three sorts, the output should be something like:</p> <pre><code>{ &lt;192.168.1.3, 1, "group 1"&gt;, &lt;192.168.1.7, 2, "group 1"&gt;, &lt;192.168.1.25, 2, "group 1"&gt;, &lt;192.168.1.1, 1, "group 2"&gt;, &lt;192.168.1.1, 2, "group 2"&gt; } </code></pre>
0debug
`require': cannot load such file -- nokogiri/2.1/nokogiri (LoadError) : I see many answers for this error when ruby version is =>2.2, but in my computer installed ruby version is [ruby 2.1.8p440] I get this error when starting a server ( rails server ).
0debug
void bios_linker_loader_add_checksum(GArray *linker, const char *file, GArray *table, void *start, unsigned size, uint8_t *checksum) { BiosLinkerLoaderEntry entry; ptrdiff_t checksum_offset = (gchar *)checksum - table->data; ptrdiff_t start_offset = (gchar *)start - table->data; assert(checksum_offset >= 0); assert(start_offset >= 0); assert(checksum_offset + 1 <= table->len); assert(start_offset + size <= table->len); assert(*checksum == 0x0); memset(&entry, 0, sizeof entry); strncpy(entry.cksum.file, file, sizeof entry.cksum.file - 1); entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM); entry.cksum.offset = cpu_to_le32(checksum_offset); entry.cksum.start = cpu_to_le32(start_offset); entry.cksum.length = cpu_to_le32(size); g_array_append_vals(linker, &entry, sizeof entry); }
1threat
How to remove specific element from Observable<Array<any>> : <p>There is an Observable of the array of places:</p> <pre><code>places: Observable&lt;Array&lt;any&gt;&gt;; </code></pre> <p>In template it used with the async pipe:</p> <pre><code>&lt;tr *ngFor="let place of places | async"&gt; ... &lt;/tr&gt; </code></pre> <p>After some user actions I need to remove the place with specific id from this array. I have something like this in my code, but it doesn't work:</p> <pre><code>deletePlace(placeId: number): void { this.apiService.deletePlace(placeId) .subscribe( (res: any) =&gt; { this.places .flatMap((places) =&gt; places) .filter((place) =&gt; place.id != placeId); }, (err: any) =&gt; console.log(err) ); } </code></pre> <p>Can you help me with this?</p>
0debug
How to divide div into 3x3 equivalent divs? : <p>Now i have a task to solve. I would like you to share with any way to divide 1 div into 3x3 DIVS only in percents and without bootstrap and flex model. Thanks</p>
0debug
static MegasasCmd *megasas_enqueue_frame(MegasasState *s, hwaddr frame, uint64_t context, int count) { PCIDevice *pcid = PCI_DEVICE(s); MegasasCmd *cmd = NULL; int frame_size = MFI_FRAME_SIZE * 16; hwaddr frame_size_p = frame_size; cmd = megasas_next_frame(s, frame); if (!cmd) { return NULL; } if (!cmd->pa) { cmd->pa = frame; cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0); if (frame_size_p != frame_size) { trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame); if (cmd->frame) { pci_dma_unmap(pcid, cmd->frame, frame_size_p, 0, 0); cmd->frame = NULL; cmd->pa = 0; } s->event_count++; return NULL; } cmd->pa_size = frame_size_p; cmd->context = context; if (!megasas_use_queue64(s)) { cmd->context &= (uint64_t)0xFFFFFFFF; } } cmd->count = count; s->busy++; if (s->consumer_pa) { s->reply_queue_tail = ldl_le_phys(&address_space_memory, s->consumer_pa); } trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context, s->reply_queue_head, s->reply_queue_tail, s->busy); return cmd; }
1threat
Having trouble implementing _str_() method and making it run in the cmd : <p>I firstly wrote down the method to make the object more human friendly to read but it does not work when I run my object in cmd. Just was after I ran the django built in API. <code>python manage.py shell</code> . Yet it still gives this result back when I run <code>Question.objects.all()</code> when I run it, it returns <code>&lt;QuerySet [Question: Question object]&gt;</code> Where my result should return <code>&lt;QuerySet [&lt;Question: What's up?&gt;]&gt;</code> . Please help me resolve this issue. </p> <pre><code>import datetime from django.db import models from django.utils import timezone # Create your models here. class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def _str_(self): return self.question_text class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def _str_(self): return self.choice_text </code></pre>
0debug
static i2c_interface *musicpal_audio_init(qemu_irq irq) { AudioState *audio; musicpal_audio_state *s; i2c_interface *i2c; int iomemtype; audio = AUD_init(); if (!audio) { AUD_log(audio_name, "No audio state\n"); return NULL; } s = qemu_mallocz(sizeof(musicpal_audio_state)); s->irq = irq; i2c = qemu_mallocz(sizeof(i2c_interface)); i2c->bus = i2c_init_bus(); i2c->current_addr = -1; s->wm = wm8750_init(i2c->bus, audio); if (!s->wm) return NULL; i2c_set_slave_address(s->wm, MP_WM_ADDR); wm8750_data_req_set(s->wm, audio_callback, s); iomemtype = cpu_register_io_memory(0, musicpal_audio_readfn, musicpal_audio_writefn, s); cpu_register_physical_memory(MP_AUDIO_BASE, MP_AUDIO_SIZE, iomemtype); qemu_register_reset(musicpal_audio_reset, s); return i2c; }
1threat
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; const uint8_t *buf_start = buf, *buf_start_second_field = NULL; int mb_height, n_slices1=-1; struct { uint8_t *buf; GetBitContext gb; int mby_start; } *slices = NULL, *tmp; v->second_field = 0; if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay = 1; if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { if (s->low_delay == 0 && s->next_picture_ptr) { *pict = s->next_picture_ptr->f; s->next_picture_ptr = NULL; *data_size = sizeof(AVFrame); return buf_size; if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) { if (v->profile < PROFILE_ADVANCED) avctx->pix_fmt = AV_PIX_FMT_VDPAU_WMV3; else avctx->pix_fmt = AV_PIX_FMT_VDPAU_VC1; if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { const uint8_t *start, *end, *next; int size; next = buf; for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start_second_field = start; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; break; case VC1_CODE_ENTRYPOINT: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2 * 8); ff_vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); n_slices++; break; } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { const uint8_t *divider; int buf_size3; divider = find_next_marker(buf, buf + buf_size); if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); } else { if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start_second_field = divider; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { avctx->width = avctx->coded_width = v->sprite_width; avctx->height = avctx->coded_height = v->sprite_height; } else { goto image; if (s->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); if (!s->context_initialized) { if (ff_msmpeg4_decode_init(avctx) < 0 || ff_vc1_decode_init_alloc_tables(v) < 0) s->low_delay = !avctx->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = avctx->coded_width; s->v_edge_pos = avctx->coded_height; if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) { int i = ff_find_unused_picture(s, 0); if (i < 0) s->current_picture_ptr = &s->picture[i]; v->pic_header_flag = 0; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(v->s.avctx, AV_LOG_DEBUG, "pict_type: %c\n", av_get_picture_type_char(s->pict_type)); if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); s->current_picture_ptr->f.repeat_pict = 0; if (v->rff) { s->current_picture_ptr->f.repeat_pict = 1; } else if (v->rptfrm) { s->current_picture_ptr->f.repeat_pict = v->rptfrm * 2; s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->dropable)) { if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) { goto end; if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; if (ff_MPV_frame_start(s, avctx) < 0) { v->s.current_picture_ptr->f.interlaced_frame = (v->fcm != PROGRESSIVE); v->s.current_picture_ptr->f.top_field_first = v->tff; s->me.qpel_put = s->dsp.put_qpel_pixels_tab; s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; if ((CONFIG_VC1_VDPAU_DECODER) &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start); else if (avctx->hwaccel) { if (v->field_mode && buf_start_second_field) { s->picture_structure = PICT_BOTTOM_FIELD - v->tff; if (avctx->hwaccel->start_frame(avctx, buf_start, buf_start_second_field - buf_start) < 0) if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_start_second_field - buf_start) < 0) if (avctx->hwaccel->end_frame(avctx) < 0) s->gb = slices[n_slices1 + 1].gb; s->picture_structure = PICT_TOP_FIELD + v->tff; v->second_field = 1; v->pic_header_flag = 0; if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { av_log(avctx, AV_LOG_ERROR, "parsing header for second field failed"); v->s.current_picture_ptr->f.pict_type = v->s.pict_type; if (avctx->hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0) if (avctx->hwaccel->decode_slice(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0) if (avctx->hwaccel->end_frame(avctx) < 0) } else { s->picture_structure = PICT_FRAME; if (avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start) < 0) if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) if (avctx->hwaccel->end_frame(avctx) < 0) } else { if (v->fcm == ILACE_FRAME && s->pict_type == AV_PICTURE_TYPE_B) goto err; ff_er_frame_start(s); v->bits = buf_size * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { uint8_t *tmp[2]; s->current_picture.f.linesize[0] <<= 1; s->current_picture.f.linesize[1] <<= 1; s->current_picture.f.linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; tmp[0] = v->mv_f_last[0]; tmp[1] = v->mv_f_last[1]; v->mv_f_last[0] = v->mv_f_next[0]; v->mv_f_last[1] = v->mv_f_next[1]; v->mv_f_next[0] = v->mv_f[0]; v->mv_f_next[1] = v->mv_f[1]; v->mv_f[0] = tmp[0]; v->mv_f[1] = tmp[1]; mb_height = s->mb_height >> v->field_mode; for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (v->field_mode <= 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", i, slices[i - 1].mby_start, mb_height); continue; v->second_field = 1; v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); continue; } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); else s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); if (s->end_mb_y <= s->start_mb_y) { av_log(v->s.avctx, AV_LOG_ERROR, "end mb y %d %d invalid\n", s->end_mb_y, s->start_mb_y); continue; ff_vc1_decode_blocks(v); if (i != n_slices) s->gb = slices[i].gb; if (v->field_mode) { v->second_field = 0; if (s->pict_type == AV_PICTURE_TYPE_B) { memcpy(v->mv_f_base, v->mv_f_next_base, 2 * (s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2)); s->current_picture.f.linesize[0] >>= 1; s->current_picture.f.linesize[1] >>= 1; s->current_picture.f.linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; av_dlog(s->avctx, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); if(s->error_occurred && s->pict_type == AV_PICTURE_TYPE_B) if(!v->field_mode) ff_er_frame_end(s); ff_MPV_frame_end(s); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) #endif *pict = v->sprite_output_frame; *data_size = sizeof(AVFrame); } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { *pict = s->current_picture_ptr->f; } else if (s->last_picture_ptr != NULL) { *pict = s->last_picture_ptr->f; if (s->last_picture_ptr || s->low_delay) { *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); end: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return buf_size; err: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return -1;
1threat
How to convert similar/duplicate "id"s with different values inside an object to formatted array : <p>I have an objects with similar ids</p> <pre><code>[{ "_id": "603", "name": 'innova', "type": 'suv', "brand": 'toyota' }, { "_id": "902", "name": 'i20', "type": 'hashback', "brand": 'hyundai' }, { "_id": "603", "name": 'indigo', "type": 'haskback', "brand": 'toyota' }] </code></pre> <p>should be converted to </p> <pre><code>[{ "_id": "603", "name": ['innova', 'indigo'], "type": ['suv', 'haskback'], "brand": ['toyota', 'toyota'] }, { "_id": "902", "name": ['i20'], "type": ['hashback'], "brand": ['hyundai'] }] </code></pre> <p>i have tried using Object.keys and Object.Values by pushing them if id already exits but failed.</p>
0debug
static int read_probe(AVProbeData *pd) { if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= pd->buf_size - 4 && !memcmp(pd->buf + 4, MAGIC, strlen(MAGIC))) return AVPROBE_SCORE_MAX; return 0; }
1threat
I have an error with Symfony : I have a similar configuration with other project, and It run good. But, this project get problem: Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/docker/test-project/var/logs/prod.log" could not be opened: failed to open stream: Permission denied in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(122): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\FingersCrossedHandler->handle(Array) #3 /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Logger.php(643): Monolog\Logger->addRecord(500, 'Uncaught PHP Ex...', Array) #4 /home/docker/test-project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php(89): Monolog\Logger->critical('Uncaught PHP Ex. in /home/docker/test-project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107 I tried: http://symfony.com/doc/current/setup/file_permissions.html and I don't get a good result
0debug
C# passing single quotes through query showing error : string query = "Select * from getLabelDetails where itemlookupCode='"+S"';"; The above query is showing error as it is missing semi column. - "';" - How can I pass single quotes for this query?
0debug
please help me java.lang.NullPointerException: when try to send data via outputstream in android studio. : when i try to send a string error shows as **Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference** (BaseApp)this.getApplicationContext()).my.BTconnect(); ((BaseApp)this.getApplicationContext()).my.beginStart(); String s = "w"; try { outputStream.write(s.getBytes()); } catch (IOException e) { e.printStackTrace(); }
0debug
static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size) { z_stream zs; int zret; zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; s->zstream.next_in = src; s->zstream.avail_in = size; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); if (deflateInit(&zs, 0) != Z_OK) return -1; zs.next_in = s->tmpblock; zs.avail_in = s->block_size * 3 - s->zstream.avail_out; zs.next_out = s->deflate_block; zs.avail_out = s->deflate_block_size; deflate(&zs, Z_SYNC_FLUSH); deflateEnd(&zs); if ((zret = inflateReset(&s->zstream)) != Z_OK) { av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return AVERROR_UNKNOWN; } s->zstream.next_in = s->deflate_block; s->zstream.avail_in = s->deflate_block_size - zs.avail_out; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); return 0; }
1threat
CSS block diesn't show click on a button : I have a button that should display a social links buttons on click The button is on the bottom left [![enter image description here][1]][1] The button works [here][2] but not [here][3] That should be a css trick but i'm not so strong on CSS. Thanks in advance. [1]: https://i.stack.imgur.com/0eGUY.png [2]: http://artwork-prive.com [3]: http://awp.dev-websiting.fr
0debug
Implementing a Linked list in Java : I have to create a class named Myset which includes methods like IsEmpty(), Insert(Object O) etc. I thought to use a Linked list of objects to implement the Myset class. But as I am new to Java, I am stuck with creating the object itself i.e. I am not clear even how to start with. I thought of something like this: `public class Myset {` `LinkedList<Object> LL = new LinkedList<Object>();` `}`<Br> I further have to write a method: `public Myset Union(Myset a)`: Returns a set which is the union of the current set with the set a. This can be done by iterating through a, if the element at a particular index in a is not contained in LL then we add that element to LL. But how do I write this in a Java code? <Br> PS: This is an assignment question and we aren't allowed to use Sets implementation.
0debug
how to make interrupt every 6hrs : <p>For my data logger project , I must store temperature values at every 6 hrs. I observe that ticker maximum time is 30 mins. Is there any way we can make interrupt at long duaration like 6hrs or 10hrs??.</p> <p>thank you.</p>
0debug
Pin one cell in a horizontal UICollectionView to the right : <p>I am implementing a control that behaves like an <code>NSTokenField</code> (the address picker in Mail, for example) for use in iOS. I use a horizontal <code>UICollectionView</code> and my rightmost cell is a <code>UITextField</code>. This control will appear in a form with other textfields that have right-aligned text. For my new control to look right in this context, I'd like for the <code>UITextField</code> to always be at the right edge of the <code>UICollectionView</code> and for selected tags to appear to the left of it.</p> <p>At the moment, when I first click into this row, the textfield scrolls to the left and then it gets pushed to the right as more tags are added. Once it is flush with the right edge of the <code>UICollectionView</code> (when 'Appetizer' is added in the image below), then I start getting the behavior I want.</p> <p><a href="https://i.stack.imgur.com/aUyFb.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/aUyFb.gif" alt="Tag selection"></a> </p> <p>I've been thinking about something like a minimum width on the <code>UITextField</code> so it takes up as much width as is available at first and less and less as tags are added. Or alternately, some way to pin the fixed-with field to the right. I haven't found a way to implement these ideas, though! </p> <p>How can I make it so the textfield is always at the right of the <code>UICollectionView</code>?</p>
0debug