problem
stringlengths
26
131k
labels
class label
2 classes
static RemoveResult remove_hpte(CPUPPCState *env, target_ulong ptex, target_ulong avpn, target_ulong flags, target_ulong *vp, target_ulong *rp) { hwaddr hpte; target_ulong v, r, rb; if ((ptex * HASH_PTE_SIZE_64) & ~env->htab_mask) { return REMOVE_PARM; } hpte = ptex * HASH_PTE_SIZE_64; v = ppc_hash64_load_hpte0(env, hpte); r = ppc_hash64_load_hpte1(env, hpte); if ((v & HPTE64_V_VALID) == 0 || ((flags & H_AVPN) && (v & ~0x7fULL) != avpn) || ((flags & H_ANDCOND) && (v & avpn) != 0)) { return REMOVE_NOT_FOUND; } *vp = v; *rp = r; ppc_hash64_store_hpte0(env, hpte, HPTE64_V_HPTE_DIRTY); rb = compute_tlbie_rb(v, r, ptex); ppc_tlb_invalidate_one(env, rb); return REMOVE_SUCCESS; }
1threat
static void test_qemu_strtoul_correct(void) { const char *str = "12345 foo"; char f = 'X'; const char *endptr = &f; unsigned long res = 999; int err; err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 12345); g_assert(endptr == str + 5); }
1threat
int locate_option(int argc, char **argv, const OptionDef *options, const char *optname) { const OptionDef *po; int i; for (i = 1; i < argc; i++) { const char *cur_opt = argv[i]; if (*cur_opt++ != '-') continue; po = find_option(options, cur_opt); if (!po->name && cur_opt[0] == 'n' && cur_opt[1] == 'o') po = find_option(options, cur_opt + 2); if ((!po->name && !strcmp(cur_opt, optname)) || (po->name && !strcmp(optname, po->name))) return i; if (!po || po->flags & HAS_ARG) i++; } return 0; }
1threat
How can i bulid this effect to website with no background : <p>How can I do this : </p> <pre><code> https://codepen.io/aleksander-koty/pen/KeaGQB </code></pre> <p>But with no background only this star and line</p> <pre><code>org project : https://codepen.io/kenchen/pen/tgBiE </code></pre>
0debug
VS Code Error: spawn git ENOENT : <p>I get the error <code>Error: spawn git ENOENT</code> when I try to view git history using <a href="https://github.com/DonJayamanne/gitHistoryVSCode" rel="noreferrer">https://github.com/DonJayamanne/gitHistoryVSCode</a> on VS Code.. I'm very new to VS Code and github. I tried googling for solutions but I only found links about node.js which I don't understand at all..</p>
0debug
I wanna rander a browser on the AR rendering object. Can three.js makes it? : <p>There is a AR object and I want to Put a browser on it , so users can See that browser on the AR object. Can three.js makes it?</p>
0debug
what is best way to save variable in compiler : i want save variable in bison and don't know what is best way to save variable. value is string or int. parser : .... assignment : '$' identifier '=' exp {updateSymbolVal($2,$4); } ... function : void updateSymbolVal(char symbol,int val) { int bucket = computeSymbolIndex(symbol); symbols[bucket] = val; ////printf("\n is: %s",symbols[bucket]); } how fix them to can give big string ? please help me tank you.
0debug
Python function, need to make it so lists can go through the function. SEC EDGAR : ''' for url in indexurls: row = parseFormPage(indexurls) row ''' indexurls is a list filled with urls returns an error instead of going through the list. Need help with iterations! heres the function code ''' def parseFormPage(indexurls): ''' Input: URL Output: filer_cik: filing_date: report_date: form_url ''' # get page and create soup res = requests.get(indexurls) html = res.text soup = BeautifulSoup(html, 'html.parser') # parse filer Info on 10K page filer_div = soup.find('div', {'id': 'filerDiv'}) filer_text = filer_div.find('span', {'class': 'companyName'}).find('a').get_text() filer_cik = re.search(r"(\d{10})\s(\(.+\))$" ,filer_text)[1] # parse 10K Page Meta data form_content = soup.find('div', {'class': 'formContent'}) filing_date = form_content.find('div', text='Filing Date').findNext('div').get_text() report_date = form_content.find('div', text='Period of Report').findNext('div').get_text() # parse 10-K URL table = soup.find('table', {'class': 'tableFile', 'summary': 'Document Format Files'}) href = table.find('td', text='10-K').find_parent('tr').find('a')['href'] form_url = "https://www.sec.gov" + href return filer_cik, filing_date, report_date, form_url '''
0debug
static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb) { int i, j, scale_factor; unsigned prob, cumulative_target; unsigned cumul_prob = 0; unsigned scaled_cumul_prob = 0; rac->prob[0] = 0; rac->prob[257] = UINT_MAX; for (i = 1; i < 257; i++) { if (lag_decode_prob(gb, &rac->prob[i]) < 0) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability encountered.\n"); return -1; } if ((uint64_t)cumul_prob + rac->prob[i] > UINT_MAX) { av_log(rac->avctx, AV_LOG_ERROR, "Integer overflow encountered in cumulative probability calculation.\n"); return -1; } cumul_prob += rac->prob[i]; if (!rac->prob[i]) { if (lag_decode_prob(gb, &prob)) { av_log(rac->avctx, AV_LOG_ERROR, "Invalid probability run encountered.\n"); return -1; } if (prob > 257 - i) prob = 257 - i; for (j = 0; j < prob; j++) rac->prob[++i] = 0; } } if (!cumul_prob) { av_log(rac->avctx, AV_LOG_ERROR, "All probabilities are 0!\n"); return -1; } scale_factor = av_log2(cumul_prob); if (cumul_prob & (cumul_prob - 1)) { uint64_t mul = softfloat_reciprocal(cumul_prob); for (i = 1; i < 257; i++) { rac->prob[i] = softfloat_mul(rac->prob[i], mul); scaled_cumul_prob += rac->prob[i]; } scale_factor++; cumulative_target = 1 << scale_factor; if (scaled_cumul_prob > cumulative_target) { av_log(rac->avctx, AV_LOG_ERROR, "Scaled probabilities are larger than target!\n"); return -1; } scaled_cumul_prob = cumulative_target - scaled_cumul_prob; for (i = 1; scaled_cumul_prob; i = (i & 0x7f) + 1) { if (rac->prob[i]) { rac->prob[i]++; scaled_cumul_prob--; } } } rac->scale = scale_factor; for (i = 1; i < 257; i++) rac->prob[i] += rac->prob[i - 1]; return 0; }
1threat
database output each line on each page : <p>i am trying to put data of each each from my database to each page by modifying it on each page</p> <p>for example i have on my database with table of :</p> <p><code>id fname lname age 1 bob carl 23 2 michael jake 25</code></p> <p>now i want each line to show up on each page i want</p> <p>for example i have page1.php this must out put the first line like this <code>bob carl 23</code></p> <p>and i have page2.php this must out put the second line like this <code>michael jake 25</code></p> <p>and so on.</p> <p>i have a code like this</p> <pre><code>$sql = "SELECT * FROM pages"; $results = mysqli_query($connection,$sql); if (mysqli_num_rows($results) &gt; 0) { while ($row = mysqli_fetch_array($results)) { $id = $row["id"]; $pname = $row["pname"]; $pimg = $row["pimg"]; $pstream = $row["pstream"]; } } </code></pre> <p>if i echo this out it is gonna output the last line only or with while loop it's gonna output all lines on one page. how can i mark from my code which line should be showing ?</p>
0debug
static bool nvic_rettobase(NVICState *s) { int irq, nhand = 0; for (irq = ARMV7M_EXCP_RESET; irq < s->num_irq; irq++) { if (s->vectors[irq].active) { nhand++; if (nhand == 2) { return 0; } } } return 1; }
1threat
Big-O complexity for n + n-1 + n-2 + n-3 + (...) + 1 : <p>I was wondering.. what is the complexity of an algorithm that starts with n elements (which I run through doing whatever). I take one element off, I do it again.. I take off another element and do it again until I have just one element left. is it O(n log n)? I can't visualize it...</p>
0debug
Setting GOOGLE_APPLICATION_CREDENTIALS for BigQuery Python CLI : <p>I'm trying to connect to Google BigQuery through the BigQuery API, using Python. </p> <p>I'm following this page here: <a href="https://cloud.google.com/bigquery/bigquery-api-quickstart" rel="noreferrer">https://cloud.google.com/bigquery/bigquery-api-quickstart</a></p> <p>My code is as follows:</p> <pre><code>import os import argparse from apiclient.discovery import build from apiclient.errors import HttpError from oauth2client.client import GoogleCredentials GOOGLE_APPLICATION_CREDENTIALS = './Peepl-cb1dac99bdc0.json' def main(project_id): # Grab the application's default credentials from the environment. credentials = GoogleCredentials.get_application_default() print(credentials) # Construct the service object for interacting with the BigQuery API. bigquery_service = build('bigquery', 'v2', credentials=credentials) try: query_request = bigquery_service.jobs() query_data = { 'query': ( 'SELECT TOP(corpus, 10) as title, ' 'COUNT(*) as unique_words ' 'FROM [publicdata:samples.shakespeare];') } query_response = query_request.query( projectId=project_id, body=query_data).execute() print('Query Results:') for row in query_response['rows']: print('\t'.join(field['v'] for field in row['f'])) except HttpError as err: print('Error: {}'.format(err.content)) raise err if __name__ == '__main__': parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('project_id', help='Your Google Cloud Project ID.') args = parser.parse_args() main(args.project_id) </code></pre> <p>However, when I run this code through the terminal, I get the following error: </p> <pre><code>oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. </code></pre> <p>As you can see in the code, I've tried to set the <code>GOOGLE_APPLICATION_CREDENTIALS</code> as per the link in the error. However, the error persists. Does anyone know what the issue is? </p> <p>Thank you in advance. </p>
0debug
HttpUrlConnection setting Range in Android is ignored : <p>I'm trying get a 206 response from my server using Android.</p> <p><strong>Here's the code.</strong></p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected Void doInBackground(Void... params) { try { URL url = new URL("http://aviddapp.com/10mb.file"); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestProperty("Range", "bytes=1-2"); urlConnection.connect(); System.out.println("Response Code: " + urlConnection.getResponseCode()); System.out.println("Content-Length: " + urlConnection.getContentLength()); Map&lt;String, List&lt;String&gt;&gt; map = urlConnection.getHeaderFields(); for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) { System.out.println("Key : " + entry.getKey() + " ,Value : " + entry.getValue()); } InputStream inputStream = urlConnection.getInputStream(); long size = 0; while(inputStream.read() != -1 ) size++; System.out.println("Downloaded Size: " + size); }catch(MalformedURLException mue) { mue.printStackTrace(); }catch(IOException ioe) { ioe.printStackTrace(); } return null; } }.execute(); } </code></pre> <p>Here's the output:</p> <pre><code>I/System.out: Respnse Code: 200 I/System.out: Content-Length: -1 I/System.out: Key : null ,Value : [HTTP/1.1 200 OK] I/System.out: Key : Accept-Ranges ,Value : [bytes] I/System.out: Key : Cache-Control ,Value : [max-age=604800, public] I/System.out: Key : Connection ,Value : [Keep-Alive] I/System.out: Key : Date ,Value : [Tue, 04 Oct 2016 07:45:22 GMT] I/System.out: Key : ETag ,Value : ["a00000-53e051f279680-gzip"] I/System.out: Key : Expires ,Value : [Tue, 11 Oct 2016 07:45:22 GMT] I/System.out: Key : Keep-Alive ,Value : [timeout=5, max=100] I/System.out: Key : Last-Modified ,Value : [Tue, 04 Oct 2016 07:36:42 GMT] I/System.out: Key : Server ,Value : [Apache/2.4.12 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4] I/System.out: Key : Transfer-Encoding ,Value : [chunked] I/System.out: Key : Vary ,Value : [Accept-Encoding,User-Agent] I/System.out: Key : X-Android-Received-Millis ,Value : [1475567127403] I/System.out: Key : X-Android-Response-Source ,Value : [NETWORK 200] I/System.out: Key : X-Android-Sent-Millis ,Value : [1475567127183] I/System.out: Downloaded Size: 10485760 </code></pre> <p><strong>Now I'm doing the same thing is pure java.</strong></p> <pre><code>public static void main(String... args) { try { URL url = new URL("http://aviddapp.com/10mb.file"); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestProperty("Range", "bytes=1-2"); urlConnection.connect(); System.out.println("Respnse Code: " + urlConnection.getResponseCode()); System.out.println("Content-Length: " + urlConnection.getContentLength()); Map&lt;String, List&lt;String&gt;&gt; map = urlConnection.getHeaderFields(); for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) { System.out.println("Key : " + entry.getKey() + " ,Value : " + entry.getValue()); } InputStream inputStream = urlConnection.getInputStream(); long size = 0; while(inputStream.read() != -1 ) size++; System.out.println("Downloaded Size: " + size); }catch(MalformedURLException mue) { mue.printStackTrace(); }catch(IOException ioe) { ioe.printStackTrace(); } } </code></pre> <p><strong>Here's the output</strong></p> <pre><code>Respnse Code: 206 Content-Length: 2 Key : Keep-Alive ,Value : [timeout=5, max=100] Key : null ,Value : [HTTP/1.1 206 Partial Content] Key : Server ,Value : [Apache/2.4.12 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4] Key : Content-Range ,Value : [bytes 1-2/10485760] Key : Connection ,Value : [Keep-Alive] Key : Last-Modified ,Value : [Tue, 04 Oct 2016 07:36:42 GMT] Key : Date ,Value : [Tue, 04 Oct 2016 07:42:17 GMT] Key : Accept-Ranges ,Value : [bytes] Key : Cache-Control ,Value : [max-age=604800, public] Key : ETag ,Value : ["a00000-53e051f279680"] Key : Vary ,Value : [Accept-Encoding,User-Agent] Key : Expires ,Value : [Tue, 11 Oct 2016 07:42:17 GMT] Key : Content-Length ,Value : [2] Downloaded Size: 2 </code></pre> <p>As you can see I'm getting diffrent response codes in both cases. It seems like Android is not passing <code>Range</code> to the server maybe? What's happening here?</p> <p><em>PS: I'm getting a 206 if the file size is 1mb.</em></p>
0debug
def count_Squares(m,n): if (n < m): temp = m m = n n = temp return n * (n + 1) * (3 * m - n + 1) // 6
0debug
Sorting Array in array variable : <p>I have an array like this</p> <pre><code>$data = array( array( 'name'=&gt;'guguk', 'nilai'=&gt;3 ), array( 'name'=&gt;'gogok', 'nilai'=&gt;7 ) ); </code></pre> <p>so, how should I do to sort array base on attribute 'nilai'?</p>
0debug
Update Xcode 10.1 to 10.2 on High Sierra 10.13.6 : <p>I'm trying to update Xcode 10.1 to 10.2 on my High Sierra 10.13.6 version.</p> <p>The App Store window shows the update button, but the problem is after hitting that button, the circle on the upper-left corner is just rotating for hours and nothing else happens!</p> <p><a href="https://i.stack.imgur.com/DZjZM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DZjZM.png" alt="enter image description here"></a></p> <p>Since the difference between the two versions is not that huge, the update naturally must be downloaded and installed after some time, but in effect it's not that way! </p> <p>How to solve that issue, please?</p>
0debug
Pandas.read_csv() with special characters (accents) in column names � : <p>I have a <code>csv</code> file that contains some data with columns names:</p> <ul> <li><em>"PERIODE"</em></li> <li><em>"IAS_brut"</em></li> <li><em>"IAS_lissé"</em></li> <li><em>"Incidence_Sentinelles"</em></li> </ul> <p>I have a problem with the third one <strong><em>"IAS_lissé"</em></strong> which is misinterpreted by <code>pd.read_csv()</code> method and returned as �.</p> <p>What is that character?</p> <p>Because it's generating a bug in my flask application, is there a way to read that column in an other way <strong>without modifying the file?</strong></p> <pre class="lang-py prettyprint-override"><code>In [1]: import pandas as pd In [2]: pd.read_csv("Openhealth_S-Grippal.csv",delimiter=";").columns Out[2]: Index([u'PERIODE', u'IAS_brut', u'IAS_liss�', u'Incidence_Sentinelles'], dtype='object') </code></pre>
0debug
Visual studio 2017 installer won't run after extracting : <p>visual studio 2017 community.exe won't run after extracting to the temp.</p> <p>OS: windows 10 x64bit</p> <p>Setup : community version</p> <p>in the temp folder bootstrapper log says, </p> <p><strong>Beginning of the log. Start Time: 3/26/2017 1:14:54 AM VisualStudio Bootstrapper:3/26/2017 1:14:54 AM: Current Optin root path does not exists<br> VisualStudio Bootstrapper:3/26/2017 1:14:55 AM: Commandline arguments =</strong> <br></p> <p>and the dd_vs_community_decompression_log says<br> <strong>[3/26/2017, 11:17:47] === Logging started: 2017/03/26 11:17:47 ===<br> [3/26/2017, 11:17:47] Executable: C:\Users\Sameera\Downloads\Programs\vs_community.exe v15.0.26228.0<br> [3/26/2017, 11:17:47] --- logging level: standard ---<br> [3/26/2017, 11:17:47] Directory <br>'C:\Users\Sameera\AppData\Local\Temp\4ceac4b7b9cd9fdf2489526c66\' has been selected for file extraction<br> [3/26/2017, 11:17:48] Extracting files to: C:\Users\Sameera\AppData\Local\Temp\4ceac4b7b9cd9fdf2489526c66\<br> [3/26/2017, 11:17:48] Extraction took 360 milliseconds<br> [3/26/2017, 11:17:48] Executing extracted package: 'vs_bootstrapper_d15\vs_setup_bootstrapper.exe ' with commandline ' '<br> [3/26/2017, 11:18:10] The entire Box execution exiting with result code: 0x0<br> [3/26/2017, 11:18:10] Launched extracted application exiting with result code: 0xc000000d<br> [3/26/2017, 11:18:10] === Logging stopped: 2017/03/26 11:18:10 ===</strong><br></p> <p>can't find proper solution..</p>
0debug
Count records with today's timestamp mysql php : Here is my PHP code it is working in localhost but when i am uploading on server it is not working it taking 1 day before data from database. If any one have answer please reply it is very urgent. Thanks in advance. <?php require_once('connection.php'); $id=$_SESSION['SESS_MEMBER_ID']; $query = mysql_query("select count(*) as Unread3 from s_daily_reporting where (mem_id='$id')&&(entry_time >= DATE_SUB(CURRENT_DATE(), INTERVAL 0 DAY))"); $data2= mysql_fetch_array($query); echo $sum=8-$data2['Unread3']; ?>
0debug
I keep getting error when im creating trigger and i don't have idea how to fix it : CREATE TRIGGER ORDER_BILL_TRIG AFTER INSERT ON ORDER_BILL FOR EACH ROW MODE DB2SQL [REFERENCING NEW AS N] UPDATE ORDER_BILL SET ORDER_BILL = QUANTITY * (SELECT FOOD_PRICE FROM FOOD WHERE FOOD_PRICE = N.FOOD_NUM) WHERE N.FOOD_NUM = FOOD_NUM; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DB2SQL [REFERENCING NEW AS N] UPDATE ORDER_BILL SET ORDER_BILL = QUANTITY * (SEL' at line 3
0debug
static target_ulong h_protect(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) { target_ulong flags = args[0]; target_ulong pte_index = args[1]; target_ulong avpn = args[2]; uint8_t *hpte; target_ulong v, r, rb; if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) { return H_PARAMETER; } hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64); while (!lock_hpte(hpte, HPTE_V_HVLOCK)) { assert(0); } v = ldq_p(hpte); r = ldq_p(hpte + (HASH_PTE_SIZE_64/2)); if ((v & HPTE_V_VALID) == 0 || ((flags & H_AVPN) && (v & ~0x7fULL) != avpn)) { stq_p(hpte, v & ~HPTE_V_HVLOCK); assert(!(ldq_p(hpte) & HPTE_V_HVLOCK)); return H_NOT_FOUND; } r &= ~(HPTE_R_PP0 | HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_HI | HPTE_R_KEY_LO); r |= (flags << 55) & HPTE_R_PP0; r |= (flags << 48) & HPTE_R_KEY_HI; r |= flags & (HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_LO); rb = compute_tlbie_rb(v, r, pte_index); stq_p(hpte, v & ~HPTE_V_VALID); ppc_tlb_invalidate_one(env, rb); stq_p(hpte + (HASH_PTE_SIZE_64/2), r); stq_p(hpte, v & ~HPTE_V_HVLOCK); assert(!(ldq_p(hpte) & HPTE_V_HVLOCK)); return H_SUCCESS; }
1threat
static void draw_bar(TestSourceContext *test, const uint8_t color[4], int x, int y, int w, int h, AVFrame *frame) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); uint8_t *p, *p0; int plane; x = FFMIN(x, test->w - 1); y = FFMIN(y, test->h - 1); w = FFMIN(w, test->w - x); h = FFMIN(h, test->h - y); av_assert0(x + w <= test->w); av_assert0(y + h <= test->h); for (plane = 0; frame->data[plane]; plane++) { const int c = color[plane]; const int linesize = frame->linesize[plane]; int i, px, py, pw, ph; if (plane == 1 || plane == 2) { px = x >> desc->log2_chroma_w; pw = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); py = y >> desc->log2_chroma_h; ph = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); } else { px = x; pw = w; py = y; ph = h; } p0 = p = frame->data[plane] + py * linesize + px; memset(p, c, pw); p += linesize; for (i = 1; i < ph; i++, p += linesize) memcpy(p, p0, pw); } }
1threat
Need sql select statement for the following : I)Get the names of the employees who are working on the project named “Office Security Project” and their responsibilities in the project. ii. Give the qualification for the above query in: 1) conjunctive normal form, and 2) disjunctive normal form.
0debug
Single executable with Python and React.js : <p>I have two applications </p> <ul> <li>react.js + node.js app.</li> <li><p>stand alone python app</p> <p>I need to merge these two apps and distribute this single app in single executable/binary. I understand i need to get rid of node.js and use python as my backend and change calls going from react-node to react-python. And for the latter i need to bring may be Flask.</p> <p>For packaging i can use PyInstaller or cx_freeze.</p> <p>Any pointers what is the best way to make this merge and create single executable/binary so that final workflow should be like below :</p> <p>1) User gets the single executable/binary</p> <p>2) Runs/Executes the executable/binary</p> <p>3) This fires up the application which can be accessed on browser</p> <p>4) User will be able to send request from UI (React) to Backend (Python)</p> <p>So basically the single executable/binary has python env, python backend and react(UI) code.</p></li> </ul>
0debug
I dont know why i cant show my list : So ive been trying to overload << operator for my list, but i just cant cout it. i have the following error and i dont know how to fix it..error: no match for 'operator<<' in 'std::cout << it.std::_List_const_iterator<_Tp>::operator* [with _Tp = Joc]()'| CPP: This are the methods that i tried to overload cout << operator but neither of them worked to cout my list using iterators. i dunno how to fix it. ostream& Joc::afisare(ostream&os)const{ os<<endl; os<<"Numele jocului:"<<this->nume<<' '<<"Stoc:"<<this->stoc<<' '<<"Descrierea joc: "<<this->Descriere<<' '; for(list<string>::const_iterator it=upd.begin();it!=upd.end();it++) { os<<"Lista:"<<*it<<endl; } os<<endl; return os; } ostream &operator << (ostream &os, Joc&j){ return j.afisare(os); } void Joc::afisare()const {cout<<"Numele jocului:"<<this->nume<<' '<<"Stoc:"<<this->stoc<<' '<<"Descrierea joc: "<<this->Descriere<<' '; for(list<string>::const_iterator it=upd.begin();it!=upd.end();it++) { cout<<"Lista:"<<*it<<endl; } } Main: list < Joc > jx; here i declared a list of "joc" type. jx.push_back(j6); pushed 2 jx.push_back(j7); for(list<Joc>::const_iterator it=jx.begin();it!=jx.end();it++) { cout<<*it; } //tried to cout<<it->afisare(); still didnt work , i dunno what to do. I think its problem with overload << but i dont know how to fix it.. } ALl i need is to tipe this list . I dunno how . i think the code is alright but im getting that error. Details detials ALl i need is to tipe this list . I dunno how . i think the code is alright but im getting that error. Details detials ALl i need is to tipe this list . I dunno how . i think the code is alright but im getting that error. Details detials ALl i need is to tipe this list . I dunno how . i think the code is alright but im getting that error. Details detials ALl i need is to tipe this list . I dunno how . i think the code is alright but im getting that error. Details detials
0debug
Striped triangle in CSS : <p>I'm trying to code a striped triangle in CSS, which will be a resize icon as you can normally find in the lower right of a window such as this one: <a href="https://i.stack.imgur.com/HkLqk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HkLqk.png" alt="enter image description here"></a></p> <p>I tried using repeating-linear-gradient and creating a triangle with the div-border trick, but I can't combine those, as the triangle is made from borders, and the gradient is for background.</p> <p>So how do I get a div that looks like the image? I can't find anything helpful on google or here on stackoverflow.</p> <p>Any help is highly appreciated :)</p>
0debug
Java substring string when specific string occours : i need help to substring a string when a a substring occours. Example > Initial string: 123456789abcdefgh > string to substr: abcd > result : 123456789 I checked substr method but it accept index position value.I need to search the occorrence of the substring and than pass the index? Thanks
0debug
Using List Comprehensions to create multiple SubList in a list . - Python : I have a list : list1 = [0,2,5,6] Here I want to add number 2 to the list1 and create a sublist in new list , and create another sublist using the first sublist to create new sublist . I want to create a new list from list1 with the help of list comprehentions only and that too in single line . newList = [[2,4,6,8],[4,6,8,10],[6,8,10,12]] For example : newList = [a+2 for a in list1] but with this code I am able to create only 1 list inside newList.but I want to create 3 sublist accordingly in newList using list Comprehensions only.
0debug
static void v9fs_write(void *opaque) { int cnt; ssize_t err; int32_t fid; int64_t off; int32_t count; int32_t len = 0; int32_t total = 0; size_t offset = 7; V9fsFidState *fidp; struct iovec iov[128]; struct iovec *sg = iov; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dqdv", &fid, &off, &count, sg, &cnt); trace_v9fs_write(pdu->tag, pdu->id, fid, off, count, cnt); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_FILE) { if (fidp->fs.fd == -1) { err = -EINVAL; goto out; } } else if (fidp->fid_type == P9_FID_XATTR) { err = v9fs_xattr_write(s, pdu, fidp, off, count, sg, cnt); goto out; } else { err = -EINVAL; goto out; } sg = cap_sg(sg, count, &cnt); do { if (0) { print_sg(sg, cnt); } do { len = v9fs_co_pwritev(pdu, fidp, sg, cnt, off); if (len >= 0) { off += len; total += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { err = len; goto out; } sg = adjust_sg(sg, len, &cnt); } while (total < count && len > 0); offset += pdu_marshal(pdu, offset, "d", total); err = offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err); out: put_fid(pdu, fidp); out_nofid: complete_pdu(s, pdu, err); }
1threat
Which of following sql instructions do not is Standard SQL? : <pre><code>a) GRANT b) SELECT c) CREATE d) All previous is sql standard </code></pre> <p>If you can share with me a link for learning all standard sql, i would appreciate</p>
0debug
More denn one variable on javascript : Hi i have this script : <v-tab :title="siteObject.xip_infos[index].lineid" > <div class="description text-left" :class="{ 'text-danger': item.status === 'DEACTIVE' }"> <small v-for="(field, key) in item" :key="key"> <strong>{{ key }}</strong> {{ field }}<br> </small> </div> </v-tab> the result of this script show me all item how have status **DEACTIVE** i wanna add the condition **disconnected** how i do this ? Thanks
0debug
static void spawn_thread(ThreadPool *pool) { pool->cur_threads++; pool->new_threads++; if (!pool->pending_threads) { qemu_bh_schedule(pool->new_thread_bh); } }
1threat
static int assign_intx(AssignedDevice *dev) { AssignedIRQType new_type; PCIINTxRoute intx_route; bool intx_host_msi; int r; if (assigned_dev_pci_read_byte(&dev->dev, PCI_INTERRUPT_PIN) == 0) { pci_device_set_intx_routing_notifier(&dev->dev, NULL); return 0; } if (!check_irqchip_in_kernel()) { return -ENOTSUP; } pci_device_set_intx_routing_notifier(&dev->dev, assigned_dev_update_irq_routing); intx_route = pci_device_route_intx_to_irq(&dev->dev, dev->intpin); assert(intx_route.mode != PCI_INTX_INVERTED); if (!pci_intx_route_changed(&dev->intx_route, &intx_route)) { return 0; } switch (dev->assigned_irq_type) { case ASSIGNED_IRQ_INTX_HOST_INTX: case ASSIGNED_IRQ_INTX_HOST_MSI: intx_host_msi = dev->assigned_irq_type == ASSIGNED_IRQ_INTX_HOST_MSI; r = kvm_device_intx_deassign(kvm_state, dev->dev_id, intx_host_msi); break; case ASSIGNED_IRQ_MSI: r = kvm_device_msi_deassign(kvm_state, dev->dev_id); break; case ASSIGNED_IRQ_MSIX: r = kvm_device_msix_deassign(kvm_state, dev->dev_id); break; default: r = 0; break; } if (r) { perror("assign_intx: deassignment of previous interrupt failed"); } dev->assigned_irq_type = ASSIGNED_IRQ_NONE; if (intx_route.mode == PCI_INTX_DISABLED) { dev->intx_route = intx_route; return 0; } retry: if (dev->features & ASSIGNED_DEVICE_PREFER_MSI_MASK && dev->cap.available & ASSIGNED_DEVICE_CAP_MSI) { intx_host_msi = true; new_type = ASSIGNED_IRQ_INTX_HOST_MSI; } else { intx_host_msi = false; new_type = ASSIGNED_IRQ_INTX_HOST_INTX; } r = kvm_device_intx_assign(kvm_state, dev->dev_id, intx_host_msi, intx_route.irq); if (r < 0) { if (r == -EIO && !(dev->features & ASSIGNED_DEVICE_PREFER_MSI_MASK) && dev->cap.available & ASSIGNED_DEVICE_CAP_MSI) { error_report("Host-side INTx sharing not supported, " "using MSI instead"); error_printf("Some devices do not work properly in this mode.\n"); dev->features |= ASSIGNED_DEVICE_PREFER_MSI_MASK; goto retry; } error_report("Failed to assign irq for \"%s\": %s", dev->dev.qdev.id, strerror(-r)); error_report("Perhaps you are assigning a device " "that shares an IRQ with another device?"); return r; } dev->intx_route = intx_route; dev->assigned_irq_type = new_type; return r; }
1threat
static int lag_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; LagarithContext *l = avctx->priv_data; ThreadFrame frame = { .f = data }; AVFrame *const p = data; uint8_t frametype = 0; uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; uint32_t offs[4]; uint8_t *srcs[4], *dst; int i, j, planes = 3; p->key_frame = 1; frametype = buf[0]; offset_gu = AV_RL32(buf + 1); offset_bv = AV_RL32(buf + 5); switch (frametype) { case FRAME_SOLID_RGBA: avctx->pix_fmt = AV_PIX_FMT_RGB32; if (ff_thread_get_buffer(avctx, &frame, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } dst = p->data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) AV_WN32(dst + i * 4, offset_gu); dst += p->linesize[0]; } break; case FRAME_ARITH_RGBA: avctx->pix_fmt = AV_PIX_FMT_RGB32; planes = 4; offset_ry += 4; offs[3] = AV_RL32(buf + 9); case FRAME_ARITH_RGB24: case FRAME_U_RGB24: if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = AV_PIX_FMT_RGB24; if (ff_thread_get_buffer(avctx, &frame, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } offs[0] = offset_bv; offs[1] = offset_gu; offs[2] = offset_ry; if (!l->rgb_planes) { l->rgb_stride = FFALIGN(avctx->width, 16); l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes + 1); if (!l->rgb_planes) { av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); } } for (i = 0; i < planes; i++) srcs[i] = l->rgb_planes + (i + 1) * l->rgb_stride * avctx->height - l->rgb_stride; if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size || (planes == 4 && offs[3] >= buf_size)) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < planes; i++) lag_decode_arith_plane(l, srcs[i], avctx->width, avctx->height, -l->rgb_stride, buf + offs[i], buf_size - offs[i]); dst = p->data[0]; for (i = 0; i < planes; i++) srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) { uint8_t r, g, b, a; r = srcs[0][i]; g = srcs[1][i]; b = srcs[2][i]; r += g; b += g; if (frametype == FRAME_ARITH_RGBA) { a = srcs[3][i]; AV_WN32(dst + i * 4, MKBETAG(a, r, g, b)); } else { dst[i * 3 + 0] = r; dst[i * 3 + 1] = g; dst[i * 3 + 2] = b; } } dst += p->linesize[0]; for (i = 0; i < planes; i++) srcs[i] += l->rgb_stride; } break; case FRAME_ARITH_YUY2: avctx->pix_fmt = AV_PIX_FMT_YUV422P; if (ff_thread_get_buffer(avctx, &frame, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf + offset_ry, buf_size - offset_ry); lag_decode_arith_plane(l, p->data[1], avctx->width / 2, avctx->height, p->linesize[1], buf + offset_gu, buf_size - offset_gu); lag_decode_arith_plane(l, p->data[2], avctx->width / 2, avctx->height, p->linesize[2], buf + offset_bv, buf_size - offset_bv); break; case FRAME_ARITH_YV12: avctx->pix_fmt = AV_PIX_FMT_YUV420P; if (ff_thread_get_buffer(avctx, &frame, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size) { av_log(avctx, AV_LOG_ERROR, "Invalid frame offsets\n"); return AVERROR_INVALIDDATA; } lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf + offset_ry, buf_size - offset_ry); lag_decode_arith_plane(l, p->data[2], avctx->width / 2, avctx->height / 2, p->linesize[2], buf + offset_gu, buf_size - offset_gu); lag_decode_arith_plane(l, p->data[1], avctx->width / 2, avctx->height / 2, p->linesize[1], buf + offset_bv, buf_size - offset_bv); break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported Lagarith frame type: %#x\n", frametype); return -1; } *got_frame = 1; return buf_size; }
1threat
test a java method in netbeans : <p>Let's say I found this piece of code and I want to test it in Netbeans before I incorporate it:</p> <pre><code>ArrayList list; for(String s: list) { Integer c = stringsCount.get(s); if(c == null) c = new Integer(0); c++; stringsCount.put(s,c); } </code></pre> <p>Is there a way to test the above code in Netbeans without having to create a temp class with a main? I believe there is a way in Eclipse but I am looking for a way in Netbeans. Thank you.</p>
0debug
How to reduce the time complexity of this nested loop code in python : <p>Please help me reduce the time complexity of the nested loop in Python</p> <p>df is a dataframe with say 3 columns, say name, city and date for eg rep data frame has the average/means based on 2 columns name and city from df. I need to reattach the mean from rep to df </p> <pre><code>for i in range(0,len(rep)): for j in range(k,len(df)): if df["X"][j] == rep["X"][i]: df["Mean"][j] = rep["Mean"][i] else: k=j break </code></pre>
0debug
Linear gradient for background image -JS : i am getting error var sectionStyle = { paddingTop:"2%", width: "100%", height: "100%", backgroundImage: "url(" + Background + ") , linearGradient(#eb01a5, #d13531)" }
0debug
INSERT INTO a table variable in T-SQL with value contains backsplash : I have a query in sql DECLARE @Test nvarchar(max) DECLARE @t as table ( name nvarchar(30) ) INSERT @t (name) VALUES ( '\\ \ \\ \b \c' ) SELECT * from @t Why output of me is > \\ \b \c not same with input . How to resolve this issue
0debug
static void cpu_ppc_hdecr_cb(void *opaque) { PowerPCCPU *cpu = opaque; _cpu_ppc_store_hdecr(cpu, 0x00000000, 0xFFFFFFFF, 1); }
1threat
python function call with/without list comprehension : <p>I have below two functions:</p> <pre><code>def foo(n=50000): return sum(i*i for i in range(n)) # just called sum() directly without def bar(n=50000): return sum([i*i for i in range(n)]) # passed constructed list to sum() </code></pre> <p>I was hoping that <code>foo</code> will run faster then <code>bar</code> but I have checked in ipython with <code>%%timeit</code> that <code>foo</code> is taking slightly longer then <code>bar</code> </p> <pre><code>In [2]: %%timeit ...: foo(50000) ...: 100 loops, best of 3: 4.22 ms per loop In [3]: %%timeit ...: bar(50000) ...: 100 loops, best of 3: 3.45 ms per loop In [4]: %%timeit ...: foo(10000000) ...: 1 loops, best of 3: 1.02 s per loop In [5]: %%timeit ...: bar(10000000) ...: 1 loops, best of 3: 869 ms per loop </code></pre> <p>The difference increases as I increase value of n hence I tried to check function with <code>dis.dis(foo)</code> and <code>dis.dis(bar)</code> but it was identical.</p> <p>So what would be the cause of such time difference between both methods?</p>
0debug
Can C's restrict keyword be emulated using strict aliasing in C++? : <h2>The Problem</h2> <p>The <code>restrict</code> keyword in C is missing in C++, so out of interest I was looking for a way to emulate the same feature in C++. </p> <p>Specifically, I would like the following to be equivalent:</p> <pre><code>// C void func(S *restrict a, S *restrict b) // C++ void func(noalias&lt;S, 1&gt; a, noalias&lt;S, 2&gt; b) </code></pre> <p>where <code>noalias&lt;T, n&gt;</code></p> <ul> <li>behaves just like <code>T*</code> when accessed with <code>-&gt;</code> and <code>*</code></li> <li>can be constructed from an <code>T*</code> (so that the function can be called as <code>func(t1, t2)</code>, where <code>t1</code> and <code>t2</code> are both of type <code>T*</code>)</li> <li>the index <code>n</code> specifies the "aliasing class" of the variable, so that variables of type <code>noalias&lt;T, n&gt;</code> and <code>noalias&lt;T, m&gt;</code> may be assumed never to alias for n != m.</li> </ul> <h2>An Attempt</h2> <p>Here is my deeply flawed solution:</p> <pre><code>template &lt;typename T, int n&gt; class noalias { struct T2 : T {}; T *t; public: noalias(T *t_) : t(t_) {} T2 *operator-&gt;() const {return static_cast&lt;T2*&gt;(t);} // &lt;-- UB }; </code></pre> <p>When accessed with <code>-&gt;</code>, it casts the internally-stored <code>T*</code> to a <code>noalias&lt;T, n&gt;::T2*</code> and returns that instead. Since this is a different type for each <code>n</code>, the strict aliasing rule ensures that they will never alias. Also, since <code>T2</code> derives from <code>T</code>, the returned pointer behaves just like a <code>T*</code>. Great!</p> <p>Even better, the code compiles and the assembly output confirms that it has the desired effect.</p> <p>The problem is the <code>static_cast</code>. If <code>t</code> were really pointing to an object of type <code>T2</code> then this would be fine. But <code>t</code> points to a <code>T</code> so this is UB. In practice, since <code>T2</code> is a subclass which adds nothing extra to <code>T</code> it will probably have the same data layout, and so member accesses on the <code>T2*</code> will look for members at the same offsets as they occur in <code>T</code> and everything will be fine.</p> <p>But having an <code>n</code>-dependent class is necessary for strict aliasing, and that this class derives from <code>T</code> is also necessary so that the pointer can be treated like a <code>T*</code>. So UB seems unavoidable.</p> <h2>Questions</h2> <ul> <li><p>Can this be done in c++14 without invoking UB - possibly using a completely different idea?</p></li> <li><p>If not, then I have heard about a "dot operator" in c++1z; would it be possible with this?</p></li> <li><p>If the above, will something similar to <code>noalias</code> be appearing in the standard library?</p></li> </ul>
0debug
What code does Facebook, Skype, etc. look for to make their thumbnails? : <p>When I post a link in Facebook or Skype, they display some of the content as a thumbnail, but it's not the whole page, usually it's the most representative image. I would like my own pages to have nice thumbnails in Facebook, Skype, etc. too. What code do they look for to do this?</p>
0debug
Converting Ruby Array into a Hash *Must Use a Function* : I am attempting to write a function (method) in Ruby which takes and array as follows: items = ["Aqua", "Blue", "Green", "Red", "Yellow"] I need to write a function that will display the items' indexes as follows: item_to_position={"Aqua"=>0, "Blue"=>1, "Green"=>2, "Red"=>3, "Yellow"=>4} I have already contemplated using "each_with_index" and I've spent hours researching how to do this in a function. my_transform is the name of the function. I should be able to type in my_transform(items)=item_to_position and receive TRUE when executed. Should I begin by saying: items = ["Aqua", "Blue", "Green", "Red", "Yellow"] hash = Hash[*array] def my_transform Any help is appreciated. I have to convert the string to a hash.
0debug
Arduino read data json : can you help me to solve problem? I using the arduino,and my question is how can read and split the data json in arduino. The value is { $sen1:$sen2}
0debug
Adding c # model list : I have a list of the List of Request Types. With the For cycle, I have data from the vertaban. I want to add the dates into detail. There is an error in the code I wrote. All data are listed as the same. > public IHttpActionResult TalepListele(TalepList model) > { > List<TalepList> detay = new List<TalepList>(); > using (var ctx = new ktdbEntities()) > { > var query = ctx.talepListele(model.KullaniciId, 0, 10).ToList(); > var adet = query.Count; > if (query.Count != 0) > { > for (var i = 0; i < adet; i++) > { > model.OlusturmaTarihi = query[i].olusturulmaTarihi; > model.TalepDurumAdi = query[i].talepDurumuAdi; > model.TalepDurumId = query[i].talepTuruID; > model.TalepTuruAdi = query[i].talepTuruAdi; > model.TalepTuruId = query[i].talepTuruID; > model.talepID = query[i].talepID; > detay.Add(model); > } > return Ok(detay); > } > } > return Ok(); > }
0debug
xCode 9 - iOS 11: NSURLConnection - sendAsynchronousRequest fails : <p>I just downloaded the latest version of xCode (9.0 beta (9M136h)).</p> <p>However, when I try to make a request to my server in iOS 11 simulator (Using NSURLConnection sendAsynchronousRequest), an error is received:</p> <p>NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9807) NSURLConnection finished with error - code -1202</p> <p>NSError object contains the message - @"NSLocalizedDescription" : @"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “***” which could put your confidential information at risk." </p> <p>The plist contains:</p> <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt; &lt;dict&gt; &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; </code></pre> <p>so it is not the problem in this case (I guess)</p> <p>Needless to say that it is working in iOS 10/9/8</p> <p>Any suggestions?</p> <p>Thanks in advance!</p>
0debug
'CGAffineTransformIdentity' is unavailable in Swift : <p>Came across this error when trying to do adapt some animations into Swift3 syntax. </p> <pre><code> UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.8, options: [] , animations: { fromView.transform = offScreenLeft toView.transform = CGAffineTransformIdentity }, completion: { finished in transitionContext.completeTransition(true) }) </code></pre> <p>and got this: </p> <blockquote> <p>'CGAffineTransformIdentity' is unavailable in Swift </p> </blockquote>
0debug
json multiple arrays decode : <p>I have the following code:</p> <pre><code>$json = ' { "HTML": [ { "id": 1, "name": "HTML", "match": false }, { "id": 2, "name": "HTML 5", "match": false }, { "id": 3, "name": "XHTML", "match": false } ] }'; $obj = json_decode($json); $obj[0][0]-&gt;name; // JavaScript: The Definitive Guide </code></pre> <p>Why do I get the following error? </p> <blockquote> <p>use object of type stdClass as array</p> </blockquote> <p>I decode the json correctly, than I say that I want to pick the first object from the array (in this case HTML) and than I want to pick the name of the first one in the array.</p> <p>What is going wrong?</p>
0debug
What C++ standard has better of COM? : <p>I have see such answer:</p> <blockquote> <p>COM is a technique of it's own. It fulfills some special needs but violates a lot of good engineering principles. E.g solid. The standard has better ways than using COM. – mkaes</p> </blockquote> <p>Very interesting to know what is that "better ways"?</p> <p>We use in our project IUnknown base class, but not COM technology itself. IUnknown allows us:</p> <ol> <li>have nice specified interface abstract classes;</li> <li>use its add()/release() as basis for intrusive smart ptrs;</li> <li>use mechanism of QueryInterface() to be more effective than dynamic_cast;</li> </ol> <p>Okay, exists boost::intrusive_ptr but it is not in the standard so far. And even if it was there, this will be separate class to solve task of intrusive smart ptr. Assuming it is there, yes I could do something as</p> <pre><code>interface ITable : intrusive_ptr {} interface IField : intrusive_ptr {} </code></pre> <p>But what about QueryInterface() mechanism?</p> <p>P.S. This question is NOT about COM at all.</p>
0debug
static int asf_read_payload(AVFormatContext *s, AVPacket *pkt) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; int ret, i; ASFPacket *asf_pkt = NULL; if (!asf->sub_left) { uint32_t off_len, media_len; uint8_t stream_num; stream_num = avio_r8(pb); asf->stream_index = stream_num & ASF_STREAM_NUM; for (i = 0; i < asf->nb_streams; i++) { if (asf->stream_index == asf->asf_st[i]->stream_index) { asf_pkt = &asf->asf_st[i]->pkt; asf_pkt->stream_index = asf->asf_st[i]->index; break; } } if (!asf_pkt) return AVERROR_INVALIDDATA; if (stream_num >> 7) asf_pkt->flags |= AV_PKT_FLAG_KEY; READ_LEN(asf->prop_flags & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE, ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_, media_len); READ_LEN(asf->prop_flags & ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE, ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_, off_len); READ_LEN(asf->prop_flags & ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE, ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_, asf->rep_data_len); if (asf_pkt->size_left && (asf_pkt->frame_num != media_len)) { av_log(s, AV_LOG_WARNING, "Unfinished frame will be ignored\n"); reset_packet(asf_pkt); } asf_pkt->frame_num = media_len; asf->sub_dts = off_len; if (asf->nb_mult_left) { if ((ret = asf_read_multiple_payload(s, pkt, asf_pkt)) < 0) return ret; } else if (asf->rep_data_len == 1) { asf->sub_left = 1; asf->state = READ_SINGLE; pkt->flags = asf_pkt->flags; if ((ret = asf_read_subpayload(s, pkt, 1)) < 0) return ret; } else { if ((ret = asf_read_single_payload(s, pkt, asf_pkt)) < 0) return ret; } } else { for (i = 0; i <= asf->nb_streams; i++) { if (asf->stream_index == asf->asf_st[i]->stream_index) { asf_pkt = &asf->asf_st[i]->pkt; break; } } if (!asf_pkt) return AVERROR_INVALIDDATA; pkt->flags = asf_pkt->flags; pkt->dts = asf_pkt->dts; pkt->stream_index = asf->asf_st[i]->index; if ((ret = asf_read_subpayload(s, pkt, 0)) < 0) return ret; } return 0; }
1threat
android: data binding error: cannot find symbol class : <p>I am getting started for using <code>DataBinding</code> feature. I am facing problem with it.</p> <blockquote> <p>Error:(21, 9) error: cannot find symbol class ContactListActivityBinding</p> </blockquote> <p><strong>build.gradle(Module: app)</strong></p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.letsnurture.ln_202.databindingdemo" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dataBinding { enabled = true } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' } </code></pre> <p><strong>ContactListActivity.java</strong></p> <pre><code>import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import com.letsnurture.ln_202.databindingdemo.model.Contact; public class ContactListActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ContactListActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_list); Contact user = new Contact("Chintan Soni", "+91 9876543210"); binding.setContact(user); // setContentView(R.layout.activity_contact_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_contact_list, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } </code></pre> <p><strong>content_contact_list.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.letsnurture.ln_202.databindingdemo.ContactListActivity" tools:showIn="@layout/activity_contact_list"&gt; &lt;data&gt; &lt;variable name="user" type="com.letsnurture.ln_202.databindingdemo.model.Contact" /&gt; &lt;/data&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="@dimen/activity_horizontal_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{user.contactName}" tools:text="Name" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{user.contactNumber}" tools:text="Number" /&gt; &lt;/LinearLayout&gt; &lt;/layout&gt; </code></pre> <p><strong>activity_contact_list.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.letsnurture.ln_202.databindingdemo.ContactListActivity"&gt; &lt;android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"&gt; &lt;android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /&gt; &lt;/android.support.design.widget.AppBarLayout&gt; &lt;include layout="@layout/content_contact_list" /&gt; &lt;android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /&gt; &lt;/android.support.design.widget.CoordinatorLayout&gt; </code></pre>
0debug
static void ccw_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); mc->name = "s390-ccw-virtio"; mc->alias = "s390-ccw"; mc->desc = "VirtIO-ccw based S390 machine"; mc->init = ccw_init; mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; mc->no_floppy = 1; mc->no_serial = 1; mc->no_parallel = 1; mc->no_sdcard = 1; mc->use_sclp = 1; mc->max_cpus = 255; mc->is_default = 1; nc->nmi_monitor_handler = s390_nmi; }
1threat
how extract data from json in php : <p>how to extract from json </p> <pre><code>{"aaData":[["Hitech Institute","0shoaib0@gmail.com","8149587579","2016-02-04 16:55:37","5"],["Hitech Institute","0shoaib0@gmail.com","8149587579","2016-02-04 16:55:38","6"],["Hitech Institute","0shoaib0@gmail.com","8149587579","2016-02-04 16:55:40","9"],["fdsf","fds","654545","2016-02-08 13:52:40","12"],["fsdf","fsdfsdfds","546","2016-02-08 13:53:51","13"],["hjgh","hg","3123123","2016-02-08 14:35:31","14"]]} foreach($data-&gt;aaData as $row) { echo $row-&gt;aaData[1]; } </code></pre> <p>Its not working please Help me someone</p>
0debug
trying to get user input value to use in a variable JavaScript : im pretty new to this and im pretty new to using JS. im working through the basics and really getting in to it. however i am having an issue with trying to use a users input to help me in other areas.. i have a little CSS to create an input id="cars" and a button id="submit" i want to use those inputs in a switch statement.. this is what i have so far, i will add more to my switch statement once i have managed to get the input value to work... <h1>What is your car?</h1> <input id="cars" type="text"></input> <button id="submit">Submit</button> <script type="text/javascript"> var clickedCar = document.getElementById("cars").value switch(clickedCar){ case "Honda": document.write("Honda are nice cars to drive"); break; }
0debug
int kvm_cpu_exec(CPUState *env) { struct kvm_run *run = env->kvm_run; int ret; DPRINTF("kvm_cpu_exec()\n"); if (kvm_arch_process_irqchip_events(env)) { env->exit_request = 0; env->exception_index = EXCP_HLT; return 0; } do { if (env->kvm_vcpu_dirty) { kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE); env->kvm_vcpu_dirty = 0; } kvm_arch_pre_run(env, run); if (env->exit_request) { DPRINTF("interrupt exit requested\n"); qemu_cpu_kick_self(); } cpu_single_env = NULL; qemu_mutex_unlock_iothread(); ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); qemu_mutex_lock_iothread(); cpu_single_env = env; kvm_arch_post_run(env, run); kvm_flush_coalesced_mmio_buffer(); if (ret == -EINTR || ret == -EAGAIN) { cpu_exit(env); DPRINTF("io window exit\n"); ret = 0; break; } if (ret < 0) { DPRINTF("kvm run failed %s\n", strerror(-ret)); abort(); } ret = 0; switch (run->exit_reason) { case KVM_EXIT_IO: DPRINTF("handle_io\n"); kvm_handle_io(run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); ret = 1; break; case KVM_EXIT_MMIO: DPRINTF("handle_mmio\n"); cpu_physical_memory_rw(run->mmio.phys_addr, run->mmio.data, run->mmio.len, run->mmio.is_write); ret = 1; break; case KVM_EXIT_IRQ_WINDOW_OPEN: DPRINTF("irq_window_open\n"); break; case KVM_EXIT_SHUTDOWN: DPRINTF("shutdown\n"); qemu_system_reset_request(); ret = 1; break; case KVM_EXIT_UNKNOWN: fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", (uint64_t)run->hw.hardware_exit_reason); ret = -1; break; #ifdef KVM_CAP_INTERNAL_ERROR_DATA case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; #endif case KVM_EXIT_DEBUG: DPRINTF("kvm_exit_debug\n"); #ifdef KVM_CAP_SET_GUEST_DEBUG if (kvm_arch_debug(&run->debug.arch)) { env->exception_index = EXCP_DEBUG; return 0; } ret = 1; #endif break; default: DPRINTF("kvm_arch_handle_exit\n"); ret = kvm_arch_handle_exit(env, run); break; } } while (ret > 0); if (ret < 0) { cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); vm_stop(0); env->exit_request = 1; } if (env->exit_request) { env->exit_request = 0; env->exception_index = EXCP_INTERRUPT; } return ret; }
1threat
static inline void gen_op_mfspr (DisasContext *ctx) { void (*read_cb)(void *opaque, int sprn); uint32_t sprn = SPR(ctx->opcode); #if !defined(CONFIG_USER_ONLY) if (ctx->supervisor) read_cb = ctx->spr_cb[sprn].oea_read; else #endif read_cb = ctx->spr_cb[sprn].uea_read; if (likely(read_cb != NULL)) { if (likely(read_cb != SPR_NOACCESS)) { (*read_cb)(ctx, sprn); gen_op_store_T0_gpr(rD(ctx->opcode)); } else { if (loglevel != 0) { fprintf(logfile, "Trying to read privileged spr %d %03x\n", sprn, sprn); } printf("Trying to read privileged spr %d %03x\n", sprn, sprn); RET_PRIVREG(ctx); } } else { if (loglevel != 0) { fprintf(logfile, "Trying to read invalid spr %d %03x\n", sprn, sprn); } printf("Trying to read invalid spr %d %03x\n", sprn, sprn); RET_EXCP(ctx, EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_SPR); } }
1threat
build conda package from local python package : <p>I can't find a complete example of how to create a conda package from a python package that I wrote and also how to install the package using conda install, while it is on my computer and not on anaconda cloud. I'm looking for example that not using conda skeleton from pypi, but using a python package on my windows machine, the source code must be on my windows machine and not on pypi or other cloud. any help would be mostly appriciate. thanks very much</p>
0debug
static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVVmdkState *s = bs->opaque; int64_t index_in_cluster, n, ret; uint64_t offset; VmdkExtent *extent; extent = find_extent(s, sector_num, NULL); if (!extent) { return 0; } ret = get_cluster_offset(bs, extent, NULL, sector_num * 512, 0, &offset); ret = !ret; index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } *pnum = n; return ret; }
1threat
Conventions for app.js, index.js, and server.js in node.js? : <p>In node.js, it seems I run into the same 3 filenames to describe the main entry point to an app:</p> <ul> <li>When using the <code>express-generator</code> package, an <strong><code>app.js</code></strong> file is created as the main entry point for the resulting app.</li> <li>When creating a new <code>package.json</code> file via <code>npm init</code>, one is prompted for the main entry point file. The default is given as <strong><code>index.js</code></strong>.</li> <li>In some programs I have seen, <strong><code>server.js</code></strong> serves as the main entry point as well.</li> </ul> <p>Other times, still, it seems as though there are subtle differences in their usage. For example, this node app directory structure uses <code>index.js</code> and <code>server.js</code> in different contexts:</p> <pre><code>app |- modules | |- moduleA | | |- controllers | | | |- controllerA.js | | | +- controllerB.js | | |- services | | | +- someService.js | | +- index.js &lt;-------------- | +- index.js &lt;------------------- |- middleware.js +- index.js &lt;------------------------ config +- index.js &lt;------------------------ web |- css |- js server.js &lt;---------------------------- </code></pre> <p>What are the differences, if any, between these three names?</p>
0debug
regex to match string value and replace all occurrences in golang : <p>what would be the regex to match string </p> <pre><code>"{{media url=\"wysiwyg/Out_story.png\"}} </code></pre> <p>or </p> <pre><code>"{{skin url=\"wysiwyg/Out_story.png\"}} </code></pre> <p>in Golang</p> <p>I need to replace every instance of these, there could be any number of them and replace it with</p> <p><code>https://img.abc.com/xyz/valueOfURL</code> from above</p>
0debug
UWP: Alternative to Grid.IsSharedSizeScope and SharedSizeGroup : <p>I got the same issue as described in the following, old, forum post: <a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/66de600a-a409-44bc-945b-96a895edbe38/list-view-item-template-alignment?forum=wpf">Issue on MSDN</a><br> However, for some reason Microsoft decided to remove the functionalities in the answer described there.</p> <p>What I'm looking for is a ListView with 2+ columns, with the first column containing random data (thus random width elements), making the width of the first column the same as the widest element inside.</p>
0debug
void ppc_store_sdr1 (CPUPPCState *env, target_ulong value) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value); if (env->sdr1 != value) { env->sdr1 = value; tlb_flush(env, 1); } }
1threat
static int io_channel_send_full(QIOChannel *ioc, const void *buf, size_t len, int *fds, size_t nfds) { size_t offset = 0; while (offset < len) { ssize_t ret = 0; struct iovec iov = { .iov_base = (char *)buf + offset, .iov_len = len - offset }; ret = qio_channel_writev_full( ioc, &iov, 1, fds, nfds, NULL); if (ret == QIO_CHANNEL_ERR_BLOCK) { errno = EAGAIN; return -1; } else if (ret < 0) { if (offset) { return offset; } errno = EINVAL; return -1; } offset += ret; } return offset; }
1threat
When the Web HTML interpreter read the code under the script tag? : <p>I have a script inserted on the head of the page like this</p> <pre><code>&lt;head&gt; ... load jQuery .... &lt;script&gt;var bbody = $('body');&lt;/script&gt; &lt;/head&gt; &lt;body&gt; .... &lt;script&gt;console.log(bbody);&lt;/script&gt; &lt;script&gt;console.log($('body'));&lt;/script&gt; &lt;/body&gt; </code></pre> <p>And always the result of the console.log in the first sentence it's <code>undefined</code>, but the second it's the correct object, So my question is: </p> <ol> <li>¿Always the code on the <code>&lt;script&gt;</code> is executed at the moment on the interpreter read the code inside in?</li> </ol>
0debug
mlt_compensate_output(COOKContext *q, float *decode_buffer, cook_gains *gains, float *previous_buffer, int16_t *out, int chan) { int j; cook_imlt(q, decode_buffer, q->mono_mdct_output); gain_compensate(q, gains, previous_buffer); for (j = 0; j < q->samples_per_channel; j++) { out[chan + q->nb_channels * j] = av_clip(lrintf(q->mono_mdct_output[j]), -32768, 32767); } }
1threat
static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { ChannelState *s = (ChannelState *)dev; int qcode, keycode; InputKeyEvent *key; assert(evt->type == INPUT_EVENT_KIND_KEY); key = evt->u.key; qcode = qemu_input_key_value_to_qcode(key->key); trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode], key->down); if (qcode == Q_KEY_CODE_CAPS_LOCK) { if (key->down) { s->caps_lock_mode ^= 1; if (s->caps_lock_mode == 2) { return; } } else { s->caps_lock_mode ^= 2; if (s->caps_lock_mode == 3) { return; } } } if (qcode == Q_KEY_CODE_NUM_LOCK) { if (key->down) { s->num_lock_mode ^= 1; if (s->num_lock_mode == 2) { return; } } else { s->num_lock_mode ^= 2; if (s->num_lock_mode == 3) { return; } } } keycode = qcode_to_keycode[qcode]; if (!key->down) { keycode |= 0x80; } trace_escc_sunkbd_event_out(keycode); put_queue(s, keycode); }
1threat
How To Put Values Dynamicly : Hi All I am Trying To Add Comments At Below Post As Like (Posted By : Some Name From My Text Box)And In Next Line (Comment: )Again In Next Line Print That Textarea's Value Below Of That Post So Please My Trying Code Is Here Please Let me Know Any Mistakes in My Code . Please Help Me Anybody Expert In This Type Of Functionality . Thanks In Advanced . <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var cnt; var name; $(document).ready(function(){ $('#comment').click(function(){ $('#form1').html("<div class=\"form-group\" ><input type=\"text\" class=\"form-control\" placeholder=\"Please Enter Your Name Or Email\" id=\"namefield\"/> <textarea class=\"form-control\" placeholder=\"Leave A Comment Here\" style=\"width:100%; height:150px;\" id=\"coment-txt\" required></textarea></div><button class=\"btn btn-success\" id=\"post\">Post</button>"); $('#post').click(function(){ cnt = $('#coment-txt').val(); name = $('#namefield').val(); alert('Posted by '+name+'\n'+' Comment : '+'\n'+cnt); }); }); $('#newcoment').html('Posted by '+name+'\n'+' Comment : '+'\n'+cnt); }); <!-- language: lang-css --> /* Set height of the grid so .sidenav can be 100% (adjust if needed) */ .row.content {height: 1500px} /* Set gray background color and 100% height */ .sidenav { background-color: #f1f1f1; height: 100%; } /* Set black background color, white text and some padding */ footer { background-color: #555; color: white; padding: 15px; } .text-justify{ text-align:justify; } .cursor{cursor:pointer;} /* On small screens, set height to 'auto' for sidenav and grid */ @media screen and (max-width: 767px) { .sidenav { height: auto; padding: 15px; } .row.content {height: auto;} } <!-- language: lang-html --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div class="container-fluid"> <div class="row content"> <div class="col-sm-3 sidenav"> <h4>Samudrala's Blog</h4> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#section1">Home</a></li> <li><a href="#section2">Friends</a></li> <li><a href="#section3">Family</a></li> <li><a href="#section3">Photos</a></li> <li><a href="#section3">Likes</a></li> <li><a href="#section3">DisLikes</a></li> </ul><br> <div class="input-group"> <input type="text" class="form-control" placeholder="Search Blog.."> <span class="input-group-btn"> <button class="btn btn-default" type="button"> <span class="glyphicon glyphicon-search"></span> </button> </span> </div> </div> <div class="col-sm-9 sidenav" style="background:#337ab7; color:#fff;"> <h4>RECENT POSTS</h4> <hr> <h2>I Like Updated Technologies</h2> <h5><span class="glyphicon glyphicon-time"></span> Post by Samudrala, Oct 21, 2016.</h5> <h5><span class="label label-danger">Updated Technologies</span> <span class="label label-primary">Samudrala</span></h5><br> <p class="text-justify">Nowadays technology has brought a lot of changes to our life, especially in education and communication. In communication, the major changes happen in the way we communicate with other people. We do not need to meet them in person or face to face to say what is in our mind. We simply can phone them or do video chat using Internet connection. In the past, we spent a long time to travel to a distant place, but now we just need hours or even minutes to go there using the latest technology in a form of transportation means. In education, the changes have brought advantages to students and teachers. For instance, students can do their homework or assignment faster because using Internet. The teachers also get some advantages from it. They can combine their teaching skill with it and produce some interesting materials to teach like colorful slides to deliver the lesson and animation to show how things happen. In conclusion, technology itself has given us advantages to improve our life's quality. </p> <p id="newcoment"></p> <br><br> <h4>Leave a Comment : <span class="label label-success cursor" id="comment">Comments</span></h4> <br/> <form role="form" id="form1"> </form> </div> </div> </div> <footer class="container-fluid"> <p>Footer Text</p> </footer> <!-- end snippet -->
0debug
static int find_partition(BlockDriverState *bs, int partition, off_t *offset, off_t *size) { struct partition_record mbr[4]; uint8_t data[512]; int i; int ext_partnum = 4; int ret; if ((ret = bdrv_read(bs, 0, data, 1)) < 0) { errno = -ret; err(EXIT_FAILURE, "error while reading"); } if (data[510] != 0x55 || data[511] != 0xaa) { errno = -EINVAL; return -1; } for (i = 0; i < 4; i++) { read_partition(&data[446 + 16 * i], &mbr[i]); if (!mbr[i].nb_sectors_abs) continue; if (mbr[i].system == 0xF || mbr[i].system == 0x5) { struct partition_record ext[4]; uint8_t data1[512]; int j; if ((ret = bdrv_read(bs, mbr[i].start_sector_abs, data1, 1)) < 0) { errno = -ret; err(EXIT_FAILURE, "error while reading"); } for (j = 0; j < 4; j++) { read_partition(&data1[446 + 16 * j], &ext[j]); if (!ext[j].nb_sectors_abs) continue; if ((ext_partnum + j + 1) == partition) { *offset = (uint64_t)ext[j].start_sector_abs << 9; *size = (uint64_t)ext[j].nb_sectors_abs << 9; return 0; } } ext_partnum += 4; } else if ((i + 1) == partition) { *offset = (uint64_t)mbr[i].start_sector_abs << 9; *size = (uint64_t)mbr[i].nb_sectors_abs << 9; return 0; } } errno = -ENOENT; return -1; }
1threat
can this [0] mean the whole list?? PYTHON : N1 = ["Ryan", "Remariz", "Christian" , "Rmefer", "Colomn" ] for names in N1: if names[0] == "C": print("* " + names) The outome will be: * Christian * Colomn but Im asking because im a beginner and i would like to know if that [0] ment the whole list, becuase i've been trying [2] but it just wouldnt print. no error, and nothing in the output. It took me 15 minutes to figure it out. i know it's a piece of cake to most people but i just started to bare with me. Cheers -Jassim
0debug
generates all tuples (x, y) in a range : <p>I'd like to know what is the pythonic way to generate all tuples (x, y) where x and y are integers in a certain range. I need it to generate n points and I don't want to take the same point two or more times.</p>
0debug
why multiple variable assignment in python terminal throwing syntax error? : <p>I am using python terminal and I am trying to do instantiate multiple variable at once . It throws me an error. The code works fine in an IDE . Can someone helps me understand this behaviour.</p> <pre><code>&gt;&gt;&gt; var1 =10 \ ... var21 = 20 \ File "&lt;stdin&gt;", line 2 var21 = 20 \ ^ SyntaxError: invalid syntax </code></pre>
0debug
static inline void decode_residual_inter(AVSContext *h) { int block; h->cbp = cbp_tab[get_ue_golomb(&h->s.gb)][1]; if(h->cbp && !h->qp_fixed) h->qp += get_se_golomb(&h->s.gb); for(block=0;block<4;block++) if(h->cbp & (1<<block)) decode_residual_block(h,&h->s.gb,inter_2dvlc,0,h->qp, h->cy + h->luma_scan[block], h->l_stride); decode_residual_chroma(h); }
1threat
Is it possible to use dependencies without module-info.class in a Java 9 module : <p>I created two small projects <em>de.app1</em> and <em>de.app2</em>, where <code>App</code> from <em>de.app1</em> uses <code>Test</code> from <em>de.app2</em>.</p> <pre><code>├── de.app1 │   ├── de │   │   └── app │   │   └── App.java │   └── module-info.java └── de.app2 └── de    └── test    └── Test.java </code></pre> <p><em>module-info.java</em> in the first project just contains <code>module de.app1 {}</code></p> <p>I compiled the second project and created a jar file:</p> <pre><code>javac de/test/Test.java jar cf app2.jar de/test/Test.class </code></pre> <p>and then tried to compile the first project like this:</p> <pre><code>javac -cp ../de.app2/app2.jar de/app/App.java module-info.java </code></pre> <p>which failed because <code>Test</code> could not be found. When I compile the project without <em>module-info.java</em>, everything is working as usual.</p> <p>Is it somehow possible to use classes from a jar that is not a Java 9 module <em>within</em> a Java 9 module? Especially for projects that depend on 3rd-party projects (e.g. apache-commons,...), I think something like this would be required.</p>
0debug
Why is it not allowed to declare empty expression body for methods? : <p>I had a method which has an empty body like this:</p> <pre><code>public void Foo() { } </code></pre> <p>As suggested by <code>ReSharper</code> I wanted to convert it to expression body to save some space and it became:</p> <pre><code>public void Foo() =&gt; ; </code></pre> <p>Which doesn't compile. Is there a specific reason why this is not supported ? </p> <p>And I think I should open a bug ticket for <code>ReSharper</code> since it refactors code to a non-compilable version.</p>
0debug
Basic hangman code-problem with changing the word after right answer : <p>My code does not work properly. All I want is to make the word appear properly without any additional messages. What am I doing wrong? For simplicity, I just put one word ('weekend') so that I can easily check my code's mistakes every time I run it.</p> <pre><code>def hangman(): j=0 word='weekend' new_word=len(word)*'_ ' while j&lt;20: letter=input('Give a letter: ') for i in range(len(word)): if word[i]==letter and new_word[i]=='_': new_word=new_word.replace(new_word[i],letter) if new_word.replace(' ','')==word: print('You won!') break j+=1 print(new_word) hangman() </code></pre>
0debug
static void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture) { uint8_t *ptr; int offset, src_x, src_y, linesize, uvlinesize; int motion_x, motion_y; int emu=0; motion_x= s->sprite_offset[0][0]; motion_y= s->sprite_offset[0][1]; src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) motion_x =0; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) motion_y =0; linesize = s->linesize; uvlinesize = s->uvlinesize; ptr = ref_picture[0] + (src_y * linesize) + src_x; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } if((motion_x|motion_y)&7){ s->dsp.gmc1(dest_y , ptr , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding); }else{ int dxy; dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2); if (s->no_rounding){ s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); }else{ s->hdsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16); } } if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return; motion_x= s->sprite_offset[1][0]; motion_y= s->sprite_offset[1][1]; src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1)); src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1)); motion_x<<=(3-s->sprite_warping_accuracy); motion_y<<=(3-s->sprite_warping_accuracy); src_x = av_clip(src_x, -8, s->width>>1); if (src_x == s->width>>1) motion_x =0; src_y = av_clip(src_y, -8, s->height>>1); if (src_y == s->height>>1) motion_y =0; offset = (src_y * uvlinesize) + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0) || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } } s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); ptr = ref_picture[2] + offset; if(emu){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); return; }
1threat
I believe I am getting confused with the pointers in my program. : Below I created a function that enters a while loop. In the while loop an if statement is called to traverse the list and check the numbers to see which one is the largest and which one is the smallest. When I run the program only one `printf()` is called, and prints the same `printf()` more than once. It seems to pick two numbers and print them under the same `printf()` function.I know that `firstNumber = firstNumber->next;` is supposed to traverse the list. Isn't `secondNumber = secondNumber->next->next;` supposed to point to the next number in the list? typedef struct A_NewNumber { struct A_NewNumber *next; double newNum; } NewNumber; void NumberSize(NewNumber *start){ NewNumber *firstNumber = start; NewNumber *secondNumber = start; if(start != NULL){ while (secondNumber != NULL && secondNumber->next != NULL){ secondNumber = secondNumber->next->next; firstNumber = firstNumber->next; if(secondNumber > firstNumber){ printf("The biggest number is:%lf \n",secondNumber->newNum); }else{ printf("The smallest number is:%lf \n",firstNumber->newNum); } firstNumber = firstNumber->next; } } }
0debug
How to only allow number as input? - Python : <p>I want to make a simple Python IP Tracker with IP Format only, but i'm confused cause i can't filter the input. This is my code:</p> <pre><code>while True: ip= raw_input("What Your Target IP : ") url = "http://blabla.com/json/" response = urllib2.urlopen(url + ip) data = response.read() values = json.loads(data) print("------------------------------------") print "\r" print(" IP: " + values['query']) print(" City: " + values['city']) print(" Region: " + values['regionName']) print(" Country: " + values['country']) print(" Time Zone: " + values['timezone']) print "\r" break </code></pre>
0debug
As ViewModelProviders.of() is deprecated, How should i create object of ViewModel? : <p>I have been trying to create an Object of ViewModel in an Activity but ViewModelProviders is deprecated So what's the alternative to create the ViewModel's object.</p>
0debug
sum value and remove duplicates in List<> : <p>I want to check the duplicate values in the list and bring the prices together.</p> <p>Follow the example below.</p> <p>ex.</p> <pre><code>var list = new List&lt;Item&gt;(); list.Add(new Item() { code= "521523", text= "cookie", price= 5}); list.Add(new Item() { code= "521523", text= "donut", price= 20 }); list.Add(new Item() { code= "521524", text= "coffee", price= 15 }); list.Add(new Item() { code= "521524", text= "water", price= 16 }); list.Add(new Item() { code= "521525", text= "other", price= 16 }); </code></pre> <p>result</p> <pre><code>code= "521523", text= "cookie", price= 25 code= "521524", text= "coffee", price= 31 code= "521525", text= "other", price= 16 </code></pre>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
Why is everything in python language an object if python is written in C? : <p>It is said: "Everything in python is an object." But python is written in C and C is not an object-oriented programming language. I am aware that C has the capabilty to implement some object-oriented concepts, but shouldn't it be called a struct or somethin instead of object?</p> <p>Please clear up this mystery for me. Thank you.</p>
0debug
Why Microsoft Access? : <p>I am going to school for Database Administration and Design. There I learn SQL Server, SSRS, SSIS and SSAS and some other technologies. My question is: Is there any real value in learning MS Access for designing databases, especially when I can spend same amount of time on SQL Server and get better at it? Is MS Access still relevant in the job market? </p> <p>Cheers, </p>
0debug
Convert a list of string into a vector : <p>Given:</p> <p><code>['1 -1 1 1 1 1 1 1 1']</code></p> <p>How can I convert it (efficiently) to be a vector of integers something like:</p> <p><code>[1 -1 1 1 1 1 1 1 1]</code></p> <p>Thank you.</p>
0debug
How can I set the UIColor of a UIBezierPath in Swift? : <p>Let's say I have something like this in Objective-C</p> <pre><code> - (void)drawRect:(CGRect)rect { if (1 &lt; [_points count]) { UIBezierPath *path = [UIBezierPath bezierPath]; [path setLineWidth:3.]; MyPoint *point = _points[0]; [path moveToPoint:point.where]; NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; for (int i = 1; i &lt; (int)_points.count; ++i) { point = _points[i]; [path addLineToPoint:point.where]; float alpha = 1; if (1 &lt; now - point.when) { alpha = 1 - MIN(1, now - (1+point.when)); } [[UIColor colorWithWhite:0 alpha:alpha] set]; //THIS LINE [path stroke]; path = [UIBezierPath bezierPath]; [path setLineWidth:3.]; [path moveToPoint:point.where]; } } } </code></pre> <p>How would I do the following line <code>[[UIColor colorWithWhite:0 alpha:alpha] set];</code> in Swift?</p>
0debug
NSLog on devices in iOS 10 / Xcode 8 seems to truncate? Why? : <p>Why the console output shows incomplete in Xcode 8 / iOS 10?</p> <p><a href="https://i.stack.imgur.com/2s0Uj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2s0Uj.png" alt="enter image description here"></a></p>
0debug
R pass-by-value or pass-by-reference : <p>if i create a function in R, for example:</p> <pre><code>f&lt;-function(x){ x ..... } </code></pre> <p>when execute function R use pass-by-value or pass-by-reference</p>
0debug
JS Find JSON strings in string : Not a repeat The answer to the question Find JSON strings in a string meets my needs perfectly in regex101 but when I implement it in JavaScript I get an error that says invalid character in regular expression after (? Can anyone suggest a modification to that regex?
0debug
Why am i getting empty result when i apply a condition to skip array value whose key is even number : Am trying to print an array value at random which worked fine. but when i apply a condition to skip array whose keys are odd (not even) i sometime get a result that display nothing, dunno why. please need help. Here is the code: var arr = [0,1,2,3,4,5]; var rand = Math.floor(Math.random() * arr.length) if(rand % 2 !== 0) console.log(arr[rand]);
0debug
Java Class does nothing : <p>I want to print an 2 dimensional double Array to the console.</p> <pre><code> public class arrayprinter { public static void main(String[] args) { double[][] multi = new double[][]{ { 10, 20, 30, 40, 50}, { 1.1, 2.2, 3.3, 4.4}, { 1.2, 3.2}, { 1, 2, 3, 4, 5, 6, 7, 8, 9} }; print(multi); } private static void print(double[][] e){ for(int i=0; i&gt;e.length;i++) { print(e[i]); } } public static void print(double[] e) { for(int i=0; i&gt;e.length;i++) { System.out.print(e[i]); } } } </code></pre> <p>When i click the play button in eclipse there is only: <code>&lt;terminated&gt;...</code>and no printed array in the console. Can someone say me what I am doing wrong?</p>
0debug
static void v9fs_mkdir(void *opaque) { V9fsPDU *pdu = opaque; size_t offset = 7; int32_t fid; struct stat stbuf; V9fsQID qid; V9fsString name; V9fsFidState *fidp; gid_t gid; int mode; int err = 0; pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &mode, &gid); trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, mode, gid); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_mkdir(pdu, fidp, &name, mode, fidp->uid, gid, &stbuf); if (err < 0) { goto out; } stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Q", &qid); err = offset; trace_v9fs_mkdir_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, err); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); }
1threat
qcrypto_block_luks_load_key(QCryptoBlock *block, QCryptoBlockLUKSKeySlot *slot, const char *password, QCryptoCipherAlgorithm cipheralg, QCryptoCipherMode ciphermode, QCryptoHashAlgorithm hash, QCryptoIVGenAlgorithm ivalg, QCryptoCipherAlgorithm ivcipheralg, QCryptoHashAlgorithm ivhash, uint8_t *masterkey, size_t masterkeylen, QCryptoBlockReadFunc readfunc, void *opaque, Error **errp) { QCryptoBlockLUKS *luks = block->opaque; uint8_t *splitkey; size_t splitkeylen; uint8_t *possiblekey; int ret = -1; ssize_t rv; QCryptoCipher *cipher = NULL; uint8_t keydigest[QCRYPTO_BLOCK_LUKS_DIGEST_LEN]; QCryptoIVGen *ivgen = NULL; size_t niv; if (slot->active != QCRYPTO_BLOCK_LUKS_KEY_SLOT_ENABLED) { return 0; } splitkeylen = masterkeylen * slot->stripes; splitkey = g_new0(uint8_t, splitkeylen); possiblekey = g_new0(uint8_t, masterkeylen); if (qcrypto_pbkdf2(hash, (const uint8_t *)password, strlen(password), slot->salt, QCRYPTO_BLOCK_LUKS_SALT_LEN, slot->iterations, possiblekey, masterkeylen, errp) < 0) { goto cleanup; } rv = readfunc(block, slot->key_offset * QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, splitkey, splitkeylen, errp, opaque); if (rv < 0) { goto cleanup; } cipher = qcrypto_cipher_new(cipheralg, ciphermode, possiblekey, masterkeylen, errp); if (!cipher) { goto cleanup; } niv = qcrypto_cipher_get_iv_len(cipheralg, ciphermode); ivgen = qcrypto_ivgen_new(ivalg, ivcipheralg, ivhash, possiblekey, masterkeylen, errp); if (!ivgen) { goto cleanup; } if (qcrypto_block_decrypt_helper(cipher, niv, ivgen, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE, 0, splitkey, splitkeylen, errp) < 0) { goto cleanup; } if (qcrypto_afsplit_decode(hash, masterkeylen, slot->stripes, splitkey, masterkey, errp) < 0) { goto cleanup; } if (qcrypto_pbkdf2(hash, masterkey, masterkeylen, luks->header.master_key_salt, QCRYPTO_BLOCK_LUKS_SALT_LEN, luks->header.master_key_iterations, keydigest, G_N_ELEMENTS(keydigest), errp) < 0) { goto cleanup; } if (memcmp(keydigest, luks->header.master_key_digest, QCRYPTO_BLOCK_LUKS_DIGEST_LEN) == 0) { ret = 1; goto cleanup; } ret = 0; cleanup: qcrypto_ivgen_free(ivgen); qcrypto_cipher_free(cipher); g_free(splitkey); g_free(possiblekey); return ret; }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
How to add custom item in android Theme declaration? : <p>I'm having few custom themes in my styles.xml <br> Now whenever the activity takes the theme, it uses the <strong>colorPrimary</strong>, <strong>colorPrimaryDark</strong> and <strong>colorAccent</strong> values. <br> For my layout's background I'm using <strong>?attr/colorAccent</strong>, so it can pick the background color based on the selected theme. <br> If I use any of the above values it works fine. But I want to define a custom item value for my background color.<br> I tried like this below but it didn't worked. any ideas to make it work ? <br> My custom theme with custom value: <br></p> <pre><code>&lt;style name = "customTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt; &lt;item name="colorPrimary"&gt;#4285f4&lt;/item&gt; &lt;item name="colorPrimaryDark"&gt;#2C75F2&lt;/item&gt; &lt;item name="colorAccent"&gt;#E1FFC7&lt;/item&gt; &lt;item name="customBgColor"&gt;#d3d3d3&lt;/item&gt; &lt;/style&gt; </code></pre> <p><br> And I want to use it in layout's style as <br></p> <pre><code>&lt;style name="layoutStyle" &gt; &lt;item name="android:background"&gt;?attr/customBgColor&lt;/item&gt; &lt;/style&gt; </code></pre>
0debug
PhantomJs: Can't find variable map : <p>I receive the following error:</p> <pre><code>INFO [karma]: Karma v0.13.9 server started at http://localhost:9018/ INFO [launcher]: Starting browser PhantomJS PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR ReferenceError: Can't find variable: Map at /Users/runtimeZero/code/vendor/inert/inert.min.js:589 </code></pre> <p>I understand that I am including a file called <a href="https://raw.githubusercontent.com/WICG/inert/master/dist/inert.js" rel="noreferrer">inert.js</a> which is using ES6 Map() . This is freaking out PhantomJs.</p> <p>So I included core-js/es6/map.js polyfill in my karma config under files. However that does not resolve the issue.</p> <p>Any tips ?</p>
0debug
Docker build complains it can't find nuget fallback package folder : <p>I'm following the tutorial at <a href="https://docs.microsoft.com/en-us/dotnet/core/docker/docker-basics-dotnet-core#dockerize-the-net-core-application" rel="noreferrer">https://docs.microsoft.com/en-us/dotnet/core/docker/docker-basics-dotnet-core#dockerize-the-net-core-application</a> in learning to containerise .net core applications into Docker.</p> <p>Other than changing the <code>Dockerfile</code> to point at <code>microsoft/dotnet:2.1-sdk</code> as a base image, and adding a <code>RUN dotnet --info</code> line to get version/environment information, everything else is the same. However, I'm getting an error on the <code>dotnet publish</code> step:</p> <pre><code>Step 7/8 : RUN dotnet publish -c Release -o out ---&gt; Running in 6739267c7581 Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved. Restore completed in 34.46 ms for /app/Hello.csproj. /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder'. [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders) [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(LockFile lockFile, String projectPath) [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task, Stream stream) [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/app/Hello.csproj] /usr/share/dotnet/sdk/2.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(198,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/app/Hello.csproj] The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1 </code></pre> <p>So far the only thing I can find on the subject is some github issues requesting that the fallback folder is ditched in Docker as it bloats the container. At this stage I'm not concerned too much about bloat, I just want it to build a hello world application.</p> <hr> <p>In case it is helpful the <code>dotnet --info</code> command returned the following:</p> <pre><code>Step 3/8 : RUN dotnet --info ---&gt; Running in 17dad2f04a7e .NET Core SDK (reflecting any global.json): Version: 2.1.401 Commit: 91b1c13032 Runtime Environment: OS Name: debian OS Version: 9 OS Platform: Linux RID: debian.9-x64 Base Path: /usr/share/dotnet/sdk/2.1.401/ Host (useful for support): Version: 2.1.3 Commit: 124038c13e .NET Core SDKs installed: 2.1.401 [/usr/share/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download </code></pre>
0debug
foo(bar) and foo(bar, baz) : <p>In ES6, is it possible to have some code like this:</p> <pre><code>class MyClass { foo(bar) { console.log(bar + "Bar") } foo(bar, baz) { console.log(bar + baz + "Bar baz") } } </code></pre> <p>so that when I did:</p> <pre><code>MyClass.foo("Hello, ", "World and ") </code></pre> <p>I would get:</p> <pre><code>Hello, World and Bar baz </code></pre> <p>And I would be able to do:</p> <pre><code>MyClass.foo("Hello, world!") </code></pre> <p>to get:</p> <pre><code>Hello, world!Bar </code></pre> <p>like in Java?</p>
0debug
How do I type an object with known and unknown keys in TypeScript : <p>I am looking for a way to create TypeScript types for the following object that has two known keys and one unknown key that has a known type:</p> <pre><code>interface ComboObject { known: boolean field: number [U: string]: string } const comboObject: ComboObject = { known: true field: 123 unknownName: 'value' } </code></pre> <p>That code does not work because TypeScript requires that all properties match the type of the given index signature. However, I am not looking to use index signatures, I want to type a single field where I know its type but I do not know its name.</p> <p>The only solution I have so far is to use index signatures and set up a union type of all possible types:</p> <pre><code>interface ComboObject { [U: string]: boolean | number | string } </code></pre> <p>But that has many drawbacks including allowing incorrect types on the known fields as well as allowing an arbitrary number of unknown keys.</p> <p>Is there a better approach? Could something with TypeScript 2.8 conditional types help?</p>
0debug
static int check_intra_pred_mode(int mode, int mb_x, int mb_y) { if (mode == DC_PRED8x8) { if (!(mb_x|mb_y)) mode = DC_128_PRED8x8; else if (!mb_y) mode = LEFT_DC_PRED8x8; else if (!mb_x) mode = TOP_DC_PRED8x8; } return mode; }
1threat