problem
stringlengths
26
131k
labels
class label
2 classes
React Native horizontal FlatList with multiple rows : <p>I'm trying to implement a horizontal scrolling list that has two rows. Using FlatList, the vertical scrolling list involves setting <code>numColumns</code> but there is no equivalent for using rows with horizontal.</p> <p>I was successfully able to make it render properly, and it works flawlessly. However, a warning gets thrown saying setting <code>flexWrap</code> is not supported in <code>VirtualizedList</code> or <code>FlatList</code>, and to use numColumns. I cannot use numColumns as that is not meant for horizontal lists.</p> <pre><code>&lt;FlatList horizontal={true} contentContainerStyle={{ flexDirection: 'column', flexWrap: 'wrap' }} {...otherProps} /&gt; </code></pre> <p>I found the commit where this warning was added, but cannot find the reasoning behind it. There seems to be no way to make this work without a warning being thrown, at least without ditching FlatList entirely. Is there a more appropriate solution for horizontal lists with rows?</p> <p><strong>References:</strong></p> <ul> <li>Commit adding warning: <a href="https://github.com/facebook/react-native/commit/eac399b" rel="noreferrer">https://github.com/facebook/react-native/commit/eac399b</a></li> <li>FlatList Documentation: <a href="https://facebook.github.io/react-native/docs/flatlist.html" rel="noreferrer">https://facebook.github.io/react-native/docs/flatlist.html</a></li> </ul>
0debug
How do i convert list to dictionary in python? : <p>i have 2 list in when i try to convert them to dict my output is random can anybody help?</p> <pre><code>a=['abc', 'def', 'ghi', 'jkl', 'mno'] b=['', '', ['123', '456', '786', '989'], '', ['222', '888', '111', '333']] print(dict(zip(a,b))) output: {'def': '', 'ghi': ['123', '456', '786', '989'], 'jkl': '', 'abc': '', 'mno': ['222', '888', '111', '333']} what i want is {'abc':'', 'def':'', 'ghi':['123', '456', '786', '989'],'jkl':'','mno':['222', '888', '111', '333']} </code></pre>
0debug
Mysql database expert needed : I have a question about mysql $result = mysql_query(" SELECT * FROM Table order by rand() limit 10 When i write the script 10 row is fetch in 2-3 second Is it possible to Fetch each 1 row with 2 second
0debug
Completely Stuck. Create Dual Sidebar With Expanding Options. [Diagram Provided] : I have spent about an hour trying to find a solution that can work, however, none of them come close to my desired goal. I am not expecting someone to spend the time creating it for me (its a lot of work), but I want to know how I can achieve it. Links or js fiddle would be amazing. So this sidebar I am working on. It should have three states. --------------------- The first and second state show up on table onwards. The default state is when the sidebar is loaded. [Default state][1] ------------- The second state is what happens when the user clicks on one of the icon images that are seen in the first image. It now expands to show the additional navigation. (Ex. Icon says Friends, and the new menu that appears has a list of like 10 people). [Clicked State][2] -------------- The Third state only appears on mobile. It basically eliminated the icon sidebar seen in the Default State (first image) [Cant show Mobile Picture Cause I need 10 reputation :| I will comment below.] ----------------- I appreciate any advice on how to solve this. I have tried so many different things and none come close to what I want. [1]: https://i.stack.imgur.com/odZ3l.png [2]: https://i.stack.imgur.com/jVIlE.jpg
0debug
What is The Diffrence Between These Two Code? : I Am On Codewars And My Code Shows A Error Besides Being Same as A Solution. I Can't See The Difference .. Can You help Me?? if len(numbers) <= 1: return [] numbers.remove(min(numbers)) return numbers and this if len(numbers) <= 1: return [] numbers.remove(min(numbers)) return numbers
0debug
Javascript Mental Jumpstart : <p>I need some help on a assignment for school, and I'm kinda stuck. This question defines the ones following and I need a mental "jumpstart;" I can't seem to remember what to do to begin.</p> <pre><code>function get_longest_word(){ //Task 1, complete this function to find the longest word //from the text entered into the textarea. //Once the longest word is found display the longest word in an alert. //Hint use the split(" ") method to split the string into an array of words. var str = document.getElementById('input_text').value;//str is the string from the input text area var longest_word = "not yet implementd"; alert(longest_word); </code></pre>
0debug
Angular2 : render a component without its wrapping tag : <p>I am struggling to find a way to do this. In a parent component, the template describes a <code>table</code> and its <code>thead</code> element, but delegates rendering the <code>tbody</code> to another component, like this:</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Time&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody *ngFor="let entry of getEntries()"&gt; &lt;my-result [entry]="entry"&gt;&lt;/my-result&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Each myResult component renders its own <code>tr</code> tag, basically like so:</p> <pre><code>&lt;tr&gt; &lt;td&gt;{{ entry.name }}&lt;/td&gt; &lt;td&gt;{{ entry.time }}&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>The reason I'm not putting this directly in the parent component (avoiding the need for a myResult component) is that the myResult component is actually more complicated than shown here, so I want to put its behaviour in a separate component and file.</p> <p>The resulting DOM looks bad. I believe this is because it is invalid, as <code>tbody</code> can only contain <code>tr</code> elements <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody" rel="noreferrer">(see MDN)</a>, but my generated (simplified) DOM is :</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Time&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;my-result&gt; &lt;tr&gt; &lt;td&gt;Bob&lt;/td&gt; &lt;td&gt;128&lt;/td&gt; &lt;/tr&gt; &lt;/my-result&gt; &lt;/tbody&gt; &lt;tbody&gt; &lt;my-result&gt; &lt;tr&gt; &lt;td&gt;Lisa&lt;/td&gt; &lt;td&gt;333&lt;/td&gt; &lt;/tr&gt; &lt;/my-result&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Is there any way we can get the same thing rendered, but without the wrapping <code>&lt;my-result&gt;</code> tag, and while still using a component to be sole responsible for rendering a table row ?</p> <p>I have looked at <code>ng-content</code>, <code>DynamicComponentLoader</code>, the <code>ViewContainerRef</code>, but they don't seem to provide a solution to this as far as I can see.</p>
0debug
static int convert_read(ImgConvertState *s, int64_t sector_num, int nb_sectors, uint8_t *buf) { int n; int ret; if (s->status == BLK_ZERO || s->status == BLK_BACKING_FILE) { return 0; } assert(nb_sectors <= s->buf_sectors); while (nb_sectors > 0) { BlockBackend *blk; int64_t bs_sectors; convert_select_part(s, sector_num); blk = s->src[s->src_cur]; bs_sectors = s->src_sectors[s->src_cur]; n = MIN(nb_sectors, bs_sectors - (sector_num - s->src_cur_offset)); ret = blk_read(blk, sector_num - s->src_cur_offset, buf, n); if (ret < 0) { return ret; } sector_num += n; nb_sectors -= n; buf += n * BDRV_SECTOR_SIZE; } return 0; }
1threat
Python Convert a list of list to list of tuples : <p>I want to convert a list of list into list of tuples using Python. But I want to do it without iterating through the nested list as it will increasing execution time of script. Is there any way which can workout for me? </p> <p>Thanks in Advance</p>
0debug
static double tget_double(const uint8_t **p, int le) { av_alias64 i = { .u64 = le ? AV_RL64(*p) : AV_RB64(*p)}; *p += 8; return i.f64; }
1threat
C++ Hermite interpolation : <p>I found c++ source calculating "Hermite polynomial interpolating function and derivative values". Source: <a href="https://people.sc.fsu.edu/~jburkardt/cpp_src/hermite/hermite.html" rel="nofollow noreferrer">https://people.sc.fsu.edu/~jburkardt/cpp_src/hermite/hermite.html</a></p> <p>I have looked to given examples in that source and no of them applies my case.</p> <p>My case is to calculate y values at some x position from data points such as:</p> <pre><code>X: 0.9, 1.7, 2.55, 3.39... Y: 0.9, 0.8, 0.85, 0.84... </code></pre> <p>And get result with equal x spaces (x space 0.5):</p> <pre><code>X: 0.5, 1.00, 1.5, 2.00, 2.5, 3.0,... Y: 0.8, 0.95, 0.8, 0.85, 0.9, 0.9,... </code></pre> <p>Is that source even applicable for my case? </p>
0debug
how to write comlpete dictionary in existing csv file in loop using python : I want to write the dictionary in existing CSV in the new column within the loop. My sample code : `for loop: keys = [] values = [] dictionary = {}` for loop: dictionary = dict(zip(keys,values) ####**write code for inserting dictionary in csv file in first loop.** My dictionary data is {'string':value, 'string':value} My desired CSV data should be : Count {'string':value, 'string':value}
0debug
Test if all elements of a Foldable are the same : <p>I built a function that verifies that all elements of a foldable structure are equal.</p> <p>Compared to a similar function on the lists, it seems to me that the more general function is disproportionately complex, but I have not been able to simplify it.</p> <p>Do you have any suggestions?</p> <pre><code>import Data.Monoid import Data.Sequence as SQ import Data.Matrix as MT allElementsEqualL :: Eq a =&gt; [a] -&gt; Bool allElementsEqualL [] = True allElementsEqualL (x:ns) = all (== x) ns -- allElementsEqualL [1,1,1] -&gt; True allElementsEqualF :: (Foldable t, Eq a) =&gt; t a -&gt; Bool allElementsEqualF xs = case (getFirst . foldMap (First . Just) $ xs) of Nothing -&gt; True Just x -&gt; all (== x) xs -- allElementsEqualF [1,1,1] -&gt; True -- allElementsEqualF $ SQ.fromList [1,1,1] -&gt; True -- allElementsEqualF $ MT.fromLists [[1,1],[1,1]] -&gt; True </code></pre>
0debug
Slope function error(sort-of)... again : <p>Well this one feels tough... <strong>BEFORE YOU READ</strong> p5js.org This is p5.js library</p> <p>Earlier I made a slope function with some help.</p> <pre><code>function graphY(num,cHI){ var GsetR = cHI-num; return(GsetR); }; function slope(x1,y1,x2,y2,ex,direction){ //direction left or right? mirror flips for right var gg1 = x2-x1; var gg2 = y2-y1; var ggs = gg2/gg1; var ggsR = gg1/gg2; console.log(ggsR); if(direction == "right"){ return(ggs); } if(direction == "left"){ return(-ggs); } }; function setup() { createCanvas(1000,650); } var slipX= 100; var slipY= 500; function draw() { background(204); fill(0,0,0); stroke(0,0,0); strokeWeight(2) ellipse(slipX,slipY,20,20); slipY += slope(100,500,50,200,slipX,"left"); // I WANT THE BALL TO GO TO THE LEFT line(100,500,50,200); slipX++; text(slipY,20,20); } </code></pre> <p>Although it works fine on the "right" mode It doesn't work for left. And this is where the "sort-of bit comes in"</p> <p>I need the negative RECIPROCAL of ggs not just negative but I checked all documentations and couldn't find out how. ggsR doesnt work...</p> <p><strong>Is there any way to get the reciprocal of ggs?</strong></p>
0debug
How to get accces to that pointer? : I've got something like this : template <typename T,typename K> class Ring { typedef struct Node { T data; K key; Node * next; Node * prev; }; Node * head; public: class iterator { private: //protected: Node * ptr; friend class Ring; } And i want to get by iterator class to Node*ptr to return in methods like get_value(iterator x) data and key. How can i do this ommiting function friend class? I want to make that Node *ptr will not be able to being used by user. Thanks in advance ;)
0debug
How to remove useless array and indexOf : I want to refactor this code without indexOf() and remove useless groupArr. I want to use ^ES6 or/and lodash <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> const keys= ['activity', 'admin']; const labels = ["accountTypes.GROUP_ACCOUNT", "accountTypes.SINGLE_ACCOUNT", "activity.active", "activity.inactive", "admin.dictionaries.name", "admin.group.details.addedDate", "admin.group.details.enterDescription"]; let arr = []; keys.forEach( key => { labels.forEach(label => { if (label.indexOf(key) === 0){ arr.push(label); } }); }); console.log(arr) <!-- end snippet -->
0debug
Redux and within a reducer accessing a different reducer, how? : <p>So, I have an app that has multiple reducers, and thus multiple action creators associated.</p> <p>There is a time in which one of my reducers updates the state (because of an edit), and as such, I have to then make sure the other reducers see this update and adjust their state accordingly. </p> <p>think of it as if a user selects "sneakers", and this state management is in a reducer called productsReducer. As such, as a user moves thru the app process, they get couponsReducer associated with it... but the user can "edit" at any time, so if they then edit "sneakers" and say, choose another producer, I have to be able to alter the couponsReducer in real time, because a progress modal needs to reflect this. I can do this via going thru the flow to the coupon page, because on that page I just reconcile the data on componentWillMount... but the rub is I have a progress modal, and prior to getting to the coupons page, a user can open the progress modal... and there will be a missmatch here...</p> <p>long winded I know, I just wanted to explain my situation.</p> <p>so, I want to be able to call "other reducers" or their action creators from within the productsReducer. </p> <p>Would a middleware be appropriate here, in which I sniff for a certain "action.type" and if I see it, I can dispatch other action.type's or is there a way to call action creators from within the productsReducer?</p> <p>importing: import * as coupons from './couponsActions' and any other actions I need seem inappropriate.</p>
0debug
cannot save form data into db when I click submit button : <p>I have a php code, I want to save the form data into datatase. I test, I can write "insert into table values()" directly in database, it can insert into database.</p> <p>But in my UI, when I click submit button, I cannot save into db?</p> <pre><code>&lt;?php include('connectWorkbench.php'); $sql=mysql_query("SELECT * FROM Properties"); $epr = ''; $msg = ''; if(isset($_GET['epr'])) $epr=$_GET['epr']; //++++++++++++++++++++++++++++++save record++++++++++++++++++ if($epr=='save') { $pid=$_POST['pid']; $aid=$_POST['aid']; $uid=$_POST['uid']; $code=$_POST['code']; $name=$_POST['name']; $description=$_POST['description']; $parking=$_POST['parking']; $sfeet=$_POST['sfeet']; $price=$_POST['price']; $distance=$_POST['distance']; $owner=$_POST['owner']; $a_sql=mysql_query("INSERT INTO Properties VALUES($pid,$aid,$uid,$code,'$name','$description','$parking',$sfeet,'$price','$distance','$owner')"); if($a_sql) header("location:index.php"); else { $msg='Error:'.mysql_error(); echo '$msg'; } } ?&gt; &lt;!--$query = mysql_query("SELECT * FROM Contact"); while($row = mysql_fetch_array($query)) { $id = $row['contact_ID']; $fname = $row['first_name']; $midname = $row['middle_name']; $lname = $row['last_name']; echo '&lt;br /&gt;' .$id. ':' . $fname . '&lt;br /&gt;'; } $query2 = mysql_query("SELECT * FROM Properties"); while($row = mysql_fetch_array($query2)) { $id = $row['property_ID']; $addressID = $row['property_address_ID']; $ownerID = $row['owner_user_ID']; $propertyCode = $row['property_type_code']; echo '&lt;br /&gt;' .$id. ':' . $addressID . ':' . $ownerID .':'. $propertyCode .'&lt;br /&gt;'; } &lt;IMG SRC=""&gt; --&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;h2 align="center"&gt;Contact Us&lt;/h2&gt; &lt;table align="center" border="1" cellspacing="0" cellpadding="0" width="700"&gt; &lt;thead&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Middle Name&lt;/th&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;Email Address&lt;/th&gt; &lt;th&gt;Message&lt;/th&gt; &lt;/thead&gt; &lt;/table&gt; &lt;h2 align="center"&gt;Edit Property&lt;/h2&gt; &lt;form method="POST" action='index.php?epr=save'&gt; &lt;table align="center" width="700"&gt; &lt;tr&gt; &lt;td&gt;property id&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='pid'&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Property address ID&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='aid'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Owner user ID&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='uid'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Property type code&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='code'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Property name&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='name'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Property description&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='description'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Parking&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='parking'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Square feet&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='sfeet'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Rent price&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='price'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Distance from campus&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='distance'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Property owner&lt;/td&gt; &lt;td&gt;&lt;input type='text' name='owner'/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;input type='submit' name='submitbutton' value="Submit"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;!--+++++++++++++++++++++++++Show Data++++++++++++++++++++--&gt; &lt;h2 align="center"&gt;Property List&lt;/h2&gt; &lt;table align="center" border="1" cellspacing="0" cellpadding="0" width="1200"&gt; &lt;thead&gt; &lt;th&gt;Property ID&lt;/th&gt; &lt;th&gt;Property address ID&lt;/th&gt; &lt;th&gt;Owner user ID&lt;/th&gt; &lt;th&gt;Property type code&lt;/th&gt; &lt;th&gt;Property name&lt;/th&gt; &lt;th&gt;Property description&lt;/th&gt; &lt;th&gt;Parking&lt;/th&gt; &lt;th&gt;Square feet&lt;/th&gt; &lt;th&gt;Rent price&lt;/th&gt; &lt;th&gt;Distance from campus&lt;/th&gt; &lt;th&gt;Property owner&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/thead&gt; &lt;?php $i=1; while ($row=mysql_fetch_array($sql)) { echo"&lt;tr&gt; &lt;td&gt;".$i."&lt;/td&gt; &lt;td&gt;".$row['property_address_ID']."&lt;/td&gt; &lt;td&gt;".$row['owner_user_ID']."&lt;/td&gt; &lt;td&gt;".$row['property_type_code']."&lt;/td&gt; &lt;td&gt;".$row['property_name']."&lt;/td&gt; &lt;td&gt;".$row['property_description']."&lt;/td&gt; &lt;td&gt;".$row['parking']."&lt;/td&gt; &lt;td&gt;".$row['square_feet']."&lt;/td&gt; &lt;td&gt;".$row['rent_price']."&lt;/td&gt; &lt;td&gt;".$row['distanceFromCampus']."&lt;/td&gt; &lt;td&gt;".$row['property_owner']."&lt;/td&gt; &lt;td align='center'&gt; &lt;a href='#'&gt;Delete&lt;/a&gt; | &lt;a href='#'&gt;Edit&lt;/a&gt; | &lt;a href='#'&gt;New&lt;/a&gt; &lt;/td&gt; &lt;tr&gt;"; $i++; } ?&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
def intersection_array(array_nums1,array_nums2): result = list(filter(lambda x: x in array_nums1, array_nums2)) return result
0debug
int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f) { SaveStateEntry *se; int ret = 1; QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (se->save_live_state == NULL) continue; qemu_put_byte(f, QEMU_VM_SECTION_PART); qemu_put_be32(f, se->section_id); ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); if (!ret) { break; } } if (ret != 0) { return ret; } ret = qemu_file_get_error(f); if (ret != 0) { qemu_savevm_state_cancel(mon, f); } return ret; }
1threat
Control + F4 not working in ubuntu 16.04 : <p>Control + F4 option which is used to close current tab in google chrome is not working in ubuntu 16.04.</p>
0debug
static int get_cv_transfer_function(AVCodecContext *avctx, CFStringRef *transfer_fnc, CFNumberRef *gamma_level) { enum AVColorTransferCharacteristic trc = avctx->color_trc; Float32 gamma; *gamma_level = NULL; switch (trc) { case AVCOL_TRC_UNSPECIFIED: *transfer_fnc = NULL; break; case AVCOL_TRC_BT709: *transfer_fnc = kCVImageBufferTransferFunction_ITU_R_709_2; break; case AVCOL_TRC_SMPTE240M: *transfer_fnc = kCVImageBufferTransferFunction_SMPTE_240M_1995; break; case AVCOL_TRC_GAMMA22: gamma = 2.2; *transfer_fnc = kCVImageBufferTransferFunction_UseGamma; *gamma_level = CFNumberCreate(NULL, kCFNumberFloat32Type, &gamma); break; case AVCOL_TRC_GAMMA28: gamma = 2.8; *transfer_fnc = kCVImageBufferTransferFunction_UseGamma; *gamma_level = CFNumberCreate(NULL, kCFNumberFloat32Type, &gamma); break; case AVCOL_TRC_BT2020_10: case AVCOL_TRC_BT2020_12: *transfer_fnc = kCVImageBufferTransferFunction_ITU_R_2020; break; default: av_log(avctx, AV_LOG_ERROR, "Transfer function %s is not supported.\n", av_color_transfer_name(trc)); return -1; } return 0; }
1threat
Include Javascript on Certain Pages in Phoenix Framework Application : <p>I've got a bit of Javascript that I only want to include on certain pages in my Phoenix application.</p> <p>Right now I've got the Javascript inside a script tag in <code>myapp/web/templates/post/form.html.eex</code>.</p> <p>I understand that I can move the JavaScript to <code>web/static/js/app.js</code> ...but I don't want to include the Javascript on every page (it's only required on 2 specific pages).</p> <p>What's the best way to load this section of Javascript on certain pages in my application without duplication the code and violating the DRY principle? </p>
0debug
Python mock.patch: replace a method : <p>I'd like to replace a method in a class with mock:</p> <pre><code>from unittest.mock import patch class A(object): def method(self, string): print(self, "method", string) def method2(self, string): print(self, "method2", string) with patch.object(A, 'method', side_effect=method2): a = A() a.method("string") a.method.assert_called_with("string") </code></pre> <p>...but I get insulted by the computer:</p> <pre><code>TypeError: method2() missing 1 required positional argument: 'string' </code></pre>
0debug
Extract multiple lines of text in xml case : I have an xml case as given below .I want to extract text of message between <com.eds.travel.fares.ping.response></com.eds.travel.fares.ping.response>.The xml strat with com.eds.travel.fares.ping.response and end with com.eds.travel.fares.ping.response. % handlertd -- log_message -- preprod.preprods3.1.server3.native1 msgcount=2721 Tue Jun 21 00:01:46 2016 <?xml version="1.0" encoding="UTF-8"?>^M ^M <!--This is a Ping Response-->^M <com.eds.travel.fares.ping.response xmlns="http://schemas.eds.com/transportation/message/ping/response" targetNamespace="http://schemas.eds.com/transportation/message/ping/response" EchoToken="00c0d1a" TimeStamp="2016-06-21T00:01:46.123" Target="Test" Version="1.07" SequenceNmbr="1466467306998" PrimaryLangID="en" RequestorCompanyCode="1y" RequestorNetworkID="as" SetLocation="zrh">^M <Headers Trailers="n">^M <Result xmlns="http://schemas.eds.com/transportation/message/fares/common" status="success" />^M </Headers>^M <DataArea>^M <Pong Message="pong" ServerHostName="usclsefam922.clt.travel.eds.com" ServerPortNumber="8023" ServerMessageCount="0" RegionName="preprod" SystemName="preprods3.1" SystemDate="20160621" SystemTime="146" CodeVersion="$Name: build-2016-06-17-1338 $" />^M </DataArea>^M <Trailers />^M </com.eds.travel.fares.ping.response> % handlertd -- log_message -- preprod.preprods3.1.server3.native1 msgcount=2721 Tue Jun 21 00:01:46 2016 I tried with below command but no luck cat file.txt | egrep "<com.eds.travel.fares.ping.response>.*</com.eds.travel.fares.ping.response>" please advise
0debug
def rear_extract(test_list): res = [lis[-1] for lis in test_list] return (res)
0debug
Parse complex Json Object with Gson : I have a json got from OMDb like this: { "Search": [{"Title":"Seven Pounds", "Year":"2008", "imdbID":"tt0814314", "Type":"movie", "Poster":"someUrl"}, {"Title":"Seven Samurai", "Year":"1954", "imdbID":"tt0047478", "Type":"movie", "Poster":"someUrl"} ],"totalResults":"1048", "Response":"True" } I'd like to extract every movie and store it into a List so I created a class MovieContainer with a List of Movie, which containes a set of Strings. I used MovieContainer cnt=new Gson().fromJson(jstring, MovieContainer.class); where jstring is a String with a json like the one above, but when I try to iterate over the List in the Container I get a NullPointerException. Since I'm a beginner with Gson I can't find out why, how should I parse the Json?
0debug
How can I read an images from a folder but we start by image 10 for exemple with VideoCapture() in python? : I want to read a sequence of images from a folder , I find: cap=cv2.VideoCapture("in%6d.jpg") ,but I must start by image10 not by the first. How can I do this??
0debug
Client-side request encryption with React : <p>I want to make calls to my backend service in such a way that prevents people from copying the requests from the network tab, and duplicating them using curl, allowing them to burn through my API limits.</p> <p>My site uses client-side React, so it seems to me that whenever I access the secret key to encrypt the data I'm sending, a user could just set a breakpoint in the Sources folder, and sniff the password I'm using for encryption.</p> <p>Is there a technology or pattern I'm missing that would solve this problem?</p> <p>Thanks very much!</p>
0debug
How to develop an application that recognize a type of image : i must develop a program in python that recognize the flowchart image files.Result must be 'yes this is a flowchart' or 'no this is not a flowchart'.I have watched a video series that classify dog and cat images, there are two categories as dataset dogs and cats.But i have only one category 'flowcharts'.How can i seperate flowchart images from all other things?
0debug
Java Drawing an Arc between two given points : <p>say i have two points (x,y) (10,10) and (100,100) how would i be able to calculate the width, height, startAngle and arcAngle, to draw an arc between those two points? please note that this is <strong>NOT</strong> a homework exercise.</p>
0debug
static int qcow_create2(const char *filename, int64_t total_size, const char *backing_file, const char *backing_format, int flags, size_t cluster_size, int prealloc) { int fd, header_size, backing_filename_len, l1_size, i, shift, l2_bits; int ref_clusters, backing_format_len = 0; QCowHeader header; uint64_t tmp, offset; QCowCreateState s1, *s = &s1; QCowExtension ext_bf = {0, 0}; memset(s, 0, sizeof(*s)); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd < 0) return -1; memset(&header, 0, sizeof(header)); header.magic = cpu_to_be32(QCOW_MAGIC); header.version = cpu_to_be32(QCOW_VERSION); header.size = cpu_to_be64(total_size * 512); header_size = sizeof(header); backing_filename_len = 0; if (backing_file) { if (backing_format) { ext_bf.magic = QCOW_EXT_MAGIC_BACKING_FORMAT; backing_format_len = strlen(backing_format); ext_bf.len = (backing_format_len + 7) & ~7; header_size += ((sizeof(ext_bf) + ext_bf.len + 7) & ~7); } header.backing_file_offset = cpu_to_be64(header_size); backing_filename_len = strlen(backing_file); header.backing_file_size = cpu_to_be32(backing_filename_len); header_size += backing_filename_len; } s->cluster_bits = get_bits_from_size(cluster_size); if (s->cluster_bits < MIN_CLUSTER_BITS || s->cluster_bits > MAX_CLUSTER_BITS) { fprintf(stderr, "Cluster size must be a power of two between " "%d and %dk\n", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); return -EINVAL; } s->cluster_size = 1 << s->cluster_bits; header.cluster_bits = cpu_to_be32(s->cluster_bits); header_size = (header_size + 7) & ~7; if (flags & BLOCK_FLAG_ENCRYPT) { header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES); } else { header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } l2_bits = s->cluster_bits - 3; shift = s->cluster_bits + l2_bits; l1_size = (((total_size * 512) + (1LL << shift) - 1) >> shift); offset = align_offset(header_size, s->cluster_size); s->l1_table_offset = offset; header.l1_table_offset = cpu_to_be64(s->l1_table_offset); header.l1_size = cpu_to_be32(l1_size); offset += align_offset(l1_size * sizeof(uint64_t), s->cluster_size); s->refcount_table = qemu_mallocz(s->cluster_size); s->refcount_table_offset = offset; header.refcount_table_offset = cpu_to_be64(offset); header.refcount_table_clusters = cpu_to_be32(1); offset += s->cluster_size; s->refcount_block_offset = offset; tmp = offset >> s->cluster_bits; ref_clusters = (tmp >> (s->cluster_bits - REFCOUNT_SHIFT)) + 1; for (i=0; i < ref_clusters; i++) { s->refcount_table[i] = cpu_to_be64(offset); offset += s->cluster_size; } s->refcount_block = qemu_mallocz(ref_clusters * s->cluster_size); qcow2_create_refcount_update(s, 0, header_size); qcow2_create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); qcow2_create_refcount_update(s, s->refcount_table_offset, s->cluster_size); qcow2_create_refcount_update(s, s->refcount_block_offset, ref_clusters * s->cluster_size); write(fd, &header, sizeof(header)); if (backing_file) { if (backing_format_len) { char zero[16]; int d = ext_bf.len - backing_format_len; memset(zero, 0, sizeof(zero)); cpu_to_be32s(&ext_bf.magic); cpu_to_be32s(&ext_bf.len); write(fd, &ext_bf, sizeof(ext_bf)); write(fd, backing_format, backing_format_len); if (d>0) { write(fd, zero, d); } } write(fd, backing_file, backing_filename_len); } lseek(fd, s->l1_table_offset, SEEK_SET); tmp = 0; for(i = 0;i < l1_size; i++) { write(fd, &tmp, sizeof(tmp)); } lseek(fd, s->refcount_table_offset, SEEK_SET); write(fd, s->refcount_table, s->cluster_size); lseek(fd, s->refcount_block_offset, SEEK_SET); write(fd, s->refcount_block, ref_clusters * s->cluster_size); qemu_free(s->refcount_table); qemu_free(s->refcount_block); close(fd); if (prealloc) { BlockDriverState *bs; bs = bdrv_new(""); bdrv_open(bs, filename, BDRV_O_CACHE_WB); preallocate(bs); bdrv_close(bs); } return 0; }
1threat
Jquery Ajax - Use event within an ajax callback function : <p>Any clues, how I would get this to work?</p> <pre><code>$( "#search_form" ).on('submit',function(event) { ajax(function(response){ if (response.status == 'error'){ event.preventDefault(); alert(response.status,response.msg); }else if(response.status == 'ok'){ alert(response.status,response.msg); } }); }); </code></pre> <p>event.preventDefault(); is not being called, probably because it's out of scope in the ajax function. This line simply prevents the button from carrying out a post action. How would i insert it into the ajax function? I'm just learning about callbacks and this has thrown me</p> <p>Thanks y'all</p>
0debug
how to include my twitter timeline in a html page? : How can use the twitter API's to get my timeline and display it in a html page? I want to query the API's using JavaScript. The questions I found on stackoverflow are old and the answer don't seem to work any more. Any help would be appreciated.
0debug
Unsubscribe subscription in Apollo Client : <p>In my component, I have this code:</p> <pre><code>componentDidMount () { // Setup subscription listener const { client, match: { params: { groupId } } } = this.props client.subscribe({ query: HOMEWORK_IN_GROUP_SUBSCRIPTION, variables: { groupId }, }).subscribe({ next ({ data }) { const cacheData = client.cache.readQuery({ query: GET_GROUP_QUERY, variables: { groupId }, }) const homeworkAlreadyExists = cacheData.group.homeworks.find( homework =&gt; homework._id == data.homeworkInGroup._id ) if (!homeworkAlreadyExists) { client.cache.writeQuery({ query: GET_GROUP_QUERY, variables: { groupId }, data: { ...cacheData, group: { ...cacheData.group, homeworks: [ ...cacheData.group.homeworks, data.homeworkInGroup, ], }, }, }) } }, }) } </code></pre> <p>The problem is that this component will re-subscribe when mounted and will mantain subscribed even if unmounted.</p> <p>How can I unsubscribe my component?</p>
0debug
def lateralsuface_cylinder(r,h): lateralsurface= 2*3.1415*r*h return lateralsurface
0debug
Revoking Permissions in app specific parmission through settings clearing the app cache : <p>I have opened the app, I am trying to revoke the app specific permissions through settings menu and now my variable values resets to null(Which means clearing the variable cache)</p> <p>Is this the regular behavior when we trying to revoke the permission manually?</p> <p>Could anyone give us a description about this.</p> <p>Thanks.</p>
0debug
static av_cold int cinepak_decode_init(AVCodecContext *avctx) { CinepakContext *s = avctx->priv_data; s->avctx = avctx; s->width = (avctx->width + 3) & ~3; s->height = (avctx->height + 3) & ~3; s->sega_film_skip_bytes = -1; if (avctx->bits_per_coded_sample != 8) { s->palette_video = 0; avctx->pix_fmt = AV_PIX_FMT_YUV420P; } else { s->palette_video = 1; avctx->pix_fmt = AV_PIX_FMT_PAL8; } s->frame.data[0] = NULL; return 0; }
1threat
AWS Credentials Refreshed but Still Expired : <p>Anyone has any idea what the following error means?</p> <pre><code>#aws s3 ls Credentials were refreshed, but the refreshed credentials are still expired. </code></pre> <p>I running it from the command line on the server, have already updated the keys couple of time but getting this error which i haven't seen before</p>
0debug
static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags) { int i; uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED; uint64_t first_entry = be64_to_cpu(l2_table[0]); uint64_t offset = first_entry & mask; if (!offset) return 0; assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED); for (i = 0; i < nb_clusters; i++) { uint64_t l2_entry = be64_to_cpu(l2_table[i]) & mask; if (offset + (uint64_t) i * cluster_size != l2_entry) { break; } } return i; }
1threat
void do_m68k_semihosting(CPUM68KState *env, int nr) { uint32_t args; void *p; void *q; uint32_t len; uint32_t result; args = env->dregs[1]; switch (nr) { case HOSTED_EXIT: gdb_exit(env, env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "open,%s,%x,%x", ARG(0), (int)ARG(1), ARG(2), ARG(3)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = open(p, translate_openflags(ARG(2)), ARG(3)); unlock_user(p, ARG(0), 0); } } break; case HOSTED_CLOSE: { int fd = ARG(0); if (fd > 2) { if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); return; } else { result = close(fd); } } else { result = 0; } break; } case HOSTED_READ: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { result = -1; } else { result = read(ARG(0), p, len); unlock_user(p, ARG(1), len); } } break; case HOSTED_WRITE: len = ARG(2); if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return; } else { if (!(p = lock_user(VERIFY_READ, ARG(1), len, 1))) { result = -1; } else { result = write(ARG(0), p, len); unlock_user(p, ARG(0), 0); } } break; case HOSTED_LSEEK: { uint64_t off; off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); if (use_gdb_syscalls()) { m68k_semi_is_fseek = 1; gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", ARG(0), off, ARG(3)); } else { off = lseek(ARG(0), off, ARG(3)); put_user_u32(off >> 32, args); put_user_u32(off, args + 4); put_user_u32(errno, args + 8); } return; } case HOSTED_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "rename,%s,%s", ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); return; } else { p = lock_user_string(ARG(0)); q = lock_user_string(ARG(2)); if (!p || !q) { result = -1; } else { result = rename(p, q); } unlock_user(p, ARG(0), 0); unlock_user(q, ARG(2), 0); } break; case HOSTED_UNLINK: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = unlink(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_STAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "stat,%s,%x", ARG(0), (int)ARG(1), ARG(2)); return; } else { struct stat s; if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = stat(p, &s); unlock_user(p, ARG(0), 0); } if (result == 0) { translate_stat(env, ARG(2), &s); } } break; case HOSTED_FSTAT: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", ARG(0), ARG(1)); return; } else { struct stat s; result = fstat(ARG(0), &s); if (result == 0) { translate_stat(env, ARG(1), &s); } } break; case HOSTED_GETTIMEOFDAY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", ARG(0), ARG(1)); return; } else { qemu_timeval tv; struct gdb_timeval *p; result = qemu_gettimeofday(&tv); if (result != 0) { if (!(p = lock_user(VERIFY_WRITE, ARG(0), sizeof(struct gdb_timeval), 0))) { result = -1; } else { p->tv_sec = cpu_to_be32(tv.tv_sec); p->tv_usec = cpu_to_be64(tv.tv_usec); unlock_user(p, ARG(0), sizeof(struct gdb_timeval)); } } } break; case HOSTED_ISATTY: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); return; } else { result = isatty(ARG(0)); } break; case HOSTED_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(m68k_semi_cb, "system,%s", ARG(0), (int)ARG(1)); return; } else { if (!(p = lock_user_string(ARG(0)))) { result = -1; } else { result = system(p); unlock_user(p, ARG(0), 0); } } break; case HOSTED_INIT_SIM: #if defined(CONFIG_USER_ONLY) { TaskState *ts = env->opaque; if (!ts->heap_limit) { long ret; uint32_t size; uint32_t base; base = do_brk(0); size = SEMIHOSTING_HEAP_SIZE; for (;;) { ret = do_brk(base + size); if (ret != -1) break; size >>= 1; } ts->heap_limit = base + size; } env->dregs[1] = ts->heap_limit; env->aregs[7] = ts->stack_base; } #else env->dregs[1] = ram_size; env->aregs[7] = ram_size; #endif return; default: cpu_abort(env, "Unsupported semihosting syscall %d\n", nr); result = 0; } put_user_u32(result, args); put_user_u32(errno, args + 4); }
1threat
pyspark matrix with dummy variables : <p>Have two columns:</p> <pre><code>ID Text 1 a 2 b 3 c </code></pre> <p>How can I able to create matrix with dummy variables like this:</p> <pre><code>ID a b c 1 1 0 0 2 0 1 0 3 0 0 1 </code></pre> <p>Using pyspark library and its features?</p>
0debug
Differences between Fprint/Fprintf vs conn.Write in GOLANG : Trying to send encrypted data across a TCP connection. Fprintf works fine for unencrypted data but seems to be adding formatting to encrypted data causing the decrypt to fail intermittently. I am unable send using conn.Write or for that matter writer.Writestring followed by writer.Flush(). scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() && err == nil { msg := scanner.Text() ciphertext := md5.Encrypt([]byte(msg+"\n") conn.Write(append(ciphertext, '\r')) } //Receiver scanner := bufio.NewScanner(conn) for scanner.Scan() { ciphertext := scanner.Bytes() plaintext := md5.Decrypt(ciphertext) fmt.Println(string(plaintext)) } Suggestions welcome.
0debug
static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame; AVCodecContext *avctx = ist->st->codec; int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); int i, ret; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); if (ret < 0) { return ret; } if (!*got_output) { return ret; } if (decoded_frame->pts != AV_NOPTS_VALUE) ist->next_dts = decoded_frame->pts; ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / avctx->sample_rate; if (audio_volume != 256) { int decoded_data_size = decoded_frame->nb_samples * avctx->channels * bps; void *samples = decoded_frame->data[0]; switch (avctx->sample_fmt) { case AV_SAMPLE_FMT_U8: { uint8_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; *volp++ = av_clip_uint8(v); } break; } case AV_SAMPLE_FMT_S16: { int16_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int v = ((*volp) * audio_volume + 128) >> 8; *volp++ = av_clip_int16(v); } break; } case AV_SAMPLE_FMT_S32: { int32_t *volp = samples; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); *volp++ = av_clipl_int32(v); } break; } case AV_SAMPLE_FMT_FLT: { float *volp = samples; float scale = audio_volume / 256.f; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } case AV_SAMPLE_FMT_DBL: { double *volp = samples; double scale = audio_volume / 256.; for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { *volp++ *= scale; } break; } default: av_log(NULL, AV_LOG_FATAL, "Audio volume adjustment on sample format %s is not supported.\n", av_get_sample_fmt_name(ist->st->codec->sample_fmt)); exit_program(1); } } rate_emu_sleep(ist); for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || !ost->encoding_needed) continue; do_audio_out(output_files[ost->file_index]->ctx, ost, ist, decoded_frame); } return ret; }
1threat
static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type) { H264Context *h = &svq3->h; int i, j, k, m, dir, mode; int cbp = 0; uint32_t vlc; int8_t *top, *left; MpegEncContext *const s = (MpegEncContext *) h; const int mb_xy = h->mb_xy; const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; h->topright_samples_available = 0xFFFF; if (mb_type == 0) { if (s->pict_type == AV_PICTURE_TYPE_P || s->next_picture.f.mb_type[mb_xy] == -1) { svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0); if (s->pict_type == AV_PICTURE_TYPE_B) { svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1); } mb_type = MB_TYPE_SKIP; } else { mb_type = FFMIN(s->next_picture.f.mb_type[mb_xy], 6); if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0) return -1; if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0) return -1; mb_type = MB_TYPE_16x16; } } else if (mb_type < 8) { if (svq3->thirdpel_flag && svq3->halfpel_flag == !get_bits1 (&s->gb)) { mode = THIRDPEL_MODE; } else if (svq3->halfpel_flag && svq3->thirdpel_flag == !get_bits1 (&s->gb)) { mode = HALFPEL_MODE; } else { mode = FULLPEL_MODE; } for (m = 0; m < 2; m++) { if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) { for (i = 0; i < 4; i++) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - 1 + i*h->b_stride]; } } else { for (i = 0; i < 4; i++) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0; } } if (s->mb_y > 0) { memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t)); memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4); if (s->mb_x < (s->mb_width - 1)) { *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4]; h->ref_cache[m][scan8[0] + 4 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 || h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1; }else h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE; if (s->mb_x > 0) { *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1]; h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1; }else h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE; }else memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8); if (s->pict_type != AV_PICTURE_TYPE_B) break; } if (s->pict_type == AV_PICTURE_TYPE_P) { if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0) return -1; } else { if (mb_type != 2) { if (svq3_mc_dir(h, 0, mode, 0, 0) < 0) return -1; } else { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } if (mb_type != 1) { if (svq3_mc_dir(h, 0, mode, 1, (mb_type == 3)) < 0) return -1; } else { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } } mb_type = MB_TYPE_16x16; } else if (mb_type == 8 || mb_type == 33) { memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t)); if (mb_type == 8) { if (s->mb_x > 0) { for (i = 0; i < 4; i++) { h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i]; } if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) { h->left_samples_available = 0x5F5F; } } if (s->mb_y > 0) { h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+0]; h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+1]; h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+2]; h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+3]; if (h->intra4x4_pred_mode_cache[4+8*0] == -1) { h->top_samples_available = 0x33FF; } } for (i = 0; i < 16; i+=2) { vlc = svq3_get_ue_golomb(&s->gb); if (vlc >= 25){ av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc); return -1; } left = &h->intra4x4_pred_mode_cache[scan8[i] - 1]; top = &h->intra4x4_pred_mode_cache[scan8[i] - 8]; left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]]; left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]]; if (left[1] == -1 || left[2] == -1){ av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n"); return -1; } } } else { for (i = 0; i < 4; i++) { memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4); } } write_back_intra_pred_mode(h); if (mb_type == 8) { ff_h264_check_intra4x4_pred_mode(h); h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF; h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF; } else { for (i = 0; i < 4; i++) { memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4); } h->top_samples_available = 0x33FF; h->left_samples_available = 0x5F5F; } mb_type = MB_TYPE_INTRA4x4; } else { dir = i_mb_type_info[mb_type - 8].pred_mode; dir = (dir >> 1) ^ 3*(dir & 1) ^ 1; if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir)) == -1){ av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n"); return -1; } cbp = i_mb_type_info[mb_type - 8].cbp; mb_type = MB_TYPE_INTRA16x16; } if (!IS_INTER(mb_type) && s->pict_type != AV_PICTURE_TYPE_I) { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } if (s->pict_type == AV_PICTURE_TYPE_B) { for (i = 0; i < 4; i++) { memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t)); } } } if (!IS_INTRA4x4(mb_type)) { memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8); } if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) { memset(h->non_zero_count_cache + 8, 0, 14*8*sizeof(uint8_t)); s->dsp.clear_blocks(h->mb+ 0); s->dsp.clear_blocks(h->mb+384); } if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) { if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc); return -1; } cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc]; } if (IS_INTRA16x16(mb_type) || (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) { s->qscale += svq3_get_se_golomb(&s->gb); if (s->qscale > 31){ av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale); return -1; } } if (IS_INTRA16x16(mb_type)) { AV_ZERO128(h->mb_luma_dc[0]+0); AV_ZERO128(h->mb_luma_dc[0]+8); if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n"); return -1; } } if (cbp) { const int index = IS_INTRA16x16(mb_type) ? 1 : 0; const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1); for (i = 0; i < 4; i++) { if ((cbp & (1 << i))) { for (j = 0; j < 4; j++) { k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j); h->non_zero_count_cache[ scan8[k] ] = 1; if (svq3_decode_block(&s->gb, &h->mb[16*k], index, type)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n"); return -1; } } } } if ((cbp & 0x30)) { for (i = 1; i < 3; ++i) { if (svq3_decode_block(&s->gb, &h->mb[16*16*i], 0, 3)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n"); return -1; } } if ((cbp & 0x20)) { for (i = 1; i < 3; i++) { for (j = 0; j < 4; j++) { k = 16*i + j; h->non_zero_count_cache[ scan8[k] ] = 1; if (svq3_decode_block(&s->gb, &h->mb[16*k], 1, 1)){ av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n"); return -1; } } } } } } h->cbp= cbp; s->current_picture.f.mb_type[mb_xy] = mb_type; if (IS_INTRA(mb_type)) { h->chroma_pred_mode = ff_h264_check_intra_pred_mode(h, DC_PRED8x8); } return 0; }
1threat
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) { AVFilterContext *ctx = inlink->dst; SeparateFieldsContext *sf = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *second; int i, ret; inpicref->height = outlink->h; inpicref->interlaced_frame = 0; second = av_frame_clone(inpicref); if (!second) return AVERROR(ENOMEM); for (i = 0; i < sf->nb_planes; i++) { if (!inpicref->top_field_first) inpicref->data[i] = inpicref->data[i] + inpicref->linesize[i]; else second->data[i] = second->data[i] + second->linesize[i]; inpicref->linesize[i] *= 2; second->linesize[i] *= 2; } inpicref->pts = outlink->frame_count * sf->ts_unit; ret = ff_filter_frame(outlink, inpicref); if (ret < 0) return ret; second->pts = outlink->frame_count * sf->ts_unit; return ff_filter_frame(outlink, second); }
1threat
Python2.7: new list from from a single column of existing list : Existing LIST columns: list Index([u'id', u'last_checkin', u'name'], dtype='object') New List: zlist for i in list: zhostname = i.get('name') #print zhostname if zhostname not in zlist: zlist.append(i) In 1st list there are multiple entries for the same host with a different last_checkin date. For the new list I am trying add to the list when hostname does not already exist. But the new list seems to be an exact copy of the first list. It is like it is not checking for only the host name in the new list. I do not care about the last_checkin date for either entry. How does it validate the entry if I am only checking the name of the host? i.e [if zhostname not in zlist: zlist.append(i)] So when it looks for the hostname in zlist is it also validating the other columns and sees it is different based on the whole row? Hopefully this is not clear as mud.
0debug
static void fpu_dump_state(CPUState *env, FILE *f, int (*fpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { int i; int is_fpu64 = !!(env->hflags & MIPS_HFLAG_F64); #define printfpr(fp) \ do { \ if (is_fpu64) \ fpu_fprintf(f, "w:%08x d:%016" PRIx64 \ " fd:%13g fs:%13g psu: %13g\n", \ (fp)->w[FP_ENDIAN_IDX], (fp)->d, \ (double)(fp)->fd, \ (double)(fp)->fs[FP_ENDIAN_IDX], \ (double)(fp)->fs[!FP_ENDIAN_IDX]); \ else { \ fpr_t tmp; \ tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX]; \ tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX]; \ fpu_fprintf(f, "w:%08x d:%016" PRIx64 \ " fd:%13g fs:%13g psu:%13g\n", \ tmp.w[FP_ENDIAN_IDX], tmp.d, \ (double)tmp.fd, \ (double)tmp.fs[FP_ENDIAN_IDX], \ (double)tmp.fs[!FP_ENDIAN_IDX]); \ } \ } while(0) fpu_fprintf(f, "CP1 FCR0 0x%08x FCR31 0x%08x SR.FR %d fp_status 0x%08x(0x%02x)\n", env->active_fpu.fcr0, env->active_fpu.fcr31, is_fpu64, env->active_fpu.fp_status, get_float_exception_flags(&env->active_fpu.fp_status)); for (i = 0; i < 32; (is_fpu64) ? i++ : (i += 2)) { fpu_fprintf(f, "%3s: ", fregnames[i]); printfpr(&env->active_fpu.fpr[i]); } #undef printfpr }
1threat
def greater_specificnum(list,num): greater_specificnum=all(x >= num for x in list) return greater_specificnum
0debug
Regenerate Web API key of Google Firebase : <p>How do I regnerate my Web API key for Google Firebase? I deleted the autogenerated one due to misguided reasons.</p> <p>If it's not deletable, do I need to create a just a new App or a new Project?</p>
0debug
static TypeImpl *type_register_internal(const TypeInfo *info) { TypeImpl *ti = g_malloc0(sizeof(*ti)); int i; g_assert(info->name != NULL); if (type_table_lookup(info->name) != NULL) { fprintf(stderr, "Registering `%s' which already exists\n", info->name); abort(); } ti->name = g_strdup(info->name); ti->parent = g_strdup(info->parent); ti->class_size = info->class_size; ti->instance_size = info->instance_size; ti->class_init = info->class_init; ti->class_base_init = info->class_base_init; ti->class_finalize = info->class_finalize; ti->class_data = info->class_data; ti->instance_init = info->instance_init; ti->instance_post_init = info->instance_post_init; ti->instance_finalize = info->instance_finalize; ti->abstract = info->abstract; for (i = 0; info->interfaces && info->interfaces[i].type; i++) { ti->interfaces[i].typename = g_strdup(info->interfaces[i].type); } ti->num_interfaces = i; type_table_add(ti); return ti; }
1threat
def shell_sort(my_list): gap = len(my_list) // 2 while gap > 0: for i in range(gap, len(my_list)): current_item = my_list[i] j = i while j >= gap and my_list[j - gap] > current_item: my_list[j] = my_list[j - gap] j -= gap my_list[j] = current_item gap //= 2 return my_list
0debug
Eroor in command django-admin manage.py make migrations : <p><a href="http://i.stack.imgur.com/GccvD.png" rel="nofollow">this is the entire output of this command then the output is looked like this.now as a beginner its very difficult for me to solve it </a></p>
0debug
Creating a new instance of a KClass : <p>I have a Kotlin class whose primary (and only) constructor is empty.</p> <p>I have a reference to this class:</p> <pre><code>val kClass: KClass&lt;MyClass&gt; = MyClass::class </code></pre> <p>How do I create an instance of this class using reflection?</p> <p>In Java I would do <code>myClass.newInstance()</code> but it seems in Kotlin I need to find the constructor first:</p> <pre><code>kClass.constructors.first().call() </code></pre> <p>I have seen mention of <code>primaryConstructor</code> in <a href="https://youtrack.jetbrains.com/issue/KT-6728" rel="noreferrer">some bug reports</a> but it's not showing up in my IDE.</p>
0debug
High CPU and RAM usage, how to know what is the cause? : <p>I am maintaining a cloud server (ubuntu 14, webuzo) on Amazon (AWS). Recently the usage of CPU and RAM are increasing high which cause the server going down.</p> <p>i thought there is an attact to the server, then i try to modify the security from the AWS console. I block all the ports, except for accessing the control panel of my hosting panel which i set it to only accept from my ip address.</p> <p>But still, the CPU and RAM usage is still high.</p> <p>I guess this is not caused from the outside(attact/flood), but it comes from inside the server.</p> <p>So the question is how to know or determine what is the cause?</p> <p>Regards</p>
0debug
Understanding SQL in depth : <p>at first i want to say sorry for the bad gramar, i dont speak or write in english with regularity. But here is the purpose of the question ,</p> <p>Im a newbie programer currently working in a company that develops heavy data-base oriented products, and due to these reasons im currently working on my knowledge to achieve more results and grow inside of the company and also get more close to achieve the excellence while coding. Most of my work actually focus on import some data from a data-base to another, having to treat these datas so it can fit the data base that will get the data. Since it normaly have a lot of rows and even archives data-bases that does requires very efficient query's to not lose any time , more and more often im seeing myself in a situation that i require more knowledge.</p> <p>Few weeks ago i started to understand a little more of how SQL works, and it does took off that beginner feelings of CRUD being a static sentence, specially after i started to put subquerys on the FROM and making some functions inside of select and prepared statements BUT STILL, it lacks of something to give the true enlightment to the coding art to understand NOT how it is writen but how and why it works .</p> <p>Its a very complicated question even for who asks and i cant even imagine how it is for who answers . If there is someone that understood my point of view and has pacience to answer this , i really believe that it will help a lot of peoples that got inside of SQL programing. Thank you.</p>
0debug
void cpu_outb(CPUState *env, pio_addr_t addr, uint8_t val) { LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val); ioport_write(0, addr, val); #ifdef CONFIG_KQEMU if (env) env->last_io_time = cpu_get_time_fast(); #endif }
1threat
def floor_Max(A,B,N): x = min(B - 1,N) return (A*x) // B
0debug
SFINAE works with deduction but fails with substitution : <p>Consider the following MCVE</p> <pre><code>struct A {}; template&lt;class T&gt; void test(T, T) { } template&lt;class T&gt; class Wrapper { using type = typename T::type; }; template&lt;class T&gt; void test(Wrapper&lt;T&gt;, Wrapper&lt;T&gt;) { } int main() { A a, b; test(a, b); // works test&lt;A&gt;(a, b); // doesn't work return 0; } </code></pre> <p>Here <code>test(a, b);</code> works and <code>test&lt;A&gt;(a, b);</code> fails with:</p> <pre><code>&lt;source&gt;:11:30: error: no type named 'type' in 'A' using type = typename T::type; ~~~~~~~~~~~~^~~~ &lt;source&gt;:23:13: note: in instantiation of template class 'Wrap&lt;A&gt;' requested here test&lt;A&gt;(a, b); // doesn't work ^ &lt;source&gt;:23:5: note: while substituting deduced template arguments into function template 'test' [with T = A] test&lt;A&gt;(a, b); // doesn't work </code></pre> <p><a href="https://gcc.godbolt.org/z/XLrOSX" rel="noreferrer">LIVE DEMO</a></p> <p><strong>Question:</strong> Why is that? Shouldn't SFINAE work during <em>substitution</em>? Yet here it seems to work during <em>deduction</em> only.</p>
0debug
static av_always_inline void predict(PredictorState *ps, int *coef, int output_enable) { const SoftFloat a = { 1023410176, 0 }; const SoftFloat alpha = { 973078528, 0 }; SoftFloat e0, e1; SoftFloat pv; SoftFloat k1, k2; SoftFloat r0 = ps->r0, r1 = ps->r1; SoftFloat cor0 = ps->cor0, cor1 = ps->cor1; SoftFloat var0 = ps->var0, var1 = ps->var1; SoftFloat tmp; if (var0.exp > 1 || (var0.exp == 1 && var0.mant > 0x20000000)) { k1 = av_mul_sf(cor0, flt16_even(av_div_sf(a, var0))); } else { k1.mant = 0; k1.exp = 0; } if (var1.exp > 1 || (var1.exp == 1 && var1.mant > 0x20000000)) { k2 = av_mul_sf(cor1, flt16_even(av_div_sf(a, var1))); } else { k2.mant = 0; k2.exp = 0; } tmp = av_mul_sf(k1, r0); pv = flt16_round(av_add_sf(tmp, av_mul_sf(k2, r1))); if (output_enable) { int shift = 28 - pv.exp; if (shift < 31) *coef += (pv.mant + (1 << (shift - 1))) >> shift; } e0 = av_int2sf(*coef, 2); e1 = av_sub_sf(e0, tmp); ps->cor1 = flt16_trunc(av_add_sf(av_mul_sf(alpha, cor1), av_mul_sf(r1, e1))); tmp = av_add_sf(av_mul_sf(r1, r1), av_mul_sf(e1, e1)); tmp.exp--; ps->var1 = flt16_trunc(av_add_sf(av_mul_sf(alpha, var1), tmp)); ps->cor0 = flt16_trunc(av_add_sf(av_mul_sf(alpha, cor0), av_mul_sf(r0, e0))); tmp = av_add_sf(av_mul_sf(r0, r0), av_mul_sf(e0, e0)); tmp.exp--; ps->var0 = flt16_trunc(av_add_sf(av_mul_sf(alpha, var0), tmp)); ps->r1 = flt16_trunc(av_mul_sf(a, av_sub_sf(r0, av_mul_sf(k1, e0)))); ps->r0 = flt16_trunc(av_mul_sf(a, e0)); }
1threat
Java Enum<T> vs T as variable type : <p>Is there any difference between this declaration</p> <pre><code>Thread.State state = Thread.State.NEW; </code></pre> <p>and that</p> <pre><code>Enum&lt;Thread.State&gt; state = Thread.State.NEW; </code></pre> <p>in Java? Instead of the second option is a bit longer?</p>
0debug
crm 2015 unsupported line of code - HTML Resource : I just did an upgrade from CRM 2011 to CRM 2015. I was just wondering if the below line of code is supported in CRM 2015. This piece of code is in a HTML resource. document.getElementById('crmGrid').parentElement.innerHTML=document.frames['grid'].document.getElementById('crmGrid').parentElement.innerHTML; Thanks in advance. Sam
0debug
How install font-awesome via bower : <p>I have just installed font-awesome via bower:</p> <pre><code>bower install font-awesome --save </code></pre> <p>And it appears to not add the CSS at the bower build. How can I install it?</p>
0debug
static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint32_t data; if (dev->pdev->msix_enabled) { g_assert_cmpint(dev->config_msix_entry, !=, -1); if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) { return qpci_msix_pending(dev->pdev, dev->config_msix_entry); } else { data = readl(dev->config_msix_addr); writel(dev->config_msix_addr, 0); return data == dev->config_msix_data; } } else { return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2; } }
1threat
static DisplayType select_display(const char *p) { const char *opts; DisplayType display = DT_DEFAULT; if (strstart(p, "sdl", &opts)) { #ifdef CONFIG_SDL display = DT_SDL; while (*opts) { const char *nextopt; if (strstart(opts, ",frame=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { no_frame = 0; } else if (strstart(opts, "off", &nextopt)) { no_frame = 1; } else { goto invalid_display; } } else if (strstart(opts, ",alt_grab=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { alt_grab = 1; } else if (strstart(opts, "off", &nextopt)) { alt_grab = 0; } else { goto invalid_display; } } else if (strstart(opts, ",ctrl_grab=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { ctrl_grab = 1; } else if (strstart(opts, "off", &nextopt)) { ctrl_grab = 0; } else { goto invalid_display; } } else if (strstart(opts, ",window_close=", &nextopt)) { opts = nextopt; if (strstart(opts, "on", &nextopt)) { no_quit = 0; } else if (strstart(opts, "off", &nextopt)) { no_quit = 1; } else { goto invalid_display; } } else { goto invalid_display; } opts = nextopt; } #else fprintf(stderr, "SDL support is disabled\n"); exit(1); #endif } else if (strstart(p, "vnc", &opts)) { #ifdef CONFIG_VNC display_remote++; if (*opts) { const char *nextopt; if (strstart(opts, "=", &nextopt)) { vnc_display = nextopt; } } if (!vnc_display) { fprintf(stderr, "VNC requires a display argument vnc=<display>\n"); exit(1); } #else fprintf(stderr, "VNC support is disabled\n"); exit(1); #endif } else if (strstart(p, "curses", &opts)) { #ifdef CONFIG_CURSES display = DT_CURSES; #else fprintf(stderr, "Curses support is disabled\n"); exit(1); #endif } else if (strstart(p, "none", &opts)) { display = DT_NONE; } else { invalid_display: fprintf(stderr, "Unknown display type: %s\n", p); exit(1); } return display; }
1threat
Pipenv: Command Not Found : <p>I'm new to Python development and attempting to use pipenv. I ran the command <code>pip install pipenv</code>, which ran successfully:</p> <pre><code>... Successfully built pipenv pathlib shutilwhich pythonz-bd virtualenv-clone Installing collected packages: virtualenv, pathlib, shutilwhich, backports.shutil-get-terminal-size, pythonz-bd, virtualenv-clone, pew, first, six, click, pip-tools, certifi, chardet, idna, urllib3, requests, pipenv ... </code></pre> <p>However, when I run the command <code>pipenv install</code> in a fresh root project directory I receive the following message: <code>-bash: pipenv: command not found</code>. I suspect that I might need to modify my .bashrc, but I'm unclear about what to add to the file or if modification is even necessary.</p>
0debug
Bash function argument parsing/regex : I want to have a function I can call from the command line that takes the following: $ command_name /some/path/file.java and turns into the following call: command /some/path:file So basically the part I'm having trouble with is substituting a ':' for the last '/' and stripping the file extension.
0debug
static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i; if(buf+16>=buf_end) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); if (s->avctx->width!=s->width || s->avctx->height!=s->height) avcodec_set_dimensions(s->avctx, s->width, s->height); s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf+2<buf_end; i++) { s->palette[i] = AV_RB24(buf); buf += 3; } }
1threat
Python - Repeat counter when index ends : Simple question - i want a loop that counts up and returns to 0 when it reaches a certain number. tried something like while i < 7: i += 1 if i == 7 i -= 1 #(or change i in any other way - you get the idea) My Python actually crashed when i tried the above.
0debug
Regex to accept any 3 combinations is must but no space : I wanted to allow regex to accept minimum of 8 characters and any 3 combinations out of following 4 categories. 1. One uppercase alpha character 2. One lowercase alpha character 3. One numeric character 4. One special character The good thing is, there are many regex available for my requirement but most of them allows **space**. I got this [Regex][1] from [here][2]. I tried to modify this in several ways but I couldn't succeed in writing a proper regex to validate a space along with 3 combinations as i mentioned above. [1]: https://regex101.com/r/vB7eF3/6 [2]: http://stackoverflow.com/questions/5950756/regex-for-checking-that-at-least-3-of-4-different-character-groups-exist
0debug
Hide header in stack navigator React navigation : <p>I'm trying to switch screen using both stack and tab navigator.</p> <pre><code>const MainNavigation = StackNavigator({ otp: { screen: OTPlogin }, otpverify: { screen: OTPverification}, userVerified: { screen: TabNavigator({ List: { screen: List }, Settings: { screen: Settings } }), }, }); </code></pre> <p>In this case stacknavigator is used first and then tabnavigator. and i want to hide headers of stack navigator. WIt is not working properly when i use navigationoptions like::</p> <pre><code>navigationOptions: { header: { visible: false } } </code></pre> <p>i'm trying this code on first two components which are using in stacknavigator. if i use this line then getting some error like:: </p> <p><a href="https://i.stack.imgur.com/DzbD0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DzbD0.png" alt="enter image description here"></a></p>
0debug
how do i get exact row index in datagridview on selecting the row n pressing enter : when i select the first row im getting the row index as 1 which must be 0 if im not wrong n 2 on selecting both 2nd n 3rd row. private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { r = this.dataGridView1.SelectedRows[0].Index; } } private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { p = p+1; if (p == 1) { if (this.dataGridView1.SelectedRows.Count > 0) { brand = dataGridView1.Rows[r].Cells[0].Value.ToString(); datadisp(); } } } }
0debug
Returning ES6 Proxy from the ES6 class constructor : <p>I want user to only set specific properties to an object but as the same time that object should be constructed from custom class.</p> <p>For example</p> <pre><code>var row = new Row({ name : 'John Doe', email : 'uhiwarale@gmail.com' }, Schema); </code></pre> <p><code>row</code> can have methods. But when user is trying to set <code>row.password</code>, they are not allowed.</p> <p>One way to do it is using <code>new Proxy</code> instead of <code>new Row</code> but then we will loose all cool things we are doing inside <code>Row</code> class. I want <code>new Row</code> to return a proxy object with <code>this</code> reference as a target of proxy.</p> <p>Anybody have any ideas on this? If you know <code>mongoose</code>, how <code>mongoose</code> is doing it?</p>
0debug
void mkimg(const char *file, const char *fmt, unsigned size_mb) { gchar *cli; bool ret; int rc; GError *err = NULL; char *qemu_img_path; gchar *out, *out2; char *abs_path; qemu_img_path = getenv("QTEST_QEMU_IMG"); abs_path = realpath(qemu_img_path, NULL); assert(qemu_img_path); cli = g_strdup_printf("%s create -f %s %s %uM", abs_path, fmt, file, size_mb); ret = g_spawn_command_line_sync(cli, &out, &out2, &rc, &err); if (err) { fprintf(stderr, "%s\n", err->message); g_error_free(err); } g_assert(ret && !err); if (rc) { fprintf(stderr, "qemu-img returned status code %d\n", rc); } g_assert(!rc); g_free(out); g_free(out2); g_free(cli); free(abs_path); }
1threat
Declaring defaulted assignment operator as constexpr: which compiler is right? : <p>Consider</p> <pre><code>struct A1 { constexpr A1&amp; operator=(const A1&amp;) = default; ~A1() {} }; struct A2 { constexpr A2&amp; operator=(const A2&amp;) = default; ~A2() = default; }; struct A3 { ~A3() = default; constexpr A3&amp; operator=(const A3&amp;) = default; }; </code></pre> <p>GCC and MSVC accept all three structs. Clang rejects <code>A1</code> and <code>A2</code> (but accepts <code>A3</code>), with the following error message:</p> <blockquote> <pre><code>&lt;source&gt;:2:5: error: defaulted definition of copy assignment operator is not constexpr constexpr A1&amp; operator=(const A1&amp;) = default; ^ &lt;source&gt;:6:5: error: defaulted definition of copy assignment operator is not constexpr constexpr A2&amp; operator=(const A2&amp;) = default; ^ 2 errors generated. </code></pre> </blockquote> <p>(<a href="https://godbolt.org/z/ZBUrMJ" rel="noreferrer">live demo</a>)</p> <p>Which compiler is correct, and why?</p>
0debug
generate list of quarters betweeen given dates : <p>I need to get the list of quarters between the given dates in python.</p> <p>For example: start_date = March 2012 , end_date = June 2013</p> <p>Expected output: </p> <pre><code>['March 2012', 'June 2012', 'September 2012', 'December 2012', 'March 2013', 'June 2013'] </code></pre> <p>I checked other threads like <a href="https://stackoverflow.com/questions/33160952/generate-time-series-by-quarter-increment-by-one-quarter">generate time series by quarter, increment by one quarter</a> but my requirement is little different. I need it in the exact same format as mentioned above. </p>
0debug
static int theora_header(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; TheoraParams *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; int err; uint8_t *cdp; if (!(os->buf[os->pstart] & 0x80)) return 0; if (!thp) { thp = av_mallocz(sizeof(*thp)); if (!thp) return AVERROR(ENOMEM); os->private = thp; } switch (os->buf[os->pstart]) { case 0x80: { GetBitContext gb; AVRational timebase; init_get_bits(&gb, os->buf + os->pstart, os->psize * 8); skip_bits_long(&gb, 7 * 8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return AVERROR(ENOSYS); } st->codec->width = get_bits(&gb, 16) << 4; st->codec->height = get_bits(&gb, 16) << 4; if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { int width = get_bits_long(&gb, 24); int height = get_bits_long(&gb, 24); if (width <= st->codec->width && width > st->codec->width - 16 && height <= st->codec->height && height > st->codec->height - 16) { st->codec->width = width; st->codec->height = height; } skip_bits(&gb, 16); } timebase.den = get_bits_long(&gb, 32); timebase.num = get_bits_long(&gb, 32); if (!(timebase.num > 0 && timebase.den > 0)) { av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n"); timebase.num = 1; timebase.den = 25; } avpriv_set_pts_info(st, 64, timebase.num, timebase.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_THEORA; st->need_parsing = AVSTREAM_PARSE_HEADERS; } break; case 0x81: ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 7); case 0x82: if (!thp->version) return AVERROR_INVALIDDATA; break; default: av_log(s, AV_LOG_ERROR, "Unknown header type %X\n", os->buf[os->pstart]); return AVERROR_INVALIDDATA; } if ((err = av_reallocp(&st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { st->codec->extradata_size = 0; return err; } cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy(cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1; }
1threat
Getting the same subplot size using matplotlib imshow and scatter : <p>I am trying to plot an image (using <code>matplotlib.imshow</code>) and a scatter plot within the same figure. When trying this, the image appears smaller than the scatter plot. Small example code is shown below:</p> <pre><code>import matplotlib.pyplot as plt import numpy as np image = np.random.randint(100,200,(200,200)) x = np.arange(0,10,0.1) y = np.sin(x) fig, (ax1, ax2) = plt.subplots(1,2) ax1.imshow(image) ax2.scatter(x,y) plt.show() </code></pre> <p>Which gives the following figure:</p> <p><a href="https://i.stack.imgur.com/zkHti.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zkHti.png" alt="enter image description here"></a></p> <p>How can I get the two sublpots to have the same height? (and width I suppose)</p> <p>I have tried using <a href="http://matplotlib.org/users/gridspec.html" rel="noreferrer"><code>gridspec</code></a> as shown in <a href="https://stackoverflow.com/questions/10388462/matplotlib-different-size-subplots">this</a> answer:</p> <pre><code>fig=plt.figure() gs=GridSpec(1,2) ax1=fig.add_subplot(gs[0,0]) ax2=fig.add_subplot(gs[0,1]) ax1.imshow(image) ax2.scatter(x,y) </code></pre> <p>But this gives the same result. I have also tried to adjust the subplot sizes manually by using:</p> <pre><code>fig = plt.figure() ax1 = plt.axes([0.05,0.05,0.45,0.9]) ax2 = plt.axes([0.55,0.19,0.45,0.62]) ax1.imshow(image) ax2.scatter(x,y) </code></pre> <p>By trial and error I can get the two subplots to the correct size, though any change in the overall figure size will mean that the subplots will no longer be the same size.</p> <p>Is there a way to make <code>imshow</code> and a <code>scatter</code> plot appear the same size in a figure without manually changing the axes sizes?</p> <p>I am using Python 2.7 and matplotlib 2.0.0</p>
0debug
Elixir + Ecto: How to do WHERE NOT IN [array]? : <p>I am trying to look for all <code>User</code>s that don't have a certain string element in their <code>match_history</code> field. I took a guess with this:</p> <p><code>matched_user = User |&gt; where([u], ^device_id not in u.match_history) |&gt; limit(1) |&gt; VideoChat.Repo.one</code></p> <p>But it seems to break at the <code>not</code> part. Is there a way to do this?</p>
0debug
How to make parse object to json using retrofit : <p>with the next problem, when trying to consume a webservice, then message and presentation;</p> <p>Expected BEGIN_ARRAY but was BEGIN_OBJECT</p> <p>I'm not sure how to make a scenario, I've already got data from a webservice, but when it's not a simple array.</p> <p>I have tried many alternatives, but without success.</p> <p><strong>response api</strong></p> <pre><code> { "_links": { "self": { "href": "http://url.com/service?page=1" }, "first": { "href": "http://url.com/service" }, "last": { "href": "http://url.com/service?page=1" } }, "_embedded": { "data": [ { "id": 1, "nome": "teste", "_links": { "self": { "href": "http://url.com/service/1" } } }, { "id": 2, "nome": "teste 2", "_links": { "self": { "href": "http://url.com/service/2" } } } ] }, "page_count": 1, "page_size": 25, "total_items": 2, "page": 1 } </code></pre> <p><strong>Client</strong></p> <pre><code>public class ApiClient { private static final String BASE_URL = "http://url.com/"; private static Retrofit getClient() { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build(); Gson gson = new GsonBuilder().setLenient().create(); return new Retrofit.Builder() .baseUrl(BASE_URL) .client(client) .addConverterFactory(GsonConverterFactory.create(gson)) .build(); } /** * Get API Service * * @return API Service */ public static ApiInterface getApiService() { return getClient().create(ApiInterface.class); } } </code></pre> <p><strong>Interface</strong></p> <pre><code>/** * Class ApiInterface */ public interface ApiInterface { @Headers("Accept: application/json") @GET("/service") Call&lt;ArrayList&lt;ServiceData&gt;&gt; getData(); } </code></pre> <p><strong>Service</strong></p> <pre><code>public class Service{ @SerializedName("data") private ArrayList&lt;ServiceData&gt; service = new ArrayList&lt;&gt;(); } </code></pre> <p><strong>Service Data</strong></p> <pre><code>public class ServiceData { @SerializedName("id") private int id; public ServiceData(int id, String nome) { this.id = id; } public int getId() { return id; } } </code></pre> <p><strong>Activity</strong></p> <pre><code> final Call&lt;ArrayList&lt;ServiceData&gt;&gt; service = apiService.getService(); service.enqueue(new Callback&lt;ArrayList&lt;ServiceData&gt;&gt;() { @Override public void onResponse(Call&lt;ArrayList&lt;ServiceData&gt;&gt; call, Response&lt;ArrayList&lt;ServiceData&gt;&gt; response) { Log.e(TAG, "" + response.body()); } @Override public void onFailure(Call&lt;ArrayList&lt;ServiceData&gt;&gt; call, Throwable t) { Log.e(TAG, "" + t); } }); </code></pre>
0debug
static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) { AVStream *st = s->streams[1]; int av_unused tmp, tmp2; int samples, size; uint64_t pos = avio_tell(s->pb); unsigned dts; int ret; dts = avio_rb32(s->pb); st->codec->sample_rate = avio_rb32(s->pb); samples = avio_rb32(s->pb); tmp = avio_rb32(s->pb); av_dlog(s, "packet num %d\n", tmp); tmp = avio_rb16(s->pb); av_dlog(s, "unknown %d\n", tmp); tmp = avio_r8(s->pb); tmp2 = avio_r8(s->pb); av_dlog(s, "version %d.%d\n", tmp, tmp2); tmp = avio_rb32(s->pb); av_dlog(s, "unknown %d\n", tmp); size = atom->size - 8 - (avio_tell(s->pb) - pos); if (size < 0) return -1; ret = av_get_packet(s->pb, pkt, size); if (ret < 0) { av_log(s, AV_LOG_ERROR, "error reading audio packet\n"); return ret; } pkt->stream_index = 1; pkt->dts = dts; pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate); av_dlog(s, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n", pkt->dts, pkt->duration, samples, st->codec->sample_rate); return 0; }
1threat
Como acceder al contenido de un xml desde xsl : Hola estoy intentando transformar un archivo xml con otro archivo xsl, lo que pretendo es hacer una tabla con todos los apartados del xml, pero hay dos apartados "complexity" y "subjet" que no se como conseguir su valor este es mi codigo xml: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="../xsl/showQue``stions.xsl"?> <assessmentItems> <assessmentItem complexity="3" subject="mikologia"> <itemBody> <p>Zein Amanita da jangarria?</p> </itemBody> <correctResponse> <value>Caesarea</value> </correctResponse> <incorrectResponses> <value>Phalloides</value> <value>Muscaria</value> <value>Virosa</value> </incorrectResponses> </assessmentItem> <assessmentItem complexity="3" subject="mikologia"> <itemBody> <p>Tripakiek zer dute kapela azpian?</p> </itemBody> <correctResponse> <value>Eztenak</value> </correctResponse> <incorrectResponses> <value>Filamenduak</value> <value>Himenioa</value> <value>Hodiak</value> </incorrectResponses> </assessmentItem> <assessmentItem complexity="5" subject="mikologia"> <itemBody> <p>Eranztuna du</p> </itemBody> <correctResponse> <value>Galanpernak</value> </correctResponse> <incorrectResponses> <value>Gibel urdinak</value> <value>Esnegorriak</value> <value>Errotariak</value> </incorrectResponses> </assessmentItem> </assessmentItems> y este es mi codigo xsl: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <HTML> <BODY> <h2>Galderak</h2> <TABLE border="1"> <TR> <TH>Testua</TH> <TH>Erantzun zuzena</TH> <TH>Erantzun okerrak</TH> <TH>Zailtasuna</TH> <TH>Arloa</TH> </TR> <xsl:for-each select="/assessmentItems/assessmentItem" > <TR> <TD><FONT SIZE="2" COLOR="red" FACE="Verdana"> <xsl:value-of select="itemBody/p"/> <BR/> </FONT> </TD> <TD><FONT SIZE="2" COLOR="orange" FACE="Verdana"> <xsl:value-of select="correctResponse"/> <BR/> </FONT> </TD> <TD> <FONT SIZE="2" COLOR="pink" FACE="Verdana"> <xsl:value-of select="incorrectResponses/value[1]"/><BR/> <xsl:value-of select="incorrectResponses/value[2]"/> <BR/> <xsl:value-of select="incorrectResponses/value[3]"/> <BR/> </FONT> </TD> <TD><FONT SIZE="2" COLOR="green" FACE="Verdana"> <xsl:value-of select="complexity"/> <BR/> </FONT> </TD> <TD><FONT SIZE="2" COLOR="blue" FACE="Verdana"> <xsl:atribute select="subject"/> <BR/> </FONT> </TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML></xsl:template> </xsl:stylesheet> En la tabla me aparece todo como es debido, menos esos dos apartados y no tengo ni idea de como acceder a ellos. Si alguno sabe como lo agradeceria muchisimo.
0debug
Debug apk instalation error in other mobiles : I want share my debug apk to testing team for testing. here app-debug.apk will trow error while installing in other mobiles. I have connect my mobile(MI note 4) to USB and install success. But when i was copy apk from ....\app\build\outputs\apk\debug path, that apk will throw error. like below [![enter image description here][1]][1] [![MY Android studio][2]][2] My Android studio [1]: https://i.stack.imgur.com/ew3hT.png [2]: https://i.stack.imgur.com/HmeQ9.png
0debug
Javascript Vanilla - Double Click event handler on inputs / GetEelemntsByTagName : **Problem:** Can't assign a double click event handler to my generated inputs; is this feasable using the getEelementsByTagName? Thanks for any help Here is the code: **Generated inputs** function list_tasks() { let container = document.getElementById("todo"); container.innerHTML = "" if (task_array.length > 0) { for (let i = 0; i < task_array.length; i++) { let input = document.createElement("input"); input.value = task_array[i]; input.classList.add("record"); input.disabled = true; container.appendChild(input); } } } **Attaching the event** document.getElementsByClassName("record").addEventListener("dblclick", editTask); **And the console.log is never called** function editTask(e){ console.log("double click") }
0debug
add kotlin code in java code in android; error: : I am trying to call kotlin code from java code inandroid. I got the code from Internet. I get error :org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugKotlin'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: org.gradle.api.GradleException: Compilation error. See log for more details at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:16) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:429) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:390) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:274) at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:233) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) ... 32 more my Build.gradle(Project:xyz) file is-> // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.2.50' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir } my build.gradle(Module:App)file is-> apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { compileSdkVersion 26 defaultConfig { applicationId "com.example.root.securityalert" minSdkVersion 23 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } buildToolsVersion '27.0.3' } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation 'com.android.support:design:26.1.0' implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' implementation 'io.reactivex.rxjava2:rxjava:2.1.16' implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } repositories { mavenCentral() }
0debug
How coudl messages get out of sequence? : I have used QuickFix/.NET for a long time but in last 2 days the engine appears to have sent messages out of sequence twice. Here is an example, the 3rd message is out of sequence: 20171117-14:44:34.627 : 8=FIX.4.4 9=70 35=0 34=6057 49=TRD 52=20171117-14:44:34.622 56=SS 10=208 20171117-14:44:34.635 : 8=FIX.4.4 9=0070 35=0 34=6876 49=SS 56=TRD 52=20171117-14:44:34.634 10=060 20171117-14:45:04.668 : 8=FIX.4.4 9=224 35=D 34=6059 49=TRD 52=20171117-14:45:04.668 56=SS 11=AGG-171117T095204000182 38=100000 40=D 44=112.402 54=2 55=USD/XXX 59=3 60=20171117-09:45:04.647 278=2cK-3ovrjdrk00X1j8h03+ 10=007 20171117-14:45:04.668 : 8=FIX.4.4 9=70 35=0 34=6058 49=TRD 52=20171117-14:45:04.642 56=SS 10=209 I understand that the QuickFix logger is not on a separate thread. What could cause this to happen?
0debug
Word file in bash script meaning : I have a line in bush script for i in 'ls /sbin'; do file /spin/$i | grew ASCII ;done Could somebody let me know what we have word file for?
0debug
visual studio c# .php ,i am able to store image in database but how to display image : This part of the code is upload image into the database and save but how do i retrieve the image and display? Below are the code that i have done . <!doctype html> <html> <head> <?php include("config.php"); if(isset($_POST['but_upload'])){ $name = $_FILES['file']['name']; $target_dir = "upload/"; $target_file = $target_dir . basename($_FILES["file"]["name"]); // Select file type $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Valid file extensions $extensions_arr = array("jpg","jpeg","png","gif"); // Check extension if( in_array($imageFileType,$extensions_arr) ){ // Convert to base64 $image_base64 = base64_encode(file_get_contents($_FILES['file']['tmp_name']) ); $image = 'data:image/'.$imageFileType.';base64,'.$image_base64; // Insert record $query = "insert into images(name,image) values('".$name."','".$image."')"; mysqli_query($con,$query) or die(mysqli_error($con)); // Upload file move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$name); } } ?> <body> <form method="post" action="" enctype='multipart/form-data'> <input type='file' name='file' /> <input type='submit' value='Save name' name='but_upload'> </form> </body> </html> The above code i got this from a website call http://makitweb.com/upload-and-store-an-image-in-the-database-with-php/ below this line is the code i do not know where to add where do i add the below code can help me edit? <?php $sql = "select image from images where id=1"; $result = mysqli_query($con,$sql); $row = mysqli_fetch_array($result); $image_src2 = $row['image']; ?> <img src='<?php echo $image_src; ?>' >
0debug
How to use native android webview in Qt C++ using QAndroidJniObject : <p>I would like to use the Android WebView in my qml application. The default WebView object provided uses native rendering but several features are missing (for example the ability to intercept network requests and block them). I know that Qt allows you to call native Java API using QAndroidJniObject. Is it possible to use that to create a Qt wrapper around the native Android WebView? If yes, how can I achieve that? </p>
0debug
int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) { ASFContext *asf = s->priv_data; ASFStream *asf_st = 0; for (;;) { if(url_feof(pb)) return AVERROR_EOF; if (asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1) { int ret = asf->packet_size_left + asf->packet_padsize; assert(ret>=0); url_fskip(pb, ret); asf->packet_pos= url_ftell(pb); if (asf->data_object_size != (uint64_t)-1 && (asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) return AVERROR(EIO); return 1; } if (asf->packet_time_start == 0) { if(asf_read_frame_header(s, pb) < 0){ asf->packet_segments= 0; continue; } if (asf->stream_index < 0 || s->streams[asf->stream_index]->discard >= AVDISCARD_ALL || (!asf->packet_key_frame && s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY) ) { asf->packet_time_start = 0; url_fskip(pb, asf->packet_frag_size); asf->packet_size_left -= asf->packet_frag_size; if(asf->stream_index < 0) av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size); continue; } asf->asf_st = s->streams[asf->stream_index]->priv_data; } asf_st = asf->asf_st; if (asf->packet_replic_size == 1) { asf->packet_frag_timestamp = asf->packet_time_start; asf->packet_time_start += asf->packet_time_delta; asf->packet_obj_size = asf->packet_frag_size = get_byte(pb); asf->packet_size_left--; asf->packet_multi_size--; if (asf->packet_multi_size < asf->packet_obj_size) { asf->packet_time_start = 0; url_fskip(pb, asf->packet_multi_size); asf->packet_size_left -= asf->packet_multi_size; continue; } asf->packet_multi_size -= asf->packet_obj_size; } if( asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size && asf_st->frag_offset + asf->packet_frag_size > asf->packet_obj_size){ av_log(s, AV_LOG_INFO, "ignoring invalid packet_obj_size (%d %d %d %d)\n", asf_st->frag_offset, asf->packet_frag_size, asf->packet_obj_size, asf_st->pkt.size); asf->packet_obj_size= asf_st->pkt.size; } if ( asf_st->pkt.size != asf->packet_obj_size || asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) { if(asf_st->pkt.data){ av_log(s, AV_LOG_INFO, "freeing incomplete packet size %d, new %d\n", asf_st->pkt.size, asf->packet_obj_size); asf_st->frag_offset = 0; av_free_packet(&asf_st->pkt); } av_new_packet(&asf_st->pkt, asf->packet_obj_size); asf_st->seq = asf->packet_seq; asf_st->pkt.dts = asf->packet_frag_timestamp; asf_st->pkt.stream_index = asf->stream_index; asf_st->pkt.pos = asf_st->packet_pos= asf->packet_pos; if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) asf->packet_key_frame = 1; if (asf->packet_key_frame) asf_st->pkt.flags |= PKT_FLAG_KEY; } asf->packet_size_left -= asf->packet_frag_size; if (asf->packet_size_left < 0) continue; if( asf->packet_frag_offset >= asf_st->pkt.size || asf->packet_frag_size > asf_st->pkt.size - asf->packet_frag_offset){ av_log(s, AV_LOG_ERROR, "packet fragment position invalid %u,%u not in %u\n", asf->packet_frag_offset, asf->packet_frag_size, asf_st->pkt.size); continue; } get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, asf->packet_frag_size); if (s->key && s->keylen == 20) ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset, asf->packet_frag_size); asf_st->frag_offset += asf->packet_frag_size; if (asf_st->frag_offset == asf_st->pkt.size) { if( s->streams[asf->stream_index]->codec->codec_id == CODEC_ID_MPEG2VIDEO && asf_st->pkt.size > 100){ int i; for(i=0; i<asf_st->pkt.size && !asf_st->pkt.data[i]; i++); if(i == asf_st->pkt.size){ av_log(s, AV_LOG_DEBUG, "discarding ms fart\n"); asf_st->frag_offset = 0; av_free_packet(&asf_st->pkt); continue; } } if (asf_st->ds_span > 1) { if(asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span){ av_log(s, AV_LOG_ERROR, "pkt.size != ds_packet_size * ds_span (%d %d %d)\n", asf_st->pkt.size, asf_st->ds_packet_size, asf_st->ds_span); }else{ uint8_t *newdata = av_malloc(asf_st->pkt.size); if (newdata) { int offset = 0; while (offset < asf_st->pkt.size) { int off = offset / asf_st->ds_chunk_size; int row = off / asf_st->ds_span; int col = off % asf_st->ds_span; int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size); memcpy(newdata + offset, asf_st->pkt.data + idx * asf_st->ds_chunk_size, asf_st->ds_chunk_size); offset += asf_st->ds_chunk_size; } av_free(asf_st->pkt.data); asf_st->pkt.data = newdata; } } } asf_st->frag_offset = 0; *pkt= asf_st->pkt; asf_st->pkt.size = 0; asf_st->pkt.data = 0; break; } } return 0; }
1threat
C++ Functions with struct and vectors : <p>I just finished a program that reads a CSV file and outputs the rows using structs and vectors. My question involves these specific lines:</p> <pre><code>displayBid(bids[i]); void displayBid(Bid bid) { cout &lt;&lt; bid.title &lt;&lt; " | " &lt;&lt; bid.amount &lt;&lt; " | " &lt;&lt; bid.fund &lt;&lt; endl; return; } </code></pre> <p>I am not sure if I am thinking about this correctly, but how is displayBid able to take in a vector as a parameter? The displayBid function takes in a struct called of Bid type. Originally I could not get the code to compile because I was trying displayBid(bid) and I got a scope error. I figured the displayBid function would need to take in a struct instead of a vector. Thanks.</p> <p>Source:</p> <pre><code>#include &lt;algorithm&gt; #include &lt;iostream&gt; #include &lt;time.h&gt; // FIXME (1): Reference the CSVParser library #include "CSVparser.hpp" using namespace std; // forward declarations double strToDouble(string str, char ch); struct Bid { string title; string fund; double amount; // Set default bid amount to 0.0 Bid() { amount = 0.0; } }; /** * Display the bid information * * @param bid struct containing the bid info */ void displayBid(Bid bid) { cout &lt;&lt; bid.title &lt;&lt; " | " &lt;&lt; bid.amount &lt;&lt; " | " &lt;&lt; bid.fund &lt;&lt; endl; return; } /** * Prompt user for bid information * * @return Bid struct containing the bid info */ Bid getBid() { Bid bid; cout &lt;&lt; "Enter title: "; cin.ignore(); getline(cin, bid.title); cout &lt;&lt; "Enter fund: "; cin &gt;&gt; bid.fund; cout &lt;&lt; "Enter amount: "; cin.ignore(); string strAmount; getline(cin, strAmount); bid.amount = strToDouble(strAmount, '$'); return bid; } /** * Load a CSV file containing bids into a container * * @param csvPath the path to the CSV file to load * @return a container holding all the bids read */ vector&lt;Bid&gt; loadBids(string csvPath) { // FIXME (2): Define a vector data structure to hold a collection of bids. vector&lt;Bid&gt; bids; // initialize the CSV Parser using the given path csv::Parser file = csv::Parser(csvPath); // loop to read rows of a CSV file for (int i = 0; i &lt; file.rowCount(); i++) { // FIXME (3): create a data structure to hold data from each row and add to vector Bid bid; bid.title = file[i][0]; bid.fund = file[i][8]; //Convert to double and take out $ bid.amount = strToDouble(file[i][4], '$'); bids.push_back(bid); } return bids; } /** * Simple C function to convert a string to a double * after stripping out unwanted char * * credit: http://stackoverflow.com/a/24875936 * * @param ch The character to strip out */ double strToDouble(string str, char ch) { str.erase(remove(str.begin(), str.end(), ch), str.end()); return atof(str.c_str()); } /** * The one and only main() method */ int main(int argc, char* argv[]) { // process command line arguments string csvPath; switch (argc) { case 2: csvPath = argv[1]; break; default: csvPath = "eBid_Monthly_Sales_Dec_2016.csv"; } // FIXME (4): Define a vector to hold all the bids vector&lt;Bid&gt; bids; // FIXME (7a): Define a timer variable clock_t timer; int choice = 0; while (choice != 9) { cout &lt;&lt; "Menu:" &lt;&lt; endl; cout &lt;&lt; " 1. Enter a Bid" &lt;&lt; endl; cout &lt;&lt; " 2. Load Bids" &lt;&lt; endl; cout &lt;&lt; " 3. Display All Bids" &lt;&lt; endl; cout &lt;&lt; " 9. Exit" &lt;&lt; endl; cout &lt;&lt; "Enter choice: "; cin &gt;&gt; choice; switch (choice) { case 1: cout &lt;&lt; "Not currently implemented." &lt;&lt; endl; break; case 2: // FIXME (7b): Initialize a timer variable before loading bids timer = clock(); // FIXME (5): Complete the method call to load the bids bids = loadBids(csvPath); // FIXME (7c): Calculate elapsed time and display result timer = clock() - timer; cout &lt;&lt; bids.size() &lt;&lt; " bids loaded" &lt;&lt; endl; cout &lt;&lt; "time: " &lt;&lt; (float)timer/CLOCKS_PER_SEC * 1000 &lt;&lt; " milliseconds" &lt;&lt; endl; cout &lt;&lt; "time: " &lt;&lt; (float)timer/CLOCKS_PER_SEC &lt;&lt; " seconds" &lt;&lt; endl; break; case 3: // FIXME (6): Loop and display the bids read for (int i = 0; i &lt; bids.size(); ++i) { displayBid(bids[i]); } cout &lt;&lt; endl; break; } } cout &lt;&lt; "Good bye." &lt;&lt; endl; return 0; } </code></pre>
0debug
Displaying text when hovering over first list item in a un ordered list : <p>If I have a li inside a ul and some hidden text on a page, how can I show that text when the user hovers over the first li in the ul?</p> <p>I don't care if this is in CSS or JS, the text just has to appear only when hovering on the first itel in the list and no others. So when I hover over coffee, "hidden text" is visible</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul&gt; &lt;li&gt;Coffee&lt;/li&gt; &lt;li&gt;Tea&lt;/li&gt; &lt;li&gt;Milk&lt;/li&gt; &lt;/ul&gt; &lt;label style="display: none"&gt;hidden text&lt;/label&gt;</code></pre> </div> </div> </p>
0debug
Optimal way to cover a complete are making searching by zipcoe : I want to make a search by zip code, which is defined by polygons like in the picture below: [![enter image description here][1]][1] The thing is that actually, I can not make the search on the zip codes itself but in an area from the centroid of that zip code, for example for the zipcode 4, this area touch 1,2 and 5 as well. [![enter image description here][2]][2] In the same way, the search for 1 with take the results from 2,3,4 and 6 as well. Hence to avoid getting duplicates I want to take find out with are the zipcodes with whch I can get all the results with the less number of searches, say take 4, and 6 [![enter image description here][3]][3] [![enter image description here][4]][4] Instead of 2,5 and 6 [![enter image description here][5]][5] How can I approach this problem? [1]: https://i.stack.imgur.com/Wa4vF.png [2]: https://i.stack.imgur.com/jvVpf.png [3]: https://i.stack.imgur.com/ipyVz.png [4]: https://i.stack.imgur.com/3a1x5.png [5]: https://i.stack.imgur.com/ivl1M.png
0debug
react-fontawesome not displaying icons : <p>I'm attempting to using react-fontawesome and implementing it in what seems to me to be exactly the same as the readme: <a href="https://github.com/danawoodman/react-fontawesome/blob/master/readme.md" rel="noreferrer">https://github.com/danawoodman/react-fontawesome/blob/master/readme.md</a></p> <pre><code>import React from 'react'; import FontAwesome from 'react-fontawesome' ... export default class ComponentName extends React.Component { render() { return ( &lt;div&gt; &lt;div&gt; &lt;span&gt; &lt;FontAwesome className='super-crazy-colors' name='rocket' size='2x' spin style={{ textShadow: '0 1px 0 rgba(0, 0, 0, 0.1)' }} /&gt; SOME TEXT &lt;/span&gt; &lt;/div&gt; ... &lt;/div&gt; ) } } </code></pre> <p>But I'm not seeing an icon in the DOM. Although I do see in the Chrome Dev Tools:</p> <pre><code>&lt;span style="text-shadow:0 1px 0 rgba(0, 0, 0, 0.1);" aria-hidden="true" class="fa fa-rocket fa-2x fa-spin super-crazy-colors" data-reactid=".0.$/=11.0.0.$/=10.$/=10.$/=10"&gt;&lt;/span&gt; </code></pre> <p>which I feel like should be a <code>&lt;i&gt;</code> tag. I tried changing the <code>&lt;span&gt;...&lt;/span&gt;</code> to an <code>&lt;i&gt;...&lt;/i&gt;</code> in "edit as HTML" in the dev tools and the icon still didn't show.</p> <p>I have add-module-exports in my plugins and stage-2 in my presets in my webpack.config.</p> <p>Can anyone tell me if I'm missing something? Do I need some other package other than react-fontawesome to make this work? Do I need to import the standard font-awesome.css or load a font-awesome CDN? Any help would be greatly appreciated, thanks!</p>
0debug
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int frame_size; *pnum = 0; *pden = 0; switch(st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: if (st->avg_frame_rate.num) { *pnum = st->avg_frame_rate.den; *pden = st->avg_frame_rate.num; } else if(st->time_base.num*1000LL > st->time_base.den) { *pnum = st->time_base.num; *pden = st->time_base.den; }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){ *pnum = st->codec->time_base.num; *pden = st->codec->time_base.den; if (pc && pc->repeat_pict) { *pnum = (*pnum) * (1 + pc->repeat_pict); } if(st->codec->ticks_per_frame>1 && !pc){ *pnum = *pden = 0; } } break; case AVMEDIA_TYPE_AUDIO: frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0); if (frame_size <= 0 || st->codec->sample_rate <= 0) break; *pnum = frame_size; *pden = st->codec->sample_rate; break; default: break; } }
1threat
How to develop antivirus, I want a book for reference : <p>I want to develop antivirus software but I do not know how to make.</p> <p>I tried to search book of antivirus SW, but there's no book for reference.</p> <p>If you know the good reference to develop antivirus SW, plz let me know.</p>
0debug
UIAlertContoller Texfield width iOS 9 : I have this problem while running my project that uses PixateFreestyle in iOS 9; As you can see in the image below, for some reason TextField of the UIAlertController loses it's width. [enter image description here][1] [1]: http://i.stack.imgur.com/43VHe.png
0debug
static int compare_sectors(const uint8_t *buf1, const uint8_t *buf2, int n, int *pnum) { bool res; int i; if (n <= 0) { *pnum = 0; return 0; } res = !!memcmp(buf1, buf2, 512); for(i = 1; i < n; i++) { buf1 += 512; buf2 += 512; if (!!memcmp(buf1, buf2, 512) != res) { break; } } *pnum = i; return res; }
1threat
How do I use Docker environment variable in ENTRYPOINT array? : <p>If I set an environment variable, say <code>ENV ADDRESSEE=world</code>, and I want to use it in the entry point script concatenated into a fixed string like:</p> <pre><code>ENTRYPOINT ["./greeting", "--message", "Hello, world!"] </code></pre> <p>with <code>world</code> being the value of the environment varible, how do I do it? I tried using <code>"Hello, $ADDRESSEE"</code> but that doesn't seem to work, as it takes the <code>$ADDRESSEE</code> literally.</p>
0debug
bool cache_is_cached(const PageCache *cache, uint64_t addr) { size_t pos; g_assert(cache); g_assert(cache->page_cache); pos = cache_get_cache_pos(cache, addr); return (cache->page_cache[pos].it_addr == addr); }
1threat