problem
stringlengths
26
131k
labels
class label
2 classes
How to break/split the content in a div tag in javascript : This div tag contains the following content ."Name Individual Branch" <html>`<div hidden name = "divT" id = "divT" >Hi</div> <html>` I want Name in a separate div . These are dynamic and are coming from the database the following is my javascript code <html> function showName(Policy,Select) { //alert("Hi"+Select+Policy); if (Policy == "") { document.getElementById("divT").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); //alert("Hi"); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { //alert("Hi3" + xmlhttp.readyState + xmlhttp.status ); if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { //alert(xmlhttp.responseText); document.getElementById("divT").innerHTML = xmlhttp.responseText; document.getElementById("divT").style.display ='block'; //document.getElementById("divT1").style.display ='block'; // alert(xmlhttp.responseText); } }; xmlhttp.open("GET","query.php?policy="+Policy+'&select='+Select,true); xmlhttp.send(); } } <html>
0debug
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { int i; MpegEncContext *s = dst->priv_data, *s1 = src->priv_data; if (dst == src || !s1->context_initialized) return 0; if (!s->context_initialized) { memcpy(s, s1, sizeof(MpegEncContext)); s->avctx = dst; s->picture_range_start += MAX_PICTURE_COUNT; s->picture_range_end += MAX_PICTURE_COUNT; s->bitstream_buffer = NULL; s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0; ff_MPV_common_init(s); } if (s->height != s1->height || s->width != s1->width || s->context_reinit) { int err; s->context_reinit = 0; s->height = s1->height; s->width = s1->width; if ((err = ff_MPV_common_frame_size_change(s)) < 0) return err; } s->avctx->coded_height = s1->avctx->coded_height; s->avctx->coded_width = s1->avctx->coded_width; s->avctx->width = s1->avctx->width; s->avctx->height = s1->avctx->height; s->coded_picture_number = s1->coded_picture_number; s->picture_number = s1->picture_number; s->input_picture_number = s1->input_picture_number; memcpy(s->picture, s1->picture, s1->picture_count * sizeof(Picture)); memcpy(&s->last_picture, &s1->last_picture, (char *) &s1->last_picture_ptr - (char *) &s1->last_picture); s->last_picture_ptr = REBASE_PICTURE(s1->last_picture_ptr, s, s1); s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1); s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1); s->next_p_frame_damaged = s1->next_p_frame_damaged; s->workaround_bugs = s1->workaround_bugs; memcpy(&s->time_increment_bits, &s1->time_increment_bits, (char *) &s1->shape - (char *) &s1->time_increment_bits); s->max_b_frames = s1->max_b_frames; s->low_delay = s1->low_delay; s->dropable = s1->dropable; s->divx_packed = s1->divx_packed; if (s1->bitstream_buffer) { if (s1->bitstream_buffer_size + FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) av_fast_malloc(&s->bitstream_buffer, &s->allocated_bitstream_buffer_size, s1->allocated_bitstream_buffer_size); s->bitstream_buffer_size = s1->bitstream_buffer_size; memcpy(s->bitstream_buffer, s1->bitstream_buffer, s1->bitstream_buffer_size); memset(s->bitstream_buffer + s->bitstream_buffer_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); } memcpy(&s->progressive_sequence, &s1->progressive_sequence, (char *) &s1->rtp_mode - (char *) &s1->progressive_sequence); if (!s1->first_field) { s->last_pict_type = s1->pict_type; if (s1->current_picture_ptr) s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f.quality; if (s1->pict_type != AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s1->pict_type; } } return 0; }
1threat
static int gdbserver_open(int port) { struct sockaddr_in sockaddr; int fd, ret; fd = socket(PF_INET, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); return -1; } #ifndef _WIN32 fcntl(fd, F_SETFD, FD_CLOEXEC); #endif socket_set_fast_reuse(fd); sockaddr.sin_family = AF_INET; sockaddr.sin_port = htons(port); sockaddr.sin_addr.s_addr = 0; ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); if (ret < 0) { perror("bind"); close(fd); return -1; } ret = listen(fd, 0); if (ret < 0) { perror("listen"); close(fd); return -1; } return fd; }
1threat
i try to implement merge sort algorythm using python but the code doesn't work well : <p>here merge function:</p> <pre><code>def __merge__(arr, middle): L = arr[:middle] R = arr[middle:] L.append(math.inf) R.append(math.inf) i = 0 j = 0 for k in range(0, len(arr)): if(L[i] &lt;= R[j]): arr[k] = L[i] i += 1 else: arr[k] = R[j] j += 1 return arr </code></pre> <p>and here mergesort function that call intself recursively:</p> <pre><code>def __mergeSort__(listOfNumber): if(len(listOfNumber) &lt;= 1): return listOfNumber middle = int( len(listOfNumber) / 2 ) print('merge lit: ', listOfNumber[:middle]) __mergeSort__(listOfNumber[:middle]) print('merge lit: ', listOfNumber[middle:]) __mergeSort__(listOfNumber[middle:]) print(__merge__(listOfNumber, middle)) return __merge__(listOfNumber, middle) </code></pre> <p>when I give array like[6,5,4,3,2,1] as input i receve this: [3, 2, 1, 6, 5, 4]</p>
0debug
Using read.table in a for loop in R : I am trying to read in multiple files into R, which are in multiple directories (which cannot be changed). My code is as follows: gs_scores_dir="/home/directory1/file1.txt" ps_scores_dir="/home/directory2/file2.txt" ds_scores_dir="/home/directory3/file3.txt" for (data in c("gs","ps","ds")){ assign(paste(data,"scores", sep="_"), read.table(paste(data,"scores_dir",sep="_"),header=T)) } ie. I want three files read into R, with the object names `gs_scores`, `ps_scores` and `ds_scores`. However I get the following error message: Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'gs_scores_dir': No such file or directory When I change the code to the following for example, it works: for (data in c("gs","ps","ds")){ assign(paste(data,"scores", sep="_"), read.table(gs_scores_dir,header=T)) } Does anyone know what the error of my code is or a better way of using read.table within a for loop? Thank you.
0debug
1. CGPathMoveToPoint' is unavailable: Use move(to:transform:) 2. 'CGPathAddLineToPoint' is unavailable: Use addLine(to:transform:) : <p>I have created one of my application in <code>swift 2</code> in <code>Xcode 7.3.1</code>. But now I have open same application in <code>Xcode 8.0</code> and perform changes. Some automatic changes are done and some errors and suggestions shown I have corrected them. But I am facing issue that </p> <pre><code>let path = CGMutablePath() CGPathMoveToPoint(path, nil, lineFrame.midX, lineFrame.midY) CGPathAddLineToPoint(path, nil, lineFrame.origin.x + lineFrame.width / 2, lineFrame.origin.y) </code></pre> <p>I tried to create <code>path</code>, but shows error that </p> <blockquote> <ol> <li><code>CGPathMoveToPoint</code> is unavailable: Use move(to:transform:)</li> <li><code>CGPathAddLineToPoint</code> is unavailable: Use addLine(to:transform:)</li> </ol> </blockquote> <p>If anyone have solution, please let me know.</p>
0debug
Do I need to replace NSURLConnection in order to achieve mandatory support for IPv6-only services? : <p>As Apple is requesting app submitted for review must support IPv6-only network starting from 1st June 2016, I am checking if I need to replace certain API / libraries in my app. However I don't know much enough about networking and some related aspects, as a result I am unable to have a definite answer on this and would like to seek for help.</p> <p>Regarding the document <a href="https://developer.apple.com/library/mac/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW13" rel="noreferrer">Supporting IPv6 DNS64/NAT64 Networks</a> provided by Apple, it states that apps should be fine and no need to perform update if:</p> <blockquote> <p>you’re writing a client-side app using high-level networking APIs such as <strong>NSURLSession</strong> and the <strong>CFNetwork frameworks</strong> and you <strong>connect by name</strong></p> </blockquote> <p>By this I take it as 2 criteria:</p> <ol> <li>using NSURLSession or CFNetwork</li> <li>connect by name</li> </ol> <p>So the question here is:</p> <ol> <li><p>As far as I know NSURLConnection is based on CFNetwork, does this mean I will be fine too if my app is using NSURLConnection? (I saw NSURLConnection is also mentioned in <a href="https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/art/NetworkingFrameworksAndAPIs_2x.png" rel="noreferrer">this image in the above document</a>, but again I am not quite sure about this as NSURLConnection is kind of old? And seems I cannot find documents mentioning IPv4 and IPv6 support either.)</p></li> <li><p>By the criteria "calling by name", does this mean no matter I am using NSURLSession or NSURLConnection, if I happen to call or access certain resources / APIs by an IPv4 address, bad things will happen? (I've done some research, and from my understanding clients like iOS device with iOS 9+ will always use synthesized IPv6 address to access IPv4 server, as a result the client will fail to reach the resource if I call by IPv4 address?)</p></li> </ol> <p>Thanks for any help!</p>
0debug
make tablebody scrollable into table : I have this table:<br/> And i like to make the table body scrollable so that i don't have to scroll the page, but that i can scroll inside the tablebody. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function sortTable(table, col, reverse) { var tb = table.tBodies[0], // use `<tbody>` to ignore `<thead>` and `<tfoot>` rows tr = Array.prototype.slice.call(tb.rows, 0), // put rows into array i; reverse = -((+reverse) || -1); tr = tr.sort(function (a, b) { // sort rows return reverse // `-1 *` if want opposite order * (a.cells[col].textContent.trim() // using `.textContent.trim()` for test .localeCompare(b.cells[col].textContent.trim()) ); }); for(i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); // append each row in order } function makeSortable(table) { var th = table.tHead, i; th && (th = th.rows[0]) && (th = th.cells); if (th) i = th.length; else return; // if no `<thead>` then do nothing while (--i >= 0) (function (i) { var dir = 1; th[i].addEventListener('click', function () {sortTable(table, i, (dir = 1 - dir))}); }(i)); } function makeAllSortable(parent) { parent = parent || document.body; var t = parent.getElementsByTagName('table'), i = t.length; while (--i >= 0) makeSortable(t[i]); } window.onload = function () {makeAllSortable();}; <!-- language: lang-css --> table { border-collapse: collapse; width: 80%; margin: auto; background: #fff; text-align: center; } td, th { padding: 0.75em 0.5em; text-align: center; } td.err { background-color: #e992b9; color: #fff; font-size: 0.75em; text-align: center; line-height: 1; } th { background-color: #7fb030; font-weight: bold; color: #fff; white-space: nowrap; text-align: center; } tbody th { background-color: #7fb030; text-align: center; } tbody tr:nth-child(2n-1) { background-color: #f5f5f5; transition: all .125s ease-in-out; } .overzicht tr:hover { background-color: rgba(129,208,177,.3); } <!-- language: lang-html --> <table class="overzicht scroll" id="table" style="width: 80%;"> <thead> <tr style="cursor: hand;"> <th style="width: 10%;">Allemaal</th> <th style="width: 18%;">Datum</th> <th style="width: 16%;" class="left">Naam</th> <th style="width: 10%;" class="left">Bedrijf</th> <th style="width: 22%;" class="left">Email</th> <th style="width: 14%;" class="left">SMS</th> <th style="width: 10%;">Geblokkeerd</th> </tr> </thead><tbody> <tr class="cus1"> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> <input type="hidden" name="ID" value="39"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jbn@ti.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="39"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="38"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jban@ti.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="38"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="36"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jboan@tri.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="36"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="37"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jboan@twi.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="37"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="48"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdn@tifdsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="48"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="50"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdn@tisdrd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="50"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="40"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jbsfdfn@ti.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="40"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="49"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdn@tiftrrd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="49"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="34"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Kees de jong </td> <td style="width: 10%;" class="left"> trined </td> <td style="width: 22%;" class="left"> jboan@trined.nl </td> <td style="width: 14%;" class="left"> 0643937984 </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="34"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="47"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdn@tifddddsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="47"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="51"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdrtgg@tisdrd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="51"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="35"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jboan@trinedd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="35"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="41"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jbsfdfn@tidsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="41"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="44"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdsdfn@tifdddsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="44"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="52"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdrtgg@tisfredrd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="52"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="46"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdsdfn@tifddddsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="46"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="33"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Kees de jong </td> <td style="width: 10%;" class="left"> trined </td> <td style="width: 22%;" class="left"> jboan@team.trined.n </td> <td style="width: 14%;" class="left"> 0642937984 </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="33"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="45"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> fdsdccdfn@tifdddsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="45"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="42"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jbsfgfgdfdfn@tidsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="42"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="32"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Kees de jong </td> <td style="width: 10%;" class="left"> trined </td> <td style="width: 22%;" class="left"> jbotman@team.trined.nl </td> <td style="width: 14%;" class="left"> 0642937988 </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja" selected="">Ja</option> <option value="Nee">Nee</option> </select> <input type="hidden" name="IDS" value="32"> <input type="hidden" name="B" value="1"> <p style="display:none;">1</p> </td></tr> <tr class="cus1"> <td style="width: 10%;"> <select onchange="this.form.submit()" name="alles"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="ID" value="43"> <input type="hidden" name="A" value="0"> <p style="display:none;">0</p> </td> <td style="width: 18%;"> 19-01-2017 10:28 </td> <td style="width: 16%;" class="left"> Testpersoon </td> <td style="width: 10%;" class="left"> test </td> <td style="width: 22%;" class="left"> jbsfgfgdfdfn@tifddsd.nl </td> <td style="width: 14%;" class="left"> </td> <form method="post"></form><td style="width: 10%;"> <select onchange="this.form.submit()" name="geblokkeerd"> <option value="Ja">Ja</option> <option value="Nee" selected="">Nee</option> </select> <input type="hidden" name="IDS" value="43"> <input type="hidden" name="B" value="0"> <p style="display:none;">0</p> </td> </tr> </tbody></table> <!-- end snippet --> How can i make my tbody scrollable?<br/> can someone please edit my snippet and make it scrollable?<b/> I can sort already and now i need to scroll inside the table BODY!!<br/>
0debug
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len) { if (s->chr_read) { s->chr_read(s->handler_opaque, buf, len); } }
1threat
int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_remove_breakpoint) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_remove_breakpoint) { return bs->drv->bdrv_debug_remove_breakpoint(bs, tag); } return -ENOTSUP; }
1threat
Bootstrap nav bar with home icon issue : <p>i want to display home icon on bootstrap nav bar. i follow this link <a href="http://www.tutorialrepublic.com/codelab.php?topic=bootstrap&amp;file=pills-nav-with-icons" rel="nofollow">http://www.tutorialrepublic.com/codelab.php?topic=bootstrap&amp;file=pills-nav-with-icons</a></p> <p>my html looks like</p> <pre><code> &lt;nav class="navbar navbar-inverse"&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar-header"&gt; &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;div class="collapse navbar-collapse" id="myNavbar"&gt; &lt;ul class="nav navbar-nav"&gt; &lt;li class="active"&gt; &lt;a href="#"&gt; &lt;span class="glyphicon glyphicon-home"&gt;&lt;/span&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;All Parts&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; </code></pre> <p>but still no luck. my home icon does not look good. jsfiddle is <a href="https://jsfiddle.net/0gjw5rzg/1/" rel="nofollow">https://jsfiddle.net/0gjw5rzg/1/</a></p>
0debug
How would i save the output of this forloop : This is the code i've already written but i would like to be able to save my for loop output to a file. I have tried using different ways like using ofstream around the loop outside the loop and inside the loop. However even tho using these my code runs it does not output information to the file like i would like. ANY help would be greatly appreciated. #include <iostream> #include <fstream> using namespace std; struct alexisgay { int number; int numbertwo; }; void printStruct(alexisgay thestruct); int main(){ alexisgay alex[4] = {{15, 20},{30, 35},{45, 50},{60, 65}}; cout<<"Number"<<"\t"<<"Numbertwo"<<endl; int sizeofarray = 4; for(int x = 0; x < sizeofarray; x = x+1){ printStruct(alex[x]); } } void printStruct(alexisgay thestruct){ for(int x = 0;x < 1; x++) if(thestruct.number > 30){ cout<<thestruct.number*10<<"\t"<<thestruct.numbertwo<<endl;} else if(thestruct.number <= 30){ cout<<thestruct.number*10<<"\t"<<thestruct.numbertwo<<endl; }
0debug
reject by app store because of App Store Review Guideline 2.5.2 : <p>Your app, extension, or linked framework appears to contain code designed explicitly with the capability to change your app’s behavior or functionality after App Review approval, which is not in compliance with App Store Review Guideline 2.5.2 and section 3.3.2 of the Apple Developer Program License Agreement.</p> <p>i wonder AFNetworking framework is illegal?</p>
0debug
i want to compare current time with specific time in c# application when some event occures : /*here only else part is getting executed so what should i do to execute if part please help to solve this*/ private void Form_Load(object sender, EventArgs e) { /* Current Time is 11:47:00 AM*/ System.DateTime CurrentTime = System.DateTime.Now; System.DateTime StartTime = Convert.ToDateTime("10:15:00 AM"); System.DateTime Stoptime = Convert.ToDateTime("02:29:57 PM"); System.DateTime CloseTime = Convert.ToDateTime("02:59:57 PM"); if (StartTime > CurrentTime && CurrentTime < Stoptime) { //CODE } else { //CODE } }
0debug
should I use what language to deal many http/mysql request? : I have `1400000000` data and it saved in some txt files, like this: key1 key2 I use key1/key2 request data by http/mysql, and check body. Now I have wrote using python, but it slow. And I learn a little Go language. The part codes: import Queue import threading class CheckThread(threading.Thread): def __init__(self, queue, src_folder, dest_folder='check_result'): super(CheckThread, self).__init__() self._queue = queue self.daemon = True def run(self): while True: file_name = self._queue.get() try: self._prepare_check(file_name) except: self._queue.task_done() continue self._queue.task_done() def Check(src_folder, workers=12, dest_folder='check_result'): queue = Queue.Queue() for (dirpath, dirnames, filelist) in os.walk(src_folder): for name in filelist: if name[0] == '.': continue queue.put(os.path.join(dirpath, name)) for worker in xrange(workers): worker = str(worker + 1) t = CheckThread(queue, src_folder, dest_folder) t.start() queue.join() def main(folder, worker=12, out='check_result'): try: Check(folder, worker, out) except: return 1 return 0 Every thread deal one file from queue. How I should optimization it? thanks a lot.
0debug
static void fw_cfg_ctl_mem_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { fw_cfg_select(opaque, (uint16_t)value); }
1threat
static int l2_load(BlockDriverState *bs, uint64_t l2_offset, uint64_t **l2_table) { BDRVQcow2State *s = bs->opaque; int ret; ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void**) l2_table); return ret; }
1threat
how i can sort mysql table by max value? : <p>this is my first question on this website </p> <p>and i want to know how i can sort mysql table by max value?</p> <pre><code>| ID | Value | |----|-------| | 1 | 20 | | 2 | 30 | | 3 | 25 | | 4 | 70 | | 5 | 29 | </code></pre> <p>i want the table be like this</p> <pre><code>| ID | Value | |----|-------| | 1 | 70 | | 2 | 30 | | 3 | 29 | | 4 | 25 | | 5 | 20 | </code></pre> <p>or like this</p> <pre><code>| ID | Value | |----|-------| | 4 | 70 | | 2 | 30 | | 5 | 29 | | 3 | 25 | | 1 | 20 | </code></pre>
0debug
Result not correct : private void ifsc_btn_Click(object sender, EventArgs e) { string query = "select * from ifsc where branch='" + branch_txt + "'"; OleDbConnection conn = new OleDbConnection(conString);//connection string already defined OleDbCommand cmd = new OleDbCommand(query, conn); try { conn.Open(); OleDbDataReader myReader; myReader = cmd.ExecuteReader();//executes query if(!myReader.Read()) { string scode = myReader.GetString(myReader.GetOrdinal("ifsc"));//get the ifsc code from database code.Text = scode; } else MessageBox.Show("No Data Found!"); //error message while no data found conn.Close(); myReader.Close(); //closing both connection and myreader } catch (Exception ex) { MessageBox.Show(ex.Message);// exception } }
0debug
'Batch' script using file names from an xml to organise files : I have a library of sounds that are pretty ambiguous in what they are, the only way to find the sounds is by rummaging through an xml file which has the reference to each, so what I want to do is create a script that reads from the xml with conditions to get the right files and streams in the right folders by renaming and putting the files in the correct directory... here is the code and the conditions: <File Id="14518742" Language="SFX"> <ShortName>Creatures\Fish_Large_Swim_03.wav</ShortName> <Path>SFX\Creatures\Fish_Large_Swim_03_9344E057.wem</Path> </File> I want to look for the file call, and get the ID (14518742), this will be a name of a file (14518742.ogg) and I want to move it to this directory: SFX\Creatures\Fish_Large_Swim_03_9344E057 (Renaming the file to Fish_Large_Swim_03_9344E057.ogg, ignore the .wem) which is preceded by "Path" The thing is that I don't know how to read through files in such scripts, if or if not possible in .bat, where is it possible?
0debug
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException and how to fix it? : <p>I want to create an application which chooses the number to be guessed by selecting an integer at random in the range 1-1000.The application then displays the following in a label: I have a number between 1-1000.Can you guess my number?Please enter your first guess. As each guess is input,the background color should change to either red or blue.Red indicates that the user is getting "warmer" ,and blue,"colder".</p> <pre><code> import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; class GuessNumber extends JFrame{ private JLabel topLabel; private JLabel colorLabel; private JLabel correctLabel; private JTextField numberText; private JTextField inputText; private JButton playBtn; private int num; GuessNumber(){ setSize(600,300); setTitle("Guess the number"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLocationRelativeTo(null); topLabel=new JLabel("I have a number between 1 and 1000.Can you guess my number?",JLabel.CENTER); add("North",topLabel); playBtn=new JButton("Play"); inputText=new JTextField(); inputText.setEditable(false); correctLabel=new JLabel(); colorLabel=new JLabel(); //Read a random number when play button is clicked playBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt){ Random r=new Random(); num=r.nextInt(1001); numberText.setText(Integer.toString(num)); inputText.setEditable(true); } }); //Show whether your guess is close to the number or not inputText.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt){ if(Integer.parseInt(inputText.getText())&gt;num/2){ colorLabel.setText("Warmer"); colorLabel.setBackground(Color.red); colorLabel.setOpaque(true); }else{ colorLabel.setText("Colder"); colorLabel.setBackground(Color.blue); colorLabel.setOpaque(true); } if(Integer.parseInt(inputText.getText())==num){ correctLabel.setText("Correct!"); correctLabel.setVisible(true); inputText.setEditable(false); } } }); JPanel centerPanel=new JPanel(); centerPanel.setLayout(new GridLayout(3,1)); centerPanel.add(inputText); centerPanel.add(colorLabel); centerPanel.add(correctLabel); add(centerPanel); add("South",playBtn); setVisible(true); } } class Example{ public static void main(String args[]){ new GuessNumber(); } } </code></pre> <p>The program will compile but I get an exception in run time.I can't find the error in my program.How can I fix this? Here is the error I get:</p> <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at GuessNumber$1.actionPerformed(Example.java:34) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour ce) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP rivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP rivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP rivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) </code></pre>
0debug
c++ printing the complete square numbers in an array : <p>How can i print all complete square numbers available in the array</p> <p>this is my array:</p> <pre><code>int main() { int array[6]; cout&lt;&lt;"Enter 6 #'s: "&lt;&lt;endl; for(int i=0; i&lt;6; i++) { cin&gt;&gt;array[i]; } </code></pre>
0debug
How to print the docstring(documentation string) of the input function using help() : <p>Write a python script to print the docstring(documentation string) of the input function. Hint:</p> <ul> <li>use help() function to get the docstring</li> </ul>
0debug
Store Procedure to Insert data between tables : I want to insert data from a table called temp_menu to another called menu, they have the same structure, they store the same data,I want to create a stored procedure to check the differences between the rows tables, if there is diferent rows and the rows dont exist in table menu, i want to insert in the table menu, if the rows exist, i want to update the rows in the table menu if the DateReg columm is higher that the DateReg columm in temp_menu table. The tables have this structure: CREATE TABLE [dbo].[Menu_Temp]( [Date] [datetime] NOT NULL, [Ref] [int] NOT NULL, [Art] [char](60) NOT NULL, [Dish] [char](60) NOT NULL, [DateReg] [datetime] NOT NULL, [Zone] [char](60) NOT NULL, );
0debug
Calculate distance between two points in Leaflet : <p>How do you calculate the distance between two markers in Leaflet-ionic2?</p> <p>Couldn't figure out, I hope there is an Algorithme to do as soon as i select a marker it show me the distance between my location and the marker.</p> <p>Thanks..</p>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
Data separation from single column : I have data in single column like different sets: Original data Class: Country1 Object: State1 Description: DEsc1 Object: State2 Description: DEsc2 Object: State3 Description: DEsc3 Object: State4 Description: DEsc4 Class: Country2 Object: State1 Description: DEsc1 Object: State2 Description: DEsc2 Object: State3 Description: DEsc3 Object: State4 Description: DEsc4 Class: Country3 Object: State1 Description: DEsc1 Object: State2 Description: DEsc2 Object: State3 Description: DEsc3 Object: State4 Description: DEsc4 Class: Country4 Object: State1 Description: DEsc1 Object: State2 Description: DEsc2 Object: State3 Description: DEsc3 Object: State4 Description: DEsc4 I am looking for Excel VBA macro code , which will clean and organize my data. Expected Data Class Object Description Country1 Object1 DEsc1 Country1 Object2 DEsc2 Country1 Object3 DEsc3 Country1 Object4 DEsc4 Country2 Object1 DEsc1 Country2 Object2 DEsc2 Country2 Object3 DEsc3 Country2 Object4 DEsc4 Country3 Object1 DEsc1 Country3 Object2 DEsc2 Country3 Object3 DEsc3 Country3 Object4 DEsc4 Country4 Object1 DEsc1 Country4 Object2 DEsc2 Country4 Object3 DEsc3 Country4 Object4 DEsc4
0debug
how to display the result in a table using PHP : i have PHP code that read from txt files and display the result where the user enter a word for search and the system read the files and display the result with specified the line number and the file name. i want to display these result in a table or a form that is well formed. if its possible columns must be the name of files and the rows contains the line number. code: ======= <?php if(isset($_POST["search"])) { $search =$_POST['name']; echo "the word $search exist: <br><br>"; foreach(glob($_SERVER['DOCUMENT_ROOT']."/readfiletest/*.txt") as $txts) { $line = 1; $myFileLink = fopen($txts, 'r'); while(!feof($myFileLink)) { $myFileContents = fgets($myFileLink); if( preg_match_all('/('.preg_quote($search,'/').')/i', $myFileContents, $matches)) { foreach($matches[1] as $match) { echo "line [$line] file "; } echo basename ($txts) . "<br>".PHP_EOL; } ++$line; } fclose($myFileLink); } } ?> <html> <head> </head> <meta http-equiv="Content-Language" content="ar-sa"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> #form { background: -webkit-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px); background: -moz-linear-gradient(bottom, #CCCCCC, #EEEEEE 175px); background: linear-gradient(bottom, #CCCCCC, #EEEEEE 175px); margin: auto; width: 200px; height: 200px; position: absolute; font-family: Tahoma, Geneva, sans-serif; font-size: 14px; font-style: italic; line-height: 24px; font-weight: bold; color: #09C; text-decoration: none; border-radius: 10px; padding: 10px; border: 1px solid #999; border: inset 1px solid #333; -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3); } </style <body> <div id = "form"> <form action="index.php" method="post"> <h1 align =center > Search Form </h1> <p>enter your string <input type ="text" id = "idName" name="name" /></p> <p align =center ><input type ="Submit" name ="search" value= "Search" /></p> </form> </div> </body> </html>
0debug
void bdrv_query_info(BlockDriverState *bs, BlockInfo **p_info, Error **errp) { BlockInfo *info = g_malloc0(sizeof(*info)); BlockDriverState *bs0; ImageInfo **p_image_info; Error *local_err = NULL; info->device = g_strdup(bs->device_name); info->type = g_strdup("unknown"); info->locked = bdrv_dev_is_medium_locked(bs); info->removable = bdrv_dev_has_removable_media(bs); if (bdrv_dev_has_removable_media(bs)) { info->has_tray_open = true; info->tray_open = bdrv_dev_is_tray_open(bs); } if (bdrv_iostatus_is_enabled(bs)) { info->has_io_status = true; info->io_status = bs->iostatus; } if (bs->dirty_bitmap) { info->has_dirty = true; info->dirty = g_malloc0(sizeof(*info->dirty)); info->dirty->count = bdrv_get_dirty_count(bs) * BDRV_SECTOR_SIZE; info->dirty->granularity = ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bs->dirty_bitmap)); } if (bs->drv) { info->has_inserted = true; info->inserted = g_malloc0(sizeof(*info->inserted)); info->inserted->file = g_strdup(bs->filename); info->inserted->ro = bs->read_only; info->inserted->drv = g_strdup(bs->drv->format_name); info->inserted->encrypted = bs->encrypted; info->inserted->encryption_key_missing = bdrv_key_required(bs); if (bs->backing_file[0]) { info->inserted->has_backing_file = true; info->inserted->backing_file = g_strdup(bs->backing_file); } info->inserted->backing_file_depth = bdrv_get_backing_file_depth(bs); if (bs->io_limits_enabled) { ThrottleConfig cfg; throttle_get_config(&bs->throttle_state, &cfg); info->inserted->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->inserted->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->inserted->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->inserted->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; } bs0 = bs; p_image_info = &info->inserted->image; while (1) { bdrv_query_image_info(bs0, p_image_info, &local_err); if (error_is_set(&local_err)) { error_propagate(errp, local_err); goto err; } if (bs0->drv && bs0->backing_hd) { bs0 = bs0->backing_hd; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } } } *p_info = info; return; err: qapi_free_BlockInfo(info); }
1threat
Dublicate array items using recursion instead of for loop : // This my wrong code , what is the right??`// This my wrong code , what is the right?? function dubArr(arr){ newArr=[]; if(arr.length===0){ return newArr; } newArr.push(2*arr[0]); arr.shift(); dubArr(arr); return newArr; }`
0debug
Multiple schema references in single schema array - mongoose : <p>Can you populate an array in a mongoose schema with references to a few different schema options?</p> <p>To clarify the question a bit, say I have the following schemas:</p> <pre><code>var scenarioSchema = Schema({ _id : Number, name : String, guns : [] }); var ak47 = Schema({ _id : Number //Bunch of AK specific parameters }); var m16 = Schema({ _id : Number //Bunch of M16 specific parameters }); </code></pre> <p>Can I populate the guns array with a bunch of ak47 <strong>OR</strong> m16? Can I put <strong>BOTH</strong> in the same guns array? Or does it require a populate ref in the assets array, like this, which limits it to a single specific type?</p> <pre><code>guns: [{ type: Schema.Types.ObjectId, ref: 'm16' }] </code></pre> <p>I know I could just have separate arrays for different gun types but that will create an insane amount of extra fields in the schema as the project scales, most of which would be left empty depending on the loaded scenario.</p> <pre><code>var scenarioSchema = Schema({ _id : Number, name : String, ak47s : [{ type: Schema.Types.ObjectId, ref: 'ak47' }], m16s: [{ type: Schema.Types.ObjectId, ref: 'm16' }] }); </code></pre> <p>So back to the question, can I stick multiple schema references in a single array?</p>
0debug
QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap) { char *cmdline; struct QOSState *qs = g_malloc(sizeof(QOSState)); cmdline = g_strdup_vprintf(cmdline_fmt, ap); qs->qts = qtest_start(cmdline); qs->ops = ops; qtest_irq_intercept_in(global_qtest, "ioapic"); if (ops && ops->init_allocator) { qs->alloc = ops->init_allocator(ALLOC_NO_FLAGS); } g_free(cmdline); return qs; }
1threat
list of variables from local scope : Hello I am learning python. In python **dir()** displays all the names defined in **namespcae** I checked and it worked fine. But when I used **dir(function_name)** it didn't display the variables i created inside function. **Why?** Here is screenshot [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/CQzEU.png
0debug
SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd) { SimpleSpiceUpdate *update; QXLDrawable *drawable; QXLImage *image; QXLCommand *cmd; uint8_t *src, *dst; int by, bw, bh; if (qemu_spice_rect_is_empty(&ssd->dirty)) { return NULL; }; pthread_mutex_lock(&ssd->lock); dprint(2, "%s: lr %d -> %d, tb -> %d -> %d\n", __FUNCTION__, ssd->dirty.left, ssd->dirty.right, ssd->dirty.top, ssd->dirty.bottom); update = qemu_mallocz(sizeof(*update)); drawable = &update->drawable; image = &update->image; cmd = &update->ext.cmd; bw = ssd->dirty.right - ssd->dirty.left; bh = ssd->dirty.bottom - ssd->dirty.top; update->bitmap = qemu_malloc(bw * bh * 4); drawable->bbox = ssd->dirty; drawable->clip.type = SPICE_CLIP_TYPE_NONE; drawable->effect = QXL_EFFECT_OPAQUE; drawable->release_info.id = (intptr_t)update; drawable->type = QXL_DRAW_COPY; drawable->surfaces_dest[0] = -1; drawable->surfaces_dest[1] = -1; drawable->surfaces_dest[2] = -1; drawable->u.copy.rop_descriptor = SPICE_ROPD_OP_PUT; drawable->u.copy.src_bitmap = (intptr_t)image; drawable->u.copy.src_area.right = bw; drawable->u.copy.src_area.bottom = bh; QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_DEVICE, ssd->unique++); image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP; image->bitmap.flags = QXL_BITMAP_DIRECT | QXL_BITMAP_TOP_DOWN; image->bitmap.stride = bw * 4; image->descriptor.width = image->bitmap.x = bw; image->descriptor.height = image->bitmap.y = bh; image->bitmap.data = (intptr_t)(update->bitmap); image->bitmap.palette = 0; image->bitmap.format = SPICE_BITMAP_FMT_32BIT; if (ssd->conv == NULL) { PixelFormat dst = qemu_default_pixelformat(32); ssd->conv = qemu_pf_conv_get(&dst, &ssd->ds->surface->pf); assert(ssd->conv); } src = ds_get_data(ssd->ds) + ssd->dirty.top * ds_get_linesize(ssd->ds) + ssd->dirty.left * ds_get_bytes_per_pixel(ssd->ds); dst = update->bitmap; for (by = 0; by < bh; by++) { qemu_pf_conv_run(ssd->conv, dst, src, bw); src += ds_get_linesize(ssd->ds); dst += image->bitmap.stride; } cmd->type = QXL_CMD_DRAW; cmd->data = (intptr_t)drawable; memset(&ssd->dirty, 0, sizeof(ssd->dirty)); pthread_mutex_unlock(&ssd->lock); return update; }
1threat
swift basic grammer swift : import UIKit class ViewController: UIViewController { @IBOutlet weak var formulalabel: UILabel! @IBOutlet weak var Answerlabel: UILabel! override func viewDidLoad() { super.viewDidLoad() formulalabel.text = "" Answerlabel.text = "" // 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. } @IBAction func inputformula(_ sender: Any) { guard let formulaText = formulalabel.text else { return } guard let senderedText = sender.titleLabel.text else { return } formulaLabel.text = formulaText + senderedText } @IBAction func calculationanswer(_ sender: Any) { } @IBAction func clearcalculation(_ sender: Any) { } } I can't understand grammer in the text below . guard let senderedText = sender.titleLabel.text else what is sender.titleLabel??? If you have any helpful URL, please let me know.
0debug
void qemu_system_guest_panicked(void) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED);
1threat
How can i bend the outline with css? : <p><a href="https://i.stack.imgur.com/VOaFI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VOaFI.png" alt="enter image description here"></a></p> <p>I am trying to create this outline effect using CSS. I am unable to think in the right direction and don't want to use any image for the bending. </p> <p>So what's the best approach to do this? </p>
0debug
Powershell -lt and -gt giving opposite of expected results : <p>In the below code, if I add a where-object, -lt &amp; -gt are giving opposite of expected results. </p> <p>I'm sure the reason is I'm stupid, but in what specific way am I messing up? </p> <p>This part gives the expected results, where in my case, the single drive has %Free of 39.8</p> <pre><code>Get-WmiObject -Namespace root\cimv2 -Class win32_logicaldisk | where-object -Property drivetype -eq 3 | format-table deviceid, @{n='GB Capacity';e={$_.size/1gb}}, @{n='GB Free';e={$_.freespace/1gb}}, @{n='%Free';e={($_.freespace/$_.size)*100}} </code></pre> <p>But adding this</p> <pre><code>| where {$_.'%Free' -gt 10} </code></pre> <p>Results in no output. In fact </p> <pre><code>| where {$_.'%Free' -gt 0} </code></pre> <p>Produces no results. Instead I have to use</p> <pre><code>| where {$_.'%Free' -lt 0} </code></pre> <p>Powershell thinks %Free is a negative number, I guess? </p>
0debug
Error while loading electron-tabs module & unable to create tabs in electron : <p>I have installed electron-modules package for implementing tabs in electron as shown below</p> <p>package.json</p> <pre><code>{ "name": "Backoffice", "version": "1.0.0", "description": "BackOffice application", "main": "main.js", "scripts": { "start": "electron ." }, "author": "Karthik", "license": "ISC", "devDependencies": { "electron": "^2.0.8", "electron-tabs": "^0.9.4" } } </code></pre> <p>main.js</p> <pre><code>const electron = require("electron"); const app = electron.app; const BrowserWindow = electron.BrowserWindow; const Menu = electron.Menu; const path = require("path"); const url = require("url"); const TabGroup = require("electron-tabs"); let win; const tabGroup = new TabGroup(); function createWindow() { win = new BrowserWindow(); win.loadURL(url.format({ pathname:path.join(__dirname,'index.html'), protocol:'file', slashes:true })); win.on('closed',()=&gt;{ win = null; }) } app.on('ready', function(){ createWindow(); const template = [ { label : 'Backoffice', submenu: [ { label : 'Account Management', click : function () { let tab = tabGroup.addTab({ title: "Electron", src: "http://electron.atom.io", visible: true }); } }, { label : 'HR Management', click : function () { console.log("CLICK HM menu"); } }, ] } ] const menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(menu); }); </code></pre> <p>index.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;BackOffice&lt;/title&gt; &lt;link rel="stylesheet" href="styles.css"&gt; &lt;link rel="stylesheet" href="node_modules/electron-tabs/electron-tabs.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;BackOffice&lt;/h1&gt; &lt;div class="etabs-tabgroup"&gt; &lt;div class="etabs-tabs"&gt;&lt;/div&gt; &lt;div class="etabs-buttons"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="etabs-views"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I am getting the following error when I run npm start</p> <pre><code>App threw an error during loadReferenceError: document is not defined at Object.&lt;anonymous&gt; (C:\workspace\nodejs_workspace\electron\menu-demo\node_modules\electron-tabs\index.js:3:1) at Object.&lt;anonymous&gt; (C:\workspace\nodejs_workspace\electron\menu-demo\node_modules\electron-tabs\index.js:421:3) at Module._compile (module.js:642:30) at Object.Module._extensions..js (module.js:653:10) at Module.load (module.js:561:32) at tryModuleLoad (module.js:504:12) at Function.Module._load (module.js:496:3) at Module.require (module.js:586:17) at require (internal/module.js:11:18) at Object.&lt;anonymous&gt; (C:\DEV_2018\nodejs_workspace\electron\menu-demo\main.js:11:18) </code></pre> <ul> <li><p>Why am I not able to load electron-modules package. </p></li> <li><p>What is causing this error? How to create a new tab on click on application menu in electron?</p></li> </ul>
0debug
Mx record for subdomain : <p>My domain mybasiccrm.com is hosted on hostgator.com</p> <p>The subdomain tr1.mybasiccrm.com is hosted on tr8.mybasiccrm.com</p> <p>I have created an MX record on the server tr8 for the domain tr1.mybasiccrm.com but when I check this <a href="http://mxtoolbox.com/SuperTool.aspx?action=mx%3atr1.mybasiccrm.com&amp;run=toolpage" rel="nofollow">http://mxtoolbox.com/SuperTool.aspx?action=mx%3atr1.mybasiccrm.com&amp;run=toolpage</a> it says that "No Records Exist"</p> <p>How can I have a proper mx recort for tr1.mybasiccrm.com ?</p> <p>PS: I can send an email from my gmail account to the address email@tr1.mybasiccrm.com without a problem.</p> <p>Thank you all!</p>
0debug
Developing an Asp.net MVC website : which requirements? : <p>I'm about to develop an ASP.NET Mvc website for a startup. I've never done this before, so i have few architecture/infrastructure asks.</p> <p>1/ Is it reasonable to develop the website in Asp.NET Core MVC ? I've read several times that the technology may not be mature for the next 1-2 years.</p> <p>2/ In a first time, i'll have a low budget. Knowing this, would it be possible to use TFS ? IIS ? Sql Server ? If it is too expansive, which are the alternatives ?</p> <p>3/ Should i host the website using Microsoft Azure ?</p> <p>Thanks for your help.</p>
0debug
Jquery: How to get country code from browser url and inject it in all page links : suppose these are my address bar url http://localhost:53741/gb/default.aspx OR http://localhost:53741/gb/default.aspx?id=1 OR http://localhost:53741/gb/part/part.aspx?id=1&vref=2010 so gb is the country code. my default.aspx page has many hyperlinks and those looks like http://localhost:53741/test1.aspx http://localhost:53741/test2.aspx http://localhost:53741/test3.aspx now through jquery i want to get first country code from browser url which gb as per url and i need to inject that country code in all the hyperlinks of default.aspx page. so new links would be look like http://localhost:53741/gb/test1.aspx http://localhost:53741/gb/test2.aspx http://localhost:53741/gb/test3.aspx anyone can help me with jquery code sample how to achieve this. thanks
0debug
static int ape_tag_read_field(AVFormatContext *s) { AVIOContext *pb = s->pb; uint8_t key[1024], *value; uint32_t size, flags; int i, c; size = avio_rl32(pb); flags = avio_rl32(pb); for (i = 0; i < sizeof(key) - 1; i++) { c = avio_r8(pb); if (c < 0x20 || c > 0x7E) break; else key[i] = c; } key[i] = 0; if (c != 0) { av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key); return -1; } if (size >= UINT_MAX) return -1; if (flags & APE_TAG_FLAG_IS_BINARY) { uint8_t filename[1024]; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avio_get_str(pb, INT_MAX, filename, sizeof(filename)); st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); if (avio_read(pb, st->codec->extradata, size) != size) { av_freep(&st->codec->extradata); return AVERROR(EIO); } st->codec->extradata_size = size; av_dict_set(&st->metadata, key, filename, 0); st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; } else { value = av_malloc(size+1); if (!value) return AVERROR(ENOMEM); c = avio_read(pb, value, size); if (c < 0) return c; value[c] = 0; av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); } return 0; }
1threat
Swift 4: Switch 0/1 int array values : I have next array [0, 0, 1, 1, 0, 0] On some condition I have to switch 0 to 1 and vice versa I am new in Switch and came from JS. In JS usually used code like: array[index] = !array[index] However, in swift such coding does not working Is there are an elegant way to do such convert with doing if-> else statements?
0debug
An error about "make_shared",I can't understand : <pre><code>#include&lt;algorithm&gt; #include&lt;string&gt; #include&lt;new&gt; #include&lt;memory&gt; #include&lt;vector&gt; using std::vector; using namespace std; int main() { shared_ptr&lt;vector&lt;int&gt; &gt; pointer=make_shared&lt;vector&lt;int&gt;&gt; ({2,3,5,8}); cout&lt;&lt;(*pointer)[3]; return 0; </code></pre> <p><strong>so make_shared can't initialize like ({2,3,5,8}),why?</strong> }</p>
0debug
What is the difference between TEST, TEST_F and TEST_P? : <p>I have researched a lot about gtest/gmock but none of them gave me the right answer. I new to C++ so any help would be really appreciated.</p>
0debug
Is SharedPreferences Enough for me? : <p>I want to save 15 arraylist from user,and 10-15 int value.Can I use sharedpreferences or should I use sqlLite ? I dont wanna use SqlLite actually can u help me ?</p>
0debug
detect non ascii characters in a string : <p>How can I detect non-ascii characters in a vector f strings in a grep like fashion. For example below I'd like to return <code>c(1, 3)</code> or <code>c(TRUE, FALSE, TRUE, FALSE)</code>:</p> <pre><code>x &lt;- c("façile test of showNonASCII(): details{", "This is a good line", "This has an ümlaut in it.", "OK again. }") </code></pre> <p>Attempt:</p> <pre><code>y &lt;- tools::showNonASCII(x) str(y) p &lt;- capture.output(tools::showNonASCII(x)) </code></pre>
0debug
static int vnc_set_x509_credential(VncDisplay *vd, const char *certdir, const char *filename, char **cred, int ignoreMissing) { struct stat sb; g_free(*cred); *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); strcpy(*cred, certdir); strcat(*cred, "/"); strcat(*cred, filename); VNC_DEBUG("Check %s\n", *cred); if (stat(*cred, &sb) < 0) { g_free(*cred); *cred = NULL; if (ignoreMissing && errno == ENOENT) return 0; return -1; } return 0; }
1threat
How can I trim down this code? : <p>I have two text files "usernames.txt" and "passwords.txt" and I want to have them print out in a specific order, I have a snippet of code that does exactly what I need but I feel like It can be shortened.</p> <pre><code>with open('passwords.txt','r') as f: for line in f: for password in line.split(): with open('usernames.txt','r') as f: for line in f: for username in line.split(): print username +":"+ password </code></pre> <p>This works perfect for me what I feel like I can make it even shorter!</p> <p>current output is this:</p> <pre><code>username1:password username1:password1 username1:password2 username2:password username2:password1 username2:password2 </code></pre>
0debug
Console.log not working javascript/jquery : <p>I am trying to get started with javascript, but I can't see to get console.log to work.</p> <p>In the <code>head</code>, I load jquery as follows:</p> <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>Then, right before the end of <code>body</code>, I place the document.ready function as follows:</p> <pre><code>$( document ).ready(function() { console.log( "ready!" ); }); </code></pre> <p>No other javascript/jquery is present in the file. I expected the phrase "ready!" to be logged to the console, but instead, nothing happened. How can I fix this?</p>
0debug
How to get Start date and end date of month : Hi i am using this libs [CalnderView][1] any one know how to get end and last date of month. [1]: http://%20https://github.com/prolificinteractive/material-calendarview/wiki
0debug
static inline void vmsvga_check_size(struct vmsvga_state_s *s) { DisplaySurface *surface = qemu_console_surface(s->vga.con); if (s->new_width != surface_width(surface) || s->new_height != surface_height(surface)) { qemu_console_resize(s->vga.con, s->new_width, s->new_height); s->invalidated = 1; } }
1threat
Java - how to replace duplicated characters in a string? : <p>could someone tell me how to replace duplicated characters by "*" in a string? Input is for example: "aacbbbz" - output should be "**c***z"</p> <p>Thank you.</p>
0debug
Regex: compare lines and find out the different numbers : <p>I have this lines on my html pages (1978 pages).</p> <blockquote> <p><code>&lt;li&gt;&lt;a href="xxx.html" title="xxx"&gt;xxx (22)&lt;/a&gt;&lt;/li&gt;</code></p> <p><code>&lt;li&gt;&lt;a href="yyy.html" title="yyy"&gt;yyy (21)&lt;/a&gt;&lt;/li&gt;</code></p> <p><code>&lt;li&gt;&lt;a href="zzz.html" title="zzz"&gt;zzz (13)&lt;/a&gt;&lt;/li&gt;</code></p> </blockquote> <p>Somewhere in my files, there is a mistake, but I'm not sure where at thos final numbers. Some numbers are may be different in some pages, but I need the be the same in all pages.</p> <p>Can anyone give me an idea how to find the html pages that contains a line that has other numbers then all above?</p>
0debug
static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) { AVIndexEntry *sample = NULL; int64_t best_dts = INT64_MAX; int i; for (i = 0; i < s->nb_streams; i++) { AVStream *avst = s->streams[i]; MOVStreamContext *msc = avst->priv_data; if (msc->pb && msc->current_sample < avst->nb_index_entries) { AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample]; int64_t dts; if (msc->ctts_data) dts = av_rescale(current_sample->timestamp - msc->dts_shift - msc->ctts_data[msc->ctts_index].duration, AV_TIME_BASE, msc->time_scale); else dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale); av_dlog(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); if (!sample || (!s->pb->seekable && current_sample->pos < sample->pos) || (s->pb->seekable && ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) { sample = current_sample; best_dts = dts; *st = avst; } } } return sample; }
1threat
How to remove shortcut(.lnk) and .vbs from the drives but i dont want that it delete files from my system drives i.e C: or D: how could i do : Deleting files say shortcuts from the remove able drivers like pen drive but not from the system drives like c: D: using batch
0debug
void HELPER(stfl)(CPUS390XState *env) { uint64_t words[MAX_STFL_WORDS]; LowCore *lowcore; lowcore = cpu_map_lowcore(env); do_stfle(env, words); lowcore->stfl_fac_list = cpu_to_be32(words[0] >> 32); cpu_unmap_lowcore(lowcore); }
1threat
shorten javascript code - check if property exists and is not empty : <p>Is it possible to shorten this code?</p> <pre><code>var access_followup = user_access &amp;&amp; user_access.followup &amp;&amp; user_access.followup.access ? true : false; </code></pre>
0debug
Please help me with my code in VB6 : "If LastName and FirstName already exist, else add new, it's okay to duplicate the last name but different first name in the last record. Example: **First Record** *Last Name = Bautista* *First Name = Johnlord* **Second Record** *Last Name = Bautista* *First Name = Angelo* **Third Record** *Last Name = Domingo* *First Name = Angelo* **Fourth Record** *Last Name = Domingo* *First Name = Johnlord* **SAVE!** -- **First Record** *Last Name = Bautista* *First Name = Angelo* **Second Record** *Last Name = Bautista* *First Name = Angelo* **ALREADY EXIST!** Private Sub Command2_Click() With Adodc1.Recordset If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Then MsgBox "Please Update the Information Given!", vbCritical, "ASAP" Else MsgBox "Saved!", vbInformation, "Save" End If` .AddNew .Fields(0) = Text2.Text .Fields(1) = Text3.Text .Fields(2) = Text4.Text .Fields(3) = Combo1.Text .Fields(4) = Text5.Text .Fields(5) = Text6.Text` .Fields(6) = Text7.Text .Fields(7) = Text8.Text Frame1.Visible = False Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" Combo1.Text = "" End If End With End Sub [This is my Interface][1] [1]: https://i.stack.imgur.com/bLtMg.jpg
0debug
python 3 dot product of two vectors with out using numpy : I'm fairly new to coding in the Python 3 language. I'm looking to compute a code that checks the dimensions of two vectors and if they match computes the dot product of those two vectors using for loops and if statements. I'm trying to stay away from any built in python functions any help would be appreciated. Thank you in advance. def dot(vector01,vector02): result= [] for i in range(len(vector01), len(vector02)): total = 0 total += vector01[i] * vector02[i] result.append(total) return result if len(vector01) == len(vector02): return result else: print(error) vector01 = [2, 3, 4] vector02 = [4, 2, 1] print(dot(vector01,vector02))
0debug
static void piix3_update_irq_levels(PIIX3State *piix3) { int pirq; piix3->pic_levels = 0; for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) { piix3_set_irq_level(piix3, pirq, pci_bus_get_irq_level(piix3->dev.bus, pirq)); } }
1threat
How to deal with browser freezing because of nested ng-repeat : <p>I created a nested tree which may have 1 - 5000 items, I am able to make it work but it freezes my browser\loading spinner for few seconds just before showing the tree.</p> <p><strong><em>How can I make it smooth so browser would never freeze ?</em></strong></p> <p><strong><em>How can I know when angularjs finished creating or rendering or computing (not sure right word) whole list so that I could remove loading spinner then, as you can see scope.$last won't work as we have nested ng-repeat and same for scope.$parent.$last</em></strong> </p> <p>Here is plunker I created but with demo data - </p> <p><a href="http://plnkr.co/edit/GSZEpHjt5YVxqpg386k5?p=preview" rel="noreferrer">http://plnkr.co/edit/GSZEpHjt5YVxqpg386k5?p=preview</a></p> <p>Example dataset - <a href="http://pastebin.com/YggqE2MK" rel="noreferrer">http://pastebin.com/YggqE2MK</a></p> <p>It's not too bad in this example but at points my browser freezes for more then 10 seconds for around 4000 items in my OWN setup with all other components.</p> <p><strong>What I already considered</strong></p> <ul> <li>used bindonce.js library but without much success</li> <li>used "::" single binding without much success again</li> <li>only load first level then render next level when user expands a category but my tree can be very random, maybe I only have 1 single root node with 100s child nodes</li> <li>pagination is not ideal for scenario</li> </ul> <p><strong>HTML</strong></p> <pre><code> &lt;script type="text/ng-template" id="tree_item"&gt; &lt;div ng-init="category.expanded=true"&gt; &lt;div ng-class="{'selected': category.ID==selectedCategoryID}"&gt; &lt;div class="icon icon16" ng-if="category.Children.length&gt;0" ng-click="$parent.category.expanded=!$parent.category.expanded" ng-class="$parent.category.expanded?'col':'exp'"&gt;&lt;/div&gt; &lt;div class="icon icon-category" ng-class="'icon-category-'+category.TypeType" ng-style="{'border-color':category.Colour}" ng-attr-title="{{category.Status?Res['wpOPT_Status'+category.Status]:''}}"&gt;&lt;/div&gt; &lt;a ng-href="#id={{category.ID}}" ng-class="{'pending-text': category.PendingChange}"&gt;{{category.Name}}&lt;/a&gt; &lt;/div&gt; &lt;ul class="emlist" ng-show="category.expanded"&gt; &lt;li ng-repeat="category in category.Children | orderBy:'Name'" ng-include="'tree_item'" ng-class="{'selected': category.ID==selectedCategoryID}" e2-tree-item is-selected="category.ID==selectedCategoryID"&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/script&gt; &lt;div id="CategoryListContainer" class="dragmenu-container initial-el-height"&gt; &lt;div class="spinner" data-ng-show="status=='loading'"&gt;&lt;/div&gt; &lt;ul id="CategoryList" class="dragmenu-list ng-cloak" ng-show="status=='loaded'"&gt; &lt;li ng-repeat="category in tree | orderBy:'Name'" ng-include="'tree_item'" e2-tree-item is-selected="category.ID==selectedCategoryID"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>var app = angular.module('recursionDemo', []); app.controller("TreeController", function($scope, $timeout) { $scope.status = "loading"; $timeout(function() { var result = { "GetCategoryTreeResult": [{ // too big data set so I pasted it here http://pastebin.com/YggqE2MK }]; $scope.tree = result.GetCategoryTreeResult; $scope.status = "loaded"; }, 3000); }); app.directive('e2TreeItem', function($timeout) { function link(scope, element, ngModel) { scope.$watch('isSelected', function(oldVal, newVal) { if (scope.isSelected === true) { element.parentsUntil('#CategoryListContainer', 'li').each(function(index, item) { angular.element(item).scope().category.expanded = true; }); } }); // not working //if (scope.$parent.$last) { // console.log("last has been caught"); // var appElement = document.querySelector('[ng-app=recursionDemo]'); // angular.element(appElement).scope().status = "loaded"; //} } return { link: link, scope: { isSelected: '=?' } }; }); </code></pre>
0debug
How to find out which player has closest bid in Price is Right game java? : <p>My Price Is Right program is still incomplete as I need to find out who my winner is each time. </p> <p>The game's winner must have the highest bid that is most closest to the object's value, but cannot be more than the object's value.</p> <p>How can I add the winner into my program? Here is my code so far:</p> <pre><code>public class PriceisRight { public static void main(String args[]) { new PriceisRight(); } public PriceisRight() { System.out.println("Welcome to the Price is Right!\n"); String name1 = IBIO.inputString("Name of contestant #1: "); String name2 = IBIO.inputString("Name of contestant #2: "); String name3 = IBIO.inputString("Name of contestant #3: "); String name4 = IBIO.inputString("Name of contestant #4: "); System.out.println(""); char again = 'y'; while (again == 'Y' || again == 'y') { String THING = item (); System.out.println("The item to bid on is a "+ THING +"."); System.out.println("The contestant who is the closest without going"); System.out.println("over wins. The maximum bid is $1000.\n"); int bid1 = IBIO.inputInt ( name1 +", what is your bid? "); int bid2 = IBIO.inputInt ( name2 +", what is your bid? "); int bid3 = IBIO.inputInt ( name3 +", what is your bid? "); int bid4 = IBIO.inputInt ( name4 +", what is your bid? "); again = IBIO.inputChar ("Play again? (y/n) "); System.out.println (""); } } public String item () { int num = (int)(Math.random() * 5); int price = 0; String object = ""; if (num == 1) { object = ("sofa"); price = 987; } else if (num == 2) { object = ("TV"); price = 560; } else if(num == 3) { object = ("bed"); price = 226; } else if(num == 4) { object = ("table"); price = 354; } else { object = ("chair"); price = 70; } return object; } } </code></pre>
0debug
Getting CPU % consumed by a task with PHP : How can I get the CPU % consumed by a linux task with PHP? I tried to find any utility for this but couldn't. Thanks
0debug
Which one out to the two would be more efficient : from collections import Counter sentence = Counter(input("What would you like to say? ").lower()) sentence_length = 0 for k, v in sentence.items(): if v > 1: print("There are {} {}'s in this sentence.".format(v, k)) else: print("There is {} {} in this sentence.".format(v, k)) sentence_length += v print("There are {} words, including spaces, in total.".format(sentence_length)) and from collections import Counter sentence = Counter(input("What would you like to say? ").lower()) sentence_length = 0 for k, v in sentence.items(): print("There {} {} {}{} in this sentence.".format(("are" if v > 1 else "is"), v, k, ("'s" if v > 1 else ""))) sentence_length += v print("There are {} words, including spaces, in total.".format(sentence_length)) Both programs are used to calculate the number of a letter/number there are in a sentence. The difference between the two programs is the part inside of the "for" statement. I am wanting to know, which one of the two would be more efficient?
0debug
Add a flag to mail : I am developing a perl script in which I need to have a flag in which I accept an email id and then the entire output of the script should be sent to that email id. Any suggestions? ./script -mail xyz@gmail.com
0debug
How to compare Assocaited enums that has no associated value in it : Can i compare associated enum case that has no associated value. Let check the below snippet of code //Declare associated enum enum Example { case test(x:Int) case test1(x:String) } //Creating enum with associated value let testWithAssociatedValue = Example.test(x:0) if case .test = testWithAssociatedValue { //WorksFine } //Now having enum with no associated value let testWithNoAssociatedValue = Example.test Now Why comparing enum that has no associated value like below,gives me compile error?. if case .test = testWithNoAssociatedValue { }
0debug
What are the unknown issues of using try/except block in functions in python? : <p>I want to know the side effects or unknown issues of using try/except block in the below approaches?</p> <p>Approach 1:</p> <pre class="lang-py prettyprint-override"><code>def f1(): try: # some code here except Exception as e: print(str(e)) def f2(): try: f1() except Exception as e: print(str(e)) </code></pre> <p>Approach 2: Same logic as in approach 1 but without try/block in f1()</p> <pre class="lang-py prettyprint-override"><code>def f1(): # some code here def f2(): try: f1() except Exception as e: print(str(e)) </code></pre> <p>Approach 3: Using multiple nested functions</p> <pre class="lang-py prettyprint-override"><code>def f1(): # some code here def f4(): # some code here def f3(): f4() # some code here def f2(): try: f1() f3() except Exception as e: print(str(e)) </code></pre> <p>Approach 4: Adding multiple try/except in every function</p> <pre class="lang-py prettyprint-override"><code>def f1(): try: # some code here except Exception as e: print(str(e)) def f4(): try: # some code here except Exception as e: print(str(e)) def f3(): try: f4() # some code here except Exception as e: print(str(e)) def f2(): try: f1() f3() except Exception as e: print(str(e)) </code></pre>
0debug
BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *iov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { return bdrv_aio_rw_vector(bs, sector_num, iov, nb_sectors, cb, opaque, 0); }
1threat
Dependencies not installed in Visual Studio : <p>I'm currently upgrading my ASP.Net RC1 to ASP.Net Core RC2. The Solution Explorer in Visual Studio is giving me a warning of "Dependencies - not installed" with subfolder "npm - not installed". </p> <p>However, the dependencies do seem to be installed - I ran 'npm install' in the project directory and it ran fine without any errors, just some warnings. It added the dependency folders into a parent folder called node-modules which I can see clearly in Windows Explorer. The node-modules folder contains folders for angular2, bootstrap, copy-webpack-plugin, etc. </p> <p>Does anyone know why Visual Studio is telling me they aren't installed? I've also tried running npm install from Package Manager Console and doing a 'right-click -> restore packages' on those folders giving me the warning in the Solution Explorer. </p> <p><a href="https://i.stack.imgur.com/RZzYL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RZzYL.png" alt="enter image description here"></a></p> <p>Here's my package.json file:</p> <pre><code>{ "name": "EmptyWebApp", "version": "0.0.0", "dependencies": { "angular2": "2.0.0-beta.13", "bootstrap": "^3.3.5", "es6-promise": "^3.0.2", "es6-shim": "^0.35.0", "reflect-metadata": "0.1.2", "jquery": "^2.1.4", "less": "^2.5.3", "lodash": "^3.10.1", "rxjs": "5.0.0-beta.2", "systemjs": "0.19.22", "ts-loader": "^0.7.2", "zone.js": "0.6.6" }, "devDependencies": { "del": "^2.0.2", "event-stream": "^3.3.1", "copy-webpack-plugin": "^0.3.3", "css-loader": "^0.23.0", "exports-loader": "0.6.2", "expose-loader": "^0.7.1", "file-loader": "^0.8.4", "gulp": "^3.9.0", "html-webpack-plugin": "^1.7.0", "http-server": "^0.8.5", "imports-loader": "^0.6.4", "istanbul-instrumenter-loader": "^0.1.3", "json-loader": "^0.5.3", "nodemon": "^1.8.1", "phantomjs": "^1.9.18", "phantomjs-polyfill": "0.0.1", "protractor": "^3.0.0", "raw-loader": "0.5.1", "reflect-metadata": "0.1.2", "remap-istanbul": "^0.5.1", "rimraf": "^2.4.4", "style-loader": "^0.13.0", "ts-helper": "0.0.1", "ts-loader": "^0.7.2", "tsconfig-lint": "^0.4.3", "tslint": "^3.2.0", "tslint-loader": "^2.1.0", "typedoc": "^0.3.12", "typescript": "1.8.9", "typings": "^0.6.1", "url-loader": "^0.5.6", "webpack": "^1.12.9", "webpack-dev-server": "^1.12.1", "webpack-md5-hash": "0.0.4" }, "scripts": { "tsc": "tsc -p . -w", "start": "nodemon --ignore htm,html --ext cs,js --exec \"dnx web\" -V", "static": "nodemon --watch ./client --ext html,css --exec \"gulp deploy-client\" -V", "pre-build": "gulp deploy-client", "webpack": "webpack", "webpack-watch": "webpack --watch", "clean": "gulp cleanwww", "build": "npm run pre-build &amp;&amp; npm run webpack", "dnx": "dnx web" } } </code></pre>
0debug
Css position relative top 50% of div doesnt work : [enter image description here][1]My CSS : https://pastebin.com/EWf4gD81 My HTML : https://pastebin.com/K10iiiHK I have problem with positioning. I cannot set exacly top 50 procent and left 50 procent on both photo and text becouse it isnt 50 procent. I try by hand set that 50 procent which is more like 46 procent. When I change size of window text moves. I dont know what to Do and I am looking for answer for 2 hours enter code here [1]: https://i.stack.imgur.com/kefHv.png
0debug
static int local_chmod(FsContext *ctx, const char *path, mode_t mode) { return chmod(rpath(ctx, path), mode); }
1threat
AWS EC2 Auto Scaling Groups: I get Min and Max, but what's Desired instances limit for? : <p>When you setup an Auto Scaling groups in AWS EC2 <code>Min</code> and <code>Max</code> bounds seem to make sense:</p> <ul> <li>The minimum number of instances to scale down to based on policies</li> <li>The maximum number of instances to scale up to based on policies</li> </ul> <p>However, I've never been able to wrap my head around what the heck <code>Desired</code> is intended to affect.</p> <p>I've always just set <code>Desired</code> equal to <code>Min</code>, because generally, I want to pay Amazon the minimum tithe possible, and unless you need an instance to handle load it should be at the <code>Min</code> number of instances.</p> <p>I know if you use <code>ElasticBeanstalk</code> and set a <code>Min</code> to 1 and <code>Max</code> to 2 it sets a <code>Desired</code> to 2 (of course!)--you can't choose a value for <code>Desired</code>.</p> <p>What would be the use case for a different <code>Desired</code> number of instances and how does it differ? When you expect AWS to scale lower than your <code>Desired</code> if desired is larger than <code>Min</code>?</p>
0debug
static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc, int q) { int coeffs[4]; coeffs[0] = modulo_three_table[code][0]; coeffs[1] = modulo_three_table[code][1]; coeffs[2] = modulo_three_table[code][2]; coeffs[3] = modulo_three_table[code][3]; decode_coeff(dst , coeffs[0], 3, gb, vlc, q); if(is_block2){ decode_coeff(dst+8, coeffs[1], 2, gb, vlc, q); decode_coeff(dst+1, coeffs[2], 2, gb, vlc, q); }else{ decode_coeff(dst+1, coeffs[1], 2, gb, vlc, q); decode_coeff(dst+8, coeffs[2], 2, gb, vlc, q); } decode_coeff(dst+9, coeffs[3], 2, gb, vlc, q); }
1threat
error: conflicting types for 'functiono' : <p>I know this error occurs when there is an incompatibility in the function's declaration and definition. I as far I can see in this code, the type and parameters of the function's (int getline) declaration and definition are the same.</p> <pre><code>#include &lt;stdio.h&gt; #define MAXLINE 1000 int getline(char line[], int maxline); void copy(char to[], char from[]); int main() { int len; int max; char line[MAXLINE]; char longest[MAXLINE]; max = 0; while((len = getline(line, MAXLINE)) &gt; 0) { if (len &gt; max) { max = len; copy(longest, line); } } if (max &gt; 0) { printf("%s\n", longest); } return 0; } int getline(char s[], int lim) { int c, i; for (i=0; i&lt;lim-1 &amp;&amp; (c=getchar())!=EOF &amp;&amp; c!='\n'; ++i) s[i] = c; if (c == '\n') { s[i] = c; ++i; } s[i] = '\0'; return i; } void copy(char to[], char from[]) { int i; i = 0; while((to[i] = from[i]) != '\0'){ ++i; } } </code></pre> <p>I know I am missing something small.</p>
0debug
Add some basic markers to a map in mapbox via mapbox gl js : <p>I have a map styled with mapbox studio, however I'm having difficulty adding even a basic marker to it, however text is appearing where the marker should be which suggests that the marker would be there.</p> <p>So here's the code with that map style:</p> <pre><code>mapboxgl.accessToken = 'pk.eyJ1Ijoic21pY2tpZSIsImEiOiJjaWtiM2JkdW0wMDJudnRseTY0NWdrbjFnIn0.WxGYL18BJjWUiNIu-r3MSA'; var map = new mapboxgl.Map({ container: 'map', style: "mapbox://styles/smickie/cikb3fhvi0063cekqns0pk1f1", center: [-30.50, 40], zoom: 2, interactive: false }); </code></pre> <p>And here some markers being added from an example in the api:</p> <pre><code>map.on('style.load', function () { map.addSource("markers", { "type": "geojson", "data": { "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-77.03238901390978, 38.913188059745586] }, "properties": { "title": "Mapbox DC", "marker-symbol": "monument" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-122.414, 37.776] }, "properties": { "title": "Mapbox SF", "marker-color": "#ff00ff" } }] } }); map.addLayer({ "id": "markers", "type": "symbol", "source": "markers", "layout": { "icon-image": "{marker-symbol}-15", "text-field": "{title}", "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"], "text-offset": [0, 0.6], "text-anchor": "top" } }); }); </code></pre> <p>However only the text and not the icons appear.</p> <p>Question is: how would I add just a normal basic colored marker to this map, not even one of the special icon ones?</p> <p>Thanks.</p>
0debug
Get Enum name from multiple values python : <p>I'm trying to get the name of a enum given one of its multiple values:</p> <pre><code>class DType(Enum): float32 = ["f", 8] double64 = ["d", 9] </code></pre> <p>when I try to get one value giving the name it works:</p> <pre><code>print DType["float32"].value[1] # prints 8 print DType["float32"].value[0] # prints f </code></pre> <p>but when I try to get the name out of a given value only errors will come:</p> <pre><code>print DataType(8).name print DataType("f").name </code></pre> <blockquote> <p>raise ValueError("%s is not a valid %s" % (value, cls.<strong>name</strong>))</p> <p>ValueError: 8 is not a valid DataType</p> <p>ValueError: f is not a valid DataType</p> </blockquote> <p>Is there a way to make this? or am I using the wrong data structure?</p>
0debug
int ff_hevc_decode_nal_sps(HEVCContext *s) { const AVPixFmtDescriptor *desc; GetBitContext *gb = &s->HEVClc->gb; int ret = 0; unsigned int sps_id = 0; int log2_diff_max_min_transform_block_size; int bit_depth_chroma, start, vui_present, sublayer_ordering_info; int i; HEVCSPS *sps; AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps)); if (!sps_buf) return AVERROR(ENOMEM); sps = (HEVCSPS*)sps_buf->data; av_log(s->avctx, AV_LOG_DEBUG, "Decoding SPS\n"); sps->vps_id = get_bits(gb, 4); if (sps->vps_id >= MAX_VPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", sps->vps_id); ret = AVERROR_INVALIDDATA; goto err; } if (!s->vps_list[sps->vps_id]) { av_log(s->avctx, AV_LOG_ERROR, "VPS %d does not exist\n", sps->vps_id); ret = AVERROR_INVALIDDATA; goto err; } sps->max_sub_layers = get_bits(gb, 3) + 1; if (sps->max_sub_layers > MAX_SUB_LAYERS) { av_log(s->avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n", sps->max_sub_layers); ret = AVERROR_INVALIDDATA; goto err; } skip_bits1(gb); if (parse_ptl(s, &sps->ptl, sps->max_sub_layers) < 0) goto err; sps_id = get_ue_golomb_long(gb); if (sps_id >= MAX_SPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", sps_id); ret = AVERROR_INVALIDDATA; goto err; } sps->chroma_format_idc = get_ue_golomb_long(gb); if (sps->chroma_format_idc == 3) sps->separate_colour_plane_flag = get_bits1(gb); if (sps->separate_colour_plane_flag) sps->chroma_format_idc = 0; sps->width = get_ue_golomb_long(gb); sps->height = get_ue_golomb_long(gb); if ((ret = av_image_check_size(sps->width, sps->height, 0, s->avctx)) < 0) goto err; if (get_bits1(gb)) { sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * 2; sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * 2; sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * 2; sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * 2; if (s->avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) { av_log(s->avctx, AV_LOG_DEBUG, "discarding sps conformance window, " "original values are l:%u r:%u t:%u b:%u\n", sps->pic_conf_win.left_offset, sps->pic_conf_win.right_offset, sps->pic_conf_win.top_offset, sps->pic_conf_win.bottom_offset); sps->pic_conf_win.left_offset = sps->pic_conf_win.right_offset = sps->pic_conf_win.top_offset = sps->pic_conf_win.bottom_offset = 0; } sps->output_window = sps->pic_conf_win; } sps->bit_depth = get_ue_golomb_long(gb) + 8; bit_depth_chroma = get_ue_golomb_long(gb) + 8; if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) { av_log(s->avctx, AV_LOG_ERROR, "Luma bit depth (%d) is different from chroma bit depth (%d), " "this is unsupported.\n", sps->bit_depth, bit_depth_chroma); ret = AVERROR_INVALIDDATA; goto err; } switch (sps->bit_depth) { case 8: if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY8; if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P; if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P; if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P; break; case 9: if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16; if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P9; if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P9; if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P9; break; case 10: if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16; if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P10; if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P10; if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P10; break; case 12: if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY16; if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P12; if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P12; if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P12; break; default: av_log(s->avctx, AV_LOG_ERROR, "4:2:0, 4:2:2, 4:4:4 supports are currently specified for 8, 10 and 12 bits.\n"); ret = AVERROR_PATCHWELCOME; goto err; } desc = av_pix_fmt_desc_get(sps->pix_fmt); if (!desc) { ret = AVERROR(EINVAL); goto err; } sps->hshift[0] = sps->vshift[0] = 0; sps->hshift[2] = sps->hshift[1] = desc->log2_chroma_w; sps->vshift[2] = sps->vshift[1] = desc->log2_chroma_h; sps->pixel_shift = sps->bit_depth > 8; sps->log2_max_poc_lsb = get_ue_golomb_long(gb) + 4; if (sps->log2_max_poc_lsb > 16) { av_log(s->avctx, AV_LOG_ERROR, "log2_max_pic_order_cnt_lsb_minus4 out range: %d\n", sps->log2_max_poc_lsb - 4); ret = AVERROR_INVALIDDATA; goto err; } sublayer_ordering_info = get_bits1(gb); start = sublayer_ordering_info ? 0 : sps->max_sub_layers - 1; for (i = start; i < sps->max_sub_layers; i++) { sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1; sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb); sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1; if (sps->temporal_layer[i].max_dec_pic_buffering > MAX_DPB_SIZE) { av_log(s->avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n", sps->temporal_layer[i].max_dec_pic_buffering - 1); ret = AVERROR_INVALIDDATA; goto err; } if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) { av_log(s->avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n", sps->temporal_layer[i].num_reorder_pics); if (s->avctx->err_recognition & AV_EF_EXPLODE || sps->temporal_layer[i].num_reorder_pics > MAX_DPB_SIZE - 1) { ret = AVERROR_INVALIDDATA; goto err; } sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1; } } if (!sublayer_ordering_info) { for (i = 0; i < start; i++) { sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering; sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics; sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase; } } sps->log2_min_cb_size = get_ue_golomb_long(gb) + 3; sps->log2_diff_max_min_coding_block_size = get_ue_golomb_long(gb); sps->log2_min_tb_size = get_ue_golomb_long(gb) + 2; log2_diff_max_min_transform_block_size = get_ue_golomb_long(gb); sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size + sps->log2_min_tb_size; if (sps->log2_min_tb_size >= sps->log2_min_cb_size) { av_log(s->avctx, AV_LOG_ERROR, "Invalid value for log2_min_tb_size"); ret = AVERROR_INVALIDDATA; goto err; } sps->max_transform_hierarchy_depth_inter = get_ue_golomb_long(gb); sps->max_transform_hierarchy_depth_intra = get_ue_golomb_long(gb); sps->scaling_list_enable_flag = get_bits1(gb); if (sps->scaling_list_enable_flag) { set_default_scaling_list_data(&sps->scaling_list); if (get_bits1(gb)) { ret = scaling_list_data(s, &sps->scaling_list, sps); if (ret < 0) goto err; } } sps->amp_enabled_flag = get_bits1(gb); sps->sao_enabled = get_bits1(gb); sps->pcm_enabled_flag = get_bits1(gb); if (sps->pcm_enabled_flag) { sps->pcm.bit_depth = get_bits(gb, 4) + 1; sps->pcm.bit_depth_chroma = get_bits(gb, 4) + 1; sps->pcm.log2_min_pcm_cb_size = get_ue_golomb_long(gb) + 3; sps->pcm.log2_max_pcm_cb_size = sps->pcm.log2_min_pcm_cb_size + get_ue_golomb_long(gb); if (sps->pcm.bit_depth > sps->bit_depth) { av_log(s->avctx, AV_LOG_ERROR, "PCM bit depth (%d) is greater than normal bit depth (%d)\n", sps->pcm.bit_depth, sps->bit_depth); ret = AVERROR_INVALIDDATA; goto err; } sps->pcm.loop_filter_disable_flag = get_bits1(gb); } sps->nb_st_rps = get_ue_golomb_long(gb); if (sps->nb_st_rps > MAX_SHORT_TERM_RPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "Too many short term RPS: %d.\n", sps->nb_st_rps); ret = AVERROR_INVALIDDATA; goto err; } for (i = 0; i < sps->nb_st_rps; i++) { if ((ret = ff_hevc_decode_short_term_rps(s, &sps->st_rps[i], sps, 0)) < 0) goto err; } sps->long_term_ref_pics_present_flag = get_bits1(gb); if (sps->long_term_ref_pics_present_flag) { sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb); if (sps->num_long_term_ref_pics_sps > 31U) { av_log(s->avctx, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n", sps->num_long_term_ref_pics_sps); goto err; } for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) { sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb); sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb); } } sps->sps_temporal_mvp_enabled_flag = get_bits1(gb); sps->sps_strong_intra_smoothing_enable_flag = get_bits1(gb); sps->vui.sar = (AVRational){0, 1}; vui_present = get_bits1(gb); if (vui_present) decode_vui(s, sps); if (get_bits1(gb)) { int sps_extension_flag[1]; for (i = 0; i < 1; i++) sps_extension_flag[i] = get_bits1(gb); skip_bits(gb, 7); if (sps_extension_flag[0]) { int extended_precision_processing_flag; int high_precision_offsets_enabled_flag; int cabac_bypass_alignment_enabled_flag; sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); sps->implicit_rdpcm_enabled_flag = get_bits1(gb); sps->explicit_rdpcm_enabled_flag = get_bits1(gb); extended_precision_processing_flag = get_bits1(gb); if (extended_precision_processing_flag) av_log(s->avctx, AV_LOG_WARNING, "extended_precision_processing_flag not yet implemented\n"); sps->intra_smoothing_disabled_flag = get_bits1(gb); high_precision_offsets_enabled_flag = get_bits1(gb); if (high_precision_offsets_enabled_flag) av_log(s->avctx, AV_LOG_WARNING, "high_precision_offsets_enabled_flag not yet implemented\n"); sps->persistent_rice_adaptation_enabled_flag = get_bits1(gb); cabac_bypass_alignment_enabled_flag = get_bits1(gb); if (cabac_bypass_alignment_enabled_flag) av_log(s->avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } } if (s->apply_defdispwin) { sps->output_window.left_offset += sps->vui.def_disp_win.left_offset; sps->output_window.right_offset += sps->vui.def_disp_win.right_offset; sps->output_window.top_offset += sps->vui.def_disp_win.top_offset; sps->output_window.bottom_offset += sps->vui.def_disp_win.bottom_offset; } if (sps->output_window.left_offset & (0x1F >> (sps->pixel_shift)) && !(s->avctx->flags & CODEC_FLAG_UNALIGNED)) { sps->output_window.left_offset &= ~(0x1F >> (sps->pixel_shift)); av_log(s->avctx, AV_LOG_WARNING, "Reducing left output window to %d " "chroma samples to preserve alignment.\n", sps->output_window.left_offset); } sps->output_width = sps->width - (sps->output_window.left_offset + sps->output_window.right_offset); sps->output_height = sps->height - (sps->output_window.top_offset + sps->output_window.bottom_offset); if (sps->output_width <= 0 || sps->output_height <= 0) { av_log(s->avctx, AV_LOG_WARNING, "Invalid visible frame dimensions: %dx%d.\n", sps->output_width, sps->output_height); if (s->avctx->err_recognition & AV_EF_EXPLODE) { ret = AVERROR_INVALIDDATA; goto err; } av_log(s->avctx, AV_LOG_WARNING, "Displaying the whole video surface.\n"); memset(&sps->pic_conf_win, 0, sizeof(sps->pic_conf_win)); memset(&sps->output_window, 0, sizeof(sps->output_window)); sps->output_width = sps->width; sps->output_height = sps->height; } sps->log2_ctb_size = sps->log2_min_cb_size + sps->log2_diff_max_min_coding_block_size; sps->log2_min_pu_size = sps->log2_min_cb_size - 1; sps->ctb_width = (sps->width + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size; sps->ctb_height = (sps->height + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size; sps->ctb_size = sps->ctb_width * sps->ctb_height; sps->min_cb_width = sps->width >> sps->log2_min_cb_size; sps->min_cb_height = sps->height >> sps->log2_min_cb_size; sps->min_tb_width = sps->width >> sps->log2_min_tb_size; sps->min_tb_height = sps->height >> sps->log2_min_tb_size; sps->min_pu_width = sps->width >> sps->log2_min_pu_size; sps->min_pu_height = sps->height >> sps->log2_min_pu_size; sps->tb_mask = (1 << (sps->log2_ctb_size - sps->log2_min_tb_size)) - 1; sps->qp_bd_offset = 6 * (sps->bit_depth - 8); if (sps->width & ((1 << sps->log2_min_cb_size) - 1) || sps->height & ((1 << sps->log2_min_cb_size) - 1)) { av_log(s->avctx, AV_LOG_ERROR, "Invalid coded frame dimensions.\n"); goto err; } if (sps->log2_ctb_size > MAX_LOG2_CTB_SIZE) { av_log(s->avctx, AV_LOG_ERROR, "CTB size out of range: 2^%d\n", sps->log2_ctb_size); goto err; } if (sps->max_transform_hierarchy_depth_inter > sps->log2_ctb_size - sps->log2_min_tb_size) { av_log(s->avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_inter out of range: %d\n", sps->max_transform_hierarchy_depth_inter); goto err; } if (sps->max_transform_hierarchy_depth_intra > sps->log2_ctb_size - sps->log2_min_tb_size) { av_log(s->avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_intra out of range: %d\n", sps->max_transform_hierarchy_depth_intra); goto err; } if (sps->log2_max_trafo_size > FFMIN(sps->log2_ctb_size, 5)) { av_log(s->avctx, AV_LOG_ERROR, "max transform block size out of range: %d\n", sps->log2_max_trafo_size); goto err; } if (get_bits_left(gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Overread SPS by %d bits\n", -get_bits_left(gb)); goto err; } if (s->avctx->debug & FF_DEBUG_BITSTREAM) { av_log(s->avctx, AV_LOG_DEBUG, "Parsed SPS: id %d; coded wxh: %dx%d; " "cropped wxh: %dx%d; pix_fmt: %s.\n", sps_id, sps->width, sps->height, sps->output_width, sps->output_height, av_get_pix_fmt_name(sps->pix_fmt)); } if (s->sps_list[sps_id] && !memcmp(s->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) { av_buffer_unref(&sps_buf); } else { for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) { if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == sps_id) av_buffer_unref(&s->pps_list[i]); } if (s->sps_list[sps_id] && s->sps == (HEVCSPS*)s->sps_list[sps_id]->data) { av_buffer_unref(&s->current_sps); s->current_sps = av_buffer_ref(s->sps_list[sps_id]); if (!s->current_sps) s->sps = NULL; } av_buffer_unref(&s->sps_list[sps_id]); s->sps_list[sps_id] = sps_buf; } return 0; err: av_buffer_unref(&sps_buf); return ret; }
1threat
static int debugcon_parse(const char *devname) { QemuOpts *opts; if (!qemu_chr_new("debugcon", devname, NULL)) { exit(1); } opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1, NULL); if (!opts) { fprintf(stderr, "qemu: already have a debugcon device\n"); exit(1); } qemu_opt_set(opts, "driver", "isa-debugcon", &error_abort); qemu_opt_set(opts, "chardev", "debugcon", &error_abort); return 0; }
1threat
void qemu_spice_display_update(SimpleSpiceDisplay *ssd, int x, int y, int w, int h) { QXLRect update_area; dprint(2, "%s: x %d y %d w %d h %d\n", __FUNCTION__, x, y, w, h); update_area.left = x, update_area.right = x + w; update_area.top = y; update_area.bottom = y + h; pthread_mutex_lock(&ssd->lock); if (qemu_spice_rect_is_empty(&ssd->dirty)) { ssd->notify++; } qemu_spice_rect_union(&ssd->dirty, &update_area); pthread_mutex_unlock(&ssd->lock); }
1threat
Php string separation : I have the string `$string = ATLPáscoa            ATLNatal          ATLVerão     Turno11-03a07desetembro ` and basicaly I want to separete the `ATLPáscoa` `ATLNatal` `ATLVerão` and `Turno11-03a07desetembro` into diferente strings without the spaces with the following rules: 1. The part of the string `Turno11-03a07desetembro`(lets call it `date`, this can have white spaces in it) can be beetween any other string and in any other order ex: `$string = ATLPáscoa            ATLNatal xyza sd af(<-date)          ATLVerão      `. `ATLPáscoa`, `ATLNatal`, `ATLVerão` are alway that string and in the same order and with any nº white of caracters beetween them if they have no date string is beetween them, I want to get this `date` into a especific string `$date`. 2. There can be up more than 1 date, up to one date after each ATLXXX, exemple: `$string = ATLPáscoa       ATLNatal xyza sd af          ATLVerão      Turno11-03a07desetembro` other exemple: `$string = ATLPáscoa  bananas   ATLNatal xyza sd af          ATLVerão      Turno11-03a07desetembro`, I want to save eacth date in diferente strings `$datePáscoa, $dateNatal $dateVerão` and with no empty spaces at the end of the string, if there is no date after it will be empty string ''. General exemples:`$string = ATLPáscoa ATLNatal xyza sd af ATLVerão Turno11-03a07desetembro` will ressullt in `$datePáscoa =''; $dateNatal = 'xyza sd af' $dateVerão = 'Turno11-03a07desetembro`' other exemple: `$string = ATLPáscoa banana ATLNatal xyza sd af ATLVerão Turno11-03a07desetembro` will ressult in `$datePáscoa ='banana'; $dateNatal = 'xyza sd af'; $dateVerão = 'Turno11-03a07desetembro`'
0debug
static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name) { return !strcmp(name, VIRTFS_META_DIR); }
1threat
Django Rest Framework model serializer with out unique together validation : <p>I have a model with some fields and a <code>unique together</code>:</p> <pre><code>.... class Meta(object): unique_together = ('device_identifier', 'device_platform',) </code></pre> <p>Obviously, in this way, about Django rest framework serializer, I obtain an error when I try to make a PUT with the same <code>device_identifier</code> and <code>device_platform</code> (if already exist an entry with this data).</p> <pre><code>{ "non_field_errors": [ "The fields device_identifier, device_platform must make a unique set." ] } </code></pre> <p>Is possible to disable this validation in my model serializer? Because I need to manage this situation during save model step (for me, in serializer validation this is not an error)</p>
0debug
Windows Outlook alternative for GIF : <p>Windows outlook does not support GIFs for HTML emails. </p> <p>Is there a snippet of code that will target windows outlook only?</p> <p>Would the below work?</p> <pre><code> &lt;!--[if gte mso 9]&gt; &lt;style type="text/css"&gt; /* Your Outlook-specific CSS goes here. */ &lt;/style&gt; &lt;![endif]--&gt; </code></pre>
0debug
static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) { AvsFormat *avs = s->priv_data; int sub_type = 0, size = 0; AvsBlockType type = AVS_NONE; int palette_size = 0; uint8_t palette[4 + 3 * 256]; int ret; if (avs->remaining_audio_size > 0) if (avs_read_audio_packet(s, pkt) > 0) return 0; while (1) { if (avs->remaining_frame_size <= 0) { if (!avio_rl16(s->pb)) return AVERROR(EIO); avs->remaining_frame_size = avio_rl16(s->pb) - 4; } while (avs->remaining_frame_size > 0) { sub_type = avio_r8(s->pb); type = avio_r8(s->pb); size = avio_rl16(s->pb); if (size < 4) return AVERROR_INVALIDDATA; avs->remaining_frame_size -= size; switch (type) { case AVS_PALETTE: if (size - 4 > sizeof(palette)) return AVERROR_INVALIDDATA; ret = avio_read(s->pb, palette, size - 4); if (ret < size - 4) return AVERROR(EIO); palette_size = size; break; case AVS_VIDEO: if (!avs->st_video) { avs->st_video = avformat_new_stream(s, NULL); if (avs->st_video == NULL) return AVERROR(ENOMEM); avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; avs->st_video->codec->codec_id = AV_CODEC_ID_AVS; avs->st_video->codec->width = avs->width; avs->st_video->codec->height = avs->height; avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample; avs->st_video->nb_frames = avs->nb_frames; avs->st_video->avg_frame_rate = (AVRational){avs->fps, 1}; } return avs_read_video_packet(s, pkt, type, sub_type, size, palette, palette_size); case AVS_AUDIO: if (!avs->st_audio) { avs->st_audio = avformat_new_stream(s, NULL); if (avs->st_audio == NULL) return AVERROR(ENOMEM); avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; } avs->remaining_audio_size = size - 4; size = avs_read_audio_packet(s, pkt); if (size != 0) return size; break; default: avio_skip(s->pb, size - 4); } } } }
1threat
static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls) { while (pls->n_main_streams < pls->ctx->nb_streams) { int ist_idx = pls->n_main_streams; AVStream *st = avformat_new_stream(s, NULL); AVStream *ist = pls->ctx->streams[ist_idx]; if (!st) return AVERROR(ENOMEM); st->id = pls->index; set_stream_info_from_input_stream(st, pls, ist); dynarray_add(&pls->main_streams, &pls->n_main_streams, st); add_stream_to_programs(s, pls, st); } return 0; }
1threat
Search for specific keyword or regex pattern on git : <p>How do you search through all commit messages in a git repository for a specific keyword or regex pattern?</p>
0debug
Github public repo : <p>I am new to <strong>Github</strong> and I am working on <strong>CRM</strong> for a company. Sometimes I work in my office and others in my home personal PC. </p> <p>I decided to use <strong>Github</strong> so that I could always edit my files from any place without copy and pasting the <strong>CRM</strong> on each device everyday.</p> <p>But the problem is that I couldn't hide that repo from people.. I mean it is public so anyone can <strong>download</strong> and <strong>see</strong> my code.</p> <p>Also I don't want to buy and upgrade my membership on Github..</p> <p>Any good solutions?</p>
0debug
I am trying to write a program that determines if the sequence of characters is valid or invalid : <p>If the user enters any character other than ACGT (sequence does not matter) then it should print "INVALID". The user just keeps entering the sequence not more than 250 characters. </p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void) { char dna[250]; int i; for(i=0; i&lt;250; i++) { scanf("%c", dna[i]); } fgets(*dna, 250, scanf("%c", dna)); int k; for(k=0; k&lt;250; k++) { if(dna[k] == 'A' || 'C' || 'G'|| 'T') { i++; //printf("%c\n", dna[0]) } } if(i &gt; 0) { printf("VALID sequence \n"); } else { printf("INVALID sequence \n"); } } </code></pre>
0debug
searching technic on multiple paramters which may be null : I am trying to implement searching technic which will take four parameters and returns a set of matched results. method signature looks like public Set<Mobile> search(Set<Mobile> mobiles, OperatingSystem os, Brand brand,Display display, Style style); parameters may be null if they don't want to search for that particular property.ex: operatingSystem may be null but a user may provide brand, display and style. I have tried with all 16 possible combinations like by checking null on each property which I feel not a good option. Thanks in advance.
0debug
can u please tell me how to implement formula in Vlookup? : can you please elaborate how to implement Vlookup formula in Excel. Please guide?[enter image description here][1] [1]: https://i.stack.imgur.com/zWDov.gif
0debug
How to fix a strange error with List.Find() : public static string[] categoryNames = new string[] { "Control", "Supplies", "Power" }; int listSelected = categoryNames.Find(item => item == "Power"); Hello! For some reason, I get this error over 'Find': *There is no argument given that corresponds to the formal parameter 'match' of 'Array.Find<T>(T[], Predicate<T>)'* This confused me. I've looked through many examples, and can't figure out what I'm doing wrong with List.Find. Any feedback is appreciated. Thanks in advance!
0debug
Angular2 template driven async validator : <p>I have a problem with defining asynchrous validator in template driven form.</p> <p>Currently i have this input:</p> <pre><code>&lt;input type="text" ngControl="email" [(ngModel)]="model.applicant.contact.email" #email="ngForm" required asyncEmailValidator&gt; </code></pre> <p>with validator selector <strong>asyncEmailValidator</strong> which is pointing to this class:</p> <pre><code>import {provide} from "angular2/core"; import {Directive} from "angular2/core"; import {NG_VALIDATORS} from "angular2/common"; import {Validator} from "angular2/common"; import {Control} from "angular2/common"; import {AccountService} from "../services/account.service"; @Directive({ selector: '[asyncEmailValidator]', providers: [provide(NG_VALIDATORS, {useExisting: EmailValidator, multi: true}), AccountService] }) export class EmailValidator implements Validator { //https://angular.io/docs/ts/latest/api/common/Validator-interface.html constructor(private accountService:AccountService) { } validate(c:Control):{[key: string]: any} { let EMAIL_REGEXP = /^[-a-z0-9~!$%^&amp;*_=+}{\'?]+(\.[-a-z0-9~!$%^&amp;*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i; if (!EMAIL_REGEXP.test(c.value)) { return {validateEmail: {valid: false}}; } return null; /*return new Promise(resolve =&gt; this.accountService.getUserNames(c.value).subscribe(res =&gt; { if (res == true) { resolve(null); } else { resolve({validateEmailTaken: {valid: false}}); } }));*/ } </code></pre> <p>}</p> <p>Email regex part is working as expected and form is being validated successfuly if regex is matching. But after that I want to check if e-mail is not already in use, so im creating promise for my accountService. But this doesn't work at all and form is in failed state all the time. </p> <p>I've read about model driven forms and using FormBuilder as below:</p> <pre><code>constructor(builder: FormBuilder) { this.email = new Control('', Validators.compose([Validators.required, CustomValidators.emailFormat]), CustomValidators.duplicated ); } </code></pre> <p>Which have async validators defined in third parameter of <strong>Control()</strong> But this is not my case because im using diffrent approach.</p> <p>So, my question is: is it possible to create async validator using template driven forms?</p>
0debug
Access function location programmatically : <p>Is it possible in code to access <code>["[[FunctionLocation]]"]</code> property that google chrome developer tools show when using console log on a function ?</p>
0debug
PHP Human Readable filesize script always returns a "B" : <p>After thinking mine was in error, </p> <p>I found LOT AT LOTS of scripts the do this: <a href="https://gist.github.com/liunian/9338301" rel="nofollow noreferrer">https://gist.github.com/liunian/9338301</a></p> <p>And there are several here at S.O. I used, but had the same annoying "B" as a size.</p> <p>This issue seemed to rear it's ugly head when I switched to php v7.xxx First issues is I have to typcase a floated number (or double) or else I get a "A non well formed numeric value encountered" After some research, apparently this is <a href="https://bugs.php.net/bug.php?id=73468" rel="nofollow noreferrer">NOT a bug</a>. At least that is how I read it.</p> <p>So after typcasting it, the error goes away but the value returned is always a "B' filesize = 87.5B (when it should be MB or GB).</p> <p>I am pretty sure Javascript will work, but would rather keep it with php.</p> <p>Thanks for looking</p> <p>current live script that is producing a "B" only</p> <pre><code> public function readableBytes($size, $type='pc') { //ignore the pc - it is for something else - disabled for debugging $size = (double)$size; static $units = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); $step = 1024; $i = 0; while (($size / $step) &gt; 0.9) { $size = $size / $step; $i++; } return round($size, 2).$units[$i]; }// function readbbleBytes </code></pre>
0debug
static void copy_context_reset(AVCodecContext *avctx) { av_opt_free(avctx); av_freep(&avctx->rc_override); av_freep(&avctx->intra_matrix); av_freep(&avctx->inter_matrix); av_freep(&avctx->extradata); av_freep(&avctx->subtitle_header); av_buffer_unref(&avctx->hw_frames_ctx); avctx->subtitle_header_size = 0; avctx->extradata_size = 0; }
1threat
How can i put those numbers on top? : I have this "draw" at this moment: [What i have][1] And i want to draw numbers in the top, like i did with the letters on left. Something like this: [What i want][2] [1]: https://i.stack.imgur.com/KN50C.png [2]: https://i.stack.imgur.com/bFY1j.png How can i do that? There's my code at this moment: void MostrarC1(int C1[][14]) { char arrLetras[] = { 'A', 'B', ' ', 'C', 'D' }; // Ciclo linhas printf("\n"); for (int lin = 0; lin <= 4; lin++) { printf("%c ", arrLetras[lin]); fflush(stdout); // Ciclo colunas for (int col = 0; col <= 13; col++) { // lugares if (lin != 2) { C1[lin][col] = 0; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); printf(" "); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN); printf("|"); } // corredor else { C1[lin][col] = 0; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_BLUE); printf(" "); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN); } } printf("\n"); } printf("\n\n"); }
0debug
How to get attribute name instead of slug in variation? : <p>I need to get attribute from woocommerce product variation. </p> <pre><code>$terms = get_post_meta($value['variation_id'], 'attribute_pa_color', true); </code></pre> <p>This code is giving me an attribute slug instead of name. How can I get attribute name?</p> <p>Thank you so much in advance!</p>
0debug
access SASS values ($colors from variables.scss) in Typescript (Angular2 ionic2) : <p>In Ionic 2, I would like to access the <code>$colors</code> variables from the file "[my project]\src\theme\variables.scss".</p> <p>This file contains:</p> <pre><code>$colors: ( primary: #387ef5, secondary: #32db64, danger: #f53d3d, light: #f4f4f4, dark: #222, favorite: #69BB7B ); </code></pre> <p>In a component, I draw a canvas. It looks like that:</p> <pre><code>import {Component, Input, ViewChild, ElementRef} from '@angular/core'; @Component({ selector: 'my-graph', }) @View({ template: `&lt;canvas #myGraph class='myGraph' [attr.width]='_size' [attr.height]='_size'&gt;&lt;/canvas&gt;`, }) export class MyGraphDiagram { private _size: number; // get the element with the #myGraph on it @ViewChild("myGraph") myGraph: ElementRef; constructor(){ this._size = 150; } ngAfterViewInit() { // wait for the view to init before using the element let context: CanvasRenderingContext2D = this.myGraph.nativeElement.getContext("2d"); // HERE THE COLOR IS DEFINED AND I D LIKE TO ACCESS variable.scss TO DO THAT context.fillStyle = 'blue'; context.fillRect(10, 10, 150, 150); } } </code></pre> <p>As one can see, at some point in this code the color of the shape is defined: <code>context.fillStyle = 'blue'</code> , I would like to use instead something like <code>context.fillStyle = '[variables.scss OBJECT].$colors.primary '</code>.</p> <p>Has anyone an idea?</p>
0debug