problem
stringlengths
26
131k
labels
class label
2 classes
Can constructor template cause ambiguity in the c++17 parameter deduction of class template : <p>Consider a simple example:</p> <pre><code>template &lt;class T&gt; struct foo { template &lt;template &lt;class&gt; class TT&gt; foo(TT&lt;T&gt;&amp;&amp;) {} foo(foo&lt;T&gt;&amp;&amp;){} foo() {} }; int main() { foo f1(foo&lt;int&gt;{}); //case 1. foo&lt;int&gt; f2(foo&lt;int&gt;{}); //case 2. } </code></pre> <p>Case 1. causes ambiguity in the template argument deduction of foo class in clang but not in gcc. I thought that template functions (here - constructor) have lower priority in overload resolution. Is it not the case here?</p> <p>Error message:</p> <pre><code>prog.cc:10:14: error: ambiguous deduction for template arguments of 'foo' foo f1(foo&lt;int&gt;{}); //case 1. ^ prog.cc:4:5: note: candidate function [with T = int, TT = foo] foo(TT&lt;T&gt;&amp;&amp;) {} ^ prog.cc:5:5: note: candidate function [with T = int] foo(foo&lt;T&gt;&amp;&amp;){} ^ 1 error generated. </code></pre> <p><a href="https://wandbox.org/permlink/EpN6M1DB26MDozE8" rel="noreferrer">[clang demo]</a> <a href="https://wandbox.org/permlink/3cj3562mRnavT3Im" rel="noreferrer">[gcc demo]</a></p>
0debug
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/central/system/database/drivers/mysqli/mysqli_driver.php on line 306 : <p>A PHP Error was encountered</p> <p>Severity: Error</p> <p>Message: Maximum execution time of 30 seconds exceeded</p> <p>Filename: mysqli/mysqli_driver.php</p> <p>Line Number: 306</p> <p>Backtrace:</p>
0debug
) PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\wamp\www\malala\insert_post.php : Please help not able to resolve, trying since three days but not able to know what the reason its throwing me such message. (below is my complete code). <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <title>Insert New Post</title> </head> <body> <form method="post" action="insert_post.php" enctype="multipart/form-data"> <table align="center" border="10" width="600"> <tr> <td align="center" colspan="5" bgcolor="yellow"><h1>Insert New Post Here</h1></td> </tr> <tr> <td align="right">Post Title:</td> <td><input type="text" name="title" size="40"></td> </tr> <tr> <td align="right">Post Author:</td> <td><input type="text" name="author"></td> </tr> <tr> <td align="right">Post image:</td> <td><input type="file" name="image_name"></td> </tr> <tr> <td align="right">Post Content:</td> <td><textarea name="content" cols="50" rows="20"></textarea></td> </tr> <tr> <td align="center" colspan="5"><input type="submit" name="submit" value="Publish Now"></td> </tr> </table> </form> </body> </html> <!-- end snippet --> Above Form is to insert and submit data in Database <?php include("includes/connect.php"); if (isset($_POST['submit'])) { $title = $_POST['title']; $datenow = date('Y/m/d'); $author = $_POST['author']; $content = $_POST['content']; $image_name = $_FILES['image_name']['name']; $image_type = $_FILES['image_name']['type']; $image_size = $_FILES['image_name']['size']; $image_tmp = $_FILES['image_name']['tmp_name']; if ($title =='' || $author =='' || $content =='') { echo "<script>alert('Any feild is empty')</script>"; exit(); } if ($image_type =='image/jpeg' || $image_type =='image/png' || $image_type =='image/gif') { if ($image_size<=5000000000) { move_uploaded_file($image_tmp, "images/$image_name"); } else{ echo "<script>alert('Image is larger, only 50kb size is allowed')</script>"; } } else{ echo "<script>alert('image type is invalid')</script>"; } // insert query $sth = $con->prepare(" INSERT INTO posts (post_title, post_date, post_author, post_image, post_content) VALUE (:title,:datenow,:author,:image_name,:content) "); $sth->bindParam(':post_title', $title); $sth->bindParam(':post_date', $datenow); $sth->bindParam(':post_author', $author); $sth->bindParam(':post_image', $image_name); $sth->bindParam(':post_content', $content); $sth->execute(); echo "<h1>Form Submited Successfully</h1>"; } ?> $sth->execute(); is throwing error massage as above
0debug
int if_encap(Slirp *slirp, struct mbuf *ifm) { uint8_t buf[1600]; struct ethhdr *eh = (struct ethhdr *)buf; uint8_t ethaddr[ETH_ALEN]; const struct ip *iph = (const struct ip *)ifm->m_data; int ret; if (ifm->m_len + ETH_HLEN > sizeof(buf)) { return 1; } switch (iph->ip_v) { case IPVERSION: ret = if_encap4(slirp, ifm, eh, ethaddr); if (ret < 2) { return ret; } break; default: break; } memcpy(eh->h_dest, ethaddr, ETH_ALEN); DEBUG_ARGS((dfd, " src = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_source[0], eh->h_source[1], eh->h_source[2], eh->h_source[3], eh->h_source[4], eh->h_source[5])); DEBUG_ARGS((dfd, " dst = %02x:%02x:%02x:%02x:%02x:%02x\n", eh->h_dest[0], eh->h_dest[1], eh->h_dest[2], eh->h_dest[3], eh->h_dest[4], eh->h_dest[5])); memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len); slirp_output(slirp->opaque, buf, ifm->m_len + ETH_HLEN); return 1; }
1threat
static void coroutine_fn verify_self(void *opaque) { g_assert(qemu_coroutine_self() == opaque); }
1threat
getting null value when parshing string value from json iOS swift : I am getting a json from my server. my server json is [AnyHashable("smallIcon"): small_icon, AnyHashable("tickerText"): , AnyHashable("message"): {"action":"new_content_notification","msg":{"headline":"iOS REFERRAL BONUS","subhead":"Congratulations. You have unlocked another BDT500 discount on long route trip booking.","brief":"Congratulations. You have unlocked another BDT500 discount on long route trip booking.","content_id":44}}, AnyHashable("subtitle"): www.ezzyr.com, AnyHashable("sound"): 1, AnyHashable("gcm.message_id"): 0:id, AnyHashable("aps"): { "content-available" = 1; }, AnyHashable("title"): Notification from ezzyr, AnyHashable("vibrate"): 1, AnyHashable("largeIcon"): large_icon] i am converting this by using swifty json. after converting swity json i am gettng this let fullInfo = JSON(userInfo) print(fullInfo) { "gcm.message_id" : "0: some number", "subtitle" : "www.someName.com", "smallIcon" : "small_icon", "largeIcon" : "large_icon", "title" : "Notification from ezzyr", "vibrate" : "1", "message" : "{\"action\":\"new_content_notification\",\"msg\":{\"headline\":\"iOS REFERRAL BONUS\",\"subhead\":\"Congratulations. You have unlocked another BDT500 discount on long route trip booking.\",\"brief\":\"Congratulations. You have unlocked another BDT500 discount on long route trip booking.\",\"content_id\":69}}", "sound" : "1", "tickerText" : "", "aps" : { "content-available" : "1" } } i want only data what i have in my message key. so i try to get message key value this way let message = fullInfo["message"] print(message) after printing message i am getting this result {"action":"new_content_notification","msg":{"headline":"iOS REFERRAL BONUS","subhead":"Congratulations. You have unlocked another BDT500 discount on long route trip booking.","brief":"Congratulations. You have unlocked another BDT500 discount on long route trip booking.","content_id":94}} Than i was try to get the key value of "action" in this way. let action = message["action"] print(action) but this time i am getting null value.. How can i fix this issue and get string value and also the key value of msg Thanks advanced for help
0debug
Create sub arrays of an array : <p>What is the best and most resource efficient way to create sub-arrays of an array? I have an array of objects as follow:</p> <pre><code>bigArray = [ { id: 1, name: "Marc", age: 29 }, { id: 2, name: "Caroline", age: 27 }, { id: 3, name: "John", age: 30 }]; </code></pre> <p>And I would like to generate 3 sub-arrays such as</p> <ul> <li>ids = [1, 2, 3]</li> <li>names = ["Marc", "Caroline", "John"]</li> <li>ages = [29, 27, 30]</li> </ul> <p>I have tried with nested "for" loops and experimented it with a map() method but I'm not convinced this is the cleanest way. Especially since I may have dozens of parameters for every object (i.e. "last name, city, car...)</p>
0debug
MySQL Database table from PHP code : <p>I have attempted to create a mysql query to create the database schema but with no success, here is the php code that get data from the database, could you please help me create a mysql script that will create the database tables?</p> <p>here is the php script:</p> <pre><code> foreach($string["statuses"] as $status) { $selectSQL = 'SELECT * FROM twitter WHERE t_id="'.$status["id"].'" '; $queryset = ''; $queryset = $mysqli-&gt;query ($selectSQL); if(mysqli_num_rows($queryset)==0) { $text = mysqli_real_escape_string($mysqli, $status["text"]); $loc = mysqli_real_escape_string($mysqli, $status["user"]["location"]); $user_id = mysqli_real_escape_string($mysqli, $status["user"]["id"]); $app = mysqli_real_escape_string($mysqli, $status["source"]); $img = mysqli_real_escape_string($mysqli, $status["user"]["profile_image_url"]); $retweet = mysqli_real_escape_string($mysqli, $status["retweet_count"]); $favorite = mysqli_real_escape_string($mysqli, $status["favorite_count"]); $mysqli-&gt;query('INSERT INTO `twitter` VALUES (NULL,"'.$status['id'].'","'.$text.'","'.$status['created_at'].'","'.$loc.'","'.$user_id.'","'.$app.'","'.$img.'","'.$retweet.'","'.$favorite.'")'); } } </code></pre>
0debug
void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, uintptr_t length) { uintptr_t addr; if (tlb_is_dirty_ram(tlb_entry)) { addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend; if ((addr - start) < length) { tlb_entry->addr_write |= TLB_NOTDIRTY; } } }
1threat
Xcode 10 app icon not showing : <p>Recently updated to Xcode 10 beta and my App that previously has correct icon displayed when built and ran from Xcode 9.4 to device now shows the default blank icon when running in Xcode 10.</p> <p><a href="https://i.stack.imgur.com/PagNX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PagNX.png" alt="enter image description here"></a></p> <p>When opening AppIcon asset it shows icon correctly in all the placeholders without any warning icons. When tapping on new "Show Slicing" I do not see anything.</p> <p>Anyone any clues how to fix this so app icon shows?</p>
0debug
Errors that can be caught in php : version PHP 7+ ``` first: $i = 0; try { if ( $i == 0 ) $link = mysqli_connect("1.1.1.1", "my_user", "my_password", "my_db"); else echo 'Another link.'; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; $i = 1; goto first; } // Continue execution echo 'repair complete!'; ``` This error can be caught. ``` Warning: mysqli_connect(): (HY000/2002): repair complete! ```` BUT ,If it looks like this ``` first: $i = 0; try { if ( $i == 0 ) $link = mysql_connect("1.1.1.1", "my_user", "my_password", "my_db"); else echo 'Another link.'; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; $i = 1; goto first; } // Continue execution echo 'repair complete!'; ``` This error cannot be caught. ``` Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\wamp64\www\test.php:409 Stack trace: #0 {main} thrown in D:\wamp64\www\test.php on line 409 ``` So ,I wonder what types of errors can be caught.Then I can do something about it.
0debug
How to separate a getline from file in to string and integers. C++ : <p>So i have a .txt file that goes like this:</p> <p>John F. Bush 35</p> <p>James Bush 69</p> <p>(And so on....)</p> <p>And im trying to figuer out how to seperate a line into a string and into an integer Like so:</p> <p>String A = John F. Bush; int B = 35; And i cant seem to figuer out how to... Any help would be appreciated.</p>
0debug
Can I put <?php> inside <p> tag? : <p>It's a php file on wordpress. And I'd like to know if I can put <code>&lt;?php&gt;</code> inside <code>&lt;p&gt;</code>, <code>&lt;h&gt;</code> or something similar so I can add css on specific id.</p> <p>For example</p> <pre><code> &lt;div class="eight columns"&gt; &lt;div class="padding-right"&gt; &lt;p id="address"&gt;&lt;?php the_candidate_address(); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Thanks!</p>
0debug
call event function in another event function As3 : i am calling function on another function like below. function loadXML(e:Event = null):void{ xmlData = new XML(e.target.data); //var production:String = xmlData.production.app_id.text(); trace(xmlData); var states:String = xmlData.state.place.text(); var desc:String = xmlData.state.description.text(); var image:String = xmlData.state.image.text(); trace('this is working'); } obj.addEventListener(MouseEvent.MOUSE_OVER,fl_MouseOverHandler); function fl_MouseOverHandler(event:MouseEvent):void { loadXML(); } in thi s case warning occured `Cannot access a property or method of a null object reference` how do i resolve this?
0debug
The below written code says 'cannot read property 'textContent' of null' help me somebody : <form action="{%url 'Eats_app:pause_button'%}" method="post"> {% csrf_token %} <button class="btn btn-primary " type="submit" value="Pause" id="pausebutton" style="padding-left: 3rem; padding-right: 3rem;" >Pause</button> <!-- /* <input class="btn btn-primary " type="submit" value="Pause" id="pausebutton" onclick="toggleTheButton()" style="padding-left: 3rem; padding-right: 3rem;"> */ --> </form> document.querySelector('#pausebuttons').textContent.toggle('Pause', 'Resume');
0debug
I cant seem to make .indexOf() work for my char array : I need to get a String from my second array (morsecode) but i need to know the index of the letter which i can get from my first array (morse) These are my Arrays: char morse[27]={' ','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; String morsecode[27]={",",".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."}; And this is me trying to access the array and get the index of the char(these block of codes are looped): counter=0; char letter = words[counter]; letter = toLowerCase(letter); int location=morse.indexOf(letter); String code=morsecode[location]; counter++; Every time I try to compile this error comes out: >exit status 1 request for member 'indexOf' in 'morse', which is of non-class type 'char [27]'
0debug
how to implement if else functionality in Sql : i have an SQL query in which i have customer_id, User_id and name, the values will be provided from java class while calling the query. the scenario here is if i have customer_id then i should only consider customer_id and need not consider user_id and name, if customer_id is null then i have to consider user_id and if user_id id null i have to consider name right now this logic is implemented in java if else statement i want this logic to be moved to SQL query itself, following is the code String query = "SELECT * FROM CUSTOMER WHERE " if(customer!=null && customer.length!=0) query = query+"AND CUSTOMER_ID LIKE '"+customer+"%'"; else if(user!=null && user.length!=0) query = query+"AND USER_ID LIKE '"user+"%'"; else if(name!=0 && name.length!=0) query = query + "AND NAME LIKE '"+name+"%'"; Thanks in advance
0debug
how can I list all files in a directory without using dirnet in c? : I can't find any way to list all files without using dirent.h does anyone have an idea or suggestions? I can't work with dirent.h because my compiler doesn't work with it so this is why I am searching for another option
0debug
Can we apply slection over projection in relational algebra : σ personname="megha"(π personName,age(σcompanyName = “M&T Bank” ^(works))) Can we do it like this That we can apply selection over projection?
0debug
Why does visual basic use single quote for comments? : <p>This seems like a poor choice since the single quote is such a common character and is hard to see when reading over code. </p> <p>Was there a reason to pick this over a different sequence or less used character?</p>
0debug
How to generate 10 terms of Fibonacci series in c++? : <p>In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones. <br> <br> 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... <br> I really tried, but I couldn't mentally get it into code, Here is mine: <br></p> <pre><code>#include &lt;iostream&gt; using namespace std; int main () { cout &lt;&lt;"Fibonacci series " &lt;&lt; endl; int arr[10]; for (int i = 0; i &lt; 10; i++){ arr[i] = i; arr[i+2] = arr[i]+arr[i+1]; } for (int i = 0; i &lt; 10; i++) cout &lt;&lt; arr[i] &lt;&lt; endl; return 0; } </code></pre> <p>What should I do to represent 10 terms of Fibonacci series?</p>
0debug
Google Docs Viewer occasionally failing to load content in iframe : <p>I'm having an issue with the Google Docs viewer that is causing a nightmare to solve because it only happens intermittently. I'm looking for guidance on how to make the content in the iframe load everytime without issue as it should. </p> <p>Steps to reproduce 1) This page is a basic HTML page with a h1 tag and an iframe containing a link to a PDF on the same server</p> <p><a href="http://bit.ly/1mqbuf7" rel="noreferrer">http://bit.ly/1mqbuf7</a></p> <p>2) When you load the page, the pdf document will load in the iframe 60% of the time. </p> <p>3) If you hit refresh 10 or so times, at least once it will fail to appear. Google returns a 307 first (Which it also does when it works) and then returns a 204 - no content. When it works, it returns a 200, with the content you see in the viewer.</p> <p>I'm struggling to understand why it only does this some of the time with no visible errors. This has been tested and failed on Google Chrome v 48.0.2564.103 (PC) and Internet Explorer Edge v25.10586 (PC) with the same results and frequency of failure. </p> <p>Any guidance would be greatly appreciated. </p>
0debug
Find the median of each element in vectors in a list in R : I have a list with 30 vectors of lentgh 25: I would like to find the median of the first element of my 30 vectors, then the median of the second element up to the 25th I would like it to return a vector with the 25 values I tried with lapply but did not succed
0debug
static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; bool need_flush = false; int head = 0; int tail = 0; int max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT_MAX); int alignment = MAX(bs->bl.pwrite_zeroes_alignment ?: 1, bs->request_alignment); assert(is_power_of_2(alignment)); head = offset & (alignment - 1); tail = (offset + count) & (alignment - 1); max_write_zeroes &= ~(alignment - 1); while (count > 0 && !ret) { int num = count; if (head) { num = MIN(count, alignment - head); head = 0; } else if (tail && num > alignment) { num -= tail; } if (num > max_write_zeroes) { num = max_write_zeroes; } ret = -ENOTSUP; if (drv->bdrv_co_pwrite_zeroes) { ret = drv->bdrv_co_pwrite_zeroes(bs, offset, num, flags & bs->supported_zero_flags); if (ret != -ENOTSUP && (flags & BDRV_REQ_FUA) && !(bs->supported_zero_flags & BDRV_REQ_FUA)) { need_flush = true; } } else { assert(!bs->supported_zero_flags); } if (ret == -ENOTSUP) { int max_xfer_len = MIN_NON_ZERO(bs->bl.max_transfer_length, MAX_WRITE_ZEROES_BOUNCE_BUFFER); BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE; if ((flags & BDRV_REQ_FUA) && !(bs->supported_write_flags & BDRV_REQ_FUA)) { write_flags &= ~BDRV_REQ_FUA; need_flush = true; } num = MIN(num, max_xfer_len << BDRV_SECTOR_BITS); iov.iov_len = num; if (iov.iov_base == NULL) { iov.iov_base = qemu_try_blockalign(bs, num); if (iov.iov_base == NULL) { ret = -ENOMEM; goto fail; } memset(iov.iov_base, 0, num); } qemu_iovec_init_external(&qiov, &iov, 1); ret = bdrv_driver_pwritev(bs, offset, num, &qiov, write_flags); if (num < max_xfer_len << BDRV_SECTOR_BITS) { qemu_vfree(iov.iov_base); iov.iov_base = NULL; } } offset += num; count -= num; } fail: if (ret == 0 && need_flush) { ret = bdrv_co_flush(bs); } qemu_vfree(iov.iov_base); return ret; }
1threat
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){ unsigned int *state= bsfc->priv_data; int amount= args ? atoi(args) : (*state % 10001+1); int i; if(amount <= 0) return AVERROR(EINVAL); *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i++){ (*state) += (*poutbuf)[i] + 1; if(*state % amount == 0) (*poutbuf)[i] = *state; } return 1; }
1threat
static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, uint8_t *buf, int lun) { SCSIDeviceState *s = d->state; uint64_t nb_sectors; uint32_t lba; uint32_t len; int cmdlen; int is_write; uint8_t command; uint8_t *outbuf; SCSIRequest *r; command = buf[0]; r = scsi_find_request(s, tag); if (r) { BADF("Tag 0x%x already in use\n", tag); scsi_cancel_io(d, tag); } r = scsi_new_request(s, tag); outbuf = r->dma_buf; is_write = 0; DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, tag, buf[0]); switch (command >> 5) { case 0: lba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16); len = buf[4]; cmdlen = 6; break; case 1: case 2: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[8] | (buf[7] << 8); cmdlen = 10; break; case 4: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24); cmdlen = 16; break; case 5: lba = buf[5] | (buf[4] << 8) | (buf[3] << 16) | (buf[2] << 24); len = buf[9] | (buf[8] << 8) | (buf[7] << 16) | (buf[6] << 24); cmdlen = 12; break; default: BADF("Unsupported command length, command %x\n", command); goto fail; } #ifdef DEBUG_SCSI { int i; for (i = 1; i < cmdlen; i++) { printf(" 0x%02x", buf[i]); } printf("\n"); } #endif if (lun || buf[1] >> 5) { DPRINTF("Unimplemented LUN %d\n", lun ? lun : buf[1] >> 5); if (command != 0x03 && command != 0x12) goto fail; } switch (command) { case 0x0: DPRINTF("Test Unit Ready\n"); break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(outbuf, 0, 4); outbuf[0] = 0xf0; outbuf[1] = 0; outbuf[2] = s->sense; r->buf_len = 4; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); if (buf[1] & 0x2) { BADF("optional INQUIRY command support request not implemented\n"); goto fail; } else if (buf[1] & 0x1) { uint8_t page_code = buf[2]; if (len < 4) { BADF("Error: Inquiry (EVPD[%02X]) buffer size %d is " "less than 4\n", page_code, len); goto fail; } switch (page_code) { case 0x00: { DPRINTF("Inquiry EVPD[Supported pages] " "buffer size %d\n", len); r->buf_len = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->buf_len++] = 5; } else { outbuf[r->buf_len++] = 0; } outbuf[r->buf_len++] = 0x00; outbuf[r->buf_len++] = 0x00; outbuf[r->buf_len++] = 3; outbuf[r->buf_len++] = 0x00; outbuf[r->buf_len++] = 0x80; outbuf[r->buf_len++] = 0x83; } break; case 0x80: { if (len < 4) { BADF("Error: EVPD[Serial number] Inquiry buffer " "size %d too small, %d needed\n", len, 4); goto fail; } DPRINTF("Inquiry EVPD[Serial number] buffer size %d\n", len); r->buf_len = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->buf_len++] = 5; } else { outbuf[r->buf_len++] = 0; } outbuf[r->buf_len++] = 0x80; outbuf[r->buf_len++] = 0x00; outbuf[r->buf_len++] = 0x01; outbuf[r->buf_len++] = '0'; } break; case 0x83: { int max_len = 255 - 8; int id_len = strlen(bdrv_get_device_name(s->bdrv)); if (id_len > max_len) id_len = max_len; DPRINTF("Inquiry EVPD[Device identification] " "buffer size %d\n", len); r->buf_len = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[r->buf_len++] = 5; } else { outbuf[r->buf_len++] = 0; } outbuf[r->buf_len++] = 0x83; outbuf[r->buf_len++] = 0x00; outbuf[r->buf_len++] = 3 + id_len; outbuf[r->buf_len++] = 0x2; outbuf[r->buf_len++] = 0; outbuf[r->buf_len++] = 0; outbuf[r->buf_len++] = id_len; memcpy(&outbuf[r->buf_len], bdrv_get_device_name(s->bdrv), id_len); r->buf_len += id_len; } break; default: BADF("Error: unsupported Inquiry (EVPD[%02X]) " "buffer size %d\n", page_code, len); goto fail; } break; } else { if (buf[2] != 0) { BADF("Error: Inquiry (STANDARD) page or code " "is non-zero [%02X]\n", buf[2]); goto fail; } if (len < 5) { BADF("Error: Inquiry (STANDARD) buffer size %d " "is less than 5\n", len); goto fail; } if (len < 36) { BADF("Error: Inquiry (STANDARD) buffer size %d " "is less than 36 (TODO: only 5 required)\n", len); } } memset(outbuf, 0, 36); if (lun || buf[1] >> 5) { outbuf[0] = 0x7f; } else if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[0] = 5; outbuf[1] = 0x80; memcpy(&outbuf[16], "QEMU CD-ROM ", 16); } else { outbuf[0] = 0; memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); memcpy(&outbuf[32], QEMU_VERSION, 4); outbuf[2] = 3; outbuf[3] = 2; outbuf[4] = 31; outbuf[7] = 0x10 | (s->tcq ? 0x02 : 0); r->buf_len = 36; break; case 0x16: DPRINTF("Reserve(6)\n"); if (buf[1] & 1) goto fail; break; case 0x17: DPRINTF("Release(6)\n"); if (buf[1] & 1) goto fail; break; case 0x1a: case 0x5a: { uint8_t *p; int page; page = buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %d)\n", page, len); p = outbuf; memset(p, 0, 4); outbuf[1] = 0; outbuf[3] = 0; if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[2] = 0x80; } p += 4; if (page == 4) { int cylinders, heads, secs; p[0] = 4; p[1] = 0x16; bdrv_get_geometry_hint(s->bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = 0; p[13] = 200; p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; p += 0x16; } else if (page == 5) { int cylinders, heads, secs; p[0] = 5; p[1] = 0x1e; p[2] = 5000 >> 8; p[3] = 5000 & 0xff; bdrv_get_geometry_hint(s->bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; p[14] = 0; p[15] = 1; p[16] = 1; p[17] = 0; p[18] = 1; p[19] = 1; p[20] = 1; p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; p += 0x1e; } else if ((page == 8 || page == 0x3f)) { memset(p,0,20); p[0] = 8; p[1] = 0x12; p[2] = 4; p += 20; } if ((page == 0x3f || page == 0x2a) && (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM)) { p[0] = 0x2a; p[1] = 0x14; p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (bdrv_is_locked(s->bdrv)? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; p += 22; } r->buf_len = p - outbuf; outbuf[0] = r->buf_len - 4; if (r->buf_len > len) r->buf_len = len; } break; case 0x1b: DPRINTF("Start Stop Unit\n"); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); bdrv_set_locked(s->bdrv, buf[4] & 1); break; case 0x25: DPRINTF("Read Capacity\n"); memset(outbuf, 0, 8); bdrv_get_geometry(s->bdrv, &nb_sectors); if (nb_sectors) { nb_sectors--; outbuf[0] = (nb_sectors >> 24) & 0xff; outbuf[1] = (nb_sectors >> 16) & 0xff; outbuf[2] = (nb_sectors >> 8) & 0xff; outbuf[3] = nb_sectors & 0xff; outbuf[4] = 0; outbuf[5] = 0; outbuf[6] = s->cluster_size * 2; outbuf[7] = 0; r->buf_len = 8; } else { scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_NOT_READY); return 0; } break; case 0x08: case 0x28: DPRINTF("Read (sector %d, count %d)\n", lba, len); r->sector = lba * s->cluster_size; r->sector_count = len * s->cluster_size; break; case 0x0a: case 0x2a: DPRINTF("Write (sector %d, count %d)\n", lba, len); r->sector = lba * s->cluster_size; r->sector_count = len * s->cluster_size; is_write = 1; break; case 0x35: DPRINTF("Synchronise cache (sector %d, count %d)\n", lba, len); bdrv_flush(s->bdrv); break; case 0x43: { int start_track, format, msf, toclen; msf = buf[1] & 2; format = buf[2] & 0xf; start_track = buf[6]; bdrv_get_geometry(s->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1); switch(format) { case 0: toclen = cdrom_read_toc(nb_sectors, outbuf, msf, start_track); break; case 1: toclen = 12; memset(outbuf, 0, 12); outbuf[1] = 0x0a; outbuf[2] = 0x01; outbuf[3] = 0x01; break; case 2: toclen = cdrom_read_toc_raw(nb_sectors, outbuf, msf, start_track); break; default: goto error_cmd; } if (toclen > 0) { if (len > toclen) len = toclen; r->buf_len = len; break; } error_cmd: DPRINTF("Read TOC error\n"); goto fail; } case 0x46: DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len); memset(outbuf, 0, 8); outbuf[7] = 8; r->buf_len = 8; break; case 0x56: DPRINTF("Reserve(10)\n"); if (buf[1] & 3) goto fail; break; case 0x57: DPRINTF("Release(10)\n"); if (buf[1] & 3) goto fail; break; case 0xa0: DPRINTF("Report LUNs (len %d)\n", len); if (len < 16) goto fail; memset(outbuf, 0, 16); outbuf[3] = 8; r->buf_len = 16; break; case 0x2f: DPRINTF("Verify (sector %d, count %d)\n", lba, len); break; default: DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]); fail: scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_ILLEGAL_REQUEST); return 0; } if (r->sector_count == 0 && r->buf_len == 0) { scsi_command_complete(r, STATUS_GOOD, SENSE_NO_SENSE); } len = r->sector_count * 512 + r->buf_len; if (is_write) { return -len; } else { if (!r->sector_count) r->sector_count = -1; return len; } }
1threat
There is no Action mapped for action name elecMenuAction_menuHome : <blockquote> <p>Struts Problem Report</p> <p>Struts has detected an unhandled exception:</p> <p>Messages:<br> There is no Action mapped for action name elecMenuAction_menuHome.</p> <p>Stacktraces</p> <p>There is no Action mapped for action name elecMenuAction_menuHome. - [unknown location] </p> <p>com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)</p> <p>...</p> </blockquote> <p>My <code>struts.xml</code>:</p> <pre><code>&lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"&gt; &lt;struts&gt; &lt;!-- dev model --&gt; &lt;constant name="struts.devMode" value="true"&gt;&lt;/constant&gt; &lt;!-- ui --&gt; &lt;constant name="struts.ui.theme" value="simple"&gt;&lt;/constant&gt; &lt;!-- .do--&gt; &lt;constant name="struts.action.extension" value="do"&gt;&lt;/constant&gt; &lt;!-- system management --&gt; &lt;package name="system" namespace="/system" extends="struts-default"&gt; &lt;!-- test --&gt; &lt;action name="elecTextAction_*" class="elecTextAction" method="{1}"&gt; &lt;result name="save"&gt;/system/textAdd.jsp&lt;/result&gt; &lt;/action&gt; &lt;action name="elecMenuAction_*" class="elecMenuAction" method="{1}"&gt; &lt;result name="menuHome"&gt;/WEB-INF/page/menu/home.jsp&lt;/result&gt; &lt;/action&gt; // I add this action then report error. &lt;/package&gt; &lt;/struts&gt; </code></pre> <p>In my <code>ElecMenuAction.java</code>:</p> <pre><code>@SuppressWarnings("serial") @Controller("elecMenuAction") @Scope(value = "prototype") public class ElecMenuAction extends BaseAction&lt;MenuForm&gt; { MenuForm menuForm = this.getModel(); public String menuHome(MenuForm menuForm) { return "menuHome"; } } </code></pre> <p>In my <code>menu/index.jsp</code>:</p> <pre><code>&lt;form action="${pageContext.request.contextPath}/menu/elecMenuAction_menuHome.do" method="post" target="_top"&gt; </code></pre> <p>My directory is below:</p> <p><kbd><img src="https://i.stack.imgur.com/Yn4uO.jpg" width="333"></kbd></p>
0debug
Variable assignment in C Vs scanf : I am new to C got a small problem in understanding below scanf line printf("Enter a message to add to message queue : "); `scanf("%[^\n]",sbuf.mtext);` how do I write this statement if I am getting the value from command line? I think I would have to declare the variable as string? Thanks in advance.
0debug
How I pass by refernece object between activity in Android : <p>Can I pass by reference object between activity in Android , How ?</p> <p>Thankyou</p>
0debug
I am miss placing braces in the case statement. Please help me correct it : (CASE WHEN v_cur.order_type != 'STK' AND v_cur.lot_net_cost_flag = 'Y' THEN 0 ELSE ((v_cur.unit_costs_amount * v_cur.line_quantity_ordered) / CASE WHEN v_cur.unit_of_measure_code = 'E' THEN 1 WHEN v_cur.unit_of_measure_code = 'C' THEN 100 WHEN v_cur.unit_of_measure_code = 'M' THEN 1000 ELSE 1 END) v_dt_unit_of_measure_code_val) END v_dt_cost_amount
0debug
yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2], const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf[2], uint8_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target) { const int16_t *buf0 = buf[0], *buf1 = buf[1]; const uint8_t * const d128 = dither_8x8_220[y & 7]; int yalpha1 = 4096 - yalpha; int i; if (c->flags & SWS_ERROR_DIFFUSION) { int err = 0; int acc = 0; for (i = 0; i < dstW; i +=2) { int Y; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; c->dither_error[0][i] = err; acc = 2*acc + (Y >= 128); Y -= 220*(acc&1); err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4; c->dither_error[0][i+1] = Y; acc = 2*acc + (err >= 128); err -= 220*(acc&1); if ((i & 7) == 6) output_pixel(*dest++, acc); } c->dither_error[0][i] = err; } else { for (i = 0; i < dstW; i += 8) { int Y, acc = 0; Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; accumulate_bit(acc, Y + d128[0]); Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; accumulate_bit(acc, Y + d128[1]); Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; accumulate_bit(acc, Y + d128[2]); Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; accumulate_bit(acc, Y + d128[3]); Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; accumulate_bit(acc, Y + d128[4]); Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; accumulate_bit(acc, Y + d128[5]); Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; accumulate_bit(acc, Y + d128[6]); Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; accumulate_bit(acc, Y + d128[7]); output_pixel(*dest++, acc); } } }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
How to avoid FileNotFoundException? : <p>I'm wondering how to make it so that my program creates a file if it does not already find it there?</p> <pre><code>public void load() throws Exception { try { File log = new File(FILE_NAME); //opens the file FileInputStream fileIn = new FileInputStream(log); ObjectInputStream in = new ObjectInputStream(fileIn); //de-serializes videosList = (ArrayList)in.readObject(); // de-serializes in.close(); //closes the file fileIn.close(); } catch(Exception i) { i.printStackTrace(); } </code></pre> <p>And this is the error I am getting:</p> <pre><code>java.io.FileNotFoundException: Users/hanaezz/Desktop/output.ser (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138) at videostore.BinaryFile.load(BinaryFile.java:31) at videostore.VideoStore.&lt;init&gt;(VideoStore.java:33) at videostore.VideoStore$6.run(VideoStore.java:430) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) </code></pre> <p>All the extra stuff there is because my program is also a GUI program. And then I also have a method that's supposed to write my object to a file...</p> <pre><code>public void writeToFile() throws Exception{ FileOutputStream outputStream = new FileOutputStream(FILE_NAME); ObjectOutputStream oos = new ObjectOutputStream(outputStream); oos.writeObject(videosList); oos.close(); outputStream.close(); } </code></pre> <p>This throws the same exception. How can I avoid this? I'm not sure how to modify the FIS/OIS to create the file if they don't find it.. or I suppose it would be more efficient for the FOS/OOS to do it instead?</p>
0debug
Can I know how to add TrustedHosts in powershell. : [enter image description here][1] [1]: https://i.stack.imgur.com/pT1q2.png Am using the following command to add but showing an error that need to set set the policy to "not configured". Can any one help me in this
0debug
Can we install .exe file generated by a C# console app? if yes, how? : <p>Can we install .exe release file generated by a C# console app? if yes, how?</p>
0debug
How to fix 'Object arrays cannot be loaded when allow_pickle=False' in the sketch_rnn algorithm : <p>I was running the sketch_rnn.ipynb on my jupyter notebook, upon loading the environment to load the trained dataset, it returned an error 'Object arrays cannot be loaded when allow_pickle=False'</p> <p>This is the code already used by google developers in developing the sketch_rnn algorithm that was even run in the google colab. In the past i have ran it myself on the google colab it worked but seems not to be working on my own jupyter notebook</p> <pre><code>from magenta.models.sketch_rnn.sketch_rnn_train import * from magenta.models.sketch_rnn.model import * from magenta.models.sketch_rnn.utils import * from magenta.models.sketch_rnn.rnn import * model_params.batch_size = 1 eval_model_params = sketch_rnn_model.copy_hparams(model_params) eval_model_params.use_input_dropout = 0 eval_model_params.use_recurrent_dropout = 0 eval_model_params.use_output_dropout = 0 eval_model_params.is_training = 0 sample_model_params = sketch_rnn_model.copy_hparams(eval_model_params) sample_model_params.max_seq_len = 1 return [model_params, eval_model_params, sample_model_params] [train_set, valid_set, test_set, hps_model, eval_hps_model, sample_hps_model] = load_env_compatible(data_dir, model_dir) </code></pre> <p>i expected the output to be </p> <pre><code>INFO:tensorflow:Downloading http://github.com/hardmaru/sketch-rnn- datasets/raw/master/aaron_sheep/aaron_sheep.npz INFO:tensorflow:Loaded 7400/300/300 from aaron_sheep.npz INFO:tensorflow:Dataset combined: 8000 (7400/300/300), avg len 125 INFO:tensorflow:model_params.max_seq_len 250. total images &lt;= max_seq_len is 7400 total images &lt;= max_seq_len is 300 total images &lt;= max_seq_len is 300 INFO:tensorflow:normalizing_scale_factor 18.5198. </code></pre> <p>But it gave me</p> <pre><code>ValueError: Object arrays cannot be loaded when allow_pickle=False </code></pre>
0debug
Is there a convenience constructor in C++? : <p>Is it possible for an overloaded constructor to somehow call another constructor within the class, similar to the code below?</p> <pre><code>class A { public: A(std::string str) : m_str(str) {} A(int i) { *this = std::move(A(std::to_string(i))); } std::string m_str; }; </code></pre> <p>The code above works, yet I am afraid that calling this in the constructor might lead to undefined behavior.</p> <p>If it does could you please explain why and also suggest a better alternative?</p>
0debug
static int alac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *inbuffer = avpkt->data; int input_buffer_size = avpkt->size; ALACContext *alac = avctx->priv_data; int channels; unsigned int outputsamples; int hassize; unsigned int readsamplesize; int isnotcompressed; uint8_t interlacing_shift; uint8_t interlacing_leftweight; int i, ch, ret; init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8); channels = get_bits(&alac->gb, 3) + 1; if (channels != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "frame header channel count mismatch\n"); return AVERROR_INVALIDDATA; } skip_bits(&alac->gb, 4); skip_bits(&alac->gb, 12); hassize = get_bits1(&alac->gb); alac->extra_bits = get_bits(&alac->gb, 2) << 3; isnotcompressed = get_bits1(&alac->gb); if (hassize) { outputsamples = get_bits_long(&alac->gb, 32); if(outputsamples > alac->setinfo_max_samples_per_frame){ av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame); return -1; } } else outputsamples = alac->setinfo_max_samples_per_frame; if (outputsamples > INT32_MAX) { av_log(avctx, AV_LOG_ERROR, "unsupported block size: %u\n", outputsamples); return AVERROR_INVALIDDATA; } alac->frame.nb_samples = outputsamples; if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } readsamplesize = alac->setinfo_sample_size - alac->extra_bits + channels - 1; if (readsamplesize > MIN_CACHE_BITS) { av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize); return -1; } if (!isnotcompressed) { int16_t predictor_coef_table[MAX_CHANNELS][32]; int predictor_coef_num[MAX_CHANNELS]; int prediction_type[MAX_CHANNELS]; int prediction_quantitization[MAX_CHANNELS]; int ricemodifier[MAX_CHANNELS]; interlacing_shift = get_bits(&alac->gb, 8); interlacing_leftweight = get_bits(&alac->gb, 8); for (ch = 0; ch < channels; ch++) { prediction_type[ch] = get_bits(&alac->gb, 4); prediction_quantitization[ch] = get_bits(&alac->gb, 4); ricemodifier[ch] = get_bits(&alac->gb, 3); predictor_coef_num[ch] = get_bits(&alac->gb, 5); for (i = 0; i < predictor_coef_num[ch]; i++) predictor_coef_table[ch][i] = (int16_t)get_bits(&alac->gb, 16); } if (alac->extra_bits) { for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits); } } for (ch = 0; ch < channels; ch++) { bastardized_rice_decompress(alac, alac->predicterror_buffer[ch], outputsamples, readsamplesize, alac->setinfo_rice_initialhistory, alac->setinfo_rice_kmodifier, ricemodifier[ch] * alac->setinfo_rice_historymult / 4, (1 << alac->setinfo_rice_kmodifier) - 1); if (prediction_type[ch] == 0) { predictor_decompress_fir_adapt(alac->predicterror_buffer[ch], alac->outputsamples_buffer[ch], outputsamples, readsamplesize, predictor_coef_table[ch], predictor_coef_num[ch], prediction_quantitization[ch]); } else { av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[ch]); } } } else { for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) { alac->outputsamples_buffer[ch][i] = get_sbits_long(&alac->gb, alac->setinfo_sample_size); } } alac->extra_bits = 0; interlacing_shift = 0; interlacing_leftweight = 0; } if (get_bits(&alac->gb, 3) != 7) av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n"); if (channels == 2 && interlacing_leftweight) { decorrelate_stereo(alac->outputsamples_buffer, outputsamples, interlacing_shift, interlacing_leftweight); } if (alac->extra_bits) { append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer, alac->extra_bits, alac->numchannels, outputsamples); } switch(alac->setinfo_sample_size) { case 16: if (channels == 2) { interleave_stereo_16(alac->outputsamples_buffer, (int16_t *)alac->frame.data[0], outputsamples); } else { int16_t *outbuffer = (int16_t *)alac->frame.data[0]; for (i = 0; i < outputsamples; i++) { outbuffer[i] = alac->outputsamples_buffer[0][i]; } } break; case 24: if (channels == 2) { interleave_stereo_24(alac->outputsamples_buffer, (int32_t *)alac->frame.data[0], outputsamples); } else { int32_t *outbuffer = (int32_t *)alac->frame.data[0]; for (i = 0; i < outputsamples; i++) outbuffer[i] = alac->outputsamples_buffer[0][i] << 8; } break; } if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8) av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb)); *got_frame_ptr = 1; *(AVFrame *)data = alac->frame; return input_buffer_size; }
1threat
Notepad++ wildcard : <p>how to find and replace all characters after the main domain (including the "/" character) using a wild card?</p> <p>For example, i have the following 4 rows:</p> <pre><code>intersport-schaeftlmaier.de/ weymouthhondapowersports.com/Default.asp rtbstream.com/click?data=RG1kUFJQQUYw top-casino-sites.com/ </code></pre> <p><strong>In excel I would simply use the following:</strong> Find this /* Replace with this</p> <p><strong>The results will look like this:</strong></p> <pre><code>intersport-schaeftlmaier.de weymouthhondapowersports.com rtbstream.com top-casino-sites.com </code></pre> <p>So, how to do that with notepad++ ?</p> <p>Thanks, Ziv</p>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
In python, How to print dictionary value based on another value? : How to print the string of "value" only for id: "resolution" ?? Here in this case I want to print the value "Fixed" customFields: { string: [ { id: "device_type", value: "iPhone 6" }, { id: "os_version", value: "iOS 10.x" }, { id: "rabbit_build", value: "2.11.llyu" }, { id: "resolution", value: "Fixed" }, My Python code is resolution = ib['customFields']['string'] print(resolution)
0debug
How does implicit types in scala work with reference to this https://youtu.be/hC4gGCD3vlY?t=263 : <p><strong>How</strong> does implicit types in scala work with reference to this <a href="https://youtu.be/hC4gGCD3vlY?t=263" rel="nofollow noreferrer">https://youtu.be/hC4gGCD3vlY?t=263</a>.</p> <p>Also I did not understand why he mentions that the convertAtoB object is static. </p>
0debug
No such module while using cocoapods in swift : Hi all am new to Ios developing and am developing a app using cocoapods for MJcalendar.i successfully installed cocoapods to my project when i try to add that framework it automatically appears MJcalendar when i selected that and clean my project it shows me error as no such module found.I also checked other stackoverflow answers i cant find the solutions..eg,. i use_frameworks! like that everything i updated still it shows error what should i do to recover this error?? Mine xcode is 7.3.1..mjcalendar pod also supported my swift but dont know it still showing that error?? Thanks in advance
0debug
static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex, int interpreter_fd, abi_ulong *interp_load_addr, char bprm_buf[BPRM_BUF_SIZE]) { struct elf_phdr *elf_phdata = NULL; abi_ulong load_addr, load_bias, loaddr, hiaddr; int retval; abi_ulong error; int i; bswap_ehdr(interp_elf_ex); if ((interp_elf_ex->e_type != ET_EXEC && interp_elf_ex->e_type != ET_DYN) || !elf_check_arch(interp_elf_ex->e_machine)) { return ~((abi_ulong)0UL); } if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE) return ~(abi_ulong)0UL; elf_phdata = (struct elf_phdr *) malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum); if (!elf_phdata) return ~((abi_ulong)0UL); if (interp_elf_ex->e_phentsize != sizeof(struct elf_phdr)) { free(elf_phdata); return ~((abi_ulong)0UL); } i = interp_elf_ex->e_phnum * sizeof(struct elf_phdr); if (interp_elf_ex->e_phoff + i <= BPRM_BUF_SIZE) { memcpy(elf_phdata, bprm_buf + interp_elf_ex->e_phoff, i); } else { retval = pread(interpreter_fd, elf_phdata, i, interp_elf_ex->e_phoff); if (retval != i) { perror("load_elf_interp"); exit(-1); } } bswap_phdr(elf_phdata, interp_elf_ex->e_phnum); loaddr = -1, hiaddr = 0; for (i = 0; i < interp_elf_ex->e_phnum; ++i) { if (elf_phdata[i].p_type == PT_LOAD) { abi_ulong a = elf_phdata[i].p_vaddr; if (a < loaddr) { loaddr = a; } a += elf_phdata[i].p_memsz; if (a > hiaddr) { hiaddr = a; } } } load_addr = loaddr; if (interp_elf_ex->e_type == ET_DYN) { load_addr = target_mmap(loaddr, hiaddr - loaddr, PROT_NONE, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, -1, 0); if (load_addr == -1) { perror("mmap"); exit(-1); } } load_bias = load_addr - loaddr; for (i = 0; i < interp_elf_ex->e_phnum; i++) { struct elf_phdr *eppnt = elf_phdata + i; if (eppnt->p_type == PT_LOAD) { abi_ulong vaddr, vaddr_po, vaddr_ps, vaddr_ef, vaddr_em; int elf_prot = 0; if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; vaddr = load_bias + eppnt->p_vaddr; vaddr_po = TARGET_ELF_PAGEOFFSET(vaddr); vaddr_ps = TARGET_ELF_PAGESTART(vaddr); error = target_mmap(vaddr_ps, eppnt->p_filesz + vaddr_po, elf_prot, MAP_PRIVATE | MAP_FIXED, interpreter_fd, eppnt->p_offset - vaddr_po); if (error == -1) { close(interpreter_fd); free(elf_phdata); return ~((abi_ulong)0UL); } vaddr_ef = vaddr + eppnt->p_filesz; vaddr_em = vaddr + eppnt->p_memsz; if (vaddr_ef < vaddr_em) { zero_bss(vaddr_ef, vaddr_em, elf_prot); } } } if (qemu_log_enabled()) { load_symbols(interp_elf_ex, interpreter_fd, load_bias); } close(interpreter_fd); free(elf_phdata); *interp_load_addr = load_addr; return ((abi_ulong) interp_elf_ex->e_entry) + load_bias; }
1threat
Difference between Xms and Xmx and XX:MaxPermSize : <p>What the difference between</p> <pre><code>-Xms4096m -Xmx2048M -XX:MaxPermSize=712M </code></pre> <p>I am getting confused of this two <code>-Xmx2048M</code> and <code>-XX:MaxPermSize=712M</code> </p> <p>and will happen if I use -Xmx2048<code>M</code> or -Xmx2048<code>m</code></p>
0debug
virtio_gpu_resource_attach_backing(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_simple_resource *res; struct virtio_gpu_resource_attach_backing ab; int ret; VIRTIO_GPU_FILL_CMD(ab); trace_virtio_gpu_cmd_res_back_attach(ab.resource_id); res = virtio_gpu_find_resource(g, ab.resource_id); if (!res) { qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal resource specified %d\n", __func__, ab.resource_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; ret = virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov); if (ret != 0) { res->iov_cnt = ab.nr_entries;
1threat
How I validate my Wordpress Theme? : I am making WordPress Theme and my theme Rejected form Market Place Because Of Validator issue.I try to validate My theme at <https://validator.w3.org/> and I get some validation error because WordPress itself generates lots of invalid HTML Tags.So I don't Know how i validate my WordPress Theme ?
0debug
How can I update a field in every document in Firebase Firestore from Firebase Cloud Functions? : <p>I'm making an app with a pretend stock market and I need to update a certain field (an array (prices) in an object (stock) of a document (the company). I need to have a random value between the last price - 2 and the last price + 2 and add that to the prices array for every company (document).</p> <p>How would I go about this?</p> <p>Thanks in advance!</p> <p>Also any advice to simplify this question would be much appriciated!</p>
0debug
Remove automated closing bracket comments in IntelliJ IDEA : <p>I'm seeing following happen when working in intelliJ IDEA with Dart based project</p> <p><a href="https://i.stack.imgur.com/WTwka.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WTwka.png" alt="enter image description here"></a></p> <p>All comments there i.e <code>// AppBar</code> are auto generated, I assume for easier tracking of what closing brackets belong where. Weird bit is that I can't even highlight them, nor delete them and when I copy code they are not copied over.</p> <p>Is there a way to disable this feature in the ide?</p>
0debug
How to center placeholder text in UISearchBar iOS 11 : <p>With iOS 11, searchBars are defaulting to a left aligned text. While this looks good with the rest of the native changes to iOS, it doesn't really fit my design, and I would like it to be center, as it was before.</p> <p>I can't find any such alignment attributes on <code>UISearchBar</code>. Am I missing something, or is it simply not possible? Do I have to create my own custom search bar e.g derived from a <code>UITextField</code> to achieve this?</p>
0debug
WebRtc Architecture - Are videos stored by Webrtc? : <p>I have a simple question. After peer connection is established how video is transmitted from Peer. Does the video go to some Server of webrtc for transcoding? Or is stored somewhere by webrtc temporarily/permanently? If it is stored do they use the data for any processing or share with businesses.</p>
0debug
jQuery: how to get the number/position of an element : In my HMTL page I have this list <ul> <li id=a></li> <li id=b></li> <li id=c></li> ... </ul> How can I do in jQuery to get the "position" (meant as n-th son) of a tag knowing its id? For example something like: $(#c).position() = 3 meant that $(#c) is the 3-rd son of <ul>. Is it possible?
0debug
Failed to demangle superclass with Cocoapods in Xcode 10.2 : <p>After moving to Xcode 10.2, when running my app I get a crash with the error <code>failed to demangle superclass of MyClass from mangled name MySuperClass</code>.</p> <p>The crash occurs when I try to create an instance of MyClass. I am using CocoaPods 1.6.1 and have not yet upgraded to Swift 5. The class in question is defined inside a Pod, and is a subclass of a class defined a different Pod (listed as a sub dependency of the first Pod). </p> <p>Adding to the complexity (unsure if it is related) is that the super class takes a generic, and the sub class defines a concrete type and does not take a generic. I.e.</p> <pre><code>// Inside Pod B: open class MySuperClass&lt;DataType: Decodable&gt; { ... } // Inside Pod A: open class MySubClass: MySuperClass&lt;AConcreteStructConformingToCodable&gt; { ... } // Inside my project: let myClass = MySubClass() </code></pre> <p>I have tried overriding the Pod build settings to build with and without optmisation without any change in behaviour.</p>
0debug
Is leaked memory freed up when the program exits in golang? : <p>Before you claim a repeat <a href="https://stackoverflow.com/questions/2975831/is-leaked-memory-freed-up-when-the-program-exits">question</a>, I've read all those answers, but my question is focus to golang specific. With the golang proverb <a href="https://blog.golang.org/share-memory-by-communicating" rel="nofollow noreferrer">Don't communicate by sharing memory; share memory by communicating</a> I wonder if there is a different by how golang manage the memory</p>
0debug
whats makes JIRA better than Redmine : <p>I understood that for managing bugs a startups used redmine because it is free and open source, and a company that is not startup used JIRA (most of them)(in payment).</p> <p>why do these companies prefers JIRA above Redmine?</p>
0debug
HTML/CSS performance: flexbox vs table for large data tables : <p>I'm writing a table component in React that would potentially have hundreds of lines, and variable cell widths (in fractions) depending on the table.</p> <p>What would be the best way to implement this in HTML/CSS, flexbox or a traditional table?</p>
0debug
static void nabm_writeb (void *opaque, uint32_t addr, uint32_t val) { PCIAC97LinkState *d = opaque; AC97LinkState *s = &d->ac97; AC97BusMasterRegs *r = NULL; uint32_t index = addr - s->base[1]; switch (index) { case PI_LVI: case PO_LVI: case MC_LVI: r = &s->bm_regs[GET_BM (index)]; if ((r->cr & CR_RPBM) && (r->sr & SR_DCH)) { r->sr &= ~(SR_DCH | SR_CELV); r->civ = r->piv; r->piv = (r->piv + 1) % 32; fetch_bd (s, r); } r->lvi = val % 32; dolog ("LVI[%d] <- %#x\n", GET_BM (index), val); break; case PI_CR: case PO_CR: case MC_CR: r = &s->bm_regs[GET_BM (index)]; if (val & CR_RR) { reset_bm_regs (s, r); } else { r->cr = val & CR_VALID_MASK; if (!(r->cr & CR_RPBM)) { voice_set_active (s, r - s->bm_regs, 0); r->sr |= SR_DCH; } else { r->civ = r->piv; r->piv = (r->piv + 1) % 32; fetch_bd (s, r); r->sr &= ~SR_DCH; voice_set_active (s, r - s->bm_regs, 1); } } dolog ("CR[%d] <- %#x (cr %#x)\n", GET_BM (index), val, r->cr); break; case PI_SR: case PO_SR: case MC_SR: r = &s->bm_regs[GET_BM (index)]; r->sr |= val & ~(SR_RO_MASK | SR_WCLEAR_MASK); update_sr (s, r, r->sr & ~(val & SR_WCLEAR_MASK)); dolog ("SR[%d] <- %#x (sr %#x)\n", GET_BM (index), val, r->sr); break; default: dolog ("U nabm writeb %#x <- %#x\n", addr, val); break; } }
1threat
Firebase Firestore - OR query : <p>How to get data by multiple values of one field? For example, I have database with posts and I want to query for all posts where blogId is 1 or 2, sorting by timestamp. </p> <pre><code>collection("posts").whereEqualTo("blogId", "1") .whereEqualTo("blogId", 2).orderBy("timestamp", Query.Direction.DESCENDING).limit(50) </code></pre> <p>Code above is not working :(</p> <p>How to achieve this? Regards :)</p>
0debug
Intersecting elements in array : Can anyone please tell why I am not getting correct solution.. started programming few days ago... There are 3 arrays and code works if there are less elements.. idk whats problem..please give me solution thanks.. here is my code:- int arr1[]={1,2,3,5,7,8,9,11,12,18}; int arr2[]={2,3,4,12}; int arr3[]={2,3,5,12,19}; int arr4[10]; int k=0; int x=0,y=0,z=0; while(arr3[z]!=19) { if(arr1[x]==arr2[y] && arr2[y]==arr3[z]) { arr4[k]=arr1[x]; cout<<" intersecting element found "<<arr4[k]; k++; x++;y++;z++; } else if(arr1[x]<arr2[y]) { x++; } else if(arr2[y]<arr2[z]) { y++; } else { z++; } } for(int i=0;i<k;i++) { cout<<endl<<" o/p "<<arr4[i]; }
0debug
static void avc_loopfilter_cb_or_cr_inter_edge_ver_msa(uint8_t *data, uint8_t bs0, uint8_t bs1, uint8_t bs2, uint8_t bs3, uint8_t tc0, uint8_t tc1, uint8_t tc2, uint8_t tc3, uint8_t alpha_in, uint8_t beta_in, uint32_t img_width) { uint8_t *src; uint16_t out0, out1, out2, out3; v16u8 alpha, beta; v16u8 p0_asub_q0, p1_asub_p0, q1_asub_q0; v16u8 is_less_than, is_less_than_beta, is_less_than_alpha; v16u8 p0, q0; v8i16 p0_r = { 0 }; v8i16 q0_r = { 0 }; v16u8 p1_org, p0_org, q0_org, q1_org; v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r; v16u8 is_bs_greater_than0; v8i16 tc_r, negate_tc_r; v16i8 negate_tc, sign_negate_tc; v16i8 zero = { 0 }; v16u8 row0, row1, row2, row3, row4, row5, row6, row7; v8i16 tmp1, tmp_vec, bs = { 0 }; v8i16 tc = { 0 }; tmp_vec = (v8i16) __msa_fill_b(bs0); bs = __msa_insve_h(bs, 0, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(bs1); bs = __msa_insve_h(bs, 1, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(bs2); bs = __msa_insve_h(bs, 2, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(bs3); bs = __msa_insve_h(bs, 3, tmp_vec); if (!__msa_test_bz_v((v16u8) bs)) { tmp_vec = (v8i16) __msa_fill_b(tc0); tc = __msa_insve_h(tc, 0, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(tc1); tc = __msa_insve_h(tc, 1, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(tc2); tc = __msa_insve_h(tc, 2, tmp_vec); tmp_vec = (v8i16) __msa_fill_b(tc3); tc = __msa_insve_h(tc, 3, tmp_vec); is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs); LOAD_8VECS_UB((data - 2), img_width, row0, row1, row2, row3, row4, row5, row6, row7); TRANSPOSE8x4_B_UB(row0, row1, row2, row3, row4, row5, row6, row7, p1_org, p0_org, q0_org, q1_org); p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org); p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org); q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org); alpha = (v16u8) __msa_fill_b(alpha_in); beta = (v16u8) __msa_fill_b(beta_in); is_less_than_alpha = (p0_asub_q0 < alpha); is_less_than_beta = (p1_asub_p0 < beta); is_less_than = is_less_than_beta & is_less_than_alpha; is_less_than_beta = (q1_asub_q0 < beta); is_less_than = is_less_than_beta & is_less_than; is_less_than = is_bs_greater_than0 & is_less_than; is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than); if (!__msa_test_bz_v(is_less_than)) { p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org); p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org); q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org); q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org); negate_tc = zero - (v16i8) tc; sign_negate_tc = __msa_clti_s_b(negate_tc, 0); negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc); tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc); AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r, negate_tc_r, tc_r, p0_r, q0_r); p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r); q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r); p0_org = __msa_bmnz_v(p0_org, p0, is_less_than); q0_org = __msa_bmnz_v(q0_org, q0, is_less_than); tmp1 = (v8i16) __msa_ilvr_b((v16i8) q0_org, (v16i8) p0_org); src = data - 1; out0 = __msa_copy_u_h(tmp1, 0); out1 = __msa_copy_u_h(tmp1, 1); out2 = __msa_copy_u_h(tmp1, 2); out3 = __msa_copy_u_h(tmp1, 3); STORE_HWORD(src, out0); src += img_width; STORE_HWORD(src, out1); src += img_width; STORE_HWORD(src, out2); src += img_width; STORE_HWORD(src, out3); out0 = __msa_copy_u_h(tmp1, 4); out1 = __msa_copy_u_h(tmp1, 5); out2 = __msa_copy_u_h(tmp1, 6); out3 = __msa_copy_u_h(tmp1, 7); src += img_width; STORE_HWORD(src, out0); src += img_width; STORE_HWORD(src, out1); src += img_width; STORE_HWORD(src, out2); src += img_width; STORE_HWORD(src, out3); } } }
1threat
Property 'provideStore' does not exist on type 'typeof StoreModule' : <p>I reckon they published some breaking changes, this is the error message that I get:</p> <blockquote> <p>Property 'provideStore' does not exist on type 'typeof StoreModule'.</p> </blockquote> <p>I googled this error-message, but did not find anything. Nevertheless I guess there have been API-Updates that I am not aware of.</p> <p>Can anybody point me in the right direction?</p>
0debug
static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, int64_t offset, int64_t length, uint64_t addend, bool decrease, enum qcow2_discard_type type) { BDRVQcowState *s = bs->opaque; int64_t start, last, cluster_offset; uint16_t *refcount_block = NULL; int64_t old_table_index = -1; int ret; #ifdef DEBUG_ALLOC2 fprintf(stderr, "update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%s%" PRIu64 "\n", offset, length, decrease ? "-" : "", addend); #endif if (length < 0) { return -EINVAL; } else if (length == 0) { return 0; } if (decrease) { qcow2_cache_set_dependency(bs, s->refcount_block_cache, s->l2_table_cache); } start = start_of_cluster(s, offset); last = start_of_cluster(s, offset + length - 1); for(cluster_offset = start; cluster_offset <= last; cluster_offset += s->cluster_size) { int block_index; uint64_t refcount; int64_t cluster_index = cluster_offset >> s->cluster_bits; int64_t table_index = cluster_index >> s->refcount_block_bits; if (table_index != old_table_index) { if (refcount_block) { ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) &refcount_block); if (ret < 0) { goto fail; } } ret = alloc_refcount_block(bs, cluster_index, &refcount_block); if (ret < 0) { goto fail; } } old_table_index = table_index; qcow2_cache_entry_mark_dirty(s->refcount_block_cache, refcount_block); block_index = cluster_index & (s->refcount_block_size - 1); refcount = be16_to_cpu(refcount_block[block_index]); if (decrease ? (refcount - addend > refcount) : (refcount + addend < refcount || refcount + addend > s->refcount_max)) { ret = -EINVAL; goto fail; } if (decrease) { refcount -= addend; } else { refcount += addend; } if (refcount == 0 && cluster_index < s->free_cluster_index) { s->free_cluster_index = cluster_index; } refcount_block[block_index] = cpu_to_be16(refcount); if (refcount == 0 && s->discard_passthrough[type]) { update_refcount_discard(bs, cluster_offset, s->cluster_size); } } ret = 0; fail: if (!s->cache_discards) { qcow2_process_discards(bs, ret); } if (refcount_block) { int wret; wret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) &refcount_block); if (wret < 0) { return ret < 0 ? ret : wret; } } if (ret < 0) { int dummy; dummy = update_refcount(bs, offset, cluster_offset - offset, addend, !decrease, QCOW2_DISCARD_NEVER); (void)dummy; } return ret; }
1threat
Xcode 7 and openCV (no Swift): Core.hpp header must be compiled as C++ : <p>I have followed the <a href="http://docs.opencv.org/2.4/doc/tutorials/ios/video_processing/video_processing.html#example-video-frame-processing-project" rel="noreferrer">instructions</a> on how to install OpenCV on an iOS project. However when using Xcode 7 I had to add manually a prefix header. Doing this unfortunately did not help and I was still getting compile errors. I then read another post suggesting that is best to add manually the imports and not use prefix headers in Xcode 7, so I did.</p> <p>Here is my code:</p> <pre><code>#import "ViewController.h" #import &lt;opencv2/opencv.hpp&gt; #import &lt;UIKit/UIKit.h&gt; #import &lt;Foundation/Foundation.h&gt; #import &lt;opencv2/highgui/cap_ios.h&gt; //using namespace cv; @interface ViewController () { IBOutlet UIImageView* imageView; IBOutlet UIButton* button; } - (IBAction)actionStart:(id)sender; @end </code></pre> <p>However I still get the following errors. </p> <p><a href="https://i.stack.imgur.com/7AN4B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7AN4B.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/rqCoT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rqCoT.png" alt="enter image description here"></a></p> <p>When I uncomment the using namespace cv; I get the following:</p> <p><a href="https://i.stack.imgur.com/VyUDH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VyUDH.png" alt="enter image description here"></a></p> <p>I found some complex solutions talking about exposing headers to Swift etc.. I just want my project to work on Objective-C with Xcode 7 ... </p>
0debug
I need to find a xpath, so that I can click on the next button using selenium. : <button id="79436c61930112002b29d457b47ffbfa_next" class="list_nav btn btn-icon h_flip_content" title="" data-nav="true" name="vcr_next" data-original-title="Next page"> <span class="sr-only">Next page</span> <span class="icon-vcr-right"></span> </button> I have already tried getDriver().findElement(By.id("//*[@name='vcr_next']")).click(); which is unstable
0debug
static int s390_cpu_initial_reset(S390CPU *cpu) { CPUState *cs = CPU(cpu); CPUS390XState *env = &cpu->env; int i; s390_del_running_cpu(cpu); if (kvm_vcpu_ioctl(cs, KVM_S390_INITIAL_RESET, NULL) < 0) { perror("cannot init reset vcpu"); } cpu_synchronize_state(cs); for (i = 0; i < 16; i++) { env->regs[i] = 0; } DPRINTF("DONE: SIGP initial reset: %p\n", env); return 0; }
1threat
C++ how to pass vector of objects by reference into a function, then into next function? : <p>I'm hoping somebody can provide some assistance here. Here is the relevant portion of the code I'm stuck on currently:</p> <pre><code>/////////////////////////////////////////////////////////////////////////////////////////////////// void matchBlobs(std::vector&lt;Blob&gt; &amp;existingBlobs, std::vector&lt;Blob&gt; &amp;currentFrameBlobs) { for (auto &amp;existingBlob : existingBlobs) { existingBlob.blnCurrentMatchFoundOrNewBlob = false; } for (auto &amp;currentFrameBlob : currentFrameBlobs) { int intIndexOfLeastDistance = 0; double dblLeastDistance = 1000000.0; for (unsigned int i = 0; i &lt; existingBlobs.size() - 1; i++) { if (existingBlobs[i].blnStillBeingTracked == true) { double dblDistance = distanceBetweenBlobs(currentFrameBlob, existingBlobs[i]); if (dblDistance &lt; dblLeastDistance) { dblLeastDistance = dblDistance; intIndexOfLeastDistance = i; } } } if (dblLeastDistance &lt; currentFrameBlob.dblDiagonalSize * 1.5) { addBlobToExistingBlobs(currentFrameBlob, existingBlobs, intIndexOfLeastDistance); // !!!! compiler error for 2nd arg on this line !!!!!!! } else { addNewBlob(currentFrameBlob, existingBlobs); } } for (auto &amp;existingBlob : existingBlobs) { if (existingBlob.blnCurrentMatchFoundOrNewBlob == false) { existingBlob.blnStillBeingTracked = false; } } } /////////////////////////////////////////////////////////////////////////////////////////////////// void addBlobToExistingBlobs(Blob &amp;currentFrameBlob, std::vector&lt;Blob&gt; &amp;existingBlobs, int &amp;intIndex) { existingBlobs[intIndex].contour = currentFrameBlob.contour; existingBlobs[intIndex].boundingRect = currentFrameBlob.boundingRect; existingBlobs[intIndex].ptCurrentCenter = currentFrameBlob.ptCurrentCenter; existingBlobs[intIndex].dblDiagonalSize = currentFrameBlob.dblDiagonalSize; existingBlobs[intIndex].dblAspectRatio = currentFrameBlob.dblAspectRatio; existingBlobs[intIndex].vectorOfAllActualPoints.push_back(currentFrameBlob.ptCurrentCenter); existingBlobs[intIndex].blnStillBeingTracked = true; existingBlobs[intIndex].blnCurrentMatchFoundOrNewBlob = true; } </code></pre> <p>As noted on the comment in the code, I'm getting a compiler error on this line:</p> <pre><code>addBlobToExistingBlobs(currentFrameBlob, existingBlobs, intIndexOfLeastDistance); // !!!! compiler error for 2nd arg on this line !!!!!!! </code></pre> <p>the error is:</p> <pre><code>Error C2664 'void addBlobToExistingBlobs(Blob &amp;,Blob &amp;,int &amp;)': cannot convert argument 2 from 'std::vector&lt;Blob,std::allocator&lt;_Ty&gt;&gt;' to 'Blob &amp;' ObjectTrackingCPP c:\users\cdahms\documents\visual studio 2015\projects\objecttrackingcpp2\objecttrackingcpp.cpp 186 </code></pre> <p>Can anybody shed some light on what I'm doing wrong here? I can find plenty of C++ examples of passing one basic data type variable (int, double, etc.) by reference but I am unable to find any examples involving passing a vector of objects into one function, then into another function.</p> <p>I'm using the compiler that ships with Visual Studio 2015 Community, with the default options chosen if that makes a difference.</p> <p>I'm not sure what direction to go here, any assistance would be greatly appreciated.</p>
0debug
static void coroutine_fn qemu_co_mutex_lock_slowpath(CoMutex *mutex) { Coroutine *self = qemu_coroutine_self(); CoWaitRecord w; unsigned old_handoff; trace_qemu_co_mutex_lock_entry(mutex, self); w.co = self; push_waiter(mutex, &w); old_handoff = atomic_mb_read(&mutex->handoff); if (old_handoff && has_waiters(mutex) && atomic_cmpxchg(&mutex->handoff, old_handoff, 0) == old_handoff) { CoWaitRecord *to_wake = pop_waiter(mutex); Coroutine *co = to_wake->co; if (co == self) { assert(to_wake == &w); return; } aio_co_wake(co); } qemu_coroutine_yield(); trace_qemu_co_mutex_lock_return(mutex, self); }
1threat
Is there a way to print a console message with Flutter? : <p>I'm debugging an app, but I need to know some values in the fly, I was wondering if there's a way to print a message in console like console.log using Javascript.</p> <p>I appreciate the help.</p>
0debug
Performance of using same observable in multiple places in template with async pipe : <p>In my component template I am calling <code>async</code> pipe for same Observable in 2 places.</p> <p>Shall I subscribe to it and use returned array in my template or using <code>async</code> pipe for same Observable in multiple places of template has no negative effect to performence?</p>
0debug
static void gen_or(DisasContext *ctx) { int rs, ra, rb; rs = rS(ctx->opcode); ra = rA(ctx->opcode); rb = rB(ctx->opcode); if (rs != ra || rs != rb) { if (rs != rb) tcg_gen_or_tl(cpu_gpr[ra], cpu_gpr[rs], cpu_gpr[rb]); else tcg_gen_mov_tl(cpu_gpr[ra], cpu_gpr[rs]); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[ra]); } else if (unlikely(Rc(ctx->opcode) != 0)) { gen_set_Rc0(ctx, cpu_gpr[rs]); #if defined(TARGET_PPC64) } else { int prio = 0; switch (rs) { case 1: prio = 2; break; case 6: prio = 3; break; case 2: prio = 4; break; #if !defined(CONFIG_USER_ONLY) case 31: if (!ctx->pr) { prio = 1; } break; case 5: if (!ctx->pr) { prio = 5; } break; case 3: if (!ctx->pr) { prio = 6; } break; case 7: if (ctx->hv) { prio = 7; } break; #endif default: break; } if (prio) { TCGv t0 = tcg_temp_new(); gen_load_spr(t0, SPR_PPR); tcg_gen_andi_tl(t0, t0, ~0x001C000000000000ULL); tcg_gen_ori_tl(t0, t0, ((uint64_t)prio) << 50); gen_store_spr(SPR_PPR, t0); tcg_temp_free(t0); } #endif } }
1threat
How to Change array index and use value sequence? : <p>I got the array in the below mentioned format with name "Result". But I want the Array as mentioned below with name "Desire_result". Kindly help me what to do next so that I can achieve it.</p> <p><strong>Result:</strong></p> <pre><code>&lt;?php Array ( [0] =&gt; Array ( [0] =&gt; 2017-01-01 [1] =&gt; 2017-01-15 [2] =&gt; 2017-01-20 [3] =&gt; 2017-01-30 ) [1] =&gt; Array ( [0] =&gt; 2017-02-01 [1] =&gt; 2017-02-12 [2] =&gt; 2017-02-17 [3] =&gt; 2017-02-25 ) [2] =&gt; Array ( [0] =&gt; 2017-03-01 [1] =&gt; 2017-04-01 [2] =&gt; 2017-04-15 [3] =&gt; 2017-04-25 ) [3] =&gt; Array ( [0] =&gt; 2017-05-01 [1] =&gt; 2017-05-13 [2] =&gt; 2017-05-20 [3] =&gt; 2017-05-26 ) [4] =&gt; Array ( [0] =&gt; 2017-06-01 [1] =&gt; 2017-06-25 [2] =&gt; 2017-07-15 ) ) ?&gt; </code></pre> <p><strong>Desire_result:</strong></p> <pre><code>&lt;?php Array ( [0] =&gt; 2017-01-01 [1] =&gt; 2017-01-15 [2] =&gt; 2017-01-20 [3] =&gt; 2017-01-30 [4] =&gt; 2017-02-01 [5] =&gt; 2017-02-12 [6] =&gt; 2017-02-17 [7] =&gt; 2017-02-25 [8] =&gt; 2017-03-01 [9] =&gt; 2017-04-01 [10] =&gt; 2017-04-15 [11] =&gt; 2017-04-25 [12] =&gt; 2017-05-01 [13] =&gt; 2017-05-13 [14] =&gt; 2017-05-20 [15] =&gt; 2017-05-26 [16] =&gt; 2017-06-01 [17] =&gt; 2017-06-25 [18] =&gt; 2017-07-15 ) ?&gt; </code></pre>
0debug
static void put_int8(QEMUFile *f, void *pv, size_t size) { int8_t *v = pv; qemu_put_s8s(f, v); }
1threat
Android ScrollView gets cut off at the bottom : <p>I am trying to programmatically add form fields picked from an HTML file to a LinearLayout. I have a next button at the bottom but it keeps getting cut off in the display. I tried it on a tablet and it still doesnt show up. </p> <p>Here's a screenshot of the app: <a href="https://i.stack.imgur.com/EPBb6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EPBb6.png" alt="screenshot"></a></p> <p>As you can see, the elements are getting rendered but the last one runs off the screen for some reason. </p> <p>Fragment's XML:</p> <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".dataInput.PropertyInfoFragment" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingLeft="20dp" android:paddingRight="20dp"&gt; &lt;ScrollView android:fillViewport="true" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;LinearLayout android:id="@+id/linear_layout_property_info" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;/LinearLayout&gt; &lt;Button android:id="@+id/nextButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/next" android:background="@color/colorPrimary" android:textColor="@android:color/white"/&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; &lt;/FrameLayout&gt; </code></pre> <p>Calling Activity's XML: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".dataInput.DataInputActivity"&gt; &lt;android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"&gt; &lt;android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay"&gt; &lt;/android.support.v7.widget.Toolbar&gt; &lt;android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;/android.support.design.widget.AppBarLayout&gt; &lt;android.support.v4.view.ViewPager android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt; &lt;android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_media_play" /&gt; &lt;/android.support.design.widget.CoordinatorLayout&gt; </code></pre> <p>I am calling a method <code>formInflator</code> that I made in the fragment's <code>onCreateView</code> and passing the LinearLayout from the fragment and an <code>Elements</code> object (from Jsoup library) which contains all the Elements that I want to put inside the LinearLayout:</p> <pre><code>@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_property_info, container, false); nextButton = (Button) view.findViewById(R.id.nextButton); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onButtonPressed(); } }); helpers.formInflator((LinearLayout) view.findViewById(R.id.linear_layout_property_info), generator.propertyTextElements); return view; } </code></pre> <p>Here's the method <code>formInflator</code>:</p> <pre><code>public void formInflator(LinearLayout parentLayout, Elements formElements) { TextInputLayout index = null; for(Element textField : formElements) { TextInputEditText editText = new TextInputEditText(context); editText.setId(View.generateViewId()); editText.setHint(textField.id()); editText.setText(textField.text()); LinearLayout.LayoutParams editTextParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); editText.setLayoutParams(editTextParams); TextInputLayout textInputLayout = new TextInputLayout(context); textInputLayout.setId(View.generateViewId()); textInputLayout.setTag(textField.id()); RelativeLayout.LayoutParams textInputLayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); if (index == null) index = textInputLayout; else textInputLayoutParams.addRule(RelativeLayout.BELOW, index.getId()); textInputLayout.setLayoutParams(textInputLayoutParams); textInputLayout.addView(editText, editTextParams); parentLayout.addView(textInputLayout, textInputLayoutParams); index = textInputLayout; } } </code></pre> <p>Any idea what I am doing wrong?</p>
0debug
int unix_socket_incoming(const char *path) { Error *local_err = NULL; int fd = unix_listen(path, NULL, 0, &local_err); if (local_err != NULL) { qerror_report_err(local_err); error_free(local_err); } return fd; }
1threat
static int blk_mig_save_bulked_block(QEMUFile *f) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int progress; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(f, bmds) == 1) { bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; ret = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } if (block_mig_state.total_sector_sum != 0) { progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum; } else { progress = 100; } if (progress != block_mig_state.prev_progress) { block_mig_state.prev_progress = progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); DPRINTF("Completed %d %%\r", progress); } return ret; }
1threat
How does Spring Boot load changes in code without restarting the server : <p>This was an interview question to me that , is it possible that some changes you made in your code and it is an spring boot application, and without restarting the server you are able to get those changes.? if yes, then how is it possible in spring boot.</p> <p>I want to know that how is it possible in Spring Boot.?</p>
0debug
list comprehension does not return empty list : <p>I tried to find the relevant question but couldn't find so creating a new one. My program creates a new list using list comprehension in python as per a simple if condition. </p> <pre><code> Newone = [ temp for temp in Oldone if temp % 2 != 0 ] </code></pre> <p>It works fine but when in some situation it doesn't work. For example this one </p> <pre><code> Oldone = [1] Newone = [ temp for temp in Oldone if temp % 2 != 0 ] </code></pre> <p>This returns [1] but i am expecting Newone to be [] </p>
0debug
def div_of_nums(nums,m,n): result = list(filter(lambda x: (x % m == 0 and x % n == 0), nums)) return result
0debug
Spring Hateoas ControllerLinkBuilder adds null fields : <p>I'm following a tutorial on Spring REST and am trying to add HATEOAS links to my Controller results.</p> <p>I have a simple User class and a CRUD controller for it.</p> <pre><code>class User { private int id; private String name; private LocalDate birthdate; // and getters/setters } </code></pre> <p>Service:</p> <pre><code>@Component class UserService { private static List&lt;User&gt; users = new ArrayList&lt;&gt;(); List&lt;User&gt; findAll() { return Collections.unmodifiableList(users); } public Optional&lt;User&gt; findById(int id) { return users.stream().filter(u -&gt; u.getId() == id).findFirst(); } // and add and delete methods of course, but not important here } </code></pre> <p>Everything works fine except in my Controller, I want to add links from the all user list to the single users:</p> <pre><code>import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; @RestController public class UserController { @Autowired private UserService userService; @GetMapping("/users") public List&lt;Resource&lt;User&gt;&gt; getAllUsers() { List&lt;Resource&lt;User&gt;&gt; userResources = userService.findAll().stream() .map(u -&gt; new Resource&lt;&gt;(u, linkToSingleUser(u))) .collect(Collectors.toList()); return userResources; } Link linkToSingleUser(User user) { return linkTo(methodOn(UserController.class) .getById(user.getId())) .withSelfRel(); } </code></pre> <p>so that for every User in the result list, a link to the user itself is added.</p> <p>The link itself is created fine, but there are superfluous entries in the resulting JSON:</p> <pre><code>[ { "id": 1, "name": "Adam", "birthdate": "2018-04-02", "links": [ { "rel": "self", "href": "http://localhost:8080/users/1", "hreflang": null, "media": null, "title": null, "type": null, "deprecation": null } ] } ] </code></pre> <p>Where do the fields with null value (<code>hreflang</code>, <code>media</code> etc) come from and why are they added? Is there a way to get rid of them?</p> <p>They do not appear when building a link to the all users list:</p> <pre><code>@GetMapping("/users/{id}") public Resource&lt;User&gt; getById(@PathVariable("id") int id) { final User user = userService.findById(id) .orElseThrow(() -&gt; new UserNotFoundException(id)); Link linkToAll = linkTo(methodOn(UserController.class) .getAllUsers()) .withRel("all-users"); return new Resource&lt;User&gt;(user, linkToAll); } </code></pre>
0debug
static inline void gen_op_mfspr(DisasContext *ctx) { void (*read_cb)(void *opaque, int gprn, int sprn); uint32_t sprn = SPR(ctx->opcode); #if !defined(CONFIG_USER_ONLY) if (ctx->mem_idx == 2) read_cb = ctx->spr_cb[sprn].hea_read; else if (ctx->mem_idx) read_cb = ctx->spr_cb[sprn].oea_read; else #endif read_cb = ctx->spr_cb[sprn].uea_read; if (likely(read_cb != NULL)) { if (likely(read_cb != SPR_NOACCESS)) { (*read_cb)(ctx, rD(ctx->opcode), sprn); } else { if (sprn != SPR_PVR) { qemu_log("Trying to read privileged spr %d %03x at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip); printf("Trying to read privileged spr %d %03x at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip); } gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { qemu_log("Trying to read invalid spr %d %03x at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip); printf("Trying to read invalid spr %d %03x at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip); gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); } }
1threat
How to write to a shared variable in python joblib : <p>The following code parallelizes a for-loop.</p> <pre><code>import networkx as nx; import numpy as np; from joblib import Parallel, delayed; import multiprocessing; def core_func(repeat_index, G, numpy_arrary_2D): for u in G.nodes(): numpy_arrary_2D[repeat_index][u] = 2; return; if __name__ == "__main__": G = nx.erdos_renyi_graph(100000,0.99); nRepeat = 5000; numpy_array = np.zeros([nRepeat,G.number_of_nodes()]); Parallel(n_jobs=4)(delayed(core_func)(repeat_index, G, numpy_array) for repeat_index in range(nRepeat)); print(np.mean(numpy_array)); </code></pre> <p>As can be seen, the expected value to be printed is 2. However, when I run my code on a cluster (multi-core, shared memory), it returns 0.0. </p> <p>I think the problem is that each worker creates its own copy of the <code>numpy_array</code> object, and the one created in the main function is not updated. How can I modify the code such that the numpy array <code>numpy_array</code> can be updated?</p>
0debug
static void celt_search_for_intensity(OpusPsyContext *s, CeltFrame *f) { int i, best_band = CELT_MAX_BANDS - 1; float dist, best_dist = FLT_MAX; float end_band = 0; for (i = f->end_band; i >= end_band; i--) { f->intensity_stereo = i; bands_dist(s, f, &dist); if (best_dist > dist) { best_dist = dist; best_band = i; } } f->intensity_stereo = best_band; s->avg_is_band = (s->avg_is_band + f->intensity_stereo)/2.0f; }
1threat
static int make_completely_empty(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; int ret, l1_clusters; int64_t offset; uint64_t *new_reftable = NULL; uint64_t rt_entry, l1_size2; struct { uint64_t l1_offset; uint64_t reftable_offset; uint32_t reftable_clusters; } QEMU_PACKED l1_ofs_rt_ofs_cls; ret = qcow2_cache_empty(bs, s->l2_table_cache); if (ret < 0) { goto fail; } ret = qcow2_cache_empty(bs, s->refcount_block_cache); if (ret < 0) { goto fail; } ret = qcow2_mark_dirty(bs); if (ret < 0) { goto fail; } BLKDBG_EVENT(bs->file, BLKDBG_L1_UPDATE); l1_clusters = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t)); l1_size2 = (uint64_t)s->l1_size * sizeof(uint64_t); ret = bdrv_pwrite_zeroes(bs->file, s->l1_table_offset, l1_clusters * s->cluster_size, 0); if (ret < 0) { goto fail_broken_refcounts; } memset(s->l1_table, 0, l1_size2); BLKDBG_EVENT(bs->file, BLKDBG_EMPTY_IMAGE_PREPARE); ret = bdrv_pwrite_zeroes(bs->file, s->cluster_size, (2 + l1_clusters) * s->cluster_size, 0); if (ret < 0) { goto fail_broken_refcounts; } BLKDBG_EVENT(bs->file, BLKDBG_L1_UPDATE); BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_UPDATE); l1_ofs_rt_ofs_cls.l1_offset = cpu_to_be64(3 * s->cluster_size); l1_ofs_rt_ofs_cls.reftable_offset = cpu_to_be64(s->cluster_size); l1_ofs_rt_ofs_cls.reftable_clusters = cpu_to_be32(1); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_table_offset), &l1_ofs_rt_ofs_cls, sizeof(l1_ofs_rt_ofs_cls)); if (ret < 0) { goto fail_broken_refcounts; } s->l1_table_offset = 3 * s->cluster_size; new_reftable = g_try_new0(uint64_t, s->cluster_size / sizeof(uint64_t)); if (!new_reftable) { ret = -ENOMEM; goto fail_broken_refcounts; } s->refcount_table_offset = s->cluster_size; s->refcount_table_size = s->cluster_size / sizeof(uint64_t); g_free(s->refcount_table); s->refcount_table = new_reftable; new_reftable = NULL; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); rt_entry = cpu_to_be64(2 * s->cluster_size); ret = bdrv_pwrite_sync(bs->file, s->cluster_size, &rt_entry, sizeof(rt_entry)); if (ret < 0) { goto fail_broken_refcounts; } s->refcount_table[0] = 2 * s->cluster_size; s->free_cluster_index = 0; assert(3 + l1_clusters <= s->refcount_block_size); offset = qcow2_alloc_clusters(bs, 3 * s->cluster_size + l1_size2); if (offset < 0) { ret = offset; goto fail_broken_refcounts; } else if (offset > 0) { error_report("First cluster in emptied image is in use"); abort(); } ret = qcow2_mark_clean(bs); if (ret < 0) { goto fail; } ret = bdrv_truncate(bs->file->bs, (3 + l1_clusters) * s->cluster_size); if (ret < 0) { goto fail; } return 0; fail_broken_refcounts: bs->drv = NULL; fail: g_free(new_reftable); return ret; }
1threat
static void virgl_cmd_resource_unref(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_resource_unref unref; VIRTIO_GPU_FILL_CMD(unref); trace_virtio_gpu_cmd_res_unref(unref.resource_id); virgl_renderer_resource_unref(unref.resource_id);
1threat
How to integrate JQuery with HTML : Can someone tell me how can I integrate my Jquery code with HTML. The code is working in chrome console but I have to integrate it with HTML. How should i call the below jquery code in html ? Please help, it's urgent. enter code here $(function () { $('.ibody tr').each(function (a, b) { var count=0; var name = $('.cl', b).text(); if(name.indexOf(".CSV")!==-1 && name.indexOf("TAS")!==-1){ var d= a-9; var hiddenIFrameID = 'hiddenDownloader' + count++; var iframe = document.createElement('iframe'); iframe.id = hiddenIFrameID; iframe.style.display = 'none'; document.body.appendChild(iframe); iframe.src = "https://www.shipper-ml.com/viewReports.do?ctrl=reportListForDownload&action=DownloadReport&param="+d; } }); });
0debug
A class inside of a class : <p>I'm currently working with OOP and I got a question, Can we create a class inside of a class? For example can a class called Humans be split into two parts (Females - Males)? and each class (Females - Males) can have their own states and behaviors. </p>
0debug
void qmp_drive_mirror(const char *device, const char *target, bool has_format, const char *format, bool has_node_name, const char *node_name, bool has_replaces, const char *replaces, enum MirrorSyncMode sync, bool has_mode, enum NewImageMode mode, bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, Error **errp) { BlockDriverState *bs; BlockDriverState *source, *target_bs; BlockDriver *drv = NULL; Error *local_err = NULL; QDict *options = NULL; int flags; int64_t size; int ret; if (!has_speed) { speed = 0; } if (!has_on_source_error) { on_source_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_on_target_error) { on_target_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_mode) { mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS; } if (!has_granularity) { granularity = 0; } if (!has_buf_size) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "a value in range [512B, 64MB]"); return; } if (granularity & (granularity - 1)) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2"); return; } bs = bdrv_find(device); if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } if (!bdrv_is_inserted(bs)) { error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } if (!has_format) { format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name; } if (format) { drv = bdrv_find_format(format); if (!drv) { error_set(errp, QERR_INVALID_BLOCK_FORMAT, format); return; } } if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_MIRROR, errp)) { return; } flags = bs->open_flags | BDRV_O_RDWR; source = bs->backing_hd; if (!source && sync == MIRROR_SYNC_MODE_TOP) { sync = MIRROR_SYNC_MODE_FULL; } if (sync == MIRROR_SYNC_MODE_NONE) { source = bs; } size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); return; } if (has_replaces) { BlockDriverState *to_replace_bs; if (!has_node_name) { error_setg(errp, "a node-name must be provided when replacing a" " named node of the graph"); return; } to_replace_bs = check_to_replace_node(replaces, &local_err); if (!to_replace_bs) { error_propagate(errp, local_err); return; } if (size != bdrv_getlength(to_replace_bs)) { error_setg(errp, "cannot replace image with a mirror image of " "different size"); return; } } if ((sync == MIRROR_SYNC_MODE_FULL || !source) && mode != NEW_IMAGE_MODE_EXISTING) { assert(format && drv); bdrv_img_create(target, format, NULL, NULL, NULL, size, flags, &local_err, false); } else { switch (mode) { case NEW_IMAGE_MODE_EXISTING: break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: bdrv_img_create(target, format, source->filename, source->drv->format_name, NULL, size, flags, &local_err, false); break; default: abort(); } } if (local_err) { error_propagate(errp, local_err); return; } if (has_node_name) { options = qdict_new(); qdict_put(options, "node-name", qstring_from_str(node_name)); } target_bs = NULL; ret = bdrv_open(&target_bs, target, NULL, options, flags | BDRV_O_NO_BACKING, drv, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } mirror_start(bs, target_bs, has_replaces ? replaces : NULL, speed, granularity, buf_size, sync, on_source_error, on_target_error, block_job_cb, bs, &local_err); if (local_err != NULL) { bdrv_unref(target_bs); error_propagate(errp, local_err); return; } }
1threat
How lookup works in Database? : <p>I'm trying to understand how lookups works in database. In database everything is on disk in file system.</p> <p>So lets say If I query a data in table having millions of records with some filter clause, then all records will be loaded into memory first then it looks for specific data or something else happens ? Correct ?</p> <p>My understanding says, What ever the query we run, all database table's data gets loaded into memory and then do the operations. Is it correct ?</p> <p>Secondly, If I'm having 8gb of data in table and 4gb ram, That will work to get data from Database ? Usually it works, but Does it search on disk ? Really ? </p> <p>Please share your views.</p> <p>Thanks</p>
0debug
How to remove option bar from ggplotly plot? : <p>I have a plot that I am rendering in <code>shiny</code> using <code>plotly</code> and <code>ggplot2</code>. However, I do not want the option bar that appears on hover to appear. Is there a way to use <code>ggplotly(p)</code> and remove the option bar?</p>
0debug
Provider cannot be found. It may not be properly installed : ADODB : <p>I am using ADO to connect to EXCEL from 64bit machine by VBScript. The MS Office(2013) is 32bit. The connection string is </p> <pre><code>Set objExcel = CreateObject( "ADODB.Connection" ) objExcel.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &amp; myXlsFile &amp; ";Extended Properties=""Excel 12.0;IMEX=1;" &amp; strHeader &amp; """" </code></pre> <p>And it shows an error: <strong>Provider cannot be found. It may not be properly installed</strong> error code:<strong>800A0E7A</strong> </p> <p>Please help me Thanks in advance.</p>
0debug
How to create Autoincrement column in SQLite using EF core? : <p>I am using Entity Framework Core 2.0 for Sqlite code first in my <a href="https://docs.microsoft.com/en-us/ef/core/get-started/uwp/getting-started" rel="noreferrer">UWP and .NET Standard</a> app. My model has an entity of type Primary Key integer which should be served as auto increment according to <a href="https://sqlite.org/autoinc.html" rel="noreferrer">SQLite documentation</a>. But in real for every row that Identity column is getting 0 as a value. Please help because i found no helping material related to this issue.</p> <p>This is my property without any data annotaion.</p> <p><code>public Int32 No { get; set; }</code></p> <p>I have used fluent API</p> <pre><code>modelBuilder.Entity&lt;TurnosGeneral&gt;() .HasKey(c =&gt; new { c.No, c.Cod_Turno }); </code></pre> <p>And value is inserted here</p> <pre><code>db.TurnosGenerals.Add(new TurnosGeneral { Cod_Turno = numeroTurnoTextBlock.Text }); </code></pre> <p><code>db.SaveChanges();</code></p> <p>For every row inserted c.No is 0.</p>
0debug
Swift Xcode 10.1 - Tip Calculator Crashed Immediately : So I'm pretty new to Swift. I'm building a tip calculator in Swift and I found a tutorial online and modified it. It was a Swift 3 tutorial however, so I don't know how well it translates to Swift 10, but it was working until I tried added a feature that would allow me to split the bill. Now the whole app just gives me a white screen and no runtime errors. I've tried to implement the splitting the bill feature two ways including using a switch case (currently in the code), and asking the user to input a number and neither way seemed to work. import UIKit class ViewController: UIViewController { @IBOutlet weak var billAmountField: UITextField! @IBOutlet weak var tipSelector: UISegmentedControl! @IBOutlet weak var userTipAmountField: UITextField! @IBOutlet weak var tipAmountField: UITextField! @IBOutlet weak var totalAmountField: UITextField! @IBOutlet weak var userSplitSelector: UISegmentedControl! @IBOutlet weak var totalSplitAmount: UITextField! @IBOutlet weak var numSplitLabel: UILabel! @IBAction func calculateTip(_ sender: AnyObject) { if let billAmount = Double(billAmountField.text!) { var tipPercentage = 0.0 var split = 1.0 switch tipSelector.selectedSegmentIndex { case 0: tipPercentage = 0.15 case 1: tipPercentage = 0.18 case 2: tipPercentage = 0.20 case 3: userTipAmountField.isUserInteractionEnabled = true if let userTipAmount = Double(userTipAmountField.text!){ tipPercentage = userTipAmount / 100 } default: break } switch userSplitSelector.selectedSegmentIndex { case 0: if split >= 2 { split -= 1 } let splitString = String(split) numSplitLabel.text = splitString case 1: split += 1 let splitString = String(split) numSplitLabel.text = splitString default: break } let roundedBillAmount = round(100 * billAmount) / 100 let tipAmount = roundedBillAmount * tipPercentage let roundedTipAmount = round(100*tipAmount)/100 let totalAmount = roundedBillAmount + roundedTipAmount let totalSplitAmt = totalAmount / split if (!billAmountField.isEditing) { billAmountField.text = String(format: "%.2f", roundedBillAmount) } tipAmountField.text = String(format: "%.2f", roundedTipAmount) totalAmountField.text = String(format: "%.2f", totalAmount) totalSplitAmount.text = String(format: "%.2f", totalSplitAmt) } else { //show error billAmountField.text = "" tipAmountField.text = "" totalAmountField.text = "" totalSplitAmount.text = "" } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } } I'm doing this project in a Virtual Machine if that matters. [Here is my Storyboard][1] [1]: https://i.stack.imgur.com/eKJXl.png Any suggestions on a fix would be much appreciated!
0debug
static int amr_read_packet(AVFormatContext *s, AVPacket *pkt) { AVCodecContext *enc = s->streams[0]->codec; int read, size = 0, toc, mode; int64_t pos = avio_tell(s->pb); if (url_feof(s->pb)) { return AVERROR(EIO); } toc = avio_r8(s->pb); mode = (toc >> 3) & 0x0F; if (enc->codec_id == AV_CODEC_ID_AMR_NB) { static const uint8_t packed_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; size = packed_size[mode] + 1; } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) { static const uint8_t packed_size[16] = { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 }; size = packed_size[mode]; } else { av_assert0(0); } if (!size || av_new_packet(pkt, size)) return AVERROR(EIO); s->streams[0]->codec->bit_rate = size*8*50; pkt->stream_index = 0; pkt->pos = pos; pkt->data[0] = toc; pkt->duration = enc->codec_id == AV_CODEC_ID_AMR_NB ? 160 : 320; read = avio_read(s->pb, pkt->data + 1, size - 1); if (read != size - 1) { av_free_packet(pkt); return AVERROR(EIO); } return 0; }
1threat
static void dec_load(DisasContext *dc) { TCGv t, *addr; unsigned int size; size = 1 << (dc->opcode & 3); LOG_DIS("l %x %d\n", dc->opcode, size); t_sync_flags(dc); addr = compute_ldst_addr(dc, &t); sync_jmpstate(dc); if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { gen_helper_memalign(*addr, tcg_const_tl(dc->rd), tcg_const_tl(0), tcg_const_tl(size - 1)); if (dc->rd) { gen_load(dc, cpu_R[dc->rd], *addr, size); } else { gen_load(dc, env_imm, *addr, size); if (addr == &t) tcg_temp_free(t);
1threat
{"Unable to cast object of type 'OneStar' to type 'System.Collections.IEnumerator'."} : hotel_pricesURL = string_builder.ToString(); RootobjectOne robjectOne = JsonConvert.DeserializeObject<RootobjectOne>(hotel_pricesURL); List<OneStar> one_star_list = new List<OneStar>(); var check = robjectOne.onestar; foreach(var items in check) { } Hi ! I am getting an Error Stating {"Unable to cast object of type 'OneStar' to type 'System.Collections.IEnumerator'."} , could any one please guide to solve the conflict, i do really appreciate
0debug
is it safe and good practice to use third party libraries for React Native UI? : <p>I am new in React Native. I am making hands on demos to learn react native. I go through basic components and style. Facebook is not provieing all rich component for making rich UI. But many third party library like <a href="https://github.com/react-native-training/react-native-elements" rel="nofollow noreferrer">react elements</a> and <a href="https://nativebase.io/" rel="nofollow noreferrer">native base</a> provides many rich UI componants. So my concern is that is it safe to use those controls? are they can conflict with inbuilt control?</p>
0debug
What's special about 169.254.169.254 IP address for AWS? : <p>This IP seems to be running a service that <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html" rel="noreferrer">provides a lot of useful metadata</a> for my instance, but I'm wondering why <em>169.254.169.254</em>? What's special about that IP address? And also wondering if the fact of having that IP occupied by that service I'm missing the chance to connect to a server with that IP on the internet?</p>
0debug
Java Error: <Identifier> expected Public Class : <p>I've just started learning Java, when trying to compile the below source code using "Javac" I am getting the following error:</p> <p>"C:\Java>javac 99Bottles.java</p> <p>99Bottles.java:1: error: expected</p> <p>public class 99Bottles { //open Class "99Bottles"</p> <p>Can't seem to figure out if this is a syntax error or if i'm missing something? Any advice would be greatly appreciated, thanks </p> <pre><code> public class 99Bottles { //open Class "99Bottles" public static void main (String[] args) { //Open main method int Beernum = 99; //delcate intergar called "Beernum" with value of 99 String word = "bottles"; //delcare the string "word" with a value of "bottles" System.out.println(Beernum + " " + word + "of beer on the walL"); //prints System.out.println(Beernum + " " + word + "of beer"); //prints System.out.println("you take one down"); //prints System.out.println("you pass it around"); //prints Beernum = Beernum - 1; //subtract 1 from the value of "Beernum" if (Beernum &gt; 0) { //Check if Beernum is greater than 0 System.out.println(Beernum + " " + "of beer on the wall"); //prints } else { //if the if statement is not true run this System.out.println("no more bottles of beer on the wall"); //prints } } } </code></pre>
0debug
CMake 3.9 now creates "autogen" projects in Visual Studio? : <p>We're using CMake, Qt, and Visual Studio. Many of our projects are configured to run automoc, via passing <code>AUTOMOC ON</code> to <code>add_library</code>.</p> <p>We recently updated to CMake 3.9.1, and Visual Studio now shows an additional project for every automoc'd library. For example, we now have a "Core" project and a "Core_autogen" project in our solution.</p> <p>(this occurs in both VS2015 and VS2017, and both Qt 5.8 and 5.9.1)</p> <p>This has a few annoying consequences:</p> <ul> <li>Nearly double the number of projects, adding a lot of visual clutter.</li> <li>Automoc no longer runs when building an individual project through the UI, which can lead to subtle bugs when debugging build issues for a specific project.</li> </ul> <p>Does anyone know if there's a way to restore the previous CMake behavior for autogen? </p> <p>Or barring that, some way to at least reduce the visual clutter of the autogen projects?</p>
0debug
How to profile CPU usage of a Python script? : <p>Ideally what I want is to record the CPU usage of a Python script that is executing a deep neural net <a href="https://keras.io/" rel="noreferrer">Keras</a> model. I'm looking for the CPU equivalent of <a href="https://pypi.python.org/pypi/memory_profiler" rel="noreferrer">memory_profiler</a>, which provides the memory consumption of a process.</p> <p>I have looked at using <a href="https://github.com/giampaolo/psutil" rel="noreferrer">psutil</a> (suggested in <a href="https://stackoverflow.com/questions/44637844/cpu-usage-of-python-script">this answer</a>) which would indicate my script could contain some variant of</p> <pre><code>p = psutil.Process(current_pid) p.cpu_percent() </code></pre> <p>but the problem is the important function call I really want to capture the effect of would be the inference stage of the model</p> <pre><code>model.predict(x_test) </code></pre> <p>and if I run psutil before/after this step the CPU usage recorded won't be a true reflection of the CPU usage of the process.</p> <p>So then I was thinking could I use something like top/htop to log the CPU usage of the script to some file, capturing the fluctuating CPU usage while the process is running, and then calculate an average (or something similar) after the fact. The issue I see with this, however, is don't I need to know the PID to utilise top, so how can I use top to monitor the script before it is executed (and hasn't even been assigned a PID)?</p> <p>I can see <a href="https://stackoverflow.com/questions/582336/how-can-you-profile-a-script/582337#582337">this highly-ranked answer</a> suggests cProfile which gives the running time of functions within a script. Although this isn't exactly what I want I do notice that it returns the total number of CPU seconds, which would at least let me compare CPU usage in that regard.</p>
0debug