problem
stringlengths
26
131k
labels
class label
2 classes
ResharperUltimate - disable ReSpeller : <p>How can I disable this plugin from resharper options in Visual Studio? Driving me crazy, I've unchecked all checkboxes from <code>resharper-&gt;options-&gt;ReSpeller</code> yet it persists to underline every single string (writing in czech) with green.<br> Thanks in advance. </p>
0debug
Display simple text on vertices : <p>So I am trying to make a simple program (I'm a student) and it works fine so far, but I can't figure out how to display the "i" value from the loop in the drawCircle() function in Shapes.cpp </p> <p>code:</p> <p><a href="http://pastebin.com/4kDPNjy8" rel="nofollow noreferrer">http://pastebin.com/4kDPNjy8</a></p> <p>example: <a href="https://i.stack.imgur.com/Me9kV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Me9kV.png" alt="enter image description here"></a></p> <p>When I compile my code right now it looks like on the image to the left, but I want to get something like on the right but I have no idea how to do that kind of stuff or what function should I use for that.</p> <p>Please help </p>
0debug
Not receiving email when someone is clicking on pay no btn : I am new to PHP building a website with paytm gateway integration .i have register page with pay now but when someone clicks on pay now it is directing them to pgRedirect.php (provided by paytm). I want if someone clicks on pay now but we should get an email about all the details filled by cust in register page
0debug
def get_total_number_of_sequences(m,n): T=[[0 for i in range(n+1)] for i in range(m+1)] for i in range(m+1): for j in range(n+1): if i==0 or j==0: T[i][j]=0 elif i<j: T[i][j]=0 elif j==1: T[i][j]=i else: T[i][j]=T[i-1][j]+T[i//2][j-1] return T[m][n]
0debug
Adding Text to Text if Condition is Cet : How can I in jQuery or plan Javascript add text if condition is met. For example: <input type="checkbox" id="foo"> <label for="foo">Foo Text</label> <input type="checkbox" id="bar"> <label for="bar">Bar Text</label> <p class="success" style="display: none;">Thank you for </p> <button type="submit" id="submit-form" class="btn btn-success pull-left">SUBSCRIBE</button> Not I need a logic that will place a "Bar Text" or "Foot Text" depending which checkbox is checked, after the submit is clicked. I know I have to use `.is(:checked)` but I do not know how to place a text dynamically after the static "Thank you " text. Also, I would like a jQuery and Javascript solution, if possible, for learning purposes only. Thanks.
0debug
av_cold void ff_volume_init_x86(VolumeContext *vol) { int cpu_flags = av_get_cpu_flags(); enum AVSampleFormat sample_fmt = av_get_packed_sample_fmt(vol->sample_fmt); if (sample_fmt == AV_SAMPLE_FMT_S16) { if (EXTERNAL_SSE2(cpu_flags) && vol->volume_i < 32768) { vol->scale_samples = ff_scale_samples_s16_sse2; vol->samples_align = 8; } } else if (sample_fmt == AV_SAMPLE_FMT_S32) { if (EXTERNAL_SSE2(cpu_flags)) { vol->scale_samples = ff_scale_samples_s32_sse2; vol->samples_align = 4; } if (EXTERNAL_SSSE3(cpu_flags) && cpu_flags & AV_CPU_FLAG_ATOM) { vol->scale_samples = ff_scale_samples_s32_ssse3_atom; vol->samples_align = 4; } if (EXTERNAL_AVX(cpu_flags)) { vol->scale_samples = ff_scale_samples_s32_avx; vol->samples_align = 8; } } }
1threat
match 2 columns in sheet 1 with the columns in sheet 2 and return the value of column 3 of the sheet 1 : I have 2 sheets. sheet 1 contains col 1,col 2, col 3. Similary, sheet 2 has col 1, col 2, col 3. I wish to match a produce a output in this way: if ((col 1(of sheet 1)==col 1 (of sheet 2)) && (col 2(of sheet 1)==col 2 (of sheet 2))), then col 3(of sheet 1)= col 3 (of sheet 2) (I hope I have made the question clear)
0debug
What does this jquery + struts construct do? : I am dealing with JQuery code as follows: function formSubmit(){ $('#myform').attr('action', "./myFilter.action"); $('#myform').submit(); } The form: <s:form name="myform" action="myAction" id="myform"> </s:form> Noticing that myFilter.action is called before myAction. But I don't understand how or why that is happening. Can someone explain? Thanks
0debug
special Chinese characters comparison : <p>. There are something misunderstanding when comparing two characters "李","李".</p> <pre><code>&gt;&gt;&gt; "李" == "李" False &gt;&gt;&gt; id("李") # fisrt one 140041303457584 &gt;&gt;&gt; id("李") # second one 140041303457584 </code></pre> <p>. The first character "李“ id is equal to the second "李" id, but when i try to compare their id to see what happen:</p> <pre><code>&gt;&gt;&gt; id("李") == id("李") False </code></pre> <p>. However, I tried to use chrome "Ctrl + F" that searching the first "李" and matched the second "李".</p> <p>. Does anyone know what happens? what should I do to fix this let the first "李" equal to the second "李"?</p>
0debug
static void achroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset * d2_linesize; uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); for (y = 0; y < src_h; y++) { const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; for (p = 128 + c1; p < 128; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = 128 + c1 - 1; p > 128; p--) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = 128 + c2; p < 128; p++) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } for (p = 128 + c2 - 1; p > 128; p--) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } c1_data += c1_linesize; c2_data += c2_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } } else { const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; d2_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; for (p = 128 + c1; p < 128; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = 128 + 1; p < 128 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = 128 + c2; p < 128; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } for (p = 128 + 1; p < 128 + c2; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } } c1_data += c1_linesize; c2_data += c2_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } envelope(s, out, plane, (plane + 1) % s->ncomp); envelope(s, out, plane, (plane + 2) % s->ncomp); }
1threat
static unsigned int codec_get_asf_tag(const CodecTag *tags, unsigned int id) { while (tags->id != 0) { if (!tags->invalid_asf && tags->id == id) return tags->tag; tags++; } return 0; }
1threat
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
Migration from CVS to GIT - simplest way : <p>I'm starting my professional career in programming and needs help ! What is the simplest way to migrate from CVS to Git .</p>
0debug
Convert int Id to human readable id : Can we convert int Id to human readable id? Int id=view.getId();
0debug
How to get all direct children of a BeautifulSoup Tag? : <p>How to retrieve (not recursively) all children using BeautifulSoup (bs4) ?</p> <p><code>&lt;div class='body'&gt;&lt;span&gt;A&lt;/span&gt;&lt;span&gt;&lt;span&gt;B&lt;/span&gt;&lt;/span&gt;&lt;span&gt;C&lt;/span&gt;&lt;/div&gt;</code></p> <p>I want to get blocks like this : </p> <pre><code>block1 : &lt;span&gt;A&lt;/span&gt; block2 : &lt;span&gt;&lt;span&gt;B&lt;/span&gt;&lt;/span&gt; block3 : &lt;span&gt;C&lt;/span&gt; </code></pre> <p>I'm doing this way :</p> <pre><code>for j in soup.find_all(True)[:1]: if isinstance(j, NavigableString): continue if isinstance(j, Tag): tags.append(j.name) # Get siblings for k in j.find_next_siblings(): # k is sibling of first element </code></pre> <p>Is there a cleaner way to do that?</p>
0debug
Elasticsearch Scroll : <p>I am little bit confused over Elasticsearch by its scroll functionality. In elasticsearch is it possible to call search API everytime whenever the user scrolls on the result set? From documentation </p> <pre><code>"search_type" =&gt; "scan", // use search_type=scan "scroll" =&gt; "30s", // how long between scroll requests. should be small! "size" =&gt; 50, // how many results *per shard* you want back </code></pre> <p>Is that mean it will perform search for every 30 seconds and returns all the sets of results until there is no records?</p> <p>For example my ES returns total 500 records. I am getting an data from ES as two sets of records each with 250 records. Is there any way I can display first set of 250 records first, when user scrolls then second set of 250 records.Please suggest </p>
0debug
How can I check changes in selected options with jQuery? : <p>I want to store a value of the selected option and change it every time when user will change his mind. I used something like $('#selections').val() but first I receive undefined value and nothing happen when certain option is selected. </p> <pre><code>&lt;select id="selections"&gt; &lt;option value="0"&gt;None&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;/select&gt; </code></pre>
0debug
How to become the page responsive? : I want to make this website mobile responsive. But when I add image with the text it breaks its size. I am trying to keep the image and text side by side. I can't understand what should be the width and height. <div class="row"> <div class="col-md-6"> <div class="box2"> <img src="image/p1.jpg" width="160" height="140" align="left" > <h3>PETER L.MARUZ </h3> <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s </p> <img src="image/f.jpg" width="35" height="30" > <img src="image/twitter-bird-white-on-blue.jpg" width="35" height="30" > </div> </div> [enter image description here][1] [1]: https://i.stack.imgur.com/zNqUZ.png
0debug
Why is my c# code not working? : <p>I have made a console program in c# that is like a to-do task manager.<br> But it does not work when a certain code is reached:</p> <pre><code>using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace To_Do_List { class Program { static void Main(string[] args) { string path = @"C:\ToDoTask.txt"; Console.WriteLine("To-do program"); while (true) { if (Console.ReadLine() == "exit") { Environment.Exit(0); } if (Console.ReadLine() == "add") { Console.WriteLine("Please write your task and then press enter"); string task = Console.ReadLine(); Console.WriteLine("Task added"); try { StreamWriter sw = new StreamWriter(path); sw.WriteLine(task); } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error: could not write task to file"); Console.ResetColor(); } } if (Console.ReadLine() == "show") { try { Console.WriteLine("Tasks:"); StreamReader sr = new StreamReader(path); if (sr.ReadToEnd() != "") { Console.WriteLine(sr.ReadToEnd()); } else { Console.WriteLine("No tasks left"); } } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error: could not read tasks file"); Console.ResetColor(); } } if (Console.ReadLine() == "help") { Console.WriteLine("Write 'add' to add a new task"); Console.WriteLine("Write 'show' to see current tasks"); Console.WriteLine("Write 'exit' to exit program"); } } } } } </code></pre> <p>I am new programming and I can't find the error. When I write add, show or exit, or help nothing happens. Thanks.</p>
0debug
static int usbnet_can_receive(NetClientState *nc) { USBNetState *s = qemu_get_nic_opaque(nc); if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) { return 1; return !s->in_len;
1threat
Is it valid to add categories to sitemap.xml? : <p>I have a bloger system with this type of address:</p> <pre><code>www.example.com/xxx </code></pre> <p>each blog has its own content.</p> <p>Should I add blogs to sitemap.xml (for example as a static sitemap) or only all content is enough?</p> <p>I want search engine recognized blogs.</p>
0debug
Manually adding aar with dependency pom/iml file : <p>Since I cannot use a private maven in order to share my library, I was thinking in sharing the aar and importing into another project. The problem comes when the aar and jar files does not contain any dependency. So once I manually import the aar in android studio (using Import .JAR/.AA Package) there is no dependency, and I have to manually add all dependencies again. I already generated a pom file through a gradle task, although I cannot find any way to manually import it on the project.</p> <p>On the build.gradle file automatically generated by the "Import .JAR/.AA Package" is:</p> <pre><code>configurations.maybeCreate("default") artifacts.add("default", file('TestSample_1.0.0.aar')) </code></pre> <p>Is there a way to add the pom/iml file too? something like:</p> <pre><code>artifacts.add("default", file('pomDependencies.xml')) </code></pre>
0debug
Is it alright to install Python on D drive? : <p>I am embarking on the journey to learn Python and decided to start with Python 3.7.3 </p> <p>However, I had a couple of questions before I install python on my computer. </p> <p>My C drive is an M.2 SSD with only about 60 GBs of space left in it. I do not know how much space my python projects would take as I go on about educating myself in the language. Hence I wanted to know whether installing Python and an IDE like PyCharm in D drive would work. Would it affect where pip installs Modules and Libraries?</p>
0debug
How to sort LinkedHashMap by values in Kotlin? : <p>To sort by keys I can use</p> <pre><code>map.toSortedMap() </code></pre> <p>But what is the best way to sort LinkedHashMap by values in Kotlin?</p>
0debug
Is it possible to add a temporary property to a neo4j node for return only? : <p>I have been using cypher and neo4j for a while now, and I keep running into a similar problem again and again. </p> <p>I would like to be able to add a "temporary" property to a node thats exists only in the returned data and is not persisted to the Neo4j database. </p> <p>For example the current problem I am working on is given an N-ary tree structure in the graph database, I would like to return the children of a specific node, and an informational boolean letting me know weather those children have children. </p> <p>The query to get this information is simple enough:</p> <pre><code>MATCH (parent:Item { guid: "Identifier here" })-[:HASCHILD]-&gt;(child:Item) OPTIONAL MATCH (child)-[:HASCHILD]-&gt;(grandchild:Item) WITH parent, child, LENGTH(COLLECT(grandchild)) &gt; 0 AS has_children </code></pre> <p>Now I have the parent, child and a boolean letting me know weather there are further children. </p> <p>What I would like to be able to do next is set the has_children boolean as a property on the child nodes, but just for returning the query, I don't need the property persisted.</p> <p>I know there is are some solutions to get what I am looking for but none of them are specifically what I am looking for. </p> <p>1) I could create a temporary node: (Continued from above query)</p> <pre><code>... WITH parent, child, LENGTH(COLLECT(grandchild)) &gt; 0 AS haschildren, { childkey1: child.childkey1, childkey2: child.childkey2, ... has_children: haschildren } AS tempnode RETURN parent, tempnode </code></pre> <p>This solution is not great, you have to know the exact node type and all the properties of the node you are dealing with, it will not work in the general case. </p> <p>2) I could SET and REMOVE the boolean, temporarily persisting it to the database (as described in <a href="https://stackoverflow.com/questions/28375229/neo4j-create-temp-variable-within-cypher">Neo4J create temp variable within Cypher</a>).</p> <p>This is not great as it will cause multiple db writes (for add and remove). Also, it is not as dynamic as option 1 as it would only be able to handle simple types. (Option 1 can handle more complex cases, like adding a collection of nodes instead of a simple boolean).</p> <p>As far as I know, these are the only options when it comes to temporary return data. I'm wondering am I missing any thing? Is it possible to make this more simple or dynamic? </p> <p>Something along the lines of </p> <pre><code> WITH parent, child, LENGTH(COLLECT(grandchild)) &gt; 0 AS haschildren, TEMPSET child.has_children = haschildren </code></pre> <p>Please note that I have simplified the examples given a little. I have run into this issue multiple times in different contexts in neo4j. Most times I either go with option 1, or build the correct structure by post-processing on the application side once the query returns. </p> <p>Is there a better way?</p>
0debug
static inline void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta) { int d; for( d = 0; d < 8; d++ ) { const int p0 = pix[-1*xstride]; const int p1 = pix[-2*xstride]; const int q0 = pix[0]; const int q1 = pix[1*xstride]; if( FFABS( p0 - q0 ) < alpha && FFABS( p1 - p0 ) < beta && FFABS( q1 - q0 ) < beta ) { pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } pix += ystride; } }
1threat
jQuery.Deferred exception: $(...).datepicker is not a function : <p>thanks in advance.</p> <p>I have already searched and implemented </p> <pre><code> $(document).ready(function () { $("#ui-datepicker").datepicker(); }); </code></pre> <p>and </p> <pre><code>$(function () { if (!Modernizr.inputtypes.date) { $('input[type=date]').datepicker({ dateFormat: 'dd-mm-yyyy' } ); } }); </code></pre> <p>but unable to resolve the issue. So, Please look at my code below and tel me what is the issue</p> <pre><code>&lt;html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" style=""&gt; &lt;head&gt; &lt;link href="http://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"&gt; &lt;link href="/Content/bootstrap.min.css" rel="stylesheet"&gt; &lt;link href="/Content/font-awesome.min.css" rel="stylesheet"&gt; &lt;link href="/Content/animate.css" rel="stylesheet"&gt; &lt;link href="/Content/style.css" rel="stylesheet"&gt; &lt;script src="/Scripts/modernizr-2.8.3.js"&gt;&lt;/script&gt; &lt;!-- Tweaks for older IEs--&gt; &lt;!--[if lt IE 9]&gt; &lt;script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"&gt;&lt;/script&gt; &lt;script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="section-modal modal fade in" id="new-product-modal" tabindex="-1" role="dialog" aria-hidden="true" style="display: block;overflow-y:scroll;"&gt; &lt;div class="modal-content"&gt; &lt;div class="close-modal" data-dismiss="modal"&gt; &lt;a href="/"&gt; &lt;div class="lr"&gt; &lt;div class="rl"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; &lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div class="section-title text-center"&gt; &lt;h3&gt;Products&lt;/h3&gt; &lt;p&gt;Add a new product into List&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;form returnurl="" action="/Home/Products" enctype="multipart/form-data" method="post"&gt; &lt;input name="__RequestVerificationToken" value="Cni4uRd3UIZMvQsCWzpt3GQRxRmybm2yKX2xsOHkvS2D_f4qezvaBU38Mg6HYOJZwwe7bIYpjvWSgYOzdA2LxN3MBxG8uGvvB4-xN4W1LK41" type="hidden"&gt; &lt;div class="row form-group warning-message-container"&gt; &lt;div class=" danger" style="color:red;background-color:lightpink;border-radius:0.3em;text-align:center;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-md-3"&gt; &lt;div class="form-group text-right"&gt; &lt;label class="form-label" for="ProductName"&gt;Product Name&lt;/label&gt; &lt;span style="color:red;"&gt;*&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;input class="form-control" data-val="true" data-val-required="The ProductName field is required." id="name" name="ProductName" placeholder="Your Product Name *" value="" type="text"&gt; &lt;span class="field-validation-valid" data-valmsg-for="ProductName" data-valmsg-replace="true"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-md-3"&gt; &lt;div class="form-group text-right"&gt; &lt;label class="form-label" for="Stock"&gt;Stock&lt;/label&gt; &lt;span style="color:red;"&gt;*&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;div class="col-sm-6"&gt; &lt;div class="row form-group"&gt; &lt;input class="form-control" data-val="true" data-val-number="The field Stock must be a number." data-val-required="The Stock field is required." id="name" name="Stock" placeholder="Your Stock *" value="0" type="text"&gt; &lt;span class="field-validation-valid" data-valmsg-for="Stock" data-valmsg-replace="true"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-sm-6"&gt; &lt;div class="form-group"&gt; &lt;select class="form-control" data-val="true" data-val-number="The field Stock Unit must be a number." data-val-required="The Stock Unit field is required." id="StockUnit" name="SelectedStockUnit" placeholder="Select Unit *"&gt; &lt;option selected="selected" value="0"&gt;Select a Unit&lt;/option&gt; &lt;option value="1"&gt;Kilogram&lt;/option&gt; &lt;option value="2"&gt;Grams&lt;/option&gt; &lt;option value="3"&gt;Ton&lt;/option&gt; &lt;option value="4"&gt;Liter&lt;/option&gt; &lt;option value="5"&gt;Dozen&lt;/option&gt; &lt;option value="6"&gt;Quintel&lt;/option&gt; &lt;option value="7"&gt;Milli Gram&lt;/option&gt; &lt;option value="8"&gt;Peices&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-md-3"&gt; &lt;div class="form-group text-right"&gt; &lt;label class="form-label" for="StockDate"&gt;Stock available on Date&lt;/label&gt; &lt;span style="color:red;"&gt;*&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;input class="text-box single-line" data-val="true" data-val-date="The field Stock on Date must be a date." data-val-required="The Stock on Date field is required." id="StockDate" name="StockDate" value="01/01/0001" type="date"&gt; &lt;span class="field-validation-valid" data-valmsg-for="StockDate" data-valmsg-replace="true"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-md-3"&gt; &lt;div class="form-group text-right"&gt; &lt;label class="form-label" for="ProductDesc"&gt;Product Description&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-6"&gt; &lt;div class="form-group"&gt; &lt;textarea class="form-control" cols="20" id="ProductDesc" name="ProductDesc" placeholder="Product Description" rows="2" type="text"&gt;&lt;/textarea&gt; &lt;span class="field-validation-valid" data-valmsg-for="ProductDesc" data-valmsg-replace="true"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;div class="col-lg-12 text-center"&gt; &lt;div id="success"&gt;&lt;/div&gt; &lt;button type="submit" class="btn btn-primary" value="Save"&gt;Save&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="/Scripts/jquery-ui-1.12.1.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/jquery-3.1.1.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/jquery.appear.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/bootstrap.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/Custom/DatePickerReady.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/respond.matchmedia.addListener.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/respond.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/Custom/dropdownlist.js"&gt;&lt;/script&gt; &lt;script src="/Scripts/script.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>the date-time picker is not working on Mozilla Firefox.</p>
0debug
Sum of char value in Multi columns : ## Sum of char value in Multi columns ## ---------- - i have multi columns >- columns A1, A2, A3, A4 >- Value .....'H', 'H', 'H', 'H' - **How sum all value as integer**
0debug
$(this) not working boolean in giving always false. Not able to add class : Hello people here is my code below.. <head> <title>Dwarka</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <link href="webjars/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> <script type="text/javascript" src="webjars/bootstrap/3.2.0/js/bootstrap.js"></script> <!--<link rel="stylesheet" type="text/css" href="Dwarka/src/main/resources/css/restaurantstyles.css">--> <link rel="stylesheet" href="resources/css/styles.css"> <script> $(document).ready(function() { $('#somebutton').click(function(event) { var name = $('#userName').val(); $.post('FirstServlet', { userName : 'name' }, function(responseText) { $('#somediv').text(responseText); }); }); }); $(document).ready(function(){ $(this).click(function(){ alert($(this).parent().hasClass('active')); $('#tab').removeClass('active'); $ (this).addClass('active'); }); }); </script> </head> <body> <div class="header"> <a id="tab" href="#default" class="logo">CompanyLogo</a> <div class="header-right"> <a id="tab" class="active" href="#home"><span id="tab">Home</span></a> <a id="tab" href="#contact">Contact</a> <a id="tab" href="#about">About</a> </div> </div> <button id="somebutton">press here</button> <div id="somediv"> </div> </body>
0debug
I would like to return either even or odd as a string but for some reason this code keeps returning undefined. : <pre><code>function EvenOdd(num) { if (num === 0) return 'even'; if (num == 1) return 'odd'; num -= 2; EvenOdd(num); } console.log(EvenOdd(49)); return 0; </code></pre> <p>This returns undefined every time regardless of input. I notice that when I run the debugger that it doesn't exit the function even if I have return statements. </p>
0debug
Cannot convert type : I want to call a simple api and return the struct of JSON returned from server. I am using alamofire to achieve this, however I cant get past this cannot convert type error. this is my function func loginUser(user_name: String, password: String, callBack:(Login) -> Void){ let parameters: Parameters = ["user_name": user_name,"password": password]; let urlString=serverURL+"login.php"; Alamofire.request(urlString, method: .post, parameters: parameters, encoding: URLEncoding.httpBody) .responseJSON { response in if let status = response.response?.statusCode { switch(status) { case 200: guard response.result.isSuccess else { //error handling return } if let login: Login = response.result.value { callBack(login) } else { callBack(Login(user_id: 0, status:0)) } default: print("HTTP Error : \(status)") callBack(Login(user_id: 0, status:0)) } } } } i am getting this error in the line if let login: Login = response.result.value {
0debug
How to separate business logic to classes from windows form in Visual Studio : <p>I'm working within C# and visual studio and have made a Windows Form (<code>MainForm</code>) - it has a good amount of buttons that work through a number of process'.</p> <p>Currently - it actually works fine, I just wanted to 'make it work'. However, all my code lies in the <code>MainForm.cs</code> file and I believe that is bad practice. I've got a lot of methods in there that I feel would be better placed in appropriate classes.</p> <p>I have gathered through reading that <code>buttonClick</code> events should live in the Form class, but then should hand off the rest of the work to classes for which the buttons exist (i.e. if a button says to 'backup pictures', I should have a Pictures class with a 'backup' method).</p> <p>Is there a good way in visual studio to go about doing that?</p> <p>Are there any helpers to take existing methods and put them into their own classes?</p>
0debug
How to implement pie chart and hide watermark : <p>I have used an area high chart where i need to hide the credits that are is shown <code>highcharts.com</code> how do i do it? I want to know is there any property through which I can hide it.</p>
0debug
i want to show the distance in kilometer on activity using google map in android : I am trying to get the distance of the nearby event from my location (from google map) and show it on the activity. But I am not sure which button i need to use to show the distance and what is the java code to show the distance in kilometer on the activity?? Please help me. Please
0debug
Angular2 Material2 <md-spinner> not showing but is working : <p>My assumption is that my css is not correct, but alas I cannot figure this out.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div *ngIf="loading"&gt; &lt;md-progress-circle mode="indeterminate" color="warn"&gt;Loading...&lt;/md-progress-circle&gt; &lt;/div&gt; &lt;md-list&gt; &lt;md-list-item *ngFor="let incident of incidents"&gt; &lt;h3 md-line&gt; {{name}} &lt;/h3&gt; &lt;p md-line&gt; &lt;span&gt;{{date}} &gt; &lt;/span&gt; &lt;span&gt;{{text}}&lt;/span&gt; &lt;/p&gt; &lt;/md-list-item&gt; &lt;/md-list&gt;</code></pre> </div> </div> </p> <p><a href="https://i.stack.imgur.com/NX89R.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/NX89R.gif" alt="enter image description here"></a></p>
0debug
static void virtio_crypto_get_config(VirtIODevice *vdev, uint8_t *config) { VirtIOCrypto *c = VIRTIO_CRYPTO(vdev); struct virtio_crypto_config crypto_cfg; stl_le_p(&crypto_cfg.status, c->status); stl_le_p(&crypto_cfg.max_dataqueues, c->max_queues); stl_le_p(&crypto_cfg.crypto_services, c->conf.crypto_services); stl_le_p(&crypto_cfg.cipher_algo_l, c->conf.cipher_algo_l); stl_le_p(&crypto_cfg.cipher_algo_h, c->conf.cipher_algo_h); stl_le_p(&crypto_cfg.hash_algo, c->conf.hash_algo); stl_le_p(&crypto_cfg.mac_algo_l, c->conf.mac_algo_l); stl_le_p(&crypto_cfg.mac_algo_h, c->conf.mac_algo_h); stl_le_p(&crypto_cfg.aead_algo, c->conf.aead_algo); stl_le_p(&crypto_cfg.max_cipher_key_len, c->conf.max_cipher_key_len); stl_le_p(&crypto_cfg.max_auth_key_len, c->conf.max_auth_key_len); stq_le_p(&crypto_cfg.max_size, c->conf.max_size); memcpy(config, &crypto_cfg, c->config_size); }
1threat
const char *qdict_get_try_str(const QDict *qdict, const char *key) { QObject *obj; obj = qdict_get(qdict, key); if (!obj || qobject_type(obj) != QTYPE_QSTRING) return NULL; return qstring_get_str(qobject_to_qstring(obj)); }
1threat
static void run_block_job(BlockJob *job, Error **errp) { AioContext *aio_context = blk_get_aio_context(job->blk); aio_context_acquire(aio_context); do { aio_poll(aio_context, true); qemu_progress_print(job->len ? ((float)job->offset / job->len * 100.f) : 0.0f, 0); } while (!job->ready); block_job_complete_sync(job, errp); aio_context_release(aio_context); qemu_progress_print(100.f, 0); }
1threat
npm deprecated warnings – do I need to update something? : <p>After doing <code>npm install</code> to fetch a project's dependencies, I regularly get a lot messages like this:</p> <p><code>npm WARN deprecated lodash@1.0.2: lodash@&lt;2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0</code></p> <p>Obviously I don't understand node good enough to conclude what I should do – the project doesn't even include lodash directly.</p> <p>Do I need to update something on my side? Or is it the package maintainers task?</p>
0debug
Why cannot I return values from two functions simultaneously in Java? : I can return either getMonth or getYear from the following code. I have tried giving the value of m and y separately in the calculate date function and that works perfectly !! Any suggestions? I am a beginner, apologies if there is a trivial mistake, though there shouldn't be according to me. import java.util.Scanner; public class Second_Java { public static int getMonth() { int a; Scanner sc = new Scanner(System.in); System.out.println("Enter the input for the required month: "); a = sc.nextInt(); // stored in 'a' locally while (a < 1 && a > 12) { a = -1; System.out.println(a); } sc.close(); return a; } public static int getYear() { int b; Scanner input = new Scanner(System.in); System.out.println("Enter the input for the required year: "); b = input.nextInt(); // stored in 'a' locally while (b < 1) { b = -2; System.out.println(b); } input.close(); return b; } public static void calculateDays(int m, int y) { switch (m) { case 4: case 6: case 9: case 11: m = 30; System.out.println(m); break; case 2: if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) { m = 29; System.out.println(m); } else { m = 28; System.out.println(m); } break; default: { m = 31; System.out.println(m); } } } public static void main(String[] args) { int m = getMonth(); int y = getYear(); calculateDays(m, y); } }
0debug
Simplest way to fade in and out : Okay so I have a website that shows 3 picture and instead of re directing the users to a new page I decided that I want to use the same page. So my question is how can I make it so when users click a button 3 new picture shows up on the screen and the other 3 fades out. Please no jquery I don't know jquery and please put it in JavaScript. Summary: when users click a button the 3 images in their screen fades out and 3 new images fades in. I currently have no code because I don't know how to execute this. Sorry guys I meant to mention that I'm gonna try to make the website as fancy as possible so im gonna be using a image as a button so Ima have some kind of onclick function
0debug
Query regarding Command line Script : Q1- why -h is used? Q2- I have written a script to generated a .CSV file from SQL query. But, when I open it in Notepad, there is a spacing in between data. Although When I manually paste the query results in .csv file then there is no spacing when I open it in Notepad. Please do let me know, what should I do to avoid the issue. Please refer below an example(underscore is for showing Space). Example: Issue- CustomerName,CustomerNumber,Value 1. Adam,_________123456789,_________0 Normal- CustomerName,CustomerNumber,Value 1.Adam,123456789,0
0debug
How to style a Slider on Android with React Native : <p>I'd like to use a <a href="https://facebook.github.io/react-native/docs/slider.html" rel="noreferrer">Slider</a> on Android using React Native.</p> <p>Custom tracking images and thumb are iOS only properties, so what are the available options on Android to style the track and the thumb?</p> <p>More specifically I'm looking for a way to change the color of the thumb, the color of min/max track, and their thickness...</p>
0debug
how to redirect to another page by clicking on a gridview row : <p>i m using a grid view in my page and my requirement is that when i click on a row (anywhere on a row), it should be redirected to another page which will display the details of the row selected.</p> <p>Thanks</p>
0debug
How to pass -parameters javac flag to Java compiler via Gradle? : <p>I have a Gradle-managed multi-project setup that relies on the new Java 8 <code>-parameters</code> compiler flag. I need 2 ways of including the compiler flag:</p> <ul> <li>To test classes only (the main project should compile without parameter names attached).</li> <li>To all compiled sources.</li> </ul> <p>I've tried this:</p> <pre><code> tasks.withType(JavaCompile) { options.compilerArgs &lt;&lt; '-parameters' options.fork = true options.forkOptions.executable = 'javac' } </code></pre> <p>...but it does not seem to be working properly.</p>
0debug
How to change page Background and Font Color by clicking a button? : <p>I'm specifically trying to achieve the front end result of the blue button in the demo here:</p> <p><a href="http://www.codelifter.com/main/javascript/colorbuttons.shtml" rel="nofollow noreferrer">http://www.codelifter.com/main/javascript/colorbuttons.shtml</a></p> <p>How can this be achieved? I've tried the original code and get nothing at all.</p> <p>Thank you for any help that you can provide.</p>
0debug
static void sdhci_initfn(Object *obj) { SDHCIState *s = SDHCI(obj); DriveInfo *di; di = drive_get_next(IF_SD); s->card = sd_init(di ? di->bdrv : NULL, false); if (s->card == NULL) { exit(1); } s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0]; s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0]; sd_set_cb(s->card, s->ro_cb, s->eject_cb); s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s); s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_do_data_transfer, s); }
1threat
uint16_t cpu_inw(pio_addr_t addr) { uint16_t val; val = ioport_read(1, addr); trace_cpu_in(addr, val); LOG_IOPORT("inw : %04"FMT_pioaddr" %04"PRIx16"\n", addr, val); return val; }
1threat
static int do_token_out(USBDevice *s, USBPacket *p) { assert(p->devep == 0); switch(s->setup_state) { case SETUP_STATE_ACK: if (s->setup_buf[0] & USB_DIR_IN) { s->setup_state = SETUP_STATE_IDLE; } else { } return 0; case SETUP_STATE_DATA: if (!(s->setup_buf[0] & USB_DIR_IN)) { int len = s->setup_len - s->setup_index; if (len > p->iov.size) { len = p->iov.size; } usb_packet_copy(p, s->data_buf + s->setup_index, len); s->setup_index += len; if (s->setup_index >= s->setup_len) s->setup_state = SETUP_STATE_ACK; return len; } s->setup_state = SETUP_STATE_IDLE; return USB_RET_STALL; default: return USB_RET_STALL; } }
1threat
VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { VirtIOBlockReq *req = g_new(VirtIOBlockReq, 1); req->dev = s; req->qiov.size = 0; req->in_len = 0; req->next = NULL; req->mr_next = NULL; return req; }
1threat
static void flush_encoders(OutputStream *ost_table, int nb_ostreams) { int i, ret; for (i = 0; i < nb_ostreams; i++) { OutputStream *ost = &ost_table[i]; AVCodecContext *enc = ost->st->codec; AVFormatContext *os = output_files[ost->file_index].ctx; if (!ost->encoding_needed) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE)) continue; for(;;) { AVPacket pkt; int fifo_bytes; av_init_packet(&pkt); pkt.stream_index= ost->index; switch (ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: fifo_bytes = av_fifo_size(ost->fifo); ret = 0; if (fifo_bytes > 0) { int osize = av_get_bytes_per_sample(enc->sample_fmt); int fs_tmp = enc->frame_size; av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { enc->frame_size = fifo_bytes / (osize * enc->channels); } else { int frame_bytes = enc->frame_size*osize*enc->channels; if (allocated_audio_buf_size < frame_bytes) exit_program(1); generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); } ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf); pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den, ost->st->time_base.num, enc->sample_rate); enc->frame_size = fs_tmp; } if (ret <= 0) { ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL); } if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); exit_program(1); } audio_size += ret; pkt.flags |= AV_PKT_FLAG_KEY; break; case AVMEDIA_TYPE_VIDEO: ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } video_size += ret; if(enc->coded_frame && enc->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } break; default: ret=-1; } if (ret <= 0) break; pkt.data = bit_buffer; pkt.size = ret; if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters); } } }
1threat
How to check which version of Keras is installed? : <p>Question is the same as the title says. </p> <p>I prefer not to open Python and I use either MacOS or Ubuntu.</p>
0debug
Unexpected ! in checking multiple variables : <p>I need to check multiple varibles but I'm getting the following error:</p> <p><strong>Parse error: syntax error, unexpected '!' in /Applications/MAMP/htdocs/carematch3/includes/user.php on line 42</strong></p> <p>LINE 42</p> <pre><code>if(!empty($firstname) &amp;&amp; !empty($lastname) &amp;&amp; !empty($email) &amp;&amp; !empty($phone) !empty($gender) &amp;&amp; !empty($dob)) { $phaseOne = true; } </code></pre>
0debug
Why do I have a syntax error in this random area of the code? : <pre><code>zone_map = { 'a1': { ZONENAME = ^'Dungeon', DESCRIPTION = 'desc' EXAMINATION = 'exam' SOLVED = False UP = 'up' DOWN = 'down' LEFT = 'left' RIGHT = 'right' </code></pre> <p>(^ is where the syntax error is) I have had this unknown syntax error for a while now and can't figure out how to solve it. I am working on a RPG and have to run my code, but this problem is in my way. Does anybody have any answers for this?</p>
0debug
How do I get a list of properties from my EJS template? : <p>I'm storing response strings in a database in EJS form and filling out the data in Node. What I want to do is be able to use <em>any</em> property I want, no matter what model it comes from, then in Node, async/await those models once I have the template, based around what properties are required.</p> <p>So if I have a template like:</p> <pre><code>"Hello &lt;%=user.firstName%&gt;." </code></pre> <p>I want to be able to look at that template and extract something like:</p> <pre><code>ejsProperties = ["user", "user.firstName"] </code></pre> <p>Or something like that. </p>
0debug
static void randomize_loopfilter_buffers(int bidx, int lineoff, int str, int bit_depth, int dir, int* E, int* F, int* H, int* I, uint8_t *buf0, uint8_t *buf1) { uint32_t mask = (1 << bit_depth) - 1; int off = dir ? lineoff : lineoff * 16; int istride = dir ? 1 : 16; int jstride = dir ? str : 1; int i, j; for (i = 0; i < 2; i++) { int idx = off + i * istride, p0, q0; setpx(idx, 0, q0 = rnd() & mask); setsx(idx, -1, p0 = q0, E[bidx] >> 2); for (j = 1; j < 8; j++) { setsx(idx, -1 - j, p0, F[bidx]); setsx(idx, j, q0, F[bidx]); } } for (i = 2; i < 4; i++) { int idx = off + i * istride, p0, q0; setpx(idx, 0, q0 = rnd() & mask); setsx(idx, -1, p0 = q0, E[bidx] >> 2); for (j = 1; j < 4; j++) { setsx(idx, -1 - j, p0, F[bidx]); setsx(idx, j, q0, F[bidx]); } for (j = 4; j < 8; j++) { setpx(idx, -1 - j, rnd() & mask); setpx(idx, j, rnd() & mask); } } for (i = 4; i < 6; i++) { int idx = off + i * istride, p2, p1, p0, q0, q1, q2; setpx(idx, 0, q0 = rnd() & mask); setsx(idx, 1, q1 = q0, I[bidx]); setsx(idx, 2, q2 = q1, I[bidx]); setsx(idx, 3, q2, I[bidx]); setsx(idx, -1, p0 = q0, E[bidx] >> 2); setsx(idx, -2, p1 = p0, I[bidx]); setsx(idx, -3, p2 = p1, I[bidx]); setsx(idx, -4, p2, I[bidx]); for (j = 4; j < 8; j++) { setpx(idx, -1 - j, rnd() & mask); setpx(idx, j, rnd() & mask); } } for (i = 6; i < 8; i++) { int idx = off + i * istride; for (j = 0; j < 8; j++) { setpx(idx, -1 - j, rnd() & mask); setpx(idx, j, rnd() & mask); } } }
1threat
PXA2xxState *pxa270_init(MemoryRegion *address_space, unsigned int sdram_size, const char *revision) { PXA2xxState *s; int i; DriveInfo *dinfo; s = (PXA2xxState *) g_malloc0(sizeof(PXA2xxState)); if (revision && strncmp(revision, "pxa27", 5)) { fprintf(stderr, "Machine requires a PXA27x processor.\n"); exit(1); } if (!revision) revision = "pxa270"; s->cpu = cpu_arm_init(revision); if (s->cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0); memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size, &error_abort); vmstate_register_ram_global(&s->sdram); memory_region_add_subregion(address_space, PXA2XX_SDRAM_BASE, &s->sdram); memory_region_init_ram(&s->internal, NULL, "pxa270.internal", 0x40000, &error_abort); vmstate_register_ram_global(&s->internal); memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE, &s->internal); s->pic = pxa2xx_pic_init(0x40d00000, s->cpu); s->dma = pxa27x_dma_init(0x40000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_DMA)); sysbus_create_varargs("pxa27x-timer", 0x40a00000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 0), qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 1), qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 2), qdev_get_gpio_in(s->pic, PXA2XX_PIC_OST_0 + 3), qdev_get_gpio_in(s->pic, PXA27X_PIC_OST_4_11), NULL); s->gpio = pxa2xx_gpio_init(0x40e00000, s->cpu, s->pic, 121); dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, blk_by_legacy_dinfo(dinfo), qdev_get_gpio_in(s->pic, PXA2XX_PIC_MMC), qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_MMCI), qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_MMCI)); for (i = 0; pxa270_serial[i].io_base; i++) { if (serial_hds[i]) { serial_mm_init(address_space, pxa270_serial[i].io_base, 2, qdev_get_gpio_in(s->pic, pxa270_serial[i].irqn), 14857000 / 16, serial_hds[i], DEVICE_NATIVE_ENDIAN); } else { break; } } if (serial_hds[i]) s->fir = pxa2xx_fir_init(address_space, 0x40800000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_ICP), qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_ICP), qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_ICP), serial_hds[i]); s->lcd = pxa2xx_lcdc_init(address_space, 0x44000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_LCD)); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 2] = 0x02000210; s->clkcfg = 0x00000009; memory_region_init_io(&s->cm_iomem, NULL, &pxa2xx_cm_ops, s, "pxa2xx-cm", 0x1000); memory_region_add_subregion(address_space, s->cm_base, &s->cm_iomem); vmstate_register(NULL, 0, &vmstate_pxa2xx_cm, s); pxa2xx_setup_cp14(s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; memory_region_init_io(&s->mm_iomem, NULL, &pxa2xx_mm_ops, s, "pxa2xx-mm", 0x1000); memory_region_add_subregion(address_space, s->mm_base, &s->mm_iomem); vmstate_register(NULL, 0, &vmstate_pxa2xx_mm, s); s->pm_base = 0x40f00000; memory_region_init_io(&s->pm_iomem, NULL, &pxa2xx_pm_ops, s, "pxa2xx-pm", 0x100); memory_region_add_subregion(address_space, s->pm_base, &s->pm_iomem); vmstate_register(NULL, 0, &vmstate_pxa2xx_pm, s); for (i = 0; pxa27x_ssp[i].io_base; i ++); s->ssp = (SSIBus **)g_malloc0(sizeof(SSIBus *) * i); for (i = 0; pxa27x_ssp[i].io_base; i ++) { DeviceState *dev; dev = sysbus_create_simple(TYPE_PXA2XX_SSP, pxa27x_ssp[i].io_base, qdev_get_gpio_in(s->pic, pxa27x_ssp[i].irqn)); s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi"); } if (usb_enabled()) { sysbus_create_simple("sysbus-ohci", 0x4c000000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1)); } s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000); sysbus_create_simple(TYPE_PXA2XX_RTC, 0x40900000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_RTCALARM)); s->i2c[0] = pxa2xx_i2c_init(0x40301600, qdev_get_gpio_in(s->pic, PXA2XX_PIC_I2C), 0xffff); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, qdev_get_gpio_in(s->pic, PXA2XX_PIC_PWRI2C), 0xff); s->i2s = pxa2xx_i2s_init(address_space, 0x40400000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_I2S), qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_I2S), qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_I2S)); s->kp = pxa27x_keypad_init(address_space, 0x41500000, qdev_get_gpio_in(s->pic, PXA2XX_PIC_KEYPAD)); qdev_connect_gpio_out(s->gpio, 1, s->reset); return s; }
1threat
jenkins pipeline: agent vs node? : <p>What is the difference between an <strong>agent</strong> and a <strong>node</strong> in a jenkins pipeline?</p> <p>I've found those definitions:</p> <ul> <li><a href="https://jenkins.io/doc/book/pipeline/" rel="noreferrer">node</a>: Most work a Pipeline performs is done in the context of one or more declared node steps.</li> <li><a href="https://jenkins.io/doc/book/pipeline/syntax/#agent" rel="noreferrer">agent</a>: The agent directive specifies where the entire Pipeline, or a specific stage, will execute in the Jenkins environment depending on where the agent directive is placed.</li> </ul> <p>So both are used for executing pipeline steps. But when to use which one?</p>
0debug
Writing a method to see if String x contains letter "G" : <p>I'm working on an assignment that has us fill in 8 different methods. For the particular method I'm working on, I have to see if the string contains the letter 'G' and return. I came up with something I thought would work but it isn't. Also this is a basic Java class and I'm pretty new so please explain what you did.</p> <pre><code>/** * Where is the location of the letter G (upper or lower case) in * the given string? * @param x String to check * @return 0 based location of first occurrence of G in x, * -1 if G is not present. */ public static int indexOfG( String x ) { char[] array = x.toCharArray(); for(int i = 0; i &lt; array.length; i++){ if(array[i] == 'G'){ return i ; } } } </code></pre>
0debug
Pointer and address in C : <p>My teacher has these question on his lecture powerpoint but no answer. Can someone help. new to c.</p> <pre><code>If a is an int variable, is it always true that *&amp;a == a ? If p is an int* variable, is it always true that p == &amp;*p ? Is it ever meaningful to say **p ? Is it ever meaningful to say &amp;&amp;a ? After assigning a = 2 and p = &amp;a, how much is *p**p ? If furthermore q = &amp;p, how much is **q**p***q ? </code></pre> <p>Finally, how much is a/*p ?</p>
0debug
static void cris_alu(DisasContext *dc, int op, TCGv d, TCGv op_a, TCGv op_b, int size) { TCGv tmp; int writeback; writeback = 1; if (op == CC_OP_BOUND || op == CC_OP_BTST) tmp = tcg_temp_local_new(TCG_TYPE_TL); else tmp = tcg_temp_new(TCG_TYPE_TL); if (op == CC_OP_CMP) { writeback = 0; } else if (size == 4) { tmp = d; writeback = 0; } cris_pre_alu_update_cc(dc, op, op_a, op_b, size); cris_alu_op_exec(dc, op, tmp, op_a, op_b, size); cris_update_result(dc, tmp); if (writeback) { if (size == 1) tcg_gen_andi_tl(d, d, ~0xff); else tcg_gen_andi_tl(d, d, ~0xffff); tcg_gen_or_tl(d, d, tmp); } if (tmp != d) tcg_temp_free(tmp); }
1threat
Print columns of my dataset JAVA : <p>I have a dataframe which looks like this: </p> <pre><code>id1 1 2 3 4 id2 2 6 6 0 id3 3 4 2 2 id4 4 3 3 1 id5 5 6 6 5 id6 6 2 4 6 </code></pre> <p>The first line of the frame is the first data point. the second is another data point, etc...</p> <p>my DataPoint Class is as follows:</p> <pre><code>public class DataPoint { private ArrayList&lt;Integer&gt; values; private String id; } </code></pre> <p>So for id1 the fields will be: id = id1, and values = {1, 2, 3, 4}, etc. What I'm trying to do is print the DataPoints by columns...</p> <p>So for the above input, my output should be:</p> <pre><code>1 2 3 4 5 6 2 6 4 3 6 2 3 6 2 3 6 4 4 0 2 1 5 6 </code></pre> <p>I can't modify the above format of DataPoint because I'm too far ahead in my project and I can't afford to change all of the data structures :/ </p> <p>Is there any way to transpose my results without changing the data structures?</p>
0debug
static int dscm1xxxx_attach(PCMCIACardState *card) { MicroDriveState *md = MICRODRIVE(card); PCMCIACardClass *pcc = PCMCIA_CARD_GET_CLASS(card); md->attr_base = pcc->cis[0x74] | (pcc->cis[0x76] << 8); md->io_base = 0x0; device_reset(DEVICE(md)); md_interrupt_update(md); card->slot->card_string = "DSCM-1xxxx Hitachi Microdrive"; return 0; }
1threat
static void vp8_idct_dc_add_c(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride) { int i, dc = (block[0] + 4) >> 3; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + dc; block[0] = 0; for (i = 0; i < 4; i++) { dst[0] = cm[dst[0]]; dst[1] = cm[dst[1]]; dst[2] = cm[dst[2]]; dst[3] = cm[dst[3]]; dst += stride; } }
1threat
Angular 2 radio button events : <p>What are those events called in Angular 2 when radio button is selected or unselected.</p> <p>Something like </p> <pre><code>&lt;input type="radio" (select)="selected()" (unselect)="unselected()" /&gt; </code></pre> <p>So when I click one radio button in a group, it will fire <code>selected()</code> for the new selection and <code>unselected()</code> for the previous selection.</p>
0debug
static int usb_host_open(USBHostDevice *dev, int bus_num, int addr, const char *port, const char *prod_name, int speed) { int fd = -1, ret; trace_usb_host_open_started(bus_num, addr); if (dev->fd != -1) { goto fail; } fd = usb_host_open_device(bus_num, addr); if (fd < 0) { goto fail; } DPRINTF("husb: opened %s\n", buf); dev->bus_num = bus_num; dev->addr = addr; strcpy(dev->port, port); dev->fd = fd; dev->descr_len = read(fd, dev->descr, sizeof(dev->descr)); if (dev->descr_len <= 0) { perror("husb: reading device data failed"); goto fail; } #ifdef DEBUG { int x; printf("=== begin dumping device descriptor data ===\n"); for (x = 0; x < dev->descr_len; x++) { printf("%02x ", dev->descr[x]); } printf("\n=== end dumping device descriptor data ===\n"); } #endif if (!usb_host_claim_interfaces(dev, 0)) { goto fail; } usb_ep_init(&dev->dev); ret = usb_linux_update_endp_table(dev); if (ret) { goto fail; } if (speed == -1) { struct usbdevfs_connectinfo ci; ret = ioctl(fd, USBDEVFS_CONNECTINFO, &ci); if (ret < 0) { perror("usb_host_device_open: USBDEVFS_CONNECTINFO"); goto fail; } if (ci.slow) { speed = USB_SPEED_LOW; } else { speed = USB_SPEED_HIGH; } } dev->dev.speed = speed; dev->dev.speedmask = (1 << speed); if (dev->dev.speed == USB_SPEED_HIGH && usb_linux_full_speed_compat(dev)) { dev->dev.speedmask |= USB_SPEED_MASK_FULL; } trace_usb_host_open_success(bus_num, addr); if (!prod_name || prod_name[0] == '\0') { snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc), "host:%d.%d", bus_num, addr); } else { pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc), prod_name); } ret = usb_device_attach(&dev->dev); if (ret) { goto fail; } qemu_set_fd_handler(dev->fd, NULL, async_complete, dev); return 0; fail: trace_usb_host_open_failure(bus_num, addr); if (dev->fd != -1) { close(dev->fd); dev->fd = -1; } return -1; }
1threat
static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, unsigned int blockid, AVPacket *pkt, int flags) { MatroskaMuxContext *mkv = s->priv_data; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; uint8_t *data = NULL, *side_data = NULL; int offset = 0, size = pkt->size, side_data_size = 0; int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; uint64_t additional_id = 0; int64_t discard_padding = 0; ebml_master block_group, block_additions, block_more; av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n", avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 && (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) ff_avc_parse_nal_units_buf(pkt->data, &data, &size); else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 && (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL); else if (codec->codec_id == AV_CODEC_ID_WAVPACK) { int ret = mkv_strip_wavpack(pkt->data, &data, &size); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error stripping a WavPack packet.\n"); return; } } else data = pkt->data; if (codec->codec_id == AV_CODEC_ID_PRORES) { size -= 8; offset = 8; } side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_data_size); if (side_data && side_data_size >= 10) { discard_padding = av_rescale_q(AV_RL32(side_data + 4), (AVRational){1, codec->sample_rate}, (AVRational){1, 1000000000}); } side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); if (side_data) { additional_id = AV_RB64(side_data); side_data += 8; side_data_size -= 8; } if ((side_data_size && additional_id == 1) || discard_padding) { block_group = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, 0); blockid = MATROSKA_ID_BLOCK; } put_ebml_id(pb, blockid); put_ebml_num(pb, size + 4, 0); avio_w8(pb, 0x80 | (mkv->is_dash ? mkv->dash_track_number : (pkt->stream_index + 1))); avio_wb16(pb, ts - mkv->cluster_pts); avio_w8(pb, flags); avio_write(pb, data + offset, size); if (data != pkt->data) av_free(data); if (discard_padding) { put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding); } if (side_data_size && additional_id == 1) { block_additions = start_ebml_master(pb, MATROSKA_ID_BLOCKADDITIONS, 0); block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0); put_ebml_uint(pb, MATROSKA_ID_BLOCKADDID, 1); put_ebml_id(pb, MATROSKA_ID_BLOCKADDITIONAL); put_ebml_num(pb, side_data_size, 0); avio_write(pb, side_data, side_data_size); end_ebml_master(pb, block_more); end_ebml_master(pb, block_additions); } if ((side_data_size && additional_id == 1) || discard_padding) { end_ebml_master(pb, block_group); } }
1threat
static void do_cont(int argc, const char **argv) { vm_start(); }
1threat
My PhP file is not picking up the variables from my HTML form : <p>i have created a form with a PHP file, this is for a booking request and the aim is to get the variables sent to an email address. But for some reason the variables.</p> <p>Below is the code for my html arm:</p> <pre><code>&lt;form action="form.php" method="post"&gt; &lt;fieldset&gt; &lt;legend&gt;Book your Journey&lt;/legend&gt; &lt;label for ="name"&gt;Name:&lt;/label&gt; &lt;input type="text" id="name" name="name"&gt; &lt;label for="number"&gt;Phone Number&lt;/label&gt; &lt;input type="number" id="number" name="number"&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;label for="email"&gt;Email:&lt;/label&gt; &lt;input type="email" id="email" name="user_email"&gt; &lt;label for="pickup"&gt;Pick Me Up From&lt;/label&gt; &lt;input type="text" id="pickup" name="pickup"&gt; &lt;label for="date"&gt;Date&lt;/label&gt; &lt;input type="text" id="datepicker" name="date"&gt; &lt;label&gt;Time:&lt;/label&gt; &lt;select&gt; &lt;option&gt;--HR--&lt;/option&gt; &lt;option value="1"&gt;01&lt;/option&gt; &lt;option value="2"&gt;02&lt;/option&gt; &lt;option value="3"&gt;03&lt;/option&gt; &lt;option value="4"&gt;04&lt;/option&gt; &lt;option value="5"&gt;05&lt;/option&gt; &lt;option value="6"&gt;06&lt;/option&gt; &lt;option value="7"&gt;07&lt;/option&gt; &lt;option value="8"&gt;08&lt;/option&gt; &lt;option value="9"&gt;09&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="11"&gt;11&lt;/option&gt; &lt;option value="12"&gt;12&lt;/option&gt; &lt;/select&gt; &lt;label&gt;:&lt;/label&gt; &lt;select&gt; &lt;option&gt;--MIN--&lt;/option&gt; &lt;option value="00"&gt;00&lt;/option&gt; &lt;option value="15"&gt;15&lt;/option&gt; &lt;option value="30"&gt;30&lt;/option&gt; &lt;option value="45"&gt;45&lt;/option&gt; &lt;/select&gt; &lt;select&gt; &lt;option value="am"&gt;am&lt;/option&gt; &lt;option value="pm"&gt;pm&lt;/option&gt; &lt;/select&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;label for="destination"&gt; Destination Postal Code &lt;/label&gt; &lt;input type="text" id="destination" name="destination"&gt; &lt;/fieldset&gt; &lt;button&gt;Submit&lt;/button&gt; &lt;/form&gt; </code></pre> <p>and now my php code for this form is as follows</p> <pre><code>&lt;?php $to = 'test@gmail.com'; $subject = 'Booking'; $name = $_POST['name']; $email = $_POST['email']; $pickup = $_POST['pickup']; $destination = $_POST['destination']; $date = $_POST['date']; $message = &lt;&lt;&lt;Eod Hi, please pick up $name from $pickup and drop to $destination Eod; $header = $email; mail($to, $subject, $message, $header); echo "Message Sent"; ?&gt; </code></pre> <p>Now, when i receive the email i can see only $destination gets picked up. Have i done something wrong in my html, it looks fine to me. Also, how do i get my select elements as a variable.</p>
0debug
Terraform - assume_role_policy - similar but slightly different than standard IAM policy : <p>This page <a href="https://www.terraform.io/docs/providers/aws/r/iam_role.html" rel="noreferrer">https://www.terraform.io/docs/providers/aws/r/iam_role.html</a> mentions:</p> <blockquote> <p>NOTE: This assume_role_policy is very similar but slightly different than just a standard IAM policy and cannot use an aws_iam_policy resource. It can however, use an aws_iam_policy_document data source, see example below for how this could work.</p> </blockquote> <p>Is there any reason why the <code>assume_role_policy</code> is different from the <code>standard IAM policy</code>?</p> <p>Any why?</p>
0debug
Filtering specific values on json array and create another array : <p>How can i create another array by filtering one json array and include just the values pairs of a specific key?</p> <p>Example (Filtering Value Pairs of Number Keys):</p> <p>Array:</p> <pre><code>{ Name: 'abcd', Number: '1234' }, { Name: 'efgh', Number: '5678' } ]```` Result Array: ````var filteredarray = ['1234','5678'];```` Thanks! </code></pre>
0debug
Trying to pull files from my Github repository: "refusing to merge unrelated histories" : <p>I'm learning git, and I'm following the Git community book. </p> <p>Previously (long time ago) I made a public repository on Github, with some files. Now I set up a local Git repository on my current computer, and committed some files. Then I added a remote pointing to my Github page:</p> <pre><code>[root@osboxes c]# git remote add learnc https://github.com/michaelklachko/Learning-C </code></pre> <p>That seemed to be successful: </p> <pre><code>[root@osboxes c]# git remote show learnc * remote learnc Fetch URL: https://github.com/michaelklachko/Learning-C Push URL: https://github.com/michaelklachko/Learning-C HEAD branch: master Remote branch: master tracked Local ref configured for 'git push': master pushes to master (local out of date) </code></pre> <p>Now I want to download the files from my Github repo to my computer. I did this:</p> <pre><code>[root@osboxes c]# git fetch learnc [root@osboxes c]# git merge learnc/master warning: refname 'learnc/master' is ambiguous. Already up-to-date. </code></pre> <p>However, I don't see any new files in my local directory. How can I get them? </p> <p>I also tried to do this:</p> <pre><code>[root@osboxes c]# git pull learnc master From https://github.com/michaelklachko/Learning-C * branch master -&gt; FETCH_HEAD fatal: refusing to merge unrelated histories </code></pre> <p>BTW, locally I'm on master branch (there are no other branches):</p> <pre><code>[root@osboxes c]# git status On branch master nothing to commit, working directory clean </code></pre>
0debug
How to use VBA to write a macros that will format all the cells in the workbook? : I have recently started to use VBA Excel for financial modeling purposes and already found that it can optimize my work process. Right now I try to develop a macro that will help me to automatically format all the cells in the workbook, and I have no idea how to write such macro. What I want to do is the following - I have 3 types of numbers: 1. Hard Numbers 2. Numbers that are internal links - they are values from other sheets of the workbook. 3. Numbers that are external links - they are values from other workbooks. Is it possible to write a macro that will format cells depending on type of number (mentioned-above)? Thanks
0debug
static int decode_residual(const H264Context *h, H264SliceContext *sl, GetBitContext *gb, int16_t *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff) { static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; int level[16]; int zeros_left, coeff_token, total_coeff, i, trailing_ones, run_before; if(max_coeff <= 8){ if (max_coeff == 4) coeff_token = get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1); else coeff_token = get_vlc2(gb, chroma422_dc_coeff_token_vlc.table, CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 1); total_coeff= coeff_token>>2; }else{ if(n >= LUMA_DC_BLOCK_INDEX){ total_coeff= pred_non_zero_count(h, sl, (n - LUMA_DC_BLOCK_INDEX)*16); coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2); total_coeff= coeff_token>>2; }else{ total_coeff= pred_non_zero_count(h, sl, n); coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2); total_coeff= coeff_token>>2; } } sl->non_zero_count_cache[scan8[n]] = total_coeff; if(total_coeff==0) return 0; if(total_coeff > (unsigned)max_coeff) { av_log(h->avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", sl->mb_x, sl->mb_y, total_coeff); return -1; } trailing_ones= coeff_token&3; ff_tlog(h->avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff); assert(total_coeff<=16); i = show_bits(gb, 3); skip_bits(gb, trailing_ones); level[0] = 1-((i&4)>>1); level[1] = 1-((i&2) ); level[2] = 1-((i&1)<<1); if(trailing_ones<total_coeff) { int mask, prefix; int suffix_length = total_coeff > 10 & trailing_ones < 3; int bitsi= show_bits(gb, LEVEL_TAB_BITS); int level_code= cavlc_level_tab[suffix_length][bitsi][0]; skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]); if(level_code >= 100){ prefix= level_code - 100; if(prefix == LEVEL_TAB_BITS) prefix += get_level_prefix(gb); if(prefix<14){ if(suffix_length) level_code= (prefix<<1) + get_bits1(gb); else level_code= prefix; }else if(prefix==14){ if(suffix_length) level_code= (prefix<<1) + get_bits1(gb); else level_code= prefix + get_bits(gb, 4); }else{ level_code= 30 + get_bits(gb, prefix-3); if(prefix>=16){ if(prefix > 25+3){ av_log(h->avctx, AV_LOG_ERROR, "Invalid level prefix\n"); return -1; } level_code += (1<<(prefix-3))-4096; } } if(trailing_ones < 3) level_code += 2; suffix_length = 2; mask= -(level_code&1); level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask; }else{ level_code += ((level_code>>31)|1) & -(trailing_ones < 3); suffix_length = 1 + (level_code + 3U > 6U); level[trailing_ones]= level_code; } for(i=trailing_ones+1;i<total_coeff;i++) { static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX }; int bitsi= show_bits(gb, LEVEL_TAB_BITS); level_code= cavlc_level_tab[suffix_length][bitsi][0]; skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]); if(level_code >= 100){ prefix= level_code - 100; if(prefix == LEVEL_TAB_BITS){ prefix += get_level_prefix(gb); } if(prefix<15){ level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length); }else{ level_code = (15<<suffix_length) + get_bits(gb, prefix-3); if(prefix>=16) level_code += (1<<(prefix-3))-4096; } mask= -(level_code&1); level_code= (((2+level_code)>>1) ^ mask) - mask; } level[i]= level_code; suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length]; } } if(total_coeff == max_coeff) zeros_left=0; else{ if (max_coeff <= 8) { if (max_coeff == 4) zeros_left = get_vlc2(gb, chroma_dc_total_zeros_vlc[total_coeff - 1].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1); else zeros_left = get_vlc2(gb, chroma422_dc_total_zeros_vlc[total_coeff - 1].table, CHROMA422_DC_TOTAL_ZEROS_VLC_BITS, 1); } else { zeros_left= get_vlc2(gb, total_zeros_vlc[total_coeff - 1].table, TOTAL_ZEROS_VLC_BITS, 1); } } #define STORE_BLOCK(type) \ scantable += zeros_left + total_coeff - 1; \ if(n >= LUMA_DC_BLOCK_INDEX){ \ ((type*)block)[*scantable] = level[0]; \ for(i=1;i<total_coeff && zeros_left > 0;i++) { \ if(zeros_left < 7) \ run_before= get_vlc2(gb, run_vlc[zeros_left - 1].table, RUN_VLC_BITS, 1); \ else \ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \ zeros_left -= run_before; \ scantable -= 1 + run_before; \ ((type*)block)[*scantable]= level[i]; \ } \ for(;i<total_coeff;i++) { \ scantable--; \ ((type*)block)[*scantable]= level[i]; \ } \ }else{ \ ((type*)block)[*scantable] = ((int)(level[0] * qmul[*scantable] + 32))>>6; \ for(i=1;i<total_coeff && zeros_left > 0;i++) { \ if(zeros_left < 7) \ run_before= get_vlc2(gb, run_vlc[zeros_left - 1].table, RUN_VLC_BITS, 1); \ else \ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \ zeros_left -= run_before; \ scantable -= 1 + run_before; \ ((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \ } \ for(;i<total_coeff;i++) { \ scantable--; \ ((type*)block)[*scantable]= ((int)(level[i] * qmul[*scantable] + 32))>>6; \ } \ } if (zeros_left < 0) { av_log(h->avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", sl->mb_x, sl->mb_y); return AVERROR_INVALIDDATA; } if (h->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } return 0; }
1threat
What is the best javascript "time ago" package where I can control formatting? : <p>I want to use a time ago plugin like timeago or livestamp.js but I want to control the formatting to something like this:</p> <p>1s ago<br> 5s ago<br> 1m25s ago<br> 1h3m ago<br></p> <p>Is there a way to do that with either of the above mentioned plugins or is there a better time ago plugin you recommend?</p>
0debug
sPAPROptionVector *spapr_ovec_new(void) { sPAPROptionVector *ov; ov = g_new0(sPAPROptionVector, 1); ov->bitmap = bitmap_new(OV_MAXBITS); return ov; }
1threat
find the largest substring that contains all of occurrence of a character : <p>I need to find out largest sub string that contains all of occurrence of a character in C#.</p> <p>Example - Input string : "my name is granar" Nee to find out largest sub string that contains all of occurrence of a character "a", the result is "<strong>ame is grana</strong>"</p> <p>Please help me in algorithm?</p>
0debug
static void uhci_frame_timer(void *opaque) { UHCIState *s = opaque; s->expire_time += (get_ticks_per_sec() / FRAME_TIMER_FREQ); s->frame_bytes = 0; s->completions_only = false; qemu_bh_cancel(s->bh); if (!(s->cmd & UHCI_CMD_RS)) { trace_usb_uhci_schedule_stop(); qemu_del_timer(s->frame_timer); uhci_async_cancel_all(s); s->status |= UHCI_STS_HCHALTED; return; } trace_usb_uhci_frame_start(s->frnum); uhci_async_validate_begin(s); uhci_process_frame(s); uhci_async_validate_end(s); s->frnum = (s->frnum + 1) & 0x7ff; if (s->pending_int_mask) { s->status2 |= s->pending_int_mask; s->status |= UHCI_STS_USBINT; uhci_update_irq(s); } s->pending_int_mask = 0; qemu_mod_timer(s->frame_timer, s->expire_time); }
1threat
static int decode_profile_tier_level(HEVCLocalContext *lc, PTL *ptl, int max_num_sub_layers) { int i, j; GetBitContext *gb = &lc->gb; ptl->general_profile_space = get_bits(gb, 2); ptl->general_tier_flag = get_bits1(gb); ptl->general_profile_idc = get_bits(gb, 5); for (i = 0; i < 32; i++) ptl->general_profile_compatibility_flag[i] = get_bits1(gb); skip_bits1(gb); skip_bits1(gb); skip_bits1(gb); skip_bits1(gb); if (get_bits(gb, 16) != 0) return -1; if (get_bits(gb, 16) != 0) return -1; if (get_bits(gb, 12) != 0) return -1; ptl->general_level_idc = get_bits(gb, 8); for (i = 0; i < max_num_sub_layers - 1; i++) { ptl->sub_layer_profile_present_flag[i] = get_bits1(gb); ptl->sub_layer_level_present_flag[i] = get_bits1(gb); } if (max_num_sub_layers - 1 > 0) for (i = max_num_sub_layers - 1; i < 8; i++) skip_bits(gb, 2); for (i = 0; i < max_num_sub_layers - 1; i++) { if (ptl->sub_layer_profile_present_flag[i]) { ptl->sub_layer_profile_space[i] = get_bits(gb, 2); ptl->sub_layer_tier_flag[i] = get_bits(gb, 1); ptl->sub_layer_profile_idc[i] = get_bits(gb, 5); for (j = 0; j < 32; j++) ptl->sub_layer_profile_compatibility_flags[i][j] = get_bits1(gb); skip_bits1(gb); skip_bits1(gb); skip_bits1(gb); skip_bits1(gb); if (get_bits(gb, 16) != 0) return -1; if (get_bits(gb, 16) != 0) return -1; if (get_bits(gb, 12) != 0) return -1; } if (ptl->sub_layer_level_present_flag[i]) ptl->sub_layer_level_idc[i] = get_bits(gb, 8); } return 0; }
1threat
static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW) { #ifdef HAVE_MMX if(uDest != NULL) { asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW), "g" ((long)-chrDstW) : "%"REG_a ); asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW), "g" ((long)-chrDstW) : "%"REG_a ); } asm volatile( YSCALEYUV2YV121 :: "r" (lumSrc + dstW), "r" (dest + dstW), "g" ((long)-dstW) : "%"REG_a ); #else int i; for(i=0; i<dstW; i++) { int val= lumSrc[i]>>7; if(val&256){ if(val<0) val=0; else val=255; } dest[i]= val; } if(uDest != NULL) for(i=0; i<chrDstW; i++) { int u=chrSrc[i]>>7; int v=chrSrc[i + 2048]>>7; if((u|v)&256){ if(u<0) u=0; else if (u>255) u=255; if(v<0) v=0; else if (v>255) v=255; } uDest[i]= u; vDest[i]= v; } #endif }
1threat
static void prop_get_fdt(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); Error *err = NULL; int fdt_offset_next, fdt_offset, fdt_depth; void *fdt; if (!drc->fdt) { visit_start_struct(v, name, NULL, 0, &err); if (!err) { visit_end_struct(v, &err); } error_propagate(errp, err); return; } fdt = drc->fdt; fdt_offset = drc->fdt_start_offset; fdt_depth = 0; do { const char *name = NULL; const struct fdt_property *prop = NULL; int prop_len = 0, name_len = 0; uint32_t tag; tag = fdt_next_tag(fdt, fdt_offset, &fdt_offset_next); switch (tag) { case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); visit_start_struct(v, name, NULL, 0, &err); if (err) { error_propagate(errp, err); return; } break; case FDT_END_NODE: g_assert(fdt_depth > 0); visit_end_struct(v, &err); if (err) { error_propagate(errp, err); return; } fdt_depth--; break; case FDT_PROP: { int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); visit_start_list(v, name, &err); if (err) { error_propagate(errp, err); return; } for (i = 0; i < prop_len; i++) { visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], &err); if (err) { error_propagate(errp, err); return; } } visit_end_list(v); break; } default: error_setg(&error_abort, "device FDT in unexpected state: %d", tag); } fdt_offset = fdt_offset_next; } while (fdt_depth != 0); }
1threat
void vm_start(void) { RunState requested; qemu_vmstop_requested(&requested); if (runstate_is_running() && requested == RUN_STATE__MAX) { return; } if (runstate_is_running()) { qapi_event_send_stop(&error_abort); } else { cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); } qapi_event_send_resume(&error_abort); }
1threat
def count_no_of_ways(n, k): dp = [0] * (n + 1) total = k mod = 1000000007 dp[1] = k dp[2] = k * k for i in range(3,n+1): dp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod return dp[n]
0debug
static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
1threat
How to decode JSON in Flutter? : <p>How to decode JSON in Flutter?</p> <p>The question is simple, but the answer isn't, at least for me.</p> <p>I have a project that uses a lot of JSON Strings. Basically, the entire communication between the app and the server is through JSON.</p> <p>I have been using <code>JSON.decode(json_string)</code> to deal with it, but today I updated the Flutter core (0.5.8-pre.178) and JSON.decode isn't available anymore.</p> <p>I went to the <a href="https://flutter.io/json/" rel="noreferrer">Flutter Docs</a> to seek help, but it still says to use JSON.decode.</p> <p>So, how to decode JSON in Flutter from now on?</p>
0debug
Issue with higher order function as a binding adapter : <p>I am running into issues trying to take a function as a parameter in a binding adapter using Kotlin/Android databinding. This example code throws <code>e: error: cannot generate view binders java.lang.StackOverflowError</code> when building with no other useful info in the log. </p> <p>Here is my binding adapter:</p> <pre><code>@JvmStatic @BindingAdapter("onDelayedClick") fun onDelayedClick(view: View, function: () -&gt; Unit) { // TODO: Do something } </code></pre> <p>XML:</p> <pre><code> &lt;View android:id="@+id/test_view" android:layout_width="wrap_content" android:layout_height="wrap_content" app:onDelayedClick="@{() -&gt; viewModel.testFunction()}"/&gt; </code></pre> <p>and method in my ViewModel: </p> <pre><code>fun testFunction() = Unit </code></pre> <p>I have been struggling with this for a bit now and nothing I've tried works, so any help is appreciated.</p>
0debug
How to make the encoded value in format : YTo2OntpOjA7czo0OiIyMDY3IjtpOjE7czo0OiIyMDY4IjtpOjI7czo0OiIyMDY5IjtpOjM7czo0OiIyMDcwIjtpOjQ7czo0OiIyMDcxIjtpOjU7czo0OiIyMDcyIjt9 Above mention is my encoded value. When iam trying to decode it iam getting the output in this format a:6:{i:0;s:4:"2067";i:1;s:4:"2068";i:2;s:4:"2069";i:3;s:4:"2070";i:4;s:4:"2071";i:5;s:4:"2072";} Now how to convert into ["2067","2068","2069","2070","2071","2072"] OR (2067,2068,2069,2070,2071,2072)
0debug
Adding first character of a string to each of the other characters : <p>I have a string <code>alphabet = "abcdefghijklmnopqrstuvwxyz"</code> I need output like this <code> aa ab ac ad ae af ... ay az </code> how would I add the first character to every one of the other characters and print it? Thanks!</p>
0debug
How to prevent node-gyp from downloading node-headers.tar.gz and node.lib from internet? : <p>node-gyp downloads following files from the Internet during installation and building of the native modules like iconv, ref, ffi, etc:<br> <a href="https://nodejs.org/download/release/v6.10.0/node-v6.10.0-headers.tar.gz" rel="noreferrer">https://nodejs.org/download/release/v6.10.0/node-v6.10.0-headers.tar.gz</a><br> <a href="https://nodejs.org/download/release/v6.10.0/win-x86/node.lib" rel="noreferrer">https://nodejs.org/download/release/v6.10.0/win-x86/node.lib</a><br> <a href="https://nodejs.org/download/release/v6.10.0/win-x64/node.lib" rel="noreferrer">https://nodejs.org/download/release/v6.10.0/win-x64/node.lib</a><br> <a href="https://nodejs.org/download/release/v6.10.0/SHASUMS256.txt" rel="noreferrer">https://nodejs.org/download/release/v6.10.0/SHASUMS256.txt</a> </p> <p>How to make node-gyp to use these files from local folders, not from the Internet? </p> <p>I've found the following solution:<br> 1. Download <a href="https://nodejs.org/download/release/v6.10.0/node-v6.10.0-headers.tar.gz" rel="noreferrer">https://nodejs.org/download/release/v6.10.0/node-v6.10.0-headers.tar.gz</a><br> 2. Unpack it to some local folder.<br> 3. Create folder Release in this local folder.<br> 4. Download file <a href="https://nodejs.org/dist/v6.10.0/win-x64/node.lib" rel="noreferrer">https://nodejs.org/dist/v6.10.0/win-x64/node.lib</a> into the folder Release.<br> 5. Set property nodedir in .npmrc which will point to the folder with unpacked headers:<br> nodedir=D:\tools\node_src\node-v6.10.0-headers </p> <p>Now npm installs packages and node-gyp builds native packages without downloading node headers and libs from the Internet.<br> Is it a correct approach? </p> <p>I cannot find in the documentation that I should download node.lib and put it to the Release directory.<br> I decided to do it after analyzing the traces of node-gyp and code of node-gyp.<br> Is it possible to setup the location of node.lib using some npm_config_xxx property? </p>
0debug
def check_min_heap(arr, i): if 2 * i + 2 > len(arr): return True left_child = (arr[i] <= arr[2 * i + 1]) and check_min_heap(arr, 2 * i + 1) right_child = (2 * i + 2 == len(arr)) or (arr[i] <= arr[2 * i + 2] and check_min_heap(arr, 2 * i + 2)) return left_child and right_child
0debug
from collections import Counter def assign_freq(test_list): res = [(*key, val) for key, val in Counter(test_list).items()] return (str(res))
0debug
int qcow2_discard_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors, enum qcow2_discard_type type, bool full_discard) { BDRVQcow2State *s = bs->opaque; uint64_t end_offset; uint64_t nb_clusters; int ret; end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS); offset = align_offset(offset, s->cluster_size); end_offset = start_of_cluster(s, end_offset); if (offset > end_offset) { return 0; } nb_clusters = size_to_clusters(s, end_offset - offset); s->cache_discards = true; while (nb_clusters > 0) { ret = discard_single_l2(bs, offset, nb_clusters, type, full_discard); if (ret < 0) { goto fail; } nb_clusters -= ret; offset += (ret * s->cluster_size); } ret = 0; fail: s->cache_discards = false; qcow2_process_discards(bs, ret); return ret; }
1threat
static int dca_exss_parse_asset_header(DCAContext *s) { int header_pos = get_bits_count(&s->gb); int header_size; int channels; int embedded_stereo = 0; int embedded_6ch = 0; int drc_code_present; int extensions_mask; int i, j; if (get_bits_left(&s->gb) < 16) return -1; header_size = get_bits(&s->gb, 9) + 1; skip_bits(&s->gb, 3); if (s->static_fields) { if (get_bits1(&s->gb)) skip_bits(&s->gb, 4); if (get_bits1(&s->gb)) skip_bits_long(&s->gb, 24); if (get_bits1(&s->gb)) { int text_length = get_bits(&s->gb, 10) + 1; if (get_bits_left(&s->gb) < text_length * 8) return -1; skip_bits_long(&s->gb, text_length * 8); } skip_bits(&s->gb, 5); skip_bits(&s->gb, 4); channels = get_bits(&s->gb, 8) + 1; if (get_bits1(&s->gb)) { int spkr_remap_sets; int spkr_mask_size = 16; int num_spkrs[7]; if (channels > 2) embedded_stereo = get_bits1(&s->gb); if (channels > 6) embedded_6ch = get_bits1(&s->gb); if (get_bits1(&s->gb)) { spkr_mask_size = (get_bits(&s->gb, 2) + 1) << 2; skip_bits(&s->gb, spkr_mask_size); } spkr_remap_sets = get_bits(&s->gb, 3); for (i = 0; i < spkr_remap_sets; i++) { num_spkrs[i] = dca_exss_mask2count(get_bits(&s->gb, spkr_mask_size)); } for (i = 0; i < spkr_remap_sets; i++) { int num_dec_ch_remaps = get_bits(&s->gb, 5) + 1; if (get_bits_left(&s->gb) < 0) return -1; for (j = 0; j < num_spkrs[i]; j++) { int remap_dec_ch_mask = get_bits_long(&s->gb, num_dec_ch_remaps); int num_dec_ch = av_popcount(remap_dec_ch_mask); skip_bits_long(&s->gb, num_dec_ch * 5); } } } else { skip_bits(&s->gb, 3); } } drc_code_present = get_bits1(&s->gb); if (drc_code_present) get_bits(&s->gb, 8); if (get_bits1(&s->gb)) skip_bits(&s->gb, 5); if (drc_code_present && embedded_stereo) get_bits(&s->gb, 8); if (s->mix_metadata && get_bits1(&s->gb)) { skip_bits(&s->gb, 1); skip_bits(&s->gb, 6); if (get_bits(&s->gb, 2) != 3) skip_bits(&s->gb, 3); else skip_bits(&s->gb, 8); if (get_bits1(&s->gb)) for (i = 0; i < s->num_mix_configs; i++) skip_bits_long(&s->gb, s->mix_config_num_ch[i] * 6); else skip_bits_long(&s->gb, s->num_mix_configs * 6); for (i = 0; i < s->num_mix_configs; i++) { if (get_bits_left(&s->gb) < 0) return -1; dca_exss_skip_mix_coeffs(&s->gb, channels, s->mix_config_num_ch[i]); if (embedded_6ch) dca_exss_skip_mix_coeffs(&s->gb, 6, s->mix_config_num_ch[i]); if (embedded_stereo) dca_exss_skip_mix_coeffs(&s->gb, 2, s->mix_config_num_ch[i]); } } switch (get_bits(&s->gb, 2)) { case 0: extensions_mask = get_bits(&s->gb, 12); break; case 1: extensions_mask = DCA_EXT_EXSS_XLL; break; case 2: extensions_mask = DCA_EXT_EXSS_LBR; break; case 3: extensions_mask = 0; break; } if (get_bits_left(&s->gb) < 0) return -1; if (get_bits_count(&s->gb) - header_pos > header_size * 8) { av_log(s->avctx, AV_LOG_WARNING, "Asset header size mismatch.\n"); return -1; } skip_bits_long(&s->gb, header_pos + header_size * 8 - get_bits_count(&s->gb)); if (extensions_mask & DCA_EXT_EXSS_XLL) s->profile = FF_PROFILE_DTS_HD_MA; else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 | DCA_EXT_EXSS_XXCH)) s->profile = FF_PROFILE_DTS_HD_HRA; if (!(extensions_mask & DCA_EXT_CORE)) av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask) av_log(s->avctx, AV_LOG_WARNING, "DTS extensions detection mismatch (%d, %d)\n", extensions_mask & DCA_CORE_EXTS, s->core_ext_mask); return 0; }
1threat
ordering array of numbers returns invalid result : <p>For some reason, sort doesnt sort correctly. Why is that?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log( [0,0,0,0,1,0,0,0,3,0,0,0,0,0,1,1,0,2,1,1,0,0,0,0,0,0].sort((a,b)=&gt;a&lt;b) )</code></pre> </div> </div> </p> <p>But the inverse works....</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log( [0,0,0,0,1,0,0,0,3,0,0,0,0,0,1,1,0,2,1,1,0,0,0,0,0,0].sort((a,b)=&gt;a&gt;b) )</code></pre> </div> </div> </p>
0debug
Getting error in Android Studio 2.1 with java 8 : <p>Currently I am using <code>java 8</code> with latest <code>android studio 2.1</code></p> <p>Here is my <code>build.gradle</code> file </p> <pre><code>android { compileSdkVersion 22 buildToolsVersion "24rc3" defaultConfig { applicationId "com.name" minSdkVersion 10 targetSdkVersion 19 jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ....... } </code></pre> <p>I am getting the below compile time error that I have no clue</p> <blockquote> <p>Error:com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:892) at com.android.jack.Jack.run(Jack.java:472) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 8 more Warning:Exception while processing task java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile :oTT:compileDebugJavaWithJack FAILED Error:Execution failed for task ':oTT:compileDebugJavaWithJack'.</p> <blockquote> <p>java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile Information:BUILD FAILED</p> </blockquote> </blockquote> <p>Please feel to ask if you need some details.</p>
0debug
static void avc_loopfilter_luma_inter_edge_ver_msa(uint8_t *data, uint8_t bs0, uint8_t bs1, uint8_t bs2, uint8_t bs3, uint8_t tc0, uint8_t tc1, uint8_t tc2, uint8_t tc3, uint8_t alpha_in, uint8_t beta_in, uint32_t img_width) { uint8_t *src; v16u8 beta, tmp_vec, bs = { 0 }; v16u8 tc = { 0 }; v16u8 is_less_than, is_less_than_beta; v16u8 p1, p0, q0, q1; v8i16 p0_r, q0_r, p1_r = { 0 }; v8i16 q1_r = { 0 }; v8i16 p0_l, q0_l, p1_l = { 0 }; v8i16 q1_l = { 0 }; v16u8 p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org; v8i16 p2_org_r, p1_org_r, p0_org_r, q0_org_r, q1_org_r, q2_org_r; v8i16 p2_org_l, p1_org_l, p0_org_l, q0_org_l, q1_org_l, q2_org_l; v8i16 tc_r, tc_l; v16i8 zero = { 0 }; v16u8 is_bs_greater_than0; tmp_vec = (v16u8) __msa_fill_b(bs0); bs = (v16u8) __msa_insve_w((v4i32) bs, 0, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs1); bs = (v16u8) __msa_insve_w((v4i32) bs, 1, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs2); bs = (v16u8) __msa_insve_w((v4i32) bs, 2, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(bs3); bs = (v16u8) __msa_insve_w((v4i32) bs, 3, (v4i32) tmp_vec); if (!__msa_test_bz_v(bs)) { tmp_vec = (v16u8) __msa_fill_b(tc0); tc = (v16u8) __msa_insve_w((v4i32) tc, 0, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc1); tc = (v16u8) __msa_insve_w((v4i32) tc, 1, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc2); tc = (v16u8) __msa_insve_w((v4i32) tc, 2, (v4i32) tmp_vec); tmp_vec = (v16u8) __msa_fill_b(tc3); tc = (v16u8) __msa_insve_w((v4i32) tc, 3, (v4i32) tmp_vec); is_bs_greater_than0 = (zero < bs); { v16u8 row0, row1, row2, row3, row4, row5, row6, row7; v16u8 row8, row9, row10, row11, row12, row13, row14, row15; src = data; src -= 4; LOAD_8VECS_UB(src, img_width, row0, row1, row2, row3, row4, row5, row6, row7); src += (8 * img_width); LOAD_8VECS_UB(src, img_width, row8, row9, row10, row11, row12, row13, row14, row15); TRANSPOSE16x8_B_UB(row0, row1, row2, row3, row4, row5, row6, row7, row8, row9, row10, row11, row12, row13, row14, row15, p3_org, p2_org, p1_org, p0_org, q0_org, q1_org, q2_org, q3_org); } { v16u8 p0_asub_q0, p1_asub_p0, q1_asub_q0, alpha; v16u8 is_less_than_alpha; p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); alpha = (v16u8) __msa_fill_b(alpha_in); beta = (v16u8) __msa_fill_b(beta_in); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; is_less_than = is_less_than & is_bs_greater_than0; } if (!__msa_test_bz_v(is_less_than)) { v16i8 negate_tc, sign_negate_tc; v8i16 negate_tc_r, i16_negatetc_l; negate_tc = zero - (v16i8) tc; sign_negate_tc = __msa_clti_s_b(negate_tc, 0); negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc); i16_negatetc_l = (v8i16) __msa_ilvl_b(sign_negate_tc, negate_tc); tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc); tc_l = (v8i16) __msa_ilvl_b(zero, (v16i8) tc); p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); p1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p1_org); p0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p0_org); q0_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q0_org); { v16u8 p2_asub_p0; v16u8 is_less_than_beta_r, is_less_than_beta_l; p2_asub_p0 = __msa_asub_u_b(p2_org, p0_org); is_less_than_beta = (p2_asub_p0 < beta); is_less_than_beta = is_less_than_beta & is_less_than; is_less_than_beta_r = (v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v(is_less_than_beta_r)) { p2_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_r, q0_org_r, p1_org_r, p2_org_r, negate_tc_r, tc_r, p1_r); } is_less_than_beta_l = (v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v(is_less_than_beta_l)) { p2_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) p2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_l, q0_org_l, p1_org_l, p2_org_l, i16_negatetc_l, tc_l, p1_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { p1 = (v16u8) __msa_pckev_b((v16i8) p1_l, (v16i8) p1_r); p1_org = __msa_bmnz_v(p1_org, p1, is_less_than_beta); is_less_than_beta = __msa_andi_b(is_less_than_beta, 1); tc = tc + is_less_than_beta; } { v16u8 u8_q2asub_q0; v16u8 is_less_than_beta_l, is_less_than_beta_r; u8_q2asub_q0 = __msa_asub_u_b(q2_org, q0_org); is_less_than_beta = (u8_q2asub_q0 < beta); is_less_than_beta = is_less_than_beta & is_less_than; q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); is_less_than_beta_r = (v16u8) __msa_sldi_b((v16i8) is_less_than_beta, zero, 8); if (!__msa_test_bz_v(is_less_than_beta_r)) { q2_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_r, q0_org_r, q1_org_r, q2_org_r, negate_tc_r, tc_r, q1_r); } q1_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q1_org); is_less_than_beta_l = (v16u8) __msa_sldi_b(zero, (v16i8) is_less_than_beta, 8); if (!__msa_test_bz_v(is_less_than_beta_l)) { q2_org_l = (v8i16) __msa_ilvl_b(zero, (v16i8) q2_org); AVC_LOOP_FILTER_P1_OR_Q1(p0_org_l, q0_org_l, q1_org_l, q2_org_l, i16_negatetc_l, tc_l, q1_l); } } if (!__msa_test_bz_v(is_less_than_beta)) { q1 = (v16u8) __msa_pckev_b((v16i8) q1_l, (v16i8) q1_r); q1_org = __msa_bmnz_v(q1_org, q1, is_less_than_beta); is_less_than_beta = __msa_andi_b(is_less_than_beta, 1); tc = tc + is_less_than_beta; } { v8i16 threshold_r, negate_thresh_r; v8i16 threshold_l, negate_thresh_l; v16i8 negate_thresh, sign_negate_thresh; negate_thresh = zero - (v16i8) tc; sign_negate_thresh = __msa_clti_s_b(negate_thresh, 0); threshold_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc); negate_thresh_r = (v8i16) __msa_ilvr_b(sign_negate_thresh, negate_thresh); AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r, negate_thresh_r, threshold_r, p0_r, q0_r); threshold_l = (v8i16) __msa_ilvl_b(zero, (v16i8) tc); negate_thresh_l = (v8i16) __msa_ilvl_b(sign_negate_thresh, negate_thresh); AVC_LOOP_FILTER_P0Q0(q0_org_l, p0_org_l, p1_org_l, q1_org_l, negate_thresh_l, threshold_l, p0_l, q0_l); } p0 = (v16u8) __msa_pckev_b((v16i8) p0_l, (v16i8) p0_r); q0 = (v16u8) __msa_pckev_b((v16i8) q0_l, (v16i8) q0_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than); } { v16i8 tmp0, tmp1; v8i16 tmp2, tmp5; v4i32 tmp3, tmp4, tmp6, tmp7; uint32_t out0, out2; uint16_t out1, out3; src = data - 3; tmp0 = __msa_ilvr_b((v16i8) p1_org, (v16i8) p2_org); tmp1 = __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org); tmp2 = (v8i16) __msa_ilvr_b((v16i8) q2_org, (v16i8) q1_org); tmp3 = (v4i32) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0); tmp4 = (v4i32) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0); tmp0 = __msa_ilvl_b((v16i8) p1_org, (v16i8) p2_org); tmp1 = __msa_ilvl_b((v16i8) q0_org, (v16i8) p0_org); tmp5 = (v8i16) __msa_ilvl_b((v16i8) q2_org, (v16i8) q1_org); tmp6 = (v4i32) __msa_ilvr_h((v8i16) tmp1, (v8i16) tmp0); tmp7 = (v4i32) __msa_ilvl_h((v8i16) tmp1, (v8i16) tmp0); out0 = __msa_copy_u_w(tmp3, 0); out1 = __msa_copy_u_h(tmp2, 0); out2 = __msa_copy_u_w(tmp3, 1); out3 = __msa_copy_u_h(tmp2, 1); STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp3, 2); out1 = __msa_copy_u_h(tmp2, 2); out2 = __msa_copy_u_w(tmp3, 3); out3 = __msa_copy_u_h(tmp2, 3); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp4, 0); out1 = __msa_copy_u_h(tmp2, 4); out2 = __msa_copy_u_w(tmp4, 1); out3 = __msa_copy_u_h(tmp2, 5); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp4, 2); out1 = __msa_copy_u_h(tmp2, 6); out2 = __msa_copy_u_w(tmp4, 3); out3 = __msa_copy_u_h(tmp2, 7); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp6, 0); out1 = __msa_copy_u_h(tmp5, 0); out2 = __msa_copy_u_w(tmp6, 1); out3 = __msa_copy_u_h(tmp5, 1); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp6, 2); out1 = __msa_copy_u_h(tmp5, 2); out2 = __msa_copy_u_w(tmp6, 3); out3 = __msa_copy_u_h(tmp5, 3); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp7, 0); out1 = __msa_copy_u_h(tmp5, 4); out2 = __msa_copy_u_w(tmp7, 1); out3 = __msa_copy_u_h(tmp5, 5); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); out0 = __msa_copy_u_w(tmp7, 2); out1 = __msa_copy_u_h(tmp5, 6); out2 = __msa_copy_u_w(tmp7, 3); out3 = __msa_copy_u_h(tmp5, 7); src += img_width; STORE_WORD(src, out0); STORE_HWORD((src + 4), out1); src += img_width; STORE_WORD(src, out2); STORE_HWORD((src + 4), out3); } } }
1threat
static int usb_uhci_piix4_initfn(PCIDevice *dev) { UHCIState *s = DO_UPCAST(UHCIState, dev, dev); uint8_t *pci_conf = s->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_2); return usb_uhci_common_initfn(s); }
1threat
Sinon stub callsFake argument : <p>I had the following stubs running perfectly before</p> <pre><code>sinon.stub(console, 'log', () =&gt; { // Check what the arguments holds // And either console.info it or do nothing }); </code></pre> <p>For example, adding <code>console.info(arguments)</code> inside there, would show me whatever <code>console.log</code> was getting.</p> <p>With version <code>2xx</code> I switched to <code>callsFake</code>:</p> <pre><code>sinon.stub(console, 'log').callsFake(() =&gt; { // Check what the arguments holds // And either console.info it or do nothing }); </code></pre> <p>This now longer works. <code>console.info(arguments)</code> has bazaar values, and nothing to do with what <code>console.log</code> is passing. </p> <p>What am I doing wrong?!</p>
0debug
static int mp_pacl_removexattr(FsContext *ctx, const char *path, const char *name) { int ret; char buffer[PATH_MAX]; ret = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS); if (ret == -1 && errno == ENODATA) { errno = 0; ret = 0; } return ret; }
1threat
void bdrv_release_named_dirty_bitmaps(BlockDriverState *bs) { bdrv_do_release_matching_dirty_bitmap(bs, NULL, true); }
1threat