problem
stringlengths
26
131k
labels
class label
2 classes
JavaScript Array filling(one to many) : <p>I am new in javascript. Could you help me to make from this array: </p> <pre><code>[ [ '00011111', 'ADMIN' ], [ '00033333', 'ACTIVITY' ], [ '00022222', 'SUPPORT' ], [ '00011111', 'MEMBER' ], [ '00022222', 'MEMBER' ], [ '00033333', 'MEMBER' ] ] </code></pre> <p>This one:</p> <pre><code>[ [ '00011111', 'ADMIN', 'MEMBER' ], [ '00033333', 'ACTIVITY', 'MEMBER' ], [ '00022222', 'SUPPORT', 'MEMBER' ] ] </code></pre> <p>Thank you in advance. Would be nice if you could suggest several variants :)</p>
0debug
static void put_line(uint8_t *dst, int size, int width, const int *runs) { PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; init_put_bits(&pb, dst, size * 8); while (pix_left > 0) { run = runs[run_idx++]; mode = ~mode; pix_left -= run; for (; run > 16; run -= 16) put_sbits(&pb, 16, mode); if (run) put_sbits(&pb, run, mode); } flush_put_bits(&pb); }
1threat
How to call function from controller to service in angular JS : Here is the code.. service self.getNewCourses = function() { return "temp variable"; } controller $mmCourses.getNewCourses().then(function(data) { $scope.names = data; alert($scope.names); });
0debug
LUA referencing a HTML file : So I'm helping my friend with his server, and he wants a simple message of the day. I have made local html files for it [This is the directory][1] [This is the LUA code][2] i tried to reference the local files but it doesn't show [1]: https://i.stack.imgur.com/dNB31.png [2]: https://i.stack.imgur.com/nVmu7.png
0debug
PowerBI Embedded: 401 (Unauthorized) from wabi-north-europe-redirect.analysis.windows.net/explore/explorations/.../cache : <p>I recently updated from the old Power BI embedded method to the new one. Everything works fine and the report loads but in the console I get:</p> <pre><code>POST https://wabi-west-europe-redirect.analysis.windows.net/explore/explorations/2210976/cache 401 (Unauthorized) </code></pre> <p>errors. I do not know what this means and if there is something wrong in my configuration. The payload is like:</p> <pre><code>{"visualQueryResults":[{"visualContainerId":87590386,"... </code></pre>
0debug
void ff_avg_h264_qpel16_mc31_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_16x16_msa(src - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride); }
1threat
Ungroup after grouping by just one variable in dplyr : <p>I have a lot of units that are measured repeated times </p> <pre><code>&gt;df Item value year 1 20 1990 1 20 1991 2 30 1990 2 15 1990 2 5 1991 3 10 1991 4 15 1990 5 10 1991 5 5 1991 </code></pre> <p>I am trying to use dplyr to remove values that have a low number of observations. On this toy data lets say that I want to remove data which has fewer than 2 counts</p> <pre><code>&gt;df &lt;- df %&gt;% group_by(Item) %&gt;% tally() %&gt;% filter(n&gt;1) Item n 1 2 2 3 5 2 </code></pre> <p>The problem is that I would like to expand this back to what it was, but with this filter. I attempted using the <code>ungroup</code> command, but that seems to only have an effect when grouping by two variables. How can I filter by item counts then get my original variables back i.e <code>value</code> and <code>year</code>. It should look like this</p> <pre><code>&gt;df Item value year 1 20 1990 1 20 1991 2 30 1990 2 15 1990 2 5 1991 5 10 1991 5 5 1991 </code></pre>
0debug
iOS: Scroll view can't perform delegate but tableview can : I have a scroll view to show image and set inside tableview cell. Scroll view can’t perform scroll view delegate but table view can perform the scroll view delegate. So, how can I perform delegate only scroll view? thanks for read and help to answer me. Programming language: Objective-C
0debug
add hints in game with android studio : i am trying to create word quiz game I have a list of random words to appear, and plyer must arrange him it's working correctly. Now I want to add hints. For example, if word is "School" apper, I want the hint to be "photo of school that is words code in layout <string-array name="words"> <item>SCHOOL</item> <item>ABETS.BEATS.BEAST</item> <item>ANGEL.ANGLE.GLEAN</item> <item>COATS.COAST.TACOS</item> </string-array>
0debug
For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves : <p>I have this test of nodejs when testing I get a error of done function not declared.</p> <pre><code>Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. </code></pre> <p>My test code is, I have the done call back but still getting the error to call the <code>done();</code></p> <pre><code> it('remove existing subdocument', (done) =&gt; { const Vic = new User({ name: 'Vic', posts: [{ title: 'Leaning Nodejs' }] }); vic.save() .then(() =&gt; User.findOne({ name: 'Vic' })) .then((user) =&gt; { const post = user.posts[0]; post.remove(); return user.save(); }) .then(() =&gt; User.findOne({ name: 'Vic' })) .then((user) =&gt; { assert(user.posts.length === 0); done(); }); }); </code></pre>
0debug
preg_match_all Why don't I get something out? : preg_match_all('!<div class="Description_Productinfo" itemprop="description"><p><span style="color:#7f8c8d;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:14px;">(.*?)</span></span></span></p></div>!',$html, $matches1, PREG_SET_ORDER);foreach ($matches1 as $soge2){print_r($soge2);}
0debug
adb cannot bind 'tcp:5037' : <p>It used to work fine, but today after I connected my Android phone to my machine, and run <code>adb devices</code>, I got the following error:</p> <pre><code>* daemon not running. starting it now on port 5037 * cannot bind 'tcp:5037': Address already in use ADB server didn't ACK * failed to start daemon * error: cannot connect to daemon: Operation timed out </code></pre> <p>How to solve this problem? (I am using a MacBook)</p>
0debug
static void qvirtio_scsi_start(const char *extra_opts) { char *cmdline; cmdline = g_strdup_printf( "-drive id=drv0,if=none,file=/dev/null,format=raw " "-device virtio-scsi-pci,id=vs0 " "-device scsi-hd,bus=vs0.0,drive=drv0 %s", extra_opts ? : ""); qtest_start(cmdline); g_free(cmdline); }
1threat
Type of member variable should depend on constructor argument's type : <p>I try to define a class <code>A</code> as follows:</p> <pre><code>template&lt; typename T &gt; class A { public: A( T elem ) : _elem( elem ) {} private: TYPE _elem; // "TYPE" should be either "T" in case "elem" is an r-value or "T&amp;" in case "elem" is an l-value. }; </code></pre> <p>Here, I want <code>_elem</code> to have either the type <code>T</code> in case that the constructor's argument <code>elem</code> is an r-value or the type <code>T&amp;</code> in case <code>elem</code> is an l-value. </p> <p>Does anyone know how this can be implemented?</p>
0debug
static int h264_export_frame_props(H264Context *h) { const SPS *sps = h->ps.sps; H264Picture *cur = h->cur_pic_ptr; cur->f->interlaced_frame = 0; cur->f->repeat_pict = 0; if (sps->pic_struct_present_flag) { H264SEIPictureTiming *pt = &h->sei.picture_timing; switch (pt->pic_struct) { case SEI_PIC_STRUCT_FRAME: break; case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: cur->f->interlaced_frame = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: if (FIELD_OR_MBAFF_PICTURE(h)) cur->f->interlaced_frame = 1; else cur->f->interlaced_frame = h->prev_interlaced_frame; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: cur->f->repeat_pict = 1; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: cur->f->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: cur->f->repeat_pict = 4; break; } if ((pt->ct_type & 3) && pt->pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP) cur->f->interlaced_frame = (pt->ct_type & (1 << 1)) != 0; } else { cur->f->interlaced_frame = FIELD_OR_MBAFF_PICTURE(h); } h->prev_interlaced_frame = cur->f->interlaced_frame; if (cur->field_poc[0] != cur->field_poc[1]) { cur->f->top_field_first = cur->field_poc[0] < cur->field_poc[1]; } else { if (cur->f->interlaced_frame || sps->pic_struct_present_flag) { if (h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM || h->sei.picture_timing.pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP) cur->f->top_field_first = 1; else cur->f->top_field_first = 0; } else { cur->f->top_field_first = 0; } } if (h->sei.frame_packing.present && h->sei.frame_packing.arrangement_type >= 0 && h->sei.frame_packing.arrangement_type <= 6 && h->sei.frame_packing.content_interpretation_type > 0 && h->sei.frame_packing.content_interpretation_type < 3) { H264SEIFramePacking *fp = &h->sei.frame_packing; AVStereo3D *stereo = av_stereo3d_create_side_data(cur->f); if (!stereo) return AVERROR(ENOMEM); switch (fp->arrangement_type) { case 0: stereo->type = AV_STEREO3D_CHECKERBOARD; break; case 1: stereo->type = AV_STEREO3D_COLUMNS; break; case 2: stereo->type = AV_STEREO3D_LINES; break; case 3: if (fp->quincunx_subsampling) stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX; else stereo->type = AV_STEREO3D_SIDEBYSIDE; break; case 4: stereo->type = AV_STEREO3D_TOPBOTTOM; break; case 5: stereo->type = AV_STEREO3D_FRAMESEQUENCE; break; case 6: stereo->type = AV_STEREO3D_2D; break; } if (fp->content_interpretation_type == 2) stereo->flags = AV_STEREO3D_FLAG_INVERT; } if (h->sei.display_orientation.present && (h->sei.display_orientation.anticlockwise_rotation || h->sei.display_orientation.hflip || h->sei.display_orientation.vflip)) { H264SEIDisplayOrientation *o = &h->sei.display_orientation; double angle = o->anticlockwise_rotation * 360 / (double) (1 << 16); AVFrameSideData *rotation = av_frame_new_side_data(cur->f, AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9); if (!rotation) return AVERROR(ENOMEM); av_display_rotation_set((int32_t *)rotation->data, angle); av_display_matrix_flip((int32_t *)rotation->data, o->hflip, o->vflip); } if (h->sei.afd.present) { AVFrameSideData *sd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_AFD, sizeof(uint8_t)); if (!sd) return AVERROR(ENOMEM); *sd->data = h->sei.afd.active_format_description; h->sei.afd.present = 0; } if (h->sei.a53_caption.a53_caption) { H264SEIA53Caption *a53 = &h->sei.a53_caption; AVFrameSideData *sd = av_frame_new_side_data(cur->f, AV_FRAME_DATA_A53_CC, a53->a53_caption_size); if (!sd) return AVERROR(ENOMEM); memcpy(sd->data, a53->a53_caption, a53->a53_caption_size); av_freep(&a53->a53_caption); a53->a53_caption_size = 0; } return 0; }
1threat
i want java regex all matching index : <p>The person who is studying kmp algorithm. I am wondering if the kmp algorithm is too difficult to replace with regex. I do not like this result. The results I want are 0 and 1. And I wonder if the regex time complexity is O (n + m).</p> <pre><code>public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String t = "aaa"; Pattern p = Pattern.compile("aa"); Matcher m = p.matcher(t); ArrayList&lt;Integer&gt; ans = new ArrayList&lt;Integer&gt;(); while (m.find()) ans.add(m.start()); for (int i : ans) System.out.print(i + " "); } </code></pre> <p>i want Result [0 1] this Result [1]</p>
0debug
how to crop dynamic images coming from java side? : I'm getting image from a url from java side. and image size is too big. How to decrease it's size using inline css? image contain lots of white border from top and bottom. need to remove that too. Thanks in advance.
0debug
Ruby Beginner - Spacing issue : I am new to ruby and I am practicing conversions with numbers and strings. I have an issue with the spacing for the following code below: puts 'Hello, what\'s your first name?' firstName = gets.chomp puts 'What is your middle name?' middleName = gets.chomp puts 'Finally, what is your last name?' lastName = gets.chomp puts 'Nice to meet you ' + firstName + middleName + lastName + '. :)' The last part does not space out once it has been run on Terminal. Please help, Thanks :)
0debug
int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq) { return kvm_irqchip_remove_irqfd(s, event_notifier_get_fd(n), virq); }
1threat
How can I get a button click event to fire as soon as my page loads? : <p>I've got this jQuery:</p> <pre><code>$(document).ready(function () { $("body").on( "click", "#btnGetData", function() { var _begdate = $("#datepickerFrom").val(); var _enddate = $("#datepickerTo").val(); var _unit = $("#unitName").text(); document.body.style.cursor = 'wait'; $.ajax({ . . .elided for brevity. }); }); $("#btnGenData").trigger('click'); }); </code></pre> <p>I need the click event to occur as soon as the page load; I tried calling it this way, after the click function:</p> <pre><code>$("#btnGenData").trigger('click'); </code></pre> <p>...but it doesn't work. What am I missing?</p>
0debug
How to identify button without X path in selenium : Code is below <button type="submit" class="login-button">Login</button> In selenium i tried this code driver.findElement(By.classname("Login")).click(); please help me in this code without x path
0debug
g++ and clang++ different behaviour with pointer to variadic template functions : <p>Another "who's right between g++ and clang++ ?" question for C++ standard gurus.</p> <p>The code is the following</p> <pre><code>template &lt;typename ...&gt; struct bar { }; template &lt;typename ... Ts&gt; void foo (bar&lt;Ts...&gt; const &amp;) { } int main () { foo&lt;int&gt;(bar&lt;int, long&gt;{}); // g++ and clang++ compile (*(&amp;foo&lt;int&gt;))(bar&lt;int, long&gt;{}); // g++ and clang++ give error (&amp;foo&lt;int&gt;)(bar&lt;int, long&gt;{}); // clang++ compiles; g++ gives error } </code></pre> <p>The template function <code>foo()</code> receive a variadic template parameter <code>bar</code>.</p> <p>The first call </p> <pre><code> foo&lt;int&gt;(bar&lt;int, long&gt;{}); // g++ and clang++ compile </code></pre> <p>works for both clang++ ang g++.</p> <p>If I understand correctly, with <code>foo&lt;int&gt;</code> is explicated <strong>only</strong> the first template parameter and this doesn't complete the list of <code>Ts...</code> parameters. So the compiler look at the argument (a <code>bar&lt;int, long&gt;</code> object) and deduce the full list.</p> <p>The second call is different </p> <pre><code> (*(&amp;foo&lt;int&gt;))(bar&lt;int, long&gt;{}); // g++ and clang++ give error </code></pre> <p>If I understand correctly, with <code>(&amp;foo&lt;int&gt;)</code> we get the pointer to the instantiation of <code>foo</code> where <code>Ts...</code> is exactly <code>int</code> (not only the first type of the list but the whole list) and dereferencing it (<code>*(&amp;foo&lt;int&gt;)</code>) and calling it with a wrong argument (a <code>bar&lt;int, long&gt;</code> object) we get (clang++ and g++) a compilation error.</p> <p>So far, so good.</p> <p>The problem arises with the third call</p> <pre><code> (&amp;foo&lt;int&gt;)(bar&lt;int, long&gt;{}); // clang++ compiles; g++ gives error </code></pre> <p>that I was convinced (maybe I was wrong) equivalent the second one (we fix all template types in <code>Ts...</code>, then we call the function with a wrong parameter) but g++ seems agree (and gives error) where clang++ disagree (and compile without problem).</p> <p>The question, as usual, is: who's right ?</p>
0debug
How to set the value of a cell depending of 2 other criterias : I have an excel tab like this IT give me information on when a worker is plan to start on a product. The Columns of my input Table are: Product Number, Dummy column, Dummy column, Worker ID, Starting Date, Ending Date The lines in my input Table are: Product 1,xyz,xyz,Worker 1,13/08/2018 13:50,20/08/2018 15:30 Product 1,xyz,xyz,Worker 2,08/08/2018 03:50,16/08/2018 08:30 Product 1,xyz,xyz,Worker 9,23/08/2018 08:08,03/09/2018 10:00 Product 2,xyz,xyz,Worker 4,10/08/2018 13:50,27/08/2018 15:30 Product 2,xyz,xyz,Worker 9,18/08/2018 03:50,20/08/2018 08:30 Product 3,xyz,xyz,Worker 2,13/08/2018 08:08,13/09/2018 10:00 My Result table should have: - one line per Worker - one Column for each day of the year The values in the Result Tab should show for a given Worker and a Given Date on wich Product the Worker started to work. So the cell could be empty if at this date the workerX didn´t start to work on a product. Do you have an idea how I can solve this in excel (or Access if not possible in excel)? Thank you for your help.
0debug
uint32_t cpu_inl(pio_addr_t addr) { uint32_t val; val = ioport_read(2, addr); trace_cpu_in(addr, val); LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val); return val; }
1threat
How to delete and object from an array through a JavaScript table : How can I delete an object from an array though a js table, I have created a table with each row being one object. How can I create a function where I can have an onlclick function where if I click a delete button on one row it will delete that specific row but also delete that specific object in the array.
0debug
I get an error when I run my query even though the syntax is corret : I have a table named CUSTOMERS I have a column inside the table named CITY I want to retrieve the city that has the most customers, in other words the most frequent CITY in table CUSTOMERS. I get an error message as following: ORA-00904: "COUNTRY": invalid identifier SELECT COUNTRY, COUNT(COUNTRY) AS `value_occurrence` FROM CUSTOMERS GROUP BY COUNTRY ORDER BY `value_occurrence` DESC LIMIT 1;
0debug
convert text-string of hours + mins to rounded decimal hours in PHP : <p>I have a text-string <code>1 hour 43 mins</code></p> <p>How can I convert this to output <code>1.75</code> using PHP? </p> <p><em>(and this be true for all other possibilities, rounding to nearest .25 hours)</em></p>
0debug
Why is it necessary to create a lot of different exception types? : <p>Most of the time, if I want to terminate the execution of the program at a certain critical point, I just create a RuntimeException with some informational messages:</p> <pre><code>throw new RuntimeException("ERROR: this is wrong! Fix it first!") </code></pre> <p>In Java there are lots of different built-in exception types, and books also teach how to create your own custom exception types. Is that really necessary? Isn't a RuntimeException sufficient for most purposes from a practical point point of view? </p>
0debug
Taking pictures secretly in the background with Phonegap : <p>Creating an app with PhoneGap and using the plugin camera of cordova, is there a way to take an automatic photo without opening the camera's view, and use the front camera (the one for selfies)?</p>
0debug
Why Q_ASSERT instead of assert : <p>In Qt there is a <a href="http://doc.qt.io/qt-5/qtglobal.html#Q_ASSERT" rel="noreferrer">Q_ASSERT</a> macro. What's the advantage of using this instead of <a href="http://www.cplusplus.com/reference/cassert/assert/" rel="noreferrer">assert</a> from <code>&lt;cassert&gt;</code> ?</p>
0debug
nginx 301 redirect with query string : <p>Currently I have something like this in my nginx.conf file:</p> <pre><code>location ~ /old/page/?$ { return 301 /new-page; } </code></pre> <p>The issue is that query strings are being stripped from the /old/page?ref=xx URL.</p> <p>Is it possible to include query strings using the redirect method I'm using above?</p>
0debug
cant find out why valgrind gives errors in my code which has array of structures : <p>I have the following code is code snippet of large code. I am trying to free an array of structures for which I have allocated memory in this code. Unfortunately I get either a seg fault or no segfault (error free) when I change specific line in the code. I am not able to find the reason why. Can somebody please have a look and point out the reason. So If I change atom[i]->natoms to atom[i]->natoms-1 in void_free_atom I get no segault but valgrind shows that heap is not completely free. Note atom[i]->natoms is a constant number. </p> <pre><code>#include "stdheader.h" #include "Atom.h" Atom **atominfo(FILE *fp1,size_t nbytes,char *my_string,Ljcoeff *lj, int natoms) { int i; Atom **atom=(Atom **) malloc(sizeof(Atom *)*natoms); // printf("%d\n",natoms); for (i = 0; i &lt; natoms; i++) { atom[i]=(Atom *) malloc(sizeof(Atom)); atom[i]-&gt;natoms=natoms; atom[i]-&gt;eps=lj-&gt;eps[i]; atom[i]-&gt;sigma=lj-&gt;sigma[i]; getline(&amp;my_string, &amp;nbytes, fp1); sscanf(my_string, "%d %*d %lf %lf %lf %lf\n", &amp;atom[i]-&gt;id, &amp;atom[i]-&gt;x, &amp;atom[i]-&gt;y, &amp;atom[i]-&gt;z, &amp;atom[i]-&gt;q); // printf("%d %d %lf %lf %lf %lf\n",i+1,atom[i]-&gt;id,atom[i]-&gt;x,atom[i]-&gt;y,atom[i]-&gt;z,atom[i]-&gt;q); } return atom; } void free_atom(Atom **atom) { int i; for(i=0;i&lt; atom[i]-&gt;natoms;i++){ //printf("%d\n",atom[i]-&gt;natoms-1); free(atom[i]); } free(atom); } </code></pre>
0debug
Android P (API 28) - What does the StrictMode policy violation "SmartSelectionEventTracker$SelectionEvent;->selectionAction" mean? : <p>I am using the <code>StrictMode</code> in order to find non-SDK usages:</p> <pre><code>if (BuildConfig.DEBUG &amp;&amp; Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.P) { StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectNonSdkApiUsage() .penaltyLog() .build()); } </code></pre> <p>Now I am getting a policy violation:</p> <pre><code>D/StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/ SmartSelectionEventTracker$SelectionEvent;-&gt;selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/ SmartSelectionEventTracker$SelectionEvent; at android.os.StrictMode.lambda$static$1(StrictMode.java:428) at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2) at java.lang.Class.getDeclaredMethodInternal(Native Method) at java.lang.Class.getPublicMethodRecursive(Class.java:2075) at java.lang.Class.getMethod(Class.java:2063) at java.lang.Class.getMethod(Class.java:1690) at bzi.a(SourceFile:11) at bzq.a(SourceFile:12) at org.chromium.content.browser.selection.SmartSelectionClient.&lt;init&gt;(SourceFile:5) at bzZ.a(Unknown Source:7) at org.chromium.android_webview.AwContents.e(SourceFile:193) at org.chromium.android_webview.AwContents.d(SourceFile:153) at org.chromium.android_webview.AwContents.&lt;init&gt;(SourceFile:81) at uY.run(SourceFile:15) at ahv.a(SourceFile:13) at ahw.run(SourceFile:2) at org.chromium.base.ThreadUtils.b(SourceFile:31) at ahv.a(SourceFile:7) at com.android.webview.chromium.WebViewChromiumFactoryProvider.b(SourceFile:6) at com.android.webview.chromium.WebViewChromium.init(SourceFile:111) at android.webkit.WebView.&lt;init&gt;(WebView.java:678) at android.webkit.WebView.&lt;init&gt;(WebView.java:604) at android.webkit.WebView.&lt;init&gt;(WebView.java:587) at android.webkit.WebView.&lt;init&gt;(WebView.java:574) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at com.mine.ui.events.EventScreen.onCreateView(EventScreen.java:70) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:781) (... shortened ...) </code></pre> <p>The important line is:</p> <pre><code>at com.mine.ui.events.EventScreen.onCreateView(EventScreen.java:70) </code></pre> <p>Examining the mentioned line:</p> <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // This is the important line: ViewGroup content = (ViewGroup) inflater.inflate(R.layout.mine_event, container, false); WebView webView = (WebView) content.findViewById(R.id.container); webView.loadUrl(event.getWebViewUrl()); webView.getSettings().setJavaScriptEnabled(true); (...) </code></pre> <p>So I get the violation while the inflation happens, which I dont quite understand.</p> <p>As you can see shortly after the mentioned line a <code>WebView</code> comes into play. I have looked at the source-code for the <code>SmartSelectionEventTracker</code> <a href="https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/view/textclassifier/logging/SmartSelectionEventTracker.java" rel="noreferrer">here</a> and it seems like a generic class for <code>Widgets like TextViews, WebViews, ...</code>. <code>WebViews</code> seem to be related to <code>MockViews</code> which are related to <code>TextViews</code>.</p> <p>But apart from that finding I do not understand how / why the violation is happening and what I can do against it.</p> <p>Can someome explain this to me?</p>
0debug
START_TEST(simple_varargs) { QObject *embedded_obj; QObject *obj; LiteralQObject decoded = QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(1), QLIT_QINT(2), QLIT_QLIST(((LiteralQObject[]){ QLIT_QINT(32), QLIT_QINT(42), {}})), {}})); embedded_obj = qobject_from_json("[32, 42]"); fail_unless(embedded_obj != NULL); obj = qobject_from_jsonf("[%d, 2, %p]", 1, embedded_obj); fail_unless(obj != NULL); fail_unless(compare_litqobj_to_qobj(&decoded, obj) == 1); qobject_decref(obj); }
1threat
Not sure why this does not work : <pre><code>&lt;div class="button button1" onclick="toggleClass();"&gt;Stay Updated&lt;/div&gt; &lt;script&gt; function toggleClass(){ if(className == "button button1"){ className = "info"; } else { className = "button button 1"; } &lt;/script&gt; </code></pre> <p>Trying to change the class of the div on clicking the div. The div is meant to act like a button which should be replaced by another div class. This is my coding so far, please help. Thanks in advance.</p>
0debug
Selenium 3.141 supports for jdk 13? : Confirmation on below issue issue : Selenium 3.141 supports for jdk 13? Refer me which version of java or selenium perfectly can i use
0debug
static int roq_encode_video(RoqContext *enc) { RoqTempdata *tempData = enc->tmpData; int i, ret; memset(tempData, 0, sizeof(*tempData)); ret = create_cel_evals(enc, tempData); if (ret < 0) return ret; ret = generate_new_codebooks(enc, tempData); if (ret < 0) return ret; if (enc->framesSinceKeyframe >= 1) { motion_search(enc, 8); motion_search(enc, 4); } retry_encode: for (i=0; i<enc->width*enc->height/64; i++) gather_data_for_cel(tempData->cel_evals + i, enc, tempData); if (tempData->mainChunkSize/8 > 65535) { av_log(enc->avctx, AV_LOG_ERROR, "Warning, generated a frame too big (%d > 65535), " "try using a smaller qscale value.\n", tempData->mainChunkSize/8); enc->lambda *= 1.5; tempData->mainChunkSize = 0; memset(tempData->used_option, 0, sizeof(tempData->used_option)); memset(tempData->codebooks.usedCB4, 0, sizeof(tempData->codebooks.usedCB4)); memset(tempData->codebooks.usedCB2, 0, sizeof(tempData->codebooks.usedCB2)); goto retry_encode; } remap_codebooks(enc, tempData); write_codebooks(enc, tempData); reconstruct_and_encode_image(enc, tempData, enc->width, enc->height, enc->width*enc->height/64); enc->avctx->coded_frame = enc->current_frame; FFSWAP(AVFrame *, enc->current_frame, enc->last_frame); FFSWAP(motion_vect *, enc->last_motion4, enc->this_motion4); FFSWAP(motion_vect *, enc->last_motion8, enc->this_motion8); av_free(tempData->cel_evals); av_free(tempData->closest_cb2); enc->framesSinceKeyframe++; return 0; }
1threat
static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset, uint64_t *cur_bytes) { BDRVQcowState *s = bs->opaque; QCowL2Meta *old_alloc; uint64_t bytes = *cur_bytes; QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) { uint64_t start = guest_offset; uint64_t end = start + bytes; uint64_t old_start = l2meta_cow_start(old_alloc); uint64_t old_end = l2meta_cow_end(old_alloc); if (end <= old_start || start >= old_end) { } else { if (start < old_start) { bytes = old_start - start; } else { bytes = 0; } if (bytes == 0) { qemu_co_mutex_unlock(&s->lock); qemu_co_queue_wait(&old_alloc->dependent_requests); qemu_co_mutex_lock(&s->lock); return -EAGAIN; } } } *cur_bytes = bytes; return 0; }
1threat
Is it beneficial to use OOP on large datasets in Python? : <p>I'm implementing Kalman Filter on two types of measurements. I have GPS measurement every second (1Hz) and 100 measurment of accelration in one second (100Hz). So basically I have two huge tables and they have to be fused at some point. My aim is: I really want to write readable and maintainable code. </p> <p>My first approach was: there is a class for both of the datatables (so an object is a datatable), and I do bulk calculations in the class methods (so almost all of my methods include a for loop), until I get to the actual filter. I found this approach a bit too stiff. It works, but there is so much data-type transformation, and it is just not that convenient.</p> <p>Now I want to change my code. If I would want to stick to OOP, my second try would be: every single measurment is an object of either the GPS_measurment or the acceleration_measurement. This approach seems better, but this way thousands of objects would have been created.</p> <p>My third try would be a data-driven design, but I'm not really familiar with this approach.</p> <p>Which paradigm should I use? Or perhaps it should be solved by some kind of mixture of the above paradigms? Or should I just use procedural programming with the use of pandas dataframes? </p>
0debug
No PostCSS config found : <p>I am trying to learn reactjs according to a tutorial. Meanwhile the tutorial instructs to use webpack for compiling stylesheets and JS assets. I am stuck in an error where the stylesheets cannot get compiled and throws following error while compiling the file using webpack. It displays following error : </p> <pre><code> ERROR in ./src/stylesheets/hello.css (./node_modules/css-loader!./node_modules/postcss-loader/lib!./src/stylesheets/hello.css) Module build failed: Error: No PostCSS Config found in: E:\developer\start\src\stylesheets at E:\developer\start\node_modules\postcss-load-config\index.js:51:26 at &lt;anonymous&gt; @ ./src/stylesheets/hello.css 2:14-124 @ ./src/lib.js @ ./src/index.js @ multi (webpack)-dev-server/client?http://localhost:4000 ./src/index.js </code></pre> <p>I have done everything according to the tutorial but somehow this error persists and couldn't solve this as I am very new to this. My webpack configuration file webpack.config.js is as follows:</p> <pre><code> module: { rules: [ { test: /\.css$/, use: [{ loader: "style-loader" // creates style nodes from JS strings }, { loader: "css-loader" // translates CSS into CommonJS }, { loader: "postcss-loader" // compiles Sass to CSS }] }, { test: /\.scss$/, use: [{ loader: "style-loader" // creates style nodes from JS strings }, { loader: "css-loader" // translates CSS into CommonJS }, { loader: "postcss-loader" // compiles Sass to CSS }, { loader: "sass-loader" // compiles Sass to CSS }] } ] } }; </code></pre>
0debug
Change Double Number displaying format? : <p>In C#, if a double number has more than 5 zero (ex: 0.0000456), it will display as 4.56E-05. But I want to display as 0.0000456. Is there anyway to change the display format? Please help!</p>
0debug
Nginx - Do I really need sites-available and sites-enabled folders? : <p>I have searched Stack Overflow for a straight answer but have not found it. I noticed my install of nginx has three folders called</p> <pre><code>etc/nginx/sites-available etc/nginx/sites-enabled etc/nginx/conf.d </code></pre> <p>Do I really need these if I just want to work directly in the <code>etc/nginx/nginx.conf</code> file and remove the <code>include</code> lines that include these items in <code>nginx.conf</code>? Are these directories used for anything else that would mess things up if I delete them?</p>
0debug
static void sdhci_sdma_transfer_single_block(SDHCIState *s) { int n; uint32_t datacnt = s->blksize & 0x0fff; if (s->trnmod & SDHC_TRNS_READ) { for (n = 0; n < datacnt; n++) { s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); } dma_memory_write(&address_space_memory, s->sdmasysad, s->fifo_buffer, datacnt); } else { dma_memory_read(&address_space_memory, s->sdmasysad, s->fifo_buffer, datacnt); for (n = 0; n < datacnt; n++) { sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); } } if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; } sdhci_end_transfer(s); }
1threat
Switching from native iOS gui to Qt gui : <p>I currently have a native iOS GUI and a Qt-GUI. I'm trying to switch from one to another.</p> <p>To be clear: When i click on a button on the native GUI i want the Qt-GUI to show up and vice versa.</p> <p>I already found out which libraries i have to add to be able to use the Qt-Stuff. I created a <code>QApplication</code> in the <code>AppDelegate.mm</code> file:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions { // receive int argc, and char** argv for the QApplication. _qApp = new QApplication(_argc, _argv); } </code></pre> <p>Furthermore my Qt application looks (at the moment) like this:</p> <pre><code>void createQtGUI() { QPushButton* btn = new QPushButton("Some Button"); QLabel* lbl = new QLabel("QTGui"); QVBoxLayout* layout = new QVBoxLayout(); layout-&gt;addWidget(lbl); layout-&gt;addWidget(btn); QWidget* window = new QWidget(); window-&gt;setLayout(layout); window-&gt;show(); } </code></pre> <p>I'm calling the <code>createQtGUI</code> method in my <code>ViewController.mm</code> when pressing a button in the native iOS GUI. The code runs without throwing any error, but:</p> <p><strong>The Qt-GUI is not shown. The application still shows the native gui without switching to the Qt-GUI.</strong></p> <p>Has anybody got any idea how to fix that?</p>
0debug
How to generate pseudorandom no. easily? : <p>i am using <code>seed</code> and functions like <code>srand()</code> or <code>random()</code> to generate numbers from just <code>0 to 5</code> but i need an easier method that makes also easy to find <code>seed</code> by feeding array. Please suggest one</p>
0debug
Cannot launch Nvidia nsight : <p>Initially the Java vm would not even start, but I fixed that by editing the nsight.ini file and removing</p> <pre><code>-XX:MaxPermSize=256m </code></pre> <p>and updating the</p> <pre><code>-Dosgi.requiredJavaVersion </code></pre> <p>so I now get the splash screen and can select a workspace directory.</p> <p>I do so, and get a progress bar but it promptly crashes and gives no indication other than to look in the log file, the start of which says:</p> <pre><code>!SESSION 2016-12-09 20:30:40.686 ----------------------------------------------- eclipse.buildId=unknown java.version=9-internal java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB Command-line arguments: -os linux -ws gtk -arch x86_64 !ENTRY com.nvidia.cuda.ide.build 4 0 2016-12-09 20:30:46.292 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.build [9] Unresolved requirement: Require-Bundle: org.eclipse.cdt.managedbuilder.core -&gt; Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; bundle-version="8.3.0.201409172108"; singleton:="true" org.eclipse.cdt.managedbuilder.core [108] Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.0.0,6.0.0)" -&gt; Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true" org.eclipse.cdt.core [88] Unresolved requirement: Require-Capability: osgi.ee; filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))" at org.eclipse.osgi.container.Module.start(Module.java:434) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY com.nvidia.cuda.ide.cdt 4 0 2016-12-09 20:30:46.294 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.cdt [10] Unresolved requirement: Require-Bundle: org.eclipse.cdt.managedbuilder.core; bundle-version="8.0.0" -&gt; Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; bundle-version="8.3.0.201409172108"; singleton:="true" org.eclipse.cdt.managedbuilder.core [108] Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.0.0,6.0.0)" -&gt; Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true" org.eclipse.cdt.core [88] Unresolved requirement: Require-Capability: osgi.ee; filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))" at org.eclipse.osgi.container.Module.start(Module.java:434) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY com.nvidia.cuda.ide.debug 4 0 2016-12-09 20:30:46.297 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.debug [11] Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="5.3.0" -&gt; Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true" org.eclipse.cdt.core [88] Unresolved requirement: Require-Capability: osgi.ee; filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))" at org.eclipse.osgi.container.Module.start(Module.java:434) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY com.nvidia.cuda.ide.editor 4 0 2016-12-09 20:30:46.309 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.editor [12] Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)" -&gt; Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true" org.eclipse.cdt.ui [111] Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)" -&gt; Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true" org.eclipse.cdt.core [88] Unresolved requirement: Require-Capability: osgi.ee; filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))" at org.eclipse.osgi.container.Module.start(Module.java:434) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY com.nvidia.cuda.ide.remote 4 0 2016-12-09 20:30:46.311 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.remote [13] Unresolved requirement: Import-Package: org.eclipse.remote.core -&gt; Export-Package: org.eclipse.remote.core; bundle-symbolic-name="org.eclipse.remote.core"; bundle-version="1.0.0.201409111520"; version="0.0.0" org.eclipse.remote.core [263] Unresolved requirement: Require-Capability: osgi.ee; filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))" at org.eclipse.osgi.container.Module.start(Module.java:434) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) </code></pre> <p>I installed nsight at the same time as cuda using the NVIDA .deb package repository they provide on their website.</p> <p>I added it using:</p> <pre><code>dpkg -i &lt;cuda_file&gt;.deb </code></pre> <p>and installed using:</p> <pre><code>sudo apt update sudo apt install cuda </code></pre> <p>Normal eclipse installations work perfectly, so any advice anyone has would be greatly appreciated!</p>
0debug
Angular 2 animate element generated by ngFor : <p>I am new to animations in Angular 2 so I might be missing something obvious, but how do I animate elements generated by an *ngFor loop? It seems like the animations are tied to a component and have to be defined in the @Component decorator?</p> <p>Is the only solution to create a inner component and have that being created in the *ngFor and then animate that? </p>
0debug
Running TensorFlow on a Slurm Cluster? : <p>I could get access to a computing cluster, specifically one node with two 12-Core CPUs, which is running with <a href="https://en.wikipedia.org/wiki/Slurm_Workload_Manager" rel="noreferrer">Slurm Workload Manager</a>.</p> <p>I would like to run <a href="https://en.wikipedia.org/wiki/TensorFlow" rel="noreferrer">TensorFlow</a> on that system but unfortunately I were not able to find any information about how to do this or if this is even possible. I am new to this but as far as I understand it, I would have to run TensorFlow by creating a Slurm job and can not directly execute python/tensorflow via ssh. </p> <p>Has anyone an idea, tutorial or any kind of source on this topic?</p>
0debug
extracting total price from a shopping bill : Iam working on an application where I need to get the net price displayed in any shopping bill from its picture. I have already retrieved the editable text from the bill images using "tesseract ocr" API. Now I need to print only the "grand total amount" from the text. How do I extract only that part( total price) from a whole bill having the item name, quantity and price?
0debug
unshare --pid /bin/bash - fork cannot allocate memory : <p>I'm experimenting with linux namespaces. Specifically the pid namespace.</p> <p>I thought I'd test something out with bash but run into this problem:</p> <pre><code>unshare -p /bin/bash bash: fork: Cannot allocate memory </code></pre> <p>Running ls from there gave a core dump. Exit is the only thing possible.</p> <p>Why is it doing that?</p>
0debug
Regular Expression : Complexe Multiple Matches : line = 'bla bla bla Tax_Id=9606 Gene_Symbol=OR4F16 OR4F28P OR4F29 OR4F2P OR4F3 DTR4F7P BPFR4F8P Gene_Accession=ENSG00000217874 bla bla bla' Iam trying to matches all the Gene symbol. I tried using re, regex and their different modules but it doesn't work. Hope you guys can help me ! David
0debug
static int mkv_write_tags(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; int i, ret; ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); if (mkv_check_tag(s->metadata, 0)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &mkv->tags); if (ret < 0) return ret; } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_type == AVMEDIA_TYPE_ATTACHMENT) continue; if (!mkv_check_tag(st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &mkv->tags); if (ret < 0) return ret; } if (s->pb->seekable && !mkv->is_live) { for (i = 0; i < s->nb_streams; i++) { AVIOContext *pb; AVStream *st = s->streams[i]; ebml_master tag_target; ebml_master tag; if (st->codecpar->codec_type == AVMEDIA_TYPE_ATTACHMENT) continue; mkv_write_tag_targets(s, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &mkv->tags, &tag_target); pb = mkv->tags_bc; tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0); put_ebml_string(pb, MATROSKA_ID_TAGNAME, "DURATION"); mkv->stream_duration_offsets[i] = avio_tell(pb); put_ebml_void(pb, 23); end_ebml_master(pb, tag); end_ebml_master(pb, tag_target); } } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; if (!mkv_check_tag(ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id + mkv->chapter_id_offset, &mkv->tags); if (ret < 0) return ret; } if (mkv->have_attachments) { for (i = 0; i < mkv->attachments->num_entries; i++) { mkv_attachment *attachment = &mkv->attachments->entries[i]; AVStream *st = s->streams[attachment->stream_idx]; if (!mkv_check_tag(st->metadata, MATROSKA_ID_TAGTARGETS_ATTACHUID)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_ATTACHUID, attachment->fileuid, &mkv->tags); if (ret < 0) return ret; } } if (mkv->tags.pos) { if (s->pb->seekable && !mkv->is_live) put_ebml_void(s->pb, avio_tell(mkv->tags_bc)); else end_ebml_master_crc32(s->pb, &mkv->tags_bc, mkv, mkv->tags); } return 0; }
1threat
What is the migration procedure for moving from Windows system-wide Visual Studio Code to user setup? : <p>I am an existing user of the system-wide distribution of Visual Studio Code. I have been prompted to switch to the new User Setup distribution. This directs me to download the user setup installer. When running this installer, it tells me that I should uninstall the existing installation before installing the new one.</p> <p>The uninstall procedure doesn't give any indication that settings and extensions will be kept.</p> <p>I want to ensure that I keep all of my existing settings and extensions when moving to the new version. Is this possible?</p>
0debug
Angular 5 service failing to pass unit tests with (NullInjectorError: No provider for HttpClient!) : <p>I keep getting the following errors when running unit tests</p> <pre><code>Error: StaticInjectorError(DynamicTestModule)[ApiService -&gt; HttpClient]: StaticInjectorError(Platform: core)[ApiService -&gt; HttpClient]: NullInjectorError: No provider for HttpClient! </code></pre> <p><strong>api.service.ts</strong></p> <pre><code>import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable() export class ApiService { constructor(private http: HttpClient) { } url = './assets/data.json'; get() { return this.http.get(this.url); } } </code></pre> <p><strong>api.service.spec.ts</strong></p> <pre><code>import { TestBed, inject } from '@angular/core/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { ApiService } from './api.service'; describe('ApiService', () =&gt; { beforeEach(() =&gt; { TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, ], providers: [ ApiService, ], }); }); it('should get users', inject([HttpTestingController, ApiService], (httpMock: HttpTestingController, apiService: ApiService) =&gt; { expect(apiService).toBeTruthy(); } ) ); }); </code></pre> <p>I don't understand what is going wrong as I have included HttpClient into api.service.ts, the service works in the browser.</p> <p>This is directly called in a component called MapComponent, and that is called inside HomeComponent.</p> <pre><code>Chrome 63.0.3239 (Mac OS X 10.13.3) HomeComponent expect opened to be false FAILED Error: StaticInjectorError(DynamicTestModule)[ApiService -&gt; HttpClient]: StaticInjectorError(Platform: core)[ApiService -&gt; HttpClient]: NullInjectorError: No provider for HttpClient! </code></pre>
0debug
Search from string in mysql using php array : <p>I have absolutely no idea where to start.</p> <p>I have a table called "users" in my database called "database":</p> <pre><code>NAME | POINTS John 24 Marrie 32 Moritz 11 Adam 99 Hans 34 Monica 58 </code></pre> <p>I also have this</p> <pre><code> &lt;?php $users = array("Adam", "Hans", "Monica"); ?&gt; </code></pre> <p>What I would like to do is: Connect to mysql table "users" then database called "database", search for the names mentioned in the array $users and give me the list of their points (without names).</p> <p>SO it should echo</p> <pre><code>99 34 58 </code></pre>
0debug
static inline void tcg_reg_sync(TCGContext *s, int reg) { TCGTemp *ts; int temp; temp = s->reg_to_temp[reg]; ts = &s->temps[temp]; assert(ts->val_type == TEMP_VAL_REG); if (!ts->mem_coherent && !ts->fixed_reg) { if (!ts->mem_allocated) { temp_allocate_frame(s, temp); } tcg_out_st(s, ts->type, reg, ts->mem_reg, ts->mem_offset); } ts->mem_coherent = 1; }
1threat
How to update single column based on conditions : How to update single column based on two or multiple conditions in mssql. I have table called show_list and it looks like emp_id to_date show_flag 1 2019-01-01 2 2019-01-01 3 2019-01-01 4 2019-01-01 I have to update emp_id 1 and 3 with show_flag = 1 and emp_id 2 and 4 with show_flag = 0.
0debug
Creating two objects in main using same name in Java : i have a class name Planet and i am making objects in main. Planet planet1=new Planet("High Temperature","No Water); Planet planet2= new Planet("Low Temperature","Ice"); However, i saw my instructor doing this: Planet planet1=new Planet("High Temperature","No Water); planet1= new Planet("Low Temperature","Ice"); So basically, my instructor is also creating two objects. I understand that a new object is basically formed when constructor is called but i always thought that the two objects need to have distinct names as well. As you can see above, there are two objects created using the name planet1. Also, is there any difference in creating two objects with the two different ways mentioned above.
0debug
Is spark 1.6.3 will support Kafka 1.0.0 : I have spark 1.6.3, Scala 2.10.5 and Kafka 1.0.0, is it possible to use kafak 1.0.0 with Scala 2.10.5?
0debug
static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; VAAPIEncodeH264Context *priv = ctx->priv_data; int i; if (pic->type == PICTURE_TYPE_IDR) { av_assert0(pic->display_order == pic->encode_order); vpic->frame_num = 0; priv->next_frame_num = 1; priv->cpb_delay = 0; } else { vpic->frame_num = priv->next_frame_num; if (pic->type != PICTURE_TYPE_B) { ++priv->next_frame_num; } ++priv->cpb_delay; } priv->dpb_delay = pic->display_order - pic->encode_order + 1; vpic->frame_num = vpic->frame_num & ((1 << (4 + vseq->seq_fields.bits.log2_max_frame_num_minus4)) - 1); vpic->CurrPic.picture_id = pic->recon_surface; vpic->CurrPic.frame_idx = vpic->frame_num; vpic->CurrPic.flags = 0; vpic->CurrPic.TopFieldOrderCnt = pic->display_order; vpic->CurrPic.BottomFieldOrderCnt = pic->display_order; for (i = 0; i < pic->nb_refs; i++) { VAAPIEncodePicture *ref = pic->refs[i]; av_assert0(ref && ref->encode_order < pic->encode_order); vpic->ReferenceFrames[i].picture_id = ref->recon_surface; vpic->ReferenceFrames[i].frame_idx = ref->encode_order; vpic->ReferenceFrames[i].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE; vpic->ReferenceFrames[i].TopFieldOrderCnt = ref->display_order; vpic->ReferenceFrames[i].BottomFieldOrderCnt = ref->display_order; } for (; i < FF_ARRAY_ELEMS(vpic->ReferenceFrames); i++) { vpic->ReferenceFrames[i].picture_id = VA_INVALID_ID; vpic->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID; } vpic->coded_buf = pic->output_buffer; vpic->pic_fields.bits.idr_pic_flag = (pic->type == PICTURE_TYPE_IDR); vpic->pic_fields.bits.reference_pic_flag = (pic->type != PICTURE_TYPE_B); pic->nb_slices = 1; return 0; }
1threat
static inline int16_t g726_iterate(G726Context* c, int16_t I) { int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0; Float11 f; dq = inverse_quant(c, I); if (I >> (c->tbls->bits - 1)) dq = -dq; re_signal = c->se + dq; ylint = (c->yl >> 15); ylfrac = (c->yl >> 10) & 0x1f; thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint; if (c->td == 1 && abs(dq) > ((thr2+(thr2>>1))>>1)) tr = 1; else tr = 0; pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0; dq0 = dq ? sgn(dq) : 0; if (tr) { c->a[0] = 0; c->a[1] = 0; for (i=0; i<6; i++) c->b[i] = 0; } else { fa1 = clamp((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255); c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7); c->a[1] = clamp(c->a[1], -12288, 12288); c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8); c->a[0] = clamp(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); for (i=0; i<6; i++) c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8); } c->pk[1] = c->pk[0]; c->pk[0] = pk0 ? pk0 : 1; c->sr[1] = c->sr[0]; i2f(re_signal, &c->sr[0]); for (i=5; i>0; i--) c->dq[i] = c->dq[i-1]; i2f(dq, &c->dq[0]); c->dq[0].sign = I >> (c->tbls->bits - 1); c->td = (tr == 0 && c->a[1] < -11776); c->dms += ((c->tbls->F[I]<<9) - c->dms) >> 5; c->dml += ((c->tbls->F[I]<<11) - c->dml) >> 7; if (tr) c->ap = 256; else if (c->y > 1535 && !c->td && (abs((c->dms << 2) - c->dml) < (c->dml >> 3))) c->ap += (-c->ap) >> 4; else c->ap += (0x200 - c->ap) >> 4; c->yu = clamp(c->y + (((c->tbls->W[I] << 5) - c->y) >> 5), 544, 5120); c->yl += c->yu + ((-c->yl)>>6); al = (c->ap >= 256) ? 1<<6 : c->ap >> 2; c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6; c->se = 0; for (i=0; i<6; i++) c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]); c->sez = c->se >> 1; for (i=0; i<2; i++) c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]); c->se >>= 1; return clamp(re_signal << 2, -0xffff, 0xffff); }
1threat
AioContext *aio_context_new(void) { AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD)); ctx->thread_pool = NULL; qemu_mutex_init(&ctx->bh_lock); rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx); event_notifier_init(&ctx->notifier, false); aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); return ctx; }
1threat
static void disas_fp_csel(DisasContext *s, uint32_t insn) { unsigned int mos, type, rm, cond, rn, rd; int label_continue = -1; mos = extract32(insn, 29, 3); type = extract32(insn, 22, 2); rm = extract32(insn, 16, 5); cond = extract32(insn, 12, 4); rn = extract32(insn, 5, 5); rd = extract32(insn, 0, 5); if (mos || type > 1) { unallocated_encoding(s); return; } if (!fp_access_check(s)) { return; } if (cond < 0x0e) { int label_match = gen_new_label(); label_continue = gen_new_label(); arm_gen_test_cc(cond, label_match); gen_mov_fp2fp(s, type, rd, rm); tcg_gen_br(label_continue); gen_set_label(label_match); } gen_mov_fp2fp(s, type, rd, rn); if (cond < 0x0e) { gen_set_label(label_continue); } }
1threat
How to create random numbers with exceptions and that do not repeat themselves? (Swift 4) : Sorry for the English of Google Translate. I would like to know how to make an app generate a random number with numbers determined by typing in UITextField, for example, between 25 and 35, but that do not repeat and that can not display some numbers, also determined by typing in UITextField, for example : 28, 29 and 30. So by pressing the button he would have the numbers 25, 26, 27, 31, 32, 33, 34 and 35 to display (remembering that without repeating) I've tried several places and courses, but I did not get a valid answer.
0debug
Is there any way to define custom routes in Phoenix? : <p>Let's say I want to create a <code>resources</code> with adding a couple of custom actions to it, the analogue in rails is:</p> <pre><code>resources :tasks do member do get :implement end end </code></pre> <p>Which will return me not only 7 standard routes, but 1 new:</p> <pre><code>GET /tasks/:id/implement </code></pre> <p>How can I do it in phoenix?</p>
0debug
Every time I want to pull a table on the SQL server, I have to write the path name prior. : Is there a way to specify a path for every time I want to pull a table? Similar to how you would specify your Directory in R prior to use? I am currently using the SQL on Visual Studio interface. Thanks.
0debug
static int hls_transform_unit(HEVCContext *s, int x0, int y0, int xBase, int yBase, int cb_xBase, int cb_yBase, int log2_cb_size, int log2_trafo_size, int trafo_depth, int blk_idx, int cbf_luma, int *cbf_cb, int *cbf_cr) { HEVCLocalContext *lc = s->HEVClc; const int log2_trafo_size_c = log2_trafo_size - s->sps->hshift[1]; int i; if (lc->cu.pred_mode == MODE_INTRA) { int trafo_size = 1 << log2_trafo_size; ff_hevc_set_neighbour_available(s, x0, y0, trafo_size, trafo_size); s->hpc.intra_pred[log2_trafo_size - 2](s, x0, y0, 0); } if (cbf_luma || cbf_cb[0] || cbf_cr[0] || (s->sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1]))) { int scan_idx = SCAN_DIAG; int scan_idx_c = SCAN_DIAG; int cbf_chroma = cbf_cb[0] || cbf_cr[0] || (s->sps->chroma_format_idc == 2 && (cbf_cb[1] || cbf_cr[1])); if (s->pps->cu_qp_delta_enabled_flag && !lc->tu.is_cu_qp_delta_coded) { lc->tu.cu_qp_delta = ff_hevc_cu_qp_delta_abs(s); if (lc->tu.cu_qp_delta != 0) if (ff_hevc_cu_qp_delta_sign_flag(s) == 1) lc->tu.cu_qp_delta = -lc->tu.cu_qp_delta; lc->tu.is_cu_qp_delta_coded = 1; if (lc->tu.cu_qp_delta < -(26 + s->sps->qp_bd_offset / 2) || lc->tu.cu_qp_delta > (25 + s->sps->qp_bd_offset / 2)) { av_log(s->avctx, AV_LOG_ERROR, "The cu_qp_delta %d is outside the valid range " "[%d, %d].\n", lc->tu.cu_qp_delta, -(26 + s->sps->qp_bd_offset / 2), (25 + s->sps->qp_bd_offset / 2)); return AVERROR_INVALIDDATA; } ff_hevc_set_qPy(s, cb_xBase, cb_yBase, log2_cb_size); } if (s->sh.cu_chroma_qp_offset_enabled_flag && cbf_chroma && !lc->cu.cu_transquant_bypass_flag && !lc->tu.is_cu_chroma_qp_offset_coded) { int cu_chroma_qp_offset_flag = ff_hevc_cu_chroma_qp_offset_flag(s); if (cu_chroma_qp_offset_flag) { int cu_chroma_qp_offset_idx = 0; if (s->pps->chroma_qp_offset_list_len_minus1 > 0) { cu_chroma_qp_offset_idx = ff_hevc_cu_chroma_qp_offset_idx(s); av_log(s->avctx, AV_LOG_ERROR, "cu_chroma_qp_offset_idx not yet tested.\n"); } lc->tu.cu_qp_offset_cb = s->pps->cb_qp_offset_list[cu_chroma_qp_offset_idx]; lc->tu.cu_qp_offset_cr = s->pps->cr_qp_offset_list[cu_chroma_qp_offset_idx]; } else { lc->tu.cu_qp_offset_cb = 0; lc->tu.cu_qp_offset_cr = 0; } lc->tu.is_cu_chroma_qp_offset_coded = 1; } if (lc->cu.pred_mode == MODE_INTRA && log2_trafo_size < 4) { if (lc->tu.intra_pred_mode >= 6 && lc->tu.intra_pred_mode <= 14) { scan_idx = SCAN_VERT; } else if (lc->tu.intra_pred_mode >= 22 && lc->tu.intra_pred_mode <= 30) { scan_idx = SCAN_HORIZ; } if (lc->tu.intra_pred_mode_c >= 6 && lc->tu.intra_pred_mode_c <= 14) { scan_idx_c = SCAN_VERT; } else if (lc->tu.intra_pred_mode_c >= 22 && lc->tu.intra_pred_mode_c <= 30) { scan_idx_c = SCAN_HORIZ; } } lc->tu.cross_pf = 0; if (cbf_luma) ff_hevc_hls_residual_coding(s, x0, y0, log2_trafo_size, scan_idx, 0); if (log2_trafo_size > 2 || s->sps->chroma_format_idc == 3) { int trafo_size_h = 1 << (log2_trafo_size_c + s->sps->hshift[1]); int trafo_size_v = 1 << (log2_trafo_size_c + s->sps->vshift[1]); lc->tu.cross_pf = (s->pps->cross_component_prediction_enabled_flag && cbf_luma && (lc->cu.pred_mode == MODE_INTER || (lc->tu.chroma_mode_c == 4))); if (lc->tu.cross_pf) { hls_cross_component_pred(s, 0); } for (i = 0; i < (s->sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 1); } if (cbf_cb[i]) ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), log2_trafo_size_c, scan_idx_c, 1); else if (lc->tu.cross_pf) { ptrdiff_t stride = s->frame->linesize[1]; int hshift = s->sps->hshift[1]; int vshift = s->sps->vshift[1]; int16_t *coeffs_y = lc->tu.coeffs[0]; int16_t *coeffs = lc->tu.coeffs[1]; int size = 1 << log2_trafo_size_c; uint8_t *dst = &s->frame->data[1][(y0 >> vshift) * stride + ((x0 >> hshift) << s->sps->pixel_shift)]; for (i = 0; i < (size * size); i++) { coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); } s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); } } if (lc->tu.cross_pf) { hls_cross_component_pred(s, 1); } for (i = 0; i < (s->sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(s, x0, y0 + (i << log2_trafo_size_c), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (i << log2_trafo_size_c), 2); } if (cbf_cr[i]) ff_hevc_hls_residual_coding(s, x0, y0 + (i << log2_trafo_size_c), log2_trafo_size_c, scan_idx_c, 2); else if (lc->tu.cross_pf) { ptrdiff_t stride = s->frame->linesize[2]; int hshift = s->sps->hshift[2]; int vshift = s->sps->vshift[2]; int16_t *coeffs_y = lc->tu.coeffs[0]; int16_t *coeffs = lc->tu.coeffs[1]; int size = 1 << log2_trafo_size_c; uint8_t *dst = &s->frame->data[2][(y0 >> vshift) * stride + ((x0 >> hshift) << s->sps->pixel_shift)]; for (i = 0; i < (size * size); i++) { coeffs[i] = ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); } s->hevcdsp.transform_add[log2_trafo_size-2](dst, coeffs, stride); } } } else if (blk_idx == 3) { int trafo_size_h = 1 << (log2_trafo_size + 1); int trafo_size_v = 1 << (log2_trafo_size + s->sps->vshift[1]); for (i = 0; i < (s->sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 1); } if (cbf_cb[i]) ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), log2_trafo_size, scan_idx_c, 1); } for (i = 0; i < (s->sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { ff_hevc_set_neighbour_available(s, xBase, yBase + (i << log2_trafo_size), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (i << log2_trafo_size), 2); } if (cbf_cr[i]) ff_hevc_hls_residual_coding(s, xBase, yBase + (i << log2_trafo_size), log2_trafo_size, scan_idx_c, 2); } } } else if (lc->cu.pred_mode == MODE_INTRA) { if (log2_trafo_size > 2 || s->sps->chroma_format_idc == 3) { int trafo_size_h = 1 << (log2_trafo_size_c + s->sps->hshift[1]); int trafo_size_v = 1 << (log2_trafo_size_c + s->sps->vshift[1]); ff_hevc_set_neighbour_available(s, x0, y0, trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 1); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0, 2); if (s->sps->chroma_format_idc == 2) { ff_hevc_set_neighbour_available(s, x0, y0 + (1 << log2_trafo_size_c), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 1); s->hpc.intra_pred[log2_trafo_size_c - 2](s, x0, y0 + (1 << log2_trafo_size_c), 2); } } else if (blk_idx == 3) { int trafo_size_h = 1 << (log2_trafo_size + 1); int trafo_size_v = 1 << (log2_trafo_size + s->sps->vshift[1]); ff_hevc_set_neighbour_available(s, xBase, yBase, trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 1); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase, 2); if (s->sps->chroma_format_idc == 2) { ff_hevc_set_neighbour_available(s, xBase, yBase + (1 << (log2_trafo_size)), trafo_size_h, trafo_size_v); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 1); s->hpc.intra_pred[log2_trafo_size - 2](s, xBase, yBase + (1 << (log2_trafo_size)), 2); } } } return 0; }
1threat
COnvert it to laravel : Need to convert this sql code to laravel SELECT b.name FROM brands b INNER JOIN products p on b.id=p.brand_id INNER JOIN transaction_sell_lines tr on p.brand_id=tr.product_id SELECT b.name FROM brands b INNER JOIN products p on b.id=p.brand_id INNER JOIN transaction_sell_lines tr on p.brand_id=tr.product_id Need to get the laravel code
0debug
The labels of checkboxes are not properly aligned? IMG 1 labels are properly aligned but not for IMG 2.How to align them? : [Properly aligned text label of checkbox][1] [misaligned label of checkbox][2] [1]: https://i.stack.imgur.com/l5YWm.png [2]: https://i.stack.imgur.com/udi0k.png
0debug
what is the difference of enter/exit and popEnter/popExit, and which transaction's animation it will running at pop stack : <p>In setCustomAnimations() it takes four resource id for the animation. Not really understand them. If someone having clearer picture of it it would be appreciated if you could explain.</p> <p>Let's say having fragment A add in the place holder and backstack. </p> <pre><code>FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.holder, fragA, FragmentA.FRAGMENT_NAME); ft.addToBackStack(FragmentA.FRAGMENT_NAME); ft.setCustomAnimations(R.anim.slide_in_from_bottom, R.anim.slide_in_from_top, R.anim.slide_in_from_left, R.anim.slide_in_from_right); ft.show(frag); ft.commit(); </code></pre> <p>And the replace with fragment B:</p> <pre><code>FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.holder, fragB, FragmentB.FRAGMENT_NAME); ft.addToBackStack(FragmentB.FRAGMENT_NAME); ft.setCustomAnimations(R.anim.slide_in_from_bottom, R.anim.slide_in_from_top, R.anim.slide_in_from_left, R.anim.slide_in_from_right); ft.show(frag); ft.commit(); </code></pre> <p>next time if do a popstack()</p> <pre><code>fm.popBackStackImmediate(FragmentB.FRAGMENT_NAME, FragmentManager.POP_BACK_STACK_INCLUSIVE); </code></pre> <p>Which transaction's animation it will be running from?</p> <pre><code>/** * Set specific animation resources to run for the fragments that are * entering and exiting in this transaction. The &lt;code&gt;popEnter&lt;/code&gt; * and &lt;code&gt;popExit&lt;/code&gt; animations will be played for enter/exit * operations specifically when popping the back stack. */ public abstract FragmentTransaction setCustomAnimations(@AnimRes int enter, @AnimRes int exit, @AnimRes int popEnter, @AnimRes int popExit); </code></pre>
0debug
how to send my object by email? : This my code after submitting a form i got a json object, i want to send this JSON object in an mail, but i am stuck <!-- begin snippet: js hide: false --> <!-- language: lang-html --> $(document).ready(function() { $("#contact").submit(function () { var data = {}; $.each($(this).serializeArray(), function (key, value) { data[value.name] = value.value; }); data.interest = [data.interest1, data.interest2, data.interest3]; delete data.interest1; delete data.interest2; delete data.interest3; console.log(data); $.ajax({ type: "POST", data: JSON.stringify(data), dataType: 'json', url: "post.js", success: function (data) { $("#contact").addClass('success'); }, error: function () { $("#contact").addClass('error'); } }); return false; }); }); <!-- end snippet -->
0debug
My Android app is crashing on some device duo to java.lang.RuntimeException? : <p>My Android App is crashing on some devices due to java.lang.RuntimeException? It crashes mostly on Android version 7.0 and 7.1. Some of the devices on which it has crashed is Redmi Note 4, Moto G (5) Plus, OnePlus 3. I don't know how why It is crashing but I am giving you the link of both the app and the source code here App Link : <a href="https://play.google.com/store/apps/details?id=com.soloprogrammer.noughtsandcrosses" rel="nofollow noreferrer">https://play.google.com/store/apps/details?id=com.soloprogrammer.noughtsandcrosses</a></p> <p>Source Code: <a href="https://github.com/iamshubhamsaurav/Noughts_and_Crosses" rel="nofollow noreferrer">https://github.com/iamshubhamsaurav/Noughts_and_Crosses</a></p>
0debug
Proper Android Database : <p>Im new to android. In my project i need to use a perfect DataBase. The purpose of app is, when launching, recieve too much json data from server and to store that data in database after parsing.based on that data i need to work the whole project. Based on the requirement i need to update/ delete db stored values with new json data from server. SQLite may take too much loading time. So which ORM in need to use. Planning for SUGARORM because of its simplicity. What i want to do. If there any tutorials please upload.</p>
0debug
Quick Docstrings in Colaboratory : <p>I'm starting to play with Colaboratory but I've noticed that <code>shift-tab</code> doesn't pop up Docstrings for functions as it does in Jupyter.</p> <p>Is this functionality absent or just accessed some other way?</p>
0debug
How to retrieve only those elements of list which matches user input? : <p>i need to take input from user and only that group of words should return to me where the input string occurs. For example if i search for people then only those group of words where people appears should be retrieved as output.</p> <p>here is my sample output:</p> <pre><code> [(0, '0.897*"allah" + 0.120*"indeed" + 0.117*"lord" + 0.110*"said" + 0.101*"people" + 0.093*"upon" + 0.083*"shall" + 0.082*"unto" + 0.072*"believe" + 0.070*"earth"'), (1, '0.495*"lord" + 0.398*"said" + -0.377*"allah" + 0.252*"shall" + 0.241*"people" + 0.236*"unto" + 0.195*"indeed" + 0.131*"upon" + 0.117*"come" + 0.109*"thou"'), (2, '-0.682*"lord" + 0.497*"shall" + 0.350*"unto" + 0.125*"thee" + 0.125*"thou" + -0.098*"indeed" + -0.092*"said" + 0.092*"come" + 0.091*"people" + 0.080*"truth"'), (3, '-0.615*"shall" + 0.520*"people" + -0.395*"lord" + 0.259*"said" + 0.227*"indeed" + 0.103*"would" + 0.081*"sent" + 0.078*"among" + -0.059*"deeds" + -0.053*"good"'), (4, '0.675*"unto" + -0.425*"shall" + -0.335*"indeed" + 0.214*"thou" + 0.180*"thee" + 0.161*"lord" + -0.105*"said" + 0.099*"hath" + -0.075*"upon"'), (5, '-0.760*"said" + 0.356*"indeed" + 0.261*"upon" + 0.157*"would" + -0.130*"shall" + 0.109*"earth" + -0.108*"allah" + 0.105*"lord" + 0.100*"truth" + 0.096*"good"') </code></pre> <p>Here is my expected output:</p> <pre><code> [(0, '0.897*"allah" + 0.120*"indeed" + 0.117*"lord" + 0.110*"said" + 0.101*"people" + 0.093*"upon" + 0.083*"shall" + 0.082*"unto" + 0.072*"believe" + 0.070*"earth"'), (1, '0.495*"lord" + 0.398*"said" + -0.377*"allah" + 0.252*"shall" + 0.241*"people" + 0.236*"unto" + 0.195*"indeed" + 0.131*"upon" + 0.117*"come" + 0.109*"thou"'), (2, '-0.682*"lord" + 0.497*"shall" + 0.350*"unto" + 0.125*"thee" + 0.125*"thou" + -0.098*"indeed" + -0.092*"said" + 0.092*"come" + 0.091*"people" + 0.080*"truth"'), (3, '-0.615*"shall" + 0.520*"people" + -0.395*"lord" + 0.259*"said" + 0.227*"indeed" + 0.103*"would" + 0.081*"sent" + 0.078*"among" + -0.059*"deeds" + -0.053*"good"')] </code></pre>
0debug
Java remove duplicated array : how to remove the duplicated entry from this array code: Iterator<IHTTPStreamerSession> iterHttp = httpSessions.iterator(); while(iterHttp.hasNext()) { IHTTPStreamerSession httpSession = iterHttp.next(); if (httpSession == null) continue; ret.append("<HTTPSession>"); ret.append("<IpAddress>"+httpSession.getIpAddress()+"</IpAddress>"); ret.append("<TimeRunning>"+httpSession.getTimeRunningSeconds()+"</TimeRunning>"); ret.append("</HTTPSession>"); } I need to generate only 1 entry for each < IpAddress >
0debug
I want to understand how can i run a google app-script to extract information of schools in a certain state : Im trying to create a data base for all the school in a certain state. I have written a google app-script that pulls the details of a school and inserts it in a spreadsheet. The problem is that I want to automate the process of changing the name of the school in the url based on the ones I have. I have looking also for to extract the place_id based on a Lat and Long and with type=school but is not working, only pulls 20 schools function onOpen() { var ui = SpreadsheetApp.getUi(); ui.createMenu('Google Place Search') .addItem('Buscar Informacion','callgooglemapsapi') .addToUi(); } function callgooglemapsapi() { var response = UrlFetchApp.fetch("https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=El%20Colegio%20de%20Tamaulipas&inputtype=textquery&fields=formatted_address,type,place_id,geometry,icon,id,name,permanently_closed,photos,place_id,plus_code,user_ratings_total&key=AIzaSyDQlB5xlLhSQZhdIkBGR0WXiWPLVqMwKkM"); // Parse the JSON reply var json = response.getContentText(); var data = JSON.parse(json); Logger.log(data); Logger.log(data["candidates"]); Logger.log(data["candidates"][0]); var sheet = SpreadsheetApp.getActiveSheet(); sheet.getRange(sheet.getLastRow() + 1,1).setValue(data["candidates"][0]["name"]); sheet.getRange(sheet.getLastRow() + 0,2).setValue(data["candidates"][0]["formatted_address"]); sheet.getRange(sheet.getLastRow() + 0,3).setValue(data["candidates"][0]["geometry"]["location"]["lng"]); sheet.getRange(sheet.getLastRow() + 0,4).setValue(data["candidates"][0]["geometry"]["location"]["lat"]); sheet.getRange(sheet.getLastRow() + 0,5).setValue(data["candidates"][0]["geometry"]["viewport"]["southwest"]["lng"]); sheet.getRange(sheet.getLastRow() + 0,6).setValue(data["candidates"][0]["geometry"]["viewport"]["southwest"]["lat"]); sheet.getRange(sheet.getLastRow() + 0,7).setValue(data["candidates"][0]["geometry"]["viewport"]["northeast"]["lng"]); sheet.getRange(sheet.getLastRow() + 0,8).setValue(data["candidates"][0]["geometry"]["viewport"]["northeast"]["lat"]); sheet.getRange(sheet.getLastRow() + 0,9).setValue(data["candidates"][0]["place_id"]); sheet.getRange(sheet.getLastRow() + 0,10).setValue(data["candidates"][0]["photo_reference"]); sheet.getRange(sheet.getLastRow() + 0,11).setValue(data["candidates"][0]["plus_code"]); sheet.getRange(sheet.getLastRow() + 0,12).setValue(data["candidates"][0]["types"]); I expect to extrat the detail information and photos and insert them to a spreadsheet, I have 4,000 school names.
0debug
static void pci_nic_uninit(PCIDevice *pci_dev) { EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); vmstate_unregister(&pci_dev->qdev, s->vmstate, s); eeprom93xx_free(&pci_dev->qdev, s->eeprom); qemu_del_nic(s->nic); }
1threat
static void s390_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); S390CPUClass *scc = S390_CPU_GET_CLASS(dev); S390CPU *cpu = S390_CPU(dev); CPUS390XState *env = &cpu->env; Error *err = NULL; cpu_exec_init(cs, &err); if (err != NULL) { error_propagate(errp, err); return; } #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); #endif env->cpu_num = scc->next_cpu_id++; s390_cpu_gdb_init(cs); qemu_init_vcpu(cs); #if !defined(CONFIG_USER_ONLY) run_on_cpu(cs, s390_do_cpu_full_reset, cs); #else cpu_reset(cs); #endif scc->parent_realize(dev, errp); }
1threat
Variable name : "objectId" or "idObject"? : <p>In my company both are used equally, this triggers my OCD, what's your thought on this ? </p> <p>I think I'd rather go for "objectId"</p>
0debug
How to convert 8pm to 20 hrs in plsql? : <p>Can anyone help me to convert <code>08-MAR-16 08.15.41.000000 PM</code> so I need <code>08-MAR-16 20.15.41.000000</code> ?</p>
0debug
Long tasks in Application class : <p>Is it a good practice to make long tasks such as server requests in the application class? Let's say these requests are for initialization,is it still fine to place these requests in the oncreate method in the Application class.</p>
0debug
static av_cold void init_vlcs(FourXContext *f) { static VLC_TYPE table[8][32][2]; int i; for (i = 0; i < 8; i++) { block_type_vlc[0][i].table = table[i]; block_type_vlc[0][i].table_allocated = 32; init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7, &block_type_tab[0][i][0][1], 2, 1, &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); } }
1threat
static int oggvorbis_encode_frame(AVCodecContext *avccontext, unsigned char *packets, int buf_size, void *data) { OggVorbisContext *context = avccontext->priv_data ; float **buffer ; ogg_packet op ; signed char *audio = data ; int l, samples = OGGVORBIS_FRAME_SIZE ; buffer = vorbis_analysis_buffer(&context->vd, samples) ; if(context->vi.channels == 1) { for(l = 0 ; l < samples ; l++) buffer[0][l]=((audio[l*2+1]<<8)|(0x00ff&(int)audio[l*2]))/32768.f; } else { for(l = 0 ; l < samples ; l++){ buffer[0][l]=((audio[l*4+1]<<8)|(0x00ff&(int)audio[l*4]))/32768.f; buffer[1][l]=((audio[l*4+3]<<8)|(0x00ff&(int)audio[l*4+2]))/32768.f; } } vorbis_analysis_wrote(&context->vd, samples) ; while(vorbis_analysis_blockout(&context->vd, &context->vb) == 1) { vorbis_analysis(&context->vb, NULL); vorbis_bitrate_addblock(&context->vb) ; while(vorbis_bitrate_flushpacket(&context->vd, &op)) { memcpy(context->buffer + context->buffer_index, &op, sizeof(ogg_packet)); context->buffer_index += sizeof(ogg_packet); memcpy(context->buffer + context->buffer_index, op.packet, op.bytes); context->buffer_index += op.bytes; } } if(context->buffer_index){ ogg_packet *op2= (ogg_packet*)context->buffer; op2->packet = context->buffer + sizeof(ogg_packet); l= op2->bytes; memcpy(packets, op2->packet, l); context->buffer_index -= l + sizeof(ogg_packet); memcpy(context->buffer, context->buffer + l + sizeof(ogg_packet), context->buffer_index); return l; } return 0; }
1threat
Usage of function pointer in real world application : <p>I am very curious to find out how and where function pointer is widely used in real world application. From my experience, I haven't had a chance to apply function pointer in any of my projects. I am wondering if this is just an academic fun thing to learn or does this have a real life application purpose.</p>
0debug
getting Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI] in Android studio 3.0 : <p>As per this <a href="https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html" rel="noreferrer">blogpost</a> from CommonsWare, <code>AndroidManifest.xml</code> file can have an <code>android:testOnly</code> attribute.</p> <p>In my <code>AndroidManifest.xml</code> it is set as "false"</p> <pre><code>android:testOnly="false" </code></pre> <p>And I am generating the apk file using the “Build APK(s)” menu option as shown below image,</p> <p><a href="https://i.stack.imgur.com/OE9qt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OE9qt.png" alt="enter image description here"></a></p> <p>And when i am trying to install app from command line, adb install -r myapp.apk, I am still getting error,</p> <blockquote> <p>Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]</p> </blockquote> <p>Android studio version is as below, <a href="https://i.stack.imgur.com/e2zv9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e2zv9.png" alt="enter image description here"></a></p> <p>What else shall I do to make my app run?</p>
0debug
How to branch recursion into returning only a list of lists (Python) : I'm having a problem where I what I need returning should be a list of lists, with each nested list being a list of 2 strings. I can't find a way to flatten this list effectively, or to return just the list of lists, as the number of nested lists is undeterminable. This is happening in my recursive function, where I branch into 3 different paths of recursion for each recursive loop. What I have so far is: ``` def f(used, sequences): if sequences[0] == '' or sequences[1] == '': if sequences[0] == '' and sequences[1] == '': return [used[0], used[1]] elif sequences[0] != '': return [used[0] + sequences[0], used[1] + '-' * len(sequences[0])] elif sequences[1] != '': return [used[0] + '-' * len(sequences[1]), used[1] + sequences[1]] else: return [f([sequences[0][-1] + used[0], sequences[1][-1] + used[1]], [sequences[0][:-1], sequences[1][:-1]]), f([sequences[0][-1] + used[0], '-' + used[1]], [sequences[0][:-1], sequences[1]]), f(['-' + used[0], sequences[1][-1] + used[1]], [sequences[0], sequences[1][:-1]])] ``` which will generate something like `[[[['str', 'str'], ['str', 'str'], ['str', 'str']], [['str, 'str']... ` when I want it to come out as `[['str', 'str'], ['str', 'str'], ['str', 'str']...` Is there a way to fix my recursion so that this is the case, or a function I can write to flatten it the way I want?
0debug
(Answered) Stuck on Infinite Loop, Sublimetext3 MAC : I found a lot of posts about how to stop a sublime text infinite loop, however my scenario is different than those addressed. I figured out the answer as well, which requires no work So I had an infinite loop on sublime text 3. This caused immediate freezing so I couldn't edit or cancel with cmd c, etc. Upon reopening sublimetext3, it would auto run. Instead of using terminal or downloading packages, I found an easy way to edit the text with the bad loop. on mac -> finder --> go to folder(drop down) --> ~/Library/ --> application support--> sublime text 3 --> packages --> user --> find the file --> open with text editor --> delete lines with infinite loop --> actions --> save.
0debug
Error123: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference : <p>please do not mark this question as duplicate, because I have all of the solutions on similar questions to this, and they haven't worked. Not saying that those answers were wrong, just that it isn't working for me at least. Thanks.</p> <p>Here is my if statement:</p> <pre><code> if (dataSnapshot.exists() &amp;&amp; !dataSnapshot.child("connections").child("nope").hasChild(currentUId) &amp;&amp; !dataSnapshot.child("connections").child("yes").hasChild(currentUId)){ String profileImageUrl = "default"; if (profileImageUrl !=null &amp;&amp; !dataSnapshot.child("profileImageUrl").getValue().equals("default")){ profileImageUrl = dataSnapshot.child("profileImageUrl").getValue().toString(); } com.example.tiarnan.tinder.cards item = new com.example.tiarnan.tinder.cards(dataSnapshot.getKey(), dataSnapshot.child("name").getValue().toString(), profileImageUrl); rowItems.add(item); arrayAdapter.notifyDataSetChanged(); } </code></pre> <p>As you can see, I did try to put a != null, but it still isn't working. That was the most seen solution on the duplicate questions.</p> <p>Thanks in advance, and I hope you guys can help me solve this.</p>
0debug
static MMSSCPacketType get_tcp_server_response(MMSContext *mms) { int read_result; MMSSCPacketType packet_type= -1; for(;;) { if((read_result= url_read_complete(mms->mms_hd, mms->in_buffer, 8))==8) { if(AV_RL32(mms->in_buffer + 4)==0xb00bface) { mms->incoming_flags= mms->in_buffer[3]; read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4); if(read_result == 4) { int length_remaining= AV_RL32(mms->in_buffer+8) + 4; int hr; dprintf(NULL, "Length remaining is %d\n", length_remaining); if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 12) { dprintf(NULL, "Incoming message len %d exceeds buffer len %d\n", length_remaining, sizeof(mms->in_buffer) - 12); read_result = url_read_complete(mms->mms_hd, mms->in_buffer + 12, length_remaining) ; if (read_result == length_remaining) { packet_type= AV_RL16(mms->in_buffer+36); } else { dprintf(NULL, "read for packet type failed%d!\n", read_result); } else { dprintf(NULL, "read for length remaining failed%d!\n", read_result); } else { int length_remaining; int packet_id_type; int tmp; assert(mms->remaining_in_len==0); tmp = AV_RL16(mms->in_buffer + 6); length_remaining = (tmp - 8) & 0xffff; mms->incoming_packet_seq = AV_RL32(mms->in_buffer); packet_id_type = mms->in_buffer[4]; mms->incoming_flags = mms->in_buffer[5]; if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 8) { dprintf(NULL, "Incoming data len %d exceeds buffer len %d\n", length_remaining, sizeof(mms->in_buffer)); mms->remaining_in_len = length_remaining; mms->read_in_ptr = mms->in_buffer; read_result= url_read_complete(mms->mms_hd, mms->in_buffer, length_remaining); if(read_result != length_remaining) { dprintf(NULL, "read_bytes result: %d asking for %d\n", read_result, length_remaining); } else { if(packet_id_type == mms->header_packet_id) { packet_type = SC_PKT_ASF_HEADER; if(!mms->header_parsed) { void *p = av_realloc(mms->asf_header, mms->asf_header_size + mms->remaining_in_len); if (!p) { av_freep(&mms->asf_header); return AVERROR(ENOMEM); mms->asf_header = p; memcpy(mms->asf_header + mms->asf_header_size, mms->read_in_ptr, mms->remaining_in_len); mms->asf_header_size += mms->remaining_in_len; } else if(packet_id_type == mms->packet_id) { packet_type = SC_PKT_ASF_MEDIA; } else { dprintf(NULL, "packet id type %d is old.", packet_id_type); continue; if(packet_type == SC_PKT_KEEPALIVE) { send_keepalive_packet(mms); continue; } else if(packet_type == SC_PKT_STREAM_CHANGING) { handle_packet_stream_changing_type(mms); } else if(packet_type == SC_PKT_ASF_MEDIA) { pad_media_packet(mms); return packet_type; } else { if(read_result<0) { dprintf(NULL, "Read error (or cancelled) returned %d!\n", read_result); packet_type = SC_PKT_CANCEL; } else { dprintf(NULL, "Read result of zero?!\n"); packet_type = SC_PKT_NO_DATA; return packet_type;
1threat
static int usb_host_handle_iso_data(USBHostDevice *s, USBPacket *p, int in) { AsyncURB *aurb; int i, j, ret, max_packet_size, offset, len = 0; uint8_t *buf; max_packet_size = usb_ep_get_max_packet_size(&s->dev, p->pid, p->devep); if (max_packet_size == 0) return USB_RET_NAK; aurb = get_iso_urb(s, p->pid, p->devep); if (!aurb) { aurb = usb_host_alloc_iso(s, p->pid, p->devep); } i = get_iso_urb_idx(s, p->pid, p->devep); j = aurb[i].iso_frame_idx; if (j >= 0 && j < ISO_FRAME_DESC_PER_URB) { if (in) { if (aurb[i].urb.status) { len = urb_status_to_usb_ret(aurb[i].urb.status); aurb[i].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1; } else if (aurb[i].urb.iso_frame_desc[j].status) { len = urb_status_to_usb_ret( aurb[i].urb.iso_frame_desc[j].status); } else if (aurb[i].urb.iso_frame_desc[j].actual_length > p->iov.size) { printf("husb: received iso data is larger then packet\n"); len = USB_RET_NAK; } else { len = aurb[i].urb.iso_frame_desc[j].actual_length; buf = aurb[i].urb.buffer + j * aurb[i].urb.iso_frame_desc[0].length; usb_packet_copy(p, buf, len); } } else { len = p->iov.size; offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->pid, p->devep); if (len > max_packet_size) { printf("husb: send iso data is larger then max packet size\n"); return USB_RET_NAK; } usb_packet_copy(p, aurb[i].urb.buffer + offset, len); aurb[i].urb.iso_frame_desc[j].length = len; offset += len; set_iso_buffer_used(s, p->pid, p->devep, offset); if (!is_iso_started(s, p->pid, p->devep) && i == 1 && j == 8) { set_iso_started(s, p->pid, p->devep); } } aurb[i].iso_frame_idx++; if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) { i = (i + 1) % s->iso_urb_count; set_iso_urb_idx(s, p->pid, p->devep, i); } } else { if (in) { set_iso_started(s, p->pid, p->devep); } else { DPRINTF("hubs: iso out error no free buffer, dropping packet\n"); } } if (is_iso_started(s, p->pid, p->devep)) { for (i = 0; i < s->iso_urb_count; i++) { if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) { ret = ioctl(s->fd, USBDEVFS_SUBMITURB, &aurb[i]); if (ret < 0) { perror("USBDEVFS_SUBMITURB"); if (!in || len == 0) { switch(errno) { case ETIMEDOUT: len = USB_RET_NAK; break; case EPIPE: default: len = USB_RET_STALL; } } break; } aurb[i].iso_frame_idx = -1; change_iso_inflight(s, p->pid, p->devep, 1); } } } return len; }
1threat
static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = VIRTIO_NET(vdev); struct virtio_net_ctrl_hdr ctrl; virtio_net_ctrl_ack status = VIRTIO_NET_ERR; VirtQueueElement elem; size_t s; struct iovec *iov; unsigned int iov_cnt; while (virtqueue_pop(vq, &elem)) { if (iov_size(elem.in_sg, elem.in_num) < sizeof(status) || iov_size(elem.out_sg, elem.out_num) < sizeof(ctrl)) { error_report("virtio-net ctrl missing headers"); exit(1); } iov = elem.out_sg; iov_cnt = elem.out_num; s = iov_to_buf(iov, iov_cnt, 0, &ctrl, sizeof(ctrl)); iov_discard_front(&iov, &iov_cnt, sizeof(ctrl)); if (s != sizeof(ctrl)) { status = VIRTIO_NET_ERR; } else if (ctrl.class == VIRTIO_NET_CTRL_RX) { status = virtio_net_handle_rx_mode(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MAC) { status = virtio_net_handle_mac(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_VLAN) { status = virtio_net_handle_vlan_table(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_ANNOUNCE) { status = virtio_net_handle_announce(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MQ) { status = virtio_net_handle_mq(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_GUEST_OFFLOADS) { status = virtio_net_handle_offloads(n, ctrl.cmd, iov, iov_cnt); } s = iov_from_buf(elem.in_sg, elem.in_num, 0, &status, sizeof(status)); assert(s == sizeof(status)); virtqueue_push(vq, &elem, sizeof(status)); virtio_notify(vdev, vq); } }
1threat
static int convert_zp2tf(AVFilterContext *ctx, int channels) { AudioIIRContext *s = ctx->priv; int ch, i, j, ret; for (ch = 0; ch < channels; ch++) { IIRChannel *iir = &s->iir[ch]; double *topc, *botc; topc = av_calloc((iir->nb_ab[0] + 1) * 2, sizeof(*topc)); botc = av_calloc((iir->nb_ab[1] + 1) * 2, sizeof(*botc)); if (!topc || !botc) return AVERROR(ENOMEM); ret = expand(ctx, iir->ab[0], iir->nb_ab[0], botc); if (ret < 0) { av_free(topc); av_free(botc); return ret; } ret = expand(ctx, iir->ab[1], iir->nb_ab[1], topc); if (ret < 0) { av_free(topc); av_free(botc); return ret; } for (j = 0, i = iir->nb_ab[1]; i >= 0; j++, i--) { iir->ab[1][j] = topc[2 * i]; } iir->nb_ab[1]++; for (j = 0, i = iir->nb_ab[0]; i >= 0; j++, i--) { iir->ab[0][j] = botc[2 * i]; } iir->nb_ab[0]++; av_free(topc); av_free(botc); } return 0; }
1threat
Can't Load URL: The domain of this URL isn't included in the app's domains : <p>I'm trying to get access token from user</p> <pre><code>string response_script = "&lt;script&gt;top.location.href='https://www.facebook.com/v2.4/dialog/oauth?response_type=token&amp;client_id=[APPLICATION ID]&amp;redirect_uri=https://www.facebook.com/[APPLICATION URL]/?sk=app_[PAGE ID]&amp;scope='; &lt;/script&gt;"; </code></pre> <p>But I'm getting an error:</p> <blockquote> <p>Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.</p> </blockquote> <p>That code works well. So I think that needs to add my url to</p> <blockquote> <p>Valid OAuth redirect URIs</p> </blockquote> <p><strong>But</strong> It doesn't exists in advanced section anymore. facebook changed it's design and now it looks like <a href="http://i.imgur.com/lv7SCmz.png">this. It's too big image and because I have it in out of stackoverflow</a></p> <p>What can I do?</p>
0debug
Using Kafka Producer by different threads : <p>I have kafka producer for my java based web application to push messages to Kafka. As per the documentation I could see kafka producer is thread safe. Does it mean that I can have single instance of Kafka producer and use it by different threads ( web requests ) each will open and close the producer in my case. Will this create any issues ? Or Is better to initiate Producers per request ? </p>
0debug
pvscsi_on_cmd_setup_msg_ring(PVSCSIState *s) { PVSCSICmdDescSetupMsgRing *rc = (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data; trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_MSG_RING"); if (!s->use_msg) { return PVSCSI_COMMAND_PROCESSING_FAILED; } if (s->rings_info_valid) { pvscsi_ring_init_msg(&s->rings, rc); s->msg_ring_info_valid = TRUE; } return sizeof(PVSCSICmdDescSetupMsgRing) / sizeof(uint32_t); }
1threat
What is += mean in python and why should i use it? : <p>I was wondering what the += operator does in python. What is it used for and why would i use it?</p>
0debug
r update df1 values based ond df2 in different format : I am trying to find a scalable solution to update a data.frame based on another data.frame. Here a minimal example: df1 <- data.frame(cbind(c("a","b","b","b","c"),c(1,1,1,2,2),as.numeric(c(0.2,0.6,0.6,0.8,0.4)))) colnames(df1) <- c("ID1", "ID2","Value") > df1 ID1 ID2 Value 1 a 1 0.2 2 b 1 0.6 3 b 1 0.6 4 b 2 0.8 5 c 2 0.4 df2 <- data.frame(cbind(2),0,0.45,0.5) colnames(df2) <- c("ID2", "a","b","c") > df2 ID2 a b c 1 2 0 0.45 0.5 Now I would like to update the values of df1 by using df2 values to get to the following result: ID1 ID2 Value 1 a 1 0.2 2 b 1 0.6 3 b 1 0.6 4 b 2 0.45 5 c 2 0.5 Can someone help on this? thanks a lot
0debug
NameError: name 'n' not defined Python, Flask : I have suddenly been getting the "NameError" when I run my flask code associated with the python code snippet posted below. I have similar functions defined which is basically web scraping using BS4, but the current function mentioned below throws this error when I run the flask code on localhost. I have researched on this error on SO, and have accordingly added the global definitions as well, but still no luck with resolving this. Any help is much appreciated. Thanks in advance! Python code snippet: def bcnews(self): global n, l bcheadline = requests.get("https://www.bleepingcomputer.com/") soup=BeautifulSoup(bcheadline.content, 'html.parser') for data in soup.find_all('div', class_="bc_banner_item cz-banner-item"): for item in soup.find_all('div', class_="bc_banner_caption"): n = (item.find('h4').contents[0]) break for links in item.find_all('a'): l = (links.get('href')) break break return (n,l)
0debug
How to launch an ec2 in particular VPC in Yaml template of CloudFormation : Can you please answer my question, I am just stucked at this, How to launch am ec2 in particular subnet of particular VPC using Yaml template in Cloud Formation.
0debug